{"id":14039,"url":"https://patchwork.libcamera.org/api/patches/14039/?format=json","web_url":"https://patchwork.libcamera.org/patch/14039/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<mailman.446.1633340920.837.libcamera-devel@lists.libcamera.org>","date":"2021-10-04T09:48:23","name":"[libcamera-devel,3/3] ipu3: Apply shading adapter as part of AIQ::run2a()","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"a8575b4b1a60664f9f47eb96d6f9fe29965937ae","submitter":{"id":72,"url":"https://patchwork.libcamera.org/api/people/72/?format=json","name":"Han-lin Chen","email":"hanlinchen@google.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14039/mbox/","series":[{"id":2597,"url":"https://patchwork.libcamera.org/api/series/2597/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2597","date":"2021-10-04T09:48:20","name":"Fix dark caputred image with close sourced IPU3 IPA","version":1,"mbox":"https://patchwork.libcamera.org/series/2597/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14039/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14039/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\r\n\t[92.243.16.209])\r\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id F2E9CC3243\r\n\tfor <parsemail@patchwork.libcamera.org>;\r\n\tMon,  4 Oct 2021 09:48:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\r\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C2D2C691BA;\r\n\tMon,  4 Oct 2021 11:48:41 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\r\n\ts=mail; t=1633340921;\r\n\tbh=CQCiNmFY6TypvPrj+vKdOrxnkdSy54b57Pb0TfSkJFA=;\r\n\th=Date:In-Reply-To:References:To:List-Id:List-Post:From:\r\n\tList-Subscribe:List-Unsubscribe:List-Archive:Reply-To:List-Help:\r\n\tSubject:From;\r\n\tb=1ULQG2llsUywAKunETAqH9cHLCF04R+YXHmlnmYyQigadTYDOZAFvjJ0M8UMXokJT\r\n\tNGcIuO1CczGwVQDHOxrHR5Cg80sKoxroHUpbQ1YlX0AHEao17oY0QMF9/Z9fUtDwUF\r\n\tCBw91utjIchwlswayBX0xss+odrXSVHvqmsfKfK+55bG1WAtV3BwAI2VYyo0896fBB\r\n\tKCCOUQv2gc0nhb8d6rSLY8zLBVz3vHPuqITBawrLdUYGjKBrEJyqDRkkfvdQaBQ1sN\r\n\taOcPwhyU4G7+wSLz7/4uqizX+uV0XIWv7hEnwZm4Okeo1jrBu1bO69s10EMsmplA4y\r\n\t6jB3VxE/jrC2Q==","Date":"Mon,  4 Oct 2021 17:48:23 +0800","In-Reply-To":"<20211004094823.260789-1-hanlinchen@google.com>","References":"<20211004094823.260789-1-hanlinchen@google.com>","To":"libcamera-devel@lists.libcamera.org","MIME-Version":"1.0","Message-ID":"<mailman.446.1633340920.837.libcamera-devel@lists.libcamera.org>","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","From":"Han-Lin Chen via libcamera-devel <libcamera-devel@lists.libcamera.org>","Precedence":"list","X-Mailman-Version":"2.1.29","X-BeenThere":"libcamera-devel@lists.libcamera.org","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\r\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\r\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","Reply-To":"Han-Lin Chen <hanlinchen@google.com>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","Subject":"[libcamera-devel] [PATCH 3/3] ipu3: Apply shading adapter as part\r\n\tof AIQ::run2a()","Content-Type":"message/rfc822","Content-Disposition":"inline","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: hanlinchen <hanlinchen@google.com>\n\nApply shading adapter to correct lens shading for both camera.\n\nSigned-off-by: Han-Lin Chen <hanlinchen@google.com>\n---\n aiq/aiq.cpp | 20 ++++++++++++++++++--\n aiq/aiq.h   |  4 +++-\n ipu3.cpp    |  2 +-\n 3 files changed, 22 insertions(+), 4 deletions(-)","diff":"diff --git a/aiq/aiq.cpp b/aiq/aiq.cpp\r\nindex 708e9d6..0a92eaf 100644\r\n--- a/aiq/aiq.cpp\r\n+++ b/aiq/aiq.cpp\r\n@@ -20,7 +20,8 @@ LOG_DEFINE_CATEGORY(AIQ)\r\n namespace ipa::ipu3::aiq {\r\n \r\n AIQ::AIQ()\r\n-\t: aiq_(nullptr)\r\n+\t: aiq_(nullptr),\r\n+\t\tsensor_frame_params_{}\r\n {\r\n \tLOG(AIQ, Info) << \"Creating IA AIQ Wrapper\";\r\n }\r\n@@ -105,10 +106,19 @@ int AIQ::init(BinaryData &aiqb, BinaryData &nvm, BinaryData &aiqd)\r\n \treturn 0;\r\n }\r\n \r\n-int AIQ::configure()\r\n+int AIQ::configure(const struct IPAConfigInfo &configInfo)\r\n {\r\n \tLOG(AIQ, Debug) << \"Configure AIQ\";\r\n \r\n+\tsensor_frame_params_.horizontal_crop_offset = 0;\r\n+\tsensor_frame_params_.vertical_crop_offset = 0;\r\n+\tsensor_frame_params_.cropped_image_width = configInfo.sensorInfo.analogCrop.width;\r\n+\tsensor_frame_params_.cropped_image_height = configInfo.sensorInfo.analogCrop.height;\r\n+\tsensor_frame_params_.horizontal_scaling_numerator = 1;\r\n+\tsensor_frame_params_.horizontal_scaling_denominator = 1;\r\n+\tsensor_frame_params_.vertical_scaling_numerator = 1;\r\n+\tsensor_frame_params_.vertical_scaling_denominator = 1;\r\n+\r\n \treturn 0;\r\n }\r\n \r\n@@ -154,6 +164,11 @@ int AIQ::run2a(unsigned int frame, AiqInputParameters &params,\r\n \tparams.paParams.exposure_params = results.ae()->exposures[0].exposure;\r\n \tparameterAdapterRun(params.paParams, results);\r\n \r\n+\tparams.saParams.frame_use = params.aeInputParams.frame_use;\r\n+\tparams.saParams.sensor_frame_params = &sensor_frame_params_;\r\n+\tparams.saParams.awb_results = results.awb();\r\n+\tshadingAdapterRun(params.saParams, results);\r\n+\r\n \tafRun(params.afParams, results);\r\n \r\n \treturn 0;\r\n@@ -328,6 +343,7 @@ int AIQ::shadingAdapterRun(ia_aiq_sa_input_params &saParams,\r\n {\r\n \tia_aiq_sa_results *saResults = nullptr;\r\n \tia_err err = ia_aiq_sa_run(aiq_, &saParams, &saResults);\r\n+\r\n \tif (err) {\r\n \t\tLOG(AIQ, Error) << \"Failed to run shading adapter: \"\r\n \t\t\t\t<< decodeError(err);\r\ndiff --git a/aiq/aiq.h b/aiq/aiq.h\r\nindex fcd02d2..8a68827 100644\r\n--- a/aiq/aiq.h\r\n+++ b/aiq/aiq.h\r\n@@ -35,7 +35,7 @@ public:\r\n \t~AIQ();\r\n \r\n \tint init(BinaryData &aiqb, BinaryData &nvm, BinaryData &aiqd);\r\n-\tint configure();\r\n+\tint configure(const struct IPAConfigInfo &configInfo);\r\n \tint setStatistics(unsigned int frame,\r\n \t\t\t  int64_t timestamp, AiqResults &results,\r\n \t\t\t  const ipu3_uapi_stats_3a *stats);\r\n@@ -62,6 +62,8 @@ private:\r\n \tia_cmc_t *iaCmc_;\r\n \tstd::string version_;\r\n \r\n+  ia_aiq_frame_params sensor_frame_params_;\r\n+\r\n \tIPAIPU3Stats *aiqStats_;\r\n };\r\n \r\ndiff --git a/ipu3.cpp b/ipu3.cpp\r\nindex b60c58c..ed3c516 100644\r\n--- a/ipu3.cpp\r\n+++ b/ipu3.cpp\r\n@@ -232,7 +232,7 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo)\r\n \r\n \tint ret;\r\n \r\n-\tret = aiq_.configure();\r\n+\tret = aiq_.configure(configInfo);\r\n \tif (ret) {\r\n \t\tLOG(IPAIPU3, Error) << \"Failed to configure the AIQ\";\r\n \t\treturn ret;","prefixes":["libcamera-devel","3/3"]}