[{"id":30787,"web_url":"https://patchwork.libcamera.org/comment/30787/","msgid":"<d35675bb-05b2-449d-a663-6596b981bf7c@ideasonboard.com>","date":"2024-08-13T11:10:55","subject":"Re: [PATCH v3 20/23] libcamera: software_isp: Use floating point for\n\tcolor parameters","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/people/156/","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"content":"Hi Milan\n\nOn 17/07/2024 09:54, Milan Zamazal wrote:\n> It's more natural to represent color gains and black level as floating\n> point numbers rather than using a particular pixel-related\n> representation.\n>\n> double is used rather than float because it's a more common floating\n> point type in libcamera algorithms.  Otherwise there is no obvious\n> reason to select one over the other here.\n>\n> The constructed color tables still use integer representation for\n> efficiency.\n>\n> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n> ---\n>   src/ipa/simple/algorithms/blc.cpp    |  8 ++++----\n>   src/ipa/simple/algorithms/colors.cpp | 26 ++++++++++++++------------\n>   src/ipa/simple/ipa_context.h         | 11 +++++------\n>   3 files changed, 23 insertions(+), 22 deletions(-)\n>\n> diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp\n> index 3b73d830..ab7e7dd9 100644\n> --- a/src/ipa/simple/algorithms/blc.cpp\n> +++ b/src/ipa/simple/algorithms/blc.cpp\n> @@ -24,7 +24,7 @@ BlackLevel::BlackLevel()\n>   int BlackLevel::init(IPAContext &context,\n>   \t\t     [[maybe_unused]] const YamlObject &tuningData)\n>   {\n> -\tcontext.activeState.black.level = 255;\n> +\tcontext.activeState.black.level = 1.0;\n\n\nI'm not sure I agree with that one actually...I expect it to be represented as an absolute pixel \nintensity value. Is there any functional benefit to making it a floating point? Side note: I think \nI'd also expect the starting point to be 0 rather than 255 (or 1.0), though I don't suppose it \nmatters too much.\n\n>   \treturn 0;\n>   }\n>   \n> @@ -44,16 +44,16 @@ void BlackLevel::process(IPAContext &context,\n>   \tconst unsigned int total =\n>   \t\tstd::accumulate(begin(histogram), end(histogram), 0);\n>   \tconst unsigned int pixelThreshold = ignoredPercentage_ * total;\n> -\tconst unsigned int histogramRatio = 256 / SwIspStats::kYHistogramSize;\n>   \tconst unsigned int currentBlackIdx =\n> -\t\tcontext.activeState.black.level / histogramRatio;\n> +\t\tcontext.activeState.black.level * SwIspStats::kYHistogramSize;\n>   \n>   \tfor (unsigned int i = 0, seen = 0;\n>   \t     i < currentBlackIdx && i < SwIspStats::kYHistogramSize;\n>   \t     i++) {\n>   \t\tseen += histogram[i];\n>   \t\tif (seen >= pixelThreshold) {\n> -\t\t\tcontext.activeState.black.level = i * histogramRatio;\n> +\t\t\tcontext.activeState.black.level =\n> +\t\t\t\tstatic_cast<double>(i) / SwIspStats::kYHistogramSize;\n>   \t\t\tLOG(IPASoftBL, Debug)\n>   \t\t\t\t<< \"Auto-set black level: \"\n>   \t\t\t\t<< i << \"/\" << SwIspStats::kYHistogramSize\n> diff --git a/src/ipa/simple/algorithms/colors.cpp b/src/ipa/simple/algorithms/colors.cpp\n> index 60fdca15..77492d9e 100644\n> --- a/src/ipa/simple/algorithms/colors.cpp\n> +++ b/src/ipa/simple/algorithms/colors.cpp\n> @@ -36,7 +36,7 @@ int Colors::init(IPAContext &context,\n>   \tupdateGammaTable(context);\n>   \n>   \tauto &gains = context.activeState.gains;\n> -\tgains.red = gains.green = gains.blue = 256;\n> +\tgains.red = gains.green = gains.blue = 1.0;\nGains being floats I agree with.\n>   \n>   \treturn 0;\n>   }\n> @@ -47,7 +47,7 @@ void Colors::updateGammaTable(IPAContext &context)\n>   \tauto &blackLevel = context.activeState.gamma.blackLevel;\n>   \tblackLevel = context.activeState.black.level;\n>   \tconst unsigned int blackIndex =\n> -\t\tblackLevel * IPAActiveState::kGammaLookupSize / 256;\n> +\t\tcontext.activeState.black.level * IPAActiveState::kGammaLookupSize;\n>   \tstd::fill(gammaTable.begin(), gammaTable.begin() + blackIndex, 0);\n>   \tconst float divisor = kGammaLookupSize - blackIndex - 1.0;\n>   \tfor (unsigned int i = blackIndex; i < kGammaLookupSize; i++)\n> @@ -67,15 +67,18 @@ void Colors::prepare(IPAContext &context,\n>   \tauto &gains = context.activeState.gains;\n>   \tauto &gammaTable = context.activeState.gamma.gammaTable;\n>   \tfor (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) {\n> -\t\tconstexpr unsigned int div =\n> -\t\t\tstatic_cast<double>(DebayerParams::kRGBLookupSize) * 256 / kGammaLookupSize;\n> +\t\tconstexpr double div =\n> +\t\t\tstatic_cast<double>(DebayerParams::kRGBLookupSize) / kGammaLookupSize;\n>   \t\t/* Apply gamma after gain! */\n>   \t\tunsigned int idx;\n> -\t\tidx = std::min({ i * gains.red / div, kGammaLookupSize - 1 });\n> +\t\tidx = std::min({ static_cast<unsigned int>(i * gains.red / div),\n> +\t\t\t\t kGammaLookupSize - 1 });\n>   \t\tparams->red[i] = gammaTable[idx];\n> -\t\tidx = std::min({ i * gains.green / div, kGammaLookupSize - 1 });\n> +\t\tidx = std::min({ static_cast<unsigned int>(i * gains.green / div),\n> +\t\t\t\t kGammaLookupSize - 1 });\n>   \t\tparams->green[i] = gammaTable[idx];\n> -\t\tidx = std::min({ i * gains.blue / div, kGammaLookupSize - 1 });\n> +\t\tidx = std::min({ static_cast<unsigned int>(i * gains.blue / div),\n> +\t\t\t\t kGammaLookupSize - 1 });\n>   \t\tparams->blue[i] = gammaTable[idx];\n>   \t}\n>   }\n> @@ -87,7 +90,7 @@ void Colors::process(IPAContext &context,\n>   \t\t     [[maybe_unused]] ControlList &metadata)\n>   {\n>   \tconst SwIspStats::Histogram &histogram = stats->yHistogram;\n> -\tconst uint8_t blackLevel = context.activeState.black.level;\n> +\tconst double blackLevel = context.activeState.black.level;\n>   \n>   \t/*\n>   \t * Black level must be subtracted to get the correct AWB ratios, they\n> @@ -104,12 +107,11 @@ void Colors::process(IPAContext &context,\n>   \t/*\n>   \t * Calculate red and blue gains for AWB.\n>   \t * Clamp max gain at 4.0, this also avoids 0 division.\n> -\t * Gain: 128 = 0.5, 256 = 1.0, 512 = 2.0, etc.\n>   \t */\n>   \tauto &gains = context.activeState.gains;\n> -\tgains.red = sumR <= sumG / 4 ? 1024 : 256 * sumG / sumR;\n> -\tgains.blue = sumB <= sumG / 4 ? 1024 : 256 * sumG / sumB;\n> -\t/* Green gain is fixed to 256 */\n> +\tgains.red = sumR <= sumG / 4 ? 4.0 : static_cast<double>(sumG) / sumR;\n> +\tgains.blue = sumB <= sumG / 4 ? 4.0 : static_cast<double>(sumG) / sumB;\n> +\t/* Green gain is fixed to 1.0 */\n>   \n>   \tLOG(IPASoftColors, Debug) << \"gain R/B \" << gains.red << \"/\" << gains.blue;\n>   }\n> diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n> index 979ddb8f..552d6cde 100644\n> --- a/src/ipa/simple/ipa_context.h\n> +++ b/src/ipa/simple/ipa_context.h\n> @@ -9,7 +9,6 @@\n>   #pragma once\n>   \n>   #include <array>\n> -#include <stdint.h>\n>   \n>   #include <libipa/fc_queue.h>\n>   \n> @@ -23,17 +22,17 @@ struct IPASessionConfiguration {\n>   \n>   struct IPAActiveState {\n>   \tstruct {\n> -\t\tuint8_t level;\n> +\t\tdouble level;\n>   \t} black;\n>   \tstruct {\n> -\t\tunsigned int red;\n> -\t\tunsigned int green;\n> -\t\tunsigned int blue;\n> +\t\tdouble red;\n> +\t\tdouble green;\n> +\t\tdouble blue;\n>   \t} gains;\n>   \tstatic constexpr unsigned int kGammaLookupSize = 1024;\n>   \tstruct {\n>   \t\tstd::array<double, kGammaLookupSize> gammaTable;\n> -\t\tuint8_t blackLevel;\n> +\t\tdouble blackLevel;\n>   \t} gamma;\n>   };\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 6210FBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Aug 2024 11:11:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4269A633B5;\n\tTue, 13 Aug 2024 13:11:00 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C29D263382\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Aug 2024 13:10:58 +0200 (CEST)","from [192.168.0.43]\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 873314AB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Aug 2024 13:10:01 +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=\"i7gXYSvV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1723547401;\n\tbh=QR8wGXyGk/AjWoNSfjSJwUgixEBapZhsJp/nf4/pRLI=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=i7gXYSvVmpT7hhCBwq5us5CkZPtYIiIZbrSBdo2rX6523gvI8VI+bRhkZ0Z148Zip\n\tfDmbGh19rxRBEk+nH+7NCJYIsVma7bUym4MEeXO7c5KymLb5yy4QTsCQtiRlQXhMHt\n\tQnV5pAO8VuJoBWMctTFNjyZmQ4h/RIA50qoMOUXM=","Message-ID":"<d35675bb-05b2-449d-a663-6596b981bf7c@ideasonboard.com>","Date":"Tue, 13 Aug 2024 12:10:55 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3 20/23] libcamera: software_isp: Use floating point for\n\tcolor parameters","To":"libcamera-devel@lists.libcamera.org","References":"<20240717085444.289997-1-mzamazal@redhat.com>\n\t<20240717085444.289997-21-mzamazal@redhat.com>","Content-Language":"en-US","From":"Dan Scally <dan.scally@ideasonboard.com>","Autocrypt":"addr=dan.scally@ideasonboard.com; keydata=\n\t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","In-Reply-To":"<20240717085444.289997-21-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>"}},{"id":30788,"web_url":"https://patchwork.libcamera.org/comment/30788/","msgid":"<87a5hgy7xs.fsf@redhat.com>","date":"2024-08-13T11:32:31","subject":"Re: [PATCH v3 20/23] libcamera: software_isp: Use floating point\n\tfor color parameters","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Hi Dan,\n\nthank you for review.\n\nDan Scally <dan.scally@ideasonboard.com> writes:\n\n> Hi Milan\n>\n> On 17/07/2024 09:54, Milan Zamazal wrote:\n>> It's more natural to represent color gains and black level as floating\n>> point numbers rather than using a particular pixel-related\n>> representation.\n>>\n>> double is used rather than float because it's a more common floating\n>> point type in libcamera algorithms.  Otherwise there is no obvious\n>> reason to select one over the other here.\n>>\n>> The constructed color tables still use integer representation for\n>> efficiency.\n>>\n>> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>> ---\n>>   src/ipa/simple/algorithms/blc.cpp    |  8 ++++----\n>>   src/ipa/simple/algorithms/colors.cpp | 26 ++++++++++++++------------\n>>   src/ipa/simple/ipa_context.h         | 11 +++++------\n>>   3 files changed, 23 insertions(+), 22 deletions(-)\n>>\n>> diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp\n>> index 3b73d830..ab7e7dd9 100644\n>> --- a/src/ipa/simple/algorithms/blc.cpp\n>> +++ b/src/ipa/simple/algorithms/blc.cpp\n>> @@ -24,7 +24,7 @@ BlackLevel::BlackLevel()\n>>   int BlackLevel::init(IPAContext &context,\n>>   \t\t     [[maybe_unused]] const YamlObject &tuningData)\n>>   {\n>> -\tcontext.activeState.black.level = 255;\n>> +\tcontext.activeState.black.level = 1.0;\n>\n>\n> I'm not sure I agree with that one actually...I expect it to be represented as an absolute pixel intensity value. Is there any functional\n> benefit to making it a floating point? \n\nThere is no functional benefit.  It's just to make it bit-width\nindependent but maybe it's better to avoid useless conversions.  Is this\nwhat you mean or do you have other reasons to prefer the pixel value?\n\n> Side note: I think I'd also expect the starting point to be 0 rather\n> than 255 (or 1.0), though I don't suppose it matters too much.\n\nIt's the maximum so that the algorithm below automatically updates it;\nnote that it is also assumed and has been observed that the right (low)\nblack level may not be reached on the first image run.  I'll add this\nexplanation to the commit message.\n\n>>   \treturn 0;\n>>   }\n>>   @@ -44,16 +44,16 @@ void BlackLevel::process(IPAContext &context,\n>>   \tconst unsigned int total =\n>>   \t\tstd::accumulate(begin(histogram), end(histogram), 0);\n>>   \tconst unsigned int pixelThreshold = ignoredPercentage_ * total;\n>> -\tconst unsigned int histogramRatio = 256 / SwIspStats::kYHistogramSize;\n>>   \tconst unsigned int currentBlackIdx =\n>> -\t\tcontext.activeState.black.level / histogramRatio;\n>> +\t\tcontext.activeState.black.level * SwIspStats::kYHistogramSize;\n>>     \tfor (unsigned int i = 0, seen = 0;\n>>   \t     i < currentBlackIdx && i < SwIspStats::kYHistogramSize;\n>>   \t     i++) {\n>>   \t\tseen += histogram[i];\n>>   \t\tif (seen >= pixelThreshold) {\n>> -\t\t\tcontext.activeState.black.level = i * histogramRatio;\n>> +\t\t\tcontext.activeState.black.level =\n>> +\t\t\t\tstatic_cast<double>(i) / SwIspStats::kYHistogramSize;\n>>   \t\t\tLOG(IPASoftBL, Debug)\n>>   \t\t\t\t<< \"Auto-set black level: \"\n>>   \t\t\t\t<< i << \"/\" << SwIspStats::kYHistogramSize\n>> diff --git a/src/ipa/simple/algorithms/colors.cpp b/src/ipa/simple/algorithms/colors.cpp\n>> index 60fdca15..77492d9e 100644\n>> --- a/src/ipa/simple/algorithms/colors.cpp\n>> +++ b/src/ipa/simple/algorithms/colors.cpp\n>> @@ -36,7 +36,7 @@ int Colors::init(IPAContext &context,\n>>   \tupdateGammaTable(context);\n>>     \tauto &gains = context.activeState.gains;\n>> -\tgains.red = gains.green = gains.blue = 256;\n>> +\tgains.red = gains.green = gains.blue = 1.0;\n> Gains being floats I agree with.\n>>     \treturn 0;\n>>   }\n>> @@ -47,7 +47,7 @@ void Colors::updateGammaTable(IPAContext &context)\n>>   \tauto &blackLevel = context.activeState.gamma.blackLevel;\n>>   \tblackLevel = context.activeState.black.level;\n>>   \tconst unsigned int blackIndex =\n>> -\t\tblackLevel * IPAActiveState::kGammaLookupSize / 256;\n>> +\t\tcontext.activeState.black.level * IPAActiveState::kGammaLookupSize;\n>>   \tstd::fill(gammaTable.begin(), gammaTable.begin() + blackIndex, 0);\n>>   \tconst float divisor = kGammaLookupSize - blackIndex - 1.0;\n>>   \tfor (unsigned int i = blackIndex; i < kGammaLookupSize; i++)\n>> @@ -67,15 +67,18 @@ void Colors::prepare(IPAContext &context,\n>>   \tauto &gains = context.activeState.gains;\n>>   \tauto &gammaTable = context.activeState.gamma.gammaTable;\n>>   \tfor (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) {\n>> -\t\tconstexpr unsigned int div =\n>> -\t\t\tstatic_cast<double>(DebayerParams::kRGBLookupSize) * 256 / kGammaLookupSize;\n>> +\t\tconstexpr double div =\n>> +\t\t\tstatic_cast<double>(DebayerParams::kRGBLookupSize) / kGammaLookupSize;\n>>   \t\t/* Apply gamma after gain! */\n>>   \t\tunsigned int idx;\n>> -\t\tidx = std::min({ i * gains.red / div, kGammaLookupSize - 1 });\n>> +\t\tidx = std::min({ static_cast<unsigned int>(i * gains.red / div),\n>> +\t\t\t\t kGammaLookupSize - 1 });\n>>   \t\tparams->red[i] = gammaTable[idx];\n>> -\t\tidx = std::min({ i * gains.green / div, kGammaLookupSize - 1 });\n>> +\t\tidx = std::min({ static_cast<unsigned int>(i * gains.green / div),\n>> +\t\t\t\t kGammaLookupSize - 1 });\n>>   \t\tparams->green[i] = gammaTable[idx];\n>> -\t\tidx = std::min({ i * gains.blue / div, kGammaLookupSize - 1 });\n>> +\t\tidx = std::min({ static_cast<unsigned int>(i * gains.blue / div),\n>> +\t\t\t\t kGammaLookupSize - 1 });\n>>   \t\tparams->blue[i] = gammaTable[idx];\n>>   \t}\n>>   }\n>> @@ -87,7 +90,7 @@ void Colors::process(IPAContext &context,\n>>   \t\t     [[maybe_unused]] ControlList &metadata)\n>>   {\n>>   \tconst SwIspStats::Histogram &histogram = stats->yHistogram;\n>> -\tconst uint8_t blackLevel = context.activeState.black.level;\n>> +\tconst double blackLevel = context.activeState.black.level;\n>>     \t/*\n>>   \t * Black level must be subtracted to get the correct AWB ratios, they\n>> @@ -104,12 +107,11 @@ void Colors::process(IPAContext &context,\n>>   \t/*\n>>   \t * Calculate red and blue gains for AWB.\n>>   \t * Clamp max gain at 4.0, this also avoids 0 division.\n>> -\t * Gain: 128 = 0.5, 256 = 1.0, 512 = 2.0, etc.\n>>   \t */\n>>   \tauto &gains = context.activeState.gains;\n>> -\tgains.red = sumR <= sumG / 4 ? 1024 : 256 * sumG / sumR;\n>> -\tgains.blue = sumB <= sumG / 4 ? 1024 : 256 * sumG / sumB;\n>> -\t/* Green gain is fixed to 256 */\n>> +\tgains.red = sumR <= sumG / 4 ? 4.0 : static_cast<double>(sumG) / sumR;\n>> +\tgains.blue = sumB <= sumG / 4 ? 4.0 : static_cast<double>(sumG) / sumB;\n>> +\t/* Green gain is fixed to 1.0 */\n>>     \tLOG(IPASoftColors, Debug) << \"gain R/B \" << gains.red << \"/\" << gains.blue;\n>>   }\n>> diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n>> index 979ddb8f..552d6cde 100644\n>> --- a/src/ipa/simple/ipa_context.h\n>> +++ b/src/ipa/simple/ipa_context.h\n>> @@ -9,7 +9,6 @@\n>>   #pragma once\n>>     #include <array>\n>> -#include <stdint.h>\n>>     #include <libipa/fc_queue.h>\n>>   @@ -23,17 +22,17 @@ struct IPASessionConfiguration {\n>>     struct IPAActiveState {\n>>   \tstruct {\n>> -\t\tuint8_t level;\n>> +\t\tdouble level;\n>>   \t} black;\n>>   \tstruct {\n>> -\t\tunsigned int red;\n>> -\t\tunsigned int green;\n>> -\t\tunsigned int blue;\n>> +\t\tdouble red;\n>> +\t\tdouble green;\n>> +\t\tdouble blue;\n>>   \t} gains;\n>>   \tstatic constexpr unsigned int kGammaLookupSize = 1024;\n>>   \tstruct {\n>>   \t\tstd::array<double, kGammaLookupSize> gammaTable;\n>> -\t\tuint8_t blackLevel;\n>> +\t\tdouble blackLevel;\n>>   \t} gamma;\n>>   };\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 12AE6C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Aug 2024 11:32:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E3ADC633B5;\n\tTue, 13 Aug 2024 13:32:38 +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 768A963382\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Aug 2024 13:32:37 +0200 (CEST)","from mail-wm1-f69.google.com (mail-wm1-f69.google.com\n\t[209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-605-0O7GRRYMN4WP43lY-j9sdA-1; Tue, 13 Aug 2024 07:32:34 -0400","by mail-wm1-f69.google.com with SMTP id\n\t5b1f17b1804b1-428040f49f9so38613045e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Aug 2024 04:32:34 -0700 (PDT)","from nuthatch (nat-pool-brq-t.redhat.com. [213.175.37.10])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-429c773700dsm139519465e9.37.2024.08.13.04.32.31\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 13 Aug 2024 04:32:32 -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=\"iWn8ZWSs\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1723548756;\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=t3yHyGy51rZgL1efZKIO6GD4Ylij8EjhBHhSMVpjdH0=;\n\tb=iWn8ZWSsA+TfqAfyh6YGhC2r5CLlk6JnEMzH0FtwymwdspP22gAtdAjVlRduobyRnfawMV\n\tIq5p7LviggT3nTPcu5jJLkaGj67rbgP71Kr01Yldhcrm+yHWNUHG/AQYzwGs8UtRGaHrBq\n\tmNRQ7qLXzQJAqm0kXl8GZoOUVEurQ4g=","X-MC-Unique":"0O7GRRYMN4WP43lY-j9sdA-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1723548753; x=1724153553;\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=t3yHyGy51rZgL1efZKIO6GD4Ylij8EjhBHhSMVpjdH0=;\n\tb=WNahy9ey/gN3ZdzGHy1GyioJzihj8OQQI9RIDwHLTwjCa+6Bk4csNvfb0/Tsjq33xK\n\t6rwAvvsT/coYTEoE33Q+iDLux0cBcaz0J7yEtadtvSiYBzDQRFBKTv0bsCcMNuMIx0G2\n\tlAoW/6g1GRq5jDdpRh2R4b1HNdRdB2fRxFCKJyvs9OM4HqZ2ejUenkRBlIRZoXuzFOIk\n\tzQns2Z0rPTm84l54E2g30eYp+uIcMRZfmAFc25Ve14FFh5MAkgrTk+sjRW241jqviH3g\n\tHZH/FFlxwlDvsdkzDhzjQrao8GDGk15EyUJ76jqUb722PZvKCPyxajmxoVsFTMLQeMpd\n\tUCLA==","X-Gm-Message-State":"AOJu0Yyr6IgT+OXNXikal1qfozX7L8ZVrdqGkmP3DZqi7gecjWmbi/xC\n\tJweNJF0xm6o61lgSjSMYmalZAVJb+u2hxYoHmqddPqGohRCiRhC1EgwkhLeSLZJe49aLZ3POmC5\n\t3dWiyciAITBQYeeOpRAb7+RzXPLTwtDvV768OXY9M77aPU56JBIyJGOVUIdjh4wDB1yLnGISP+U\n\t1wIrMCRxwql1uoyWcPtVvgvi7jB53j4SEBsQwzgfIbfdSqJN0RT9Q1eWk=","X-Received":["by 2002:a7b:cc86:0:b0:426:5fbe:bf75 with SMTP id\n\t5b1f17b1804b1-429d486ff81mr25575075e9.23.1723548753339; \n\tTue, 13 Aug 2024 04:32:33 -0700 (PDT)","by 2002:a7b:cc86:0:b0:426:5fbe:bf75 with SMTP id\n\t5b1f17b1804b1-429d486ff81mr25574805e9.23.1723548752691; \n\tTue, 13 Aug 2024 04:32:32 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IEk5ReiCnTXI7VKtogkhRQ5atPwBBcqJix/gA2KEFs1UbSmsAxK8jTGRk2smlBH96JIhXitjQ==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Dan Scally <dan.scally@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 20/23] libcamera: software_isp: Use floating point\n\tfor color parameters","In-Reply-To":"<d35675bb-05b2-449d-a663-6596b981bf7c@ideasonboard.com> (Dan\n\tScally's message of \"Tue, 13 Aug 2024 12:10:55 +0100\")","References":"<20240717085444.289997-1-mzamazal@redhat.com>\n\t<20240717085444.289997-21-mzamazal@redhat.com>\n\t<d35675bb-05b2-449d-a663-6596b981bf7c@ideasonboard.com>","Date":"Tue, 13 Aug 2024 13:32:31 +0200","Message-ID":"<87a5hgy7xs.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","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>"}},{"id":30838,"web_url":"https://patchwork.libcamera.org/comment/30838/","msgid":"<87sev6tby2.fsf@redhat.com>","date":"2024-08-15T08:41:41","subject":"Re: [PATCH v3 20/23] libcamera: software_isp: Use floating point\n\tfor color parameters","submitter":{"id":177,"url":"https://patchwork.libcamera.org/api/people/177/","name":"Milan Zamazal","email":"mzamazal@redhat.com"},"content":"Milan Zamazal <mzamazal@redhat.com> writes:\n\n> Hi Dan,\n>\n> thank you for review.\n>\n> Dan Scally <dan.scally@ideasonboard.com> writes:\n>\n>> Hi Milan\n>>\n>> On 17/07/2024 09:54, Milan Zamazal wrote:\n>>> It's more natural to represent color gains and black level as floating\n>>> point numbers rather than using a particular pixel-related\n>>> representation.\n>>>\n>>> double is used rather than float because it's a more common floating\n>>> point type in libcamera algorithms.  Otherwise there is no obvious\n>>> reason to select one over the other here.\n>>>\n>>> The constructed color tables still use integer representation for\n>>> efficiency.\n>>>\n>>> Signed-off-by: Milan Zamazal <mzamazal@redhat.com>\n>>> ---\n>>>   src/ipa/simple/algorithms/blc.cpp    |  8 ++++----\n>>>   src/ipa/simple/algorithms/colors.cpp | 26 ++++++++++++++------------\n>>>   src/ipa/simple/ipa_context.h         | 11 +++++------\n>>>   3 files changed, 23 insertions(+), 22 deletions(-)\n>>>\n>>> diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp\n>>> index 3b73d830..ab7e7dd9 100644\n>>> --- a/src/ipa/simple/algorithms/blc.cpp\n>>> +++ b/src/ipa/simple/algorithms/blc.cpp\n>>> @@ -24,7 +24,7 @@ BlackLevel::BlackLevel()\n>>>   int BlackLevel::init(IPAContext &context,\n>>>   \t\t     [[maybe_unused]] const YamlObject &tuningData)\n>>>   {\n>>> -\tcontext.activeState.black.level = 255;\n>>> +\tcontext.activeState.black.level = 1.0;\n>>\n>>\n>> I'm not sure I agree with that one actually...I expect it to be represented as an absolute pixel intensity value. Is there any functional\n>> benefit to making it a floating point? \n>\n> There is no functional benefit.  It's just to make it bit-width\n> independent but maybe it's better to avoid useless conversions.  Is this\n> what you mean or do you have other reasons to prefer the pixel value?\n\nAnd there is another option, to use the range that\nCameraSensorHelper::blackLevel() uses, see \"Get black level from the\ncamera helper\" patch.\n\nI don't have a strong preference for any of the options and I'm open to\narguments why some of them is better than the others.\n\n>> Side note: I think I'd also expect the starting point to be 0 rather\n>> than 255 (or 1.0), though I don't suppose it matters too much.\n>\n> It's the maximum so that the algorithm below automatically updates it;\n> note that it is also assumed and has been observed that the right (low)\n> black level may not be reached on the first image run.  I'll add this\n> explanation to the commit message.\n>\n>>>   \treturn 0;\n>>>   }\n>>>   @@ -44,16 +44,16 @@ void BlackLevel::process(IPAContext &context,\n>>>   \tconst unsigned int total =\n>>>   \t\tstd::accumulate(begin(histogram), end(histogram), 0);\n>>>   \tconst unsigned int pixelThreshold = ignoredPercentage_ * total;\n>>> -\tconst unsigned int histogramRatio = 256 / SwIspStats::kYHistogramSize;\n>>>   \tconst unsigned int currentBlackIdx =\n>>> -\t\tcontext.activeState.black.level / histogramRatio;\n>>> +\t\tcontext.activeState.black.level * SwIspStats::kYHistogramSize;\n>>>     \tfor (unsigned int i = 0, seen = 0;\n>>>   \t     i < currentBlackIdx && i < SwIspStats::kYHistogramSize;\n>>>   \t     i++) {\n>>>   \t\tseen += histogram[i];\n>>>   \t\tif (seen >= pixelThreshold) {\n>>> -\t\t\tcontext.activeState.black.level = i * histogramRatio;\n>>> +\t\t\tcontext.activeState.black.level =\n>>> +\t\t\t\tstatic_cast<double>(i) / SwIspStats::kYHistogramSize;\n>>>   \t\t\tLOG(IPASoftBL, Debug)\n>>>   \t\t\t\t<< \"Auto-set black level: \"\n>>>   \t\t\t\t<< i << \"/\" << SwIspStats::kYHistogramSize\n>>> diff --git a/src/ipa/simple/algorithms/colors.cpp b/src/ipa/simple/algorithms/colors.cpp\n>>> index 60fdca15..77492d9e 100644\n>>> --- a/src/ipa/simple/algorithms/colors.cpp\n>>> +++ b/src/ipa/simple/algorithms/colors.cpp\n>>> @@ -36,7 +36,7 @@ int Colors::init(IPAContext &context,\n>>>   \tupdateGammaTable(context);\n>>>     \tauto &gains = context.activeState.gains;\n>>> -\tgains.red = gains.green = gains.blue = 256;\n>>> +\tgains.red = gains.green = gains.blue = 1.0;\n>> Gains being floats I agree with.\n>>>     \treturn 0;\n>>>   }\n>>> @@ -47,7 +47,7 @@ void Colors::updateGammaTable(IPAContext &context)\n>>>   \tauto &blackLevel = context.activeState.gamma.blackLevel;\n>>>   \tblackLevel = context.activeState.black.level;\n>>>   \tconst unsigned int blackIndex =\n>>> -\t\tblackLevel * IPAActiveState::kGammaLookupSize / 256;\n>>> +\t\tcontext.activeState.black.level * IPAActiveState::kGammaLookupSize;\n>>>   \tstd::fill(gammaTable.begin(), gammaTable.begin() + blackIndex, 0);\n>>>   \tconst float divisor = kGammaLookupSize - blackIndex - 1.0;\n>>>   \tfor (unsigned int i = blackIndex; i < kGammaLookupSize; i++)\n>>> @@ -67,15 +67,18 @@ void Colors::prepare(IPAContext &context,\n>>>   \tauto &gains = context.activeState.gains;\n>>>   \tauto &gammaTable = context.activeState.gamma.gammaTable;\n>>>   \tfor (unsigned int i = 0; i < DebayerParams::kRGBLookupSize; i++) {\n>>> -\t\tconstexpr unsigned int div =\n>>> -\t\t\tstatic_cast<double>(DebayerParams::kRGBLookupSize) * 256 / kGammaLookupSize;\n>>> +\t\tconstexpr double div =\n>>> +\t\t\tstatic_cast<double>(DebayerParams::kRGBLookupSize) / kGammaLookupSize;\n>>>   \t\t/* Apply gamma after gain! */\n>>>   \t\tunsigned int idx;\n>>> -\t\tidx = std::min({ i * gains.red / div, kGammaLookupSize - 1 });\n>>> +\t\tidx = std::min({ static_cast<unsigned int>(i * gains.red / div),\n>>> +\t\t\t\t kGammaLookupSize - 1 });\n>>>   \t\tparams->red[i] = gammaTable[idx];\n>>> -\t\tidx = std::min({ i * gains.green / div, kGammaLookupSize - 1 });\n>>> +\t\tidx = std::min({ static_cast<unsigned int>(i * gains.green / div),\n>>> +\t\t\t\t kGammaLookupSize - 1 });\n>>>   \t\tparams->green[i] = gammaTable[idx];\n>>> -\t\tidx = std::min({ i * gains.blue / div, kGammaLookupSize - 1 });\n>>> +\t\tidx = std::min({ static_cast<unsigned int>(i * gains.blue / div),\n>>> +\t\t\t\t kGammaLookupSize - 1 });\n>>>   \t\tparams->blue[i] = gammaTable[idx];\n>>>   \t}\n>>>   }\n>>> @@ -87,7 +90,7 @@ void Colors::process(IPAContext &context,\n>>>   \t\t     [[maybe_unused]] ControlList &metadata)\n>>>   {\n>>>   \tconst SwIspStats::Histogram &histogram = stats->yHistogram;\n>>> -\tconst uint8_t blackLevel = context.activeState.black.level;\n>>> +\tconst double blackLevel = context.activeState.black.level;\n>>>     \t/*\n>>>   \t * Black level must be subtracted to get the correct AWB ratios, they\n>>> @@ -104,12 +107,11 @@ void Colors::process(IPAContext &context,\n>>>   \t/*\n>>>   \t * Calculate red and blue gains for AWB.\n>>>   \t * Clamp max gain at 4.0, this also avoids 0 division.\n>>> -\t * Gain: 128 = 0.5, 256 = 1.0, 512 = 2.0, etc.\n>>>   \t */\n>>>   \tauto &gains = context.activeState.gains;\n>>> -\tgains.red = sumR <= sumG / 4 ? 1024 : 256 * sumG / sumR;\n>>> -\tgains.blue = sumB <= sumG / 4 ? 1024 : 256 * sumG / sumB;\n>>> -\t/* Green gain is fixed to 256 */\n>>> +\tgains.red = sumR <= sumG / 4 ? 4.0 : static_cast<double>(sumG) / sumR;\n>>> +\tgains.blue = sumB <= sumG / 4 ? 4.0 : static_cast<double>(sumG) / sumB;\n>>> +\t/* Green gain is fixed to 1.0 */\n>>>     \tLOG(IPASoftColors, Debug) << \"gain R/B \" << gains.red << \"/\" << gains.blue;\n>>>   }\n>>> diff --git a/src/ipa/simple/ipa_context.h b/src/ipa/simple/ipa_context.h\n>>> index 979ddb8f..552d6cde 100644\n>>> --- a/src/ipa/simple/ipa_context.h\n>>> +++ b/src/ipa/simple/ipa_context.h\n>>> @@ -9,7 +9,6 @@\n>>>   #pragma once\n>>>     #include <array>\n>>> -#include <stdint.h>\n>>>     #include <libipa/fc_queue.h>\n>>>   @@ -23,17 +22,17 @@ struct IPASessionConfiguration {\n>>>     struct IPAActiveState {\n>>>   \tstruct {\n>>> -\t\tuint8_t level;\n>>> +\t\tdouble level;\n>>>   \t} black;\n>>>   \tstruct {\n>>> -\t\tunsigned int red;\n>>> -\t\tunsigned int green;\n>>> -\t\tunsigned int blue;\n>>> +\t\tdouble red;\n>>> +\t\tdouble green;\n>>> +\t\tdouble blue;\n>>>   \t} gains;\n>>>   \tstatic constexpr unsigned int kGammaLookupSize = 1024;\n>>>   \tstruct {\n>>>   \t\tstd::array<double, kGammaLookupSize> gammaTable;\n>>> -\t\tuint8_t blackLevel;\n>>> +\t\tdouble blackLevel;\n>>>   \t} gamma;\n>>>   };\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 C0AFBBDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 Aug 2024 08:41:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BD491633BE;\n\tThu, 15 Aug 2024 10:41:48 +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 54C0363393\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 Aug 2024 10:41:47 +0200 (CEST)","from mail-wr1-f72.google.com (mail-wr1-f72.google.com\n\t[209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS\n\t(version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n\tus-mta-619-1DMUGyb2PM-l3PjYymFMyQ-1; Thu, 15 Aug 2024 04:41:44 -0400","by mail-wr1-f72.google.com with SMTP id\n\tffacd0b85a97d-371845055aaso362884f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 15 Aug 2024 01:41:44 -0700 (PDT)","from nuthatch (ip-77-48-47-2.net.vodafone.cz. [77.48.47.2])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-371898aad93sm926469f8f.95.2024.08.15.01.41.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 15 Aug 2024 01:41:41 -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=\"HEtgV17l\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n\ts=mimecast20190719; t=1723711306;\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=3F8y7Z2cPs8zegHUF1IvF7GyuanisU+sf746cGZzXiU=;\n\tb=HEtgV17lcg4Amp6kLuYwOTyqGvEiBifpN4HxJHMBfeSjD3qBGmJrNIkmUxuk6I0DALDcvc\n\tZOWXE2iOWxd3HUcU3I+H5la3PJOze363OkNJZh/PGTT7Iwjwls9wzW2jRAC1PQAVeJp5bM\n\tvkXu0iVbxhYKH2gER3XMED8IEbtAsTM=","X-MC-Unique":"1DMUGyb2PM-l3PjYymFMyQ-1","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1723711303; x=1724316103;\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=3F8y7Z2cPs8zegHUF1IvF7GyuanisU+sf746cGZzXiU=;\n\tb=C/qz9RuTzTvFwtI5JgRS8t14w8mfXHyBMPyYPmnazPZVBWElF/5WPuKtMShnVXOn7w\n\tct+c51r9zNDEjxF/WqfWNP87fy8Xps5VFsI0OCAZRXUeB3ElF3Q2ujoOmT9daJr8enHJ\n\tmsUGmXn1ukQ3Hhzcn9hKmKaksH75XhSQCOQUZ0aaIuG1hpY7rWEvh0PjUW1ATt37ePUM\n\tz422GfLCfpKLPMQcZ0HqW4ntyMzcN5fux8n2Nm0L0qcho5WVg+a0xSSGCZqyijMN/gLz\n\t/urQEfoZ4SUepbiKvPcMPJHQKfv57KMbC2w6ZU1mvFZ8K+QN4f8p/XUBWpEW4HvD0kpl\n\tr9fA==","X-Gm-Message-State":"AOJu0YyN3pwN/uur3ESPrXEptLkG+bZz0ahuKVsAGY32lX1Swc7ox+35\n\t2YcIm06m96xI9rj9dEH+rcvEcFI0YngsJI+KJaSKDnqA9LmjEQ29bTybeaZu/PBiZiPZ+cLq5t0\n\tvEoymXb1rhgpWdO7JWUmzoDiG3rrxdr3SH+Y/Mwetwt+/dOLzPu/4XrSsEYkEcxAHt/y17U0wdL\n\tgnX2p3OWBVM5uh5GY/RgB/3t08CzHoSEFTJswCi+uArlNT38Kw5oU0zJ0=","X-Received":["by 2002:a5d:564c:0:b0:367:93b3:5d5a with SMTP id\n\tffacd0b85a97d-3717780b16fmr3158915f8f.57.1723711302953; \n\tThu, 15 Aug 2024 01:41:42 -0700 (PDT)","by 2002:a5d:564c:0:b0:367:93b3:5d5a with SMTP id\n\tffacd0b85a97d-3717780b16fmr3158898f8f.57.1723711302366; \n\tThu, 15 Aug 2024 01:41:42 -0700 (PDT)"],"X-Google-Smtp-Source":"AGHT+IHwWFe/yDcBD78kam83ZSprdO0LqvDkMau9gnB6oO+SYO0zysnYERMfOftlwP8i+ndto05oZg==","From":"Milan Zamazal <mzamazal@redhat.com>","To":"Dan Scally <dan.scally@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 20/23] libcamera: software_isp: Use floating point\n\tfor color parameters","In-Reply-To":"<87a5hgy7xs.fsf@redhat.com> (Milan Zamazal's message of \"Tue, 13\n\tAug 2024 13:32:31 +0200\")","References":"<20240717085444.289997-1-mzamazal@redhat.com>\n\t<20240717085444.289997-21-mzamazal@redhat.com>\n\t<d35675bb-05b2-449d-a663-6596b981bf7c@ideasonboard.com>\n\t<87a5hgy7xs.fsf@redhat.com>","Date":"Thu, 15 Aug 2024 10:41:41 +0200","Message-ID":"<87sev6tby2.fsf@redhat.com>","User-Agent":"Gnus/5.13 (Gnus v5.13)","MIME-Version":"1.0","X-Mimecast-Spam-Score":"0","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>"}}]