Working on SoftISP
Find a file
Kieran Bingham 668a5e674a libcamera v0.1.0
ABI Compliance:

abi-compliance-checker reports 99% binary compatibility and 81.4% source
compatibilty between version 0.0.5 and 0.1.

 - Binary compatibility: 99%
 - Source compatibility: 81.4%
 - Total binary compatibility problems: 4, warnings: 2
 - Total source compatibility problems: 165, warnings: 7

Now that we have funtional ABI validation, the soname has been updated from
libcamera.so.0.0.5 to libcamera.so.0.1.

Future releases will now maintain the same soname until an ABI breakage is
detected to reduce the repackaging and rebuilding of other components that may
use libcamera. The abi-compatibility report can now be generated with the new
utility './utils/abi-compat.sh'.

Key differences here are due to preventing the installation of internal and
private headers in the packaging process, and most of this API compatibility
should not be visible to applications with the exception of:

- Camera::generateConfiguration ( StreamRoles const& roles )

  The StreamRoles type definition has been removed. This is now handled as a
  Span<StreamRole> to prevent unnecessary allocations and copies.

- CameraManager::addCamera ( std::shared_ptr<struct Camera> camera, std::vector<unsigned long>const& devnums )
- CameraManager::get ( dev_t devnum )
- CameraManager::removeCamera ( std::shared_ptr<struct Camera> camera )

  These functions of the CameraManager were for use exclusively by the V4L2
  adaptation layer, and not intended for use by applications. This has now been
  reworked to use the new SystemDevices and the redundant functions removed.

The ABI/API breakages have been introduced by:

  5ca0c9276f ("libcamera: CameraManager: Remove ::get(dev_t)")
  26a4b83d1b ("libcamera: Remove `StreamRoles` alias")
  63966ae587 ("libcamera: base: Do not install private headers")

Core:
 - libcamera: v4l2_videodevice: Use O_CLOEXEC when exporting DMA buffers
 - libcamera: ipa_manager: Allow IPA loading in nested subdirs
 - meson: Fix usage of overwritten pipeline variable
 - subprojects: Drop leftovers of pybind11
 - camera_sensor: ipa: core: Add CFA pattern to IPACameraSensorInfo
 - libcamera: controls: Define a default lens position behaviour
 - libcamera: internal: request: convert to pragma once
 - libcamera: camera_manager: Move private implementation to internal
 - libcamera: camera_manager: Move {add,remove}Camera to internal
 - libcamera: properties: Provide a Devices camera property
 - libcamera: pipeline: Register device numbers with camera
 - libcamera: camera_sensor: Adjust properties::Rotation
 - libcamera: meson: Allow PH to change libcamera_deps
 - libcamera: base: Move thread_annotations to private
 - libcamera: base: Do not install private headers
 - utils: ABI Compatibility checker
 - meson: Use x.y soname versioning
 - libcamera: camera: Take span of StreamRole instead of vector
 - libcamera: Remove `StreamRoles` alias
 - utils: ipu3-capture.sh: Fix the script to work with recent media-ctl versions
 - Documentation: Add predefined macros from config.h to Doxyfile
 - utils: checkstyle: Add __repr__ method to CommitFile class
 - utils: checkstyle: Support running checkers selectively
 - utils: checkstyle: Don't include commit ID in commit title
 - utils: checkstyle: Add trailers checker
 - tests: gstreamer: Test cameras' enumeration from GstDeviceProvider
 - meson: Fix space around colon issues
 - libcamera: Add option to configure udev support
 - libcamera: CameraManager: Remove ::get(dev_t)
 - tests: gstreamer: Fix compiler error with gcc 8.4.0

ipa:
 - meson: ipa: Add mapping for pipeline handler to mojom interface file
 - libcamera: ipa: Remove character restriction on the IPA name
 - ipa: meson: Allow nested IPA directory structures
 - ipa: raspberrypi: Introduce IpaBase class
 - ipa: raspberrypi: agc: Move weights out of AGC
 - ipa: rkisp1: agc: drop hard-coded analogue gain range
 - libipa: camera_sensor_helper: Add IMX327 helper
 - pipeline: rpi: ipa_base: Parse config files after platformRegister()
 - libcamera: camera_sensor: Add Sony IMX327 sensor properties
 - ipa: rpi: imx296: Small refinements to the IMX296 mono sensor tuning
 - ipa: rpi: Handle controls for mono variant sensors
 - libcamera: controls: Drop reference to IPA in controls documentation
 - libipa: camera_sensor_helper: Restore alphabetical order
 - ipa: ipu3: agc: Drop hard-codec analogue gain max
 - ipa: rkisp1: agc: Restore minimum analogue gain limit
 - pipeline: ipa: rpi: Return lens controls from ipa->configure()
 - ipa: rpi: Set lens position to hyperfocal on startup
 - ipa: rpi: tunings: Add missing short and long exposure profiles
 - ipa: rpi: agc: Use std::string instead of char arrays
 - ipa: rpi: agc: Gracefully handle missing agc modes
 - ipa: rpi: agc: Do not switch to a default if a mode is unavailable
 - ipa: rpi: imx708: Fix mode switch drop frame count
 - ipa: rpi: imx296_mono: Disable all colour shading

pipeline:
 - libcamera: pipeline: simple: Add support for ST's DCMIPP
 - pipeline: meson: Allow nested pipeline handler directory structures
 - pipeline: ipa: raspberrypi: Refactor and move the Raspberry Pi code
 - pipeline: raspberrypi: rpi_stream: Set invalid buffer to id == 0
 - pipeline: ipa: raspberrypi: Restructure the IPA mojom interface
 - pipeline: raspberrypi: Make RPi::Stream::name() return const std::string &
 - pipeline: raspberrypi: Introduce PipelineHandlerBase class
 - pipeline: raspberrypi: Add stream flags to RPi::Stream
 - libcamera: rkisp1: Generate config using main path
 - libcamera: rkisp1: Crop on ISP before downscaling
 - libcamera: rkisp1: Assign sizes to roles
 - libcamera: rkisp1: Fix enumeration of RAW formats
 - pipeline: rpi: Do not return an error from pipeline config file handling
 - libcamera: pipeline: simple: Support TI CSI-RX
 - pipeline: rpi: Account for Bayer packing when validating format

apps:
 - apps: qcam: Remove redundant check
 - v4l2: Move the v4l2 compat layer to libexec/libcamera
 - android: mm: generic: use GRALLOC_HARDWARE_MODULE_ID
 - android: mm: Stub libhardware for build tests
 - py: Fix CameraManager.version property
 - py: Move ColorSpace and Transform classes to separate files
 - py: Use exceptions instead of returning error codes
 - py: unittests.py: Add weakref helpers and use del
 - py: Move to mainline pybind11 version
 - py: Fix code formatting
 - py: unittests.py: Fix type checker warnings
 - gstreamer: Add enable_auto_focus option to the GStreamer plugin
 - gstreamer: Drop libcamera_private dependency
 - apps: Add ipa-verify application
 - v4l2: v4l2_camera_proxy: Prevent ioctl sign-extensions
 - v4l2: Use SystemDevices properties to identify cameras

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-16 12:46:01 +01:00
.reuse pipeline: ipa: raspberrypi: Refactor and move the Raspberry Pi code 2023-05-04 20:47:40 +03:00
Documentation meson: Fix space around colon issues 2023-07-07 11:39:19 +03:00
include libcamera: CameraManager: Remove ::get(dev_t) 2023-07-11 15:19:13 +01:00
LICENSES Documentation: theme: Specify license of search.png 2022-09-30 21:51:14 +03:00
package/gentoo/media-libs/libcamera libcamera: Standardize URLs to git repositories 2021-09-24 13:25:33 +03:00
src libcamera: CameraManager: Remove ::get(dev_t) 2023-07-11 15:19:13 +01:00
subprojects subprojects: Drop leftovers of pybind11 2023-06-04 11:48:00 +03:00
test tests: gstreamer: Fix compiler error with gcc 8.4.0 2023-07-11 15:58:06 +01:00
utils utils: checkstyle: Add trailers checker 2023-07-05 17:11:26 +03:00
.clang-format clang-format: Remove unsupported option 2021-08-27 14:04:21 +01:00
.clang-tidy libcamera: Add missing SPDX headers for miscellaneous CC0-1.0 contents 2022-09-30 21:51:23 +03:00
.gitignore libcamera: Restrict .gitignore build/ and patches/ to the root directory 2021-12-14 12:03:12 +02:00
COPYING.rst libcamera: Summarize licensing terms in COPYING.rst 2020-06-26 15:18:25 +03:00
meson.build libcamera v0.1.0 2023-07-16 12:46:01 +01:00
meson_options.txt libcamera: Add option to configure udev support 2023-07-07 11:39:32 +03:00
README.rst utils: ABI Compatibility checker 2023-07-04 20:25:10 +01:00

.. SPDX-License-Identifier: CC-BY-SA-4.0

.. section-begin-libcamera

===========
 libcamera
===========

**A complex camera support library for Linux, Android, and ChromeOS**

Cameras are complex devices that need heavy hardware image processing
operations. Control of the processing is based on advanced algorithms that must
run on a programmable processor. This has traditionally been implemented in a
dedicated MCU in the camera, but in embedded devices algorithms have been moved
to the main CPU to save cost. Blurring the boundary between camera devices and
Linux often left the user with no other option than a vendor-specific
closed-source solution.

To address this problem the Linux media community has very recently started
collaboration with the industry to develop a camera stack that will be
open-source-friendly while still protecting vendor core IP. libcamera was born
out of that collaboration and will offer modern camera support to Linux-based
systems, including traditional Linux distributions, ChromeOS and Android.

.. section-end-libcamera
.. section-begin-getting-started

Getting Started
---------------

To fetch the sources, build and install:

::

  git clone https://git.libcamera.org/libcamera/libcamera.git
  cd libcamera
  meson setup build
  ninja -C build install

Dependencies
~~~~~~~~~~~~

The following Debian/Ubuntu packages are required for building libcamera.
Other distributions may have differing package names:

A C++ toolchain: [required]
        Either {g++, clang}

Meson Build system: [required]
        meson (>= 0.56) ninja-build pkg-config

        If your distribution doesn't provide a recent enough version of meson,
        you can install or upgrade it using pip3.

        .. code::

            pip3 install --user meson
            pip3 install --user --upgrade meson

for the libcamera core: [required]
        libyaml-dev python3-yaml python3-ply python3-jinja2

for IPA module signing: [recommended]
        Either libgnutls28-dev or libssl-dev, openssl

        Without IPA module signing, all IPA modules will be isolated in a
        separate process. This adds an unnecessary extra overhead at runtime.

for improved debugging: [optional]
        libdw-dev libunwind-dev

        libdw and libunwind provide backtraces to help debugging assertion
        failures. Their functions overlap, libdw provides the most detailed
        information, and libunwind is not needed if both libdw and the glibc
        backtrace() function are available.

for device hotplug enumeration: [optional]
        libudev-dev

for documentation: [optional]
        python3-sphinx doxygen graphviz texlive-latex-extra

for gstreamer: [optional]
        libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

for cam: [optional]
        libevent-dev is required to support cam, however the following
        optional dependencies bring more functionality to the cam test
        tool:

        - libdrm-dev: Enables the KMS sink
        - libjpeg-dev: Enables MJPEG on the SDL sink
        - libsdl2-dev: Enables the SDL sink

for qcam: [optional]
        qtbase5-dev libqt5core5a libqt5gui5 libqt5widgets5 qttools5-dev-tools libtiff-dev

for tracing with lttng: [optional]
        liblttng-ust-dev python3-jinja2 lttng-tools

for android: [optional]
        libexif-dev libjpeg-dev

for lc-compliance: [optional]
        libevent-dev

for abi-compat.sh: [optional]
        abi-compliance-checker

Basic testing with cam utility
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``cam`` utility can be used for basic testing. You can list the cameras
detected on the system with ``cam -l``, and capture ten frames from the first
camera and save them to disk with ``cam -c 1 --capture=10 --file``. See
``cam -h`` for more information about the ``cam`` tool.

In case of problems, a detailed debug log can be obtained from libcamera by
setting the ``LIBCAMERA_LOG_LEVELS`` environment variable:

.. code::

    :~$ LIBCAMERA_LOG_LEVELS=*:DEBUG cam -l

Using GStreamer plugin
~~~~~~~~~~~~~~~~~~~~~~

To use GStreamer plugin from source tree, set the following environment so that
GStreamer can find it. This isn't necessary when libcamera is installed.

  export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer

The debugging tool ``gst-launch-1.0`` can be used to construct a pipeline and
test it. The following pipeline will stream from the camera named "Camera 1"
onto the OpenGL accelerated display element on your system.

.. code::

  gst-launch-1.0 libcamerasrc camera-name="Camera 1" ! glimagesink

To show the first camera found you can omit the camera-name property, or you
can list the cameras and their capabilities using:

.. code::

  gst-device-monitor-1.0 Video

This will also show the supported stream sizes which can be manually selected
if desired with a pipeline such as:

.. code::

  gst-launch-1.0 libcamerasrc ! 'video/x-raw,width=1280,height=720' ! \
        glimagesink

The libcamerasrc element has two log categories, named libcamera-provider (for
the video device provider) and libcamerasrc (for the operation of the camera).
All corresponding debug messages can be enabled by setting the ``GST_DEBUG``
environment variable to ``libcamera*:7``.

Presently, to prevent element negotiation failures it is required to specify
the colorimetry and framerate as part of your pipeline construction. For
instance, to capture and encode as a JPEG stream and receive on another device
the following example could be used as a starting point:

.. code::

   gst-launch-1.0 libcamerasrc ! \
        video/x-raw,colorimetry=bt709,format=NV12,width=1280,height=720,framerate=30/1 ! \
        jpegenc ! multipartmux ! \
        tcpserversink host=0.0.0.0 port=5000

Which can be received on another device over the network with:

.. code::

   gst-launch-1.0 tcpclientsrc host=$DEVICE_IP port=5000 ! \
        multipartdemux ! jpegdec ! autovideosink

.. section-end-getting-started

Troubleshooting
~~~~~~~~~~~~~~~

Several users have reported issues with meson installation, crux of the issue
is a potential version mismatch between the version that root uses, and the
version that the normal user uses. On calling `ninja -C build`, it can't find
the build.ninja module. This is a snippet of the error message.

::

  ninja: Entering directory `build'
  ninja: error: loading 'build.ninja': No such file or directory

This can be solved in two ways:

1) Don't install meson again if it is already installed system-wide.

2) If a version of meson which is different from the system-wide version is
already installed, uninstall that meson using pip3, and install again without
the --user argument.