Commit Graph

6096 Commits

Author SHA1 Message Date
Barnabás Pőcze
02277d4c1a ipa: simple: Fix again10 value with sensor helper
`CameraSensorHelper::gain(uint32_t)` maps a gain code to the actual floating
point gain value. Calling it with `1.0` as the argument will simply get
the real gain for gain code 1. This is most likely not what was intended.

For example, in the case of the `ov2740` sensor, `againMin` is 1, but the
calculated `again10` (1 / 128 ~ 0.078) ends up being < 1, meaning that the
agc algorithm will never lower the exposure.

Fix that by using the maximum of the minimum gain and 1 as `again10`.

Fixes: 950ca85e8a ("ipa: software_isp: AGC: Do not lower gain below 1.0")
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
2026-03-10 08:56:47 +01:00
Barnabás Pőcze
20ea9ae1e5 py: Fix include order
Python.h hence the pybind header must be included first since pyconfig.h
unconditionally overrides certain feature test macros[0]. This was mostly
hidden by the fact that macro redefinitions with the same value do not
trigger compiler warnings. However, glibc 43 has changed certain defaults[1],
causing mismatches, leading to compiler warnings.

So change the include order so that `<pybind11/...>` headers are included
first and then the local `"py_..."` headers, and then everything else. Also
remove some redundant includes.

Adjust `.clang-format` and the documentation as well.

[0]: https://docs.python.org/3/c-api/intro.html#include-files
[1]: https://sourceware.org/git/?p=glibc.git;a=commit;h=a5cc3018f31a125f019685b239c6e5a0bf1a272b

Link: https://github.com/python/cpython/issues/61322
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2026-03-06 18:24:56 +01:00
Naushir Patuck
14ba4d1680 ipa: rpi: awb_nn: Remove unused constexpr variable
The kDefaultCT variable is unused, remove it.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-03-02 12:27:18 +00:00
Milan Zamazal
0d3e543b4d libcamera: software_isp: Set initial values of DebayerParams
Debayer parameters and processing are currently run asynchronously.
This can lead to assertion errors in case the processing tries to use
not yet computed debayer parameters.  To prevent this situation, specify
some default values for DebayerParams members.  This doesn't make
correct parameters but prevents crashes or other crazy behaviours at
least.

Note this patch is just a workaround.  The mutually asynchronous
parameters computation and processing can cause more problems, like
using parameters computed for a different frame.  But it is non-trivial
to fix that; in the meantime, setting the default values solves the
worst problem.

Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/311
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-26 16:37:41 +00:00
David Plowman
cc74afcdbd libcamera: rpi: Make the controller min frame duration configurable
The controller min frame duration is used to rate limit how often we
run IPAs. Historically this has been set to 33333us, meaning that the
algorithms effectively skip frames when the camera is running faster
than 30fps.

This patch adds a small amount of plumbing that allows this value to
be set in the Raspberry Pi configuration file. Some applications or
platforms (such as Pi 5) are easily capable of running these more
often, should there be a need to do so.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-26 10:17:36 +00:00
Barnabás Pőcze
71c5c08fcf libcamera: software_isp: debayer_egl: Remove frameSize()
The base class (`Debayer`) already contains a non-virtual function with
the same name and implementation, so remove it from the derived class.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2026-02-24 18:01:30 +01:00
Barnabás Pőcze
6db2a7ab43 py: Disable -Winvalid-offsetof
A "small vector" implementation has been introduced in the latest version of
pybind11 (3.0.2), which might use `offsetof()` on a non standard layout type.
This triggers the `invalid-offsetof` warning.

So disable it for the python bindings.

Link: https://github.com/pybind/pybind11/pull/5824
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-24 10:06:51 +01:00
Laurent Pinchart
993968d80e libcamera: Standardize on 'const auto'
'const auto' and 'auto const' are interchangeable in C++. There are 446
occurrences of the former in the code base, and 67 occurrences of the
latter. Standardize on the winner.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-02-20 13:34:30 +01:00
Laurent Pinchart
5a44c5af06 libcamera: Use it variable name for iterators only
Using the name `it` for a variable that is not an iterator is confusing.
Give the variable a more explanatory name.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-02-20 13:34:28 +01:00
Laurent Pinchart
a736fe8531 libcamera: Replace iterators with range-based for loops
Use range-based for loops instead of iterators when iterating over a
container. This improves readability.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-02-20 13:34:26 +01:00
Laurent Pinchart
be88125af1 libcamera: Replace iterators with structured bindings
Use structured bindings when iterating over a map in range-based for
loops. This improves readability.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-02-20 13:34:21 +01:00
Laurent Pinchart
59be23f34e android: camera_stream: Include <poll.h> instead of <sys/poll.h>
The standard C library header for the poll() API is poll.h, not
sys/poll.h. The musl C library warns about this:

In file included from src/android/camera_stream.cpp:13:
host/i586-buildroot-linux-musl/sysroot/usr/include/sys/poll.h:1:2: error: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Werror=cpp]
    1 | #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
      |  ^~~~~~~

Fix it by including the correct header.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-02-20 13:34:19 +01:00
Kieran Bingham
8064c4f33a ipa: libipa: fixedpoint: Move float conversion inline
With all users of the floatingToFixedPoint and fixedToFloatingPoint
calls converted to use the FixedPoint Quantized types, remove the calls
and documentation and move the implementation inline in the
FixedPointTraits implementation.

Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
f05aab5aca test: libipa: Remove legacy fixed point conversion test
Now that the fixed point conversions are equally covered by the new Q types,
the legacy tests for fixedToFloatingPoint and floatingToFixedPoint are
redundant.

Remove them, and replace the existing test cases with equivalant tests
using the new Q4.7 type directly to maintain identical test coverage.

Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
8896ca13f1 ipa: mali-c55: agc: Quantise the ISP Digital Gain
The Mali-C55 ISP has a digital gain block which allows setting gain in Q5.8
format, a range of 0.0 to (very nearly) 32.0.

Convert usage to the new UQ<5, 8> FixedPoint Quantised type which will
support the conversion, clamping and quantisation so that the metadata
and debug prints can now report the effective gain applied instead of
the potentially inaccurate float.

Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
3d4e0446af ipa: mali-c55: Convert AWB to UQ<4, 8> usage
Utilise the new FixedPoint type to explicitly calculate gains for AWB in Q4.8
format. This ensures that reporting of gains in metadata reflect the true
AWB gains applied.

Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
6b5ecd96ff ipa: mali-c55: Reduce AWB calculations to float precision
The AWB calculations are determined using double precision, and then
will be soon stored in a quantized float.

Use float types for the intermediate types after the sums have been
converted to an average to remove static cast assignments.

Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
4116467710 ipa: rkisp1: ccm: Use Q<4, 7> format directly
Replace the legacy call to floatingToFixedPoint with the new FixedPoint
quantizer to explicitly describe the type used by the RKISP1 Colour
Correction Matrix.

Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
6c181ac5a7 ipa: rkisp1: cproc: Provide a Hue control
The RKISP1 supports a configurable Hue as part of the colour processing
unit (cproc).

Implement the new control converting to the hardware scale accordingly
and report the applied control in the completed request metadata.

This is implemented as a phase shift of the chrominance values between
-90 and +87.188 degrees according to the datasheet however the type
itself would imply that this is a range between -90 and 89.2969.

Moreover, the hardware applies the inverse phase shift to the operation
expected and documented by libcamera, so we apply a negative scale when
converting the libcamera control to the Q<1,7> type, resulting in a
range of -89.2969 to +90.0 degrees control.

Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
van Veen, Stephan
da967ed63d libcamera: controls: Define a new core Hue control
Define a new control to support configuration of Hue adjustments when
supported by the available platform.

Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Signed-off-by: van Veen, Stephan <stephan.vanveen@karlstorz.com>
[Kieran: Rework to define as a rotation in degrees]
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
52cc91f3f1 ipa: rkisp1: cproc: Report metadata
Presently the colour processing component exposes controls for
brightness, saturation, and contrast to the applications which are
handled and processed accordingly on the ISP.

The implementation lacks reporting the values that are set back to the
application.

Utilise the new Quantised types to provide the values that were applied
to the hardware and report them in the completed request metadata.

Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
9d1b2b3ba8 ipa: rkisp1: cproc: Convert to use Quantized types
Convert the Brightness, Contrast and Saturation helper functions to a
Quantizer type to support maintaining the data.

While modifying the include blocks of the ipa_context.h, also fix the
include style for libipa components.

Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
4527dcad1e test: libipa: Provide FixedPoint Quantized tests
Provide tests to validate the conditions of FixedPoint types used
within libcamera explicitly.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
5b4c0c5b8b ipa: libipa: Provide fixed point quantized traits
Extend the new Quantized type infrastructure by providing a
FixedPointQTraits template.

This allows construction of fixed point types with a Quantized storage
that allows easy reading of both the underlying quantized type value and
a floating point representation of that same value.

Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
cd3149a7fa ipa: libipa: fixedpoint: Fix unsigned usage
The fixedToFloatingPoint does not support unsigned Q types, and
incorrectly sign-extends all values which have the top most bit set in
the quantized values.

Fix this by ensuring that only signed types perform sign extension, and
simplify the calculation for unsigned types.

Convert the storage of the test cases to signed types to correctly
represent their intended purpose, to prevent test failures.

Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
cb40945db6 test: libipa: Add tests for Quantized types
Provide use case tests for the Quantized types to ensure construction
and usages are consistent and work as expected.

Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
be64005a8e ipa: libipa: Provide a Quantized data type support
Frequently when handling data in IPA components we must convert and
store user interface values which may be floating point values, and
perform a specific operation or conversion to quantize this to a
hardware value.

This value may be to a fixed point type, or more custom code mappings,
but in either case it is important to contain both the required hardware
value, with its effective quantized value.

Provide a new storage type 'Quantized' which can be defined based on a
set of type specific Traits to perform the conversions between floats
and the underlying hardware type.

Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-19 15:06:21 +00:00
Kieran Bingham
da12b1854f libcamera: software_isp: Fix LIBCAMERA_SOFTISP_MODE log print
When an invalid parameter is specified to LIBCAMERA_SOFTISP_MODE, the
error log has a typo. Fix the typo and reflow the line while here.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-18 16:48:56 +00:00
Kieran Bingham
a1d272d7f1 ipa: simple: Remove duplicate header inclusion
The Awb component already references libcamera/control_ids.h. Remove
the incorrect duplicate inclusion of "control_ids.h".

Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-18 16:48:56 +00:00
Kieran Bingham
dcfe6afb49 ipa: rkisp1: Fix awb algorithm brief
The Awb brief was not updated from when the Bayes AWB was added.

Extend it to account for this.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-18 16:48:56 +00:00
Milan Zamazal
d97d2a58ad libcamera: software_isp: Remove redundant include of time.h
The header file is not used in debayer_cpu.cpp any more.

Signed-off-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: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-18 11:09:51 +00:00
Hans de Goede
7bcc2168bf software_isp: benchmark: Print what is being benchmarked
With the GPU accelerated softISP 2 separate benchmark results are printed,
1 for the generation of the output images on the GPU and a separate one
for generating the statistics on the CPU.

Add a new name argument to the Benchmark class descriptor and print this
out when printing the benchmark result.

Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-18 10:48:52 +00:00
Hans de Goede
f0a79dd68b software_isp: benchmark: Add missing _ postfix to measure data member
All class data members should have a _ postifx, add the missing _ postfix
to the Benchmark::measure_ data member.

Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-18 10:48:52 +00:00
Stefan Klug
1dcf9957a4 libcamera: converter: converter_dw100_vertexmap: Fix dewarp parameter p2 handling
The lens dewarp implementation done in commit 1784e08be3 ("libcamera:
dw100_vertexmap: Implement parametric dewarping") handles the dewarp
parameter p2 incorrectly because it uses the already dewarped x value as
input for the calculation of the y value. Fix that by using separate
variables for the output value. Do so for x and y to keep the code
symmetric even if it is only strictly required for y.

Fixes: 1784e08be3 ("libcamera: dw100_vertexmap: Implement parametric dewarping")
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-11 14:06:20 +01:00
Barnabás Pőcze
b181327131 test: Remove uses of O_TMPFILE
`O_TMPFILE` requires file system support, which may not be available in
certain environments, usually containerized ones. So do not use it.

A new function is added for tests to be able to create unnamed temporary
files using `libcamera::MemFd` as the implementation.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2026-02-10 09:53:32 +01:00
Barnabás Pőcze
78b9890a0f libcamera: software_isp: debayer: Take DebayerParams by ref
When calling `Debayer::process()` from `SoftwareIsp::process()`, the
`DebayerParams` object is copied multiple times:

  (1) call of `BoundMethodMember<...>::activate()`
      inside `Object::invokeMethod()`
  (2) constructor of `BoundMethodArgs<...>`
      inside `BoundMethodMember<...>::activate()`
  (3) call of `BoundMethodMember<...>::invoke()`
      inside `BoundMethodArgs::invokePack()`
  (4) call of the actual pointer to member function
      inside `BoundMethodMember::invoke()`

While compilers might avoid one or two of the above copies, this is still
not ideal. By making `Debayer::process()` take the parameter object by
const lvalue reference, only the copy in the `BoundMethodArgs` constructor
remains. So do that.

Before:
	[0:12:51.133836595] [12424] DEBUG SoftwareIsp software_isp.cpp:399 params=0x7d0a691f57d0
	copy from 0x7d0a691f57d0 into 0x7baa65f2bf30
	copy from 0x7baa65f2bf30 into 0x7c6a69209758
	copy from 0x7c6a69209758 into 0x7baa63223930
	copy from 0x7baa63223930 into 0x7baa63223a70
	[0:12:51.134559602] [12426] DEBUG eGL debayer_egl.cpp:538 params=0x7baa63223a70
	771.099877 (30.06 fps) cam0-stream0 seq: 000031 bytesused: 8666112

After:
	[0:13:42.861691943] [12543] DEBUG SoftwareIsp software_isp.cpp:399 params=0x7cfaad5f57d0
	copy from 0x7cfaad5f57d0 into 0x7c5aad609758
	[0:13:42.862453917] [12545] DEBUG eGL debayer_egl.cpp:538 params=0x7c5aad609758
	822.827388 (30.02 fps) cam0-stream0 seq: 000031 bytesused: 8666112

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
2026-02-09 09:14:24 +01:00
Barnabás Pőcze
c6c5a8bc5b meson: Add libdw option to control libdw dependency
Previously it was not possible to disable libdw usage if it was
detected. Fix that by adding a meson feature option.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-06 09:57:56 +01:00
Milan Zamazal
bb2e6d0833 libcamera: ipa: simple: Fix multiplication order in Awb
The matrix multiplication in Awb is swapped: the gains should be applied
after combinedMatrix, i.e. on the left side.  The mistake happened when
`ccm' was replaced with combinedMatrix and gainMatrix multiplication was
moved to Awb.  While CCM must be applied after gains, the gains must be
applied after the combined matrix, which no longer corresponds to CCM in
Awb.

Since there is currently no algorithm modifying combinedMatrix before
Awb, combinedMatrix is an identity matrix there and the wrong order
doesn't influence the output at the moment.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2026-02-06 00:39:33 +02:00
Barnabás Pőcze
4ceceb682a libcamera: base: Add missing private.h includes
Certain private header files failed to include `private.h`, fix that.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-01-29 16:39:12 +01:00
Kieran Bingham
b7854fd07d libcamera v0.7.0
This release brings 158 commits with substantial development on the SoftISP
components. This brings in GPU acceleration, allowing us to get higher
throughput for cameras using this pipeline. Further development to improve the
image quality is ongoing now that we can perform more processing in realtime.

The simple pipeline handler now supports exposing the Raw streams directly
allowing us to enable the SoftISP by default without removing access to the
camera formats.

Kernel headers have been updated to v6.18, supporting the new V4L2 ISP kernel
interface which allows us to continue improvements to hardware ISP pipelines as
we add new features.

Logging has been improved to better detect when to enable or disable color
output and can be controlled through the environment variable
LIBCAMERA_LOG_COLOR.

A new control is added for LensShadingCorrectionEnable to allow runtime control
over the LSC components where supported.

The gstreamer pipeline now has raw support added to the libcamerasrc
stream-role property allowing raw streams to be configured and accessed.

An exciting new AWB algorithm using Neural Networks, has been added to the
Raspberry Pi IPA following extensive development and training performed by the
Raspberry Pi Camera Team.

And finally, the Documentation now includes a support matrix which will help
identify the current support and enablement for platforms and sensors.

Contributors:

    36	Bryan O'Donoghue <bryan.odonoghue@linaro.org>
    26	Milan Zamazal <mzamazal@redhat.com>
    23	Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
    20	Jacopo Mondi <jacopo.mondi@ideasonboard.com>
    15	Stefan Klug <stefan.klug@ideasonboard.com>
     8	Robert Mader <robert.mader@collabora.com>
     5	Hans de Goede <hdegoede@redhat.com>
     4	Daniel Scally <dan.scally@ideasonboard.com>
     4	Peter Bailey <peter.bailey@raspberrypi.com>
     3	Naushir Patuck <naush@raspberrypi.com>
     2	Andrei Gansari <andrei.gansari@nxp.com>
     2	Hans de Goede <johannes.goede@oss.qualcomm.com>
     2	Jai Luthra <jai.luthra@ideasonboard.com>
     2	Kieran Bingham <kieran.bingham@ideasonboard.com>
     1	Julien Vuillaumier <julien.vuillaumier@nxp.com>
     1	Khem Raj <raj.khem@gmail.com>
     1	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
     1	Michael Olbrich <m.olbrich@pengutronix.de>
     1	Paul Elder <paul.elder@ideasonboard.com>
     1	Vasiliy Doylov <nekocwd@mainlining.org>

158 commits, 170 files changed, 7410 insertions(+), 2325 deletions(-)

Integration overview:

ABI:

The abi-compliance checker reports 100% compatibility in this release. But it's
a complete lie... so we're moving to v0.7.0 and increasing the SONAME for this
release.

  $ ./utils/abi-compat.sh

  Validating ABI compatibility between v0.6.0 and v0.7.0
  Preparing, please wait ...
  Comparing ABIs ...
  Comparing APIs ...
  Creating compatibility report ...
  Binary compatibility: 100%
  Source compatibility: 100%
  Total binary compatibility problems: 0, warnings: 3
  Total source compatibility problems: 0, warnings: 0
  Report: compat_reports/libcamera/v0.6.0_to_v0.7.0/compat_report.html

The warnings reported are diagnosed as low severity but relate to a change of
the structure size of the public API Request object, which will require a
recompile of any users.

bugs:
 - libcamera: simple: Move colour space logging after adjustment
   - Fixes: 5a33bc10e9 ("libcamera: software_isp: Assign colour spaces in configurations")
 - utils: gen-shader-headers: Fix subproject build
   - Fixes: 19371dee41 ("utils: gen-shader-headers: Add a utility to generate headers from shaders")
 - ipa: simple: awb: Fix ColourGains reported
   - Fixes: a0b97475b1 ("ipa: simple: Report the ColourGains in metadata")
 - apps: cam: Do not override Request::controls()
   - Fixes: 568865a6c1 ("cam: Use script parser to set controls")
 - gstreamer: Be prepared when queueing request
   - Fixes: 06bd05bece ("gstreamer: Use dedicated lock for request queues")
 - v4l2: v4l2_camera_proxy: Fix for getting default FrameDurationLimits
   - Fixes: 4e9be7d11b ("ipa: ipu3, mali-c55, rkisp1, rpi: Fix reporting non-scalar controls")
 - ipa: mali-c55: Retain Camera::controls() after ipa->configure()
   - Fixes: fe989ee514 ("ipa: mali-c55: Add Mali-C55 ISP IPA module")
 - ipa: ipu3: Retain Camera::controls() after ipa->configure()
   - Fixes: 87353f2bba ("ipa: ipu3: Derive ipu3::algorithms::Agc from AgcMeanLuminance")
 - libcamera: v4l2_subdevice: Remove unnecessary variable
   - Fixes: 5d2aad02e8 ("libcamera: add model() for retrieving model name in V4L2Subdevice")
 - libcamera: simple: Fix black level offsets in AWB
   - Fixes: 4e13c6f55b ("Honor black level in AWB")
 - apps: qcam: Disable -Wsfinae-incomplete
   - Link: https://qt-project.atlassian.net/browse/QTBUG-143470
 - libcamera: base: utils: Fix namespace of `operator<<` for `Duration`
   - Fixes: 5055ca747c ("libcamera: utils: Add helper class for std::chrono::duration")

core:
 - libcamera: media_pipeline: Add accessor for MediaPipeline list of entities
 - libcamera: controls: Small style fixes
 - libcamera: base: Wrap <regex.h>
 - libcamera: device_enumerator: Support regex to match entity names
 - libcamera: media_device: Get entity by regexp
 - libcamera: V4L2Subdevice: Get device by regexp
 - utils: gen-shader-headers: Add a utility to generate headers from shaders
 - meson: Automatically generate glsl_shaders.h from specified shader programs
 - include: linux: drm_fourcc.h: Update to v6.18
 - include: linux: intel-ipu3.h: Update to v6.18
 - include: linux: media-bus-format.h: Update to v6.18
 - include: linux: v4l2-controls.h: Update to v6.18
 - include: linux: videodev2.h: Update to v6.18
 - include: linux: README: Update to Linux v6.18
 - utils: gen-shader-headers: Fix subproject build
 - libcamera: device_enumerator_udev: Disable copy/move
 - libcamera: device_enumerator_udev: Handle duplicate devices
 - include: linux: Add stddef.h
 - include: linux: Add v4l2-isp.h
 - libcamera: request: Create control list with Camera info map
 - libcamera: request: Move metadata_ to Private
 - libcamera: request: Make metadata_ a class instance
 - libcamera: request: Make controls_ a class instance
 - libcamera: camera: Ensure a request's controls are valid
 - libcamera: camera_manager: CameraManager::version(): Add `threadsafe` ref
 - libcamera: controls: Simplify SFINAE template parameter
 - libcamera: base: log: Add `LIBCAMERA_LOG_COLOR` env var
 - libcamera: control_serializer: Remove unnecessary allocation
 - libcamera: base: event_dispatcher_poll: Dispatch `POLLPRI` first
 - meson: Do not force libc++ when using clang
 - treewide: Remove `libcamera::LOG(...)` occurrences
 - libcamera: base: log: Do not instantiate disabled `LogMessage`s
 - libcamera: base: log: Do not check severity before printing
 - libcamera: base: log: Remove `LogInvalid` check
 - libcamera: base: log: Inline `LOG()` into `ASSERT()`
 - libcamera: base: utils: join(): Don't use `const_iterator` directly
 - libcamera: v4l2_subdevice: Remove unnecessary variable
 - libcamera: v4l2_subdevice: Avoid reconstructing the `std::regex` object
 - libcamera: v4l2_subdevice: Avoid unnecessary copy
 - libcamera: control_ids: Introduce LensShadingCorrectionEnable
 - libcamera: yaml_parser: Fix uninitialized variable warning
 - libcamera: base: utils: Simplify `operator<<` for `Duration`
 - libcamera: base: utils: Fix namespace of `operator<<` for `Duration`

pipeline:
 - pipeline: imx8-isi: Integrating MediaPipeline class
 - libcamera: simple: Move colour space logging after adjustment
 - libcamera: simple: Exclude raw configurations from output conversions
 - libcamera: simple: Handle processed and raw formats separately
 - libcamera: simple: Validate raw stream configurations
 - libcamera: simple: Don't enforce conversion with an added raw stream
 - libcamera: simple: Set the number of software ISP streams to 2
 - libcamera: simple: Require metadata only when software ISP is used
 - libcamera: simple: Make raw streams working
 - pipeline: rpi: Rename Stream::prepareBuffers to Stream::allocateBuffers
 - pipeline: rpi: Rework internal buffer allocations
 - libcamera: simple: Enable SoftISP for imx7-csi
 - libcamera: pipeline: virtual: Don't use span iterator as pointer
 - libcamera: simple: Fix black level offsets in AWB

softisp:
 - libcamera: shaders: Move GL shader programs to src/libcamera/assets/shader
 - libcamera: swstats_cpu: Update statsProcessFn() / processLine0() documentation
 - libcamera: swstats_cpu: Drop patternSize_ documentation
 - libcamera: swstats_cpu: Move header to libcamera/internal/software_isp
 - libcamera: software_isp: Move benchmark code to its own class
 - libcamera: swstats_cpu: Add processFrame() method
 - libcamera: software_isp: Move useful items from DebayerCpu to Debayer base class
 - libcamera: software_isp: Move Bayer params init from DebayerCpu to Debayer
 - libcamera: software_isp: Move param select code to Debayer base class
 - libcamera: software_isp: Move DMA Sync code to Debayer base class
 - libcamera: software_isp: Make output DMA sync contingent
 - libcamera: software_isp: Move isStandardBayerOrder to base class
 - libcamera: software_isp: debayer: Introduce a start() / stop() methods to the debayer object
 - libcamera: software_isp: debayer: Make the debayer_ object of type class Debayer not DebayerCpu
 - libcamera: software_isp: lut: Make CCM available in debayer params
 - libcamera: software_isp: blacklevel: Make black level available in debayer params
 - libcamera: software_isp: lut: Make gamma from lut.cpp available in debayer params
 - libcamera: software_isp: lut: Make contrast available in debayer params
 - libcamera: software_isp: debayer: Latch contrastExp not contrast to debayer parameters
 - libcamera: software_isp: gbm: Add a GBM helper class for GPU surface access
 - libcamera: software_isp: egl: Add a eGL base helper class
 - libcamera: shaders: Rename bayer_8 to bayer_unpacked
 - libcamera: shaders: Use highp not mediump for float precision
 - libcamera: shaders: Extend debayer shaders to apply CCM gains
 - libcamera: shaders: Extend bayer shaders to support swapping R and B on output
 - libcamera: shaders: Add support for black level compensation
 - libcamera: shaders: Add support for Gamma
 - libcamera: shaders: Add support for contrast
 - libcamera: shaders: Fix input sampling when width != stride
 - libcamera: software_isp: Add member variables to track selected input/output pixelFormat
 - libcamera: software_isp: Add a Size_ member variable to pass to eGL later
 - libcamera: software_isp: debayer_egl: Add an eGL Debayer class
 - libcamera: software_isp: debayer_cpu: Make getInputConfig and getOutputConfig static
 - libcamera: software_isp: GPU support for unpacked 10/12-bit formats
 - libcamera: software_isp: debayer_egl: Make DebayerEGL an environment option
 - libcamera: software_isp: lut: Skip calculation lookup tables if gpuIspEnabled is true
 - libcamera: software_isp: lut: Change default Gamma to 1.0/2.2
 - libcamera: software_isp: Switch on default CCM at 65k
 - libcamera: software_isp: debayer_egl: Make gpuisp default softisp mode
 - libcamera: software_isp: Add a gpuisp todo list
 - Revert "libcamera: software_isp: gbm: Add a GBM helper class for GPU surface access"
 - egl: Remove unused functions
 - egl: Remove bpp variable
 - egl: Remove duplicated logging of EGL version
 - egl: Print GLES version
 - egl: Use the Mesa surfaceless platform instead of GBM
 - egl: Add workaround for Mesa <= 22.2

apps:
 - gstreamer: Add raw support to libcamerasrc stream-role property
 - apps: cam: Do not override Request::controls()
 - apps: lc-compliance: Commit camera configuration last
 - qcam: viewfinder_gl: Set no-op Bayer shader values
 - gstreamer: Be prepared when queueing request
 - v4l2: v4l2_camera_proxy: Fix for getting default FrameDurationLimits
 - apps: qcam: Disable -Wsfinae-incomplete

ipa:
 - ipa: simple: awb: Fix ColourGains reported
 - ipa: rpi: remove executable bits from data files
 - ipa: mali-c55: Update header file and adjust IPA
 - ipa: libipa: Introduce V4L2Params
 - ipa: mali-c55: Introduce MaliC55Params
 - ipa: simple: fix minimal analog gain init
 - ipa: simple: agc: Make sure activeState.agc expo/again are always initialized
 - ipa: simple: Add a flag to indicate gpuIspEnabled
 - ipa: mali-c55: Retain Camera::controls() after ipa->configure()
 - ipa: ipu3: Retain Camera::controls() after ipa->configure()
 - ipa: rpi: controller: awb: Separate Bayesian AWB into AwbBayes
 - ipa: rpi: controller: awb: Add Neural Network AWB
 - ipa: rpi: controller: Ignore algorithms that are not enabled
 - ipa: rpi: pisp: vc4: Update tuning files for new AWB
 - libcamera: ipa: simple: Remove an unused include from awb.cpp
 - libcamera: ipa: simple: Unwrap IPAFrameContext::ccm
 - libcamera: ipa: simple: Generalize tracking matrix changes
 - libcamera: ipa: simple: Rename "ccm" identifiers not specific to CCM
 - libcamera: ipa: simple: Introduce a general correction matrix
 - libcamera: ipa: simple: Initialise the general correction matrix
 - libcamera: ipa: simple: Separate saturation from CCM
 - libcamera: ipa: simple: Move contrast settings to adjust.cpp
 - libcamera: ipa: simple: Make gamma adjustable
 - libcamera: ipa: simple: Apply gain matrix in awb
 - libcamera: ipa: simple: Use float type for adjustment controls
 - libcamera: ipa: simple: Use symbolic constants for adjust defaults
 - libcamera: ipa: simple: Set contrast metadata unconditionally
 - libcamera: ipa: simple: Remove Lut algorithm
 - libcamera: ipa: simple: Disable Ccm algorithm by default again
 - ipa: rkisp1: lsc: Drop unused member variable
 - ipa: rkisp1: lsc: Drop unused function declaration
 - ipa: rkisp1: lsc: Replace assert with ASSERT
 - ipa: rkisp1: lsc: Rename res to positions
 - ipa: rkisp1: lsc: Rename res to ret
 - ipa: rkisp1: lsc: Rename res to samples
 - ipa: rksip1: lsc: Move function definitions out of class
 - ipa: rkisp1: lsc: Move local types into anonymous namespace
 - ipa: rkisp1: lsc: Handle quantization locally
 - ipa: libipa: interpolator: Drop key quantization
 - ipa: rkisp1: lsc: Pass sampling positions into samplePolynomial
 - ipa: rkisp1: lsc: Pass crop rectangle as parameter
 - ipa: rkisp1: lsc: Resample polynomial lens shading tables at configure time
 - ipa: rkisp1: Implement LensShadingCorrectionEnable control
 - ipa: rpi: Fix printing of `utils::Duration`

documentation:
 - Documentation: Add ISP feature support matrix
 - Documentation: Add camera sensor support table
 - Documentation: guides: pipeline-handler: Refresh

Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-01-29 12:17:26 +00:00
Barnabás Pőcze
79c31f0707 libcamera: base: utils: Fix namespace of operator<< for Duration
In order for ADL to find the function, it must be in the namespace of any of
its arguments. Previously, however, that was not the case, and it has only
really worked by accident and could be easily made to fail by introducing
other `operator<<` overloads.

For example, a user of this function in `libcamera::ipa` would no longer
compile after introducing an `operator<<` into the `libcamera::ipa`
namespace as that would essentially hide this overload, and without ADL
it would not be found.

So move the function into the `utils` namespace.

Fixes: 5055ca747c ("libcamera: utils: Add helper class for std::chrono::duration")
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2026-01-28 18:26:28 +01:00
Barnabás Pőcze
f7417c38e4 ipa: rpi: Fix printing of utils::Duration
`utils::Duration` derives from `std::chrono::duration<...>`, but multiplying
it yields an `std::chrono::duration<...>`, not `Duration`. chrono duration
types only have `operator<<` in C++20 or later, so this usage should not
compile. It only did so because the `operator<<` for `Duration` was in
the `libcamera` namespace and `Duration` has an implicit constructor from
any chrono duration type.

This will cease to work when that operator is moved into the `utils` namespace
for ADL purposes. So fix it by making the cast to `Duration` explicit.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2026-01-28 18:26:28 +01:00
Barnabás Pőcze
461e7d3d73 libcamera: base: utils: Simplify operator<< for Duration
There is no real need for a function template. It is not defined in a
header file, so it has limited availability, and there exists only a
single instantion.

So convert it to use `std::ostream` directly, like most `operator<<`
in the code base.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2026-01-28 18:26:28 +01:00
Laurent Pinchart
67fd7d720b libcamera: yaml_parser: Fix uninitialized variable warning
gcc 14.3.0, cross-compiling from amd64 to arm64, warns about a possibly
uninitialized variable in YamlObject::Getter<>::get():

In file included from ../../include/libcamera/internal/yaml_parser.h:12,
                 from ../../src/libcamera/yaml_parser.cpp:8:
In constructor ‘constexpr std::_Optional_payload_base<_Tp>::_Storage<_Up, <anonymous> >::_Storage(std::in_place_t, _Args&& ...) [with _Args = {unsigned char}; _Up = unsigned char; bool <anonymous> = true; _Tp = unsigned char]’,
    inlined from ‘constexpr std::_Optional_payload_base<_Tp>::_Optional_payload_base(std::in_place_t, _Args&& ...) [with _Args = {unsigned char}; _Tp = unsigned char]’ at include/c++/14.3.0/optional:122:4,
    inlined from ‘constexpr std::_Optional_payload<unsigned char, true, true, true>::_Optional_payload(std::in_place_t, _Args&& ...) [with _Args = {unsigned char}][inherited from std::_Optional_payload_base<unsigned char>]’ at include/c++/14.3.0/optional:337:42,
    inlined from ‘constexpr std::_Optional_base<_Tp, true, true>::_Optional_base(std::in_place_t, _Args&& ...) [with _Args = {unsigned char}; typename std::enable_if<is_constructible_v<_Tp, _Args ...>, bool>::type <anonymous> = false; _Tp = unsigned char]’ at include/c++/14.3.0/optional:648:4,
    inlined from ‘constexpr std::optional<_Tp>::optional(_Up&&) [with _Up = unsigned char; typename std::enable_if<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Up>::type>::type> >, std::__not_<std::is_same<std::in_place_t, typename std::remove_cv<typename std::remove_reference<_Up>::type>::type> >, std::is_constructible<_T1, _U1>, std::is_convertible<_Iter, _Iterator> >, bool>::type <anonymous> = true; _Tp = unsigned char]’ at include/c++/14.3.0/optional:747:47,
    inlined from ‘std::optional<_Tp> libcamera::YamlObject::Getter<T, typename std::enable_if<(((((is_same_v<signed char, T> || is_same_v<unsigned char, T>) || is_same_v<short int, T>) || is_same_v<short unsigned int, T>) || is_same_v<int, T>) || is_same_v<unsigned int, T>), void>::type>::get(const libcamera::YamlObject&) const [with T = unsigned char]’ at ../../src/libcamera/yaml_parser.cpp:172:10:
include/c++/14.3.0/optional:210:15: error: ‘value’ may be used uninitialized [-Werror=maybe-uninitialized]
  210 |             : _M_value(std::forward<_Args>(__args)...)
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/libcamera/yaml_parser.cpp: In member function ‘std::optional<_Tp> libcamera::YamlObject::Getter<T, typename std::enable_if<(((((is_same_v<signed char, T> || is_same_v<unsigned char, T>) || is_same_v<short int, T>) || is_same_v<short unsigned int, T>) || is_same_v<int, T>) || is_same_v<unsigned int, T>), void>::type>::get(const libcamera::YamlObject&) const [with T = unsigned char]’:
../../src/libcamera/yaml_parser.cpp:165:19: note: ‘value’ was declared here
  165 |                 T value;
      |                   ^~~~~

This appears to be a false positive, as the std::from_chars() function
should set value when it returns without an error. Commit bb1d216113
("libcamera: base: log: Fix uninitialized variable warning") fixed a
similar warning with gcc 13.3.0.

The warning is easy to work around by initializing the variable, and
doing so shouldn't be too costly as the type T is restricted to being an
integer. Fix the build by doing so.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-01-28 18:47:15 +02:00
Stefan Klug
186e5cf9ac ipa: rkisp1: Implement LensShadingCorrectionEnable control
Implement the LensShadingCorrectionEnable control for rkisp1.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2026-01-28 17:10:01 +01:00
Stefan Klug
1355e29f31 libcamera: control_ids: Introduce LensShadingCorrectionEnable
Introduce a LensShadingCorrectionEnable control to enable and disable
LSC. This is useful to assess the working and quality of the lens
shading correction at runtime.

While at it drop the reference to the tuning file in the description of
the LensDewarpEnable control, as that information doesn't belong to the
controls.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
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>
2026-01-28 17:10:01 +01:00
Stefan Klug
e8054c758c ipa: rkisp1: lsc: Resample polynomial lens shading tables at configure time
The lens shading correction is always applied based on the sensor crop
bounds. This leads to incorrect lens shading correction for analog crops
that do not cover the whole sensor.

To fix that, we need to adapt the lens shading table for the selected
analog crop at configure time. Introduce an abstract ShadingDescriptor
class that holds the lens shading information that can then be sampled
at configure time for a specific crop rectangle.

Resampling for a specific crop is only implemented for polynomial lsc
data. For tabular data, a warning is logged and the unmodified table is
returned. This matches the current functionality for tabular data and is
a huge improvement for polynomial data.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-01-28 17:10:01 +01:00
Stefan Klug
d59081c2e2 ipa: rkisp1: lsc: Pass crop rectangle as parameter
In preparation for the upcoming rework, pass the crop rectangle as
parameter to samplePolynomial(). This patch contains no functional
change.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Rui Wang <rui.wang@ideasonboard.com>
2026-01-28 17:10:01 +01:00
Stefan Klug
d474a5aa8a ipa: rkisp1: lsc: Pass sampling positions into samplePolynomial
There is no need to recalculate the sampling positions over and over.
Pass them as parameter into the sampling function. The vectors are still
kept inside the loop as this is also a preparatory change for the
upcoming refactoring.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2026-01-28 17:10:01 +01:00
Stefan Klug
ee1d93d8aa ipa: libipa: interpolator: Drop key quantization
The quantization of the interpolation key was only used by the LSC
algorithm. There it lead to difficult to read code was removed. As there
is no remaining user of it, drop it from the Interpolator class.

While at it, cleanup the includes.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-01-28 17:10:01 +01:00