[{"id":36265,"web_url":"https://patchwork.libcamera.org/comment/36265/","msgid":"<176056529726.162040.16374903468548880149@ping.linuxembedded.co.uk>","date":"2025-10-15T21:54:57","subject":"Re: [PATCH v3 11/39] libcamera: software_isp: Move param select code\n\tto Debayer base class","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Bryan O'Donoghue (2025-10-15 02:22:23)\n> Move the parameter selection code into the Debayer base class in-order to\n> facilitate reuse of the lookup tables in the eGL shaders.\n\nAll just a move so:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> \n> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n> ---\n>  src/libcamera/software_isp/debayer.cpp     | 27 ++++++++++++++++++++++\n>  src/libcamera/software_isp/debayer.h       |  3 +++\n>  src/libcamera/software_isp/debayer_cpu.cpp | 19 +--------------\n>  3 files changed, 31 insertions(+), 18 deletions(-)\n> \n> diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\n> index 937d5e2e..cf74b92b 100644\n> --- a/src/libcamera/software_isp/debayer.cpp\n> +++ b/src/libcamera/software_isp/debayer.cpp\n> @@ -187,4 +187,31 @@ Debayer::~Debayer()\n>   * \\brief Signals when the output buffer is ready\n>   */\n>  \n> +/**\n> + * \\fn void Debayer::setParams(DebayerParams &params)\n> + * \\brief Select the bayer params to use for the next frame debayer\n> + * \\param[in] params The parameters to be used in debayering\n> + */\n> +void Debayer::setParams(DebayerParams &params)\n> +{\n> +       green_ = params.green;\n> +       greenCcm_ = params.greenCcm;\n> +       if (swapRedBlueGains_) {\n> +               red_ = params.blue;\n> +               blue_ = params.red;\n> +               redCcm_ = params.blueCcm;\n> +               blueCcm_ = params.redCcm;\n> +               for (unsigned int i = 0; i < 256; i++) {\n> +                       std::swap(redCcm_[i].r, redCcm_[i].b);\n> +                       std::swap(blueCcm_[i].r, blueCcm_[i].b);\n> +               }\n> +       } else {\n> +               red_ = params.red;\n> +               blue_ = params.blue;\n> +               redCcm_ = params.redCcm;\n> +               blueCcm_ = params.blueCcm;\n> +       }\n> +       gammaLut_ = params.gammaLut;\n> +}\n> +\n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h\n> index 2cbf0823..c04c289d 100644\n> --- a/src/libcamera/software_isp/debayer.h\n> +++ b/src/libcamera/software_isp/debayer.h\n> @@ -93,6 +93,9 @@ public:\n>  \n>  private:\n>         virtual Size patternSize(PixelFormat inputFormat) = 0;\n> +\n> +protected:\n> +       void setParams(DebayerParams &params);\n>  };\n>  \n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\n> index 42a0f374..6be5cdbd 100644\n> --- a/src/libcamera/software_isp/debayer_cpu.cpp\n> +++ b/src/libcamera/software_isp/debayer_cpu.cpp\n> @@ -758,24 +758,7 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output\n>         for (const FrameBuffer::Plane &plane : output->planes())\n>                 dmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write);\n>  \n> -       green_ = params.green;\n> -       greenCcm_ = params.greenCcm;\n> -       if (swapRedBlueGains_) {\n> -               red_ = params.blue;\n> -               blue_ = params.red;\n> -               redCcm_ = params.blueCcm;\n> -               blueCcm_ = params.redCcm;\n> -               for (unsigned int i = 0; i < 256; i++) {\n> -                       std::swap(redCcm_[i].r, redCcm_[i].b);\n> -                       std::swap(blueCcm_[i].r, blueCcm_[i].b);\n> -               }\n> -       } else {\n> -               red_ = params.red;\n> -               blue_ = params.blue;\n> -               redCcm_ = params.redCcm;\n> -               blueCcm_ = params.blueCcm;\n> -       }\n> -       gammaLut_ = params.gammaLut;\n> +       setParams(params);\n>  \n>         /* Copy metadata from the input buffer */\n>         FrameMetadata &metadata = output->_d()->metadata();\n> -- \n> 2.51.0\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 DABF1BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Oct 2025 21:55:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E30066062F;\n\tWed, 15 Oct 2025 23:55:01 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 91C4060615\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Oct 2025 23:55:00 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E912BE7C;\n\tWed, 15 Oct 2025 23:53:20 +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=\"IR+JYsLj\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1760565201;\n\tbh=x6HZxdPXhY2HQhpAuOUuDOiuSiye4RFJ72p0X0x+jgE=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=IR+JYsLjMCiPw+NVATVLCqdlt0mmAs6ejVUkG44NxRNPNk4x6FQv028TmUKpS9VsC\n\tvMY8zc/a6VXxd+Z3wJG7X3KGH8CaSmynXyP3ylxjFVJi+AVfEl/QXzH6BvWBTSn3xH\n\tlPeEQw0IIF7GMX5cmkQZ5BcgE9XNylSKHAv8y8Dw=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251015012251.17508-12-bryan.odonoghue@linaro.org>","References":"<20251015012251.17508-1-bryan.odonoghue@linaro.org>\n\t<20251015012251.17508-12-bryan.odonoghue@linaro.org>","Subject":"Re: [PATCH v3 11/39] libcamera: software_isp: Move param select code\n\tto Debayer base class","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"hdegoede@redhat.com, mzamazal@redhat.com, bryan.odonoghue@linaro.org,\n\tbod.linux@nxsw.ie","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 15 Oct 2025 22:54:57 +0100","Message-ID":"<176056529726.162040.16374903468548880149@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}},{"id":36298,"web_url":"https://patchwork.libcamera.org/comment/36298/","msgid":"<85a51rgse5.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","date":"2025-10-16T08:30:58","subject":"Re: [PATCH v3 11/39] libcamera: software_isp: Move param select\n\tcode to Debayer base class","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:\n\n> Move the parameter selection code into the Debayer base class in-order to\n> facilitate reuse of the lookup tables in the eGL shaders.\n>\n> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>\n\nReviewed-by: Milan Zamazal <mzamazal@redhat.com>\n\n> ---\n>  src/libcamera/software_isp/debayer.cpp     | 27 ++++++++++++++++++++++\n>  src/libcamera/software_isp/debayer.h       |  3 +++\n>  src/libcamera/software_isp/debayer_cpu.cpp | 19 +--------------\n>  3 files changed, 31 insertions(+), 18 deletions(-)\n>\n> diff --git a/src/libcamera/software_isp/debayer.cpp b/src/libcamera/software_isp/debayer.cpp\n> index 937d5e2e..cf74b92b 100644\n> --- a/src/libcamera/software_isp/debayer.cpp\n> +++ b/src/libcamera/software_isp/debayer.cpp\n> @@ -187,4 +187,31 @@ Debayer::~Debayer()\n>   * \\brief Signals when the output buffer is ready\n>   */\n>  \n> +/**\n> + * \\fn void Debayer::setParams(DebayerParams &params)\n> + * \\brief Select the bayer params to use for the next frame debayer\n> + * \\param[in] params The parameters to be used in debayering\n> + */\n> +void Debayer::setParams(DebayerParams &params)\n> +{\n> +\tgreen_ = params.green;\n> +\tgreenCcm_ = params.greenCcm;\n> +\tif (swapRedBlueGains_) {\n> +\t\tred_ = params.blue;\n> +\t\tblue_ = params.red;\n> +\t\tredCcm_ = params.blueCcm;\n> +\t\tblueCcm_ = params.redCcm;\n> +\t\tfor (unsigned int i = 0; i < 256; i++) {\n> +\t\t\tstd::swap(redCcm_[i].r, redCcm_[i].b);\n> +\t\t\tstd::swap(blueCcm_[i].r, blueCcm_[i].b);\n> +\t\t}\n> +\t} else {\n> +\t\tred_ = params.red;\n> +\t\tblue_ = params.blue;\n> +\t\tredCcm_ = params.redCcm;\n> +\t\tblueCcm_ = params.blueCcm;\n> +\t}\n> +\tgammaLut_ = params.gammaLut;\n> +}\n> +\n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/software_isp/debayer.h b/src/libcamera/software_isp/debayer.h\n> index 2cbf0823..c04c289d 100644\n> --- a/src/libcamera/software_isp/debayer.h\n> +++ b/src/libcamera/software_isp/debayer.h\n> @@ -93,6 +93,9 @@ public:\n>  \n>  private:\n>  \tvirtual Size patternSize(PixelFormat inputFormat) = 0;\n> +\n> +protected:\n> +\tvoid setParams(DebayerParams &params);\n>  };\n>  \n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/software_isp/debayer_cpu.cpp b/src/libcamera/software_isp/debayer_cpu.cpp\n> index 42a0f374..6be5cdbd 100644\n> --- a/src/libcamera/software_isp/debayer_cpu.cpp\n> +++ b/src/libcamera/software_isp/debayer_cpu.cpp\n> @@ -758,24 +758,7 @@ void DebayerCpu::process(uint32_t frame, FrameBuffer *input, FrameBuffer *output\n>  \tfor (const FrameBuffer::Plane &plane : output->planes())\n>  \t\tdmaSyncers.emplace_back(plane.fd, DmaSyncer::SyncType::Write);\n>  \n> -\tgreen_ = params.green;\n> -\tgreenCcm_ = params.greenCcm;\n> -\tif (swapRedBlueGains_) {\n> -\t\tred_ = params.blue;\n> -\t\tblue_ = params.red;\n> -\t\tredCcm_ = params.blueCcm;\n> -\t\tblueCcm_ = params.redCcm;\n> -\t\tfor (unsigned int i = 0; i < 256; i++) {\n> -\t\t\tstd::swap(redCcm_[i].r, redCcm_[i].b);\n> -\t\t\tstd::swap(blueCcm_[i].r, blueCcm_[i].b);\n> -\t\t}\n> -\t} else {\n> -\t\tred_ = params.red;\n> -\t\tblue_ = params.blue;\n> -\t\tredCcm_ = params.redCcm;\n> -\t\tblueCcm_ = params.blueCcm;\n> -\t}\n> -\tgammaLut_ = params.gammaLut;\n> +\tsetParams(params);\n>  \n>  \t/* Copy metadata from the input buffer */\n>  \tFrameMetadata &metadata = output->_d()->metadata();","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 032EFBE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 16 Oct 2025 08:31:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DDE1C60663;\n\tThu, 16 Oct 2025 10:31:05 +0200 (CEST)","from us-smtp-delivery-124.mimecast.com\n\t(us-smtp-delivery-124.mimecast.com [170.10.129.124])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1A052600CC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Oct 2025 10:31:03 +0200 (CEST)","from mail-ej1-f70.google.com (mail-ej1-f70.google.com\n\t[209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-601-hN4eSw2mO36wb5ZoGfNrRA-1; Thu, 16 Oct 2025 04:31:01 -0400","by mail-ej1-f70.google.com with SMTP id\n\ta640c23a62f3a-b2f989de76eso211229966b.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 16 Oct 2025 01:31:01 -0700 (PDT)","from mzamazal-thinkpadp1gen7.tpbc.csb\n\t(ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\ta640c23a62f3a-b5ccd6b8e15sm455435566b.81.2025.10.16.01.30.58\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 16 Oct 2025 01:30:59 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=redhat.com header.i=@redhat.com\n\theader.b=\"WgUJMmiX\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1760603463;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=6zx8A+GFfJXxGaN+tlVrsk0TLUSFpsLjeCknqp+GCJ8=;\n\tb=WgUJMmiXAj7YiFolJ4yGZM284su4EabpTyuiWgNVnSWd+RxHcieRLNFCEamyioFMaWvKHH\n\tml1qwZDb/z0alRJYlxUrRoa/Wa57nkNQnyWeItqy0kg0ccJ7Gkaf38HmNeqS9ffEG/aqHb\n\tQnB5fVccgzDBKTIoJh6Pso9sOck6fXE=","X-MC-Unique":"hN4eSw2mO36wb5ZoGfNrRA-1","X-Mimecast-MFC-AGG-ID":"hN4eSw2mO36wb5ZoGfNrRA_1760603460","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1760603460; x=1761208260;\n\th=mime-version:user-agent:message-id:date:references:in-reply-to\n\t:subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=6zx8A+GFfJXxGaN+tlVrsk0TLUSFpsLjeCknqp+GCJ8=;\n\tb=L+wVBmHWTSlZ0Okg9zUqoXrA4gabtCvngns2Cc1VNWf5/gQDmD6JdxsPIB7ZII3yS5\n\tNSVAkMlgLPaWEcSYK6xkESEAVwMG5LcTReo44BtzPVuWq+02Bn5uENEodgT0VPtZCZ/l\n\tVOiUY25ze1s/72NGw7SGwAtJTcO/DZYSd8an2NGq85hmIVBFcE7pWEv9zRhnAB6BuEkI\n\t6C9kgbw5lOIzBZ/B+kaW+Osa1ZgF21t/iF41P1qiR58Jdb5mKojpOm7P9mcTD5coEuKM\n\tSUppHaq6nj53nKRx8Ucrt9svs2i5C1aY85cdyfs846nuerhBlMnePOGdXKjauw7tpcAx\n\tP9Sw==","X-Gm-Message-State":"AOJu0Yw7DOzsOmGbQFLeA+Zr3vdeYBCs2FIky0gmqvYcZkwuhrL6ewPx\n\tbNI6vU200dPrQ6LKTtuh3jniMEn+F30ONOkUG4ap9CQ4fMbdlVXWA4iif69xyyTv/R/pwqnpkPo\n\tNkI7dDEAoq10eKNDUIVDBCgR9NUVM8BHFVqOsngAanEc/wbF7NTyRzmDRhGkWpgRYU1xaeN0yBd\n\tU=","X-Gm-Gg":"ASbGnctu9buhaWc9MyEXumRjs6rcqvfB5QLvxA9JZgSWhPOcdMHkmIAE6J/1BGcYW8K\n\tYK93IOTUmxzbKDLkp0+LCK6bQaj9/fD9uZgMsNWWtxrU73xr2HTU24SpZNZ2hGwlSeuvevWf5VK\n\tuj73MrxGEwLOZXJcLcxOc5xQjAohbpTaHu05cx3OGgB7qsRFV5sXOd2CNlD09Gob5N9Gvl65gxS\n\tqiFnD27S2DyFvxAIQ/Xi2WU6Dckyap19+bfahzi4xh6pXliQ4HTCKo41XGwkVUtKWWGb9qzzcxp\n\txUnHV0uKJuKOnfXxW+RjYYsi4U1CsklOrBKOgmpsOtusM11PX27hWTDM3EXMiFSyZsyh+TXKORY\n\twne6lLijruZtFayXk3BYfKQEdaDZyxHAzdEeSn7gHCZJ1d3LK0WW5","X-Received":["by 2002:a17:906:9f87:b0:b41:c602:c75d with SMTP id\n\ta640c23a62f3a-b6053f1e8f8mr379617366b.31.1760603460311; \n\tThu, 16 Oct 2025 01:31:00 -0700 (PDT)","by 2002:a17:906:9f87:b0:b41:c602:c75d with SMTP id\n\ta640c23a62f3a-b6053f1e8f8mr379612666b.31.1760603459787; \n\tThu, 16 Oct 2025 01:30:59 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IE2gCd7sTvQrTNRAr9QZLnw+wTPLeTgWTGxtqMhLiQTnFMseV677YYOBzsWV/LX0QhzkaXKYg==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Bryan O'Donoghue <bryan.odonoghue@linaro.org>","Cc":"libcamera-devel@lists.libcamera.org,  hdegoede@redhat.com,\n\tbod.linux@nxsw.ie","Subject":"Re: [PATCH v3 11/39] libcamera: software_isp: Move param select\n\tcode to Debayer base class","In-Reply-To":"<20251015012251.17508-12-bryan.odonoghue@linaro.org> (Bryan\n\tO'Donoghue's message of \"Wed, 15 Oct 2025 02:22:23 +0100\")","References":"<20251015012251.17508-1-bryan.odonoghue@linaro.org>\n\t<20251015012251.17508-12-bryan.odonoghue@linaro.org>","Date":"Thu, 16 Oct 2025 10:30:58 +0200","Message-ID":"<85a51rgse5.fsf@mzamazal-thinkpadp1gen7.tpbc.csb>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"IJUasB6XfuCpljopIpkYmM4XP9oB-Gz7R5rhw2QqjvU_1760603460","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain","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>"}}]