[{"id":37949,"web_url":"https://patchwork.libcamera.org/comment/37949/","msgid":"<48da12fe-422e-480e-81de-3efb2617d54b@collabora.com>","date":"2026-01-26T15:18:41","subject":"Re: [PATCH v4 12/15] libcamera: ipa: simple: Use symbolic constants\n\tfor adjust defaults","submitter":{"id":140,"url":"https://patchwork.libcamera.org/api/people/140/","name":"Robert Mader","email":"robert.mader@collabora.com"},"content":"Reviewed-by: Robert Mader <robert.mader@collabora.com>\n\nOn 22.01.26 17:19, Milan Zamazal wrote:\n> The adjust algorithm already uses a symbolic constant for gamma.  Let's\n> introduce similar constants for contrast and saturation to prevent\n> copying the numeric defaults to multiple places.\n>\n> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>   src/ipa/simple/algorithms/adjust.cpp | 16 +++++++++++-----\n>   1 file changed, 11 insertions(+), 5 deletions(-)\n>\n> diff --git a/src/ipa/simple/algorithms/adjust.cpp b/src/ipa/simple/algorithms/adjust.cpp\n> index a8b7c5ab6..23f6f6ad7 100644\n> --- a/src/ipa/simple/algorithms/adjust.cpp\n> +++ b/src/ipa/simple/algorithms/adjust.cpp\n> @@ -1,7 +1,7 @@\n>   /* SPDX-License-Identifier: LGPL-2.1-or-later */\n>   /*\n>    * Copyright (C) 2024, Ideas On Board\n> - * Copyright (C) 2024-2025, Red Hat Inc.\n> + * Copyright (C) 2024-2026, Red Hat Inc.\n>    *\n>    * Common image adjustments\n>    */\n> @@ -19,14 +19,20 @@ namespace libcamera {\n>   \n>   namespace ipa::soft::algorithms {\n>   \n> +constexpr float kDefaultContrast = 1.0f;\n> +constexpr float kDefaultSaturation = 1.0f;\n> +\n>   LOG_DEFINE_CATEGORY(IPASoftAdjust)\n>   \n>   int Adjust::init(IPAContext &context, [[maybe_unused]] const YamlObject &tuningData)\n>   {\n> -\tcontext.ctrlMap[&controls::Gamma] = ControlInfo(0.1f, 10.0f, kDefaultGamma);\n> -\tcontext.ctrlMap[&controls::Contrast] = ControlInfo(0.0f, 2.0f, 1.0f);\n> +\tcontext.ctrlMap[&controls::Gamma] =\n> +\t\tControlInfo(0.1f, 10.0f, kDefaultGamma);\n> +\tcontext.ctrlMap[&controls::Contrast] =\n> +\t\tControlInfo(0.0f, 2.0f, kDefaultContrast);\n>   \tif (context.ccmEnabled)\n> -\t\tcontext.ctrlMap[&controls::Saturation] = ControlInfo(0.0f, 2.0f, 1.0f);\n> +\t\tcontext.ctrlMap[&controls::Saturation] =\n> +\t\t\tControlInfo(0.0f, 2.0f, kDefaultSaturation);\n>   \treturn 0;\n>   }\n>   \n> @@ -122,7 +128,7 @@ void Adjust::process([[maybe_unused]] IPAContext &context,\n>   \t\tmetadata.set(controls::Contrast, contrast.value());\n>   \n>   \tconst auto &saturation = frameContext.saturation;\n> -\tmetadata.set(controls::Saturation, saturation.value_or(1.0));\n> +\tmetadata.set(controls::Saturation, saturation.value_or(kDefaultSaturation));\n>   }\n>   \n>   REGISTER_IPA_ALGORITHM(Adjust, \"Adjust\")","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 744C7C3220\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 26 Jan 2026 15:18:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4C75061FCC;\n\tMon, 26 Jan 2026 16:18:52 +0100 (CET)","from sender4-op-o12.zoho.com (sender4-op-o12.zoho.com\n\t[136.143.188.12])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1C77761A35\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 26 Jan 2026 16:18:49 +0100 (CET)","by mx.zohomail.com with SMTPS id 1769440723502925.3436348066822;\n\tMon, 26 Jan 2026 07:18:43 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=collabora.com\n\theader.i=robert.mader@collabora.com header.b=\"Z7bOGVUV\"; \n\tdkim-atps=neutral","ARC-Seal":"i=1; a=rsa-sha256; t=1769440726; cv=none; \n\td=zohomail.com; s=zohoarc; \n\tb=EEr4KTt6tPuMxEP96in/3H1rt9InjD3ar2Vrpl5BbFLV/57gTN302SUWdcKNklLyNPTyO0EBqfb0h6Xqi/YtCdJDuTYNxmAcbUM+OzDVDXanJIBheIzdIcKVZ2oqYIFpOhIG3UA/9Pj+IhlgezORdvfCfbBFZ+DTw3VS7dLAZy4=","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; \n\ts=zohoarc; t=1769440726;\n\th=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To:Cc;\n\tbh=1199u046pmkM4btlb4hdVQzjC4zhnxjvR8wtTS/t6YA=; \n\tb=FX3ZLZw0NFGYIsm8MSK+Nz/613xoLMVruV+qES+ENXqGISwv8YzhCZ/UykAZpmnAHJj6vEm0qxaxOGNjyDCxeX71PkMpqa7VZ81564Qxo4DcHu0vKvXoqDTdRllMOK8c4fNKISPKykMJdU4M1OyJFDSqlFXSi2XOAHyJ/sCZOsI=","ARC-Authentication-Results":"i=1; mx.zohomail.com;\n\tdkim=pass  header.i=collabora.com;\n\tspf=pass  smtp.mailfrom=robert.mader@collabora.com;\n\tdmarc=pass header.from=<robert.mader@collabora.com>","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1769440726;\n\ts=zohomail; d=collabora.com; i=robert.mader@collabora.com;\n\th=Message-ID:Date:Date:MIME-Version:Subject:Subject:To:To:References:From:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To:Cc;\n\tbh=1199u046pmkM4btlb4hdVQzjC4zhnxjvR8wtTS/t6YA=;\n\tb=Z7bOGVUVsh8Ou/mGdP8TFctIEwXlF4aloigjAkSeZ0ihefAcaNVlYuIxF3izSxMk\n\txrM8J+uIqOyNGTjgnCru9JoPcLKkPsnwp3iUhnpH11q69TYTUg8xxwAEP13kNKbrs7S\n\t5jcu2vqfFBpmt2yKOXGbuyJhHvpySZMIt6A0kuWo=","Message-ID":"<48da12fe-422e-480e-81de-3efb2617d54b@collabora.com>","Date":"Mon, 26 Jan 2026 16:18:41 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v4 12/15] libcamera: ipa: simple: Use symbolic constants\n\tfor adjust defaults","To":"libcamera-devel@lists.libcamera.org","References":"<20260122161935.208562-1-mzamazal@redhat.com>\n\t<20260122161935.208562-13-mzamazal@redhat.com>","Content-Language":"en-US, de-DE","From":"Robert Mader <robert.mader@collabora.com>","In-Reply-To":"<20260122161935.208562-13-mzamazal@redhat.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","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>"}}]