Commit graph

4214 commits

Author SHA1 Message Date
Jacopo Mondi
6f6e1bf704 libcamera: camera_sensor: Apply flips at setFormat()
Augment the CameraSensor::setFormat() function to configure horizontal
and vertical flips before applying the image format on the sensor.

Applying flips before format is crucial as they might change the Bayer
pattern ordering.

To allow users of the CameraSensor class to specify a Transform,
add to the V4L2SubdeviceFormat class a 'transform' member, by
default initialized to Transform::Identity.

Moving the handling of H/V flips to the CameraSensor class allows to
remove quite some boilerplate code from the IPU3 and RaspberryPi
pipeline handlers.

No functional changes intended.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
2023-01-30 11:04:50 +01:00
Jacopo Mondi
1a614866a2 libcamera: camera_sensor: Validate Transform
The two pipeline handlers that currently support Transform (IPU3 and
RaspberryPi) implement it by operating H/V flips on the image sensor.

Centralize the code that validates a Transform request against the
sensor rotation capabilities in the CameraSensor class.

The implementation in the IPU3 pipeline handler was copied from the
RaspberryPi implementation, and is now centralized in CameraSensor to
make it easier for other platforms.

The CameraSensor::validateTransform() implementation comes directly from
the RaspberryPi pipeline handler, no functional changes intended.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
2023-01-30 11:04:29 +01:00
Jacopo Mondi
e030bac390 libcamera: camera_sensor: Verify flips support
During the camera sensor driver validation, verify if the sensor
supports horizontal and vertical flips and store a flag as
CameraSensor::supportFlips_ class member.

The flag will be later inspected when applying flips.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
2023-01-30 10:49:26 +01:00
Nicholas Roth
0f382a9926 libcamera: Add support for OmniVision OV8858
Support for the OmniVision OV8858 sensor is scheduled for inclusion in
the Linux kernel in version v6.3.

Add support for the sensor in libcamera by providing static properties
and a camera sensor helper in libipa.

The camera sensor helper expresses analogue gain increments in 1/128
step which differs from what is reported in the sensor documentation in
section "5.8 manual exposure compensation/ manual gain compensation" [0]

A more detailed analysis of the sensor gain model is reported at:
2022110617.166892-2-nicholas@rothemail.net/#142267

Record with a \todo note a reference to discussion on the gain model
implementation.

Signed-off-by: Nicholas Roth <nicholas@rothemail.net>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-26 18:33:47 +01:00
Mikhail Rudenko
7986d3d3c1 ipa: rkisp1: Raise maximum analogue gain
Omnivision OV4689 sensor driver exposes maximum analogue gain of
16x. Raise kMaxAnalogueGain to 16.0, so that the full gain range can
be used.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-01-25 18:43:44 +01:00
Mikhail Rudenko
d500930e7d ipa: rkisp1: Add OV4689 tuning file
Add a minimal tuning file for Omnivision OV4689, specifying black
level subtraction level.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-01-25 18:43:43 +01:00
Mikhail Rudenko
1818b92fd7 libcamera: camera_sensor: Add OV4689 sensor properties
Add an entry to the sensor properties for Omnivision OV4689.

Kernel supports two more types of color bars patterns, which we do not
expose now.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-01-25 18:43:36 +01:00
Mikhail Rudenko
3643c59617 ipa: camera_sensor_helper: Add OV4689 support
Add support for Omnivision OV4689 image sensor to libipa.

The sensor implements a linear gain equation with analogue gain
control values 0-2047 corresponding to 0x-16x physical gain range.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-01-25 18:42:51 +01:00
David Plowman
13986d6ce3 libcamera: camera: Fix validateColorSpaces to choose "main" colour space
The intention is that the "main" colour space is the colour space of
the largest non-raw stream. Unfortunately the use of "config_[i].size"
is clearly incorrect, and has been copied from prior versions of the
code. This patch corrects the error.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2023-01-19 21:17:48 +05:30
Laurent Pinchart
d81505b834 libcamera: ipa_module: Relax ipaModuleInfo symbol size check
When an IPA module is loaded, the loadIPAModuleInfo() function validates
the ipaModuleInfo structure. As part of that process, it checks that the
ipaModuleInfo symbol size matches the expected structure size. This
check breaks with clang and ASan, as the LLVM's address sanitizer
implementation includes the redzone after the structure in the symbol
size, currently growing it by 156 bytes (on x86-64). This causes all IPA
modules to fail to load.

Fix the problem by relaxing the size check to only ensure that the
symbol is large enough to contain the structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-16 18:32:50 +02:00
Daniel Oakley
20e33bc0df py: cam.py: Fix duplicate metadata output if more than one stream
Currently, if there are multiple streams, the --metadata flag will print
the metadata for each request multiple times.

Moving the metadata print logic outside the stream for loop this will no
longer occur.

Signed-off-by: Daniel Oakley <daniel.oakley@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-01-16 18:07:05 +02:00
Jacopo Mondi
3666290f5f libcamera: rkisp1: Re-sort includes
Comply with a checkstyle suggestion and separate inclusion directives.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-01-16 09:52:03 +01:00
Jacopo Mondi
d47965f899 libcamera: bayer_format: Expand documentation
The current documentation of the BayerFormat::transform() function
reports examples on the Bayer components ordering transformation for
horizontal flip (mirroring) but not for vertical flip or for the
combination of the two.

It is useful to complete the documentation to ease understanding of the
transform() function on a sensor's Bayer pattern.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-01-16 09:52:03 +01:00
Laurent Pinchart
aed615e173 libcamera: base: utils: Support C libraries lacking locale support
Not all C libraries include support for locale objects (locale_t) and
the strto*_l() family of functions. A notable example is uClibc that can
be compiled with a hardcoded "C" locale. Compilation then fails as the
newlocale(), freelocale() and strtod_l() functions are not defined.

Fix the compilation breakage by checking for the availability of the
locale_t type, and fall back to strtod() when the type isn't available.
This may not lead to the correct result if support for locale objects
isn't available and the locale isn't hardcoded to "C", but that is such
a corner case that we will likely never encounter it.

Fixes: e8ae254970 ("libcamera: yaml_parser: Use C locale")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-01-10 17:25:51 +02:00
Laurent Pinchart
0e3b8d71f5 base: utils: Add and use strtod() helper
The strtod() function is locale-dependent, and thus ill-suited to parse
numbers coming from, for instance, YAML files. The YamlObject class uses
strtod_l() to fix that issue, but that function is not available with
all libc implementations. Correctly handling this problem is becoming
out of scope for the YamlObject class.

As a first step, add a strtod() helper function in the utils namespace
that copies the implementation from YamlObject, and use it in
YamlObject. The core issue will then be fixed in utils::strtod().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-10 15:39:18 +02:00
Laurent Pinchart
2535e31d9e utils: checkstyle.py: Add commit title checker
Add a commit checker to ensure that commit titles start with a prefix.
The commit issue message lists prefix candidates retrieved from the git
log.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-01-10 15:36:13 +02:00
Laurent Pinchart
c15ff6b59d README: Replace deprecated 'meson' with 'meson setup'
Meson has deprecated implicit usage of the setup command, and this now
generates a warning:

WARNING: Running the setup command as `meson [options]` instead of `meson setup [options]` is ambiguous and deprecated.

Update the build instructions to use 'meson setup' explicitly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-05 16:42:44 +02:00
Barnabás Pőcze
96cd064214 Documentation: Specify Doxygen OUTPUT_DIRECTORY explicitly
Currently, doxygen is run by ninja in the top-level build directory,
therefore the "Documentation" folder is always created there. However,
when libcamera is built as a subproject, it should not touch the
top-level build directory because it can cause conflicts and because
the documentation won't be created where meson thinks it will be, so
the "doxygen" target will always be dirty and installation will fail.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-01-05 12:08:35 +02:00
Matti Lehtimäki
504b643761 libcamera: Use C++17 [[fallthrough]] everywhere
Fixes build failure on some build environments.

Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-01-05 12:08:34 +02:00
Kieran Bingham
e8ae254970 libcamera: yaml_parser: Use C locale
When parsing configuration files on systems with differing locales, the
use of strtod can produce different results, or in the worst case - fail
to parse expected values.

Fix this by using strtod_l() instead. To avoid constructing and
destructing a locale_t instance for every use of strtod_l(), create an
RAII class that wraps the locale_t and use it to provide a global "C"
locale.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=174
Bug: https://github.com/raspberrypi/libcamera/issues/29
Reported-by: https://github.com/kralo
Reported-by: Hannes Winkler <hanneswinkler2000@web.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-03 13:09:52 +00:00
Paul Elder
0081e4e6b2 meson: Add 'all' choice to pipelines option
Add an 'all' choice to the pipelines option, for building all pipelines.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-12-30 20:03:36 -06:00
Christian Rauch
e1b81401ca qcam: Show string representation of pixel format
The raw pixel format in form of the fourcc integer is not easily readable.
Use the string representation instead for easier debugging.

Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-30 22:16:49 +02:00
Paul Elder
e1c960ba5f meson: options: Fix typo in pipelines documentation
Fix a typo in the pipelines option documentation.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-12-29 10:32:01 -06:00
Javier Martinez Canillas
0a8ac1ee06 meson: Only build pipeline handlers needed in the host architecture
By default all pipeline handlers are built, regardless on whether these
are needed in the host architecture or not. It makes more sense to build
only the pipeline handlers that will be used for the given architecture.

Let's do that by default now, but still allow to build the other
pipeline handlers if needed, by using the `pipelines` meson option. For
example, on a x86-64 platform:

  $ meson build
  ...
    Configuration
    Enabled pipelines        : ipu3
                               uvcvideo
    Enabled IPA modules      : ipu3
  ...

  $ meson build -Dpipelines="ipu3,raspberrypi,rkisp1" -Dtest=true
  ...
    Configuration
    Enabled pipelines        : ipu3
                               raspberrypi
                               rkisp1
                               vimc
    Enabled IPA modules      : ipu3
                               raspberrypi
                               rkisp1
                               vimc
  ...

Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-24 17:50:28 +02:00
Pavel Machek
e83d94915d gstreamer: Add bayer8 support to libcamerasrc element
Bayer8 support is useful on hardware such as Librem 5, as GStreamer
provides easy solution for debayering and display of the camera
data. Add necessary glue to libcamerasrc element.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-24 17:47:19 +02:00
Pavel Machek
21a82ed8a5 libcamera: Simple typo fixes
Fix various typos in the code base.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-24 03:29:51 +02:00
Laurent Pinchart
c00a3a8f52 test: Drop pipeline test
The two pipeline test (for ipu3 and rkisp1) are meant to perform very
basic validation of the corresponding pipeline handlers, limited to
verifying camera enumeration. They are not unit tests as such, they are
superseded by the lc-compliance tool, and they are never used in
practice (and always skipped). Drop them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-12-24 03:29:49 +02:00
Laurent Pinchart
d48e15d571 test: py: Fix test failure when ASan is enabled
When the address sanitizer is enabled, the Python unit tests fail due to
the link order runtime check as the Python interpreter is (generally)
not linked to ASan. Fix this by LD_PRELOAD'ing the ASan runtime. We have
to disable the leak detector as the Python interpreter itself leaks
memory, which would result in test failures.

To LD_PRELOAD the ASan runtime, the path to the binary needs to be
known. gcc gives us a generic way to get the path, but that doesn't work
with clang as the ASan runtime file name depends on the clang version
and target architecture. We thus have to keep the Python test disabled
when ASan is enabled and libcamera is compiled with clang.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-12-24 03:29:47 +02:00
Laurent Pinchart
121b5de329 test: v4l2_compat: Enable test with ASan
When libcamera is compiled with the address sanitizer enabled, the
v4l2_compat test generates failures in the link order runtime check, as
the host v4l2-ctl and v4l2-compliance tools are not (generally) linked
to ASan. For this reason, the test is disabled, which sadly shrinks test
coverage.

Fix this by loading the ASan runtime using LD_PRELOAD. This needs to be
done from within the v4l2_compat_test.py Python script, as the Python
interpreter itself leaks memory and would cause test failures if run
with ASan.

To LD_PRELOAD the ASan runtime, the path to the binary needs to be
known. gcc gives us a generic way to get the path, but that doesn't work
with clang as the ASan runtime file name depends on the clang version
and target architecture. We thus have to keep the v4l2_compat test
disabled when ASan is enabled and libcamera is compiled with clang.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-12-24 03:29:43 +02:00
Laurent Pinchart
9f06cd50cc test: v4l2_compat: Reduce indentation
Return early with subdir_done() to reduce indentation in case the
v4l2_compat layer is not enabled. This matches our usual code patterns
in meson.build files, and prepares for enabling the v4l2_compat test
with ASan.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-12-24 03:29:41 +02:00
Laurent Pinchart
f5bfa33f59 ipa: raspberrypi: Fix permissions on imx477_scientific.json
The imx477_scientific.json file was added to the source tree with
incorrect executable permission. Fix it.

Fixes: bf66a1d251 ("ipa: raspberrypi: Add a "scientific" tuning for the IMX477")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-22 23:27:23 +02:00
Jacopo Mondi
6479535ee3 libcamera: camera_sensor: Add AR0521 sensor properties
Add an entry to the sensor properties for OnSemi AR0521.

The chip manual list one additional test pattern "PN9 Link integrity
test pattern" not supported by the mainline Linux driver.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-22 12:13:16 +01:00
Jacopo Mondi
ff9b8befbb ipa: camera_sensor_helper: Add AR0521 support
Add support for OnSemi AR0521 5Mpx image sensor to libipa.

The sensor analogue gain is implemented as a coarse and a fine factor,
with the coarse gain being a power of two and the fine gain being a
value in the [1.0, 2.0[ range. The mapping between gain codes and gain
values is tabulated in the datasheet, and the table values are very
close but not identical to the mathematical model. Compute the gain
using the model to keep the code shorter, if this causes precision
issues the calculation could be replaced with a table.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-22 12:11:21 +01:00
Kieran Bingham
f66a5c447b libcamera v0.0.3
Key bug fixes:

 * Segfault in the ContolInfo() constructor for an empty V4L2 menu
   Bug: https://bugs.libcamera.org/show_bug.cgi?id=167
   Fix: libcamera: v4l2_device: Workaround faulty control menus

   This resolves and prevents crashes that have occured in Pipewire when
   users connect poorly implemented UVC devices.

ABI Compliance:

abi-compliance-checker reports 100% ABI and API compatibility with with
v0.0.2, however 81e7689bb1 ("libcamera: stream: Turn StreamRole into
scoped enumeration") modifies an enum into a class enum. This may need
minor updates to applications, and didn't appear to be picked up by
abi-compliance-checker.

- See https://git.libcamera.org/libcamera/libcamera.git/commit/?id=81e7689bb168a for more details.

Highlights:

Core:
 * Fix tracing when built as a subproject
 * Avoid double map lookups in framebuffer_allocator
 * Workaround faulty control menus
 * controls: Change LensPosition units to dioptres
 * camera_sensor: Add IMX519 sensor properties
 * Documentation: contributing: Add commit message guidelines
 * Declare generic converter interface

utils:
 * Add libtuning
 * Add initial libtuning script support for rkisp1 and raspberrypi.
 * checkstyle.py: Check new header file on new and renamed meson.build files

ipa:
 * Move IPA sensor controls validation to CameraSensor (IPU3/RKISP1)

rkisp1:
 * Support FrameDurationLimits control for FrameRate management
 * Support raw capture (IPA, configuration, and runtime)
 * Add support for manual gain and exposure
 * Fix stream size validation
 * Add additional default values to controls

imx8-isi:
 * Enumerate supported stream formats
 * Set SensorTimestamp metadata

Raspberry Pi:
 * Remove generic "pause" mechanism from Algorithm
 - Remove enum BuffferMask from the mojom interface
 - Fix digital gain calculations for manual mode
 - Fix bug in IPA frame drop logic
 - imx477: Update tuning file for the latest camera modules
 - Add a "scientific" tuning for the IMX477

Apps:
 - cam: kms: Avoid 'unused-parameter' warnings
 - cam: Support parsing array controls in capture scripts
 - gstreamer: Improve control id lookups
 - lc-compliance: simple_capture: Free Requests properly

python:
 - Support controls that use an array of Rectangles
 - Expose the Request Sequence Number in Python Bindings

test:
 - Validate CameraSensor Ancillary Devices (focusLens)
 - controls: control_info: Test default def() values

Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-20 14:55:34 +00:00
Matthew Goodman
3c70cae5e5 Expose the Request Sequence Number in Python Bindings
The python bindings are missing the ability to read the sequence number
of the Request object from the public API.

Expose the objects sequence number on the pybind11 surfaces to support
applications reading this value.

Signed-off-by: Matthew Goodman <matt@exclosure.io>
[Kieran: Revised commit message]
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-19 15:07:30 +00:00
Naushir Patuck
bf66a1d251 ipa: raspberrypi: Add a "scientific" tuning for the IMX477
Add a tuning file for the IMX477 more suited to scientific applications.
The key differences from the original tuning file are:

- Disable ALSC block completely
- Pure rec709 gamma curve, and no contrast enhance
- New CT curve and CCMs based on the illumination spectrum of a black body
radiator up to about 3600 K and the CIE illuminant D for higher color
temperatures.

Further details on the changes can be found at:
https://forums.raspberrypi.com/viewtopic.php?t=343449

All credit for these changes go to Dr. Rolf Henkel.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Rolf Henkel <cpixip@pixelcircus.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-19 13:23:10 +00:00
Laurent Pinchart
b5ef421e03 test: controls: control_info: Test default def() values
Extend the ControlInfo test to verify the behaviour of the default 'def'
argument to the ControlInfo constructor.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-16 19:39:13 +02:00
Laurent Pinchart
f0fef545a7 libcamera: Add todo comment in meson.build about switch to dependency('dl')
The dlopen() & co. functions are provided by libdl on some systems, and
but the C library on others. Starting from version 0.62.0, meson handles
this behind the scenes when using dependency('dl'). Add a todo comment
to remember we should replace the manual implementation with a
dependency() call when updating to meson 0.62.0 or newer.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-16 18:48:13 +02:00
Xavier Roumegue
7ace78e215 utils: checkstyle.py: Check new header file on new and renamed meson.build files
Declaration of new header file to the build system are only checked against
modified meson.build file. Therefore, this raises a false positive warning in
case the meson.build is added or renamed.

Add the new and renamed meson.build files to the list of files to check header
file inclusion.

Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-15 12:31:48 +02:00
Xavier Roumegue
5a8271ad70 libcamera: pipeline: simple: converter: Use generic converter interface
Move the simple converter implementation to a generic V4L2 M2M class
derived from the converter interface. This latter could be used by
other pipeline implementations and as base class for customized V4L2 M2M
converters.

Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-14 16:19:52 +00:00
Xavier Roumegue
f73f4dfad8 libcamera: Declare generic converter interface
Declare a converter Abstract Base Class intended to provide generic
interfaces to hardware offering size and format conversion services on
streams. This is mainly based on the public interfaces of the current
converter class implementation found in the simple pipeline handler.

The main change is the introduction of loadConfiguration() function
which can be used by the concrete implementation to load hardware
specific runtime parameters defined by the application.

Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-14 16:19:52 +00:00
Laurent Pinchart
e653f4c13e Documentation: contributing: Add commit message guidelines
All developers, whether junior or experienced, can benefit from
improving their commit message writing skills. Add a paragraph to the
contribution documentation to explain this, with a link to a good guide.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-12-12 15:51:39 +02:00
Umang Jain
b026e4a6a0 libcamera: camera_sensor: Rectify test patterns listed for IMX519
The IMX519 driver reports ColorBars and ColorBarsFadeToGray but upon
inspecting the test pattern modes via v4l2-ctl utility, these test
patterns do not comply with MIPI CCS v1.1 (Section 10.1).

Hence, omit from camera-sensor-properties database for now and add a
comment for the same.

Fixes: e3b26b4c4e ("libcamera: camera_sensor: Add IMX519 sensor properties")
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-12 16:48:22 +05:30
Umang Jain
e3b26b4c4e libcamera: camera_sensor: Add IMX519 sensor properties
Add an entry for Arducam IMX519 sensor which has 1220x1220 pixel size
and supports four test pattern modes.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-09 16:03:51 +00:00
Robert Mader
d5fc282eff ipa: rkisp1: Add additional default values to controls
To make things easier for consumers.

Related: https://gitlab.freedesktop.org/pipewire/pipewire/-/merge_requests/1450

Signed-off-by: Robert Mader <robert.mader@collabora.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-09 16:03:09 +00:00
Paul Elder
9a913eb910 lc-compliance: simple_capture: Free Requests properly
In the simple capture tests, in the capture functions, the Requests were
auto-deallocated by the function going out of scope after the test
completed. However, before the end of the scope, the Framebuffers that
the Requests referred to were manually freed. Thus when the Requests
were deallocated, they tried to cancel their Framebuffers, which involve
setting the status to cancelled, which obviously causes a segfault
because the Framebuffers had already been freed.

Fix this by moving the list of Requests to a member variable and
deallocating them before deallocating the Framebuffers at stop() time.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-09 16:02:56 +00:00
David Plowman
a6b1ff2e6c py: Support controls that use an array of Rectangles
The Python bindings will now accept, or return, a list or tuple of
libcamera.Rectangle objects for such controls.

This had previously been omitted, but now we have, for example, the
AfWindows control which requires this feature.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-09 16:02:40 +00:00
David Plowman
1bd74b91be libcamera: controls: Change LensPosition units to dioptres
The units for the LensPosition control, previously defined as being in
units of 1 / hyperfocal_distance, are changed to 1 / distance (in
metres).

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-08 11:36:02 +00:00
Jacopo Mondi
4a7c8a98da android: Fix missing space in error message
Add whitespace to correct the error message.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-12-07 08:52:21 +01:00
David Plowman
ea8ae5afff ipa: raspberrypi: imx477: Update tuning file for the latest camera modules
The latest camera modules have a very slightly different IR filter, so
the tuning file is slightly revised to give best results with both old
and new camera modules.

The original tuning file is retained as imx477_v1.json in case anyone
should wish to continue using it.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-11-30 14:06:04 +00:00