[{"id":24043,"web_url":"https://patchwork.libcamera.org/comment/24043/","msgid":"<YtnNcGmN5mXE5MSq@pendragon.ideasonboard.com>","date":"2022-07-21T22:04:32","subject":"Re: [libcamera-devel] [PATCH v2 4/4] 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 20, 2022 at 05:42:21PM +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      | 94 ++++++++++++++++++++++++\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.h             |  7 ++\n>  src/ipa/rkisp1/rkisp1.cpp                |  1 +\n>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +++\n>  7 files changed, 146 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..7e9e8cf1\n> --- /dev/null\n> +++ b/src/ipa/rkisp1/algorithms/cproc.cpp\n> @@ -0,0 +1,94 @@\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> +\n> +#include <libcamera/base/log.h>\n> +\n> +#include <libcamera/control_ids.h>\n> +\n> +#include \"libcamera/internal/yaml_parser.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([[maybe_unused]] IPAContext &context,\n> +\t\t\t\t   [[maybe_unused]] const uint32_t frame,\n> +\t\t\t\t   const ControlList &controls)\n> +{\n\nLet's shorten the lines with\n\n\tauto &cproc = context.frameContext.cproc;\n\n> +\tconst auto &brightness = controls.get(controls::Brightness);\n> +\tif (brightness) {\n> +\t\tcontext.frameContext.cproc.brightness = std::clamp(int(*brightness * 128), -128, 127);\n\n\t\tcproc.brightness = std::clamp(std::round(*brightness * 128), -128, 127);\n\nto round to the closest value instead of rounding down unconditionally\n(you need to include <cmath>). Same below.\n\n> +\t\tcontext.frameContext.cproc.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\tcontext.frameContext.cproc.contrast = std::clamp(int(*contrast * 128), 0, 255);\n> +\t\tcontext.frameContext.cproc.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\tcontext.frameContext.cproc.saturation = std::clamp(int(*saturation) * 128, 0, 255);\n> +\t\tcontext.frameContext.cproc.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([[maybe_unused]] IPAContext &context,\n> +\t\t\t      rkisp1_params_cfg *params)\n> +{\n\n\tauto &cproc = context.frameContext.cproc;\n\nwould also help here.\n\n> +\t/* Check if the algorithm configuration has been updated. */\n> +\tif (!context.frameContext.cproc.updateParams)\n> +\t\treturn;\n> +\n> +\tcontext.frameContext.cproc.updateParams = false;\n> +\n> +\tparams->others.cproc_config.brightness = context.frameContext.cproc.brightness;\n> +\tparams->others.cproc_config.contrast = context.frameContext.cproc.contrast;\n> +\tparams->others.cproc_config.sat = context.frameContext.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 7e078b0d..0ec17e07 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>      'demosaicing.cpp',\n>      'dpcc.cpp',\n>      'gsl.cpp',\n> diff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\n> index 4ae0ffc0..331f9d2d 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.h b/src/ipa/rkisp1/ipa_context.h\n> index 241a4d04..e6a61c45 100644\n> --- a/src/ipa/rkisp1/ipa_context.h\n> +++ b/src/ipa/rkisp1/ipa_context.h\n> @@ -62,6 +62,13 @@ struct IPAFrameContext {\n>  \t\tbool updateParams;\n>  \t} demosaicing;\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\tuint32_t exposure;\n>  \t\tdouble gain;\n> diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> index aeec8f50..c664642f 100644\n> --- a/src/ipa/rkisp1/rkisp1.cpp\n> +++ b/src/ipa/rkisp1/rkisp1.cpp\n> @@ -31,6 +31,7 @@\n>  #include \"algorithms/algorithm.h\"\n>  #include \"algorithms/awb.h\"\n>  #include \"algorithms/blc.h\"\n> +#include \"algorithms/cproc.h\"\n>  #include \"algorithms/demosaicing.h\"\n>  #include \"algorithms/dpcc.h\"\n>  #include \"algorithms/gsl.h\"\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\nThis needs to move to the IPA, I'll send a patch on top.\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));","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 C0580BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 Jul 2022 22:04:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 11D3463311;\n\tFri, 22 Jul 2022 00:04:37 +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 26E7560489\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jul 2022 00:04:35 +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 8E84F6D5;\n\tFri, 22 Jul 2022 00:04:34 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658441077;\n\tbh=bZssmkOc1p22PEQIyyecM+XCA6URZEo4vcZwV1G3+dI=;\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=RXDEiobXkw6cnmoHTk3pTzv0dlN1ftGJ6UCouJrbtQ9wSATIJ8gpe8vvt18NPHlit\n\tSTNElqGhKUN9gr/NY8KHoFZkKxqchxoDlsvCjZE6gJHrdWDePOJw5uolwGoZJZtu3e\n\t42C03S9cmaMILAI5ovSEX9ZbUB4S3QMyjAwAY528cmVG4uPFzMHRdV5hIOpqhQH0w7\n\tUVmgyrvAxBARVBSXrHuBMXcyJObBBS9crsecIhuWj10NNqCahTEu7+zVH4dxBO5E+S\n\thYjxq59uFGEcj/vt7WtZq792bq+Lcq6MZDKKs/FjAJgyX5zf2qDmrEtlma0ZOZ+DfX\n\tWBIvCd0Qz5dFQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658441074;\n\tbh=bZssmkOc1p22PEQIyyecM+XCA6URZEo4vcZwV1G3+dI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=WZD+jobM7JMOJvGnctQi4pn+TA7t8QJJbEqDQBN+hzsMJHBZMxyjStpgWmbqOXfee\n\tchjW4ZjGH4og/i9AB2+3g8Ye/UaZCkBmaDbeXGtUIaQvNop3vmS4HuDTlEzCbS1yph\n\tm2MhO0R99tAxFhohqhGs5c1SMseJvEPeJRS7MyTI="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"WZD+jobM\"; dkim-atps=neutral","Date":"Fri, 22 Jul 2022 01:04:32 +0300","To":"Florian Sylvestre <fsylvestre@baylibre.com>","Message-ID":"<YtnNcGmN5mXE5MSq@pendragon.ideasonboard.com>","References":"<20220720154221.50937-1-fsylvestre@baylibre.com>\n\t<20220720154221.50937-5-fsylvestre@baylibre.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220720154221.50937-5-fsylvestre@baylibre.com>","Subject":"Re: [libcamera-devel] [PATCH v2 4/4] 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":24044,"web_url":"https://patchwork.libcamera.org/comment/24044/","msgid":"<YtnOEYIXReZpSES5@pendragon.ideasonboard.com>","date":"2022-07-21T22:07:13","subject":"Re: [libcamera-devel] [PATCH v2 4/4] 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":"Another comment.\n\nOn Fri, Jul 22, 2022 at 01:04:33AM +0300, Laurent Pinchart wrote:\n> Hi Florian,\n> \n> Thank you for the patch.\n> \n> On Wed, Jul 20, 2022 at 05:42:21PM +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      | 94 ++++++++++++++++++++++++\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.h             |  7 ++\n> >  src/ipa/rkisp1/rkisp1.cpp                |  1 +\n> >  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +++\n> >  7 files changed, 146 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..7e9e8cf1\n> > --- /dev/null\n> > +++ b/src/ipa/rkisp1/algorithms/cproc.cpp\n> > @@ -0,0 +1,94 @@\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> > +\n> > +#include <libcamera/base/log.h>\n> > +\n> > +#include <libcamera/control_ids.h>\n> > +\n> > +#include \"libcamera/internal/yaml_parser.h\"\n\nI think you don't need this header as this algorithm doesn't retrieve\nany value from the tuning file.\n\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([[maybe_unused]] IPAContext &context,\n> > +\t\t\t\t   [[maybe_unused]] const uint32_t frame,\n> > +\t\t\t\t   const ControlList &controls)\n> > +{\n> \n> Let's shorten the lines with\n> \n> \tauto &cproc = context.frameContext.cproc;\n> \n> > +\tconst auto &brightness = controls.get(controls::Brightness);\n> > +\tif (brightness) {\n> > +\t\tcontext.frameContext.cproc.brightness = std::clamp(int(*brightness * 128), -128, 127);\n> \n> \t\tcproc.brightness = std::clamp(std::round(*brightness * 128), -128, 127);\n> \n> to round to the closest value instead of rounding down unconditionally\n> (you need to include <cmath>). Same below.\n> \n> > +\t\tcontext.frameContext.cproc.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\tcontext.frameContext.cproc.contrast = std::clamp(int(*contrast * 128), 0, 255);\n> > +\t\tcontext.frameContext.cproc.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\tcontext.frameContext.cproc.saturation = std::clamp(int(*saturation) * 128, 0, 255);\n> > +\t\tcontext.frameContext.cproc.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([[maybe_unused]] IPAContext &context,\n> > +\t\t\t      rkisp1_params_cfg *params)\n> > +{\n> \n> \tauto &cproc = context.frameContext.cproc;\n> \n> would also help here.\n> \n> > +\t/* Check if the algorithm configuration has been updated. */\n> > +\tif (!context.frameContext.cproc.updateParams)\n> > +\t\treturn;\n> > +\n> > +\tcontext.frameContext.cproc.updateParams = false;\n> > +\n> > +\tparams->others.cproc_config.brightness = context.frameContext.cproc.brightness;\n> > +\tparams->others.cproc_config.contrast = context.frameContext.cproc.contrast;\n> > +\tparams->others.cproc_config.sat = context.frameContext.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 7e078b0d..0ec17e07 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> >      'demosaicing.cpp',\n> >      'dpcc.cpp',\n> >      'gsl.cpp',\n> > diff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml\n> > index 4ae0ffc0..331f9d2d 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.h b/src/ipa/rkisp1/ipa_context.h\n> > index 241a4d04..e6a61c45 100644\n> > --- a/src/ipa/rkisp1/ipa_context.h\n> > +++ b/src/ipa/rkisp1/ipa_context.h\n> > @@ -62,6 +62,13 @@ struct IPAFrameContext {\n> >  \t\tbool updateParams;\n> >  \t} demosaicing;\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\tuint32_t exposure;\n> >  \t\tdouble gain;\n> > diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp\n> > index aeec8f50..c664642f 100644\n> > --- a/src/ipa/rkisp1/rkisp1.cpp\n> > +++ b/src/ipa/rkisp1/rkisp1.cpp\n> > @@ -31,6 +31,7 @@\n> >  #include \"algorithms/algorithm.h\"\n> >  #include \"algorithms/awb.h\"\n> >  #include \"algorithms/blc.h\"\n> > +#include \"algorithms/cproc.h\"\n> >  #include \"algorithms/demosaicing.h\"\n> >  #include \"algorithms/dpcc.h\"\n> >  #include \"algorithms/gsl.h\"\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> \n> This needs to move to the IPA, I'll send a patch on top.\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));","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 C755DBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 21 Jul 2022 22:07:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3401C63311;\n\tFri, 22 Jul 2022 00:07:18 +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 4C11160489\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Jul 2022 00:07:16 +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 BDCE76D5;\n\tFri, 22 Jul 2022 00:07:15 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1658441238;\n\tbh=rbNW0GcnTazKVUmkS9bXexJWjBtf2LEgwqnmphuFGfQ=;\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=vR4isLhEWQffIVsHQVMA7YQLhNL926+840GQsIMuSRemOxiTVvNY9vKtqB/tN3Uw8\n\taCFbkwn2cK3+DdKsVHtG8Jg31o6EzHUrb18eHU9TW/yaNfQGSSVio93WAZPur4OSr8\n\ts0iGLLHvyKvp6KuWRavpmGe48ZLY3fTBNSPqZ9Uoxwcc1AnOnO4LGjEc4cK1l+Jrh8\n\tFa++KxMoOyk6fqyEso2u37GW1Fv6IFH2zotoRYkCH4wfejiecG2ulWM0MyEEP9FdoR\n\t9Wtz64c+s3pOOEM9jZKr1Y0Qxf8eHXcsrntsSFRRRgz1dsq2SokxY+5GM0KRmr4Rkd\n\tOIIUc3+TcteNQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1658441235;\n\tbh=rbNW0GcnTazKVUmkS9bXexJWjBtf2LEgwqnmphuFGfQ=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=GINzIc+YhZMcZnIlHlRiyCkiDlyAynhRKodyw9gTMZKX9qG28t3bJctKBtaO9kXZe\n\tKTtrEUFh/sw0PZSIjlPF+rH+uUehcXp4uA3TowBqjWB19qTQGMn3h3vMdcrhu6w/qv\n\tHXZAewb+C8fsEslFmrwwWfBr6n6AvyaxX28yebOw="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"GINzIc+Y\"; dkim-atps=neutral","Date":"Fri, 22 Jul 2022 01:07:13 +0300","To":"Florian Sylvestre <fsylvestre@baylibre.com>","Message-ID":"<YtnOEYIXReZpSES5@pendragon.ideasonboard.com>","References":"<20220720154221.50937-1-fsylvestre@baylibre.com>\n\t<20220720154221.50937-5-fsylvestre@baylibre.com>\n\t<YtnNcGmN5mXE5MSq@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<YtnNcGmN5mXE5MSq@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 4/4] 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>"}}]