summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-07-25libcamera v0.3.1v0.3.1Kieran Bingham
The abi-compliance checker reports 100% binary and source compatibility, so this release does not change the SONAME. Binary compatibility: 100% Source compatibility: 100% Total binary compatibility problems: 0, warnings: 0 Total source compatibility problems: 0, warnings: 0 The following commits in this release relate to either a bug fix or improvement to existing commit. - ipa: rpi: Make monoSensor() accessor const - Fixes: 2031e2f29014 ("ipa: rpi: Add accessor function for monoSensor_") - libcamera: dma_buf_allocator: Create memfd with CLOEXEC - Fixes: ea4baaacc325 ("libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf") - libcamera: dma_buf_allocator: Work around lack of memfd_create() in uClibc - Fixes: ea4baaacc325 ("libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf") - libcamera: dma_buf_allocator: Work around lack of file seals in uClibc - Fixes: ea4baaacc325 ("libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf") - test: ipa: rkisp1: utils: Fix floating and fixed point conversion test - Fixes: 9d152e9c66c1 ("ipa: rkisp1: Add a helper to convert floating-point to fixed-point") - ipa: rkisp1: Fix algorithm controls vanish after configure - Fixes: 4c5152843a2a ("ipa: rkisp1: Derive rkisp1::algorithms::Agc from AgcMeanLuminance") - pipeline: rpi: Don't validate configuration in generateConfiguration() - Bug: https://github.com/raspberrypi/libcamera/issues/138 - ipa: rkisp1: agc: Fix initialization without metering modes - Fixes: 35233938ee5d ("ipa: rkisp1: agc: Read histogram weights from tuning file") - v4l2: v4l2_compat: Fix redirect from `__open(at)64_2()` - Fixes: 1023107b6405 ("v4l2: v4l2_compat: Intercept open64, openat64, and mmap64") - ipa: rkisp1: blc: Drop [[maybe_unused]] attribute - Fixes: 50c28e135100 ("ipa: rkisp1: blc: Query black levels from camera sensor helper") - ipa: rkisp1: ccm: Fix ccm metadata output - Fixes: cbfdfa42cacc ("ipa: rkisp1: algorithms: Add crosstalk algorithm") - gstreamer: pool: Replace GstAtomicQueue with deque and mutex - Bug: https://bugs.libcamera.org/show_bug.cgi?id=201 - gstreamer: allocator: Ensure camera manager stay alive - Bug: https://bugs.libcamera.org/show_bug.cgi?id=211 And the following updates have been made in this release, grouped by category: core: - treewide: Query list of cameras just once - libcamera: yaml_parser: Avoid double lookup in `operator[]` - utils: checkstyle.py: Refactor IncludeChecker - utils: checkstyle.py: Extend IncludeChecker to cover math.h - utils: checkstyle.py: Add a check for hex values - utils: checkstyle.py: Show location of coding style issue within line - update-kernel-headers: Add linux/udmabuf.h to headers to sync - include: linux: Update kernel headers to version v6.10-rc1 - libcamera: v4l2_subdevice: Update to the new kernel routing API - libcamera: Rename DmaHeap class to DmaBufAllocator - libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf - libcamera: dma_buf_allocator: Create memfd with CLOEXEC - libcamera: dma_buf_allocator: Work around lack of memfd_create() in uClibc - libcamera: dma_buf_allocator: Work around lack of file seals in uClibc - libcamera: Add gamma control id - clang-format: Make Qt includes matching case sensitive - meson: Group libipa and libipa_includes in a dependency object - libcamera: controls: Add missing period at end of Gamma description - libcamera: yaml_parser: Make default value templated in `get()` - libcamera: yaml_parser: Drop std::enable_if_t guards for get() function - libcamera: yaml_parser: Delegate YamlObject::get() to helper structure - libcamera: yaml_parser: Add support for float types - libcamera: base: log: Declare log categories when defining them - meson: Enable warnings to flag missing declarations - libcamera: Fix maybe-uninitialized error - converter: converter_v4l2_m2m: Rectify streams sanity check - converter: converter_v4l2_m2m: Rename private Stream class - libcamera: converter: Replace usage of stream index by Stream pointer - libcamera: base: utils: Implement hex() for 8-bit and 16-bit values - libcamera: v4l2_videodevice: Use bufferType_ in [get|try|set]Format() - utils: gen-version: Use posix compliant date ----------------------------------------------------------------------------- ipa: - ipa: rpi: Make monoSensor() accessor const - ipa: rkisp1: Add a helper to convert floating-point to fixed-point - ipa: rpi: Disable StatsOutputEnable control by default - ipa: rkisp1: Fix algorithm controls vanish after configure - ipa: rkisp1: Add GammaOutCorrection algorithm - ipa: libipa: Add Vector class - ipa: libipa: Copy pwl from rpi, and clean it up to match libcamera - ipa: rpi: controller: Use libipa's Pwl class - ipa: rkisp1: goc: Fix typographical issues in documentation. - ipa: rkisp1: goc: Drop incorrect [[maybe_unused]] - ipa: rkisp1: goc: Use copydoc - ipa: rkisp1: goc: Mark default gamma table as static constexpr - ipa: rkisp1: goc: Avoid use of auto for short type - libcamera: libipa: camera_sensor: Define AR0521 helper functions inline - ipa: rkisp1: cproc: Use anonymous namespace to limit symbol visibility - ipa: rkisp1: cproc: Merge identical functions - ipa: rkisp1: cproc: Drop incorrect [[maybe_unused]] - ipa: rkisp1: agc: Read histogram weights from tuning file - ipa: rkisp1: agc: Plumb mode-selection and frame duration controls - ipa: libipa: vector: Specialize YamlObject getter - ipa: libipa: vector: Drop readYaml() function - ipa: libipa: pwl: Suffix \param with direction - ipa: libipa: pwl: Make the empty() function inline - ipa: libipa: pwl: Add a size() function - ipa: libipa: pwl: Add a constructor that moves a Point vector - ipa: libipa: pwl: Specialize YamlObject getter - ipa: libipa: Add Matrix class - ipa: libipa: Add MatrixInterpolator class - ipa: rkisp1: algorithms: Add crosstalk algorithm - ipa: libipa: vector: Add matrix-vector multiplication - ipa: rkisp1: agc: Fix initialization without metering modes - ipa: libipa: agc_mean_luminance: Fix enumerator names - ipa: libipa: agc_mean_luminance: Include missing header - ipa: rkisp1: Document all AGC parameters in IPAActiveState - ipa: rkisp1: Document all AGC parameters in IPAFrameContext - ipa: rkisp1: agc: Make size argument to computeHistogramPredivider const - ipa: rkisp1: agc: Don't update histogram parameters unnecessarily - ipa: rkisp1: agc: Simplify predivider calculation - ipa: rkisp1: agc: Use mode from frame context to calculate new EV - ipa: rkisp1: agc: Rename maxShutterSpeed to maxFrameDuration - ipa: rkisp1: agc: Correctly clamp maximum shutter speed - ipa: rkisp1: agc: Move AeEnable control to the AGC algorithm - ipa: rpi: controller: Replace Pwl::readYaml() with YamlObject::get() - ipa: libipa: pwl: Drop readYaml() function - ipa: rkisp1: agc: Rename frame context update variable to updateMetering - ipa: libipa: matrix: Fix incorrect symbol namespace - ipa: ipa_interface: Declare ipaCreate() in libcamera namespace - ipa: rpi: Define local functions in anonymous namespace - ipa: libipa: Add black levels to camera sensor helper - ipa: rkisp1: Move camHelper into IPAContext - ipa: rkisp1: blc: Query black levels from camera sensor helper - ipa: rkisp1: blc: Report sensor black levels in metadata - ipa: rkisp1: data: Update tuning files for imx219 and imx258 - ipa: rkisp1: Move ov4689 and ov5640 black levels into sensor helpers - ipa: rkisp1: blc: Drop [[maybe_unused]] attribute - ipa: rkisp1: Install all tuning files - libipa: camera_sensor_helper: Add OV5675 black level - ipa: rkisp1: awb: Clamp gains to machine limits - ipa: rkisp1: awb: Unconditionally fill metadata - ipa: rkisp1: ccm: Fix ccm metadata output - ipa: rkisp1: ccm: Ensure metadata contains valid ccm - libcamera: libipa: camera_sensor: Add onsemi AR0144 sensor properties - ipa rkisp1: Remove temperatureK from FrameContext ----------------------------------------------------------------------------- apps: - android: camera_capabilities: Fix GCC 14 warning - v4l2: v4l2_compat: Fix redirect from `__open(at)64_2()` - v4l2: v4l2_compat: Move `open*()` flag check into function - py: libcamera: Move function declarations to common header - v4l2: v4l2_compat: Include missing headers - v4l2: v4l2_compat: Selectively disable -Wmissing-declarations - apps: Define local functions in anonymous namespace - apps: common: dng_writer: Workaround for "Unknown tag 33421" error - apps: common: dng_writer: Support RAW16 formats - apps: common: dng_writer: Rename packing functions - apps: common: dng_writer: Add thumbnail scanline function for Raw - apps: common: dng_writer: Support RAW10 and RAW12 format - apps: common: dng_writer: Fix thumbnail generation on BE machines - apps: common: dng_writer: Fix RAW10 and RAW12 packing on BE machines - qcam: viewfinder_qt: Maintain aspect ratio - apps: qcam: Port to Qt 6 - gstreamer: pool: Replace GstAtomicQueue with deque and mutex - gstreamer: allocator: Ensure camera manager stay alive - v4l2: v4l2_compat: Fix ioctl() prototype with musl C library - gst: Add child proxy support to libcamerasrc - gst: Document libcamerasrc multi stream usage ----------------------------------------------------------------------------- test: - test: ipa: rkisp1-utils: Fix capitalization of hex numbers - test: camera: Increase timeout for vimc capture tests - test: fence: Turn class member variable into local variable - test: fence: Fix race condition - test: fence: Increase timeout for fence test - test: v4l2_videodevice: Increase timeout for vimc capture tests - test: ipa: rkisp1-utils: Fix coding style for template arguments - test: ipa: rkisp1: utils: Fix floating and fixed point conversion test - test: ipc: unixsocket: Define local function in anonymous namespace - test: gstreamer: Include missing sanitizer/asan_interface.h header - test: utils: Extend utils::hex() test to 8-bit and 16-bit values - test: gstreamer: Test memory lifetime ----------------------------------------------------------------------------- pipeline: - libcamera: software_isp: Use a specific integer type for black level - libcamera: software_isp: Honor black level in AWB - libcamera: software_isp: Move color mappings out of debayering - libcamera: software_isp: Remove DebayerParams::kGain10 - libcamera: software_isp: Remove TODO about internal representation - pipeline: vimc: Don't hardcode scaling factor with recent kernels - libcamera: software_isp: Allow using dma-buffers from /dev/udmabuf - libcamera: software_isp: Fix includes ordering in simple.cpp - pipeline: rkisp1: cproc: Fix default value handling - pipeline: rpi: Don't validate configuration in generateConfiguration() - libcamera: debayer_cpu: Add 32bits/aligned output formats - libcamera: software_isp: Drop unnecessary sanity check - libcamera: pipeline: simple: Enable intel-ipu6 with Soft ISP - libcamera: pipeline: simple: Enable Soft ISP for TI CSI-RX ----------------------------------------------------------------------------- tuning: - utils: raspberrypi: ctt: Adapt tuning tool for both VC4 and PiSP - utils: raspberrypi: ctt: Added CAC support to the CTT - utils: raspberrypi: ctt: Changed CTT handling of VC4 and PiSP - utils: raspberrypi: ctt: Update tuning tool for HDR - utils: raspberrypi: ctt: Add option to convert between vc4/pisp targets - utils: raspberrypi: ctt: Add a maximum gain parameter for LSC - utils: libtuning: modules: Add skeletal AGC module - utils: tuning: rkisp1: Add skeletal AGC to the rkisp1 tuning script - utils: libtuning: Correct GBRG Image parsing - libtuning: Backport improvements in MacBeth search reliability - libtuning: Fix reference image - libtuning: Copy files from raspberrypi - libtuning: Copy visualize_macbeth_chart from raspberry pi - utils: tuning: Add requirements file and update readme - libtuning: Fix imports - libtuning: Migrate prints to python logging framework - libtuning: Fix visualize_macbeth_chart() - libtuning: Improve filename parsing - libtuning: Implement a minimal yaml parser - libtuning: Reactivate macbeth locator - libtuning: Be a bit more verbose - libtuning: lsc: rkisp1: Clip lsc values to valid range - libtuning: Use the color member of the Image class - libtuning: Remove need for Cam object from ccm - libtuning: modules: Add initial CCM module - libtuning: Handle cases, where no lsc tuning images are present - libtuning: Only warn if processing returns None - libtuning: Add static module - tuning: rkisp1: Add some static modules - libtuning: lsc: rkisp1: Do not calculate ratios to green - libtuning: lsc: Prevent negative values - libtuning: agc: rkisp1: Increase y-target Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25gst: Document libcamerasrc multi stream usageNicolas Dufresne
This adds documentation and an example using gst-launch-1.0. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25gst: Add child proxy support to libcamerasrcNicolas Dufresne
The child proxy interface is needed in order to allow setting properties on pad using parse launch syntax. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25libcamera: libipa: camera_sensor: Add onsemi AR0144 sensor propertiesLaurent Pinchart
Provide the onsemi AR0144 camera sensor properties and registration with libipa for the gain code helpers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25v4l2: v4l2_compat: Fix ioctl() prototype with musl C libraryLaurent Pinchart
The musl C library, as well as the POSIX standard, define the ioctl() function's request argument as an int. glibc and uclibc, on the other hand, define it as an unsigned long. This difference between the function prototype and the implementation in the V4L2 adaptation layer causes a compilation error with musl. Fix it by detecting the function prototype and declaring the libcamera ioctl() handler accordingly. 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> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25gstreamer: allocator: Ensure camera manager stay aliveNicolas Dufresne
Without the camera manager, it is not possible to cleanly delete the FrameBufferAllocator object. Keep the camera manager alive until all the memory object have been released. A shared_ptr to the CameraManager is introduced which is itself stored as a plain pointer and allocated and released explicitly. When more than one C++ member is required, this can be refactored to use a new C++ class, but the struct _GstLibcameraAllocator is allocated and freed by glib, so it does not have automatic destruction presently. Bug: https://bugs.libcamera.org/show_bug.cgi?id=211 [Kieran: Update test framework to remove expected test fail] Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25test: gstreamer: Test memory lifetimeNicolas Dufresne
Test that everything works fine if a buffer outlives the pipeline. [Kieran: Update test path with comments and clarify test case] Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25utils: gen-version: Use posix compliant dateZach DeCook
The version string of libcamera is presently appended with a date/time argument in the case of a dirty tree to show further detail of when it was built. This string is generated with the iso-8601 parameter to 'date' and produces a date string in the form: "2024-06-17T22:15:30+01:00" Strict posix shells or implementations of 'date' which may be optimised for size such as the one provided by busybox or Alpine Linux may not support the '--iso-8601' flag. To support builds on those platforms, use a direct POSIX-compliant date-format string instead matching as closely as possible to the iso-8601 definition. An exact match is not possible with those restrictions so 'date %Y-%m-%dT%H:%M:%S%Z' is used which produces 2024-06-17T22:15:30BST. The use of the human readable timezone identifier provides a friendlier output for the string than a timezone offset at the expense of being less sortable in the exceptionally low risk and unlikely event of two custom builds being compared at the same time of different timezones. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Zach DeCook <zachdecook@librem.one> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25gstreamer: pool: Replace GstAtomicQueue with deque and mutexNicolas Dufresne
The GstAtomicQueue only supports 2 threads, one pushing, and one popping. We pop and push on error cases and we may have multiple threads downstream returning buffer (using tee), which breaks this assumption. On top of which, the release function, that notifies when the queue goes from empty to not-empty relies on a racy empty check. The downstream thread that does this check is effectively concurrent with our thread calling acquire(). Fix this by replacing the GstAtomicQueue with a std::deque, and protect access to that using the object lock. Bug: https://bugs.libcamera.org/show_bug.cgi?id=201 Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24ipa: rkisp1: ccm: Ensure metadata contains valid ccmStefan Klug
When the colour temperature does not change between frames, the ccm inside the frame context is not updated and the metadata contains invalid data. Fix that by caching the ccm inside the active state. 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: Paul Elder <paul.elder@ideasonboard.com> [Kieran: Remove spurious [[maybe_unused]] addition] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24ipa: rkisp1: ccm: Fix ccm metadata outputStefan Klug
Only the first three entries of the matrix were set. Fix that. Fixes: cbfdfa42cacc ("ipa: rkisp1: algorithms: Add crosstalk algorithm") 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: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24ipa: rkisp1: awb: Unconditionally fill metadataStefan Klug
When the colour temperature estimation gets skipped, the metadata isn't populated. Fix that by filling the metadata early in the function. 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: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24ipa rkisp1: Remove temperatureK from FrameContextStefan Klug
The frame context is used to store data used for processing that frame. It is later used to either act as input for other algorithms or to fill the metadata. For the colour temperature this is not needed, as the meatadata shall not contain the value that was active when the image was processed, but the value that was calculated based on the statistics for that image. This is no functional change. 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: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24ipa: rkisp1: awb: Clamp gains to machine limitsStefan Klug
When the color gains are set manually it is possible to specify a gain that wrapped the hardware limits. It would also be possible to further tune the floating point limits, but that is an error prone approach. So the limits are imposed on the integers, just before writing to the hardware. This noticeably reduces some oscillations in the awb regulation. 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: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24libipa: camera_sensor_helper: Add OV5675 black levelDaniel Semkowicz
Add black level value for OV5675 camera sensor. According to datasheet, default value is 0x10, 10 bits width. However, Linux kernel driver initializes black level target value to 0x40. Set the value to the same as in kernel driver, but scaled to 16 bits. Signed-off-by: Daniel Semkowicz <dse@thaumatec.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-24apps: qcam: Port to Qt 6Neal Gompa
Open source Qt 5 has been effectively end of life since the release of Qt 6, and Qt 6 has current LTS releases now. This change ports qcam to Qt 6.2 and drops some of the baggage related to Qt 5 that is no longer applicable. Signed-off-by: Neal Gompa <neal@gompa.dev> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-22libcamera: pipeline: simple: Enable Soft ISP for TI CSI-RXJai Luthra
The j721e-csi2rx driver pipeline uses no converters, so enable the software ISP plugin support. This is handy for boards with AM62 SoC (like BeaglePlay) that have no HW ISP. Tested with IMX519 on SK-AM62 running a kernel built with dmabuf heap support. Signed-off-by: Jai Luthra <j-luthra@ti.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Milan Zamazal <mzamazal@redhat.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>
2024-07-21libcamera: v4l2_videodevice: Use bufferType_ in [get|try|set]Format()Hans de Goede
V4L2VideoDevice is using the caps to determine which kind of buffers to use with the video-device in 2 different cases: 1. V4L2VideoDevice::open() 2. V4L2VideoDevice::[get|try|set]Format() And the order in which the caps are checked is different between these 2 cases. This is a problem for /dev/video# nodes which support both video-capture and metadata buffers. open() sets bufferType_ to V4L2_BUF_TYPE_VIDEO_CAPTURE[_MPLANE] in this case, where as [get|try|set]Format() will call [get|set]FormatMeta() which does not work with V4L2_BUF_TYPE_VIDEO_CAPTURE[_MPLANE] buffers. Switch [get|try|set]Format() to use the bufferType_ to determine on what sort of buffers they should be operating, leaving the V4L2VideoDevice code with only a single place where the decision is made what sort of buffers it should operate on for a specific /dev/video# node. This will also allow to modify open() in the future to take a bufferType argument to allow overriding the default bufferType it selects for /dev/video# nodes which are capable of supporting more then 1 buffer type. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-08qcam: viewfinder_qt: Maintain aspect ratioKieran Bingham
Keep the image aspect ratio when displaying in the viewfinder. When the window is adjusted to a size that differs in aspect ratio to the image, keep the image centered in the main window. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-06ipa: rkisp1: Install all tuning filesRobert Mader
We have all these neat tuning files. Unfortunately we forgot to install many of them. Signed-off-by: Robert Mader <robert.mader@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-05libtuning: agc: rkisp1: Increase y-targetStefan Klug
With the addition of gamma out correction the relative luminance target was set too low. As brightness is a bit subjective it is difficult to come up with the "correct" value. With 0.5 the patch 22 on the macbeth chart (neutral grey, 18% reflectance) ended up a bit below 50% grey, which seems reasonable. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05libtuning: lsc: Prevent negative valuesStefan Klug
In cases where the calibration image contains super dark areas, or when an invalid blacklevel was supplied, the grid might get close to zero or negative. This would have bad effects on the 1/grid later. So clamp the values to a small positive number. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05libtuning: lsc: rkisp1: Do not calculate ratios to greenStefan Klug
The current LSC algorithm for the rkisp1 just forwards the LSC tables to the hardware, so absolute factors are needed and not ratios compared to green. Therefore every channel needs to be calculated independently. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05tuning: rkisp1: Add some static modulesStefan Klug
Add awb, blc, cproc, filter, and gamma to the tuning file. These don't need any configuration. At the moment there are no inter-module dependencies in the tuning process. We can therefore safely sort them alphabetically. As soon as the first dependency gets introduced (most likely lsc -> ccm) we will see how to solve that. The output order controls the order of processing in the IPA. It is now also in alphabetical order which happens to be no change for the modules that existed previously. For the others, there is no need for a specific order. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-07-05libtuning: Add static moduleStefan Klug
Add a static module class, that can be used to add static data to the tuning file. This is propably not the best solution, but allows us to progress without writing lots of dummy classes for static cases. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05libtuning: Only warn if processing returns NoneStefan Klug
There are valid cases where a module returns None. E.g. no images were provided for LSC calibration. We should however define proper semantics there. Continue with a warning for now. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05libtuning: Handle cases, where no lsc tuning images are presentStefan Klug
Make it clear that no lsc calibration was done by returning None instead of a incomplete configuration. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05libtuning: modules: Add initial CCM modulePaul Elder
Implement a minimal ccm calibration module. For now it doesn't take the results from lsc into account and supports rkisp1 only. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-07-05libtuning: Remove need for Cam object from ccmStefan Klug
Remove the need for the Cam object, as we don't want to port it from Raspberry Pi. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05libtuning: Use the color member of the Image classStefan Klug
In the Image class the variable holding the color temperature is named color instead of col which was used by the raspberry pi scripts. Rename accordingly. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05libtuning: lsc: rkisp1: Clip lsc values to valid rangeStefan Klug
Based on the input images, the lsc values could exceed the range allowed by the rkisp1. As we are now clipping the values, we can simplify the value mapping. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05libtuning: Be a bit more verboseStefan Klug
Print a info on every image that gets processed and a warning on every image that gets ignored. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-07-05libtuning: Reactivate macbeth locatorStefan Klug
Add the missing pieces and store the result inside the image object. This solution is not very nice, and should be refactored soon. For that we need a concept to collect temperature and/or image specific results in a central place. For now it serves the purpose. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05libtuning: Implement a minimal yaml parserStefan Klug
At the moment this just reads the yaml file and returns it verbatim. This needs to evolve further in the near future. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-05libtuning: Improve filename parsingStefan Klug
In the tuning datasets, the files had names like 'imx335_1600l_3000k_1.dng'. That failed on the old filename parsing function. As there is no need to dictate the order of the tags, split the big regex into chunks and parse them one by one. This also makes the code easier to digest. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-05libtuning: Fix visualize_macbeth_chart()Stefan Klug
The old function uses PIL to save the image, which is not in the requirements file. As we are already requiring opencv, use that to save images instead of an additional dependency Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-05libtuning: Migrate prints to python logging frameworkStefan Klug
In ctt_ccm.py the logging functionality of the Cam object was used. As we don't want to port over that class, it needs to be replaced anyways. While at it, also replace the eprint function as it doesn't add any value over the logging framework and misses the ability for easy log formatting. For nice output formatting add the coloredlogs library. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-07-05libtuning: Fix importsStefan Klug
Fix imports to match new structure in the files copied from Raspberry Pi. Add missing imports in macbeth.py. Add missing dependencies to requirements.txt. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-07-05utils: tuning: Add requirements file and update readmeStefan Klug
Add a requirements file to ease the installation and use of the tuning scripts. Document that in the readme. No debian packages are provided as rawpy is not packaged as deb. So pip has to be used anyways. Also add pyyaml which was missing in the dependencies. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05libtuning: Copy visualize_macbeth_chart from raspberry piStefan Klug
Copy visualize_macbeth_chart from raspberry pi. It is copied verbatim and does not work in this state. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-05libtuning: Copy files from raspberrypiStefan Klug
Copy ctt_{awb,ccm,colors,ransac} from the raspberrypi tuning scripts as basis for the libcamera implementation. color.py was renamed to ctt_colors.py to better express the origin. The files were taken from commit 66479605baca ("utils: raspberrypi: ctt: Improve the Macbeth Chart search reliability"). Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-05libtuning: Fix reference imageStefan Klug
Opencv fails to load the image. The added license destroys the magic number. Fix, by moving the licence below the magic number. 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> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-05libtuning: Backport improvements in MacBeth search reliabilityStefan Klug
Port commit 66479605baca ("utils: raspberrypi: ctt: Improve the Macbeth Chart search reliability") into libtuning. Previously the code would brighten up images in case the Macbeth Chart is slightly dark, and also zoom in on sections of it to look for charts occupying less of the field of view. But it would not do both together. This change makes the search for smaller charts also repeat that search for the brightened up images that it made earlier, thereby increasing the chances of success for non-optimal tuning images. 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> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-04test: utils: Extend utils::hex() test to 8-bit and 16-bit valuesLaurent Pinchart
Now that the utils::hex() function supports 8-bit and 16-bit integers, extend the unit test to cover them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-07-04libcamera: base: utils: Implement hex() for 8-bit and 16-bit valuesLaurent Pinchart
The utils::hex() function is implemented for 32-bit and 64-bit integers, but not for 8-bit and 16-bit. This causes a link error (possibly at runtime for IPA modules due to lazy linking) when trying to print 8-bit or 16-bit integers. Implement additional specializations to fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-07-04ipa: rkisp1: blc: Drop [[maybe_unused]] attributeLaurent Pinchart
The context parameter of the BlackLevelCorrection::init() function is used. Drop the [[maybe_unused]] attribute. Fixes: 50c28e135100 ("ipa: rkisp1: blc: Query black levels from camera sensor helper") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-07-04libcamera: pipeline: simple: Enable intel-ipu6 with Soft ISPDennis Bonke
Enable the simple pipeline handler with software ISP for the IPU6 now that the IPU6 CSI2 receiver (aka the isys driver) has landed in media_staging/master. Signed-off-by: Dennis Bonke <admin@dennisbonke.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-07-03ipa: rkisp1: Move ov4689 and ov5640 black levels into sensor helpersStefan Klug
Move black levels for tuning files that contained a BLC block into the camera sensor helpers. ov4689.yaml had 66@12bit while the datasheet states 64@12bit. Use the value from the datasheet (scaled to 16bit). ov5640.yaml had 256@12bit while the datasheet states 16@10bit. Looking at the commit message the 256 most likely stems from the imx219 tuning file and 16@10bit is the same as the 64@12bit from the ov4689. This seems more likely and is therefore used. 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>
2024-07-03ipa: rkisp1: data: Update tuning files for imx219 and imx258Stefan Klug
The black levels for imx219 and imx258 are now contained in the camera sensor helpers. Remove them from the tuning file for the imx219. Add a BLC entry to the imx258 tuning file. 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>
2024-07-03ipa: rkisp1: blc: Report sensor black levels in metadataStefan Klug
Add sensor black levels to the metadata of the rkisp1 pipeline. Additionally enable raw support for this algorithm and add it to uncalibrated.yaml, so that black levels get reported when capturing tuning images. This is a bit of a hack, because no actual black level correction is taking place in raw mode, but it is the easiest way to get blacklevel reported for raw streams. 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> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>