From 7bbe26bbc47625dedf7703338a31bf351c560b0d Mon Sep 17 00:00:00 2001 From: Milan Zamazal Date: Fri, 18 Oct 2024 16:12:36 +0200 Subject: libcamera: software_isp: Get black level from the camera helper The black level in software ISP is unconditionally guessed from the obtained frames. CameraSensorHelper optionally provides the black level from camera specifications now. Let's use the value if available. If the black level is not available from the given CameraSensorHelper instance, it's still determined on the fly. Signed-off-by: Milan Zamazal Reviewed-by: Kieran Bingham Tested-by: Robert Mader Signed-off-by: Kieran Bingham --- src/ipa/simple/soft_simple.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/ipa/simple/soft_simple.cpp') diff --git a/src/ipa/simple/soft_simple.cpp b/src/ipa/simple/soft_simple.cpp index b45c41a6..825c0675 100644 --- a/src/ipa/simple/soft_simple.cpp +++ b/src/ipa/simple/soft_simple.cpp @@ -206,6 +206,16 @@ int IPASoftSimple::configure(const IPAConfigInfo &configInfo) (context_.configuration.agc.againMax - context_.configuration.agc.againMin) / 100.0; + if (camHelper_->blackLevel().has_value()) { + /* + * The black level from camHelper_ is a 16 bit value, software ISP + * works with 8 bit pixel values, both regardless of the actual + * sensor pixel width. Hence we obtain the pixel-based black value + * by dividing the value from the helper by 256. + */ + context_.configuration.black.level = + camHelper_->blackLevel().value() / 256; + } } else { /* * The camera sensor gain (g) is usually not equal to the value written -- cgit v1.2.1