| Message ID | 20251011160335.50578-4-kieran.bingham@ideasonboard.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
Hi Kieran On Sat, Oct 11, 2025 at 05:03:31PM +0100, Kieran Bingham wrote: > Move the black level handling into the blc module. > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > src/ipa/mali-c55/algorithms/blc.cpp | 20 +++++++++++++------- > src/ipa/mali-c55/ipa_context.h | 1 - > src/ipa/mali-c55/mali-c55.cpp | 10 ---------- > 3 files changed, 13 insertions(+), 18 deletions(-) > > diff --git a/src/ipa/mali-c55/algorithms/blc.cpp b/src/ipa/mali-c55/algorithms/blc.cpp > index 85642c0435a2..1fdd00ccc2ea 100644 > --- a/src/ipa/mali-c55/algorithms/blc.cpp > +++ b/src/ipa/mali-c55/algorithms/blc.cpp > @@ -64,17 +64,23 @@ int BlackLevelCorrection::init([[maybe_unused]] IPAContext &context, > int BlackLevelCorrection::configure(IPAContext &context, > [[maybe_unused]] const IPACameraSensorInfo &configInfo) > { > + if (!context.camHelper->blackLevel().has_value()) > + return 0; > + > + /* > + * The black level from CameraSensorHelper is a 16-bit value. > + * The Mali-C55 ISP expects 20-bit settings, so we shift it to > + * the appropriate width > + */ > + uint32_t blackLevel = context.camHelper->blackLevel().value() << 4; > + > /* > * If no Black Levels were passed in through tuning data then we could > * use the value from the CameraSensorHelper if one is available. > */ > - if (context.configuration.sensor.blackLevel && > - !(offset00_ + offset01_ + offset10_ + offset11_)) { > - offset00_ = context.configuration.sensor.blackLevel; > - offset01_ = context.configuration.sensor.blackLevel; > - offset10_ = context.configuration.sensor.blackLevel; > - offset11_ = context.configuration.sensor.blackLevel; > - } > + if (blackLevel && If we get here we know that context.camHelper->blackLevel().has_value() Is it possible that it has value 0 ? > + !(offset00_ + offset01_ + offset10_ + offset11_)) > + offset00_ = offset01_ = offset10_ = offset11_ = blackLevel; > > return 0; > } > diff --git a/src/ipa/mali-c55/ipa_context.h b/src/ipa/mali-c55/ipa_context.h > index bfa805c7b93f..6dd8e5b0edfc 100644 > --- a/src/ipa/mali-c55/ipa_context.h > +++ b/src/ipa/mali-c55/ipa_context.h > @@ -31,7 +31,6 @@ struct IPASessionConfiguration { > struct { > BayerFormat::Order bayerOrder; > utils::Duration lineDuration; > - uint32_t blackLevel; > } sensor; > }; > > diff --git a/src/ipa/mali-c55/mali-c55.cpp b/src/ipa/mali-c55/mali-c55.cpp > index 0751513dc584..27f6501085b9 100644 > --- a/src/ipa/mali-c55/mali-c55.cpp > +++ b/src/ipa/mali-c55/mali-c55.cpp > @@ -190,16 +190,6 @@ void IPAMaliC55::updateSessionConfiguration(const IPACameraSensorInfo &info, > context_.configuration.agc.defaultExposure = defExposure; > context_.configuration.agc.minAnalogueGain = context_.camHelper->gain(minGain); > context_.configuration.agc.maxAnalogueGain = context_.camHelper->gain(maxGain); > - > - if (context_.camHelper->blackLevel().has_value()) { > - /* > - * The black level from CameraSensorHelper is a 16-bit value. > - * The Mali-C55 ISP expects 20-bit settings, so we shift it to > - * the appropriate width > - */ > - context_.configuration.sensor.blackLevel = > - context_.camHelper->blackLevel().value() << 4; > - } > } > > void IPAMaliC55::updateControls(const IPACameraSensorInfo &sensorInfo, > -- > 2.51.0 >
diff --git a/src/ipa/mali-c55/algorithms/blc.cpp b/src/ipa/mali-c55/algorithms/blc.cpp index 85642c0435a2..1fdd00ccc2ea 100644 --- a/src/ipa/mali-c55/algorithms/blc.cpp +++ b/src/ipa/mali-c55/algorithms/blc.cpp @@ -64,17 +64,23 @@ int BlackLevelCorrection::init([[maybe_unused]] IPAContext &context, int BlackLevelCorrection::configure(IPAContext &context, [[maybe_unused]] const IPACameraSensorInfo &configInfo) { + if (!context.camHelper->blackLevel().has_value()) + return 0; + + /* + * The black level from CameraSensorHelper is a 16-bit value. + * The Mali-C55 ISP expects 20-bit settings, so we shift it to + * the appropriate width + */ + uint32_t blackLevel = context.camHelper->blackLevel().value() << 4; + /* * If no Black Levels were passed in through tuning data then we could * use the value from the CameraSensorHelper if one is available. */ - if (context.configuration.sensor.blackLevel && - !(offset00_ + offset01_ + offset10_ + offset11_)) { - offset00_ = context.configuration.sensor.blackLevel; - offset01_ = context.configuration.sensor.blackLevel; - offset10_ = context.configuration.sensor.blackLevel; - offset11_ = context.configuration.sensor.blackLevel; - } + if (blackLevel && + !(offset00_ + offset01_ + offset10_ + offset11_)) + offset00_ = offset01_ = offset10_ = offset11_ = blackLevel; return 0; } diff --git a/src/ipa/mali-c55/ipa_context.h b/src/ipa/mali-c55/ipa_context.h index bfa805c7b93f..6dd8e5b0edfc 100644 --- a/src/ipa/mali-c55/ipa_context.h +++ b/src/ipa/mali-c55/ipa_context.h @@ -31,7 +31,6 @@ struct IPASessionConfiguration { struct { BayerFormat::Order bayerOrder; utils::Duration lineDuration; - uint32_t blackLevel; } sensor; }; diff --git a/src/ipa/mali-c55/mali-c55.cpp b/src/ipa/mali-c55/mali-c55.cpp index 0751513dc584..27f6501085b9 100644 --- a/src/ipa/mali-c55/mali-c55.cpp +++ b/src/ipa/mali-c55/mali-c55.cpp @@ -190,16 +190,6 @@ void IPAMaliC55::updateSessionConfiguration(const IPACameraSensorInfo &info, context_.configuration.agc.defaultExposure = defExposure; context_.configuration.agc.minAnalogueGain = context_.camHelper->gain(minGain); context_.configuration.agc.maxAnalogueGain = context_.camHelper->gain(maxGain); - - if (context_.camHelper->blackLevel().has_value()) { - /* - * The black level from CameraSensorHelper is a 16-bit value. - * The Mali-C55 ISP expects 20-bit settings, so we shift it to - * the appropriate width - */ - context_.configuration.sensor.blackLevel = - context_.camHelper->blackLevel().value() << 4; - } } void IPAMaliC55::updateControls(const IPACameraSensorInfo &sensorInfo,
Move the black level handling into the blc module. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> --- src/ipa/mali-c55/algorithms/blc.cpp | 20 +++++++++++++------- src/ipa/mali-c55/ipa_context.h | 1 - src/ipa/mali-c55/mali-c55.cpp | 10 ---------- 3 files changed, 13 insertions(+), 18 deletions(-)