Files
external_libcamera/include/libcamera/internal/software_isp/swisp_stats.h
Hans de Goede 9b441cf198 libcamera: software_isp: Add valid flag to struct SwIspStats
Generating statistics for every single frame is not really necessary.

However a roundtrip through ipa_->processStats() still need to be done
every frame, even if there are no stats to make the IPA generate metadata
for every frame.

Add a valid flag to the statistics struct to let the IPA know when there
are no statistics for the frame being processed and modify the IPA to
only generate metadata for frames without valid statistics.

This is a preparation patch for skipping statistics generation for some
frames.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Tested-by: Milan Zamazal <mzamazal@redhat.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-10-01 16:45:17 +01:00

55 lines
1.2 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>
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 Holds the sum of all sampled red pixels
*/
uint64_t sumR_;
/**
* \brief Holds the sum of all sampled green pixels
*/
uint64_t sumG_;
/**
* \brief Holds the sum of all sampled blue pixels
*/
uint64_t sumB_;
/**
* \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
*/
Histogram yHistogram;
};
} /* namespace libcamera */