Message ID | 20210930093715.73293-4-jeanmichel.hautbois@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Jean-Michel, On Thu, Sep 30, 2021 at 11:37:06AM +0200, Jean-Michel Hautbois wrote: > The pixel component sums for the Accumulator are inconsistent with other > similar structures such as the IPAFrameContext::awb::gains. Group the > red, green, and blue sums together in a struct and store them as > uint64_t to reduce potential architectural differences. > > Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/ipa/ipu3/algorithms/awb.cpp | 24 ++++++++++++------------ > src/ipa/ipu3/algorithms/awb.h | 8 +++++--- > 2 files changed, 17 insertions(+), 15 deletions(-) > > diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp > index fd2f12ca..5f61cb89 100644 > --- a/src/ipa/ipu3/algorithms/awb.cpp > +++ b/src/ipa/ipu3/algorithms/awb.cpp > @@ -75,13 +75,13 @@ static constexpr uint32_t kMinGreenLevelInZone = 32; > * \var Accumulator::counted > * \brief Number of unsaturated cells used to calculate the sums > * > - * \var Accumulator::rSum > + * \var Accumulator::red This was Accumulator::sum::red in v1, why has it changed ? > * \brief Sum of the average red values of each unsaturated cell in the zone > * > - * \var Accumulator::gSum > + * \var Accumulator::green > * \brief Sum of the average green values of each unsaturated cell in the zone > * > - * \var Accumulator::bSum > + * \var Accumulator::blue > * \brief Sum of the average blue values of each unsaturated cell in the zone > */ > > @@ -206,10 +206,10 @@ void Awb::generateZones(std::vector<RGB> &zones) > RGB zone; > double counted = awbStats_[i].counted; > if (counted >= kMinZonesCounted) { > - zone.G = awbStats_[i].gSum / counted; > + zone.G = awbStats_[i].sum.green / counted; > if (zone.G >= kMinGreenLevelInZone) { > - zone.R = awbStats_[i].rSum / counted; > - zone.B = awbStats_[i].bSum / counted; > + zone.R = awbStats_[i].sum.red / counted; > + zone.B = awbStats_[i].sum.blue / counted; > zones.push_back(zone); > } > } > @@ -242,9 +242,9 @@ void Awb::generateAwbStats(const ipu3_uapi_stats_3a *stats, > /* The cell is not saturated, use the current cell */ > awbStats_[awbRegionPosition].counted++; > uint32_t greenValue = currentCell->greenRedAvg + currentCell->greenBlueAvg; > - awbStats_[awbRegionPosition].gSum += greenValue / 2; > - awbStats_[awbRegionPosition].rSum += currentCell->redAvg; > - awbStats_[awbRegionPosition].bSum += currentCell->blueAvg; > + awbStats_[awbRegionPosition].sum.green += greenValue / 2; > + awbStats_[awbRegionPosition].sum.red += currentCell->redAvg; > + awbStats_[awbRegionPosition].sum.blue += currentCell->blueAvg; > } > } > } > @@ -253,9 +253,9 @@ void Awb::generateAwbStats(const ipu3_uapi_stats_3a *stats, > void Awb::clearAwbStats() > { > for (unsigned int i = 0; i < kAwbStatsSizeX * kAwbStatsSizeY; i++) { > - awbStats_[i].bSum = 0; > - awbStats_[i].rSum = 0; > - awbStats_[i].gSum = 0; > + awbStats_[i].sum.blue = 0; > + awbStats_[i].sum.red = 0; > + awbStats_[i].sum.green = 0; > awbStats_[i].counted = 0; > } > } > diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h > index ac8ccc84..3385ebe7 100644 > --- a/src/ipa/ipu3/algorithms/awb.h > +++ b/src/ipa/ipu3/algorithms/awb.h > @@ -35,9 +35,11 @@ struct Ipu3AwbCell { > > struct Accumulator { > unsigned int counted; > - unsigned long long rSum; > - unsigned long long gSum; > - unsigned long long bSum; > + struct { > + uint64_t red; > + uint64_t green; > + uint64_t blue; > + } sum; > }; > > class Awb : public Algorithm
Hi Laurent, On 05/10/2021 03:01, Laurent Pinchart wrote: > Hi Jean-Michel, > > On Thu, Sep 30, 2021 at 11:37:06AM +0200, Jean-Michel Hautbois wrote: >> The pixel component sums for the Accumulator are inconsistent with other >> similar structures such as the IPAFrameContext::awb::gains. Group the >> red, green, and blue sums together in a struct and store them as >> uint64_t to reduce potential architectural differences. >> >> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> >> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> >> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> >> --- >> src/ipa/ipu3/algorithms/awb.cpp | 24 ++++++++++++------------ >> src/ipa/ipu3/algorithms/awb.h | 8 +++++--- >> 2 files changed, 17 insertions(+), 15 deletions(-) >> >> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp >> index fd2f12ca..5f61cb89 100644 >> --- a/src/ipa/ipu3/algorithms/awb.cpp >> +++ b/src/ipa/ipu3/algorithms/awb.cpp >> @@ -75,13 +75,13 @@ static constexpr uint32_t kMinGreenLevelInZone = 32; >> * \var Accumulator::counted >> * \brief Number of unsaturated cells used to calculate the sums >> * >> - * \var Accumulator::rSum >> + * \var Accumulator::red > > This was Accumulator::sum::red in v1, why has it changed ? This is an anticipation on the Documentation series because Doxygen can't find Accumulator::sum::red because we use unamed structures to group items. I can keep the sum:: here and fix it in the next series if you prefer ? > >> * \brief Sum of the average red values of each unsaturated cell in the zone >> * >> - * \var Accumulator::gSum >> + * \var Accumulator::green >> * \brief Sum of the average green values of each unsaturated cell in the zone >> * >> - * \var Accumulator::bSum >> + * \var Accumulator::blue >> * \brief Sum of the average blue values of each unsaturated cell in the zone >> */ >> >> @@ -206,10 +206,10 @@ void Awb::generateZones(std::vector<RGB> &zones) >> RGB zone; >> double counted = awbStats_[i].counted; >> if (counted >= kMinZonesCounted) { >> - zone.G = awbStats_[i].gSum / counted; >> + zone.G = awbStats_[i].sum.green / counted; >> if (zone.G >= kMinGreenLevelInZone) { >> - zone.R = awbStats_[i].rSum / counted; >> - zone.B = awbStats_[i].bSum / counted; >> + zone.R = awbStats_[i].sum.red / counted; >> + zone.B = awbStats_[i].sum.blue / counted; >> zones.push_back(zone); >> } >> } >> @@ -242,9 +242,9 @@ void Awb::generateAwbStats(const ipu3_uapi_stats_3a *stats, >> /* The cell is not saturated, use the current cell */ >> awbStats_[awbRegionPosition].counted++; >> uint32_t greenValue = currentCell->greenRedAvg + currentCell->greenBlueAvg; >> - awbStats_[awbRegionPosition].gSum += greenValue / 2; >> - awbStats_[awbRegionPosition].rSum += currentCell->redAvg; >> - awbStats_[awbRegionPosition].bSum += currentCell->blueAvg; >> + awbStats_[awbRegionPosition].sum.green += greenValue / 2; >> + awbStats_[awbRegionPosition].sum.red += currentCell->redAvg; >> + awbStats_[awbRegionPosition].sum.blue += currentCell->blueAvg; >> } >> } >> } >> @@ -253,9 +253,9 @@ void Awb::generateAwbStats(const ipu3_uapi_stats_3a *stats, >> void Awb::clearAwbStats() >> { >> for (unsigned int i = 0; i < kAwbStatsSizeX * kAwbStatsSizeY; i++) { >> - awbStats_[i].bSum = 0; >> - awbStats_[i].rSum = 0; >> - awbStats_[i].gSum = 0; >> + awbStats_[i].sum.blue = 0; >> + awbStats_[i].sum.red = 0; >> + awbStats_[i].sum.green = 0; >> awbStats_[i].counted = 0; >> } >> } >> diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h >> index ac8ccc84..3385ebe7 100644 >> --- a/src/ipa/ipu3/algorithms/awb.h >> +++ b/src/ipa/ipu3/algorithms/awb.h >> @@ -35,9 +35,11 @@ struct Ipu3AwbCell { >> >> struct Accumulator { >> unsigned int counted; >> - unsigned long long rSum; >> - unsigned long long gSum; >> - unsigned long long bSum; >> + struct { >> + uint64_t red; >> + uint64_t green; >> + uint64_t blue; >> + } sum; >> }; >> >> class Awb : public Algorithm >
Hi Jean-Michel, On Tue, Oct 05, 2021 at 07:34:33AM +0200, Jean-Michel Hautbois wrote: > On 05/10/2021 03:01, Laurent Pinchart wrote: > > On Thu, Sep 30, 2021 at 11:37:06AM +0200, Jean-Michel Hautbois wrote: > >> The pixel component sums for the Accumulator are inconsistent with other > >> similar structures such as the IPAFrameContext::awb::gains. Group the > >> red, green, and blue sums together in a struct and store them as > >> uint64_t to reduce potential architectural differences. > >> > >> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> > >> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > >> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > >> --- > >> src/ipa/ipu3/algorithms/awb.cpp | 24 ++++++++++++------------ > >> src/ipa/ipu3/algorithms/awb.h | 8 +++++--- > >> 2 files changed, 17 insertions(+), 15 deletions(-) > >> > >> diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp > >> index fd2f12ca..5f61cb89 100644 > >> --- a/src/ipa/ipu3/algorithms/awb.cpp > >> +++ b/src/ipa/ipu3/algorithms/awb.cpp > >> @@ -75,13 +75,13 @@ static constexpr uint32_t kMinGreenLevelInZone = 32; > >> * \var Accumulator::counted > >> * \brief Number of unsaturated cells used to calculate the sums > >> * > >> - * \var Accumulator::rSum > >> + * \var Accumulator::red > > > > This was Accumulator::sum::red in v1, why has it changed ? > > This is an anticipation on the Documentation series because Doxygen > can't find Accumulator::sum::red because we use unamed structures to > group items. I can keep the sum:: here and fix it in the next series if > you prefer ? If you look at the generated documentation without sum::, it's not good either. Let's keep it and please doxygen later. > >> * \brief Sum of the average red values of each unsaturated cell in the zone > >> * > >> - * \var Accumulator::gSum > >> + * \var Accumulator::green > >> * \brief Sum of the average green values of each unsaturated cell in the zone > >> * > >> - * \var Accumulator::bSum > >> + * \var Accumulator::blue > >> * \brief Sum of the average blue values of each unsaturated cell in the zone > >> */ > >> > >> @@ -206,10 +206,10 @@ void Awb::generateZones(std::vector<RGB> &zones) > >> RGB zone; > >> double counted = awbStats_[i].counted; > >> if (counted >= kMinZonesCounted) { > >> - zone.G = awbStats_[i].gSum / counted; > >> + zone.G = awbStats_[i].sum.green / counted; > >> if (zone.G >= kMinGreenLevelInZone) { > >> - zone.R = awbStats_[i].rSum / counted; > >> - zone.B = awbStats_[i].bSum / counted; > >> + zone.R = awbStats_[i].sum.red / counted; > >> + zone.B = awbStats_[i].sum.blue / counted; > >> zones.push_back(zone); > >> } > >> } > >> @@ -242,9 +242,9 @@ void Awb::generateAwbStats(const ipu3_uapi_stats_3a *stats, > >> /* The cell is not saturated, use the current cell */ > >> awbStats_[awbRegionPosition].counted++; > >> uint32_t greenValue = currentCell->greenRedAvg + currentCell->greenBlueAvg; > >> - awbStats_[awbRegionPosition].gSum += greenValue / 2; > >> - awbStats_[awbRegionPosition].rSum += currentCell->redAvg; > >> - awbStats_[awbRegionPosition].bSum += currentCell->blueAvg; > >> + awbStats_[awbRegionPosition].sum.green += greenValue / 2; > >> + awbStats_[awbRegionPosition].sum.red += currentCell->redAvg; > >> + awbStats_[awbRegionPosition].sum.blue += currentCell->blueAvg; > >> } > >> } > >> } > >> @@ -253,9 +253,9 @@ void Awb::generateAwbStats(const ipu3_uapi_stats_3a *stats, > >> void Awb::clearAwbStats() > >> { > >> for (unsigned int i = 0; i < kAwbStatsSizeX * kAwbStatsSizeY; i++) { > >> - awbStats_[i].bSum = 0; > >> - awbStats_[i].rSum = 0; > >> - awbStats_[i].gSum = 0; > >> + awbStats_[i].sum.blue = 0; > >> + awbStats_[i].sum.red = 0; > >> + awbStats_[i].sum.green = 0; > >> awbStats_[i].counted = 0; > >> } > >> } > >> diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h > >> index ac8ccc84..3385ebe7 100644 > >> --- a/src/ipa/ipu3/algorithms/awb.h > >> +++ b/src/ipa/ipu3/algorithms/awb.h > >> @@ -35,9 +35,11 @@ struct Ipu3AwbCell { > >> > >> struct Accumulator { > >> unsigned int counted; > >> - unsigned long long rSum; > >> - unsigned long long gSum; > >> - unsigned long long bSum; > >> + struct { > >> + uint64_t red; > >> + uint64_t green; > >> + uint64_t blue; > >> + } sum; > >> }; > >> > >> class Awb : public Algorithm
diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp index fd2f12ca..5f61cb89 100644 --- a/src/ipa/ipu3/algorithms/awb.cpp +++ b/src/ipa/ipu3/algorithms/awb.cpp @@ -75,13 +75,13 @@ static constexpr uint32_t kMinGreenLevelInZone = 32; * \var Accumulator::counted * \brief Number of unsaturated cells used to calculate the sums * - * \var Accumulator::rSum + * \var Accumulator::red * \brief Sum of the average red values of each unsaturated cell in the zone * - * \var Accumulator::gSum + * \var Accumulator::green * \brief Sum of the average green values of each unsaturated cell in the zone * - * \var Accumulator::bSum + * \var Accumulator::blue * \brief Sum of the average blue values of each unsaturated cell in the zone */ @@ -206,10 +206,10 @@ void Awb::generateZones(std::vector<RGB> &zones) RGB zone; double counted = awbStats_[i].counted; if (counted >= kMinZonesCounted) { - zone.G = awbStats_[i].gSum / counted; + zone.G = awbStats_[i].sum.green / counted; if (zone.G >= kMinGreenLevelInZone) { - zone.R = awbStats_[i].rSum / counted; - zone.B = awbStats_[i].bSum / counted; + zone.R = awbStats_[i].sum.red / counted; + zone.B = awbStats_[i].sum.blue / counted; zones.push_back(zone); } } @@ -242,9 +242,9 @@ void Awb::generateAwbStats(const ipu3_uapi_stats_3a *stats, /* The cell is not saturated, use the current cell */ awbStats_[awbRegionPosition].counted++; uint32_t greenValue = currentCell->greenRedAvg + currentCell->greenBlueAvg; - awbStats_[awbRegionPosition].gSum += greenValue / 2; - awbStats_[awbRegionPosition].rSum += currentCell->redAvg; - awbStats_[awbRegionPosition].bSum += currentCell->blueAvg; + awbStats_[awbRegionPosition].sum.green += greenValue / 2; + awbStats_[awbRegionPosition].sum.red += currentCell->redAvg; + awbStats_[awbRegionPosition].sum.blue += currentCell->blueAvg; } } } @@ -253,9 +253,9 @@ void Awb::generateAwbStats(const ipu3_uapi_stats_3a *stats, void Awb::clearAwbStats() { for (unsigned int i = 0; i < kAwbStatsSizeX * kAwbStatsSizeY; i++) { - awbStats_[i].bSum = 0; - awbStats_[i].rSum = 0; - awbStats_[i].gSum = 0; + awbStats_[i].sum.blue = 0; + awbStats_[i].sum.red = 0; + awbStats_[i].sum.green = 0; awbStats_[i].counted = 0; } } diff --git a/src/ipa/ipu3/algorithms/awb.h b/src/ipa/ipu3/algorithms/awb.h index ac8ccc84..3385ebe7 100644 --- a/src/ipa/ipu3/algorithms/awb.h +++ b/src/ipa/ipu3/algorithms/awb.h @@ -35,9 +35,11 @@ struct Ipu3AwbCell { struct Accumulator { unsigned int counted; - unsigned long long rSum; - unsigned long long gSum; - unsigned long long bSum; + struct { + uint64_t red; + uint64_t green; + uint64_t blue; + } sum; }; class Awb : public Algorithm