Encode the bayer shader files into a header as part of the build process.
Qcam already compiles the shader files down into a QT resource file which
it references internally.
In order to share the debayering shader programs outside of qcam create a
generic header which both qcam and libcamera can operate from.
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Some kernel drivers give their entities names that will differ from
implementation to implementation; for example the drivers for the
Camera Receiver Unit and CSI-2 receiver in the RZ/V2H(P) SoC give their
entities names that include their memory address, in the format
"csi-16000400.csi2". Passing that entity name to
V4L2Subdevice::fromEntityName() is too inflexible given it would only
then work if that specific CSI-2 receiver were the one being used.
Add an overload for V4L2Subdevice::fromEntityName() to instead allow
users to pass a std::basic_regex, and use std::regex_search() instead
of a direct string comparison to find a matching entity. Ths allows
us to form regular expressions like "csi-[0-9a-f]{8}.csi2" to find
the entities.
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Some kernel drivers give their entities names that will differ from
implementation to implementation; for example the drivers for the
Camera Receiver Unit and CSI-2 receiver in the RZ/V2H(P) SoC give their
entities names that include their memory address, in the format
"csi-16000400.csi2". Passing that entity name to
MediaDevice::getEntityByName() is too inflexible given it would only
then work if that specific CSI-2 receiver were the one being used.
Add an overload for MediaDevice::getEntityByName() that accepts a
std::basic_regex instead of a string, and use std::regex_search()
instead of a direct string comparison to find a matching entity. This
allows us to search for entites using regex patterns like
"csi-[0-9a-f]{8}.csi2".
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Some entities in a media graph have names that might differ from
implementation to implementation; for example the Camera Receiver
Unit and CSI-2 receiver on the RZ/V2H(P) SoC have entities with names
that include their address, in the form "csi-16000400.csi2". Passing
that entity name to DeviceMatch is too inflexible given it would only
work if that specific CSI-2 receiver were the one being used.
Add an overload for DeviceMatch::add() such that users can pass in a
std::regex instead of a string. Update DeviceMatch::match() to check
for entities that are matched by the regular expressions added with
the new overload after checking for any exact matches from the vector
of strings. This allows us to use regex to match on patterns like
"csi-[0-9a-f]{8}.csi2".
Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
This change integrates the MediaPipeline class into the imx8-isi
pipeline handler. Purpose is to allow a dynamic discovery and
configuration of the actual subdevices graph between the sensor and
the ISI crossbar. This brings support for more complex topologies and
simplifies the implementation.
Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Exposes internal MediaEntity::Entity list to help extracting more
information regarding linked entities.
For example, when the pad index of the last device in the list need to be
retrieved from the media pipeline user.
Exposes as const to with a dedicated access to prevent any corruption from
user. Then it is still protected so as when the list was private.
Since MediaPipeline::Entity needs also to be moved to public, then need to
add some documentation in cpp source. Existing documentation from header
file is applied when available.
Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
The abi-compliance checker reports there are both ABI and API changes in this
release:
Binary compatibility: 99.3%
Source compatibility: 98.6%
Total binary compatibility problems: 4, warnings: 1
Total source compatibility problems: 18, warnings: 5
These have been planned to batch together a lot of recent development to
improve the public facing API, which has extended the previous merge window on
this occasion.
A full and detailed ABI report for those interested can always be generated
between any two versions with the internal tooling:
"./utils/abi-compat.sh v0.5.2 v0.6.0"
Integration Overview:
With 211 commits and a longer merge window, this is quite a substantial
release.
Key highlights include a new global configuration file system which will
replace or extend the current use of environment variables to configure runtime
behaviours.
The core V4L2 classes can now support the V4L2 Request API - which in turn has
brought in huge developments for the i.MX8MP Dewarper support allowing full
resize, scale, rotate and crop capabilities on top of also performing lens
dewarping.
The SoftISP continues to develop, and specifically the IPU7 has been added as a
supported configuration to the pipeline.
New tuning files have been added for Raspberry Pi platforms, improving support
for the Sony IMX335, IMX415, IMX462, and ST VD55G1 image sensors, and Decompand
support has been added for the Raspberry Pi 5.
At the core, we now require Meson 1.0.1, and various improvements have been
made for thrad handling, improving synchronisation and event dispatch, as well
as fixing the serialisation operations for isolated IPA modules.
In the applications components, there are fixes to cam adding more output
formats and qcam now behaves more consistently when no camera is selected. The
python bindings have received fixes for paths from meson, and the
FrameBuffer::planes wrapper.
On the Documentation side, there's a new theme refresh and clearer separation
between the internal and public API, and fixes to the contributing guidelines.
The following commits in this release relate to either a bug fix or an
improvement to an existing commit.
- libcamera: base: semaphore: Do not unlock prematurely
- Bug: https://bugs.libcamera.org/show_bug.cgi?id=225
- apps: cam: Do not overwrite name when adding camera model
- Fixes: aab49f903e ("cam: Do not assume Location is available")
- Documentation: Fix documentation generation when subproject
- Fixes: 0382d215db ("Documentation: Use Sphinx doxylink to generate links to doxygen")
- apps: qcam: Do nothing if no camera is selected
- Bug: https://bugs.libcamera.org/show_bug.cgi?id=177
- utils: codegen: gen-formats.py: Fix big endian formats
- Fixes: 7c496f1c54 ("utils: gen-formats: Support big-endian DRM formats")
- pycamera: Fix FrameBuffer::planes wrapper
- Fixes: b8d332cdcc ("libcamera: framebuffer: Replace vector with span in constructor")
- libipa: agc_mean_luminance: Fix constraint logging
- Fixes: 42e18c96bc ("libipa: agc_mean_luminance: Add debug logging")
- libcamera: software_isp: Pass correct y-coordinate to stats
- Bug: https://bugs.libcamera.org/show_bug.cgi?id=280
- libcamera: controls: Expose string controls as `std::string_view`
- Bug: https://bugs.libcamera.org/show_bug.cgi?id=256
- pipeline: simple: Consider output sizes when choosing pipe config
- Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/236
- ipa: rpi: vd56g3: Fix frameIntegrationDiff value
- Reported-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
- libcamera: rkisp1: Mark VBLANK as priority
- Fixes: f72c76eb6e ("rkisp1: Honor the FrameDurationLimits control")
- libcamera: base: thread: Use `pthread_self()` when setting name
- Fixes: 559128b1f1 ("Thread: Add name parameter")
- pipeline: imx8-isi: Delay ISI routes config to acquire() time
- Fixes: 92df79112f ("pipeline: imx8-isi: Add multicamera support")
- pipeline: simple: Reduce warning of unknown pixel formats
- Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/291
- libcamera: pipeline_handler: Fix requestComplete on waiting requests on stop
- Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/281
- libcamera: software_isp: Assign colour spaces in configurations
- Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/294
- libipa: exposure_mode_helper: Set quantizationGain in absence of a sensor helper
- Fixes: f077c58e08 ("libipa: exposure_mode_helper: Take exposure/gain quantization into account")
- ipa: libipa: agc_mean_luminance: Fix yTarget handling in constraints
- Fixes: 24247a12c7 ("ipa: libipa: Add AgcMeanLuminance base class")
- libcamera: control_serializer: Add array info to serialized ControlValue
- Bug: https://bugs.libcamera.org/show_bug.cgi?id=285
And the following updates have been made in this release, grouped by category:
core:
- libcamera: converter_v4l2_m2m: Add missing `<set>` include
- treewide: Remove top-level `const` from return types
- libcamera: camera_sensor: getControls(): Use span
- libcamera: camera_sensor: getFormat(): Use span
- libcamera: ipa_proxy: Log configuration file path
- libcamera: base: thread: eventDispatcher(): Not thread safe
- libcamera: base: semaphore: Do not unlock prematurely
- meson: Bump minimum version to v1.0.1
- meson: Use dependency('dl')
- libcamera: v4l2_videodevice: Avoid repeated calls to FrameBuffer::planes()
- meson: Check for Python modules manually
- libcamera: sensor: imx462: Add sensor delays to CameraSensorProperties
- libcamera: clock_recovery: Use nanoseconds in addSample()
- utils: Add unary negation operation to Duration
- utils: codegen: ipc: Put default values in declaration
- utils: codegen: ipc: Generate templated constructor
- utils: codegen: gen-formats.py: Use jinja
- utils: codegen: gen-formats.py: Fix big endian formats
- libcamera: framebuffer: Replace vector with span in constructor
- libcamera: request: addBuffer(): Do not destroy fence on failure
- libcamera: camera_sensor_properties: Add vd55g1 camera sensor
- include: linux: Partially update linux headers from v6.16-rc1-310-gd968e50b5c26
- config: Introduce global runtime configuration
- libcamera: camera_manager: Construct GlobalConfiguration instance
- config: Add configuration retrieval helpers
- camera_manager: Look up pipelines match list in configuration file
- config: Check configuration file version
- meson: Add option to disable libunwind integration
- libcamera: base: thread: Make `removeMessages()` public
- utils: codegen: ipc: Split proxy types
- libcamera: controls: Expose string controls as `std::string_view`
- subprojects: libpisp: Update to v1.3.0
- libcamera: request: Clarify ReuseBuffers flag usage with fences
- libcamera: base: utils: Simplify `enumerate()`
- config: Fix doxygen 1.15.0 errors
- libcamera: base: {unique,shared}_fd: Warn if closing fails
- libcamera: base: utils: Simplify hex adaptor
- libcamera: base: thread: Use `std::unique_ptr` instead of raw pointer
- Thread: Add name parameter
- libcamera: base: thread: Use `pthread_self()` when setting name
- utils: checkstyle.py: Accept `Closes` commit trailer
- libcamera: pipeline_handler: Add accessor for useCount_
- subprojects: libyuv: Bump to version 1922
- treewide: Use `argparse.FileType` in more places
- libcamera: pipeline_handler: Fix requestComplete on waiting requests on stop
- libcamera: base: thread: Use `acquire` memo. when reading event dispatcher
- libcamera: request: Store fence `EventNotifier` directly
- libcamera: ipa_data_serializer: Add specialization for enums
- libcamera: simple: Detect Bayer pattern change during configure()
- libcamera: converter: Utilise shared MediaDevice pointers
- libcamera: Add support for V4L2 requests
- libcamera: converter: Add V4L2 request support
- libcamera: converter_v4l2_m2m: Add suport for V4L2 requests
- libcamera: converter_v4l2_m2m: Always set stride
- include: linux: Update headers for Dw100 dewarper engine
- libcamera: converter_v4l2_m2m: Add helper to apply controls
- libcamera: converter_v4l2_m2m: Add debug logging for formats
- libcamera: converter: Add dw100 vertex map class
- libcamera: converter: Add dw100 converter module
- libcamera: internal: camera_sensor: Add accessor for mountingOrientation_
- libcamera: Add transpose() function to size
- libcamera: dw100_vertexmap: Implement parametric dewarping
- libcamera: Add and implement LensDewarpEnable control
- libcamera: control_serializer: Add array info to serialized ControlValue
- Revert "controls: Add boolean constructors for ControlInfo"
pipeline:
- pipeline: simple: Improve debug log in validate()
- libcamera: pipeline: Avoid unnecessary indirection in frame info map
- pipeline: ipu3: Drop unneeded forward declarations
- pipeline: rkisp1: Replace error handling gotos with utils::exit_scope
- pipeline: rpi: Use structured bindings in range-based for loop
- pipeline: imx8-isi: Fix crossbar's sink pad computation
- pipeline: simple: Enable simple pipelinehandler with SoftISP on Intel IPU7
- pipelines: Use lambda functions to factor out buffer mapping code
- pipeline: rkisp1: Add error log when parameter queuing fails
- pipeline: rkisp1: Query kernel for available params blocks
- rkisp1: agc: Agc add yTarget to frame context
- pipeline: simple: Allow enabling software ISP via config file
- libcamera: software_isp: Make input buffer copying configurable
- libcamera: software_isp: Make measurement configurable
- libcamera: pipeline: virtual: Move image generation to separate thread
- libcamera: software_isp: Add valid flag to struct SwIspStats
- libcamera: software_isp: Run sw-statistics once every 4th frame
- libcamera: software_isp: Fix width adjustment in SwStatsCpu::setWindow
- libcamera: software_isp: Clarify SwStatsCpu::setWindow use
- libcamera: software_isp: Pass correct y-coordinate to stats
- pipeline: simple: Initialize maxQueuedRequestsDevice to 4
- pipeline: simple: Increase internal buffers for software ISP to 4
- pipeline: simple: Allow buffer counts from 1 to 32
- libcamera: software_isp: Clear pending async work
- pipeline: simple: Avoid overusage of auto variables
- libcamera: software_isp: Apply CCM swap also on green
- pipeline: simple: Consider output sizes when choosing pipe config
- libcamera: rkisp1: Mark VBLANK as priority
- pipeline: imx8-isi: Delay ISI routes config to acquire() time
- libcamera: software_isp: Fix gamma table when CCM is used
- pipeline: simple: Reduce warning of unknown pixel formats
- libcamera: pipeline: uvcvideo: Reject sensor configuration
- libcamera: software_isp: Assign colour spaces in configurations
- pipeline: virtual: Provide and validate colorspace
- libcamera: pipeline: Utilise shared MediaDevice pointers
- libcamera: rkisp1: Properly cancel buffers in dewarp case
- libcamera: rkisp1: Move useDewarper_ flag into RkISP1CameraData
- libcamera: rkisp1: Scale down in dewarper instead of resizer
- libcamera: rkisp1: Allow upscaling when the dewarper is present
- pipeline: rkisp1: Fix number of buffers imported into the dewarper
- libcamera: rkisp1: Use the dw100 converter module instead of the generic v4l2 converter
- pipeline: rksip1: Move isRaw up in scope
- pipeline: rkisp1: Drop rawFormat variable
- pipeline: rkisp1: Enable the dewarper based on the tuning file
- libcamera: rkisp1: Handle requested orientation using dewarper
- pipeline: rkisp1: Load dewarp parameters from tuning file
apps:
- apps: common: options: Avoid copying in range based for loop
- apps: cam: Do not overwrite name when adding camera model
- apps: cam: drm: Drop unneeded local variable
- py: libcamera: Improve python binding installation
- py: libcamera: Get dependency from meson python module unconditionally
- py: libcamera: Always use install path from meson python module
- apps: qcam: Do nothing if no camera is selected
- apps: cam: Support PPM output for other RGB formats
- pycamera: Fix FrameBuffer::planes wrapper
- apps: cam: Use signalfd
- gstreamer: Update the TODO list
- android: camera_hal_manager: Remove `cameraLocation()`
- gstreamer: Associate libcamera::Stream with GstPad
- gstreamer: Improve logging for buffer pool activation
- gstreamer: Track RequestWrap's GstBuffer using GstPad
- py: gen-py-formats.py: Open input file in binary mode
- apps: cam: sdl_texture: Support NV21
documentation:
- Documentation: Fix documentation generation when subproject
- Documentation: Use python3 directly to check for doxylink version
- Documentation: Use standard ordering for Doxyfile variables
- Documentation: Add doxygen-awesome-css
- Documentation: Enable doxygen-awesome-css
- Documentation: Use the sphinx book theme
- Documentation: Add api-html/ and internal-api-html/ to docs sources
- Documentation: Reorganize toctree
- Documentation: Improve Sphinx and Doxygen integration
- Documentation: Drop unnecessary documentation-contents.rst
- Documentation: mainpage: Make it easier to distinguish public and internal API
- Documentation: Rename api to public-api and drop -html suffix
- Documentation: Add global configuration file documentation
- Documentation: Fix grammar and typo in meson.build comment
- Documentation: contributing: Provide a reference to Matrix
- Documentation: contributing: Update issue tracker
- Documentation: contributing: Update Source references
ipa:
- ipa: rpi: Add Arducam B0568 IMX335 tuning files
- ipa: rpi: Add Arducam B0569 IMX415 tuning files
- ipa: rpi:: denoise: Implement TDN back-off for CDN deviation
- ipa: rpi: pisp: data: Improve noise and detail tuning
- ipa: rpi: pisp: data: Update all non-official camera tuning files
- ipa: rpi: vc4: Minor tuning changes
- ipa: rpi: sdn: Remove legacy denoise warning
- ipa: rpi: imx462: Add official RPi tuning for IMX462
- ipa: rpi: ccm: Implement "manual" CCM mode
- ipa: rpi: Add vd55g1 support for rpi
- ipa: rpi: Add vd55g1 tuning files for rpi
- libcamera: libipa: Add vd55g1 support for libipa
- libcamera: libipa: camera_sensor: Add Himax HM1246 sensor properties
- ipa: rkisp1: Add basic compression algorithm
- libipa: camera_sensor_helper: Add quantizeGain() function
- libipa: exposure_mode_helper: Take exposure/gain quantization into account
- libipa: exposure_mode_helper: Remove double calculation of lastStageGain
- libipa: exposure_mode_helper: Remove unnecessary clamp calls
- libipa: agc_mean_luminance: Fix constraint logging
- libipa: agc_mean_luminance: Configure the exposure mode helpers
- libipa: exposure_mode_helper: Calculate quantization gain in splitExposure()
- ipa: rkisp1: agc: Add correction for exposure quantization
- ipa: rkisp1: Switch histogram to RGB combined mode
- libipa: agc_mean_luminance: Introduce effectiveYTarget() accessor
- libipa: agc_mean_luminance: Add support for additional constraints
- ipa: rkisp1: Add WDR algorithm
- ipa: Look up IPA configurables in configuration file
- ipa: rpi: agc: Allow exposure mode to be updated in auto mode
- ipa: software_isp: Fix context_.configuration.agc.againMin init
- ipa: software_isp: AGC: Do not lower gain below 1.0
- ipa: software_isp: AGC: Raise exposure or gain not both at the same time
- ipa: software_isp: AGC: Only use integers for exposure calculations
- ipa: simple: blc: Use 16 as starting blacklevel when there is no sensor-info
- ipa: simple: awb: Avoid incorrect arithmetic in AWB
- ipa: simple: awb: Use correct type in std::accumulate
- ipa: simple: blc: Prevent division by zero in BLC
- ipa: simple: agc: Prevent division by zero in AGC
- ipa: rpi: pisp: Add decompand support using PiSP hardware block
- ipa: rpi: Add FE globals as a parameter to applyDecompand()
- ipa: rpi: pisp: Add a DecompandAlgorithm class
- ipa: rpi: pisp: Allow an initial decompand curve to be set on the FE
- ipa: meson.build: Remove duplicated variable
- ipa: rpi: Fix the set function for floating statistics regions
- ipa: rpi: lux: Handle camera mode sensitivity correctly
- ipa: rpi: pisp: Use a floating region to get whole image Y statistics
- ipa: rpi: vc4: Use a floating statistics region for a full image Y sum
- ipa: rpi: lux: Use floating statistics region to obtain the current Y value
- libipa: camera_sensor_helper: Add imx708
- ipa: rpi: vd56g3: Fix frameIntegrationDiff value
- ipa: libipa: agc_mean_luminance: Avoid unnecessary copies
- ipa: rkisp1: dpf: Enable strength after enable Dpf
- libipa: module: Allow algorithms to be disabled via the tuning file
- libipa: exposure_mode_helper: Set quantizationGain in absence of a sensor helper
- ipa: libipa: pwl: Allow to parse a plain yaml value as single point PWL
- ipa: rkisp1: lux: Properly handle frame context and active state
- ipa: libipa: agc_mean_luminance: Change luminance target to piecewise linear function
- ipa: libipa: agc_mean_luminance: Fix yTarget handling in constraints
- ipa: ipu3, mali-c55, rkisp1, rpi: Fix reporting non-scalar controls
tuning:
- utils: raspberrypi: ctt: Update noise/sharpness tuning
- utils: raspberrypi: ctt: Update vc4 tuning defaults
- tuning: rksip1: Add a static Compress entry
- tuning: rksip1: Add a static WideDynamicRange entry
test:
- test: camera: Use Request::ReuseBuffers flag
- test: utils: Add endlines
- test: utils: Validate hex sign extension
- lc-compliance: Ensure stream's colorspace is set after validate()
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
The ControlInfos of non-scalar controls that are reported in controls()
must have non-scalar default values for controls that have a defined
size. This is because applications should be able to directly set the
default value from a ControlInfo to the control.
Currently this is relevant to the following controls:
- ColourGains
- ColourCorrectionMatrix
- FrameDurationLimits
- AfWindows
Fix the scalarness of these controls where relevant.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> # rkisp1
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Array controls (eg. ColourCorrectionMatrix, FrameDurationLimits,
ColourGains) are serialized properly by the ControlSerializer, but are
not deserialized properly. This is because their arrayness and size are
not considered during deserialization.
Fix this by adding arrayness and size to the serialized form of all
ControlValues. This is achieved by fully serializing the min/max/def
ControlValue's metadata associated with each ControlInfo entry in the
ControlInfoMap.
While at it, clean up the serialization format of ControlValues and
ControlLists:
- ControlValue's id is only used by ControlList, so add a new struct for
ControlList entries to contain it, and remove id from ControlValue
- Remove offset from ControlInfo's entry, as it is no longer needed,
since the serialized data of a ControlInfo has now been converted to
simply three serialized ControlValues
- Remove the type from the serialized data of ControlValue, as it is
already in the metadata entry
The issue regarding array controls was not noticed before because the
default value of the ControlInfo of other array controls had been set to
scalar values similar to how min/max are set, and ColourCorrectionMatrix
was the first control to properly define a non-scalar default value.
Bug: https://bugs.libcamera.org/show_bug.cgi?id=285
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> # rkisp1
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
When the dewarper is present it can handle arbitrary orientations
specified in the requested camera configuration. In that case handle all
transformations inside the dewarper (even if the sensor supports some of
them) because that makes it easier to handle coordinates for lens
dewarping inside the dewarper.
This complicates the path selection a bit, as for transformations that
include a transpose, the format before the dewarper has swapped
width/height.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Add a transpose() function to size that applies the
Transformation::Transpose operation in the size. This is useful when
handling orientation adjustments.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
To do actual lens dewarping, the dewarper will be configured based on
the tuning file.
As a first step implement the basic loading of the
tuning file and enable/disable the dewarper for the given camera based
on the existence of the "Dewarp" entry under a new top level element
'modules' in the tuning file.
Note: This is an backwards incompatible change in that the dewarper is
currently included in the chain unconditionally. Some users may want to
not use the dewarper, so it is sensible to make that configurable.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
In raw mode the number of configurations is actively limited to 1. It is
therefore safe to move isRaw up one level to simplify the code and
prepare for later use.
During that rework it was noticed that the old code actually has a bug
in that it reduces the number of configurations to 1 in case a raw
config is found, but it doesn't reduce the config vector to that raw
config, but the first config.
Change that behavior to check the first config and either remove all
remaining configs if the first is raw or drop all raw configs if the
first is non-raw.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
The dewarper integration into the rkisp1 pipeline is quite complicated.
Simplify that by switching to the now available ConverterDW100Module. As
there is no other known converter in combination with the rkisp1 ISP this
is a safe step to do.
This change also paves the way to implement dw100 specific features later.
The input crop implemented in the dw100 kernel driver is quite limited
in that it doesn't allow arbitrary crop rectangles but only scale
factors quantized to the underlying fixed point representation and only
aspect ratio preserving crops.
The vertex map based implementation allows for pixel perfect crops. The
only downside is that ScalerCrop can no longer be set dynamically on
older kernels. A corresponding warning is already implemented in the
converter module.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
The DW100 Dewarp engine is present on i.MX8MP SoC and possibly others.
This patch provides a dedicated converter module that allows easy
integration of such a dewarper into a pipeline handler.
In this patch only the ScalerCrop control is implemented. Support for
additional functionality will be added in later patches.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Using a custom vertex map the dw100 dewarper is capable of doing
complex and useful transformations on the image data. This class
implements a pipeline featuring:
- Arbitrary ScalerCrop
- Full transform support (Flip, 90deg rotations)
- Arbitrary move, scale, rotate
ScalerCrop and Transform is implemented to provide a interface that is
standardized libcamera wide. The rest is implemented on top for more
flexible dw100 specific features.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
When the dewarper is used, an addition buffer loop with
kRkISP1MinBufferCount buffers is created between ISP and dewarper. When
the dewarper is configured, it stores the bufferCount value of the
requested stream configurations. This number of buffers is then imported
when the dewarper is started.
On the input stream of the dewarper the bufferCount is currently left
unchanged, meaning it carries the bufferCount as supplied by the user
instead of the bufferCount of the additional loop. Fix that by setting
the bufferCount to kRkISP1MinBufferCount.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
In order to allow digital zooming, scale down in the dewarper instead of
the resizer. That means forwarding the full sensor size data to the
dewarper. The ScalerCrop rectangle will also be applied at the dewarper.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
The decision if the dewarper shall be used is not per pipeline but per
camera and per configuration (raw streams can't use it). Move the
corresponding flag into the camera data class. Rename the flag to
"usesDewarper" which is easier understand when we later add the ability
to enable/disable the dewarper on a per camera basis which will be
expressed using a "canUseDewarper" flag.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
In case the buffer returned from the ISP was canceled, the upstream
buffer was not correctly marked as canceled. Move the cancel
functionality into an own helper function and correctly cancel the
upstream buffers. Add missing cancellation in case queuing to the
dewarper fails.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
To actually use requests with the m2m device, requests need to be
allocated on the underlying media device. This can only be done if the
media device is opened which means acquiring it. Add a function to check
if the m2m device supports requests by acquiring the media device,
asking it and then releasing it again. Also add a function to allocate
requests that acquires the internal media device and releases it after
allocating the requests.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Add V4L2 request support to the V4L2M2MConverter class. Extend the
functions related to buffer queuing with an optional request parameter
that gets passed to the lower layers.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
The V4L2 requests API provides support to atomically tie controls to a
set of buffers. This is especially common for m2m devices. Such a
request is represented by an fd that is allocated via
MEDIA_IOC_REQUEST_ALLOC and then passed to the various V4L2 functions.
Implement a V4L2Request class to wrap such an fd and add the
corresponding utility functions.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
With the upcoming addition of V4L2 requests support, the converters need
to keep a handle to the corresponding media device.
Prepare for that by changing the constructor parameter from a raw
pointer to a shared pointer.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Adapt the PipelineHandler::acquireMediaDevice() support function to
return a shared pointer instead of the underlying raw pointer.
Propagate this update to all pipeline handlers that use the MediaDevice
and store a std::shared_ptr<MediaDevice> accordingly.
This is required to support media devices that are potentially shared
among multiple pipeline handlers, like a dewarper implemented as v4l2
m2m device.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
The yTarget loading code is broken and works neither for plain values
nor for arrays of values to form a PWL. Fix this by supporting both
cases. If a list is provided in the tuning file construct a PWL,
otherwise construct a single point PWL with the given value.
Fixes: 24247a12c7 ("ipa: libipa: Add AgcMeanLuminance base class")
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
In some situations it is necessary to specify the target brightness
value depending on the overall lux level. Replace the float
relativeLuminanceTraget by a PWL. As the PWL loading code loads a plain
value as single point PWL, backwards compatibility to existing tuning
files is ensured.
While at it, order the class members in reverse xmas tree notation.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
With the upcoming regulation rework the processing order in the IPA is
updated a bit so that process() updates the active state with new
measurements and fills the metadata with the data from the corresponding
frame context. In prepare() all parameters for one frame are tied
together using the most up to date values from active state.
Change the lux algorithm to support that order of events. Also prepare
for cases where stats can be null which can happen with the upcoming
regulation rework.
While at it fix a formatting issue reported by checkstyle and drop a
unnecessary local variable.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
In the tuning files, it is useful to specify some values as PWL that
produces a different output value depending on an input value. For
example it is useful to specify the relativeLuminanceTarget depending on
the lux level, so that the regulation regulates a bit darker in low
light scenes. For simple setups this is not necessary and a single value
is sufficient.
This patch extends the yaml loading code, so that a single point PWL can
also be specified as a plain value. This way the following yaml
expressions are all valid:
yTarget: [ 1000, 0.15, 2000, 0.17 ] # Regular PWL
yTarget: [ 0, 0.17 ] # Single point PWL
yTarget: 0.17 # Same as above
For cases (I'm not aware of any) where a single point Pwl is not allowed
there is no change as that must be checked externally anyways.
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
In commit f077c58e08 ("libipa: exposure_mode_helper: Take
exposure/gain quantization into account") calculation of the
quantization gain was added to ExposureModeHelper::clampGain(). This
works as expected when a sensor helper is configured but the gain is not
reset to 1.0 in case the sensor helper is not configured. This leads to
incorrect gain calculations in ExposureModeHelper::splitExposure() as
that expects the quantization gain to be valid in any case. Fix that by
setting the quantization gain to 1.0 in case no sensor helper is
configured.
Fixes: f077c58e08 ("libipa: exposure_mode_helper: Take exposure/gain quantization into account")
Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/292
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
StreamConfiguration::colorspace is a std::optional<> and if unset by
the user, it should be populated by the pipeline handler after the
CameraConfiguration::validate().
Add a EXPECT_TRUE() check to ensure that each stream in the
CameraConfiguration has a colorspace set.
Signed-off-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Robert Mader <robert.mader@collabora.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Virtual pipeline handler should provide colorSpace in
generateConfiguration() and validate the colorspace in validate().
It is mandatory for a pipeline handler to set the colorspace if it
is unset in the stream configuration, during validate().
For choosing the colorspace for the generated NV12 frames, following
points have been taken into account:
- The transfer function should be Rec.709 for NV12
- The YCbCr encoding has been chosen Rec.709 as it is the most common
than Rec.601/Rec.2020
- Range should be 'Limited' as with the NV12 pixel format.
Hence, the closest colorspace match is ColorSpace::Rec709 which is
set for the virtual pipeline handler.
Signed-off-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Robert Mader <robert.mader@collabora.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Bayer pattern on the sensor can change while configuring it with the
intended capture format. This is due to the transform being applied on
the sensor which supports [v/h]flips.
During configure(), the simple pipeline handler does not detect any
bayer pattern changes that can arise due to the transformations being
applied via SimpleCameraData:setupFormats(). In such cases, the video
node will be configured in-correctly, without realising the bayer
pattern has changed on the sensor, for the given capture format.
This patch detects the bayer pattern change after the sensor has
been configured and retrieves the corresponding V4L2 pixel format
to correctly configure the video node and the input to converter or
Soft-ISP.
Signed-off-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Tested-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
The libcamera project is no longer in 'early' stages of development, and
we do make releases.
Update the Source Code section to reflect this reality and report on the
current expectations of release numbering schemes.
Furthermore update the development mirror as hosted on Freedesktop and
deprecate the LinuxTV mirror, as Freedesktop also hosts our release tar
balls and CI infrastructure.
Reviewed-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
The issue tracker no longer resides at bugs.libcamera.org.
While this URL is still available and redirects to the new tracker,
update the documentation to point to the canonical address.
Reviewed-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>