[{"id":24198,"web_url":"https://patchwork.libcamera.org/comment/24198/","msgid":"<YuGPtSuKe3jkyunk@pendragon.ideasonboard.com>","date":"2022-07-27T19:19:17","subject":"Re: [libcamera-devel] [PATCH v4 2/2] ipa: rkisp1: Add support of\n\tColorProcessing control","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Florian,\n\nThank you for the patch.\n\nOn Wed, Jul 27, 2022 at 10:38:19AM +0200, Florian Sylvestre wrote:\n> Add ColorProcessing algorithm that is in charge to manage brightness, contrast\n> and saturation controls.\n> These controls are currently based on user controls.\n> \n> Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/ipa/rkisp1/algorithms/cproc.cpp      | 97 ++++++++++++++++++++++++\n>  src/ipa/rkisp1/algorithms/cproc.h        | 30 ++++++++\n>  src/ipa/rkisp1/algorithms/meson.build    |  1 +\n>  src/ipa/rkisp1/data/ov5640.yaml          |  1 +\n>  src/ipa/rkisp1/ipa_context.cpp           | 17 +++++\n>  src/ipa/rkisp1/ipa_context.h             |  7 ++\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +++\n>  7 files changed, 165 insertions(+)\n>  create mode 100644 src/ipa/rkisp1/algorithms/cproc.cpp\n>  create mode 100644 src/ipa/rkisp1/algorithms/cproc.h\n> \n> diff --git a/src/ipa/rkisp1/algorithms/cproc.cpp b/src/ipa/rkisp1/algorithms/cproc.cpp\n> new file mode 100644\n> index 00000000..74c08215\n> --- /dev/null\n> +++ b/src/ipa/rkisp1/algorithms/cproc.cpp\n> @@ -0,0 +1,97 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2021-2022, Ideas On Board\n> + *\n> + * cproc.cpp - RkISP1 Color Processing control\n> + */\n> +\n> +#include \"cproc.h\"\n> +\n> +#include <algorithm>\n> +#include <cmath>\n> +\n> +#include <libcamera/base/log.h>\n> +\n> +#include <libcamera/control_ids.h>\n> +\n> +/**\n> + * \\file cproc.h\n> + */\n> +\n> +namespace libcamera {\n> +\n> +namespace ipa::rkisp1::algorithms {\n> +\n> +/**\n> + * \\class ColorProcessing\n> + * \\brief RkISP1 Color Processing control\n> + *\n> + * The ColorProcessing algorithm is responsible for applying brightness,\n> + * contrast and saturation corrections. The values are directly provided\n> + * through requests by the corresponding controls.\n> + */\n> +\n> +LOG_DEFINE_CATEGORY(RkISP1CProc)\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::queueRequest\n> + */\n> +void ColorProcessing::queueRequest(IPAContext &context,\n> +\t\t\t\t   [[maybe_unused]] const uint32_t frame,\n> +\t\t\t\t   const ControlList &controls)\n> +{\n> +\tauto &cproc = context.frameContext.cproc;\n> +\n> +\tconst auto &brightness = controls.get(controls::Brightness);\n> +\tif (brightness) {\n> +\t\tcproc.brightness = std::clamp<int>(std::lround(*brightness * 128.0f), -128, 127);\n> +\t\tcproc.updateParams = true;\n> +\n> +\t\tLOG(RkISP1CProc, Debug) << \"Set brightness to \" << *brightness;\n> +\t}\n> +\n> +\tconst auto &contrast = controls.get(controls::Contrast);\n> +\tif (contrast) {\n> +\t\tcproc.contrast = std::clamp<int>(std::lround(*contrast * 128.0f), 0.0f, 255.0f);\n\n0.0f and 255.0f should be 0 and 255.\n\n> +\t\tcproc.updateParams = true;\n> +\n> +\t\tLOG(RkISP1CProc, Debug) << \"Set contrast to \" << *contrast;\n> +\t}\n> +\n> +\tconst auto saturation = controls.get(controls::Saturation);\n> +\tif (saturation) {\n> +\t\tcproc.saturation = std::clamp<int>(std::lround(*saturation * 128.0f), 0.0f, 255.0f);\n\nSame here.\n\nNo need to resubmit, I can fix that when applying.\n\n> +\t\tcproc.updateParams = true;\n> +\n> +\t\tLOG(RkISP1CProc, Debug) << \"Set saturation to \" << *saturation;\n> +\t}\n> +}\n> +\n> +/**\n> + * \\copydoc libcamera::ipa::Algorithm::prepare\n> + */\n> +void ColorProcessing::prepare(IPAContext &context,\n> +\t\t\t      rkisp1_params_cfg *params)\n> +{\n> +\tauto &cproc = context.frameContext.cproc;\n> +\n> +\t/* Check if the algorithm configuration has been updated. */\n> +\tif (!cproc.updateParams)\n> +\t\treturn;\n> +\n> +\tcproc.updateParams = false;\n> +\n> +\tparams->others.cproc_config.brightness = cproc.brightness;\n> +\tparams->others.cproc_config.contrast = cproc.contrast;\n> +\tparams->others.cproc_config.sat = cproc.saturation;\n> +\n> +\tparams->module_en_update |= RKISP1_CIF_ISP_MODULE_CPROC;\n> +\tparams->module_ens |= RKISP1_CIF_ISP_MODULE_CPROC;\n> +\tparams->module_cfg_update |= RKISP1_CIF_ISP_MODULE_CPROC;\n> +}\n> +\n> +REGISTER_IPA_ALGORITHM(ColorProcessing, \"ColorProcessing\")\n> +\n> +} /* namespace ipa::rkisp1::algorithms */\n> +\n> +} /* namespace libcamera */\n> diff --git a/src/ipa/rkisp1/algorithms/cproc.h b/src/ipa/rkisp1/algorithms/cproc.h\n> new file mode 100644\n> index 00000000..4b7e4064\n> --- /dev/null\n> +++ b/src/ipa/rkisp1/algorithms/cproc.h\n> @@ -0,0 +1,30 @@\n> +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> +/*\n> + * Copyright (C) 2021-2022, Ideas On Board\n> + *\n> + * cproc.h - RkISP1 Color Processing control\n> + */\n> +\n> +#pragma once\n> +\n> +#include <sys/types.h>\n> +\n> +#include \"algorithm.h\"\n> +\n> +namespace libcamera {\n> +\n> +namespace ipa::rkisp1::algorithms {\n> +\n> +class ColorProcessing : public Algorithm\n> +{\n> +public:\n> +\tColorProcessing() = default;\n> +\t~ColorProcessing() = default;\n> +\n> +\tvoid queueRequest(IPAContext &context, const uint32_t frame,\n> +\t\t\t  const ControlList &controls) override;\n> +\tvoid prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n> +};\n> +\n> +} /* namespace ipa::rkisp1::algorithms */\n> +} /* namespace libcamera */\n> diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build\n> index dcd24fe0..e48974b4 100644\n> --- a/src/ipa/rkisp1/algorithms/meson.build\n> +++ b/src/ipa/rkisp1/algorithms/meson.build\n> @@ -4,6 +4,7 @@ rkisp1_ipa_algorithms = files([\n>      'agc.cpp',\n>      'awb.cpp',\n>      'blc.cpp',\n> +    'cproc.cpp',\n>      'dpcc.cpp',\n>      'filter.cpp',\n>      'gsl.cpp',\n> diff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\n> index 99529481..93d7d1e7 100644\n> --- a/src/ipa/rkisp1/data/ov5640.yaml\n> +++ b/src/ipa/rkisp1/data/ov5640.yaml\n> @@ -10,6 +10,7 @@ algorithms:\n>        Gr: 256\n>        Gb: 256\n>        B:  256\n> +  - ColorProcessing:\n>    - GammaSensorLinearization:\n>        x-intervals: [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]\n>        y:\n> diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\n> index 4b117186..ef8bb8e9 100644\n> --- a/src/ipa/rkisp1/ipa_context.cpp\n> +++ b/src/ipa/rkisp1/ipa_context.cpp\n> @@ -136,6 +136,23 @@ namespace libcamera::ipa::rkisp1 {\n>   * \\brief Estimated color temperature\n>   */\n>  \n> +/**\n> + * \\var IPAFrameContext::cproc\n> + * \\brief Context for the Color Processing algorithm\n> + *\n> + * \\struct IPAFrameContext::cproc.brightness\n> + * \\brief Brightness level\n> + *\n> + * \\var IPAFrameContext::cproc.contrast\n> + * \\brief Contrast level\n> + *\n> + * \\var IPAFrameContext::cproc.saturation\n> + * \\brief Saturation level\n> + *\n> + * \\var IPAFrameContext::cproc.updateParams\n> + * \\brief Indicates if ISP parameters need to be updated\n> + */\n> +\n>  /**\n>   * \\var IPAFrameContext::filter\n>   * \\brief Context for the Filter algorithm\n> diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\n> index 3b2f6af1..2bdb6a81 100644\n> --- a/src/ipa/rkisp1/ipa_context.h\n> +++ b/src/ipa/rkisp1/ipa_context.h\n> @@ -57,6 +57,13 @@ struct IPAFrameContext {\n>  \t\tdouble temperatureK;\n>  \t} awb;\n>  \n> +\tstruct {\n> +\t\tint8_t brightness;\n> +\t\tuint8_t contrast;\n> +\t\tuint8_t saturation;\n> +\t\tbool updateParams;\n> +\t} cproc;\n> +\n>  \tstruct {\n>  \t\tuint8_t denoise;\n>  \t\tuint8_t sharpness;\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> index 4e000d31..de687f4d 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> @@ -972,6 +972,18 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n>  \t\t      std::forward_as_tuple(&controls::Sharpness),\n>  \t\t      std::forward_as_tuple(0.0f, 10.0f, 1.0f));\n>  \n> +\tctrls.emplace(std::piecewise_construct,\n> +\t\t      std::forward_as_tuple(&controls::Brightness),\n> +\t\t      std::forward_as_tuple(-1.0f, 0.993f));\n> +\n> +\tctrls.emplace(std::piecewise_construct,\n> +\t\t      std::forward_as_tuple(&controls::Contrast),\n> +\t\t      std::forward_as_tuple(0.0f, 1.993f));\n> +\n> +\tctrls.emplace(std::piecewise_construct,\n> +\t\t      std::forward_as_tuple(&controls::Saturation),\n> +\t\t      std::forward_as_tuple(0.0f, 1.993f));\n> +\n>  \tctrls.emplace(std::piecewise_construct,\n>  \t\t      std::forward_as_tuple(&controls::draft::NoiseReductionMode),\n>  \t\t      std::forward_as_tuple(controls::draft::NoiseReductionModeValues));\n> -- \n> 2.34.1\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 AD85DBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Jul 2022 19:19:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0E37A63311;\n\tWed, 27 Jul 2022 21:19:21 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DFAE563309\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Jul 2022 21:19:19 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 45DAA835;\n\tWed, 27 Jul 2022 21:19:19 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658949561;\n\tbh=OUfu2FZpruFXNU2MLMrEuZLViHvb7x2MwfA5lj5D9G8=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=he5BCJqNlUmqJGz7W0Qiqf+EgAD4VYcXjCzK4QJwGTJ3b4L3/VNOrsJlAqtzZ1xr/\n\t/ySi3ubfQDQYE+ZqwhIGL43tRTCxg/ZuY4anKsZAsxvdVNSl2GpaaWe9gb0UEQMlYa\n\tYCUrUMwg7i90YA9Vg5rq8H0DQTMS8EiBvP3hHxr5o+rXiQNgEMBiPM5RdoLcuZ509e\n\tMUmpFt5c3I6KI/4g32Tg0UakQZlYumad2Pe8XvNytPtG1tE41gRBkPFkBmXFyww/x4\n\tog6HmiYibn8IheRXD+ssy6afnFTdtxLczSjPHSpuH/LlNnrwdsST5E+CO6vDFFAOfl\n\t0/4TsMMkDQ3+g==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658949559;\n\tbh=OUfu2FZpruFXNU2MLMrEuZLViHvb7x2MwfA5lj5D9G8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=fPuYV0Z0MlflxVfUpSqzIk0GMWVVDcIy0jZzLtULow8z89UlFZTnYg5ixpE4Lh98i\n\tR5AS6h+R4e8Gjn/oEjV0ff/sxb6JS6tM955j/4T2qBjdS4bSFkcqHcCCxeEJI4h6bj\n\tZpPOCYOAZExODhwK66rq35gLEF935Tk1ryfUIkRc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"fPuYV0Z0\"; dkim-atps=neutral","Date":"Wed, 27 Jul 2022 22:19:17 +0300","To":"Florian Sylvestre <fsylvestre@baylibre.com>","Message-ID":"<YuGPtSuKe3jkyunk@pendragon.ideasonboard.com>","References":"<20220727083819.589595-1-fsylvestre@baylibre.com>\n\t<20220727083819.589595-3-fsylvestre@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220727083819.589595-3-fsylvestre@baylibre.com>","Subject":"Re: [libcamera-devel] [PATCH v4 2/2] ipa: rkisp1: Add support of\n\tColorProcessing control","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":24237,"web_url":"https://patchwork.libcamera.org/comment/24237/","msgid":"<CALzBHU5YDXFbO9Ockn+2P_1=56r4Ua7ZV2uD9eu4_qFoxH=4aw@mail.gmail.com>","date":"2022-07-29T07:10:58","subject":"Re: [libcamera-devel] [PATCH v4 2/2] ipa: rkisp1: Add support of\n\tColorProcessing control","submitter":{"id":123,"url":"https://patchwork.libcamera.org/api/people/123/","name":"Florian Sylvestre","email":"fsylvestre@baylibre.com"},"content":"On Wed, 27 Jul 2022 at 21:19, Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> Hi Florian,\n>\n> Thank you for the patch.\n>\n> On Wed, Jul 27, 2022 at 10:38:19AM +0200, Florian Sylvestre wrote:\n> > Add ColorProcessing algorithm that is in charge to manage brightness, contrast\n> > and saturation controls.\n> > These controls are currently based on user controls.\n> >\n> > Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  src/ipa/rkisp1/algorithms/cproc.cpp      | 97 ++++++++++++++++++++++++\n> >  src/ipa/rkisp1/algorithms/cproc.h        | 30 ++++++++\n> >  src/ipa/rkisp1/algorithms/meson.build    |  1 +\n> >  src/ipa/rkisp1/data/ov5640.yaml          |  1 +\n> >  src/ipa/rkisp1/ipa_context.cpp           | 17 +++++\n> >  src/ipa/rkisp1/ipa_context.h             |  7 ++\n> >  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +++\n> >  7 files changed, 165 insertions(+)\n> >  create mode 100644 src/ipa/rkisp1/algorithms/cproc.cpp\n> >  create mode 100644 src/ipa/rkisp1/algorithms/cproc.h\n> >\n> > diff --git a/src/ipa/rkisp1/algorithms/cproc.cpp b/src/ipa/rkisp1/algorithms/cproc.cpp\n> > new file mode 100644\n> > index 00000000..74c08215\n> > --- /dev/null\n> > +++ b/src/ipa/rkisp1/algorithms/cproc.cpp\n> > @@ -0,0 +1,97 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2021-2022, Ideas On Board\n> > + *\n> > + * cproc.cpp - RkISP1 Color Processing control\n> > + */\n> > +\n> > +#include \"cproc.h\"\n> > +\n> > +#include <algorithm>\n> > +#include <cmath>\n> > +\n> > +#include <libcamera/base/log.h>\n> > +\n> > +#include <libcamera/control_ids.h>\n> > +\n> > +/**\n> > + * \\file cproc.h\n> > + */\n> > +\n> > +namespace libcamera {\n> > +\n> > +namespace ipa::rkisp1::algorithms {\n> > +\n> > +/**\n> > + * \\class ColorProcessing\n> > + * \\brief RkISP1 Color Processing control\n> > + *\n> > + * The ColorProcessing algorithm is responsible for applying brightness,\n> > + * contrast and saturation corrections. The values are directly provided\n> > + * through requests by the corresponding controls.\n> > + */\n> > +\n> > +LOG_DEFINE_CATEGORY(RkISP1CProc)\n> > +\n> > +/**\n> > + * \\copydoc libcamera::ipa::Algorithm::queueRequest\n> > + */\n> > +void ColorProcessing::queueRequest(IPAContext &context,\n> > +                                [[maybe_unused]] const uint32_t frame,\n> > +                                const ControlList &controls)\n> > +{\n> > +     auto &cproc = context.frameContext.cproc;\n> > +\n> > +     const auto &brightness = controls.get(controls::Brightness);\n> > +     if (brightness) {\n> > +             cproc.brightness = std::clamp<int>(std::lround(*brightness * 128.0f), -128, 127);\n> > +             cproc.updateParams = true;\n> > +\n> > +             LOG(RkISP1CProc, Debug) << \"Set brightness to \" << *brightness;\n> > +     }\n> > +\n> > +     const auto &contrast = controls.get(controls::Contrast);\n> > +     if (contrast) {\n> > +             cproc.contrast = std::clamp<int>(std::lround(*contrast * 128.0f), 0.0f, 255.0f);\n>\n> 0.0f and 255.0f should be 0 and 255.\nIndeed... :(\n>\n> > +             cproc.updateParams = true;\n> > +\n> > +             LOG(RkISP1CProc, Debug) << \"Set contrast to \" << *contrast;\n> > +     }\n> > +\n> > +     const auto saturation = controls.get(controls::Saturation);\n> > +     if (saturation) {\n> > +             cproc.saturation = std::clamp<int>(std::lround(*saturation * 128.0f), 0.0f, 255.0f);\n>\n> Same here.\n>\n> No need to resubmit, I can fix that when applying.\n>\n> > +             cproc.updateParams = true;\n> > +\n> > +             LOG(RkISP1CProc, Debug) << \"Set saturation to \" << *saturation;\n> > +     }\n> > +}\n> > +\n> > +/**\n> > + * \\copydoc libcamera::ipa::Algorithm::prepare\n> > + */\n> > +void ColorProcessing::prepare(IPAContext &context,\n> > +                           rkisp1_params_cfg *params)\n> > +{\n> > +     auto &cproc = context.frameContext.cproc;\n> > +\n> > +     /* Check if the algorithm configuration has been updated. */\n> > +     if (!cproc.updateParams)\n> > +             return;\n> > +\n> > +     cproc.updateParams = false;\n> > +\n> > +     params->others.cproc_config.brightness = cproc.brightness;\n> > +     params->others.cproc_config.contrast = cproc.contrast;\n> > +     params->others.cproc_config.sat = cproc.saturation;\n> > +\n> > +     params->module_en_update |= RKISP1_CIF_ISP_MODULE_CPROC;\n> > +     params->module_ens |= RKISP1_CIF_ISP_MODULE_CPROC;\n> > +     params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_CPROC;\n> > +}\n> > +\n> > +REGISTER_IPA_ALGORITHM(ColorProcessing, \"ColorProcessing\")\n> > +\n> > +} /* namespace ipa::rkisp1::algorithms */\n> > +\n> > +} /* namespace libcamera */\n> > diff --git a/src/ipa/rkisp1/algorithms/cproc.h b/src/ipa/rkisp1/algorithms/cproc.h\n> > new file mode 100644\n> > index 00000000..4b7e4064\n> > --- /dev/null\n> > +++ b/src/ipa/rkisp1/algorithms/cproc.h\n> > @@ -0,0 +1,30 @@\n> > +/* SPDX-License-Identifier: LGPL-2.1-or-later */\n> > +/*\n> > + * Copyright (C) 2021-2022, Ideas On Board\n> > + *\n> > + * cproc.h - RkISP1 Color Processing control\n> > + */\n> > +\n> > +#pragma once\n> > +\n> > +#include <sys/types.h>\n> > +\n> > +#include \"algorithm.h\"\n> > +\n> > +namespace libcamera {\n> > +\n> > +namespace ipa::rkisp1::algorithms {\n> > +\n> > +class ColorProcessing : public Algorithm\n> > +{\n> > +public:\n> > +     ColorProcessing() = default;\n> > +     ~ColorProcessing() = default;\n> > +\n> > +     void queueRequest(IPAContext &context, const uint32_t frame,\n> > +                       const ControlList &controls) override;\n> > +     void prepare(IPAContext &context, rkisp1_params_cfg *params) override;\n> > +};\n> > +\n> > +} /* namespace ipa::rkisp1::algorithms */\n> > +} /* namespace libcamera */\n> > diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build\n> > index dcd24fe0..e48974b4 100644\n> > --- a/src/ipa/rkisp1/algorithms/meson.build\n> > +++ b/src/ipa/rkisp1/algorithms/meson.build\n> > @@ -4,6 +4,7 @@ rkisp1_ipa_algorithms = files([\n> >      'agc.cpp',\n> >      'awb.cpp',\n> >      'blc.cpp',\n> > +    'cproc.cpp',\n> >      'dpcc.cpp',\n> >      'filter.cpp',\n> >      'gsl.cpp',\n> > diff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\n> > index 99529481..93d7d1e7 100644\n> > --- a/src/ipa/rkisp1/data/ov5640.yaml\n> > +++ b/src/ipa/rkisp1/data/ov5640.yaml\n> > @@ -10,6 +10,7 @@ algorithms:\n> >        Gr: 256\n> >        Gb: 256\n> >        B:  256\n> > +  - ColorProcessing:\n> >    - GammaSensorLinearization:\n> >        x-intervals: [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]\n> >        y:\n> > diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp\n> > index 4b117186..ef8bb8e9 100644\n> > --- a/src/ipa/rkisp1/ipa_context.cpp\n> > +++ b/src/ipa/rkisp1/ipa_context.cpp\n> > @@ -136,6 +136,23 @@ namespace libcamera::ipa::rkisp1 {\n> >   * \\brief Estimated color temperature\n> >   */\n> >\n> > +/**\n> > + * \\var IPAFrameContext::cproc\n> > + * \\brief Context for the Color Processing algorithm\n> > + *\n> > + * \\struct IPAFrameContext::cproc.brightness\n> > + * \\brief Brightness level\n> > + *\n> > + * \\var IPAFrameContext::cproc.contrast\n> > + * \\brief Contrast level\n> > + *\n> > + * \\var IPAFrameContext::cproc.saturation\n> > + * \\brief Saturation level\n> > + *\n> > + * \\var IPAFrameContext::cproc.updateParams\n> > + * \\brief Indicates if ISP parameters need to be updated\n> > + */\n> > +\n> >  /**\n> >   * \\var IPAFrameContext::filter\n> >   * \\brief Context for the Filter algorithm\n> > diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h\n> > index 3b2f6af1..2bdb6a81 100644\n> > --- a/src/ipa/rkisp1/ipa_context.h\n> > +++ b/src/ipa/rkisp1/ipa_context.h\n> > @@ -57,6 +57,13 @@ struct IPAFrameContext {\n> >               double temperatureK;\n> >       } awb;\n> >\n> > +     struct {\n> > +             int8_t brightness;\n> > +             uint8_t contrast;\n> > +             uint8_t saturation;\n> > +             bool updateParams;\n> > +     } cproc;\n> > +\n> >       struct {\n> >               uint8_t denoise;\n> >               uint8_t sharpness;\n> > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > index 4e000d31..de687f4d 100644\n> > --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n> > @@ -972,6 +972,18 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)\n> >                     std::forward_as_tuple(&controls::Sharpness),\n> >                     std::forward_as_tuple(0.0f, 10.0f, 1.0f));\n> >\n> > +     ctrls.emplace(std::piecewise_construct,\n> > +                   std::forward_as_tuple(&controls::Brightness),\n> > +                   std::forward_as_tuple(-1.0f, 0.993f));\n> > +\n> > +     ctrls.emplace(std::piecewise_construct,\n> > +                   std::forward_as_tuple(&controls::Contrast),\n> > +                   std::forward_as_tuple(0.0f, 1.993f));\n> > +\n> > +     ctrls.emplace(std::piecewise_construct,\n> > +                   std::forward_as_tuple(&controls::Saturation),\n> > +                   std::forward_as_tuple(0.0f, 1.993f));\n> > +\n> >       ctrls.emplace(std::piecewise_construct,\n> >                     std::forward_as_tuple(&controls::draft::NoiseReductionMode),\n> >                     std::forward_as_tuple(controls::draft::NoiseReductionModeValues));\n> > --\n> > 2.34.1\n> >\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 EC243C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 29 Jul 2022 07:11:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B39E563312;\n\tFri, 29 Jul 2022 09:11:12 +0200 (CEST)","from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com\n\t[IPv6:2607:f8b0:4864:20::1031])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 60D7860486\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 Jul 2022 09:11:11 +0200 (CEST)","by mail-pj1-x1031.google.com with SMTP id\n\th21-20020a17090aa89500b001f31a61b91dso4715643pjq.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 Jul 2022 00:11:11 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659078672;\n\tbh=DEBk3DSlWVTE5KpvxV5LsIEfwMZCB4Zy5LYHKd7HFLk=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=LGDWdDG2FcAPRLwEo1zvSJfU/qcwy8/13WluzntnoQGa/YRXEhEOKrxaMJ6sl1KHp\n\tHCBjvmBlLBK7HZ1/QErwsFVMJe7tpGk6kpx+kev4TizobkWPjEf1pQQT4/zheNOHwt\n\toTjUusxTL/UhF4GyKcQ2D8YPxZStV0Thxq/BR3HGxm4Ww+KQaht/FRvJsvrGL7mgJK\n\tugoJV9eK1olMms9L0JLh/9kfhZfkCt9l00OUjDfe/RIMPfOhhOVOvmjhUjiec01bcX\n\tTbU6JWxSvfXvbeg6NX17wBwiPCIUMsadeOJTXMBGRFwD37OKGtOzZqXgWaDcElSFIn\n\tlws+pDEjjobwg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=baylibre-com.20210112.gappssmtp.com; s=20210112;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=D6HEGUdrwgLICvRpl9LRRnFe4hcxfgbd4YpTOp3w8qQ=;\n\tb=JZiLlGVkbcPQaHx/0ZN1pMdmxDzQRDjulas7saNQYnS2ewjzCNIPMQt9VsRURsnhKb\n\tUdUkQKcPRmBjGKHjiCtP5Fhv4ReggHcYji9tUDS7X/pNrA3cghu+USmAR+HOQeB4tzJi\n\tP9A36v//sT9Yf5slC87FPynenB+GZa5KQuUarGTfkjx0aVFXywDFQ6IdjVOa+v+6KHYS\n\tmopo3svPqzr1Zx4qNjKJ9ZeenQCwbpY19XIc2qmJfl+/OUmkDOMNeKtmUtMXx26cVLup\n\tsXszFN3dmbCyRKTkzn0c4ymMIXfjcO8vu0Ppbiy5Y8Vukq7j5rZRITvLtC8Ols0sxdzq\n\tPDbw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=baylibre-com.20210112.gappssmtp.com\n\theader.i=@baylibre-com.20210112.gappssmtp.com header.b=\"JZiLlGVk\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=D6HEGUdrwgLICvRpl9LRRnFe4hcxfgbd4YpTOp3w8qQ=;\n\tb=iUh/k4iXY7WNE4/JFi+mo4Jm8wEDVU2g2yR1cQgl9xn6JkHIilRAeEBiegr44wGdi/\n\thLsFMdKOTASZ5yVkkg3wxSkE3w7VEwU0vYWANrNzNjCHywt+sPnmh0hWC3a0FhXR/dSt\n\tLzxF3ciR2NhEs3UnYnjnX4JwO1lNcszMMxRb3E7mupXW9mCZ2793jz3wq3TWb92rg8s0\n\toZ1FuTpFSTKjoGVplAEBXe4ya8GQFKfaqNT3cPAZe6xxYmEfMQ8HdhPrFAMuRyPzuuMi\n\tG6C7aGTRZZ038PMG5LsQjeYRuQ5kqv4iQzgoPmIsYAi1UNf1+3gvhR8s2LErDHPFqEU0\n\tYHrQ==","X-Gm-Message-State":"ACgBeo2HwjLtQc76d/O6sEL5OdIn/rHKpVKAC9Unk8GpKeWeINwF1gJU\n\t10iCyhL2Jlsy4sobS+gTMFZ0C21aoLzGn813Rg6YRONLwXimLA==","X-Google-Smtp-Source":"AA6agR7ruAA9f+IxlJjpS+re8pBUpnjiFM/2KC4giAifWaFiiOkssBPwNlm/VJ1pRfNH2HNIfjK/3Wo6/70MEI++xU4=","X-Received":"by 2002:a17:90b:4c0e:b0:1f2:be9a:5438 with SMTP id\n\tna14-20020a17090b4c0e00b001f2be9a5438mr2584436pjb.42.1659078669837;\n\tFri, 29 Jul 2022 00:11:09 -0700 (PDT)","MIME-Version":"1.0","References":"<20220727083819.589595-1-fsylvestre@baylibre.com>\n\t<20220727083819.589595-3-fsylvestre@baylibre.com>\n\t<YuGPtSuKe3jkyunk@pendragon.ideasonboard.com>","In-Reply-To":"<YuGPtSuKe3jkyunk@pendragon.ideasonboard.com>","Date":"Fri, 29 Jul 2022 09:10:58 +0200","Message-ID":"<CALzBHU5YDXFbO9Ockn+2P_1=56r4Ua7ZV2uD9eu4_qFoxH=4aw@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v4 2/2] ipa: rkisp1: Add support of\n\tColorProcessing control","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":"Florian Sylvestre via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Florian Sylvestre <fsylvestre@baylibre.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]