Patch Detail
Show a patch.
GET /api/1.1/patches/16717/?format=api
{ "id": 16717, "url": "https://patchwork.libcamera.org/api/1.1/patches/16717/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16717/", "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": "<20220721121310.1286862-6-kieran.bingham@ideasonboard.com>", "date": "2022-07-21T12:13:03", "name": "[libcamera-devel,RFC,05/12] ipa: rkisp1: Rename frameContext to activeState", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "b0e32d16751a7e91b363f2947edb34ce8e213c07", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/1.1/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": { "id": 11, "url": "https://patchwork.libcamera.org/api/1.1/users/11/?format=api", "username": "kbingham", "first_name": "Kieran", "last_name": "Bingham", "email": "kieran.bingham@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/16717/mbox/", "series": [ { "id": 3313, "url": "https://patchwork.libcamera.org/api/1.1/series/3313/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3313", "date": "2022-07-21T12:12:58", "name": "libcamera: Align IPU3 and RKISP1 interfaces", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3313/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16717/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16717/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 2C44ABD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 Jul 2022 12:13:24 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 415A66331B;\n\tThu, 21 Jul 2022 14:13:22 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E35EF603F1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 21 Jul 2022 14:13:14 +0200 (CEST)", "from Monstersaurus.local\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 917DD13B9;\n\tThu, 21 Jul 2022 14:13:14 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658405602;\n\tbh=3MunA7vIsgIBxPOjXa7eh6kSvRtNGVw534+CQjCpQYA=;\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=mJpfuLe7a2jXkSik78/dPidznn7JerQalyherD/YL+eLVOnyJPYm6YhG5lZAqcdtS\n\t2TDm0DgXhk6m/eJSjo/4CD02PdDiPjzuXvRqVmZGSSeErm5smlKCiYAGZ/Y4ul1Qdg\n\tNov11PbcC5asowrJC1wb++jmtG4BijGYMWUYyOSykmw6fbe1ViIlsgdvOF1YT+4ceI\n\t+XZbHOvhZGPWlVGNH311A46hPJ1cwUBbfCYK0iUV9u7mu9GuVbbytiNL3U2OhraZYi\n\tH11CInSXz+1Nfbg64iy8Zi0fJYFgiNC0kv46pmnMxqwLIvPKS8wQf9C3bjtoDcKQ2R\n\t3/2uYtEfsmpLQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658405594;\n\tbh=3MunA7vIsgIBxPOjXa7eh6kSvRtNGVw534+CQjCpQYA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Rn1ahXxvnrbqvDA2dh+ocnFLEeaKV6cGKNCpHTPoOzJMWHI1XDPqX/dUQZNwoCboV\n\tq88iN6dgkGYgFTw5PGQn5q4QIYjunz+mnnukUC4NvKq5W5TnjSNoVudiB5vSdT69UQ\n\t0GGrJppLKXAs3ypSN+iarOIOUJXNveUoYX4WUkTs=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Rn1ahXxv\"; dkim-atps=neutral", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Date": "Thu, 21 Jul 2022 13:13:03 +0100", "Message-Id": "<20220721121310.1286862-6-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20220721121310.1286862-1-kieran.bingham@ideasonboard.com>", "References": "<20220721121310.1286862-1-kieran.bingham@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [RFC PATCH 05/12] ipa: rkisp1: Rename\n\tframeContext to activeState", "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": "Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Move the existing frame context structure to the IPAActiveState.\nThis structure should store the most up to date results for the IPA\nwhich may be shared to other algorithms that operate on the data.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/rkisp1/algorithms/agc.cpp | 20 +++++++++---------\n src/ipa/rkisp1/algorithms/awb.cpp | 34 +++++++++++++++----------------\n src/ipa/rkisp1/algorithms/blc.cpp | 2 +-\n src/ipa/rkisp1/ipa_context.h | 7 +++++--\n src/ipa/rkisp1/rkisp1.cpp | 12 +++++------\n 5 files changed, 39 insertions(+), 36 deletions(-)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex a1bb7d972926..483e941fe427 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -73,8 +73,8 @@ Agc::Agc()\n int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n {\n \t/* Configure the default exposure and gain. */\n-\tcontext.frameContext.agc.gain = std::max(context.configuration.agc.minAnalogueGain, kMinAnalogueGain);\n-\tcontext.frameContext.agc.exposure = 10ms / context.configuration.sensor.lineDuration;\n+\tcontext.activeState.agc.gain = std::max(context.configuration.agc.minAnalogueGain, kMinAnalogueGain);\n+\tcontext.activeState.agc.exposure = 10ms / context.configuration.sensor.lineDuration;\n \n \t/*\n \t * According to the RkISP1 documentation:\n@@ -98,7 +98,7 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n \tcontext.configuration.agc.measureWindow.h_size = 3 * configInfo.outputSize.width / 4;\n \tcontext.configuration.agc.measureWindow.v_size = 3 * configInfo.outputSize.height / 4;\n \n-\t/* \\todo Use actual frame index by populating it in the frameContext. */\n+\t/* \\todo Use actual frame index by populating it in the activeState. */\n \tframeCount_ = 0;\n \treturn 0;\n }\n@@ -140,18 +140,18 @@ utils::Duration Agc::filterExposure(utils::Duration exposureValue)\n \n /**\n * \\brief Estimate the new exposure and gain values\n- * \\param[inout] frameContext The shared IPA frame Context\n+ * \\param[inout] context The shared IPA Context\n * \\param[in] yGain The gain calculated on the current brightness level\n * \\param[in] iqMeanGain The gain calculated based on the relative luminance target\n */\n void Agc::computeExposure(IPAContext &context, double yGain, double iqMeanGain)\n {\n \tIPASessionConfiguration &configuration = context.configuration;\n-\tIPAFrameContext &frameContext = context.frameContext;\n+\tIPAActiveState &activeState = context.activeState;\n \n \t/* Get the effective exposure and gain applied on the sensor. */\n-\tuint32_t exposure = frameContext.sensor.exposure;\n-\tdouble analogueGain = frameContext.sensor.gain;\n+\tuint32_t exposure = activeState.sensor.exposure;\n+\tdouble analogueGain = activeState.sensor.gain;\n \n \t/* Use the highest of the two gain estimates. */\n \tdouble evGain = std::max(yGain, iqMeanGain);\n@@ -216,8 +216,8 @@ void Agc::computeExposure(IPAContext &context, double yGain, double iqMeanGain)\n \t\t\t << stepGain;\n \n \t/* Update the estimated exposure and gain. */\n-\tframeContext.agc.exposure = shutterTime / configuration.sensor.lineDuration;\n-\tframeContext.agc.gain = stepGain;\n+\tactiveState.agc.exposure = shutterTime / configuration.sensor.lineDuration;\n+\tactiveState.agc.gain = stepGain;\n }\n \n /**\n@@ -324,7 +324,7 @@ void Agc::process(IPAContext &context,\n */\n void Agc::prepare(IPAContext &context, rkisp1_params_cfg *params)\n {\n-\tif (context.frameContext.frameCount > 0)\n+\tif (context.activeState.frameCount > 0)\n \t\treturn;\n \n \t/* Configure the measurement window. */\ndiff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp\nindex 9f00364d12b1..427aaeb1e955 100644\n--- a/src/ipa/rkisp1/algorithms/awb.cpp\n+++ b/src/ipa/rkisp1/algorithms/awb.cpp\n@@ -35,9 +35,9 @@ LOG_DEFINE_CATEGORY(RkISP1Awb)\n int Awb::configure(IPAContext &context,\n \t\t const IPACameraSensorInfo &configInfo)\n {\n-\tcontext.frameContext.awb.gains.red = 1.0;\n-\tcontext.frameContext.awb.gains.blue = 1.0;\n-\tcontext.frameContext.awb.gains.green = 1.0;\n+\tcontext.activeState.awb.gains.red = 1.0;\n+\tcontext.activeState.awb.gains.blue = 1.0;\n+\tcontext.activeState.awb.gains.green = 1.0;\n \n \t/*\n \t * Define the measurement window for AWB as a centered rectangle\n@@ -72,16 +72,16 @@ uint32_t Awb::estimateCCT(double red, double green, double blue)\n */\n void Awb::prepare(IPAContext &context, rkisp1_params_cfg *params)\n {\n-\tparams->others.awb_gain_config.gain_green_b = 256 * context.frameContext.awb.gains.green;\n-\tparams->others.awb_gain_config.gain_blue = 256 * context.frameContext.awb.gains.blue;\n-\tparams->others.awb_gain_config.gain_red = 256 * context.frameContext.awb.gains.red;\n-\tparams->others.awb_gain_config.gain_green_r = 256 * context.frameContext.awb.gains.green;\n+\tparams->others.awb_gain_config.gain_green_b = 256 * context.activeState.awb.gains.green;\n+\tparams->others.awb_gain_config.gain_blue = 256 * context.activeState.awb.gains.blue;\n+\tparams->others.awb_gain_config.gain_red = 256 * context.activeState.awb.gains.red;\n+\tparams->others.awb_gain_config.gain_green_r = 256 * context.activeState.awb.gains.green;\n \n \t/* Update the gains. */\n \tparams->module_cfg_update |= RKISP1_CIF_ISP_MODULE_AWB_GAIN;\n \n \t/* If we already have configured the gains and window, return. */\n-\tif (context.frameContext.frameCount > 0)\n+\tif (context.activeState.frameCount > 0)\n \t\treturn;\n \n \t/* Configure the gains to apply. */\n@@ -125,7 +125,7 @@ void Awb::process([[maybe_unused]] IPAContext &context,\n {\n \tconst rkisp1_cif_isp_stat *params = &stats->params;\n \tconst rkisp1_cif_isp_awb_stat *awb = ¶ms->awb;\n-\tIPAFrameContext &frameContext = context.frameContext;\n+\tIPAActiveState &activeState = context.activeState;\n \n \t/* Get the YCbCr mean values */\n \tdouble yMean = awb->awb_mean[0].mean_y_or_g;\n@@ -157,22 +157,22 @@ void Awb::process([[maybe_unused]] IPAContext &context,\n \n \t/* Filter the values to avoid oscillations. */\n \tdouble speed = 0.2;\n-\tredGain = speed * redGain + (1 - speed) * frameContext.awb.gains.red;\n-\tblueGain = speed * blueGain + (1 - speed) * frameContext.awb.gains.blue;\n+\tredGain = speed * redGain + (1 - speed) * activeState.awb.gains.red;\n+\tblueGain = speed * blueGain + (1 - speed) * activeState.awb.gains.blue;\n \n \t/*\n \t * Gain values are unsigned integer value, range 0 to 4 with 8 bit\n \t * fractional part.\n \t */\n-\tframeContext.awb.gains.red = std::clamp(redGain, 0.0, 1023.0 / 256);\n-\tframeContext.awb.gains.blue = std::clamp(blueGain, 0.0, 1023.0 / 256);\n+\tactiveState.awb.gains.red = std::clamp(redGain, 0.0, 1023.0 / 256);\n+\tactiveState.awb.gains.blue = std::clamp(blueGain, 0.0, 1023.0 / 256);\n \t/* Hardcode the green gain to 1.0. */\n-\tframeContext.awb.gains.green = 1.0;\n+\tactiveState.awb.gains.green = 1.0;\n \n-\tframeContext.awb.temperatureK = estimateCCT(redMean, greenMean, blueMean);\n+\tactiveState.awb.temperatureK = estimateCCT(redMean, greenMean, blueMean);\n \n-\tLOG(RkISP1Awb, Debug) << \"Gain found for red: \" << context.frameContext.awb.gains.red\n-\t\t\t << \" and for blue: \" << context.frameContext.awb.gains.blue;\n+\tLOG(RkISP1Awb, Debug) << \"Gain found for red: \" << context.activeState.awb.gains.red\n+\t\t\t << \" and for blue: \" << context.activeState.awb.gains.blue;\n }\n \n REGISTER_IPA_ALGORITHM(Awb, \"Awb\")\ndiff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp\nindex a58569fa2dc2..4d55a2d529cb 100644\n--- a/src/ipa/rkisp1/algorithms/blc.cpp\n+++ b/src/ipa/rkisp1/algorithms/blc.cpp\n@@ -68,7 +68,7 @@ int BlackLevelCorrection::init([[maybe_unused]] IPAContext &context,\n void BlackLevelCorrection::prepare(IPAContext &context,\n \t\t\t\t rkisp1_params_cfg *params)\n {\n-\tif (context.frameContext.frameCount > 0)\n+\tif (context.activeState.frameCount > 0)\n \t\treturn;\n \n \tif (!tuningParameters_)\ndiff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\nindex f387cacea363..341fef2e68fe 100644\n--- a/src/ipa/rkisp1/ipa_context.h\n+++ b/src/ipa/rkisp1/ipa_context.h\n@@ -40,7 +40,7 @@ struct IPASessionConfiguration {\n \t} hw;\n };\n \n-struct IPAFrameContext {\n+struct IPAActiveState {\n \tstruct {\n \t\tuint32_t exposure;\n \t\tdouble gain;\n@@ -64,9 +64,12 @@ struct IPAFrameContext {\n \tunsigned int frameCount;\n };\n \n+struct IPAFrameContext {\n+};\n+\n struct IPAContext {\n \tIPASessionConfiguration configuration;\n-\tIPAFrameContext frameContext;\n+\tIPAActiveState activeState;\n };\n \n } /* namespace ipa::rkisp1 */\ndiff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\nindex 21166b0f1ba6..9629ccbf4247 100644\n--- a/src/ipa/rkisp1/rkisp1.cpp\n+++ b/src/ipa/rkisp1/rkisp1.cpp\n@@ -224,7 +224,7 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,\n \tcontext_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain);\n \tcontext_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain);\n \n-\tcontext_.frameContext.frameCount = 0;\n+\tcontext_.activeState.frameCount = 0;\n \n \tfor (auto const &algo : algorithms()) {\n \t\tint ret = algo->configure(context_, info);\n@@ -284,7 +284,7 @@ void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)\n \t\talgo->prepare(context_, params);\n \n \tparamsBufferReady.emit(frame);\n-\tcontext_.frameContext.frameCount++;\n+\tcontext_.activeState.frameCount++;\n }\n \n void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId,\n@@ -294,9 +294,9 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId\n \t\treinterpret_cast<rkisp1_stat_buffer *>(\n \t\t\tmappedBuffers_.at(bufferId).planes()[0].data());\n \n-\tcontext_.frameContext.sensor.exposure =\n+\tcontext_.activeState.sensor.exposure =\n \t\tsensorControls.get(V4L2_CID_EXPOSURE).get<int32_t>();\n-\tcontext_.frameContext.sensor.gain =\n+\tcontext_.activeState.sensor.gain =\n \t\tcamHelper_->gain(sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get<int32_t>());\n \n \tunsigned int aeState = 0;\n@@ -311,8 +311,8 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId\n \n void IPARkISP1::setControls(unsigned int frame)\n {\n-\tuint32_t exposure = context_.frameContext.agc.exposure;\n-\tuint32_t gain = camHelper_->gainCode(context_.frameContext.agc.gain);\n+\tuint32_t exposure = context_.activeState.agc.exposure;\n+\tuint32_t gain = camHelper_->gainCode(context_.activeState.agc.gain);\n \n \tControlList ctrls(ctrls_);\n \tctrls.set(V4L2_CID_EXPOSURE, static_cast<int32_t>(exposure));\n", "prefixes": [ "libcamera-devel", "RFC", "05/12" ] }