Message ID | 20240418124632.652163-4-dan.scally@ideasonboard.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
Hi Daniel, On 18/04/2024 14:46, Daniel Scally wrote: > The IPU3 IPA module uses a green histogram for the AGC algorithm's > constraint mode calculations. Switch instead to a luminance histogram > calculated using the Rec.601 coefficients. > > Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> > --- > src/ipa/ipu3/algorithms/agc.cpp | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp > index a59b73fb..76d2bb60 100644 > --- a/src/ipa/ipu3/algorithms/agc.cpp > +++ b/src/ipa/ipu3/algorithms/agc.cpp > @@ -152,18 +152,19 @@ Histogram Agc::parseStatistics(const ipu3_uapi_stats_3a *stats, > reinterpret_cast<const ipu3_uapi_awb_set_item *>( > &stats->awb_raw_buffer.meta_data[cellPosition]); > > - rgbTriples_.push_back({ > - cell->R_avg, > - (cell->Gr_avg + cell->Gb_avg) / 2, > - cell->B_avg > - }); > + uint8_t G_avg = (cell->Gr_avg + cell->Gb_avg) / 2; > + > + rgbTriples_.push_back({cell->R_avg, G_avg, cell->B_avg}); > > /* > - * Store the average green value to estimate the > + * Store the average luminance value to estimate the > * brightness. Even the overexposed pixels are > * taken into account. > */ > - hist[(cell->Gr_avg + cell->Gb_avg) / 2]++; > + uint8_t y = (cell->R_avg * .299) + > + (G_avg * .587) + > + (cell->B_avg * .114); > + hist[y]++; Is there a benefit to have the "real" Y value and not only the green parts (which reflect this Y value quite nicely as it is ~60% of the value) ? Could you measure it ? No increase in CPU time for big stats grids ? JM
diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp index a59b73fb..76d2bb60 100644 --- a/src/ipa/ipu3/algorithms/agc.cpp +++ b/src/ipa/ipu3/algorithms/agc.cpp @@ -152,18 +152,19 @@ Histogram Agc::parseStatistics(const ipu3_uapi_stats_3a *stats, reinterpret_cast<const ipu3_uapi_awb_set_item *>( &stats->awb_raw_buffer.meta_data[cellPosition]); - rgbTriples_.push_back({ - cell->R_avg, - (cell->Gr_avg + cell->Gb_avg) / 2, - cell->B_avg - }); + uint8_t G_avg = (cell->Gr_avg + cell->Gb_avg) / 2; + + rgbTriples_.push_back({cell->R_avg, G_avg, cell->B_avg}); /* - * Store the average green value to estimate the + * Store the average luminance value to estimate the * brightness. Even the overexposed pixels are * taken into account. */ - hist[(cell->Gr_avg + cell->Gb_avg) / 2]++; + uint8_t y = (cell->R_avg * .299) + + (G_avg * .587) + + (cell->B_avg * .114); + hist[y]++; } }
The IPU3 IPA module uses a green histogram for the AGC algorithm's constraint mode calculations. Switch instead to a luminance histogram calculated using the Rec.601 coefficients. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> --- src/ipa/ipu3/algorithms/agc.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)