| Message ID | 20260211131728.96413-2-mzamazal@redhat.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
On 11/02/2026 13:17, Milan Zamazal wrote: > The black level value is passed to image processing, where it's used in > pixel value computations. To avoid troubles with weird black level > values (which are mostly theoretical but we should be still safe against > e.g. crazy values in testing tuning files) like division by zero, let's > make sure the black level passed to the image processing is lower than > the maximum pixel value. > > Signed-off-by: Milan Zamazal <mzamazal@redhat.com> > --- > src/ipa/simple/algorithms/blc.cpp | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp > index 464e43c27..b318d0354 100644 > --- a/src/ipa/simple/algorithms/blc.cpp > +++ b/src/ipa/simple/algorithms/blc.cpp > @@ -1,6 +1,6 @@ > /* SPDX-License-Identifier: LGPL-2.1-or-later */ > /* > - * Copyright (C) 2024-2025, Red Hat Inc. > + * Copyright (C) 2024-2026, Red Hat Inc. > * > * Black level handling > */ > @@ -52,8 +52,9 @@ void BlackLevel::prepare(IPAContext &context, > [[maybe_unused]] IPAFrameContext &frameContext, > DebayerParams *params) > { > - /* Latch the blacklevel gain so GPUISP can apply. */ > - params->blackLevel = RGB<float>(context.activeState.blc.level / 255.0f); > + /* Make sure the black level is sane, i.e. below maximum pixel value. */ > + params->blackLevel = RGB<float>(context.activeState.blc.level / 255.0f) > + .min(0.99); > } > > void BlackLevel::process(IPAContext &context, Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
diff --git a/src/ipa/simple/algorithms/blc.cpp b/src/ipa/simple/algorithms/blc.cpp index 464e43c27..b318d0354 100644 --- a/src/ipa/simple/algorithms/blc.cpp +++ b/src/ipa/simple/algorithms/blc.cpp @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ /* - * Copyright (C) 2024-2025, Red Hat Inc. + * Copyright (C) 2024-2026, Red Hat Inc. * * Black level handling */ @@ -52,8 +52,9 @@ void BlackLevel::prepare(IPAContext &context, [[maybe_unused]] IPAFrameContext &frameContext, DebayerParams *params) { - /* Latch the blacklevel gain so GPUISP can apply. */ - params->blackLevel = RGB<float>(context.activeState.blc.level / 255.0f); + /* Make sure the black level is sane, i.e. below maximum pixel value. */ + params->blackLevel = RGB<float>(context.activeState.blc.level / 255.0f) + .min(0.99); } void BlackLevel::process(IPAContext &context,
The black level value is passed to image processing, where it's used in pixel value computations. To avoid troubles with weird black level values (which are mostly theoretical but we should be still safe against e.g. crazy values in testing tuning files) like division by zero, let's make sure the black level passed to the image processing is lower than the maximum pixel value. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> --- src/ipa/simple/algorithms/blc.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)