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>
49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2023, Linaro Ltd
|
|
*
|
|
* Statistics data format used by the software ISP and software IPA
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <array>
|
|
#include <stdint.h>
|
|
|
|
#include "libcamera/internal/vector.h"
|
|
|
|
namespace libcamera {
|
|
|
|
/**
|
|
* \brief Struct that holds the statistics for the Software ISP
|
|
*
|
|
* The struct value types are large enough to not overflow.
|
|
* Should they still overflow for some reason, no check is performed and they
|
|
* wrap around.
|
|
*/
|
|
struct SwIspStats {
|
|
/**
|
|
* \brief True if the statistics buffer contains valid data, false if
|
|
* no statistics were generated for this frame
|
|
*/
|
|
bool valid;
|
|
/**
|
|
* \brief Sums of colour channels of all the sampled pixels
|
|
*/
|
|
RGB<uint64_t> sum_;
|
|
/**
|
|
* \brief Number of bins in the yHistogram
|
|
*/
|
|
static constexpr unsigned int kYHistogramSize = 64;
|
|
/**
|
|
* \brief Type of the histogram.
|
|
*/
|
|
using Histogram = std::array<uint32_t, kYHistogramSize>;
|
|
/**
|
|
* \brief A histogram of luminance values of all the sampled pixels
|
|
*/
|
|
Histogram yHistogram;
|
|
};
|
|
|
|
} /* namespace libcamera */
|