diff options
author | Paul Elder <paul.elder@ideasonboard.com> | 2024-07-04 19:20:35 +0300 |
---|---|---|
committer | Jacopo Mondi <jacopo.mondi@ideasonboard.com> | 2024-08-06 12:51:07 +0200 |
commit | ad587980f2b738d3540423a60b55c2c9a8098fb5 (patch) | |
tree | 5d8638e4bca691bb1ff937b3ccb6f99f3c59ec44 | |
parent | 4c4de3ba2369e5ae32cbf5f29da703cbcfe67f0b (diff) |
ipa: rkisp1: blc: Add support for BLS in compand
Extend the RkISP1 BLC algorithm to use the ISP 'companding' block for
versions of the ISP (such as the one on the i.MX8MP) that lack the
dedicated BLS block but implement BLS as part of the companding block.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r-- | src/ipa/rkisp1/algorithms/blc.cpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/ipa/rkisp1/algorithms/blc.cpp b/src/ipa/rkisp1/algorithms/blc.cpp index df1a91a4..9bc10f4a 100644 --- a/src/ipa/rkisp1/algorithms/blc.cpp +++ b/src/ipa/rkisp1/algorithms/blc.cpp @@ -110,7 +110,7 @@ int BlackLevelCorrection::init(IPAContext &context, const YamlObject &tuningData /** * \copydoc libcamera::ipa::Algorithm::prepare */ -void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context, +void BlackLevelCorrection::prepare(IPAContext &context, const uint32_t frame, [[maybe_unused]] IPAFrameContext &frameContext, RkISP1Params *params) @@ -124,15 +124,30 @@ void BlackLevelCorrection::prepare([[maybe_unused]] IPAContext &context, if (!tuningParameters_) return; - auto config = params->block<Block::Bls>(); - config.setEnabled(true); + if (context.hw->compand) { + auto config = params->block<Block::CompandBls>(); + config.setEnabled(true); - config->enable_auto = 0; - /* The rkisp1 uses 12bit based black levels. Scale down accordingly. */ - config->fixed_val.r = blackLevelRed_ >> 4; - config->fixed_val.gr = blackLevelGreenR_ >> 4; - config->fixed_val.gb = blackLevelGreenB_ >> 4; - config->fixed_val.b = blackLevelBlue_ >> 4; + /* + * Scale up to the 20-bit black levels used by the companding + * block. + */ + config->r = blackLevelRed_ << 4; + config->gr = blackLevelGreenR_ << 4; + config->gb = blackLevelGreenB_ << 4; + config->b = blackLevelBlue_ << 4; + } else { + auto config = params->block<Block::Bls>(); + config.setEnabled(true); + + config->enable_auto = 0; + + /* Scale down to the 12-bit black levels used by the BLS block. */ + config->fixed_val.r = blackLevelRed_ >> 4; + config->fixed_val.gr = blackLevelGreenR_ >> 4; + config->fixed_val.gb = blackLevelGreenB_ >> 4; + config->fixed_val.b = blackLevelBlue_ >> 4; + } } /** |