Patch Detail
Show a patch.
GET /api/patches/17461/?format=api
{ "id": 17461, "url": "https://patchwork.libcamera.org/api/patches/17461/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17461/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220929091245.2159838-2-fsylvestre@baylibre.com>", "date": "2022-09-29T09:12:44", "name": "[libcamera-devel,v2,1/2] ipa: rkisp1: Compute LSC algorithm parameter during configure", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "025d01245cb1ba0e550b1f95197dbb766a513561", "submitter": { "id": 123, "url": "https://patchwork.libcamera.org/api/people/123/?format=api", "name": "Florian Sylvestre", "email": "fsylvestre@baylibre.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17461/mbox/", "series": [ { "id": 3513, "url": "https://patchwork.libcamera.org/api/series/3513/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3513", "date": "2022-09-29T09:12:43", "name": "Take into account color temperature during LSC algorithm for rkisp1", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3513/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17461/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17461/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C7F8EC327E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 29 Sep 2022 09:12:53 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 768A562385;\n\tThu, 29 Sep 2022 11:12:53 +0200 (CEST)", "from mail-wm1-x332.google.com (mail-wm1-x332.google.com\n\t[IPv6:2a00:1450:4864:20::332])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CF4B86237B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 29 Sep 2022 11:12:50 +0200 (CEST)", "by mail-wm1-x332.google.com with SMTP id l8so515271wmi.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 29 Sep 2022 02:12:50 -0700 (PDT)", "from BL087.. ([2a01:e34:eea9:e630:71fe:49b1:81cf:acfb])\n\tby smtp.gmail.com with ESMTPSA id\n\tg15-20020a5d554f000000b0022cc7c32309sm2454588wrw.115.2022.09.29.02.12.49\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 29 Sep 2022 02:12:49 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664442773;\n\tbh=/nXzcIwh0WjaDeVdEBkTG/iCyOsx3J39uCvha8qjNGQ=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=MgIPHs3H6c9J3PG6QT+yvPHCy/WZ7qe3FjJl81xgMHS+rSFVFZglbhKeBMMoKTY+Q\n\tMlo7kHFJrhvDa6KZrGGBg3Q4VJmnxE7bWmmTJLKPwIdSY9RbOIDM1bIcTi0nNtmjUn\n\tR4RyH3Ggq44M6UTVN8qmNxU7kxPiTZjn/X+62bLqyoE7c+QMxkkLXuyxCylhVZ7C3a\n\tpIYf5KVzkYmPHGmXaAsS2wSoHtC9Jj/l5t+WprHC0ReSNwQrN+zqJg1uPpwoQXDN84\n\tVL/gF2YYfyiQid68b9GEY9JXeIrU2gd/Za8yomazoxPNhNkQ0e2dgXkSRkKE3hBddo\n\t+FwXOQJMr2SGg==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20210112.gappssmtp.com; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date;\n\tbh=/mGt/gGFBqmEZ4w4ZlbeLCfqAr4w+gUPiNzwljHm4Nw=;\n\tb=33x4sdSyu5xCK74B3vFJA9lTPrTdBkNdLZdlapQ7dLlabS74gXxLeLDOrazZv/BSvn\n\t1fJukvBjF8fwGbrBaqbULDEveYr4RNVcHZJn9bggZ0rdkpK6lmNMI45W/i16zH5WzHFM\n\tiOBrVORwgeqzNu0OieSbPjDqGvq5njNRHZpM/weA6umiInePvt3Yo3pNU2e5Jsr8H/pY\n\tWaBUEyBhSfkIJAG4S3emfTLc20K4D/Ft2jrHAYJrgnhdT9Q/U6YkJ7BOnm7Al+/Ww4nE\n\tkCMUWjcJnYpEbJgQDEP18s/8ieR+z7X+F6YNOsasP9ExoGtB36FTWTIfBqAc5qJv5pXt\n\tseQA==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20210112.gappssmtp.com\n\theader.i=@baylibre-com.20210112.gappssmtp.com header.b=\"33x4sdSy\"; \n\tdkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date;\n\tbh=/mGt/gGFBqmEZ4w4ZlbeLCfqAr4w+gUPiNzwljHm4Nw=;\n\tb=ld8qkHLXjxUS4S4X9savrWdnkrxuUafTpvBmtwZFobXAhCgjhrHKd/SQr0kRCzhtbA\n\tXSNqS0LhX6oakfWhEHLevbNqzDQqkgqx9b8GYcahsMsuCVh9P07/x0SW7dmYCIZOQpa/\n\tQMHWB6W6MQOnbKFvHqa3YqCbsTMGSQiD66WQtJgZ8Y+fMPbLKA3hbOn1S0RZd3LsryGP\n\tWU+T4LP8wVqU5XJzROSFKkvFwMlm6fCakd6sWZk9SBVG4+MBuGGbSMTUBUhsNXht+OuQ\n\tg/vUWdbUmDOpIQHVA/sHihihhfKc09u+4CaQOSUkdncGKH3wMYaE9mRC977wd1N1wIWe\n\trsgg==", "X-Gm-Message-State": "ACrzQf2ZaqxzQmMu6Ictg4uzOVW2RSmkg7fyoqAnyS7es2bI8GelhDJk\n\t08HnNn4UFdNpi2/HsD//hUUCTJahFzKUjw==", "X-Google-Smtp-Source": "AMsMyM4PDZnsIT2ejEJGmPM10zI9RKAyAWWlkK0GAP9YzMOAIi4gBF6H2i3/MQASB5ARq/l4Y9G2SA==", "X-Received": "by 2002:a05:600c:a48:b0:3b3:3256:63c with SMTP id\n\tc8-20020a05600c0a4800b003b33256063cmr1477117wmq.34.1664442770253; \n\tThu, 29 Sep 2022 02:12:50 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 29 Sep 2022 11:12:44 +0200", "Message-Id": "<20220929091245.2159838-2-fsylvestre@baylibre.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20220929091245.2159838-1-fsylvestre@baylibre.com>", "References": "<20220929091245.2159838-1-fsylvestre@baylibre.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 1/2] ipa: rkisp1: Compute LSC algorithm\n\tparameter during configure", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "From": "Florian Sylvestre via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Florian Sylvestre <fsylvestre@baylibre.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "LSC gradient parameters where initially computed during prepare() phase.\nBecause these parameters can be computed only one time and stays constant for\neach frame after: move the computation to the configure() function.\n\nSigned-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n---\n src/ipa/rkisp1/algorithms/lsc.cpp | 66 ++++++++++++++++++-------------\n src/ipa/rkisp1/algorithms/lsc.h | 4 ++\n 2 files changed, 42 insertions(+), 28 deletions(-)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\nindex 44245caa..b1f39dfd 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.cpp\n+++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n@@ -125,30 +125,15 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n int LensShadingCorrection::configure(IPAContext &context,\n \t\t\t\t [[maybe_unused]] const IPACameraSensorInfo &configInfo)\n {\n-\tcontext.configuration.lsc.enabled = initialized_;\n-\treturn 0;\n-}\n-\n-/**\n- * \\copydoc libcamera::ipa::Algorithm::prepare\n- */\n-void LensShadingCorrection::prepare(IPAContext &context, const uint32_t frame,\n-\t\t\t\t [[maybe_unused]] IPAFrameContext &frameContext,\n-\t\t\t\t rkisp1_params_cfg *params)\n-{\n-\tif (frame > 0)\n-\t\treturn;\n-\n \tif (!initialized_)\n-\t\treturn;\n+\t\treturn EINVAL;\n \n-\tstruct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;\n \tconst Size &size = context.configuration.sensor.size;\n \tSize totalSize{};\n \n \tfor (unsigned int i = 0; i < RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE; ++i) {\n-\t\tconfig.x_size_tbl[i] = xSize_[i] * size.width;\n-\t\tconfig.y_size_tbl[i] = ySize_[i] * size.height;\n+\t\txSizes_[i] = xSize_[i] * size.width;\n+\t\tySizes_[i] = ySize_[i] * size.height;\n \n \t\t/*\n \t\t * To prevent unexpected behavior of the ISP, the sum of x_size_tbl and\n@@ -157,25 +142,50 @@ void LensShadingCorrection::prepare(IPAContext &context, const uint32_t frame,\n \t\t * rounding-induced errors.\n \t\t */\n \t\tif (i == RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE - 1) {\n-\t\t\tconfig.x_size_tbl[i] = size.width / 2 - totalSize.width;\n-\t\t\tconfig.y_size_tbl[i] = size.height / 2 - totalSize.height;\n+\t\t\txSizes_[i] = size.width / 2 - totalSize.width;\n+\t\t\tySizes_[i] = size.height / 2 - totalSize.height;\n \t\t}\n \n-\t\ttotalSize.width += config.x_size_tbl[i];\n-\t\ttotalSize.height += config.y_size_tbl[i];\n+\t\ttotalSize.width += xSizes_[i];\n+\t\ttotalSize.height += ySizes_[i];\n \n-\t\tconfig.x_grad_tbl[i] = std::round(32768 / config.x_size_tbl[i]);\n-\t\tconfig.y_grad_tbl[i] = std::round(32768 / config.y_size_tbl[i]);\n+\t\txGrad_[i] = std::round(32768 / xSizes_[i]);\n+\t\tyGrad_[i] = std::round(32768 / ySizes_[i]);\n \t}\n \n+\tcontext.configuration.lsc.enabled = true;\n+\treturn 0;\n+}\n+\n+/**\n+ * \\copydoc libcamera::ipa::Algorithm::prepare\n+ */\n+void LensShadingCorrection::prepare([[maybe_unused]] IPAContext &context,\n+\t\t\t\t const uint32_t frame,\n+\t\t\t\t [[maybe_unused]] IPAFrameContext &frameContext,\n+\t\t\t\t rkisp1_params_cfg *params)\n+{\n+\tif (frame > 0)\n+\t\treturn;\n+\n+\tif (!initialized_)\n+\t\treturn;\n+\n+\tstruct rkisp1_cif_isp_lsc_config &config = params->others.lsc_config;\n+\n+\tmemcpy(config.x_grad_tbl, xGrad_, sizeof(config.x_grad_tbl));\n+\tmemcpy(config.y_grad_tbl, yGrad_, sizeof(config.y_grad_tbl));\n+\tmemcpy(config.x_size_tbl, xSizes_, sizeof(config.x_size_tbl));\n+\tmemcpy(config.y_size_tbl, ySizes_, sizeof(config.y_size_tbl));\n+\n \tstd::copy(rData_.begin(), rData_.end(),\n-\t\t ¶ms->others.lsc_config.r_data_tbl[0][0]);\n+\t\t &config.r_data_tbl[0][0]);\n \tstd::copy(grData_.begin(), grData_.end(),\n-\t\t ¶ms->others.lsc_config.gr_data_tbl[0][0]);\n+\t\t &config.gr_data_tbl[0][0]);\n \tstd::copy(gbData_.begin(), gbData_.end(),\n-\t\t ¶ms->others.lsc_config.gb_data_tbl[0][0]);\n+\t\t &config.gb_data_tbl[0][0]);\n \tstd::copy(bData_.begin(), bData_.end(),\n-\t\t ¶ms->others.lsc_config.b_data_tbl[0][0]);\n+\t\t &config.b_data_tbl[0][0]);\n \n \tparams->module_en_update |= RKISP1_CIF_ISP_MODULE_LSC;\n \tparams->module_ens |= RKISP1_CIF_ISP_MODULE_LSC;\ndiff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\nindex da957d3e..b5cd5047 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.h\n+++ b/src/ipa/rkisp1/algorithms/lsc.h\n@@ -35,6 +35,10 @@ private:\n \n \tstd::vector<double> xSize_;\n \tstd::vector<double> ySize_;\n+\tuint16_t xGrad_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n+\tuint16_t yGrad_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n+\tuint16_t xSizes_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n+\tuint16_t ySizes_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n };\n \n } /* namespace ipa::rkisp1::algorithms */\n", "prefixes": [ "libcamera-devel", "v2", "1/2" ] }