[PATCH v2] ipa: rkisp1: agc: Fix histogram construction

Paul Elder paul.elder at ideasonboard.com
Fri Apr 26 10:18:58 CEST 2024


On Fri, Apr 19, 2024 at 09:42:17PM +0100, Kieran Bingham wrote:
> Quoting Paul Elder (2024-04-19 06:58:49)
> > This histogram reported by the rkisp1 hardware is 20 bits, where the
> > upper 16 bits are meaningful integer data and the lower 4 bits are
> > fractional and meant to be discarded. Remove thse 4 bits when
> > construction the histogram.
> > 
> > Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
> > 
> > ---
> > This was meant to be in the same series as "[PATCH v2] ipa: libipa:
> > histogram: Add transform parameter to constructor"
> > 
> > This depends on v2 of "Centralise Agc into libipa".
> 
> I assume you mean
> 
> "[PATCH v2] ipa: libipa: histogram: Add transform parameter to constructor" ?

I mean I depend on that too (see above "This was meant to be in the same
series...") but this specific patch also depends on Dan's agc series.

Or I could preempt his series :)


Paul

> 
> > 
> > Changes in v2:
> > - use a lambda function instead of the rshift parameter
> > ---
> >  src/ipa/rkisp1/algorithms/agc.cpp | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp
> > index 27b6f2c1..26526f5e 100644
> > --- a/src/ipa/rkisp1/algorithms/agc.cpp
> > +++ b/src/ipa/rkisp1/algorithms/agc.cpp
> > @@ -278,7 +278,8 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,
> >         const rkisp1_cif_isp_stat *params = &stats->params;
> >         ASSERT(stats->meas_type & RKISP1_CIF_ISP_STAT_AUTOEXP);
> >  
> > -       Histogram hist({ params->hist.hist_bins, context.hw->numHistogramBins });
> > +       Histogram hist({ params->hist.hist_bins, context.hw->numHistogramBins },
> > +                      [](uint32_t x) { return x >> 4; });
> 
> It's a clean fix and more generalised and still optimised so works for
> me.
> 
> I would have thought a comment above would be beneficial to explain why
> we're shifting all the values right 4 here though.
> 
> Anyway.
> 
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> 
> >         expMeans_ = { params->ae.exp_mean, context.hw->numAeCells };
> >  
> >         /*
> > -- 
> > 2.39.2
> >


More information about the libcamera-devel mailing list