summaryrefslogtreecommitdiff
path: root/src/ipa
AgeCommit message (Collapse)Author
33 hoursipa: libipa: matrix: Fix incorrect symbol namespaceLaurent Pinchart
The matrixVlidateYaml() function is declared in the libcamera::ipa:: namespace, but defined in the libcamera:: namespace. This causes a dynamic linking error at runtime. Fix it by moving the function definition. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
44 hoursipa: rkisp1: agc: Rename frame context update variable to updateMeteringLaurent Pinchart
The frame context agc.update variable is used to indicate if the ISP histogram metering parameters need to be updated. Rename it to updateMetering to make usage more explicit. Suggested-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
8 daysipa: libipa: pwl: Drop readYaml() functionLaurent Pinchart
All users of the Pwl::readYaml() function have been removed. The function is not used, and is deprecated in favour of YamlObject::get(). Drop it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
8 daysipa: rpi: controller: Replace Pwl::readYaml() with YamlObject::get()Laurent Pinchart
Now that deserializing a Pwl object from YAML data is possible using the YamlObject::get() function, replace all usage of Pwl::readYaml() to prepare for its removal. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> # On Raspberry Pi 4
9 daysipa: rkisp1: agc: Move AeEnable control to the AGC algorithmLaurent Pinchart
The AGC algorithm implements the AeEnable control at runtime. Move the declaration of the control from the IPA module to the algorithm. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
9 daysipa: rkisp1: agc: Correctly clamp maximum shutter speedLaurent Pinchart
The sensor's maximum shutter speed is clamped by the maximum frame duration specified in requests. If the requested maximum frame duration is lower than the sensor's minimum shutter speed, the Agc::process() function will pass a minimum value higher than the maximum to the setLimits() function, resulting in an assertion failure. Fix it by clamping the value to both the lower and the upper bounds. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
9 daysipa: rkisp1: agc: Rename maxShutterSpeed to maxFrameDurationLaurent Pinchart
The AGC active state and frame context both contain a variable named maxShutterSpeed. The variable is used to limit the maximum shutter speed when computing the exposure time and gains, but stores the maximum frame duration, not clamped by the sensor's maximum shutter speed. Rename it to maxFrameDuration. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
9 daysipa: rkisp1: agc: Use mode from frame context to calculate new EVLaurent Pinchart
The effective exposure value for each frame is split into shutter time, analog gain and digital gain based on the AGC constraint mode and exposure mode. The algorithm uses the modes from the active state, which tracks the latest queued request, instead of the frame context, which tracks the value of the controls requested for that frame. Fix it by using the correct modes. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
9 daysipa: rkisp1: agc: Simplify predivider calculationLaurent Pinchart
The condition if (std::pow(std::floor(root), 2) < factor) predivider = static_cast<uint8_t>(std::ceil(root)); else predivider = static_cast<uint8_t>(std::floor(root)); can only be false when the factor's root is an integer. In that case, std::ceil(root) and std::floor(root) will be equal. The computation can thus be simplified by always rounding up. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
9 daysipa: rkisp1: agc: Don't update histogram parameters unnecessarilyLaurent Pinchart
The ISP histogram parameters depends on the AE metering mode, but not on the other AE algorithm controls. The exposure mode, constraints mode and frame duration limits influence the behaviour of the algorithm, but not the histogram computation parameters. Update the histogram parameters only when AE metering mode changes. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
9 daysipa: rkisp1: agc: Make size argument to computeHistogramPredivider constLaurent Pinchart
The Agc::computeHistogramPredivider() function doesn't need to modify its size parameter. Make it const. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
9 daysipa: rkisp1: Document all AGC parameters in IPAFrameContextLaurent Pinchart
The IPAFrameContext AGC documentation is lagging behind the implementation and misses many variables. Document them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
9 daysipa: rkisp1: Document all AGC parameters in IPAActiveStateLaurent Pinchart
The IPAActiveState AGC documentation is lagging behind the implementation and misses many variables. Document them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
9 daysipa: libipa: agc_mean_luminance: Include missing headerLaurent Pinchart
agc_mean_luminance.h uses utils::Duration, include the corresponding header. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
9 daysipa: libipa: agc_mean_luminance: Fix enumerator namesLaurent Pinchart
Enumerators in libcamera start with an upper case letter. Fix the AgcConstraint::Bound enumerators. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
9 daysipa: rkisp1: agc: Fix initialization without metering modesLaurent Pinchart
When no metering modes are specified in the tuning file, the AGC initialzation fails with [0:00:46.148508875] [209] ERROR RkISP1Agc agc.cpp:46 'AeMeteringMode' parameter not found in tuning file which results in a camera initialization failure. Fix it by downgrading the error into a warning, and continuing the AGC initialization with the default metering mode. Fixes: 35233938ee5d ("ipa: rkisp1: agc: Read histogram weights from tuning file") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
9 daysipa: libipa: vector: Add matrix-vector multiplicationPaul Elder
Add an operation for multiplying a matrix with a vector. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 daysipa: rkisp1: algorithms: Add crosstalk algorithmPaul Elder
Add an algorithm module to the rkisp1 IPA for crosstalk correction. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 daysipa: libipa: Add MatrixInterpolator classPaul Elder
Add a class to encapsulate the functionality of fetching a matrix based on an integer key, and interpolating if there is no exact match. This is expected to be used by both color correction matrices / crosstalk correction as well as lens shading correction. A cache is included only for exact matches of the key. The caller is expected to decide the tolererance for rounding. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
9 daysipa: libipa: Add Matrix classPaul Elder
Add a class to represent a Matrix object and operations for adding matrices, multipling a matrix by a scalar, and multiplying two matrices. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 daysipa: libipa: pwl: Specialize YamlObject getterLaurent Pinchart
Implement a specialization of the YamlObject::Getter structure to support deserializing ipa::Pwl objects from YAML data. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 daysipa: libipa: pwl: Add a constructor that moves a Point vectorLaurent Pinchart
The Pwl::Pwl(const std::vector<Point> &) constructor is inefficient as it makes a copy of the given points vector. Add a second constructor that takes an rvalue reference to a points vector to provide move semantics. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 daysipa: libipa: pwl: Add a size() functionLaurent Pinchart
Add a size() function to the Pwl class to return the number of points in the piecewise linear function. This is useful, for instance, to validate that all points added with append() or prepend() have been taken into account. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 daysipa: libipa: pwl: Make the empty() function inlineLaurent Pinchart
The Pwl::empty() function is a one-liner that can be easily optimized by the compiler given the chance. Make it inline. While at it, move the function documentation block to match the class declaration order. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 daysipa: libipa: pwl: Suffix \param with directionLaurent Pinchart
Suffix the Doxygen \param commands with the direction for all parameters. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 daysipa: libipa: vector: Drop readYaml() functionLaurent Pinchart
Now that YAML deserialization of Vector instances is supported through YamlObject::get(), remove the Vector::readYaml() function. It turns out not to be used. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 daysipa: libipa: vector: Specialize YamlObject getterLaurent Pinchart
Implement a specialization of the YamlObject::Getter structure to support deserializing ipa::Vector objects from YAML data. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
12 daysipa: rkisp1: agc: Plumb mode-selection and frame duration controlsPaul Elder
Plumb controls for setting metering mode, exposure mode, constraint mode, and frame duration limits. Also report them as available controls, as well as in metadata. While at it, add the missing #include for tuple, as a std::tie is used. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
12 daysipa: rkisp1: agc: Read histogram weights from tuning filePaul Elder
Add support to the rkisp1 AGC to read histogram weights from the tuning file. As controls for selecting the metering mode are not yet supported, for now hardcode the matrix metering mode, which is the same as what the AGC previously hardcoded. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
13 daysipa: rkisp1: cproc: Drop incorrect [[maybe_unused]]Stefan Klug
A few function parameters are marked with [[maybe_unused]] but are actually used. Drop the attribute. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
13 daysipa: rkisp1: cproc: Merge identical functionsStefan Klug
convertContrast() and convertSaturation() are equal. Merge them into one. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
13 daysipa: rkisp1: cproc: Use anonymous namespace to limit symbol visibilityStefan Klug
Use a anonymous namespace instead of the static keyword to limity symbol visibility. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
13 dayslibcamera: libipa: camera_sensor: Define AR0521 helper functions inlineLaurent Pinchart
All CameraSensorHelper subclasses define their member functions inline, except for the CameraSensorHelperAr0521 class. Inline the gainCode() and gain() functions to match the other classes. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
14 daysipa: rkisp1: goc: Avoid use of auto for short typeLaurent Pinchart
Replace one occurrence of the auto type qualifier with the explicit type it represents to increase readability. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
14 daysipa: rkisp1: goc: Mark default gamma table as static constexprLaurent Pinchart
The values for the default gamma table are stored in an array that is never modified. Mark it as static constexpr to facilitate optimizations. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
14 daysipa: rkisp1: goc: Use copydocLaurent Pinchart
Use the Doygen \copydoc command instead of duplicating documentation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
14 daysipa: rkisp1: goc: Drop incorrect [[maybe_unused]]Laurent Pinchart
A few function parameters are marked with [[maybe_unused]] but are actually used. Drop the attribute. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
14 daysipa: rkisp1: goc: Fix typographical issues in documentation.Laurent Pinchart
Fix a few assorted typographical issues: - Sentences should end with a period. - Paragraphs should be separated by a blank line, and there should be no line break within a paragraph. - Doxygen lists need a list marker ('-' or '*', use '-' here). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
14 daysipa: rpi: controller: Use libipa's Pwl classPaul Elder
To reduce code duplication, use the Pwl class from libipa. This also removes the Pwl class from the Raspberry Pi IPA. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Acked-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
14 daysipa: libipa: Copy pwl from rpi, and clean it up to match libcameraPaul Elder
Copy the piecewise linear function code from Raspberry Pi, and clean it up to align it more with the libcamera style. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Acked-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
14 daysipa: libipa: Add Vector classPaul Elder
Add a vector class to libipa. The original purpose of this is to replace the floating-point Point class that Raspberry Pi used in their Pwl, as that implementation of Point seemed more akin to a Vector than a Point. This is added to libipa instead of to geometry.h to avoid public API issues, plus this is not expected to be needed by applications. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-06-11pipeline: rkisp1: cproc: Fix default value handlingStefan Klug
Default control values were not applied to activeState. This had no negative side effects in the first place, as the hardware defaults were used. The issue became visible, when only one of the controls was set at runtime. In that case the params for the other values were overwritten with 0 (reset value of activeState) resulting in a black image. While at it, only add the controls to the controls map if the algorithm is contained in the tuning file. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-11meson: Group libipa and libipa_includes in a dependency objectLaurent Pinchart
Many build targets link with libipa and need libipa_includes. Group them in a libipa_dep dependency object to simplify the users. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-06-11ipa: rkisp1: Add GammaOutCorrection algorithmStefan Klug
Add a gamma algorithm for the rkisp1. It defaults to a gamma of 2.2 which closely resembles sRGB. No seperate sRGB mode was implemented because the pwl that models the gamma curve is so coarse that there is basically no difference between srgb and gamma=2.2. The default can be overridden within the tuning file or set at runtime using the gamma control. The gamma algorithm is not enabled by default. This will be done in future tuning file updates. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-06-11ipa: rkisp1: Fix algorithm controls vanish after configureStefan Klug
std::unordered_map::merge(source) has the side effect of actually moving items from source to target. In this case the controls were removed from the source maps on the first call to updateControls() and on the second call to updateControls() they were missing in the source maps and therefore also removed from the camera. Fix this by using insert() instead of merge(). This is most likely cheaper than copy-contructing the source map. Fixes: 4c5152843a2a ("ipa: rkisp1: Derive rkisp1::algorithms::Agc from AgcMeanLuminance") Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-06-04ipa: rpi: Disable StatsOutputEnable control by defaultNaushir Patuck
Set the default value of controls::rpi::StatsOutputEnable to false, disabling the functionality. This stops unnecessary copies of the statistics output ending up in the Request metdata if not needed. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-02libcamera: software_isp: Remove DebayerParams::kGain10Milan Zamazal
The constant is used in a single place internally and doesn't belong to DebayerParams anymore. Let's use 256 directly. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Andrei Konovalov <andrey.konovalov.ynk@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-06-02libcamera: software_isp: Move color mappings out of debayeringMilan Zamazal
Constructing the color mapping tables is related to stats rather than debayering, where they are applied. Let's move the corresponding code to stats processing. The same applies to the auxiliary gamma table. As the gamma value is currently fixed and used in a single place, with the temporary exception mentioned below, there is no need to share it anywhere anymore. It's necessary to initialize SoftwareIsp::debayerParams_ to default values. These initial values are used for the first two frames, before they are changed based on determined stats. To avoid sharing the gamma value constant in artificial ways, we use 0.5 directly in the initialization. This all is not a particularly elegant thing to do, such a code belongs conceptually to the similar code in stats processing, but doing better is left for larger refactoring. This is a preliminary step towards building this functionality on top of libipa/algorithm.h, which should follow. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Andrei Konovalov <andrey.konovalov.ynk@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-06-02libcamera: software_isp: Honor black level in AWBMilan Zamazal
The white balance computation didn't consider black level. This is wrong because then the computed ratios are off when they are computed from the whole brightness range rather than the sensor range. This patch adjusts white balance computation for the black level. There is no need to change white balance application in debayering as this is already applied after black level correction. Exposure computation already subtracts black level, no changes are needed there. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Andrei Konovalov <andrey.konovalov.ynk@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-06-02libcamera: software_isp: Use a specific integer type for black levelMilan Zamazal
The documented range of values corresponds to uint8_t, so let's use that type. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Andrei Konovalov <andrey.konovalov.ynk@gmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>