Message ID | 20210225170141.5184-3-david.plowman@raspberrypi.com |
---|---|
State | Accepted |
Commit | cc22d2206d83d6ab76172eeadb34f6b825c1ed9a |
Headers | show |
Series |
|
Related | show |
Hi David, Thank you for your patch. On Thu, 25 Feb 2021 at 17:01, David Plowman <david.plowman@raspberrypi.com> wrote: > Regions of the image where the statistics are not trusted should not > be put in the zones_ list. > > This also means that the AWB may fail to run initially, so > async_results_ needs to be initialised to some kind of default. > > Finally, the RGB zone structures can be zero-initialised safely now, > the previous value of -1 would seem unusual. > > Signed-off-by: David Plowman <david.plowman@raspberrypi.com> > Reviewed-by: Naushir Patuck <naush@raspberrypi.com> > --- > src/ipa/raspberrypi/controller/rpi/awb.cpp | 3 ++- > src/ipa/raspberrypi/controller/rpi/awb.hpp | 2 +- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp > b/src/ipa/raspberrypi/controller/rpi/awb.cpp > index 791a7039..1c917e4f 100644 > --- a/src/ipa/raspberrypi/controller/rpi/awb.cpp > +++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp > @@ -169,6 +169,7 @@ void Awb::Initialise() > sync_results_.gain_b = 1.0; > } > prev_sync_results_ = sync_results_; > + async_results_ = sync_results_; > } > > unsigned int Awb::GetConvergenceFrames() const > @@ -345,9 +346,9 @@ static void generate_stats(std::vector<Awb::RGB> > &zones, > if (zone.G >= min_G) { > zone.R = stats[i].r_sum / counted; > zone.B = stats[i].b_sum / counted; > + zones.push_back(zone); > } > } > - zones.push_back(zone); > } > } > > diff --git a/src/ipa/raspberrypi/controller/rpi/awb.hpp > b/src/ipa/raspberrypi/controller/rpi/awb.hpp > index 2fe59c37..8af1f27c 100644 > --- a/src/ipa/raspberrypi/controller/rpi/awb.hpp > +++ b/src/ipa/raspberrypi/controller/rpi/awb.hpp > @@ -90,7 +90,7 @@ public: > void Prepare(Metadata *image_metadata) override; > void Process(StatisticsPtr &stats, Metadata *image_metadata) > override; > struct RGB { > - RGB(double _R = -1.0, double _G = -1.0, double _B = -1.0) > + RGB(double _R = 0, double _G = 0, double _B = 0) > : R(_R), G(_G), B(_B) > { > } > -- > 2.20.1 > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel >
Hi David, On 25/02/2021 17:01, David Plowman wrote: > Regions of the image where the statistics are not trusted should not > be put in the zones_ list. > > This also means that the AWB may fail to run initially, so > async_results_ needs to be initialised to some kind of default. > > Finally, the RGB zone structures can be zero-initialised safely now, > the previous value of -1 would seem unusual. > > Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Sounds and looks reasonable to me. I'll run through the compile checks and integrate. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > src/ipa/raspberrypi/controller/rpi/awb.cpp | 3 ++- > src/ipa/raspberrypi/controller/rpi/awb.hpp | 2 +- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp > index 791a7039..1c917e4f 100644 > --- a/src/ipa/raspberrypi/controller/rpi/awb.cpp > +++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp > @@ -169,6 +169,7 @@ void Awb::Initialise() > sync_results_.gain_b = 1.0; > } > prev_sync_results_ = sync_results_; > + async_results_ = sync_results_; > } > > unsigned int Awb::GetConvergenceFrames() const > @@ -345,9 +346,9 @@ static void generate_stats(std::vector<Awb::RGB> &zones, > if (zone.G >= min_G) { > zone.R = stats[i].r_sum / counted; > zone.B = stats[i].b_sum / counted; > + zones.push_back(zone); > } > } > - zones.push_back(zone); > } > } > > diff --git a/src/ipa/raspberrypi/controller/rpi/awb.hpp b/src/ipa/raspberrypi/controller/rpi/awb.hpp > index 2fe59c37..8af1f27c 100644 > --- a/src/ipa/raspberrypi/controller/rpi/awb.hpp > +++ b/src/ipa/raspberrypi/controller/rpi/awb.hpp > @@ -90,7 +90,7 @@ public: > void Prepare(Metadata *image_metadata) override; > void Process(StatisticsPtr &stats, Metadata *image_metadata) override; > struct RGB { > - RGB(double _R = -1.0, double _G = -1.0, double _B = -1.0) > + RGB(double _R = 0, double _G = 0, double _B = 0) > : R(_R), G(_G), B(_B) > { > } >
diff --git a/src/ipa/raspberrypi/controller/rpi/awb.cpp b/src/ipa/raspberrypi/controller/rpi/awb.cpp index 791a7039..1c917e4f 100644 --- a/src/ipa/raspberrypi/controller/rpi/awb.cpp +++ b/src/ipa/raspberrypi/controller/rpi/awb.cpp @@ -169,6 +169,7 @@ void Awb::Initialise() sync_results_.gain_b = 1.0; } prev_sync_results_ = sync_results_; + async_results_ = sync_results_; } unsigned int Awb::GetConvergenceFrames() const @@ -345,9 +346,9 @@ static void generate_stats(std::vector<Awb::RGB> &zones, if (zone.G >= min_G) { zone.R = stats[i].r_sum / counted; zone.B = stats[i].b_sum / counted; + zones.push_back(zone); } } - zones.push_back(zone); } } diff --git a/src/ipa/raspberrypi/controller/rpi/awb.hpp b/src/ipa/raspberrypi/controller/rpi/awb.hpp index 2fe59c37..8af1f27c 100644 --- a/src/ipa/raspberrypi/controller/rpi/awb.hpp +++ b/src/ipa/raspberrypi/controller/rpi/awb.hpp @@ -90,7 +90,7 @@ public: void Prepare(Metadata *image_metadata) override; void Process(StatisticsPtr &stats, Metadata *image_metadata) override; struct RGB { - RGB(double _R = -1.0, double _G = -1.0, double _B = -1.0) + RGB(double _R = 0, double _G = 0, double _B = 0) : R(_R), G(_G), B(_B) { }
Regions of the image where the statistics are not trusted should not be put in the zones_ list. This also means that the AWB may fail to run initially, so async_results_ needs to be initialised to some kind of default. Finally, the RGB zone structures can be zero-initialised safely now, the previous value of -1 would seem unusual. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> --- src/ipa/raspberrypi/controller/rpi/awb.cpp | 3 ++- src/ipa/raspberrypi/controller/rpi/awb.hpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)