From patchwork Mon Oct 4 09:48:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Han-lin Chen X-Patchwork-Id: 14039 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id F2E9CC3243 for ; Mon, 4 Oct 2021 09:48:41 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C2D2C691BA; Mon, 4 Oct 2021 11:48:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1633340921; bh=CQCiNmFY6TypvPrj+vKdOrxnkdSy54b57Pb0TfSkJFA=; h=Date:In-Reply-To:References:To:List-Id:List-Post:From: List-Subscribe:List-Unsubscribe:List-Archive:Reply-To:List-Help: Subject:From; b=1ULQG2llsUywAKunETAqH9cHLCF04R+YXHmlnmYyQigadTYDOZAFvjJ0M8UMXokJT NGcIuO1CczGwVQDHOxrHR5Cg80sKoxroHUpbQ1YlX0AHEao17oY0QMF9/Z9fUtDwUF CBw91utjIchwlswayBX0xss+odrXSVHvqmsfKfK+55bG1WAtV3BwAI2VYyo0896fBB KCCOUQv2gc0nhb8d6rSLY8zLBVz3vHPuqITBawrLdUYGjKBrEJyqDRkkfvdQaBQ1sN aOcPwhyU4G7+wSLz7/4uqizX+uV0XIWv7hEnwZm4Okeo1jrBu1bO69s10EMsmplA4y 6jB3VxE/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: List-Id: List-Post: X-Patchwork-Original-From: Han-Lin Chen via libcamera-devel From: Han-lin Chen Precedence: list X-Mailman-Version: 2.1.29 X-BeenThere: libcamera-devel@lists.libcamera.org List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: Han-Lin Chen List-Help: Subject: [libcamera-devel] [PATCH 3/3] ipu3: Apply shading adapter as part of AIQ::run2a() Content-Disposition: inline Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: hanlinchen Apply shading adapter to correct lens shading for both camera. Signed-off-by: Han-Lin Chen --- aiq/aiq.cpp | 20 ++++++++++++++++++-- aiq/aiq.h | 4 +++- ipu3.cpp | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/aiq/aiq.cpp b/aiq/aiq.cpp index 708e9d6..0a92eaf 100644 --- a/aiq/aiq.cpp +++ b/aiq/aiq.cpp @@ -20,7 +20,8 @@ LOG_DEFINE_CATEGORY(AIQ) namespace ipa::ipu3::aiq { AIQ::AIQ() - : aiq_(nullptr) + : aiq_(nullptr), + sensor_frame_params_{} { LOG(AIQ, Info) << "Creating IA AIQ Wrapper"; } @@ -105,10 +106,19 @@ int AIQ::init(BinaryData &aiqb, BinaryData &nvm, BinaryData &aiqd) return 0; } -int AIQ::configure() +int AIQ::configure(const struct IPAConfigInfo &configInfo) { LOG(AIQ, Debug) << "Configure AIQ"; + sensor_frame_params_.horizontal_crop_offset = 0; + sensor_frame_params_.vertical_crop_offset = 0; + sensor_frame_params_.cropped_image_width = configInfo.sensorInfo.analogCrop.width; + sensor_frame_params_.cropped_image_height = configInfo.sensorInfo.analogCrop.height; + sensor_frame_params_.horizontal_scaling_numerator = 1; + sensor_frame_params_.horizontal_scaling_denominator = 1; + sensor_frame_params_.vertical_scaling_numerator = 1; + sensor_frame_params_.vertical_scaling_denominator = 1; + return 0; } @@ -154,6 +164,11 @@ int AIQ::run2a(unsigned int frame, AiqInputParameters ¶ms, params.paParams.exposure_params = results.ae()->exposures[0].exposure; parameterAdapterRun(params.paParams, results); + params.saParams.frame_use = params.aeInputParams.frame_use; + params.saParams.sensor_frame_params = &sensor_frame_params_; + params.saParams.awb_results = results.awb(); + shadingAdapterRun(params.saParams, results); + afRun(params.afParams, results); return 0; @@ -328,6 +343,7 @@ int AIQ::shadingAdapterRun(ia_aiq_sa_input_params &saParams, { ia_aiq_sa_results *saResults = nullptr; ia_err err = ia_aiq_sa_run(aiq_, &saParams, &saResults); + if (err) { LOG(AIQ, Error) << "Failed to run shading adapter: " << decodeError(err); diff --git a/aiq/aiq.h b/aiq/aiq.h index fcd02d2..8a68827 100644 --- a/aiq/aiq.h +++ b/aiq/aiq.h @@ -35,7 +35,7 @@ public: ~AIQ(); int init(BinaryData &aiqb, BinaryData &nvm, BinaryData &aiqd); - int configure(); + int configure(const struct IPAConfigInfo &configInfo); int setStatistics(unsigned int frame, int64_t timestamp, AiqResults &results, const ipu3_uapi_stats_3a *stats); @@ -62,6 +62,8 @@ private: ia_cmc_t *iaCmc_; std::string version_; + ia_aiq_frame_params sensor_frame_params_; + IPAIPU3Stats *aiqStats_; }; diff --git a/ipu3.cpp b/ipu3.cpp index b60c58c..ed3c516 100644 --- a/ipu3.cpp +++ b/ipu3.cpp @@ -232,7 +232,7 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo) int ret; - ret = aiq_.configure(); + ret = aiq_.configure(configInfo); if (ret) { LOG(IPAIPU3, Error) << "Failed to configure the AIQ"; return ret;