From patchwork Mon Oct 3 14:23:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Sylvestre X-Patchwork-Id: 17502 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9F320C0DA4 for ; Mon, 3 Oct 2022 14:24:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E221A601C1; Mon, 3 Oct 2022 16:24:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664807046; bh=QcOlkzmEjk7fY1Ess5PIarLSo6ZEqTSJegf9Hw1M5zY=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=AvFcg0QzE6OCWS9HxNXWBxoMv+/d5zRSXoDnoRTB8Dxo07T19vO0WNPTFa+eYr0m6 WcMbawdGUxZeL6d9zQmuXc2YsjIeju0H0GJYpcoKRqO2bFMLHuVsQsjTl4zPiDhbyA LNB8DkBTcheWTLRxSRn4HMzmcnNC0SRBZhzfenHCoD/ukoQ0Uv6w4kHWl5I1z0a/h3 JcLjpVZjXL1UeBkXMxjID9lS4ycIJ3v6rQPIo+pVhNVAm2nvByJ6T8WQYnyROgK8nz em46i+YzLRaL0NLm7HBJcmxFLKU+s7Cy4wmD+d2eItIW6yfjTH1NtcJy0jWbR3Cq5r XLRdUpBTrOovQ== Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 996DA600E9 for ; Mon, 3 Oct 2022 16:24:05 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="MoSniiia"; dkim-atps=neutral Received: by mail-wr1-x42d.google.com with SMTP id bq9so16999398wrb.4 for ; Mon, 03 Oct 2022 07:24:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=IFKBrx5R6kPwYsDZk05O0kn5O7R/cXaOGkjB/RkVR28=; b=MoSniiiaFTXNNnhZz0RkU6+NIwyxX+9vpVKo8jT5NFELJ3v/2TUTTy13peCQX49g0U 4BBH/Ru8TU2igyRWnSfoqwHGFXyNDw4b3nPTvdV50uploXlnC/AXGctEvRwT5AsxkZy+ ld+i0RzuqkZdrxhEz9eCju0DJjpiQFWIEJXDR9DSEqZODznB5syuEVr25EHrVJbin4XZ Mu8rs0Ly8BGavHGjJxgr17/xkx2jh+66JJUNFwPHzHkZTdMmM5OmqLXZbygGaYdtO5xC vFoAy3dOOC4dcd8zY5CPhUnGlQeWBHolaOgF4HQhk+6tHmk1BDFNQTIIEkO+WHUdC9zE ntKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=IFKBrx5R6kPwYsDZk05O0kn5O7R/cXaOGkjB/RkVR28=; b=WKm0oxpbyBWEzDOMRNlxgzNT0ir142qe0MuPntmgnvvUQqecFF7GVrdlXMRIdNbECi I86D+qfih5ah0BX1cMrfl8TkqXCpf7QsEMCVTHOSqoTnChCpkSDQ6AIPNxVPhBT0BvAs 8sxxQc9CVWEoiJIErwCku4GVT4Sa5UoqkY3iijrdrfz8j3YLGQBLqhCc77+lnQFLEcXN NTLURJsT0fULuRx5GvJHo8cyTtXqWsd42vbRXRj7B/6qvS/zfa84N31FYNgFFMz0Hx/q 5nHFsh6pCs+Rt4MxIe34frJGVLmuSC/nC0umMIsYzE0Aj2PgE4bNCIwBL18SSIGRdAaS /fvg== X-Gm-Message-State: ACrzQf2uo4xdd7gCrr3DWW1Mx2/jJtf+OBGnkWWGYqcfvcXp24bJ79Q3 t7KUxlO+Pntfjuk5VWnFA4OFL63439qETQ== X-Google-Smtp-Source: AMsMyM7kLaiTTGt68d8YBNtZSG+Ja9w6Ypd/77gRqfnrPidNRDIuEALVBzQeye4NIfEa3SdTUx/S+g== X-Received: by 2002:a5d:6301:0:b0:226:d87b:b55c with SMTP id i1-20020a5d6301000000b00226d87bb55cmr12611014wru.560.1664807044895; Mon, 03 Oct 2022 07:24:04 -0700 (PDT) Received: from BL087.. ([2a01:e34:eea9:e630:b89c:8d5f:fc22:ea71]) by smtp.gmail.com with ESMTPSA id bt4-20020a056000080400b0022cd96b3ba6sm12814031wrb.90.2022.10.03.07.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Oct 2022 07:24:04 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 3 Oct 2022 16:23:55 +0200 Message-Id: <20221003142357.602633-1-fsylvestre@baylibre.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 0/2] Take into account color temperature during LSC algorithm for rkisp1 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Sylvestre via libcamera-devel From: Florian Sylvestre Reply-To: Florian Sylvestre Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" First brick to have an adaptive LSC algorithm on Rkisp1: add LSC coefficients sets in YAML tuning file depending of color temperature. For this version the computation of coefficients regarding the current computed color temperature is done inside prepare() method. For reference: the computation time has been measured at an average 135us on an Imx8Mp board. The different coefficients are computed by doing a linear interpolation with the two coefficients sets that have the closer color temperature values. In case the current color temperature is 'out of bound' the closest set is used. The LSC can work with a single set in case of monochrome sensor for example. The 'grad' and 'size' tables are now computed in configure() to gain some time by doing only a memcpy() of them during prepare(). Modifications in V3: - Rebased on top of "ipa: rkisp1: Remove initialized_ flags from algorithms" - Add specific check if there is a single LSC set: Remove out-of-bound access while looking for correct set. - Minor cleanup Modifications in V2: - The single commit has been splited into two commits. The first one only contains the move of LSC parameters computation in configure(). - LSC parameters are no more re-computed when there is small color temperature variations between two frames. - LSC parameters are not interpolated when the actual color temperature is close to one defined in the tuning parameters sets. - Minor typo/cleanups Florian Sylvestre (2): ipa: rkisp1: Compute LSC algorithm parameter during configure ipa: rkisp1: Take into account color temperature during LSC algorithm src/ipa/rkisp1/algorithms/lsc.cpp | 191 +++++++++++++++++++----- src/ipa/rkisp1/algorithms/lsc.h | 25 +++- src/ipa/rkisp1/data/ov5640.yaml | 231 ++++++++++++++++++++---------- 3 files changed, 328 insertions(+), 119 deletions(-)