Message ID | 20241107102508.48322-5-dan.scally@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
Hi Dan On Thu, Nov 07, 2024 at 10:25:06AM +0000, Daniel Scally wrote: > Use the centralised libipa helpers rather than open coding common > functions. > > Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> > --- > Changes in v2: > > - None. Jacopo; this isn't in the libcamera::ipa namespace. As an > alternative to the prefix I could "using namespace libcamera::ipa" if > that's better? If that's not in the ipa:: namespace then it's fine to specify it > > src/ipa/rpi/controller/rpi/agc_channel.cpp | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp > index c9df9b5b..30e94b9b 100644 > --- a/src/ipa/rpi/controller/rpi/agc_channel.cpp > +++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp > @@ -12,6 +12,8 @@ > > #include <libcamera/base/log.h> > > +#include "libipa/helpers.h" > + > #include "../awb_status.h" > #include "../device_status.h" > #include "../histogram.h" > @@ -694,11 +696,11 @@ static double computeInitialY(StatisticsPtr &stats, AwbStatus const &awb, > double ySum; > /* Factor in the AWB correction if needed. */ > if (stats->agcStatsPos == Statistics::AgcStatsPos::PreWb) { > - ySum = rSum * awb.gainR * .299 + > - gSum * awb.gainG * .587 + > - bSum * awb.gainB * .114; > + ySum = ipa::rec601LuminanceFromRGB(rSum * awb.gainR, > + gSum * awb.gainG, > + bSum * awb.gainB); Algined to the open ( ? Thanks j > } else > - ySum = rSum * .299 + gSum * .587 + bSum * .114; > + ySum = ipa::rec601LuminanceFromRGB(rSum, gSum, bSum); > > return ySum / pixelSum / (1 << 16); > } > -- > 2.30.2 >
diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp index c9df9b5b..30e94b9b 100644 --- a/src/ipa/rpi/controller/rpi/agc_channel.cpp +++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp @@ -12,6 +12,8 @@ #include <libcamera/base/log.h> +#include "libipa/helpers.h" + #include "../awb_status.h" #include "../device_status.h" #include "../histogram.h" @@ -694,11 +696,11 @@ static double computeInitialY(StatisticsPtr &stats, AwbStatus const &awb, double ySum; /* Factor in the AWB correction if needed. */ if (stats->agcStatsPos == Statistics::AgcStatsPos::PreWb) { - ySum = rSum * awb.gainR * .299 + - gSum * awb.gainG * .587 + - bSum * awb.gainB * .114; + ySum = ipa::rec601LuminanceFromRGB(rSum * awb.gainR, + gSum * awb.gainG, + bSum * awb.gainB); } else - ySum = rSum * .299 + gSum * .587 + bSum * .114; + ySum = ipa::rec601LuminanceFromRGB(rSum, gSum, bSum); return ySum / pixelSum / (1 << 16); }
Use the centralised libipa helpers rather than open coding common functions. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> --- Changes in v2: - None. Jacopo; this isn't in the libcamera::ipa namespace. As an alternative to the prefix I could "using namespace libcamera::ipa" if that's better? src/ipa/rpi/controller/rpi/agc_channel.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)