Show a patch.

GET /api/1.1/patches/17330/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 17330,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17330/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17330/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20220908014200.28728-22-laurent.pinchart@ideasonboard.com>",
    "date": "2022-09-08T01:41:49",
    "name": "[libcamera-devel,v4,21/32] ipa: rkisp1: cproc: Store per-frame information in frame context",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "120e2f0f47d16289fe2f658c36fbef441d989dac",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17330/mbox/",
    "series": [
        {
            "id": 3476,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3476/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3476",
            "date": "2022-09-08T01:41:28",
            "name": "ipa: Frame context queue, IPU3 & RkISP consolidation, and RkISP1 improvements",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/3476/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17330/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17330/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 44A8DC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  8 Sep 2022 01:42:49 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0B22B620E5;\n\tThu,  8 Sep 2022 03:42:49 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D2E9620E7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Sep 2022 03:42:47 +0200 (CEST)",
            "from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DE7176CC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  8 Sep 2022 03:42:46 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1662601369;\n\tbh=tO0gsFWQuTe0wdKJLk3/87qbHIdw/Lnh0RzFFOyT1i0=;\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=ZNUhnNRggvYRmPP0bcoM9CiFtGwqk21jgexSplcxnoYcEhrh7ZPu6OVOz3bXEyXgv\n\tU7cJNzxl+nTGMU2DrdABVmC81i9LU6HW6P/JQsTAe+yarI8HvGk349MYzNI2wVQVCi\n\tnBiYZJtVP3MHSRJ1ktKQXUzCImray74GOrDUklvzGhntznuV373FcMCB3f5hcCDBbC\n\trJx+UduARnlw2MssW3WMpw11L1JO5DFQuGqm+V9mrULrHNEecJBoxY99pxzdRwWi8W\n\tz2fgRqncDsiCDsS6ycjZfqnkGUXVuzV6Y3dj7BRwsraxENMnFUE84uLWUs1FZ3/EyK\n\tZsdPDLnpVTn6A==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1662601367;\n\tbh=tO0gsFWQuTe0wdKJLk3/87qbHIdw/Lnh0RzFFOyT1i0=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=CNgF287fCCGe3O6JV3EyQin5CW/VrJ3UXULxo8Qg1hXoFrI/zOZ6yiONG22hmdyDa\n\tZw+RArKckD/hWWMMK9aUP/18Nq3BYE4nOX04oeHARxIbhraUbJCifs5KLG/rv/iw4g\n\tFy2Se5FCg1BhdqeiRpwT6PWuW+qI0U4nqgEh6wL0="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"CNgF287f\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  8 Sep 2022 04:41:49 +0300",
        "Message-Id": "<20220908014200.28728-22-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.35.1",
        "In-Reply-To": "<20220908014200.28728-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20220908014200.28728-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 21/32] ipa: rkisp1: cproc: Store\n\tper-frame information in frame context",
        "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": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Rework the algorithm's usage of the active state, to store the value of\ncontrols for the last queued request in the queueRequest() function, and\nstore a copy of the values in the corresponding frame context. The\nlatter is used in the prepare() function to populate the ISP parameters\nwith values corresponding to the right frame.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/cproc.cpp | 51 ++++++++++++++++++-----------\n src/ipa/rkisp1/ipa_context.cpp      | 21 ++++++++++--\n src/ipa/rkisp1/ipa_context.h        |  8 ++++-\n 3 files changed, 56 insertions(+), 24 deletions(-)",
    "diff": "diff --git a/src/ipa/rkisp1/algorithms/cproc.cpp b/src/ipa/rkisp1/algorithms/cproc.cpp\nindex 22a70e0b70c7..9c442cd56b3f 100644\n--- a/src/ipa/rkisp1/algorithms/cproc.cpp\n+++ b/src/ipa/rkisp1/algorithms/cproc.cpp\n@@ -38,55 +38,66 @@ LOG_DEFINE_CATEGORY(RkISP1CProc)\n  */\n void ColorProcessing::queueRequest(IPAContext &context,\n \t\t\t\t   [[maybe_unused]] const uint32_t frame,\n-\t\t\t\t   [[maybe_unused]] RkISP1FrameContext &frameContext,\n+\t\t\t\t   RkISP1FrameContext &frameContext,\n \t\t\t\t   const ControlList &controls)\n {\n \tauto &cproc = context.activeState.cproc;\n+\tbool update = false;\n \n \tconst auto &brightness = controls.get(controls::Brightness);\n \tif (brightness) {\n-\t\tcproc.brightness = std::clamp<int>(std::lround(*brightness * 128), -128, 127);\n-\t\tcproc.updateParams = true;\n+\t\tint value = std::clamp<int>(std::lround(*brightness * 128), -128, 127);\n+\t\tif (cproc.brightness != value) {\n+\t\t\tcproc.brightness = value;\n+\t\t\tupdate = true;\n+\t\t}\n \n-\t\tLOG(RkISP1CProc, Debug) << \"Set brightness to \" << *brightness;\n+\t\tLOG(RkISP1CProc, Debug) << \"Set brightness to \" << value;\n \t}\n \n \tconst auto &contrast = controls.get(controls::Contrast);\n \tif (contrast) {\n-\t\tcproc.contrast = std::clamp<int>(std::lround(*contrast * 128), 0, 255);\n-\t\tcproc.updateParams = true;\n+\t\tint value = std::clamp<int>(std::lround(*contrast * 128), 0, 255);\n+\t\tif (cproc.contrast != value) {\n+\t\t\tcproc.contrast = value;\n+\t\t\tupdate = true;\n+\t\t}\n \n-\t\tLOG(RkISP1CProc, Debug) << \"Set contrast to \" << *contrast;\n+\t\tLOG(RkISP1CProc, Debug) << \"Set contrast to \" << value;\n \t}\n \n \tconst auto saturation = controls.get(controls::Saturation);\n \tif (saturation) {\n-\t\tcproc.saturation = std::clamp<int>(std::lround(*saturation * 128), 0, 255);\n-\t\tcproc.updateParams = true;\n+\t\tint value = std::clamp<int>(std::lround(*saturation * 128), 0, 255);\n+\t\tif (cproc.saturation != value) {\n+\t\t\tcproc.saturation = value;\n+\t\t\tupdate = true;\n+\t\t}\n \n-\t\tLOG(RkISP1CProc, Debug) << \"Set saturation to \" << *saturation;\n+\t\tLOG(RkISP1CProc, Debug) << \"Set saturation to \" << value;\n \t}\n+\n+\tframeContext.cproc.brightness = cproc.brightness;\n+\tframeContext.cproc.contrast = cproc.contrast;\n+\tframeContext.cproc.saturation = cproc.saturation;\n+\tframeContext.cproc.update = update;\n }\n \n /**\n  * \\copydoc libcamera::ipa::Algorithm::prepare\n  */\n-void ColorProcessing::prepare(IPAContext &context,\n+void ColorProcessing::prepare([[maybe_unused]] IPAContext &context,\n \t\t\t      [[maybe_unused]] const uint32_t frame,\n-\t\t\t      [[maybe_unused]] RkISP1FrameContext &frameContext,\n+\t\t\t      RkISP1FrameContext &frameContext,\n \t\t\t      rkisp1_params_cfg *params)\n {\n-\tauto &cproc = context.activeState.cproc;\n-\n \t/* Check if the algorithm configuration has been updated. */\n-\tif (!cproc.updateParams)\n+\tif (!frameContext.cproc.update)\n \t\treturn;\n \n-\tcproc.updateParams = false;\n-\n-\tparams->others.cproc_config.brightness = cproc.brightness;\n-\tparams->others.cproc_config.contrast = cproc.contrast;\n-\tparams->others.cproc_config.sat = cproc.saturation;\n+\tparams->others.cproc_config.brightness = frameContext.cproc.brightness;\n+\tparams->others.cproc_config.contrast = frameContext.cproc.contrast;\n+\tparams->others.cproc_config.sat = frameContext.cproc.saturation;\n \n \tparams->module_en_update |= RKISP1_CIF_ISP_MODULE_CPROC;\n \tparams->module_ens |= RKISP1_CIF_ISP_MODULE_CPROC;\ndiff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\nindex cd1443e1ed46..936b77709417 100644\n--- a/src/ipa/rkisp1/ipa_context.cpp\n+++ b/src/ipa/rkisp1/ipa_context.cpp\n@@ -160,9 +160,6 @@ namespace libcamera::ipa::rkisp1 {\n  *\n  * \\var IPAActiveState::cproc.saturation\n  * \\brief Saturation level\n- *\n- * \\var IPAActiveState::cproc.updateParams\n- * \\brief Indicates if ISP parameters need to be updated\n  */\n \n /**\n@@ -236,6 +233,24 @@ namespace libcamera::ipa::rkisp1 {\n  * \\brief Whether the Auto White Balance algorithm is enabled\n  */\n \n+/**\n+ * \\var RkISP1FrameContext::cproc\n+ * \\brief Color Processing parameters for this frame\n+ *\n+ * \\struct RkISP1FrameContext::cproc.brightness\n+ * \\brief Brightness level\n+ *\n+ * \\var RkISP1FrameContext::cproc.contrast\n+ * \\brief Contrast level\n+ *\n+ * \\var RkISP1FrameContext::cproc.saturation\n+ * \\brief Saturation level\n+ *\n+ * \\var RkISP1FrameContext::cproc.update\n+ * \\brief Indicates if the color processing parameters have been updated\n+ * compared to the previous frame\n+ */\n+\n /**\n  * \\var RkISP1FrameContext::sensor\n  * \\brief Sensor configuration that used been used for this frame\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex d97aae9a97b4..78edb607d039 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -75,7 +75,6 @@ struct IPAActiveState {\n \t\tint8_t brightness;\n \t\tuint8_t contrast;\n \t\tuint8_t saturation;\n-\t\tbool updateParams;\n \t} cproc;\n \n \tstruct {\n@@ -107,6 +106,13 @@ struct RkISP1FrameContext : public FrameContext {\n \t\tbool autoEnabled;\n \t} awb;\n \n+\tstruct {\n+\t\tint8_t brightness;\n+\t\tuint8_t contrast;\n+\t\tuint8_t saturation;\n+\t\tbool update;\n+\t} cproc;\n+\n \tstruct {\n \t\tuint32_t exposure;\n \t\tdouble gain;\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "21/32"
    ]
}