libcamera: software_isp: Create algorithms

We are ready to introduce algorithms now.  First, let's create
algorithms.  The algorithms are not called yet, calls to them will be
added in followup patches.

The maximum number of contexts is set to the same value as in hardware
pipelines.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Milan Zamazal 2024-09-27 15:46:14 +02:00 committed by Kieran Bingham
parent f06c344bd5
commit 97f9961e1b
4 changed files with 24 additions and 2 deletions

View file

@ -0,0 +1,4 @@
# SPDX-License-Identifier: CC0-1.0
soft_simple_ipa_algorithms = files([
])

View file

@ -2,4 +2,5 @@
%YAML 1.1 %YAML 1.1
--- ---
version: 1 version: 1
algorithms:
... ...

View file

@ -1,5 +1,8 @@
# SPDX-License-Identifier: CC0-1.0 # SPDX-License-Identifier: CC0-1.0
subdir('algorithms')
subdir('data')
ipa_name = 'ipa_soft_simple' ipa_name = 'ipa_soft_simple'
soft_simple_sources = files([ soft_simple_sources = files([
@ -8,6 +11,8 @@ soft_simple_sources = files([
'black_level.cpp', 'black_level.cpp',
]) ])
soft_simple_sources += soft_simple_ipa_algorithms
mod = shared_module(ipa_name, soft_simple_sources, mod = shared_module(ipa_name, soft_simple_sources,
name_prefix : '', name_prefix : '',
include_directories : [ipa_includes], include_directories : [ipa_includes],
@ -24,6 +29,4 @@ if ipa_sign_module
build_by_default : true) build_by_default : true)
endif endif
subdir('data')
ipa_names += ipa_name ipa_names += ipa_name

View file

@ -54,12 +54,15 @@ static constexpr float kExposureOptimal = kExposureBinsCount / 2.0;
* enough to prevent the exposure from wobbling around the optimal value. * enough to prevent the exposure from wobbling around the optimal value.
*/ */
static constexpr float kExposureSatisfactory = 0.2; static constexpr float kExposureSatisfactory = 0.2;
/* Maximum number of frame contexts to be held */
static constexpr uint32_t kMaxFrameContexts = 16;
class IPASoftSimple : public ipa::soft::IPASoftInterface, public Module class IPASoftSimple : public ipa::soft::IPASoftInterface, public Module
{ {
public: public:
IPASoftSimple() IPASoftSimple()
: params_(nullptr), stats_(nullptr), blackLevel_(BlackLevel()), : params_(nullptr), stats_(nullptr), blackLevel_(BlackLevel()),
context_({ {}, {}, { kMaxFrameContexts } }),
ignoreUpdates_(0) ignoreUpdates_(0)
{ {
} }
@ -93,6 +96,8 @@ private:
static constexpr unsigned int kGammaLookupSize = 1024; static constexpr unsigned int kGammaLookupSize = 1024;
std::array<uint8_t, kGammaLookupSize> gammaTable_; std::array<uint8_t, kGammaLookupSize> gammaTable_;
int lastBlackLevel_ = -1; int lastBlackLevel_ = -1;
/* Local parameter storage */
struct IPAContext context_;
int32_t exposureMin_, exposureMax_; int32_t exposureMin_, exposureMax_;
int32_t exposure_; int32_t exposure_;
@ -139,6 +144,15 @@ int IPASoftSimple::init(const IPASettings &settings,
unsigned int version = (*data)["version"].get<uint32_t>(0); unsigned int version = (*data)["version"].get<uint32_t>(0);
LOG(IPASoft, Debug) << "Tuning file version " << version; LOG(IPASoft, Debug) << "Tuning file version " << version;
if (!data->contains("algorithms")) {
LOG(IPASoft, Error) << "Tuning file doesn't contain algorithms";
return -EINVAL;
}
int ret = createAlgorithms(context_, (*data)["algorithms"]);
if (ret)
return ret;
params_ = nullptr; params_ = nullptr;
stats_ = nullptr; stats_ = nullptr;