[{"id":30114,"web_url":"https://patchwork.libcamera.org/comment/30114/","msgid":"<d2d7924c-6a05-4ca1-ba78-07de8bd5d0ea@ideasonboard.com>","date":"2024-06-28T06:03:55","subject":"Re: [PATCH 09/19] libcamera: software_isp: Create algorithms","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Milan,\n\nThank you for the patch\n\nOn 26/06/24 12:50 pm, Milan Zamazal wrote:\n> We are ready to introduce algorithms now.  First, let's create\n> algorithms.  The algorithms are not called yet, calls to them will be\n> added in followup patches.\n>\n> The maximum number of contexts is set to the same value as in hardware\n> pipelines.\n>\n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n>   src/ipa/simple/algorithms/meson.build |  4 ++++\n>   src/ipa/simple/data/uncalibrated.yaml |  1 +\n>   src/ipa/simple/meson.build            |  7 +++++--\n>   src/ipa/simple/soft_simple.cpp        | 14 ++++++++++++++\n>   4 files changed, 24 insertions(+), 2 deletions(-)\n>   create mode 100644 src/ipa/simple/algorithms/meson.build\n>\n> diff --git a/src/ipa/simple/algorithms/meson.build b/src/ipa/simple/algorithms/meson.build\n> new file mode 100644\n> index 00000000..31d26e43\n> --- /dev/null\n> +++ b/src/ipa/simple/algorithms/meson.build\n> @@ -0,0 +1,4 @@\n> +# SPDX-License-Identifier: CC0-1.0\n> +\n> +soft_simple_ipa_algorithms = files([\n> +])\n> diff --git a/src/ipa/simple/data/uncalibrated.yaml b/src/ipa/simple/data/uncalibrated.yaml\n> index ff981a1a..2cdc39a8 100644\n> --- a/src/ipa/simple/data/uncalibrated.yaml\n> +++ b/src/ipa/simple/data/uncalibrated.yaml\n> @@ -2,4 +2,5 @@\n>   %YAML 1.1\n>   ---\n>   version: 1\n> +algorithms:\n>   ...\n> diff --git a/src/ipa/simple/meson.build b/src/ipa/simple/meson.build\n> index 33d1c96a..08d877bc 100644\n> --- a/src/ipa/simple/meson.build\n> +++ b/src/ipa/simple/meson.build\n> @@ -1,5 +1,8 @@\n>   # SPDX-License-Identifier: CC0-1.0\n>   \n> +subdir('algorithms')\n> +subdir('data')\n> +\n>   ipa_name = 'ipa_soft_simple'\n>   \n>   soft_simple_sources = files([\n> @@ -7,6 +10,8 @@ soft_simple_sources = files([\n>       'black_level.cpp',\n>   ])\n>   \n> +soft_simple_sources += soft_simple_ipa_algorithms\n> +\n>   mod = shared_module(ipa_name,\n>                       [soft_simple_sources, libcamera_generated_ipa_headers],\n>                       name_prefix : '',\n> @@ -24,6 +29,4 @@ if ipa_sign_module\n>                     build_by_default : true)\n>   endif\n>   \n> -subdir('data')\n> -\n>   ipa_names += ipa_name\n> diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp\n> index f2cfb2dc..6ddb4004 100644\n> --- a/src/ipa/simple/soft_simple.cpp\n> +++ b/src/ipa/simple/soft_simple.cpp\n> @@ -54,12 +54,15 @@ static constexpr float kExposureOptimal = kExposureBinsCount / 2.0;\n>    * enough to prevent the exposure from wobbling around the optimal value.\n>    */\n>   static constexpr float kExposureSatisfactory = 0.2;\n> +/* Maximum number of frame contexts to be held */\n> +static constexpr uint32_t kMaxFrameContexts = 16;\n>   \n>   class IPASoftSimple : public ipa::soft::IPASoftInterface, public Module\n>   {\n>   public:\n>   \tIPASoftSimple()\n>   \t\t: params_(nullptr), stats_(nullptr), blackLevel_(BlackLevel()),\n> +\t\t  context_({ {}, {}, { kMaxFrameContexts } }),\n>   \t\t  ignoreUpdates_(0)\n>   \t{\n>   \t}\n> @@ -93,6 +96,8 @@ private:\n>   \tstatic constexpr unsigned int kGammaLookupSize = 1024;\n>   \tstd::array<uint8_t, kGammaLookupSize> gammaTable_;\n>   \tint lastBlackLevel_ = -1;\n> +\t/* Local parameter storage */\n> +\tstruct IPAContext context_;\n>   \n>   \tint32_t exposureMin_, exposureMax_;\n>   \tint32_t exposure_;\n> @@ -139,6 +144,15 @@ int IPASoftSimple::init(const IPASettings &settings,\n>   \tunsigned int version = (*data)[\"version\"].get<uint32_t>(0);\n>   \tLOG(IPASoft, Debug) << \"Tuning file version \" << version;\n>   \n> +\tif (!data->contains(\"algorithms\")) {\n> +\t\tLOG(IPASoft, Error) << \"Tuning file doesn't contain algorithms\";\n> +\t\treturn -EINVAL;\n> +\t}\n> +\n> +\tint ret = createAlgorithms(context_, (*data)[\"algorithms\"]);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n>   \tparams_ = nullptr;\n>   \tstats_ = nullptr;\n>","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 E4D99BDB1D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Jun 2024 06:04:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2035662C99;\n\tFri, 28 Jun 2024 08:04:04 +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 20AD0619C8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Jun 2024 08:04:02 +0200 (CEST)","from [IPV6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f] (unknown\n\t[IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 19490735;\n\tFri, 28 Jun 2024 08:03:36 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"KBSXUZrM\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1719554617;\n\tbh=fIrVEITGiOQJFGMrmktalgFmi7Lo59ayoFvQHCM0JRE=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=KBSXUZrMdfy2Ks2xNFC/E4LU9bSEK8Pv5DWF3gxZjQiFyB1OWaQcDWGV3KQvnzY0m\n\tAx/0JsKI53RB1CJciqLbIacks1vhHi4pVJSGBhyZ9IrFXsEe5bWaOQctvXeYwAgppc\n\tgUMly54DhYwOepYry5hXuuQVbopc7vLpreMvMEF4=","Message-ID":"<d2d7924c-6a05-4ca1-ba78-07de8bd5d0ea@ideasonboard.com>","Date":"Fri, 28 Jun 2024 11:33:55 +0530","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH 09/19] libcamera: software_isp: Create algorithms","Content-Language":"en-US","To":"Milan Zamazal <mzamazal@redhat.com>, libcamera-devel@lists.libcamera.org","References":"<20240626072100.55497-1-mzamazal@redhat.com>\n\t<20240626072100.55497-10-mzamazal@redhat.com>","From":"Umang Jain <umang.jain@ideasonboard.com>","In-Reply-To":"<20240626072100.55497-10-mzamazal@redhat.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]