Patch Detail
Show a patch.
GET /api/patches/17503/?format=api
{ "id": 17503, "url": "https://patchwork.libcamera.org/api/patches/17503/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17503/", "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": "<20221003142357.602633-2-fsylvestre@baylibre.com>", "date": "2022-10-03T14:23:56", "name": "[libcamera-devel,v3,1/2] ipa: rkisp1: Compute LSC algorithm parameter during configure", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "8a350466334d4ad26ca54db548e2dd4bf2906029", "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/17503/mbox/", "series": [ { "id": 3525, "url": "https://patchwork.libcamera.org/api/series/3525/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3525", "date": "2022-10-03T14:23:55", "name": "Take into account color temperature during LSC algorithm for rkisp1", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3525/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17503/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17503/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 C5727C327C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 3 Oct 2022 14:24:08 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 611FE601C5;\n\tMon, 3 Oct 2022 16:24:08 +0200 (CEST)", "from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com\n\t[IPv6:2a00:1450:4864:20::42d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3E571600E9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 3 Oct 2022 16:24:06 +0200 (CEST)", "by mail-wr1-x42d.google.com with SMTP id a10so4651968wrm.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 03 Oct 2022 07:24:06 -0700 (PDT)", "from BL087.. ([2a01:e34:eea9:e630:b89c:8d5f:fc22:ea71])\n\tby smtp.gmail.com with ESMTPSA id\n\tbt4-20020a056000080400b0022cd96b3ba6sm12814031wrb.90.2022.10.03.07.24.05\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 03 Oct 2022 07:24:05 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1664807048;\n\tbh=DKOUnhShlLbKrYV5cyjtaWMvckcaHAjGmf1dKW30C2g=;\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=mPI8RaQTw5+j116Tz5IRs8bt2WMd1CBF6nJHM5FwJZcF3Kz5op+B32R9odbbNtzMJ\n\t9ri31vpDHNZNQV1GPOkvxMgYlaKVoVuPcc/QZcmNufum8VzA4g9oFxgHZsEIQnUDIt\n\thcvXXTvxXfzL1cE2wEWVov9kXHzrYAiVy+GvO19Mdsb1FzXruHTO4ZHhBLIVmQlc1F\n\tmmpUGb3hIx5+Dz3hQa0LoltsMzeIWT0r4Iwok+GaYG24/FZ3hASe6s9csqNjdPmWvn\n\tU315lkIeReMG8fOvEp+vheaLx6goyF0xDiTyG6gd2/kVe1MB6JUaCnSdO+WtWyvJ1J\n\tt1oLhNsq447Jg==", "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=1viFbPOyJM227fdqsP6Fo0vsMl1d6/JhNbzsfoPk6I4=;\n\tb=qbCZPSwxsR3kTAYEOssZomgR4WRaeXvkWTYoq5xZvW4iCpc+vPLhhGj+ks5ycg+KSA\n\t3Wx/wJrA9dm8ki6FANFPkbhG0M7O6/VcblPFg9+AddOYChzV+84MCfDZYwvY3kkTjcec\n\tXwDl7yjUyuinGwPqIq5LAvI0yE2VKS/q+/0aDJsIArWplljW8zxacV+g/SnMVRNjr2Au\n\t8dRQ0ZjgfW0H7plNs8L3gyMdmc2BAgaiq87QjSTKNPnlX53ppEg4DWVWsvXl82evgsQ+\n\tIb2RoY3RYlTOiYVSMMWo/hMn3JzNDm3oSo0WykVtVXxsRJALI83UEgNa3nHXXWs5V8H0\n\tvAbg==" ], "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=\"qbCZPSwx\"; \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=1viFbPOyJM227fdqsP6Fo0vsMl1d6/JhNbzsfoPk6I4=;\n\tb=f2VDRhJM9Ex24j7XXsm1u+AMwMdZ6k6YoRF3vHiMjeeGFVoFqBfOrvqa7Ui3WPYaDJ\n\tWbCHgEsvq0lQ8yFOgDdCHRp8oT226ovR5v9D0xD+748iKgHFai36t0jWM+/zE6yXEBb4\n\tIOI4ckRDzbL1ZioSdfjiFLvVaG/grQRdKuvpU9pTLnDGhBV5axd27VnWbpTTX5NV4Ylj\n\twDDIshTUuStWTUUdryXG3gJJ3uN83teAkn9nGCOodJNt7Tt6VtMys0/sMqPuHW2GSAJ+\n\tCYAiC1npVOGx/76RhfRm6hC19IUE5kC0vcXsBZm8jUCHIaKx8spO5FQwMWSbqbCLLA3P\n\t3nDw==", "X-Gm-Message-State": "ACrzQf2C9cZjZT/84xboXFWmV1O3N3Zeujrld6SV4qGqaZX0Uy7vy3Et\n\ttHZWXO3wc9gerd9PkhhZHldkJ5OUROTsLg==", "X-Google-Smtp-Source": "AMsMyM7Mwmh52NdC9n6M0I9nnPSyx5D0vSu+B43zxrQDoSRvQ/ZeL0c+3XGxqFHpuIXrySpl7j8uMw==", "X-Received": "by 2002:adf:fec6:0:b0:22e:3218:f7e1 with SMTP id\n\tq6-20020adffec6000000b0022e3218f7e1mr5800072wrs.522.1664807045699; \n\tMon, 03 Oct 2022 07:24:05 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 3 Oct 2022 16:23:56 +0200", "Message-Id": "<20221003142357.602633-2-fsylvestre@baylibre.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20221003142357.602633-1-fsylvestre@baylibre.com>", "References": "<20221003142357.602633-1-fsylvestre@baylibre.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 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 are currently computed during prepare() phase.\nBecause these parameters can be computed only one time and stay constant for\neach frame after, move the computation to the configure() function.\n\nSigned-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/ipa/rkisp1/algorithms/lsc.cpp | 61 +++++++++++++++++--------------\n src/ipa/rkisp1/algorithms/lsc.h | 4 ++\n 2 files changed, 38 insertions(+), 27 deletions(-)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\nindex 102535bd..ad64aeb4 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.cpp\n+++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n@@ -122,27 +122,12 @@ 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 = true;\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-\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@@ -151,25 +136,47 @@ 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+\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 6c052669..da81ea53 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.h\n+++ b/src/ipa/rkisp1/algorithms/lsc.h\n@@ -33,6 +33,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", "v3", "1/2" ] }