libcamera: simple: Fix black level offsets in AWB
The black level offset subtracted in AWB is wrong. It assumes that the
stats contain sums of the individual colour pixels. But they actually
contain sums of the colour channels of larger "superpixels" consisting
of the individual colour pixels. Each of the RGB colour values and the
computed luminosity (a histogram entry) are added once to the stats per
such a superpixel. This means the offset computed from the black level
and the number of pixels should be used as it is, not divided.
The patch fixes the subtracted offset. Since the evaluation is the same
for all the three colours now, the individual class variables are
replaced with a single RGB variable.
Fixes: 4e13c6f55b ("Honor black level in AWB")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Robert Mader <robert.mader@collabora.com>
Tested-by: Robert Mader <robert.mader@collabora.com>
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
committed by
Kieran Bingham
parent
10e4e5ba1e
commit
07240afa12
@@ -185,9 +185,9 @@ static constexpr unsigned int kBlueYMul = 29; /* 0.114 * 256 */
|
||||
stats_.yHistogram[yVal * SwIspStats::kYHistogramSize / (256 * 256 * (div))]++;
|
||||
|
||||
#define SWSTATS_FINISH_LINE_STATS() \
|
||||
stats_.sumR_ += sumR; \
|
||||
stats_.sumG_ += sumG; \
|
||||
stats_.sumB_ += sumB;
|
||||
stats_.sum_.r() += sumR; \
|
||||
stats_.sum_.g() += sumG; \
|
||||
stats_.sum_.b() += sumB;
|
||||
|
||||
void SwStatsCpu::statsBGGR8Line0(const uint8_t *src[])
|
||||
{
|
||||
@@ -332,9 +332,7 @@ void SwStatsCpu::startFrame(uint32_t frame)
|
||||
if (window_.width == 0)
|
||||
LOG(SwStatsCpu, Error) << "Calling startFrame() without setWindow()";
|
||||
|
||||
stats_.sumR_ = 0;
|
||||
stats_.sumB_ = 0;
|
||||
stats_.sumG_ = 0;
|
||||
stats_.sum_ = RGB<uint64_t>({ 0, 0, 0 });
|
||||
stats_.yHistogram.fill(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user