summaryrefslogtreecommitdiff
path: root/src/ipa
AgeCommit message (Collapse)Author
2022-04-02ipa: rkisp1: Split queuing of request and parameter fillingUmang Jain
Queuing of request (i.e. passing of controls to the IPA) and filling of the parameters buffer are two separate operations. Treat them as such by splitting them into two functions in the rkisp1 IPA interface. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-04-01libipa: camera_sensor_helper: Add OV5640 helperPaul Elder
The OV5640 is an OmniVision sensor with a linear gain model, expressed in 1/16 steps. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-04-01libipa: camera_sensor_helper: Add IMX296 helperLaurent Pinchart
The IMX296 is a Sony sensor that expresses its gain in 0.1dB units. It thus maps to the exponential gain model. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-01libipa: camera_sensor_helper: Add IMX290 helperLaurent Pinchart
The IMX290 is a Sony sensor that expresses its gain in 0.3dB units. It thus maps to the exponential gain model. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-01libipa: camera_sensor_helper: Implement exponential gain modelLaurent Pinchart
The CameraSensorHelper specifies two gain models, linear and exponential. They are modelled after the MIPI CCS specification. Only the linear model has been implemented, the exponential model was left for later. We now need to support sensors that configure their gain in a hardware register with a value expressed in dB. This has similarities with the MIPI CCS exponential gain model, but is only has an exponential factor, while CCS also allows sensors to support a configurable linear factor. The full CCS exponential model needs two values (for the linear and exponential factors) to express a gain, while IPAs use a single linear gain value internally. However, the exponential gain model example in the CCS specification has a fixed linear factor, which may indicate that it could be common for sensors that implement the exponential gain model to only use the exponential factor. For this reason, implement the exponential gain model with a fixed linear factor, but with a sensor-specific coefficient for the exponential factor that allows expressing the gain in dB (or other logarithmical units) instead of limiting it to powers of 2 as in the MIPI CCS specification. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-01libipa: camera_sensor_helper: Reorganize gain constantsLaurent Pinchart
To prepare for other gain models than the linear model, store the gain constants in a union with per-model members. Due to the lack of designated initializer support in gcc with C++17, initializing a single complex structure that includes a union will be difficult. Split the gain model type to a separate variable to work around this issue. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-03-28ipa: ipu3: Ensure controls exists in before they are queriedUmang Jain
Add a validation check for sensor controls validateSensorControls() before they are queried in IPAIPU3::updateSessionConfiguration(). Fail the IPAIPU3::configure() if the required sensor controls are not found. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28ipa: ipu3: Drop sensor controls private members from IPAIPU3Umang Jain
Drop exposure, gain private members from IPAIPU3 because the values are handled directly via IPAFrameContext. Move the default vblank value from IPAIPU3 to IPASessionConfiguration structure as it is a default static value not expected to change for a session. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28ipa: ipu3: Consolidate querying of exposure and gain limitsUmang Jain
The exposure and gain limits are required for AGC configuration handled in IPAIPU3::updateSessionConfiguration(), which is happening already. Therefore the max/min private members in IPAIPU3 class for exposure/gain serve no use except setting initial values of exposure_ and gain_ members. Drop the max/min private members from IPAIPU3 class and set initial gain_ and exposure_ in IPAIPU3::updateSessionConfiguration(). Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28ipa: rkisp1: Introduce AWBJean-Michel Hautbois
The RkISP1 ISP calculates a mean value for Y, Cr and Cb at each frame. There is a RGB mode which could theoretically give us the values for R, G and B directly, but it seems to be failing right now. Convert those values into R, G and B and estimate the gain to apply in a grey world. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Tested-by: Peter Griffin <peter.griffin@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28ipa: rkisp1: agc: Add a histogram-based gainJean-Michel Hautbois
As for the IPU3, we can estimate the histogram of the luminance. The RkISP1 can estimate multiple ones, the R, G and B ones, the Y only one and a combination of RGB. The one we are interested by in AGC is the Y histogram. Use the hardware revision to determine the number of bins of the produced histogram. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Tested-by: Peter Griffin <peter.griffin@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28ipa: libipa: Histogram: Constify the constructor spanJean-Michel Hautbois
The Histogram constructor does not modify the data. Pass it a Span<const uint32_t> instead of a Span<uint32_t>. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28ipa: rkisp1: Introduce Black Level CorrectionJean-Michel Hautbois
In order to have the proper pixel levels, apply a fixed black level correction, based on the imx219 tuning file in RPi. The value is 4096 on 16 bits, and the pipeline for RkISP1 is on 12 bits, scale it. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Tested-by: Peter Griffin <peter.griffin@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28ipa: rkisp1: Use frame counter for the request queuedJean-Michel Hautbois
Introduce a frameCount variable in the IPAFrameContext which increments each time a request is queued. It is reset at configure call, when the camera is started. This will allow the frameCount to be used by other algorithms, without having to keep multiple private frame counters. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-23ipa: rkisp1: Replace event-based ops with dedicated functionsUmang Jain
The IPARkISP1Interface currently uses event-type based structures in order to communicate with the pipeline-handler (and vice-versa). Replace the event based structures with dedicated functions associated to each operation. The translated naming scheme of operations to dedicated functions: ActionV4L2Set => setSensorControls ActionParamFilled => paramsBufferReady ActionMetadata => metdataReady EventSignalStatBuffer => processStatsBuffer() EventQueueRequest => queueRequest() The lexical of IPARkISP1::metadataReady() will now conflict with the metadataReady Signal being introduced in this patch as part of the interface change. Hence, rename IPARkISP1::metadataReady() to IPARkISP1::prepareReady() to prevent the conflict. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Tested-by: Paul Elder <paul.elder@ideasonboard.com>
2022-03-23ipa: rkisp1: Drop private exposure and gain limitsUmang Jain
The private members of exposure and gain limits can be dropped from IPARkISP1 since they are not used class-wide and can be easily replaced by local counter-parts. In case they are required to be widely available, these should then sit in IPASessionConfiguration. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Tested-by: Paul Elder <paul.elder@ideasonboard.com>
2022-03-23ipa: raspberrypi: Add tuning file for IMX296 sensorNaushir Patuck
The Sony IMX296 exists in two versions, colour (Bayer) and monochrome. The tuning file corresponds to the monochrome version. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
2022-03-23ipa: raspberrypi: Add camera helper for Sony IMX296 sensorNaushir Patuck
The Sony IMX296 sensor has an exponential gain model, and adds a fixed 14.26µs offset to the exposure time expressed in line units. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-23ipa: raspberrypi: cam_helper: Make exposure conversion functions virtualNaushir Patuck
Some sensors (namely the Sony IMX296, whose support will be added shortly) require different conversion formulas between exposure time and exposure lines. Make the Exposure() and ExposureLines() functions virtual to allow this. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-23ipa: raspberrypi: awb: Fix typo in AWB mode conversion tableDavid Plowman
The AwbAuto mode is defined in all the JSON tuning files as "auto", not "normal". The effect of this was that you couldn't switch back to "auto" mode once you had switched away. Signed-off-by: David Plowman <david.plowman@raspberrypi.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>
2022-03-17ipa: ipu3: agc: Use existing local short-hand variable in configure()Laurent Pinchart
The configure() function has a local configuration variable referencing context.configuration for the purpose of shortening lines. Use it instead of context.configuration in the remaining locations, and constify it while at it as the configuration isn't meant to be modified. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-17ipa: ipu3: agc: Reset frame count when configuring AGCLaurent Pinchart
The frame count is used to skip the gain and exposure filtering when starting. It thus needs to be reset when configuring the algorithm, to avoid slower convergence when stopping and restarting. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-17libipa: Add CameraSensorHelper for OV2740Daniel Scally
The datasheet for the OV2740 gives 0x80 as 1x gain, so real gain is GainCode / 128. Signed-off-by: Daniel Scally <djrscally@gmail.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-15ipa: ipu3: Send lens controls to pipeline handlerDaniel Scally
Pick up the focus value from the AF algorithm and send lens controls along in the frame context. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Daniel Scally <djrscally@gmail.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-15libcamera: ipa: Rename ctrls_ memberDaniel Scally
Now that we have added lens controls, rename the existiing member of the class to clarify that it relates to the sensor's controls. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Daniel Scally <djrscally@gmail.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-15libcamera: ipa: Add lens control member to ipu3 ipa interfaceDaniel Scally
Add further members to the ipu3 ipa interface that will hold lens controls passed in by configInfo Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Daniel Scally <djrscally@gmail.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-15ipa: ipu3: af: Auto focus for dw9719 Surface Go2 VCMKate Hsuan
Since VCM for surface Go 2 (dw9719) had been successfully driven, this Af module can be used to control the VCM and determine the focus value based on the IPU3 AF state. Based on the values from the IPU3 AF buffer, the variance of each focus step is determined and a greedy approach is used to find the maximum variance of the AF state and an appropriate focus value. The grid configuration is implemented as a context. Also, the grid parameter- AF_MIN_BLOCK_WIDTH is set to 4 (default is 3) since if the default value is used, x_start (x_start > 640) will be at an incorrect location of the image (rightmost of the sensor). Signed-off-by: Kate Hsuan <hpa@redhat.com> Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-11ipa: ipu3: awb: Clamp gain valuesJean-Michel Hautbois
The gain values are coded as u3.13 fixed point values, ie they can not be more than 8. Clamp the values in order to avoid any off limits value which could make the IPU3 behave in a weird manner. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-03-11ipa: ipu3: agc: Introduce lineDuration in IPASessionConfigurationJean-Michel Hautbois
Instead of having a local cached value for line duration, store it in the IPASessionConfiguration::sensor structure. While at it, configure the default analogue gain and shutter speed to controlled fixed values. The latter is set to be 10ms as it will in most cases be close to the one needed, making the AGC faster to converge. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2022-03-11ipa: ipu3: Shorten exposure and gain linesJean-Michel Hautbois
When the effective sensor values are stored during the EventStatReady event, the lines are long. Fix it. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2022-03-11ipa: ipu3: Return filtered valueJean-Michel Hautbois
When the current exposure value is calculated, it is cached and used by filterExposure(). Use private filteredExposure_ and pass currentExposure as a parameter. In order to limit the use of filteredExposure_, return the value from filterExposure(). While at it, remove a stale comment. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2022-02-10ipa: raspberrypi: Reduce the controller rate to 30fpsNaushir Patuck
With the controller algorithms running at 60fps, there are some dropped frames when running at very high famerates. Reducing this to 30fps eliminates all these drops without any noticeable changes to the image quality. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-02-08ipa: raspberrypi: awb: Better handling of how we disable AWBDavid Plowman
We now handle disabling ("pausing") AWB in the same way as AEC/AGC. Instead of letting the pause flag be set so that the code never runs at all, we instead fix the manual settings to the current values (but continue to be called). The algorithm does not restart any calculations in this state, but continues to add AWB metadata to every frame. Therefore certain other algorithms that want to know it (CCM and ALSC, for example) can still find it. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-02-03ipa: raspberrypi: config: Increase the max gain in the exposure profilesNaushir Patuck
Increase the maximum allowable gain from 6.0 to 8.0 in the normal and short exposure profiles for all camera sensors. Increase this limit to 12.0 for the long exposure profiles for sensors where this has been defined. The 6.0x value was somewhat arbitrarily chosen, and does limit the total exposure in dark conditions. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-02-03ipa: raspberrypi: Limit the maximum sensor gain usedNaushir Patuck
Limit the gain code to the maximum value reported by the sensor controls when sending to DelayedControls. The AGC algorithm will handle a lower gain used by the sensor, provided it knows the actual gain used. This change ensures that DelayedControls will never report an unclipped gain used. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-07libcamera: Use utils::abs_diff()Laurent Pinchart
Use the new utils::abs_diff() function where appropriate to replace manual implementations. While at it fix a header ordering issue in src/libcamera/pipeline/raspberrypi/raspberrypi.cpp. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-12-04libcamera: base: shared_fd: Rename fd() to get()Laurent Pinchart
For consistency with UniqueFD, rename the fd() function to get(). Renaming UniqueFD::get() to fd() would have been another option, but was rejected to keep as close as possible to the std::shared_ptr<> and std::unique_ptr<> APIs. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-12-04libcamera: base: Rename FileDescriptor to SharedFDLaurent Pinchart
Now that we have a UniqueFD class, the name FileDescriptor is ambiguous. Rename it to SharedFD. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-03libcamera: Move file_descriptor.h to base/Laurent Pinchart
The FileDescriptor class is a generic helper that matches the criteria for the base library. Move it there. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-12-01ipa: rkisp1: Initialize numCells in constructorJean-Michel Hautbois
The non-static class member "numCells_" is not initialized in the constructor. Fix it. Reported-by: Coverity CID 365801 Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-30ipa: ipu3: Rectify gain value reporting in request metadataUmang Jain
Report value of sensor's gain pertaining to the current request completion, as that is the gain value the request completed with. The Agc algorithm processes the gain value for incoming next request hence it should not be reported in request's metadata. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-29ipa: rkisp1: agc: Introduce prepare callJean-Michel Hautbois
When a new parameter buffer needs to be queued, we need to specify which algorithm is activated or not in the ISP. Add a simple prepare function in AGC for that, which may later evolve to take the exposure locking into account. For that function to be called, we also need to add the loop on the algorithms in IPARkISP1::queueRequest. We no longer disable the AE algorithm based on the controls::AeEnable, which will be handled in a different manner later. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-29ipa: rkisp1: Introduce AGCJean-Michel Hautbois
Now that we have IPAContext and Algorithm, we can implement a simple AGC based on the IPU3 one. It is very similar, except that there is no histogram used for an inter quantile mean. The RkISP1 is returning a 5x5 array (for V10) of luminance means. Estimating the relative luminance is thus a simple mean of all the blocks already calculated by the ISP. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-29ipa: rkisp1: agc: Introduce HW revision in IPAContextJean-Michel Hautbois
The ISP can use 25 or 81 cells depending on its revision. Remove the cached value in IPARkISP1 and use IPASessionConfiguration to store it and pass it to AGC later. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-29ipa: rkisp1: Report and use sensor controlsJean-Michel Hautbois
The pipeline handler populates a new sensorControls ControlList, to have the effective exposure and gain values for the current frame. This is done when a statistics buffer is received. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-11-29ipa: rkisp1: Use the Algorithm classJean-Michel Hautbois
Now that libipa offers a templated class for Algorithm, use it in RkISP1. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-11-29ipa: libipa: Introduce Algorithm class templateJean-Michel Hautbois
The algorithms are using the same function names with specialized parameters. Instead of duplicating code, introduce a libipa Algorithm class which implements a base class with template parameters in libipa, and use it in each IPA. As we now won't need an algorithm class for each IPA, move the documentation to libipa, and make it agnostic of the IPA used. While at it, fix the IPU3::Algorithm::Awb documentation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-11-29ipa: rkisp1: Introduce IPAContextJean-Michel Hautbois
Before using any algorithm, we want the IPAContext to be ready for those. Introduce the IPAContext following the existing design from IPA::IPU3. Each algorithm will then introduce the needed fields. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-11-29ipa: rkisp1: Instantiate CameraSensorHelperJean-Michel Hautbois
When the AGC will run, it will use analogue gains as double values. We will need those values to be converted to apply the control. Introduce CameraSensorHelper and call it at init(). Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-11-29ipa: Do not modify the sensor limitsJean-Michel Hautbois
The driver is responsible for setting the proper limits for its controls. The IMX219 has an analogue gain of 1.0 when the gain code is set to 0, therefore we can not clamp to a minimum gain code of 1. Rework this for both IPU3 and RkISP1, for both Exposure and Gain controls. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>