| Message ID | 20260507161101.7D2CD1EA006B@mailuser.phl.internal |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
2026. 05. 07. 18:03 keltezéssel, Javier Tia írta: > Right-shifting by zero is a no-op, so the if (sumShift_) check before > the three >>= sumShift_ assignments is unnecessary. Remove it. > > Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Suggested-by: Barnabas Pocze <barnabas.pocze@ideasonboard.com> > Signed-off-by: Javier Tia <floss@jetm.me> > --- > src/libcamera/software_isp/swstats_cpu.cpp | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/src/libcamera/software_isp/swstats_cpu.cpp b/src/libcamera/software_isp/swstats_cpu.cpp > index b40d3334..d9011f41 100644 > --- a/src/libcamera/software_isp/swstats_cpu.cpp > +++ b/src/libcamera/software_isp/swstats_cpu.cpp > @@ -362,11 +362,9 @@ void SwStatsCpu::finishFrame(uint32_t frame, uint32_t bufferId) > for (unsigned int j = 0; j < SwIspStats::kYHistogramSize; j++) > sharedStats_->yHistogram[j] += s.yHistogram[j]; > } > - if (sumShift_) { > - sharedStats_->sum_.r() >>= sumShift_; > - sharedStats_->sum_.g() >>= sumShift_; > - sharedStats_->sum_.b() >>= sumShift_; > - } > + sharedStats_->sum_.r() >>= sumShift_; > + sharedStats_->sum_.g() >>= sumShift_; > + sharedStats_->sum_.b() >>= sumShift_; I kind of wanted to suggest adding `operator>>{,=}` to the `Vector` class but let's not get too carried away. Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > } > > sharedStats_->valid = valid;
On Fri, May 08, 2026 at 08:59:32AM +0200, Barnabás Pőcze wrote: > 2026. 05. 07. 18:03 keltezéssel, Javier Tia írta: > > Right-shifting by zero is a no-op, so the if (sumShift_) check before > > the three >>= sumShift_ assignments is unnecessary. Remove it. > > > > Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > Suggested-by: Barnabas Pocze <barnabas.pocze@ideasonboard.com> > > Signed-off-by: Javier Tia <floss@jetm.me> > > --- > > src/libcamera/software_isp/swstats_cpu.cpp | 8 +++----- > > 1 file changed, 3 insertions(+), 5 deletions(-) > > > > diff --git a/src/libcamera/software_isp/swstats_cpu.cpp b/src/libcamera/software_isp/swstats_cpu.cpp > > index b40d3334..d9011f41 100644 > > --- a/src/libcamera/software_isp/swstats_cpu.cpp > > +++ b/src/libcamera/software_isp/swstats_cpu.cpp > > @@ -362,11 +362,9 @@ void SwStatsCpu::finishFrame(uint32_t frame, uint32_t bufferId) > > for (unsigned int j = 0; j < SwIspStats::kYHistogramSize; j++) > > sharedStats_->yHistogram[j] += s.yHistogram[j]; > > } > > - if (sumShift_) { > > - sharedStats_->sum_.r() >>= sumShift_; > > - sharedStats_->sum_.g() >>= sumShift_; > > - sharedStats_->sum_.b() >>= sumShift_; > > - } > > + sharedStats_->sum_.r() >>= sumShift_; > > + sharedStats_->sum_.g() >>= sumShift_; > > + sharedStats_->sum_.b() >>= sumShift_; > > I kind of wanted to suggest adding `operator>>{,=}` to the `Vector` class > but let's not get too carried away. I thought about the same :-) On top of this patch of course. > Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > > > } > > > > sharedStats_->valid = valid;
diff --git a/src/libcamera/software_isp/swstats_cpu.cpp b/src/libcamera/software_isp/swstats_cpu.cpp index b40d3334..d9011f41 100644 --- a/src/libcamera/software_isp/swstats_cpu.cpp +++ b/src/libcamera/software_isp/swstats_cpu.cpp @@ -362,11 +362,9 @@ void SwStatsCpu::finishFrame(uint32_t frame, uint32_t bufferId) for (unsigned int j = 0; j < SwIspStats::kYHistogramSize; j++) sharedStats_->yHistogram[j] += s.yHistogram[j]; } - if (sumShift_) { - sharedStats_->sum_.r() >>= sumShift_; - sharedStats_->sum_.g() >>= sumShift_; - sharedStats_->sum_.b() >>= sumShift_; - } + sharedStats_->sum_.r() >>= sumShift_; + sharedStats_->sum_.g() >>= sumShift_; + sharedStats_->sum_.b() >>= sumShift_; } sharedStats_->valid = valid;
Right-shifting by zero is a no-op, so the if (sumShift_) check before the three >>= sumShift_ assignments is unnecessary. Remove it. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Suggested-by: Barnabas Pocze <barnabas.pocze@ideasonboard.com> Signed-off-by: Javier Tia <floss@jetm.me> --- src/libcamera/software_isp/swstats_cpu.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)