android: Add soong blueprint makefiles generated by ninja-to-soong

This commit is contained in:
Konsta
2026-04-30 16:13:20 +03:00
parent 8bf59a6bbd
commit 2c3d3b6185
22 changed files with 9996 additions and 0 deletions

409
Android.bp Normal file
View File

@@ -0,0 +1,409 @@
//
// This file has been auto-generated by ninja-to-soong
//
// ******************************
// *** DO NOT MODIFY MANUALLY ***
// ******************************
//
// https://github.com/rjodinchr/ninja-to-soong
//
package {
default_visibility: ["//visibility:public"],
default_applicable_licenses: ["libcamera_rpi_licenses"],
}
license {
name: "libcamera_rpi_licenses",
visibility: [":__subpackages__"],
license_kinds: ["SPDX-license-identifier-LGPL-2.1-or-later"],
}
cc_library_shared {
name: "libcamera",
srcs: [
"meson_generated/src/libcamera/*.cpp",
"meson_generated/src/libcamera/proxy/raspberrypi_ipa_proxy.cpp",
"src/libcamera/bayer_format.cpp",
"src/libcamera/byte_stream_buffer.cpp",
"src/libcamera/camera.cpp",
"src/libcamera/camera_controls.cpp",
"src/libcamera/camera_lens.cpp",
"src/libcamera/camera_manager.cpp",
"src/libcamera/clock_recovery.cpp",
"src/libcamera/color_space.cpp",
"src/libcamera/control_serializer.cpp",
"src/libcamera/control_validator.cpp",
"src/libcamera/controls.cpp",
"src/libcamera/converter.cpp",
"src/libcamera/converter/*.cpp",
"src/libcamera/debug_controls.cpp",
"src/libcamera/delayed_controls.cpp",
"src/libcamera/device_enumerator.cpp",
"src/libcamera/device_enumerator_sysfs.cpp",
"src/libcamera/dma_buf_allocator.cpp",
"src/libcamera/fence.cpp",
"src/libcamera/formats.cpp",
"src/libcamera/framebuffer.cpp",
"src/libcamera/framebuffer_allocator.cpp",
"src/libcamera/geometry.cpp",
"src/libcamera/global_configuration.cpp",
"src/libcamera/ipa_controls.cpp",
"src/libcamera/ipa_data_serializer.cpp",
"src/libcamera/ipa_interface.cpp",
"src/libcamera/ipa_manager.cpp",
"src/libcamera/ipa_module.cpp",
"src/libcamera/ipa_proxy.cpp",
"src/libcamera/ipc_pipe.cpp",
"src/libcamera/ipc_pipe_unixsocket.cpp",
"src/libcamera/ipc_unixsocket.cpp",
"src/libcamera/mapped_framebuffer.cpp",
"src/libcamera/matrix.cpp",
"src/libcamera/media_device.cpp",
"src/libcamera/media_object.cpp",
"src/libcamera/media_pipeline.cpp",
"src/libcamera/orientation.cpp",
"src/libcamera/pipeline/rpi/common/*.cpp",
"src/libcamera/pipeline/rpi/pisp/pisp.cpp",
"src/libcamera/pipeline/rpi/vc4/vc4.cpp",
"src/libcamera/pipeline_handler.cpp",
"src/libcamera/pixel_format.cpp",
"src/libcamera/process.cpp",
"src/libcamera/pub_key.cpp",
"src/libcamera/request.cpp",
"src/libcamera/sensor/*.cpp",
"src/libcamera/shared_mem_object.cpp",
"src/libcamera/source_paths.cpp",
"src/libcamera/stream.cpp",
"src/libcamera/sysfs.cpp",
"src/libcamera/transform.cpp",
"src/libcamera/v4l2_device.cpp",
"src/libcamera/v4l2_pixelformat.cpp",
"src/libcamera/v4l2_request.cpp",
"src/libcamera/v4l2_subdevice.cpp",
"src/libcamera/v4l2_videodevice.cpp",
"src/libcamera/value_node.cpp",
"src/libcamera/vector.cpp",
"src/libcamera/yaml_parser.cpp",
],
cflags: [
"-DLIBCAMERA_BASE_PRIVATE",
"-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST",
"-Wextra-semi",
"-Wnon-virtual-dtor",
"-Wthread-safety",
"-std=c++20",
],
shared_libs: [
"libcamera-base",
"libpisp",
],
static_libs: ["libyaml"],
local_include_dirs: [
"include",
"meson_generated/include",
"meson_generated/include/libcamera",
"meson_generated/include/libcamera/internal",
"meson_generated/include/libcamera/ipa",
"meson_generated/src/libcamera",
"meson_generated/src/libcamera/proxy",
"src/libcamera",
],
soc_specific: true,
header_libs: ["libpisp_headers"],
defaults: ["libcamera-rpi-defaults"],
}
cc_library_shared {
name: "libcamera-base",
srcs: ["src/libcamera/base/*.cpp"],
cflags: [
"-DLIBCAMERA_BASE_PRIVATE",
"-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST",
"-Wextra-semi",
"-Wnon-virtual-dtor",
"-Wthread-safety",
"-pthread",
"-std=c++20",
],
local_include_dirs: [
"include",
"meson_generated/include",
"src/libcamera/base",
],
soc_specific: true,
defaults: ["libcamera-rpi-defaults"],
}
cc_library_shared {
name: "ipa_rpi_vc4",
srcs: ["src/ipa/rpi/vc4/vc4.cpp"],
cflags: [
"-DLIBCAMERA_BASE_PRIVATE",
"-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST",
"-Wextra-semi",
"-Wnon-virtual-dtor",
"-Wthread-safety",
"-std=c++20",
],
shared_libs: [
"libcamera",
"libcamera-base",
],
static_libs: ["libcamera-rpi_src_ipa_libipa_libipa_a"],
whole_static_libs: [
"libcamera-rpi_src_ipa_rpi_cam_helper_librpi_ipa_cam_helper_a",
"libcamera-rpi_src_ipa_rpi_common_librpi_ipa_common_a",
"libcamera-rpi_src_ipa_rpi_controller_librpi_ipa_controller_a",
],
local_include_dirs: [
"include",
"meson_generated/include",
"meson_generated/include/libcamera",
"meson_generated/include/libcamera/ipa",
"src/ipa",
"src/ipa/rpi",
"src/ipa/rpi/vc4",
],
soc_specific: true,
relative_install_path: "libcamera/ipa",
defaults: ["libcamera-rpi-defaults"],
}
cc_library_static {
name: "libcamera-rpi_src_ipa_rpi_controller_librpi_ipa_controller_a",
srcs: [
"src/ipa/rpi/controller/*.cpp",
"src/ipa/rpi/controller/rpi/af.cpp",
"src/ipa/rpi/controller/rpi/agc.cpp",
"src/ipa/rpi/controller/rpi/agc_channel.cpp",
"src/ipa/rpi/controller/rpi/alsc.cpp",
"src/ipa/rpi/controller/rpi/awb.cpp",
"src/ipa/rpi/controller/rpi/awb_bayes.cpp",
"src/ipa/rpi/controller/rpi/black_level.cpp",
"src/ipa/rpi/controller/rpi/cac.cpp",
"src/ipa/rpi/controller/rpi/ccm.cpp",
"src/ipa/rpi/controller/rpi/contrast.cpp",
"src/ipa/rpi/controller/rpi/decompand.cpp",
"src/ipa/rpi/controller/rpi/denoise.cpp",
"src/ipa/rpi/controller/rpi/dpc.cpp",
"src/ipa/rpi/controller/rpi/geq.cpp",
"src/ipa/rpi/controller/rpi/hdr.cpp",
"src/ipa/rpi/controller/rpi/lux.cpp",
"src/ipa/rpi/controller/rpi/noise.cpp",
"src/ipa/rpi/controller/rpi/saturation.cpp",
"src/ipa/rpi/controller/rpi/sdn.cpp",
"src/ipa/rpi/controller/rpi/sharpen.cpp",
"src/ipa/rpi/controller/rpi/tonemap.cpp",
],
cflags: [
"-DLIBCAMERA_BASE_PRIVATE",
"-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST",
"-Wextra-semi",
"-Wnon-virtual-dtor",
"-Wthread-safety",
"-std=c++20",
],
local_include_dirs: [
"include",
"meson_generated/include",
"meson_generated/include/libcamera",
"meson_generated/include/libcamera/ipa",
"src/ipa",
"src/ipa/rpi/controller",
],
defaults: ["libcamera-rpi-defaults"],
}
cc_library_static {
name: "libcamera-rpi_src_ipa_rpi_common_librpi_ipa_common_a",
srcs: ["src/ipa/rpi/common/ipa_base.cpp"],
cflags: [
"-DLIBCAMERA_BASE_PRIVATE",
"-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST",
"-Wextra-semi",
"-Wnon-virtual-dtor",
"-Wthread-safety",
"-std=c++20",
],
local_include_dirs: [
"include",
"meson_generated/include",
"meson_generated/include/libcamera",
"meson_generated/include/libcamera/ipa",
"src/ipa/rpi",
"src/ipa/rpi/common",
],
defaults: ["libcamera-rpi-defaults"],
}
cc_library_static {
name: "libcamera-rpi_src_ipa_rpi_cam_helper_librpi_ipa_cam_helper_a",
srcs: [
"src/ipa/rpi/cam_helper/*.cpp",
"src/ipa/rpi/cam_helper/imx500_tensor_parser/imx500_tensor_parser.cpp",
],
cflags: [
"-DLIBCAMERA_BASE_PRIVATE",
"-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST",
"-Wextra-semi",
"-Wnon-virtual-dtor",
"-Wthread-safety",
"-std=c++20",
],
local_include_dirs: [
"include",
"meson_generated/include",
"meson_generated/include/libcamera",
"meson_generated/include/libcamera/ipa",
"src/ipa/rpi",
"src/ipa/rpi/cam_helper",
],
defaults: ["libcamera-rpi-defaults"],
}
cc_library_static {
name: "libcamera-rpi_src_ipa_libipa_libipa_a",
srcs: ["src/ipa/libipa/*.cpp"],
cflags: [
"-DLIBCAMERA_BASE_PRIVATE",
"-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST",
"-Wextra-semi",
"-Wnon-virtual-dtor",
"-Wthread-safety",
"-std=c++20",
],
local_include_dirs: [
"include",
"meson_generated/include",
"meson_generated/include/libcamera",
"meson_generated/include/libcamera/ipa",
"src/ipa/libipa",
],
defaults: ["libcamera-rpi-defaults"],
}
cc_library_shared {
name: "ipa_rpi_pisp",
srcs: ["src/ipa/rpi/pisp/pisp.cpp"],
cflags: [
"-DLIBCAMERA_BASE_PRIVATE",
"-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST",
"-Wextra-semi",
"-Wno-address-of-packed-member",
"-Wnon-virtual-dtor",
"-Wthread-safety",
"-std=c++20",
],
shared_libs: [
"libcamera",
"libcamera-base",
"libpisp",
],
static_libs: ["libcamera-rpi_src_ipa_libipa_libipa_a"],
whole_static_libs: [
"libcamera-rpi_src_ipa_rpi_cam_helper_librpi_ipa_cam_helper_a",
"libcamera-rpi_src_ipa_rpi_common_librpi_ipa_common_a",
"libcamera-rpi_src_ipa_rpi_controller_librpi_ipa_controller_a",
],
local_include_dirs: [
"include",
"meson_generated/include",
"meson_generated/include/libcamera",
"meson_generated/include/libcamera/ipa",
"src/ipa",
"src/ipa/rpi",
"src/ipa/rpi/pisp",
],
soc_specific: true,
relative_install_path: "libcamera/ipa",
header_libs: ["libpisp_headers"],
defaults: ["libcamera-rpi-defaults"],
}
cc_library_shared {
name: "camera.libcamera",
srcs: [
"src/android/*.cpp",
"src/android/jpeg/encoder_libjpeg.cpp",
"src/android/jpeg/exif.cpp",
"src/android/jpeg/post_processor_jpeg.cpp",
"src/android/jpeg/thumbnailer.cpp",
"src/android/mm/generic_camera_buffer.cpp",
"src/android/mm/generic_frame_buffer_allocator.cpp",
"src/android/mm/graphic_buffer_allocator_stub.cpp",
"src/android/yuv/post_processor_yuv.cpp",
],
cflags: [
"-DHAVE_LIBJPEG",
"-DLIBCAMERA_BASE_PRIVATE",
"-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST",
"-Wextra-semi",
"-Wnon-virtual-dtor",
"-Wthread-safety",
"-std=c++20",
],
shared_libs: [
"libcamera",
"libcamera-base",
"libexif",
"libjpeg",
"libyuv_chromium",
],
static_libs: ["libcamera-rpi_src_android_libcamera_metadata_a"],
local_include_dirs: [
"include",
"include/android/frameworks/native/libs/ui/include",
"include/android/hardware/libhardware/include",
"include/android/metadata",
"include/android/system/core/include",
"include/android/system/core/libutils/include",
"meson_generated/include",
"meson_generated/include/libcamera",
"meson_generated/include/libcamera/ipa",
"src/android",
],
soc_specific: true,
relative_install_path: "hw",
defaults: ["libcamera-rpi-defaults"],
}
cc_library_static {
name: "libcamera-rpi_src_android_libcamera_metadata_a",
srcs: ["src/android/metadata/camera_metadata.c"],
cflags: ["-Wno-shadow"],
local_include_dirs: [
"include/android/frameworks/native/libs/ui/include",
"include/android/hardware/libhardware/include",
"include/android/metadata",
"include/android/system/core/include",
"include/android/system/core/libutils/include",
"src/android",
],
defaults: ["libcamera-rpi-defaults"],
}
cc_defaults {
name: "libcamera-rpi-defaults",
cflags: [
"-D_FILE_OFFSET_BITS=64",
"-D_FORTIFY_SOURCE=2",
"-O3",
"-Wall",
"-Wextra",
"-Winvalid-pch",
"-Wmissing-declarations",
"-Wno-c99-designator",
"-Wno-macro-redefined",
"-Wshadow",
"-fPIC",
"-fdiagnostics-color=always",
],
defaults: ["libcamera-rpi-raw-defaults"],
}
cc_defaults {
name: "libcamera-rpi-raw-defaults",
cflags: ["-include meson_generated/config.h"],
rtti: true,
}

31
meson_generated/config.h Normal file
View File

@@ -0,0 +1,31 @@
/*
* Autogenerated by the Meson build system.
* Do not edit, your changes will be lost.
*/
#pragma once
#define HAVE_BACKTRACE 1
#define HAVE_CLOSE_RANGE 1
#define HAVE_FILE_SEALS 1
#define HAVE_IPA_PUBKEY 1
#define HAVE_LOCALE_T 1
#define HAVE_MEMFD_CREATE 1
#define HAVE_POSIX_IOCTL 1
#define IPA_CONFIG_DIR "/vendor/etc/libcamera/ipa:/usr/local/share/libcamera/ipa"
#define IPA_MODULE_DIR "/usr/local/lib/libcamera/ipa"
#define IPA_PROXY_DIR "/usr/local/libexec/libcamera"
#define LIBCAMERA_DATA_DIR "/usr/local/share/libcamera"
#define LIBCAMERA_SYSCONF_DIR "/vendor/etc/libcamera"

View File

@@ -0,0 +1,513 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* Controls ID list
*
* This file is auto-generated. Do not edit.
*/
#pragma once
#include <array>
#include <map>
#include <stdint.h>
#include <string>
#include <string_view>
#include <libcamera/controls.h>
namespace libcamera {
namespace controls {
extern const ControlIdMap controls;
enum {
AE_ENABLE = 1,
AE_STATE = 2,
AE_METERING_MODE = 3,
AE_CONSTRAINT_MODE = 4,
AE_EXPOSURE_MODE = 5,
EXPOSURE_VALUE = 6,
EXPOSURE_TIME = 7,
EXPOSURE_TIME_MODE = 8,
ANALOGUE_GAIN = 9,
ANALOGUE_GAIN_MODE = 10,
AE_FLICKER_MODE = 11,
AE_FLICKER_PERIOD = 12,
AE_FLICKER_DETECTED = 13,
BRIGHTNESS = 14,
CONTRAST = 15,
LUX = 16,
AWB_ENABLE = 17,
AWB_MODE = 18,
AWB_LOCKED = 19,
COLOUR_GAINS = 20,
COLOUR_TEMPERATURE = 21,
SATURATION = 22,
SENSOR_BLACK_LEVELS = 23,
SHARPNESS = 24,
FOCUS_FO_M = 25,
COLOUR_CORRECTION_MATRIX = 26,
SCALER_CROP = 27,
DIGITAL_GAIN = 28,
FRAME_DURATION = 29,
FRAME_DURATION_LIMITS = 30,
SENSOR_TEMPERATURE = 31,
SENSOR_TIMESTAMP = 32,
AF_MODE = 33,
AF_RANGE = 34,
AF_SPEED = 35,
AF_METERING = 36,
AF_WINDOWS = 37,
AF_TRIGGER = 38,
AF_PAUSE = 39,
LENS_POSITION = 40,
AF_STATE = 41,
AF_PAUSE_STATE = 42,
HDR_MODE = 43,
HDR_CHANNEL = 44,
GAMMA = 45,
DEBUG_METADATA_ENABLE = 46,
FRAME_WALL_CLOCK = 47,
WDR_MODE = 48,
WDR_STRENGTH = 49,
WDR_MAX_BRIGHT_PIXELS = 50,
LENS_DEWARP_ENABLE = 51,
LENS_SHADING_CORRECTION_ENABLE = 52,
HUE = 53,
};
extern const Control<bool> AeEnable;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AE_ENABLE
enum AeStateEnum {
AeStateIdle = 0,
AeStateSearching = 1,
AeStateConverged = 2,
};
extern const std::array<const ControlValue, 3> AeStateValues;
extern const std::map<std::string, int32_t> AeStateNameValueMap;
extern const Control<int32_t> AeState;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AE_STATE
enum AeMeteringModeEnum {
MeteringCentreWeighted = 0,
MeteringSpot = 1,
MeteringMatrix = 2,
MeteringCustom = 3,
};
extern const std::array<const ControlValue, 4> AeMeteringModeValues;
extern const std::map<std::string, int32_t> AeMeteringModeNameValueMap;
extern const Control<int32_t> AeMeteringMode;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AE_METERING_MODE
enum AeConstraintModeEnum {
ConstraintNormal = 0,
ConstraintHighlight = 1,
ConstraintShadows = 2,
ConstraintCustom = 3,
};
extern const std::array<const ControlValue, 4> AeConstraintModeValues;
extern const std::map<std::string, int32_t> AeConstraintModeNameValueMap;
extern const Control<int32_t> AeConstraintMode;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AE_CONSTRAINT_MODE
enum AeExposureModeEnum {
ExposureNormal = 0,
ExposureShort = 1,
ExposureLong = 2,
ExposureCustom = 3,
};
extern const std::array<const ControlValue, 4> AeExposureModeValues;
extern const std::map<std::string, int32_t> AeExposureModeNameValueMap;
extern const Control<int32_t> AeExposureMode;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AE_EXPOSURE_MODE
extern const Control<float> ExposureValue;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_EXPOSURE_VALUE
extern const Control<int32_t> ExposureTime;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_EXPOSURE_TIME
enum ExposureTimeModeEnum {
ExposureTimeModeAuto = 0,
ExposureTimeModeManual = 1,
};
extern const std::array<const ControlValue, 2> ExposureTimeModeValues;
extern const std::map<std::string, int32_t> ExposureTimeModeNameValueMap;
extern const Control<int32_t> ExposureTimeMode;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_EXPOSURE_TIME_MODE
extern const Control<float> AnalogueGain;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_ANALOGUE_GAIN
enum AnalogueGainModeEnum {
AnalogueGainModeAuto = 0,
AnalogueGainModeManual = 1,
};
extern const std::array<const ControlValue, 2> AnalogueGainModeValues;
extern const std::map<std::string, int32_t> AnalogueGainModeNameValueMap;
extern const Control<int32_t> AnalogueGainMode;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_ANALOGUE_GAIN_MODE
enum AeFlickerModeEnum {
FlickerOff = 0,
FlickerManual = 1,
FlickerAuto = 2,
};
extern const std::array<const ControlValue, 3> AeFlickerModeValues;
extern const std::map<std::string, int32_t> AeFlickerModeNameValueMap;
extern const Control<int32_t> AeFlickerMode;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AE_FLICKER_MODE
extern const Control<int32_t> AeFlickerPeriod;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AE_FLICKER_PERIOD
extern const Control<int32_t> AeFlickerDetected;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AE_FLICKER_DETECTED
extern const Control<float> Brightness;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_BRIGHTNESS
extern const Control<float> Contrast;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_CONTRAST
extern const Control<float> Lux;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_LUX
extern const Control<bool> AwbEnable;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AWB_ENABLE
enum AwbModeEnum {
AwbAuto = 0,
AwbIncandescent = 1,
AwbTungsten = 2,
AwbFluorescent = 3,
AwbIndoor = 4,
AwbDaylight = 5,
AwbCloudy = 6,
AwbCustom = 7,
};
extern const std::array<const ControlValue, 8> AwbModeValues;
extern const std::map<std::string, int32_t> AwbModeNameValueMap;
extern const Control<int32_t> AwbMode;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AWB_MODE
extern const Control<bool> AwbLocked;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AWB_LOCKED
extern const Control<Span<const float, 2>> ColourGains;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_COLOUR_GAINS
extern const Control<int32_t> ColourTemperature;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_COLOUR_TEMPERATURE
extern const Control<float> Saturation;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_SATURATION
extern const Control<Span<const int32_t, 4>> SensorBlackLevels;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_SENSOR_BLACK_LEVELS
extern const Control<float> Sharpness;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_SHARPNESS
extern const Control<int32_t> FocusFoM;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_FOCUS_FO_M
extern const Control<Span<const float, 9>> ColourCorrectionMatrix;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_COLOUR_CORRECTION_MATRIX
extern const Control<Rectangle> ScalerCrop;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_SCALER_CROP
extern const Control<float> DigitalGain;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_DIGITAL_GAIN
extern const Control<int64_t> FrameDuration;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_FRAME_DURATION
extern const Control<Span<const int64_t, 2>> FrameDurationLimits;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_FRAME_DURATION_LIMITS
extern const Control<float> SensorTemperature;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_SENSOR_TEMPERATURE
extern const Control<int64_t> SensorTimestamp;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_SENSOR_TIMESTAMP
enum AfModeEnum {
AfModeManual = 0,
AfModeAuto = 1,
AfModeContinuous = 2,
};
extern const std::array<const ControlValue, 3> AfModeValues;
extern const std::map<std::string, int32_t> AfModeNameValueMap;
extern const Control<int32_t> AfMode;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AF_MODE
enum AfRangeEnum {
AfRangeNormal = 0,
AfRangeMacro = 1,
AfRangeFull = 2,
};
extern const std::array<const ControlValue, 3> AfRangeValues;
extern const std::map<std::string, int32_t> AfRangeNameValueMap;
extern const Control<int32_t> AfRange;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AF_RANGE
enum AfSpeedEnum {
AfSpeedNormal = 0,
AfSpeedFast = 1,
};
extern const std::array<const ControlValue, 2> AfSpeedValues;
extern const std::map<std::string, int32_t> AfSpeedNameValueMap;
extern const Control<int32_t> AfSpeed;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AF_SPEED
enum AfMeteringEnum {
AfMeteringAuto = 0,
AfMeteringWindows = 1,
};
extern const std::array<const ControlValue, 2> AfMeteringValues;
extern const std::map<std::string, int32_t> AfMeteringNameValueMap;
extern const Control<int32_t> AfMetering;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AF_METERING
extern const Control<Span<const Rectangle>> AfWindows;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AF_WINDOWS
enum AfTriggerEnum {
AfTriggerStart = 0,
AfTriggerCancel = 1,
};
extern const std::array<const ControlValue, 2> AfTriggerValues;
extern const std::map<std::string, int32_t> AfTriggerNameValueMap;
extern const Control<int32_t> AfTrigger;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AF_TRIGGER
enum AfPauseEnum {
AfPauseImmediate = 0,
AfPauseDeferred = 1,
AfPauseResume = 2,
};
extern const std::array<const ControlValue, 3> AfPauseValues;
extern const std::map<std::string, int32_t> AfPauseNameValueMap;
extern const Control<int32_t> AfPause;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AF_PAUSE
extern const Control<float> LensPosition;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_LENS_POSITION
enum AfStateEnum {
AfStateIdle = 0,
AfStateScanning = 1,
AfStateFocused = 2,
AfStateFailed = 3,
};
extern const std::array<const ControlValue, 4> AfStateValues;
extern const std::map<std::string, int32_t> AfStateNameValueMap;
extern const Control<int32_t> AfState;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AF_STATE
enum AfPauseStateEnum {
AfPauseStateRunning = 0,
AfPauseStatePausing = 1,
AfPauseStatePaused = 2,
};
extern const std::array<const ControlValue, 3> AfPauseStateValues;
extern const std::map<std::string, int32_t> AfPauseStateNameValueMap;
extern const Control<int32_t> AfPauseState;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_AF_PAUSE_STATE
enum HdrModeEnum {
HdrModeOff = 0,
HdrModeMultiExposureUnmerged = 1,
HdrModeMultiExposure = 2,
HdrModeSingleExposure = 3,
HdrModeNight = 4,
};
extern const std::array<const ControlValue, 5> HdrModeValues;
extern const std::map<std::string, int32_t> HdrModeNameValueMap;
extern const Control<int32_t> HdrMode;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_HDR_MODE
enum HdrChannelEnum {
HdrChannelNone = 0,
HdrChannelShort = 1,
HdrChannelMedium = 2,
HdrChannelLong = 3,
};
extern const std::array<const ControlValue, 4> HdrChannelValues;
extern const std::map<std::string, int32_t> HdrChannelNameValueMap;
extern const Control<int32_t> HdrChannel;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_HDR_CHANNEL
extern const Control<float> Gamma;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_GAMMA
extern const Control<bool> DebugMetadataEnable;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_DEBUG_METADATA_ENABLE
extern const Control<int64_t> FrameWallClock;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_FRAME_WALL_CLOCK
enum WdrModeEnum {
WdrOff = 0,
WdrLinear = 1,
WdrPower = 2,
WdrExponential = 3,
WdrHistogramEqualization = 4,
};
extern const std::array<const ControlValue, 5> WdrModeValues;
extern const std::map<std::string, int32_t> WdrModeNameValueMap;
extern const Control<int32_t> WdrMode;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_WDR_MODE
extern const Control<float> WdrStrength;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_WDR_STRENGTH
extern const Control<float> WdrMaxBrightPixels;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_WDR_MAX_BRIGHT_PIXELS
extern const Control<bool> LensDewarpEnable;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_LENS_DEWARP_ENABLE
extern const Control<bool> LensShadingCorrectionEnable;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_LENS_SHADING_CORRECTION_ENABLE
extern const Control<float> Hue;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_CONTROLS_HUE
namespace draft {
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS
enum {
AE_PRECAPTURE_TRIGGER = 10001,
NOISE_REDUCTION_MODE = 10002,
COLOR_CORRECTION_ABERRATION_MODE = 10003,
AWB_STATE = 10004,
SENSOR_ROLLING_SHUTTER_SKEW = 10005,
LENS_SHADING_MAP_MODE = 10006,
PIPELINE_DEPTH = 10007,
MAX_LATENCY = 10008,
TEST_PATTERN_MODE = 10009,
FACE_DETECT_MODE = 10010,
FACE_DETECT_FACE_RECTANGLES = 10011,
FACE_DETECT_FACE_SCORES = 10012,
FACE_DETECT_FACE_LANDMARKS = 10013,
FACE_DETECT_FACE_IDS = 10014,
};
enum AePrecaptureTriggerEnum {
AePrecaptureTriggerIdle = 0,
AePrecaptureTriggerStart = 1,
AePrecaptureTriggerCancel = 2,
};
extern const std::array<const ControlValue, 3> AePrecaptureTriggerValues;
extern const std::map<std::string, int32_t> AePrecaptureTriggerNameValueMap;
extern const Control<int32_t> AePrecaptureTrigger;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_AE_PRECAPTURE_TRIGGER
enum NoiseReductionModeEnum {
NoiseReductionModeOff = 0,
NoiseReductionModeFast = 1,
NoiseReductionModeHighQuality = 2,
NoiseReductionModeMinimal = 3,
NoiseReductionModeZSL = 4,
};
extern const std::array<const ControlValue, 5> NoiseReductionModeValues;
extern const std::map<std::string, int32_t> NoiseReductionModeNameValueMap;
extern const Control<int32_t> NoiseReductionMode;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_NOISE_REDUCTION_MODE
enum ColorCorrectionAberrationModeEnum {
ColorCorrectionAberrationOff = 0,
ColorCorrectionAberrationFast = 1,
ColorCorrectionAberrationHighQuality = 2,
};
extern const std::array<const ControlValue, 3> ColorCorrectionAberrationModeValues;
extern const std::map<std::string, int32_t> ColorCorrectionAberrationModeNameValueMap;
extern const Control<int32_t> ColorCorrectionAberrationMode;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_COLOR_CORRECTION_ABERRATION_MODE
enum AwbStateEnum {
AwbStateInactive = 0,
AwbStateSearching = 1,
AwbConverged = 2,
AwbLocked = 3,
};
extern const std::array<const ControlValue, 4> AwbStateValues;
extern const std::map<std::string, int32_t> AwbStateNameValueMap;
extern const Control<int32_t> AwbState;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_AWB_STATE
extern const Control<int64_t> SensorRollingShutterSkew;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_SENSOR_ROLLING_SHUTTER_SKEW
enum LensShadingMapModeEnum {
LensShadingMapModeOff = 0,
LensShadingMapModeOn = 1,
};
extern const std::array<const ControlValue, 2> LensShadingMapModeValues;
extern const std::map<std::string, int32_t> LensShadingMapModeNameValueMap;
extern const Control<int32_t> LensShadingMapMode;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_LENS_SHADING_MAP_MODE
extern const Control<int32_t> PipelineDepth;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_PIPELINE_DEPTH
extern const Control<int32_t> MaxLatency;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_MAX_LATENCY
enum TestPatternModeEnum {
TestPatternModeOff = 0,
TestPatternModeSolidColor = 1,
TestPatternModeColorBars = 2,
TestPatternModeColorBarsFadeToGray = 3,
TestPatternModePn9 = 4,
TestPatternModeCustom1 = 256,
};
extern const std::array<const ControlValue, 6> TestPatternModeValues;
extern const std::map<std::string, int32_t> TestPatternModeNameValueMap;
extern const Control<int32_t> TestPatternMode;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_TEST_PATTERN_MODE
enum FaceDetectModeEnum {
FaceDetectModeOff = 0,
FaceDetectModeSimple = 1,
FaceDetectModeFull = 2,
};
extern const std::array<const ControlValue, 3> FaceDetectModeValues;
extern const std::map<std::string, int32_t> FaceDetectModeNameValueMap;
extern const Control<int32_t> FaceDetectMode;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_FACE_DETECT_MODE
extern const Control<Span<const Rectangle>> FaceDetectFaceRectangles;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_FACE_DETECT_FACE_RECTANGLES
extern const Control<Span<const uint8_t>> FaceDetectFaceScores;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_FACE_DETECT_FACE_SCORES
extern const Control<Span<const Point>> FaceDetectFaceLandmarks;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_FACE_DETECT_FACE_LANDMARKS
extern const Control<Span<const int32_t>> FaceDetectFaceIds;
#define LIBCAMERA_HAS_DRAFT_VENDOR_CONTROLS_FACE_DETECT_FACE_IDS
} /* namespace draft */
namespace rpi {
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS
enum {
STATS_OUTPUT_ENABLE = 20001,
BCM2835_STATS_OUTPUT = 20002,
SCALER_CROPS = 20003,
PISP_STATS_OUTPUT = 20004,
SYNC_MODE = 20005,
SYNC_READY = 20006,
SYNC_TIMER = 20007,
SYNC_FRAMES = 20008,
CNN_OUTPUT_TENSOR = 20009,
CNN_OUTPUT_TENSOR_INFO = 20010,
CNN_ENABLE_INPUT_TENSOR = 20011,
CNN_INPUT_TENSOR = 20012,
CNN_INPUT_TENSOR_INFO = 20013,
CNN_KPI_INFO = 20014,
};
extern const Control<bool> StatsOutputEnable;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_STATS_OUTPUT_ENABLE
extern const Control<Span<const uint8_t>> Bcm2835StatsOutput;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_BCM2835_STATS_OUTPUT
extern const Control<Span<const Rectangle>> ScalerCrops;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_SCALER_CROPS
extern const Control<Span<const uint8_t>> PispStatsOutput;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_PISP_STATS_OUTPUT
enum SyncModeEnum {
SyncModeOff = 0,
SyncModeServer = 1,
SyncModeClient = 2,
};
extern const std::array<const ControlValue, 3> SyncModeValues;
extern const std::map<std::string, int32_t> SyncModeNameValueMap;
extern const Control<int32_t> SyncMode;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_SYNC_MODE
extern const Control<bool> SyncReady;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_SYNC_READY
extern const Control<int64_t> SyncTimer;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_SYNC_TIMER
extern const Control<int32_t> SyncFrames;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_SYNC_FRAMES
extern const Control<Span<const float>> CnnOutputTensor;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_CNN_OUTPUT_TENSOR
extern const Control<Span<const uint8_t>> CnnOutputTensorInfo;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_CNN_OUTPUT_TENSOR_INFO
extern const Control<bool> CnnEnableInputTensor;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_CNN_ENABLE_INPUT_TENSOR
extern const Control<Span<const uint8_t>> CnnInputTensor;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_CNN_INPUT_TENSOR
extern const Control<Span<const uint8_t>> CnnInputTensorInfo;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_CNN_INPUT_TENSOR_INFO
extern const Control<Span<const int32_t, 2>> CnnKpiInfo;
#define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS_CNN_KPI_INFO
} /* namespace rpi */
namespace debug {
#define LIBCAMERA_HAS_DEBUG_VENDOR_CONTROLS
} /* namespace debug */
} /* namespace controls */
} /* namespace libcamera */

View File

@@ -0,0 +1,124 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* Formats
*
* This file is auto-generated. Do not edit.
*/
#pragma once
#include <stdint.h>
#include <libcamera/pixel_format.h>
namespace libcamera {
namespace formats {
namespace {
constexpr uint32_t __fourcc(char a, char b, char c, char d)
{
return (static_cast<uint32_t>(a) << 0) |
(static_cast<uint32_t>(b) << 8) |
(static_cast<uint32_t>(c) << 16) |
(static_cast<uint32_t>(d) << 24);
}
constexpr uint64_t __mod(unsigned int vendor, unsigned int mod)
{
return (static_cast<uint64_t>(vendor) << 56) |
(static_cast<uint64_t>(mod) << 0);
}
constexpr uint32_t kDrmFormatBigEndian = uint32_t(1) << 31; /* DRM_FORMAT_BIG_ENDIAN */
} /* namespace */
constexpr PixelFormat R8(__fourcc('R', '8', ' ', ' '), __mod(0, 0));
constexpr PixelFormat R10(__fourcc('R', '1', '0', ' '), __mod(0, 0));
constexpr PixelFormat R12(__fourcc('R', '1', '2', ' '), __mod(0, 0));
constexpr PixelFormat R16(__fourcc('R', '1', '6', ' '), __mod(0, 0));
constexpr PixelFormat RGB565(__fourcc('R', 'G', '1', '6'), __mod(0, 0));
constexpr PixelFormat RGB565_BE(__fourcc('R', 'G', '1', '6') | kDrmFormatBigEndian, __mod(0, 0));
constexpr PixelFormat RGB888(__fourcc('R', 'G', '2', '4'), __mod(0, 0));
constexpr PixelFormat BGR888(__fourcc('B', 'G', '2', '4'), __mod(0, 0));
constexpr PixelFormat XRGB8888(__fourcc('X', 'R', '2', '4'), __mod(0, 0));
constexpr PixelFormat XBGR8888(__fourcc('X', 'B', '2', '4'), __mod(0, 0));
constexpr PixelFormat RGBX8888(__fourcc('R', 'X', '2', '4'), __mod(0, 0));
constexpr PixelFormat BGRX8888(__fourcc('B', 'X', '2', '4'), __mod(0, 0));
constexpr PixelFormat ARGB8888(__fourcc('A', 'R', '2', '4'), __mod(0, 0));
constexpr PixelFormat ABGR8888(__fourcc('A', 'B', '2', '4'), __mod(0, 0));
constexpr PixelFormat RGBA8888(__fourcc('R', 'A', '2', '4'), __mod(0, 0));
constexpr PixelFormat BGRA8888(__fourcc('B', 'A', '2', '4'), __mod(0, 0));
constexpr PixelFormat RGB161616(__fourcc('R', 'G', '4', '8'), __mod(0, 0));
constexpr PixelFormat BGR161616(__fourcc('B', 'G', '4', '8'), __mod(0, 0));
constexpr PixelFormat YUYV(__fourcc('Y', 'U', 'Y', 'V'), __mod(0, 0));
constexpr PixelFormat YVYU(__fourcc('Y', 'V', 'Y', 'U'), __mod(0, 0));
constexpr PixelFormat UYVY(__fourcc('U', 'Y', 'V', 'Y'), __mod(0, 0));
constexpr PixelFormat VYUY(__fourcc('V', 'Y', 'U', 'Y'), __mod(0, 0));
constexpr PixelFormat AVUY8888(__fourcc('A', 'V', 'U', 'Y'), __mod(0, 0));
constexpr PixelFormat XVUY8888(__fourcc('X', 'V', 'U', 'Y'), __mod(0, 0));
constexpr PixelFormat NV12(__fourcc('N', 'V', '1', '2'), __mod(0, 0));
constexpr PixelFormat NV21(__fourcc('N', 'V', '2', '1'), __mod(0, 0));
constexpr PixelFormat NV16(__fourcc('N', 'V', '1', '6'), __mod(0, 0));
constexpr PixelFormat NV61(__fourcc('N', 'V', '6', '1'), __mod(0, 0));
constexpr PixelFormat NV24(__fourcc('N', 'V', '2', '4'), __mod(0, 0));
constexpr PixelFormat NV42(__fourcc('N', 'V', '4', '2'), __mod(0, 0));
constexpr PixelFormat YUV420(__fourcc('Y', 'U', '1', '2'), __mod(0, 0));
constexpr PixelFormat YVU420(__fourcc('Y', 'V', '1', '2'), __mod(0, 0));
constexpr PixelFormat YUV422(__fourcc('Y', 'U', '1', '6'), __mod(0, 0));
constexpr PixelFormat YVU422(__fourcc('Y', 'V', '1', '6'), __mod(0, 0));
constexpr PixelFormat YUV444(__fourcc('Y', 'U', '2', '4'), __mod(0, 0));
constexpr PixelFormat YVU444(__fourcc('Y', 'V', '2', '4'), __mod(0, 0));
constexpr PixelFormat MJPEG(__fourcc('M', 'J', 'P', 'G'), __mod(0, 0));
constexpr PixelFormat SRGGB8(__fourcc('R', 'G', 'G', 'B'), __mod(0, 0));
constexpr PixelFormat SGRBG8(__fourcc('G', 'R', 'B', 'G'), __mod(0, 0));
constexpr PixelFormat SGBRG8(__fourcc('G', 'B', 'R', 'G'), __mod(0, 0));
constexpr PixelFormat SBGGR8(__fourcc('B', 'A', '8', '1'), __mod(0, 0));
constexpr PixelFormat SRGGB10(__fourcc('R', 'G', '1', '0'), __mod(0, 0));
constexpr PixelFormat SGRBG10(__fourcc('B', 'A', '1', '0'), __mod(0, 0));
constexpr PixelFormat SGBRG10(__fourcc('G', 'B', '1', '0'), __mod(0, 0));
constexpr PixelFormat SBGGR10(__fourcc('B', 'G', '1', '0'), __mod(0, 0));
constexpr PixelFormat SRGGB12(__fourcc('R', 'G', '1', '2'), __mod(0, 0));
constexpr PixelFormat SGRBG12(__fourcc('B', 'A', '1', '2'), __mod(0, 0));
constexpr PixelFormat SGBRG12(__fourcc('G', 'B', '1', '2'), __mod(0, 0));
constexpr PixelFormat SBGGR12(__fourcc('B', 'G', '1', '2'), __mod(0, 0));
constexpr PixelFormat SRGGB14(__fourcc('R', 'G', '1', '4'), __mod(0, 0));
constexpr PixelFormat SGRBG14(__fourcc('B', 'A', '1', '4'), __mod(0, 0));
constexpr PixelFormat SGBRG14(__fourcc('G', 'B', '1', '4'), __mod(0, 0));
constexpr PixelFormat SBGGR14(__fourcc('B', 'G', '1', '4'), __mod(0, 0));
constexpr PixelFormat SRGGB16(__fourcc('R', 'G', 'B', '6'), __mod(0, 0));
constexpr PixelFormat SGRBG16(__fourcc('G', 'R', '1', '6'), __mod(0, 0));
constexpr PixelFormat SGBRG16(__fourcc('G', 'B', '1', '6'), __mod(0, 0));
constexpr PixelFormat SBGGR16(__fourcc('B', 'Y', 'R', '2'), __mod(0, 0));
constexpr PixelFormat R10_CSI2P(__fourcc('R', '1', '0', ' '), __mod(11, 1));
constexpr PixelFormat R12_CSI2P(__fourcc('R', '1', '2', ' '), __mod(11, 1));
constexpr PixelFormat SRGGB10_CSI2P(__fourcc('R', 'G', '1', '0'), __mod(11, 1));
constexpr PixelFormat SGRBG10_CSI2P(__fourcc('B', 'A', '1', '0'), __mod(11, 1));
constexpr PixelFormat SGBRG10_CSI2P(__fourcc('G', 'B', '1', '0'), __mod(11, 1));
constexpr PixelFormat SBGGR10_CSI2P(__fourcc('B', 'G', '1', '0'), __mod(11, 1));
constexpr PixelFormat SRGGB12_CSI2P(__fourcc('R', 'G', '1', '2'), __mod(11, 1));
constexpr PixelFormat SGRBG12_CSI2P(__fourcc('B', 'A', '1', '2'), __mod(11, 1));
constexpr PixelFormat SGBRG12_CSI2P(__fourcc('G', 'B', '1', '2'), __mod(11, 1));
constexpr PixelFormat SBGGR12_CSI2P(__fourcc('B', 'G', '1', '2'), __mod(11, 1));
constexpr PixelFormat SRGGB14_CSI2P(__fourcc('R', 'G', '1', '4'), __mod(11, 1));
constexpr PixelFormat SGRBG14_CSI2P(__fourcc('B', 'A', '1', '4'), __mod(11, 1));
constexpr PixelFormat SGBRG14_CSI2P(__fourcc('G', 'B', '1', '4'), __mod(11, 1));
constexpr PixelFormat SBGGR14_CSI2P(__fourcc('B', 'G', '1', '4'), __mod(11, 1));
constexpr PixelFormat SRGGB10_IPU3(__fourcc('R', 'G', '1', '0'), __mod(1, 13));
constexpr PixelFormat SGRBG10_IPU3(__fourcc('B', 'A', '1', '0'), __mod(1, 13));
constexpr PixelFormat SGBRG10_IPU3(__fourcc('G', 'B', '1', '0'), __mod(1, 13));
constexpr PixelFormat SBGGR10_IPU3(__fourcc('B', 'G', '1', '0'), __mod(1, 13));
constexpr PixelFormat RGGB_PISP_COMP1(__fourcc('R', 'G', 'B', '6'), __mod(12, 1));
constexpr PixelFormat GRBG_PISP_COMP1(__fourcc('G', 'R', '1', '6'), __mod(12, 1));
constexpr PixelFormat GBRG_PISP_COMP1(__fourcc('G', 'B', '1', '6'), __mod(12, 1));
constexpr PixelFormat BGGR_PISP_COMP1(__fourcc('B', 'Y', 'R', '2'), __mod(12, 1));
constexpr PixelFormat MONO_PISP_COMP1(__fourcc('R', '1', '6', ' '), __mod(12, 1));
} /* namespace formats */
} /* namespace libcamera */

View File

@@ -0,0 +1,237 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* Tracepoints with lttng
*
* This file is auto-generated. Do not edit.
*/
#ifndef __LIBCAMERA_INTERNAL_TRACEPOINTS_H__
#define __LIBCAMERA_INTERNAL_TRACEPOINTS_H__
#if HAVE_TRACING
#define LIBCAMERA_TRACEPOINT(...) tracepoint(libcamera, __VA_ARGS__)
#define LIBCAMERA_TRACEPOINT_IPA_BEGIN(pipe, func) \
tracepoint(libcamera, ipa_call_begin, #pipe, #func)
#define LIBCAMERA_TRACEPOINT_IPA_END(pipe, func) \
tracepoint(libcamera, ipa_call_end, #pipe, #func)
#else
namespace {
template <typename ...Args>
inline void unused([[maybe_unused]] Args&& ...args)
{
}
} /* namespace */
#define LIBCAMERA_TRACEPOINT(category, ...) unused(__VA_ARGS__)
#define LIBCAMERA_TRACEPOINT_IPA_BEGIN(pipe, func)
#define LIBCAMERA_TRACEPOINT_IPA_END(pipe, func)
#endif /* HAVE_TRACING */
#endif /* __LIBCAMERA_INTERNAL_TRACEPOINTS_H__ */
#if HAVE_TRACING
#undef TRACEPOINT_PROVIDER
#define TRACEPOINT_PROVIDER libcamera
#undef TRACEPOINT_INCLUDE
#define TRACEPOINT_INCLUDE "libcamera/internal/tracepoints.h"
#if !defined(INCLUDE_LIBCAMERA_INTERNAL_TRACEPOINTS_TP_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
#define INCLUDE_LIBCAMERA_INTERNAL_TRACEPOINTS_TP_H
#include <lttng/tracepoint.h>
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* buffer_enums.tp - Tracepoint definition for enums in the buffer class
*/
TRACEPOINT_ENUM(
libcamera,
buffer_status,
TP_ENUM_VALUES(
ctf_enum_value("FrameSuccess", 0)
ctf_enum_value("FrameError", 1)
ctf_enum_value("FrameCancelled", 2)
)
)
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* request_enums.tp - Tracepoint definition for enums in the request class
*/
TRACEPOINT_ENUM(
libcamera,
request_status,
TP_ENUM_VALUES(
ctf_enum_value("RequestPending", 0)
ctf_enum_value("RequestComplete", 1)
ctf_enum_value("RequestCancelled", 2)
)
)
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* pipeline.tp - Tracepoints for pipelines
*/
TRACEPOINT_EVENT(
libcamera,
ipa_call_begin,
TP_ARGS(
const char *, pipe,
const char *, func
),
TP_FIELDS(
ctf_string(pipeline_name, pipe)
ctf_string(function_name, func)
)
)
TRACEPOINT_EVENT(
libcamera,
ipa_call_end,
TP_ARGS(
const char *, pipe,
const char *, func
),
TP_FIELDS(
ctf_string(pipeline_name, pipe)
ctf_string(function_name, func)
)
)
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* request.tp - Tracepoints for the request object
*/
#include <stdint.h>
#include <libcamera/framebuffer.h>
#include "libcamera/internal/request.h"
TRACEPOINT_EVENT_CLASS(
libcamera,
request,
TP_ARGS(
libcamera::Request *, req
),
TP_FIELDS(
ctf_integer_hex(uintptr_t, request, reinterpret_cast<uintptr_t>(req))
ctf_integer(uint64_t, cookie, req->cookie())
ctf_enum(libcamera, request_status, uint32_t, status, req->status())
)
)
TRACEPOINT_EVENT_INSTANCE(
libcamera,
request,
request_construct,
TP_ARGS(
libcamera::Request *, req
)
)
TRACEPOINT_EVENT_INSTANCE(
libcamera,
request,
request_destroy,
TP_ARGS(
libcamera::Request *, req
)
)
TRACEPOINT_EVENT_INSTANCE(
libcamera,
request,
request_reuse,
TP_ARGS(
libcamera::Request *, req
)
)
TRACEPOINT_EVENT_INSTANCE(
libcamera,
request,
request_queue,
TP_ARGS(
libcamera::Request *, req
)
)
TRACEPOINT_EVENT_INSTANCE(
libcamera,
request,
request_device_queue,
TP_ARGS(
libcamera::Request *, req
)
)
TRACEPOINT_EVENT_INSTANCE(
libcamera,
request,
request_complete,
TP_ARGS(
libcamera::Request::Private *, req
)
)
TRACEPOINT_EVENT_INSTANCE(
libcamera,
request,
request_cancel,
TP_ARGS(
libcamera::Request::Private *, req
)
)
TRACEPOINT_EVENT(
libcamera,
request_complete_buffer,
TP_ARGS(
libcamera::Request::Private *, req,
libcamera::FrameBuffer *, buf
),
TP_FIELDS(
ctf_integer_hex(uintptr_t, request, reinterpret_cast<uintptr_t>(req))
ctf_integer(uint64_t, cookie, req->_o<libcamera::Request>()->cookie())
ctf_integer(int, status, req->_o<libcamera::Request>()->status())
ctf_integer_hex(uintptr_t, buffer, reinterpret_cast<uintptr_t>(buf))
ctf_enum(libcamera, buffer_status, uint32_t, buf_status, buf->metadata().status)
)
)
#endif /* INCLUDE_LIBCAMERA_INTERNAL_TRACEPOINTS_TP_H */
#include <lttng/tracepoint-event.h>
#endif /* HAVE_TRACING */

View File

@@ -0,0 +1,163 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* libcamera core definitions for Image Processing Algorithms
*
* This file is auto-generated. Do not edit.
*/
#pragma once
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include <libcamera/controls.h>
#include <libcamera/framebuffer.h>
#include <libcamera/geometry.h>
#include <libcamera/ipa/ipa_interface.h>
namespace libcamera {
struct IPACameraSensorInfo
{
public:
#ifndef __DOXYGEN__
IPACameraSensorInfo() = default;
template<
typename T1 = std::string,
typename T2 = uint32_t,
typename T3 = uint32_t,
typename T4 = Size,
typename T5 = Rectangle,
typename T6 = Size,
typename T7 = uint64_t,
typename T8 = uint32_t,
typename T9 = uint32_t,
typename T10 = uint32_t,
typename T11 = uint32_t,
std::enable_if_t<std::is_convertible_v<T1&&, std::string>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T2&&, uint32_t>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T3&&, uint32_t>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T4&&, Size>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T5&&, Rectangle>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T6&&, Size>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T7&&, uint64_t>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T8&&, uint32_t>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T9&&, uint32_t>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T10&&, uint32_t>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T11&&, uint32_t>> * = nullptr
>
IPACameraSensorInfo(T1 &&_model, T2 &&_bitsPerPixel, T3 &&_cfaPattern, T4 &&_activeAreaSize, T5 &&_analogCrop, T6 &&_outputSize, T7 &&_pixelRate, T8 &&_minLineLength, T9 &&_maxLineLength, T10 &&_minFrameLength, T11 &&_maxFrameLength)
: model(std::forward<T1>(_model))
, bitsPerPixel(std::forward<T2>(_bitsPerPixel))
, cfaPattern(std::forward<T3>(_cfaPattern))
, activeAreaSize(std::forward<T4>(_activeAreaSize))
, analogCrop(std::forward<T5>(_analogCrop))
, outputSize(std::forward<T6>(_outputSize))
, pixelRate(std::forward<T7>(_pixelRate))
, minLineLength(std::forward<T8>(_minLineLength))
, maxLineLength(std::forward<T9>(_maxLineLength))
, minFrameLength(std::forward<T10>(_minFrameLength))
, maxFrameLength(std::forward<T11>(_maxFrameLength))
{
}
#endif
std::string model;
uint32_t bitsPerPixel{ 0 };
uint32_t cfaPattern{ 0 };
Size activeAreaSize;
Rectangle analogCrop;
Size outputSize;
uint64_t pixelRate{ 0 };
uint32_t minLineLength{ 0 };
uint32_t maxLineLength{ 0 };
uint32_t minFrameLength{ 0 };
uint32_t maxFrameLength{ 0 };
};
struct IPABuffer
{
public:
#ifndef __DOXYGEN__
IPABuffer() = default;
template<
typename T1 = uint32_t,
typename T2 = std::vector<FrameBuffer::Plane>,
std::enable_if_t<std::is_convertible_v<T1&&, uint32_t>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T2&&, std::vector<FrameBuffer::Plane>>> * = nullptr
>
IPABuffer(T1 &&_id, T2 &&_planes)
: id(std::forward<T1>(_id))
, planes(std::forward<T2>(_planes))
{
}
#endif
uint32_t id{ 0 };
std::vector<FrameBuffer::Plane> planes;
};
struct IPASettings
{
public:
#ifndef __DOXYGEN__
IPASettings() = default;
template<
typename T1 = std::string,
typename T2 = std::string,
std::enable_if_t<std::is_convertible_v<T1&&, std::string>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T2&&, std::string>> * = nullptr
>
IPASettings(T1 &&_configurationFile, T2 &&_sensorModel)
: configurationFile(std::forward<T1>(_configurationFile))
, sensorModel(std::forward<T2>(_sensorModel))
{
}
#endif
std::string configurationFile;
std::string sensorModel;
};
struct IPAStream
{
public:
#ifndef __DOXYGEN__
IPAStream() = default;
template<
typename T1 = uint32_t,
typename T2 = Size,
std::enable_if_t<std::is_convertible_v<T1&&, uint32_t>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T2&&, Size>> * = nullptr
>
IPAStream(T1 &&_pixelFormat, T2 &&_size)
: pixelFormat(std::forward<T1>(_pixelFormat))
, size(std::forward<T2>(_size))
{
}
#endif
uint32_t pixelFormat{ 0 };
Size size;
};
} /* namespace libcamera */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,377 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* Image Processing Algorithm interface for raspberrypi
*
* This file is auto-generated. Do not edit.
*/
#pragma once
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include <libcamera/base/flags.h>
#include <libcamera/base/signal.h>
#include <libcamera/controls.h>
#include <libcamera/framebuffer.h>
#include <libcamera/geometry.h>
#include <libcamera/ipa/core_ipa_interface.h>
#include <libcamera/ipa/ipa_interface.h>
namespace libcamera {
namespace ipa {
namespace RPi {
const uint32_t MaxLsGridSize = 0x8000;
enum class _RPiCmd {
Exit = 0,
Init = 1,
Start = 2,
Stop = 3,
Configure = 4,
MapBuffers = 5,
UnmapBuffers = 6,
PrepareIsp = 7,
ProcessStats = 8,
};
enum class _RPiEventCmd {
PrepareIspComplete = 1,
ProcessStatsComplete = 2,
MetadataReady = 3,
SetIspControls = 4,
SetDelayedControls = 5,
SetLensControls = 6,
SetCameraTimeout = 7,
};
struct SensorConfig
{
public:
#ifndef __DOXYGEN__
SensorConfig() = default;
template<
typename T1 = uint32_t,
std::enable_if_t<std::is_convertible_v<T1&&, uint32_t>> * = nullptr
>
SensorConfig(T1 &&_sensorMetadata)
: sensorMetadata(std::forward<T1>(_sensorMetadata))
{
}
#endif
uint32_t sensorMetadata{ 0 };
};
struct InitParams
{
public:
#ifndef __DOXYGEN__
InitParams() = default;
template<
typename T1 = bool,
typename T2 = IPACameraSensorInfo,
typename T3 = float,
typename T4 = SharedFD,
typename T5 = SharedFD,
std::enable_if_t<std::is_convertible_v<T1&&, bool>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T2&&, IPACameraSensorInfo>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T3&&, float>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T4&&, SharedFD>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T5&&, SharedFD>> * = nullptr
>
InitParams(T1 &&_lensPresent, T2 &&_sensorInfo, T3 &&_controllerMinFrameDurationUs, T4 &&_fe, T5 &&_be)
: lensPresent(std::forward<T1>(_lensPresent))
, sensorInfo(std::forward<T2>(_sensorInfo))
, controllerMinFrameDurationUs(std::forward<T3>(_controllerMinFrameDurationUs))
, fe(std::forward<T4>(_fe))
, be(std::forward<T5>(_be))
{
}
#endif
bool lensPresent{ 0 };
IPACameraSensorInfo sensorInfo;
float controllerMinFrameDurationUs{ 0 };
SharedFD fe{ -1 };
SharedFD be{ -1 };
};
struct InitResult
{
public:
#ifndef __DOXYGEN__
InitResult() = default;
template<
typename T1 = SensorConfig,
typename T2 = ControlInfoMap,
std::enable_if_t<std::is_convertible_v<T1&&, SensorConfig>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T2&&, ControlInfoMap>> * = nullptr
>
InitResult(T1 &&_sensorConfig, T2 &&_controlInfo)
: sensorConfig(std::forward<T1>(_sensorConfig))
, controlInfo(std::forward<T2>(_controlInfo))
{
}
#endif
SensorConfig sensorConfig;
ControlInfoMap controlInfo;
};
struct BufferIds
{
public:
#ifndef __DOXYGEN__
BufferIds() = default;
template<
typename T1 = uint32_t,
typename T2 = uint32_t,
typename T3 = uint32_t,
std::enable_if_t<std::is_convertible_v<T1&&, uint32_t>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T2&&, uint32_t>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T3&&, uint32_t>> * = nullptr
>
BufferIds(T1 &&_bayer, T2 &&_embedded, T3 &&_stats)
: bayer(std::forward<T1>(_bayer))
, embedded(std::forward<T2>(_embedded))
, stats(std::forward<T3>(_stats))
{
}
#endif
uint32_t bayer{ 0 };
uint32_t embedded{ 0 };
uint32_t stats{ 0 };
};
struct ConfigParams
{
public:
#ifndef __DOXYGEN__
ConfigParams() = default;
template<
typename T1 = uint32_t,
typename T2 = ControlInfoMap,
typename T3 = ControlInfoMap,
typename T4 = ControlInfoMap,
typename T5 = SharedFD,
std::enable_if_t<std::is_convertible_v<T1&&, uint32_t>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T2&&, ControlInfoMap>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T3&&, ControlInfoMap>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T4&&, ControlInfoMap>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T5&&, SharedFD>> * = nullptr
>
ConfigParams(T1 &&_transform, T2 &&_sensorControls, T3 &&_ispControls, T4 &&_lensControls, T5 &&_lsTableHandle)
: transform(std::forward<T1>(_transform))
, sensorControls(std::forward<T2>(_sensorControls))
, ispControls(std::forward<T3>(_ispControls))
, lensControls(std::forward<T4>(_lensControls))
, lsTableHandle(std::forward<T5>(_lsTableHandle))
{
}
#endif
uint32_t transform{ 0 };
ControlInfoMap sensorControls;
ControlInfoMap ispControls;
ControlInfoMap lensControls;
SharedFD lsTableHandle{ -1 };
};
struct ConfigResult
{
public:
#ifndef __DOXYGEN__
ConfigResult() = default;
template<
typename T1 = float,
typename T2 = ControlInfoMap,
typename T3 = ControlList,
typename T4 = ControlList,
std::enable_if_t<std::is_convertible_v<T1&&, float>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T2&&, ControlInfoMap>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T3&&, ControlList>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T4&&, ControlList>> * = nullptr
>
ConfigResult(T1 &&_modeSensitivity, T2 &&_controlInfo, T3 &&_sensorControls, T4 &&_lensControls)
: modeSensitivity(std::forward<T1>(_modeSensitivity))
, controlInfo(std::forward<T2>(_controlInfo))
, sensorControls(std::forward<T3>(_sensorControls))
, lensControls(std::forward<T4>(_lensControls))
{
}
#endif
float modeSensitivity{ 0 };
ControlInfoMap controlInfo;
ControlList sensorControls;
ControlList lensControls;
};
struct StartResult
{
public:
#ifndef __DOXYGEN__
StartResult() = default;
template<
typename T1 = ControlList,
typename T2 = int32_t,
typename T3 = int32_t,
std::enable_if_t<std::is_convertible_v<T1&&, ControlList>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T2&&, int32_t>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T3&&, int32_t>> * = nullptr
>
StartResult(T1 &&_controls, T2 &&_startupFrameCount, T3 &&_invalidFrameCount)
: controls(std::forward<T1>(_controls))
, startupFrameCount(std::forward<T2>(_startupFrameCount))
, invalidFrameCount(std::forward<T3>(_invalidFrameCount))
{
}
#endif
ControlList controls;
int32_t startupFrameCount{ 0 };
int32_t invalidFrameCount{ 0 };
};
struct PrepareParams
{
public:
#ifndef __DOXYGEN__
PrepareParams() = default;
template<
typename T1 = BufferIds,
typename T2 = ControlList,
typename T3 = ControlList,
typename T4 = uint32_t,
typename T5 = uint32_t,
std::enable_if_t<std::is_convertible_v<T1&&, BufferIds>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T2&&, ControlList>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T3&&, ControlList>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T4&&, uint32_t>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T5&&, uint32_t>> * = nullptr
>
PrepareParams(T1 &&_buffers, T2 &&_sensorControls, T3 &&_requestControls, T4 &&_ipaContext, T5 &&_delayContext)
: buffers(std::forward<T1>(_buffers))
, sensorControls(std::forward<T2>(_sensorControls))
, requestControls(std::forward<T3>(_requestControls))
, ipaContext(std::forward<T4>(_ipaContext))
, delayContext(std::forward<T5>(_delayContext))
{
}
#endif
BufferIds buffers;
ControlList sensorControls;
ControlList requestControls;
uint32_t ipaContext{ 0 };
uint32_t delayContext{ 0 };
};
struct ProcessParams
{
public:
#ifndef __DOXYGEN__
ProcessParams() = default;
template<
typename T1 = BufferIds,
typename T2 = uint32_t,
std::enable_if_t<std::is_convertible_v<T1&&, BufferIds>> * = nullptr,
std::enable_if_t<std::is_convertible_v<T2&&, uint32_t>> * = nullptr
>
ProcessParams(T1 &&_buffers, T2 &&_ipaContext)
: buffers(std::forward<T1>(_buffers))
, ipaContext(std::forward<T2>(_ipaContext))
{
}
#endif
BufferIds buffers;
uint32_t ipaContext{ 0 };
};
class IPARPiInterface : public IPAInterface
{
public:
virtual int32_t init(
const IPASettings &settings,
const InitParams &params,
InitResult *result) = 0;
virtual void start(
const ControlList &controls,
StartResult *result) = 0;
virtual void stop() = 0;
virtual int32_t configure(
const IPACameraSensorInfo &sensorInfo,
const ConfigParams &params,
ConfigResult *result) = 0;
virtual void mapBuffers(
const std::vector<libcamera::IPABuffer> &buffers) = 0;
virtual void unmapBuffers(
const std::vector<uint32_t> &ids) = 0;
virtual void prepareIsp(
const PrepareParams &params) = 0;
virtual void processStats(
const ProcessParams &params) = 0;
Signal<const BufferIds &, bool> prepareIspComplete;
Signal<const BufferIds &> processStatsComplete;
Signal<const ControlList &> metadataReady;
Signal<const ControlList &> setIspControls;
Signal<const ControlList &, uint32_t> setDelayedControls;
Signal<const ControlList &> setLensControls;
Signal<uint32_t> setCameraTimeout;
};
} /* namespace RPi */
} /* namespace ipa */
} /* namespace libcamera */

View File

@@ -0,0 +1,239 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* Image Processing Algorithm proxy for raspberrypi
*
* This file is auto-generated. Do not edit.
*/
#pragma once
#include <libcamera/ipa/ipa_interface.h>
#include <libcamera/ipa/raspberrypi_ipa_interface.h>
#include <libcamera/base/object.h>
#include <libcamera/base/thread.h>
#include "libcamera/internal/control_serializer.h"
#include "libcamera/internal/ipa_proxy.h"
#include "libcamera/internal/ipc_pipe.h"
#include "libcamera/internal/ipc_pipe_unixsocket.h"
#include "libcamera/internal/ipc_unixsocket.h"
namespace libcamera {
namespace ipa {
namespace RPi {
class IPAProxyRPiThreaded;
class IPAProxyRPiIsolated;
class IPAProxyRPi : public IPAProxy, public IPARPiInterface, public Object
{
public:
using Threaded = IPAProxyRPiThreaded;
using Isolated = IPAProxyRPiIsolated;
protected:
using IPAProxy::IPAProxy;
};
class IPAProxyRPiThreaded : public IPAProxyRPi
{
public:
IPAProxyRPiThreaded(IPAModule *ipam, const CameraManager &cm);
~IPAProxyRPiThreaded();
int32_t init(
const IPASettings &settings,
const InitParams &params,
InitResult *result) override;
void start(
const ControlList &controls,
StartResult *result) override;
void stop() override;
int32_t configure(
const IPACameraSensorInfo &sensorInfo,
const ConfigParams &params,
ConfigResult *result) override;
void mapBuffers(
const std::vector<libcamera::IPABuffer> &buffers) override;
void unmapBuffers(
const std::vector<uint32_t> &ids) override;
void prepareIsp(
const PrepareParams &params) override;
void processStats(
const ProcessParams &params) override;
private:
void prepareIspCompleteHandler(
const BufferIds &buffers,
const bool stitchSwapBuffers);
void processStatsCompleteHandler(
const BufferIds &buffers);
void metadataReadyHandler(
const ControlList &metadata);
void setIspControlsHandler(
const ControlList &controls);
void setDelayedControlsHandler(
const ControlList &controls,
const uint32_t delayContext);
void setLensControlsHandler(
const ControlList &controls);
void setCameraTimeoutHandler(
const uint32_t maxFrameLengthMs);
/* Helper class to invoke async functions in another thread. */
class ThreadProxy : public Object
{
public:
ThreadProxy()
: ipa_(nullptr)
{
}
void setIPA(IPARPiInterface *ipa)
{
ipa_ = ipa;
}
void stop()
{
ipa_->stop();
}
void start(
const ControlList &controls,
StartResult *result)
{
ipa_->start(controls, result);
}
void prepareIsp(
const PrepareParams &params)
{
ipa_->prepareIsp(params);
}
void processStats(
const ProcessParams &params)
{
ipa_->processStats(params);
}
private:
IPARPiInterface *ipa_;
};
Thread thread_;
ThreadProxy proxy_;
std::unique_ptr<IPARPiInterface> ipa_;
};
class IPAProxyRPiIsolated : public IPAProxyRPi
{
public:
IPAProxyRPiIsolated(IPAModule *ipam, const CameraManager &cm);
~IPAProxyRPiIsolated();
int32_t init(
const IPASettings &settings,
const InitParams &params,
InitResult *result) override;
void start(
const ControlList &controls,
StartResult *result) override;
void stop() override;
int32_t configure(
const IPACameraSensorInfo &sensorInfo,
const ConfigParams &params,
ConfigResult *result) override;
void mapBuffers(
const std::vector<libcamera::IPABuffer> &buffers) override;
void unmapBuffers(
const std::vector<uint32_t> &ids) override;
void prepareIsp(
const PrepareParams &params) override;
void processStats(
const ProcessParams &params) override;
private:
void recvMessage(const IPCMessage &data);
void prepareIspCompleteHandler(
std::vector<uint8_t>::const_iterator data,
size_t dataSize,
const std::vector<SharedFD> &fds);
void processStatsCompleteHandler(
std::vector<uint8_t>::const_iterator data,
size_t dataSize,
const std::vector<SharedFD> &fds);
void metadataReadyHandler(
std::vector<uint8_t>::const_iterator data,
size_t dataSize,
const std::vector<SharedFD> &fds);
void setIspControlsHandler(
std::vector<uint8_t>::const_iterator data,
size_t dataSize,
const std::vector<SharedFD> &fds);
void setDelayedControlsHandler(
std::vector<uint8_t>::const_iterator data,
size_t dataSize,
const std::vector<SharedFD> &fds);
void setLensControlsHandler(
std::vector<uint8_t>::const_iterator data,
size_t dataSize,
const std::vector<SharedFD> &fds);
void setCameraTimeoutHandler(
std::vector<uint8_t>::const_iterator data,
size_t dataSize,
const std::vector<SharedFD> &fds);
std::unique_ptr<IPCPipeUnixSocket> ipc_;
ControlSerializer controlSerializer_;
uint32_t seq_;
};
} /* namespace RPi */
} /* namespace ipa */
} /* namespace libcamera */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* This file is auto-generated, do not edit! */
/*
* Copyright (C) 2018-2019, Google Inc.
*
* libcamera public API
*/
#pragma once
#include <libcamera/camera.h>
#include <libcamera/camera_manager.h>
#include <libcamera/color_space.h>
#include <libcamera/control_ids.h>
#include <libcamera/controls.h>
#include <libcamera/fence.h>
#include <libcamera/formats.h>
#include <libcamera/framebuffer_allocator.h>
#include <libcamera/framebuffer.h>
#include <libcamera/geometry.h>
#include <libcamera/logging.h>
#include <libcamera/orientation.h>
#include <libcamera/pixel_format.h>
#include <libcamera/property_ids.h>
#include <libcamera/request.h>
#include <libcamera/stream.h>
#include <libcamera/transform.h>
#include <libcamera/version.h>

View File

@@ -0,0 +1,99 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* Properties ID list
*
* This file is auto-generated. Do not edit.
*/
#pragma once
#include <array>
#include <map>
#include <stdint.h>
#include <string>
#include <string_view>
#include <libcamera/controls.h>
namespace libcamera {
namespace properties {
extern const ControlIdMap properties;
enum {
LOCATION = 1,
ROTATION = 2,
MODEL = 3,
UNIT_CELL_SIZE = 4,
PIXEL_ARRAY_SIZE = 5,
PIXEL_ARRAY_OPTICAL_BLACK_RECTANGLES = 6,
PIXEL_ARRAY_ACTIVE_AREAS = 7,
SCALER_CROP_MAXIMUM = 8,
SENSOR_SENSITIVITY = 9,
SYSTEM_DEVICES = 10,
PIPELINE_HANDLER = 11,
};
enum LocationEnum {
CameraLocationFront = 0,
CameraLocationBack = 1,
CameraLocationExternal = 2,
};
extern const std::array<const ControlValue, 3> LocationValues;
extern const std::map<std::string, int32_t> LocationNameValueMap;
extern const Control<int32_t> Location;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_PROPERTIES_LOCATION
extern const Control<int32_t> Rotation;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_PROPERTIES_ROTATION
extern const Control<std::string_view> Model;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_PROPERTIES_MODEL
extern const Control<Size> UnitCellSize;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_PROPERTIES_UNIT_CELL_SIZE
extern const Control<Size> PixelArraySize;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_PROPERTIES_PIXEL_ARRAY_SIZE
extern const Control<Span<const Rectangle>> PixelArrayOpticalBlackRectangles;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_PROPERTIES_PIXEL_ARRAY_OPTICAL_BLACK_RECTANGLES
extern const Control<Span<const Rectangle>> PixelArrayActiveAreas;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_PROPERTIES_PIXEL_ARRAY_ACTIVE_AREAS
extern const Control<Rectangle> ScalerCropMaximum;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_PROPERTIES_SCALER_CROP_MAXIMUM
extern const Control<float> SensorSensitivity;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_PROPERTIES_SENSOR_SENSITIVITY
extern const Control<Span<const int64_t>> SystemDevices;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_PROPERTIES_SYSTEM_DEVICES
extern const Control<std::string_view> PipelineHandler;
#define LIBCAMERA_HAS_LIBCAMERA_VENDOR_PROPERTIES_PIPELINE_HANDLER
namespace draft {
#define LIBCAMERA_HAS_DRAFT_VENDOR_PROPERTIES
enum {
COLOR_FILTER_ARRANGEMENT = 10001,
};
enum ColorFilterArrangementEnum {
RGGB = 0,
GRBG = 1,
GBRG = 2,
BGGR = 3,
RGB = 4,
MONO = 5,
};
extern const std::array<const ControlValue, 6> ColorFilterArrangementValues;
extern const std::map<std::string, int32_t> ColorFilterArrangementNameValueMap;
extern const Control<int32_t> ColorFilterArrangement;
#define LIBCAMERA_HAS_DRAFT_VENDOR_PROPERTIES_COLOR_FILTER_ARRANGEMENT
} /* namespace draft */
} /* namespace properties */
} /* namespace libcamera */

View File

@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCyUg1y0NHdUlX+
aW4IO2dMUrRpi0xorITJp5T0/h7lVjCtnnLWfEUbliGnrmRzBTtdfJpfq4zKBGVr
4uJXOexU3kYPKWShLeTPNIV5xOZLLo4wl0id7wXhUj12GcTQ+ybnwm+/qdd6eBl2
2aldic9+HMH7CH5l7qX+JAirtFZVR2R+6tG6Hrh9no+jHNEB11n9fQUiBWsiIqSK
UtHpRai/8qsKT+0oGd+3ZFlEi7SCjcfTKNNCPYbXtWUE8DoaYz9KQPYC1s+fU5Ef
0kyr7s7V9s8/AqxpeYICU1Soe3/m/h2N+05RixS5Iac1pP8uaz3Y05IWgT/UbW1H
bqdD2hnFAgMBAAECggEACg0R8PzQN3dinXp310Lx6Z1nyeMuJWBEA9HMVZrVRvv6
tm6N7oUGqC1oLDlqNAmBdR2G3gmfX+urg89ADsaXCZmVvVkJ8QPTN9KwC1ML4AT5
wsdkMnK8lBy8liGRtG3TnZCaF+WM3bxTQx21rC4OYf9g97Nc3IX9GTwSuQrrKtdJ
ICDB6LMBK6ef8l0srKgWHVQ6QR04YY/y/8H3uoNoapPBVlli0bRBVcMHN9+FzBuR
wmQQ7CJzMI78mCGd5PR3vw+4P0vm02QSSZU4bKuqUc0BnQ04mUt/CVmrPXT+m5e6
wfUmpR7SI9wskSEORVF+heaXQeOESKuv+Ga3DavI6QKBgQDBY/i6s9FfCl3d7KlP
OY3Ano3PMKtuw+1XgdAzjaJ4WB2BZi0VOH7xzjUKD9SkzwA4uLPooXiZo8AeVoMQ
wBPOlcNpYLWGAz3TskXiA6a+h4P3kfp7UymDX41ijurrlG5DkcQNy/hM411IAOMV
rOoCK8dy0cMul5tO0RUSiQigAwKBgQDsDRftEMXN+EGxKLiZFFPw3rPq3ZFSzVhU
H1AQZR9QJZGHvtYdcG6BGzIDd1T0AaFjcjRgAs4fB7tClZoRMjqZ5x4ZhbTAuAVE
uoHh3RVELlbinx0lIavdlvFtGfbdL+NELUmk/YCJRx9nkhBDtenAOPWWkpVx1LtX
+fm0lOvolwKBgQCQKIqf+i0HkL26EZGAGiH9xPNm0BvqvKhuw7jExT6oQN71t4nB
uNSAQbut3XEgzaGXpq+NqNgyhytOMiUPVm8tXtxE8C9AT6hF5y1KtngUrQYFhU7X
oX1fjdnh7zFVHNc5DS69Lh/QiOffJbIhVT03ExVhFNZPI/pEvXzczUOdqwKBgQCN
ZkKA1d1HxoDDeNsrh8vIq/8mn9cfvLY+ngs95vVc80Q8BosIU4M+f2X0QZV4HUnp
4k2RfdyvJdh8yFTkHCySaKnVLAzcrN8rDnYjMGY+02tkkV/KEGN9d5/jdPw1/yuq
eV52IQzQLvSW/B4WEXCWnwguTFyNNZuL1chI7jRqvQKBgB00U7LLj1Q91FsdH7ue
jHTcWcWwFLrsjpTFJvB/IfT5ecfbG4GPAfsBLN/9WtxpolE+0gYHHmDz+8Xhgrtc
EMFBaGFB2TojnCL7rcQ8pGccqeTROL/WIz0S/EJ0RTl0Po4OUXYxygQHQEJyRCT5
M/2F2joV56ADNLqewkwSuQE1
-----END PRIVATE KEY-----

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,58 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Laurent Pinchart <laurent.pinchart@ideasonboard.com>
*
* IPA module signing public key
*
* This file is auto-generated. Do not edit.
*/
#include "libcamera/internal/ipa_manager.h"
namespace libcamera {
#if HAVE_IPA_PUBKEY
const uint8_t IPAManager::publicKeyData_[] = {
0x30, 0x82, 0x01, 0x22, 0x30, 0x0d, 0x06, 0x09,
0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01,
0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0f, 0x00,
0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
0x00, 0xb2, 0x52, 0x0d, 0x72, 0xd0, 0xd1, 0xdd,
0x52, 0x55, 0xfe, 0x69, 0x6e, 0x08, 0x3b, 0x67,
0x4c, 0x52, 0xb4, 0x69, 0x8b, 0x4c, 0x68, 0xac,
0x84, 0xc9, 0xa7, 0x94, 0xf4, 0xfe, 0x1e, 0xe5,
0x56, 0x30, 0xad, 0x9e, 0x72, 0xd6, 0x7c, 0x45,
0x1b, 0x96, 0x21, 0xa7, 0xae, 0x64, 0x73, 0x05,
0x3b, 0x5d, 0x7c, 0x9a, 0x5f, 0xab, 0x8c, 0xca,
0x04, 0x65, 0x6b, 0xe2, 0xe2, 0x57, 0x39, 0xec,
0x54, 0xde, 0x46, 0x0f, 0x29, 0x64, 0xa1, 0x2d,
0xe4, 0xcf, 0x34, 0x85, 0x79, 0xc4, 0xe6, 0x4b,
0x2e, 0x8e, 0x30, 0x97, 0x48, 0x9d, 0xef, 0x05,
0xe1, 0x52, 0x3d, 0x76, 0x19, 0xc4, 0xd0, 0xfb,
0x26, 0xe7, 0xc2, 0x6f, 0xbf, 0xa9, 0xd7, 0x7a,
0x78, 0x19, 0x76, 0xd9, 0xa9, 0x5d, 0x89, 0xcf,
0x7e, 0x1c, 0xc1, 0xfb, 0x08, 0x7e, 0x65, 0xee,
0xa5, 0xfe, 0x24, 0x08, 0xab, 0xb4, 0x56, 0x55,
0x47, 0x64, 0x7e, 0xea, 0xd1, 0xba, 0x1e, 0xb8,
0x7d, 0x9e, 0x8f, 0xa3, 0x1c, 0xd1, 0x01, 0xd7,
0x59, 0xfd, 0x7d, 0x05, 0x22, 0x05, 0x6b, 0x22,
0x22, 0xa4, 0x8a, 0x52, 0xd1, 0xe9, 0x45, 0xa8,
0xbf, 0xf2, 0xab, 0x0a, 0x4f, 0xed, 0x28, 0x19,
0xdf, 0xb7, 0x64, 0x59, 0x44, 0x8b, 0xb4, 0x82,
0x8d, 0xc7, 0xd3, 0x28, 0xd3, 0x42, 0x3d, 0x86,
0xd7, 0xb5, 0x65, 0x04, 0xf0, 0x3a, 0x1a, 0x63,
0x3f, 0x4a, 0x40, 0xf6, 0x02, 0xd6, 0xcf, 0x9f,
0x53, 0x91, 0x1f, 0xd2, 0x4c, 0xab, 0xee, 0xce,
0xd5, 0xf6, 0xcf, 0x3f, 0x02, 0xac, 0x69, 0x79,
0x82, 0x02, 0x53, 0x54, 0xa8, 0x7b, 0x7f, 0xe6,
0xfe, 0x1d, 0x8d, 0xfb, 0x4e, 0x51, 0x8b, 0x14,
0xb9, 0x21, 0xa7, 0x35, 0xa4, 0xff, 0x2e, 0x6b,
0x3d, 0xd8, 0xd3, 0x92, 0x16, 0x81, 0x3f, 0xd4,
0x6d, 0x6d, 0x47, 0x6e, 0xa7, 0x43, 0xda, 0x19,
0xc5, 0x02, 0x03, 0x01, 0x00, 0x01
};
const PubKey IPAManager::pubKey_{ { IPAManager::publicKeyData_ } };
#endif
} /* namespace libcamera */

View File

@@ -0,0 +1,872 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* properties ID list
*
* This file is auto-generated. Do not edit.
*/
#include <libcamera/property_ids.h>
#include <libcamera/controls.h>
/**
* \file property_ids.h
* \brief Camera properties identifiers
*/
namespace libcamera {
/**
* \brief Namespace for libcamera properties
*/
namespace properties {
/**
* \enum LocationEnum
* \brief Supported Location values
*
* \var CameraLocationFront
* \brief The camera is mounted on the front side of the device, facing the
* user
*
* \var CameraLocationBack
* \brief The camera is mounted on the back side of the device, facing away
* from the user
*
* \var CameraLocationExternal
* \brief The camera is attached to the device in a way that allows it to
* be moved freely
*/
/**
* \var LocationValues
* \brief List of all Location supported values
*/
/**
* \var LocationNameValueMap
* \brief Map of all Location supported value names (in std::string format) to value
*/
/**
* \var Location
* \brief Camera mounting location
*/
/**
* \var Rotation
* \brief The camera physical mounting rotation. It is expressed as the angular
* difference in degrees between two reference systems, one relative to the
* camera module, and one defined on the external world scene to be
* captured when projected on the image sensor pixel array.
*
* A camera sensor has a 2-dimensional reference system 'Rc' defined by
* its pixel array read-out order. The origin is set to the first pixel
* being read out, the X-axis points along the column read-out direction
* towards the last columns, and the Y-axis along the row read-out
* direction towards the last row.
*
* A typical example for a sensor with a 2592x1944 pixel array matrix
* observed from the front is
*
* 2591 X-axis 0
* <------------------------+ 0
* .......... ... ..........!
* .......... ... ..........! Y-axis
* ... !
* .......... ... ..........!
* .......... ... ..........! 1943
* V
*
*
* The external world scene reference system 'Rs' is a 2-dimensional
* reference system on the focal plane of the camera module. The origin is
* placed on the top-left corner of the visible scene, the X-axis points
* towards the right, and the Y-axis points towards the bottom of the
* scene. The top, bottom, left and right directions are intentionally not
* defined and depend on the environment in which the camera is used.
*
* A typical example of a (very common) picture of a shark swimming from
* left to right, as seen from the camera, is
*
* 0 X-axis
* 0 +------------------------------------->
* !
* !
* !
* ! |\____)\___
* ! ) _____ __`<
* ! |/ )/
* !
* !
* !
* V
* Y-axis
*
* With the reference system 'Rs' placed on the camera focal plane.
*
* ¸.·˙!
* ¸.·˙ !
* _ ¸.·˙ !
* +-/ \-+¸.·˙ !
* | (o) | ! Camera focal plane
* +-----+˙·.¸ !
* ˙·.¸ !
* ˙·.¸ !
* ˙·.¸!
*
* When projected on the sensor's pixel array, the image and the associated
* reference system 'Rs' are typically (but not always) inverted, due to
* the camera module's lens optical inversion effect.
*
* Assuming the above represented scene of the swimming shark, the lens
* inversion projects the scene and its reference system onto the sensor
* pixel array, seen from the front of the camera sensor, as follow
*
* Y-axis
* ^
* !
* !
* !
* ! |\_____)\__
* ! ) ____ ___.<
* ! |/ )/
* !
* !
* !
* 0 +------------------------------------->
* 0 X-axis
*
* Note the shark being upside-down.
*
* The resulting projected reference system is named 'Rp'.
*
* The camera rotation property is then defined as the angular difference
* in the counter-clockwise direction between the camera reference system
* 'Rc' and the projected scene reference system 'Rp'. It is expressed in
* degrees as a number in the range [0, 360[.
*
* Examples
*
* 0 degrees camera rotation
*
*
* Y-Rp
* ^
* Y-Rc !
* ^ !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! 0 +------------------------------------->
* ! 0 X-Rp
* 0 +------------------------------------->
* 0 X-Rc
*
*
* X-Rc 0
* <------------------------------------+ 0
* X-Rp 0 !
* <------------------------------------+ 0 !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! V
* ! Y-Rc
* V
* Y-Rp
*
* 90 degrees camera rotation
*
* 0 Y-Rc
* 0 +-------------------->
* ! Y-Rp
* ! ^
* ! !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! 0 +------------------------------------->
* ! 0 X-Rp
* !
* !
* !
* !
* V
* X-Rc
*
* 180 degrees camera rotation
*
* 0
* <------------------------------------+ 0
* X-Rc !
* Y-Rp !
* ^ !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! V
* ! Y-Rc
* 0 +------------------------------------->
* 0 X-Rp
*
* 270 degrees camera rotation
*
* 0 Y-Rc
* 0 +-------------------->
* ! 0
* ! <-----------------------------------+ 0
* ! X-Rp !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! !
* ! V
* ! Y-Rp
* !
* !
* !
* !
* V
* X-Rc
*
*
* Example one - Webcam
*
* A camera module installed on the user facing part of a laptop screen
* casing used for video calls. The captured images are meant to be
* displayed in landscape mode (width > height) on the laptop screen.
*
* The camera is typically mounted upside-down to compensate the lens
* optical inversion effect.
*
* Y-Rp
* Y-Rc ^
* ^ !
* ! !
* ! ! |\_____)\__
* ! ! ) ____ ___.<
* ! ! |/ )/
* ! !
* ! !
* ! !
* ! 0 +------------------------------------->
* ! 0 X-Rp
* 0 +------------------------------------->
* 0 X-Rc
*
* The two reference systems are aligned, the resulting camera rotation is
* 0 degrees, no rotation correction needs to be applied to the resulting
* image once captured to memory buffers to correctly display it to users.
*
* +--------------------------------------+
* ! !
* ! !
* ! !
* ! |\____)\___ !
* ! ) _____ __`< !
* ! |/ )/ !
* ! !
* ! !
* ! !
* +--------------------------------------+
*
* If the camera sensor is not mounted upside-down to compensate for the
* lens optical inversion, the two reference systems will not be aligned,
* with 'Rp' being rotated 180 degrees relatively to 'Rc'.
*
*
* X-Rc 0
* <------------------------------------+ 0
* !
* Y-Rp !
* ^ !
* ! !
* ! |\_____)\__ !
* ! ) ____ ___.< !
* ! |/ )/ !
* ! !
* ! !
* ! V
* ! Y-Rc
* 0 +------------------------------------->
* 0 X-Rp
*
* The image once captured to memory will then be rotated by 180 degrees
*
* +--------------------------------------+
* ! !
* ! !
* ! !
* ! __/(_____/| !
* ! >.___ ____ ( !
* ! \( \| !
* ! !
* ! !
* ! !
* +--------------------------------------+
*
* A software rotation correction of 180 degrees should be applied to
* correctly display the image.
*
* +--------------------------------------+
* ! !
* ! !
* ! !
* ! |\____)\___ !
* ! ) _____ __`< !
* ! |/ )/ !
* ! !
* ! !
* ! !
* +--------------------------------------+
*
* Example two - Phone camera
*
* A camera installed on the back side of a mobile device facing away from
* the user. The captured images are meant to be displayed in portrait mode
* (height > width) to match the device screen orientation and the device
* usage orientation used when taking the picture.
*
* The camera sensor is typically mounted with its pixel array longer side
* aligned to the device longer side, upside-down mounted to compensate for
* the lens optical inversion effect.
*
* 0 Y-Rc
* 0 +-------------------->
* ! Y-Rp
* ! ^
* ! !
* ! !
* ! !
* ! ! |\_____)\__
* ! ! ) ____ ___.<
* ! ! |/ )/
* ! !
* ! !
* ! !
* ! 0 +------------------------------------->
* ! 0 X-Rp
* !
* !
* !
* !
* V
* X-Rc
*
* The two reference systems are not aligned and the 'Rp' reference
* system is rotated by 90 degrees in the counter-clockwise direction
* relatively to the 'Rc' reference system.
*
* The image once captured to memory will be rotated.
*
* +-------------------------------------+
* | _ _ |
* | \ / |
* | | | |
* | | | |
* | | > |
* | < | |
* | | | |
* | . |
* | V |
* +-------------------------------------+
*
* A correction of 90 degrees in counter-clockwise direction has to be
* applied to correctly display the image in portrait mode on the device
* screen.
*
* +--------------------+
* | |
* | |
* | |
* | |
* | |
* | |
* | |\____)\___ |
* | ) _____ __`< |
* | |/ )/ |
* | |
* | |
* | |
* | |
* | |
* +--------------------+
*/
/**
* \var Model
* \brief The model name shall to the extent possible describe the sensor. For
* most devices this is the model name of the sensor. While for some
* devices the sensor model is unavailable as the sensor or the entire
* camera is part of a larger unit and exposed as a black-box to the
* system. In such cases the model name of the smallest device that
* contains the camera sensor shall be used.
*
* The model name is not meant to be a camera name displayed to the
* end-user, but may be combined with other camera information to create a
* camera name.
*
* The model name is not guaranteed to be unique in the system nor is
* it guaranteed to be stable or have any other properties required to make
* it a good candidate to be used as a permanent identifier of a camera.
*
* The model name shall describe the camera in a human readable format and
* shall be encoded in ASCII.
*
* Example model names are 'ov5670', 'imx219' or 'Logitech Webcam C930e'.
*/
/**
* \var UnitCellSize
* \brief The pixel unit cell physical size, in nanometers.
*
* The UnitCellSize properties defines the horizontal and vertical sizes of
* a single pixel unit, including its active and non-active parts. In
* other words, it expresses the horizontal and vertical distance between
* the top-left corners of adjacent pixels.
*
* The property can be used to calculate the physical size of the sensor's
* pixel array area and for calibration purposes.
*/
/**
* \var PixelArraySize
* \brief The camera sensor pixel array readable area vertical and horizontal
* sizes, in pixels.
*
* The PixelArraySize property defines the size in pixel units of the
* readable part of full pixel array matrix, including optical black
* pixels used for calibration, pixels which are not considered valid for
* capture and active pixels containing valid image data.
*
* The property describes the maximum size of the raw data captured by the
* camera, which might not correspond to the physical size of the sensor
* pixel array matrix, as some portions of the physical pixel array matrix
* are not accessible and cannot be transmitted out.
*
* For example, let's consider a pixel array matrix assembled as follows
*
* +--------------------------------------------------+
* |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
* |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
* |xxDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDxx|
* |xxDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDxx|
* |xxDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDxx|
* |xxDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDxx|
* |xxDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDxx|
* |xxDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDxx|
* ... ... ... ... ...
*
* ... ... ... ... ...
* |xxDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDxx|
* |xxDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDxx|
* |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
* |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
* +--------------------------------------------------+
*
* starting with two lines of non-readable pixels (x), followed by N lines
* of readable data (D) surrounded by two columns of non-readable pixels on
* each side, and ending with two more lines of non-readable pixels. Only
* the readable portion is transmitted to the receiving side, defining the
* sizes of the largest possible buffer of raw data that can be presented
* to applications.
*
* PixelArraySize.width
* /----------------------------------------------/
* +----------------------------------------------+ /
* |DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD| |
* |DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD| |
* |DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD| |
* |DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD| |
* |DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD| |
* |DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD| | PixelArraySize.height
* ... ... ... ... ...
* ... ... ... ... ...
* |DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD| |
* |DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD| |
* +----------------------------------------------+ /
*
* This defines a rectangle whose top-left corner is placed in position (0,
* 0) and whose vertical and horizontal sizes are defined by this property.
* All other rectangles that describe portions of the pixel array, such as
* the optical black pixels rectangles and active pixel areas, are defined
* relatively to this rectangle.
*
* All the coordinates are expressed relative to the default sensor readout
* direction, without any transformation (such as horizontal and vertical
* flipping) applied. When mapping them to the raw pixel buffer,
* applications shall take any configured transformation into account.
*
* \todo Rename this property to Size once we will have property
* categories (i.e. Properties::PixelArray::Size)
*/
/**
* \var PixelArrayOpticalBlackRectangles
* \brief The pixel array region(s) which contain optical black pixels
* considered valid for calibration purposes.
*
* This property describes the position and size of optical black pixel
* regions in the raw data buffer as stored in memory, which might differ
* from their actual physical location in the pixel array matrix.
*
* It is important to note, in fact, that camera sensors might
* automatically reorder or skip portions of their pixels array matrix when
* transmitting data to the receiver. For instance, a sensor may merge the
* top and bottom optical black rectangles into a single rectangle,
* transmitted at the beginning of the frame.
*
* The pixel array contains several areas with different purposes,
* interleaved by lines and columns which are said not to be valid for
* capturing purposes. Invalid lines and columns are defined as invalid as
* they could be positioned too close to the chip margins or to the optical
* black shielding placed on top of optical black pixels.
*
* PixelArraySize.width
* /----------------------------------------------/
* x1 x2
* +--o---------------------------------------o---+ /
* |IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII| |
* |IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII| |
* y1 oIIOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOII| |
* |IIOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOII| |
* |IIOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOII| |
* y2 oIIOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOII| |
* |IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII| |
* |IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII| |
* y3 |IIOOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPOOII| |
* |IIOOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPOOII| | PixelArraySize.height
* |IIOOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPOOII| |
* ... ... ... ... ...
* ... ... ... ... ...
* y4 |IIOOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPOOII| |
* |IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII| |
* |IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII| |
* +----------------------------------------------+ /
*
* The readable pixel array matrix is composed by
* 2 invalid lines (I)
* 4 lines of valid optical black pixels (O)
* 2 invalid lines (I)
* n lines of valid pixel data (P)
* 2 invalid lines (I)
*
* And the position of the optical black pixel rectangles is defined by
*
* PixelArrayOpticalBlackRectangles = {
* { x1, y1, x2 - x1 + 1, y2 - y1 + 1 },
* { x1, y3, 2, y4 - y3 + 1 },
* { x2, y3, 2, y4 - y3 + 1 },
* };
*
* If the camera, when capturing the full pixel array matrix, automatically
* skips the invalid lines and columns, producing the following data
* buffer, when captured to memory
*
* PixelArraySize.width
* /----------------------------------------------/
* x1
* +--------------------------------------------o-+ /
* |OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO| |
* |OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO| |
* |OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO| |
* |OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO| |
* y1 oOOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPOO| |
* |OOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPOO| |
* |OOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPOO| | PixelArraySize.height
* ... ... ... ... ... |
* ... ... ... ... ... |
* |OOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPOO| |
* |OOPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPOO| |
* +----------------------------------------------+ /
*
* then the invalid lines and columns should not be reported as part of the
* PixelArraySize property in first place.
*
* In this case, the position of the black pixel rectangles will be
*
* PixelArrayOpticalBlackRectangles = {
* { 0, 0, y1 + 1, PixelArraySize[0] },
* { 0, y1, 2, PixelArraySize[1] - y1 + 1 },
* { x1, y1, 2, PixelArraySize[1] - y1 + 1 },
* };
*
* \todo Rename this property to Size once we will have property
* categories (i.e. Properties::PixelArray::OpticalBlackRectangles)
*/
/**
* \var PixelArrayActiveAreas
* \brief The PixelArrayActiveAreas property defines the (possibly multiple and
* overlapping) portions of the camera sensor readable pixel matrix
* which are considered valid for image acquisition purposes.
*
* This property describes an arbitrary number of overlapping rectangles,
* with each rectangle representing the maximum image size that the camera
* sensor can produce for a particular aspect ratio. They are defined
* relatively to the PixelArraySize rectangle.
*
* When multiple rectangles are reported, they shall be ordered from the
* tallest to the shortest.
*
* Example 1
* A camera sensor which only produces images in the 4:3 image resolution
* will report a single PixelArrayActiveAreas rectangle, from which all
* other image formats are obtained by either cropping the field-of-view
* and/or applying pixel sub-sampling techniques such as pixel skipping or
* binning.
*
* PixelArraySize.width
* /----------------/
* x1 x2
* (0,0)-> +-o------------o-+ /
* y1 o +------------+ | |
* | |////////////| | |
* | |////////////| | | PixelArraySize.height
* | |////////////| | |
* y2 o +------------+ | |
* +----------------+ /
*
* The property reports a single rectangle
*
* PixelArrayActiveAreas = (x1, y1, x2 - x1 + 1, y2 - y1 + 1)
*
* Example 2
* A camera sensor which can produce images in different native
* resolutions will report several overlapping rectangles, one for each
* natively supported resolution.
*
* PixelArraySize.width
* /------------------/
* x1 x2 x3 x4
* (0,0)-> +o---o------o---o+ /
* y1 o +------+ | |
* | |//////| | |
* y2 o+---+------+---+| |
* ||///|//////|///|| | PixelArraySize.height
* y3 o+---+------+---+| |
* | |//////| | |
* y4 o +------+ | |
* +----+------+----+ /
*
* The property reports two rectangles
*
* PixelArrayActiveAreas = ((x2, y1, x3 - x2 + 1, y4 - y1 + 1),
* (x1, y2, x4 - x1 + 1, y3 - y2 + 1))
*
* The first rectangle describes the maximum field-of-view of all image
* formats in the 4:3 resolutions, while the second one describes the
* maximum field of view for all image formats in the 16:9 resolutions.
*
* Multiple rectangles shall only be reported when the sensor can't capture
* the pixels in the corner regions. If all the pixels in the (x1,y1) -
* (x4,y4) area can be captured, the PixelArrayActiveAreas property shall
* contains the single rectangle (x1,y1) - (x4,y4).
*
* \todo Rename this property to ActiveAreas once we will have property
* categories (i.e. Properties::PixelArray::ActiveAreas)
*/
/**
* \var ScalerCropMaximum
* \brief The maximum valid rectangle for the controls::ScalerCrop control. This
* reflects the minimum mandatory cropping applied in the camera sensor and
* the rest of the pipeline. Just as the ScalerCrop control, it defines a
* rectangle taken from the sensor's active pixel array.
*
* This property is valid only after the camera has been successfully
* configured and its value may change whenever a new configuration is
* applied.
*
* \todo Turn this property into a "maximum control value" for the
* ScalerCrop control once "dynamic" controls have been implemented.
*/
/**
* \var SensorSensitivity
* \brief The relative sensitivity of the chosen sensor mode.
*
* Some sensors have readout modes with different sensitivities. For example,
* a binned camera mode might, with the same exposure and gains, produce
* twice the signal level of the full resolution readout. This would be
* signalled by the binned mode, when it is chosen, indicating a value here
* that is twice that of the full resolution mode. This value will be valid
* after the configure method has returned successfully.
*/
/**
* \var SystemDevices
* \brief A list of integer values of type dev_t denoting the major and minor
* device numbers of the underlying devices used in the operation of this
* camera.
*
* Different cameras may report identical devices.
*/
/**
* \var PipelineHandler
* \brief The name of the pipeline handler that manages this camera device.o
*
* This property is meant to help development, debugging and support. The
* pipeline handler name is not guaranteed to be stable across libcamera
* releases.
*/
/**
* \brief Namespace for draft properties
*/
namespace draft {
/**
* \enum ColorFilterArrangementEnum
* \brief Supported ColorFilterArrangement values
*
* \var RGGB
* \brief RGGB Bayer pattern
*
* \var GRBG
* \brief GRBG Bayer pattern
*
* \var GBRG
* \brief GBRG Bayer pattern
*
* \var BGGR
* \brief BGGR Bayer pattern
*
* \var RGB
* \brief Sensor is not Bayer; output has 3 16-bit values for each pixel,
* instead of just 1 16-bit value per pixel.
*
* \var MONO
* \brief Sensor is not Bayer; output consists of a single colour channel.
*/
/**
* \var ColorFilterArrangementValues
* \brief List of all ColorFilterArrangement supported values
*/
/**
* \var ColorFilterArrangementNameValueMap
* \brief Map of all ColorFilterArrangement supported value names (in std::string format) to value
*/
/**
* \var ColorFilterArrangement
* \brief The arrangement of color filters on sensor; represents the colors in the
* top-left 2x2 section of the sensor, in reading order. Currently
* identical to ANDROID_SENSOR_INFO_COLOR_FILTER_ARRANGEMENT.
*/
} /* namespace draft */
#ifndef __DOXYGEN__
/*
* Keep the properties definitions hidden from doxygen as it incorrectly parses
* them as functions.
*/
extern const std::array<const ControlValue, 3> LocationValues = {
static_cast<int32_t>(CameraLocationFront),
static_cast<int32_t>(CameraLocationBack),
static_cast<int32_t>(CameraLocationExternal),
};
extern const std::map<std::string, int32_t> LocationNameValueMap = {
{ "CameraLocationFront", CameraLocationFront },
{ "CameraLocationBack", CameraLocationBack },
{ "CameraLocationExternal", CameraLocationExternal },
};
extern const Control<int32_t> Location(LOCATION, "Location", "libcamera", ControlId::Direction::Out, LocationNameValueMap);
extern const Control<int32_t> Rotation(ROTATION, "Rotation", "libcamera", ControlId::Direction::Out);
extern const Control<std::string_view> Model(MODEL, "Model", "libcamera", ControlId::Direction::Out);
extern const Control<Size> UnitCellSize(UNIT_CELL_SIZE, "UnitCellSize", "libcamera", ControlId::Direction::Out);
extern const Control<Size> PixelArraySize(PIXEL_ARRAY_SIZE, "PixelArraySize", "libcamera", ControlId::Direction::Out);
extern const Control<Span<const Rectangle>> PixelArrayOpticalBlackRectangles(PIXEL_ARRAY_OPTICAL_BLACK_RECTANGLES, "PixelArrayOpticalBlackRectangles", "libcamera", ControlId::Direction::Out);
extern const Control<Span<const Rectangle>> PixelArrayActiveAreas(PIXEL_ARRAY_ACTIVE_AREAS, "PixelArrayActiveAreas", "libcamera", ControlId::Direction::Out);
extern const Control<Rectangle> ScalerCropMaximum(SCALER_CROP_MAXIMUM, "ScalerCropMaximum", "libcamera", ControlId::Direction::Out);
extern const Control<float> SensorSensitivity(SENSOR_SENSITIVITY, "SensorSensitivity", "libcamera", ControlId::Direction::Out);
extern const Control<Span<const int64_t>> SystemDevices(SYSTEM_DEVICES, "SystemDevices", "libcamera", ControlId::Direction::Out);
extern const Control<std::string_view> PipelineHandler(PIPELINE_HANDLER, "PipelineHandler", "libcamera", ControlId::Direction::Out);
namespace draft {
extern const std::array<const ControlValue, 6> ColorFilterArrangementValues = {
static_cast<int32_t>(RGGB),
static_cast<int32_t>(GRBG),
static_cast<int32_t>(GBRG),
static_cast<int32_t>(BGGR),
static_cast<int32_t>(RGB),
static_cast<int32_t>(MONO),
};
extern const std::map<std::string, int32_t> ColorFilterArrangementNameValueMap = {
{ "RGGB", RGGB },
{ "GRBG", GRBG },
{ "GBRG", GBRG },
{ "BGGR", BGGR },
{ "RGB", RGB },
{ "MONO", MONO },
};
extern const Control<int32_t> ColorFilterArrangement(COLOR_FILTER_ARRANGEMENT, "ColorFilterArrangement", "draft", ControlId::Direction::Out, ColorFilterArrangementNameValueMap);
} /* namespace draft */
#endif /* __DOXYGEN__ */
/**
* \brief List of all supported libcamera properties
*/
extern const ControlIdMap properties {
{ LOCATION, &Location },
{ ROTATION, &Rotation },
{ MODEL, &Model },
{ UNIT_CELL_SIZE, &UnitCellSize },
{ PIXEL_ARRAY_SIZE, &PixelArraySize },
{ PIXEL_ARRAY_OPTICAL_BLACK_RECTANGLES, &PixelArrayOpticalBlackRectangles },
{ PIXEL_ARRAY_ACTIVE_AREAS, &PixelArrayActiveAreas },
{ SCALER_CROP_MAXIMUM, &ScalerCropMaximum },
{ SENSOR_SENSITIVITY, &SensorSensitivity },
{ SYSTEM_DEVICES, &SystemDevices },
{ PIPELINE_HANDLER, &PipelineHandler },
{ draft::COLOR_FILTER_ARRANGEMENT, &draft::ColorFilterArrangement },
};
} /* namespace properties */
} /* namespace libcamera */

View File

@@ -0,0 +1,683 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* Image Processing Algorithm proxy for raspberrypi
*
* This file is auto-generated. Do not edit.
*/
#include <libcamera/ipa/raspberrypi_ipa_proxy.h>
#include <memory>
#include <string>
#include <vector>
#include <libcamera/ipa/ipa_module_info.h>
#include <libcamera/ipa/raspberrypi_ipa_interface.h>
#include <libcamera/ipa/raspberrypi_ipa_serializer.h>
#include <libcamera/base/log.h>
#include <libcamera/base/thread.h>
#include "libcamera/internal/control_serializer.h"
#include "libcamera/internal/ipa_data_serializer.h"
#include "libcamera/internal/ipa_module.h"
#include "libcamera/internal/ipa_proxy.h"
#include "libcamera/internal/ipc_pipe.h"
#include "libcamera/internal/ipc_pipe_unixsocket.h"
#include "libcamera/internal/ipc_unixsocket.h"
#include "libcamera/internal/process.h"
namespace libcamera {
LOG_DECLARE_CATEGORY(IPAProxy)
namespace ipa {
namespace RPi {
IPAProxyRPiThreaded::IPAProxyRPiThreaded(IPAModule *ipam, const CameraManager &cm)
: IPAProxyRPi(ipam, cm), thread_("IPAProxyRPi")
{
LOG(IPAProxy, Debug)
<< "initializing raspberrypi proxy in thread: loading IPA from "
<< ipam->path();
if (!ipam->load())
return;
IPAInterface *ipai = ipam->createInterface();
if (!ipai) {
LOG(IPAProxy, Error)
<< "Failed to create IPA context for " << ipam->path();
return;
}
ipa_ = std::unique_ptr<IPARPiInterface>(static_cast<IPARPiInterface *>(ipai));
proxy_.setIPA(ipa_.get());
ipa_->prepareIspComplete.connect(this, &IPAProxyRPiThreaded::prepareIspCompleteHandler);
ipa_->processStatsComplete.connect(this, &IPAProxyRPiThreaded::processStatsCompleteHandler);
ipa_->metadataReady.connect(this, &IPAProxyRPiThreaded::metadataReadyHandler);
ipa_->setIspControls.connect(this, &IPAProxyRPiThreaded::setIspControlsHandler);
ipa_->setDelayedControls.connect(this, &IPAProxyRPiThreaded::setDelayedControlsHandler);
ipa_->setLensControls.connect(this, &IPAProxyRPiThreaded::setLensControlsHandler);
ipa_->setCameraTimeout.connect(this, &IPAProxyRPiThreaded::setCameraTimeoutHandler);
valid_ = true;
}
IPAProxyRPiThreaded::~IPAProxyRPiThreaded() = default;
int32_t IPAProxyRPiThreaded::init(
const IPASettings &settings,
const InitParams &params,
InitResult *result)
{
int32_t _ret = ipa_->init(settings, params, result);
proxy_.moveToThread(&thread_);
return _ret;
}
void IPAProxyRPiThreaded::start(
const ControlList &controls,
StartResult *result)
{
state_ = ProxyRunning;
thread_.start();
return proxy_.invokeMethod(&ThreadProxy::start, ConnectionTypeBlocking, controls, result);
}
void IPAProxyRPiThreaded::stop()
{
ASSERT(state_ != ProxyStopping);
if (state_ != ProxyRunning)
return;
state_ = ProxyStopping;
proxy_.invokeMethod(&ThreadProxy::stop, ConnectionTypeBlocking);
thread_.exit();
thread_.wait();
Thread::current()->dispatchMessages(Message::Type::InvokeMessage, this);
state_ = ProxyStopped;
}
int32_t IPAProxyRPiThreaded::configure(
const IPACameraSensorInfo &sensorInfo,
const ConfigParams &params,
ConfigResult *result)
{
return ipa_->configure(sensorInfo, params, result);
}
void IPAProxyRPiThreaded::mapBuffers(
const std::vector<libcamera::IPABuffer> &buffers)
{
return ipa_->mapBuffers(buffers);
}
void IPAProxyRPiThreaded::unmapBuffers(
const std::vector<uint32_t> &ids)
{
return ipa_->unmapBuffers(ids);
}
void IPAProxyRPiThreaded::prepareIsp(
const PrepareParams &params)
{
ASSERT(state_ == ProxyRunning);
proxy_.invokeMethod(&ThreadProxy::prepareIsp, ConnectionTypeQueued, params);
}
void IPAProxyRPiThreaded::processStats(
const ProcessParams &params)
{
ASSERT(state_ == ProxyRunning);
proxy_.invokeMethod(&ThreadProxy::processStats, ConnectionTypeQueued, params);
}
void IPAProxyRPiThreaded::prepareIspCompleteHandler(
const BufferIds &buffers,
const bool stitchSwapBuffers)
{
ASSERT(state_ != ProxyStopped);
prepareIspComplete.emit(buffers, stitchSwapBuffers);
}
void IPAProxyRPiThreaded::processStatsCompleteHandler(
const BufferIds &buffers)
{
ASSERT(state_ != ProxyStopped);
processStatsComplete.emit(buffers);
}
void IPAProxyRPiThreaded::metadataReadyHandler(
const ControlList &metadata)
{
ASSERT(state_ != ProxyStopped);
metadataReady.emit(metadata);
}
void IPAProxyRPiThreaded::setIspControlsHandler(
const ControlList &controls)
{
ASSERT(state_ != ProxyStopped);
setIspControls.emit(controls);
}
void IPAProxyRPiThreaded::setDelayedControlsHandler(
const ControlList &controls,
const uint32_t delayContext)
{
ASSERT(state_ != ProxyStopped);
setDelayedControls.emit(controls, delayContext);
}
void IPAProxyRPiThreaded::setLensControlsHandler(
const ControlList &controls)
{
ASSERT(state_ != ProxyStopped);
setLensControls.emit(controls);
}
void IPAProxyRPiThreaded::setCameraTimeoutHandler(
const uint32_t maxFrameLengthMs)
{
ASSERT(state_ != ProxyStopped);
setCameraTimeout.emit(maxFrameLengthMs);
}
/* ========================================================================== */
IPAProxyRPiIsolated::IPAProxyRPiIsolated(IPAModule *ipam, const CameraManager &cm)
: IPAProxyRPi(ipam, cm),
controlSerializer_(ControlSerializer::Role::Proxy), seq_(0)
{
LOG(IPAProxy, Debug)
<< "initializing raspberrypi proxy in isolation: loading IPA from "
<< ipam->path();
const std::string proxyWorkerPath = resolvePath("raspberrypi_ipa_proxy");
if (proxyWorkerPath.empty()) {
LOG(IPAProxy, Error) << "Failed to get proxy worker path";
return;
}
auto ipc = std::make_unique<IPCPipeUnixSocket>(ipam->path().c_str(),
proxyWorkerPath.c_str());
if (!ipc->isConnected()) {
LOG(IPAProxy, Error) << "Failed to create IPCPipe";
return;
}
ipc->recv.connect(this, &IPAProxyRPiIsolated::recvMessage);
ipc_ = std::move(ipc);
valid_ = true;
}
IPAProxyRPiIsolated::~IPAProxyRPiIsolated()
{
if (ipc_) {
IPCMessage::Header header =
{ static_cast<uint32_t>(_RPiCmd::Exit), seq_++ };
IPCMessage msg(header);
ipc_->sendAsync(msg);
}
}
int32_t IPAProxyRPiIsolated::init(
const IPASettings &settings,
const InitParams &params,
InitResult *result)
{
IPCMessage::Header _header = { static_cast<uint32_t>(_RPiCmd::Init), seq_++ };
IPCMessage _ipcInputBuf(_header);
IPCMessage _ipcOutputBuf;
std::vector<uint8_t> settingsBuf;
std::tie(settingsBuf, std::ignore) =
IPADataSerializer<libcamera::IPASettings>::serialize(settings);
std::vector<uint8_t> paramsBuf;
std::vector<SharedFD> paramsFds;
std::tie(paramsBuf, paramsFds) =
IPADataSerializer<ipa::RPi::InitParams>::serialize(params);
appendPOD<uint32_t>(_ipcInputBuf.data(), settingsBuf.size());
appendPOD<uint32_t>(_ipcInputBuf.data(), paramsBuf.size());
appendPOD<uint32_t>(_ipcInputBuf.data(), paramsFds.size());
_ipcInputBuf.data().insert(_ipcInputBuf.data().end(), settingsBuf.begin(), settingsBuf.end());
_ipcInputBuf.data().insert(_ipcInputBuf.data().end(), paramsBuf.begin(), paramsBuf.end());
_ipcInputBuf.fds().insert(_ipcInputBuf.fds().end(), paramsFds.begin(), paramsFds.end());
int _ret = ipc_->sendSync(_ipcInputBuf, &_ipcOutputBuf);
if (_ret < 0) {
LOG(IPAProxy, Error) << "Failed to call init: " << _ret;
return static_cast<int32_t>(_ret);
}
int32_t _retValue = IPADataSerializer<int32_t>::deserialize(_ipcOutputBuf.data(), 0);
const size_t resultStart = 4;
if (result) {
*result =
IPADataSerializer<ipa::RPi::InitResult>::deserialize(
_ipcOutputBuf.data().cbegin() + resultStart,
_ipcOutputBuf.data().cend(),
&controlSerializer_);
}
return _retValue;
}
void IPAProxyRPiIsolated::start(
const ControlList &controls,
StartResult *result)
{
IPCMessage::Header _header = { static_cast<uint32_t>(_RPiCmd::Start), seq_++ };
IPCMessage _ipcInputBuf(_header);
IPCMessage _ipcOutputBuf;
std::vector<uint8_t> controlsBuf;
std::tie(controlsBuf, std::ignore) =
IPADataSerializer<libcamera::ControlList>::serialize(controls, &controlSerializer_);
_ipcInputBuf.data().insert(_ipcInputBuf.data().end(), controlsBuf.begin(), controlsBuf.end());
int _ret = ipc_->sendSync(_ipcInputBuf, &_ipcOutputBuf);
if (_ret < 0) {
LOG(IPAProxy, Error) << "Failed to call start: " << _ret;
return;
}
const size_t resultStart = 0;
if (result) {
*result =
IPADataSerializer<ipa::RPi::StartResult>::deserialize(
_ipcOutputBuf.data().cbegin() + resultStart,
_ipcOutputBuf.data().cend(),
&controlSerializer_);
}
}
void IPAProxyRPiIsolated::stop()
{
IPCMessage::Header _header = { static_cast<uint32_t>(_RPiCmd::Stop), seq_++ };
IPCMessage _ipcInputBuf(_header);
int _ret = ipc_->sendSync(_ipcInputBuf);
if (_ret < 0) {
LOG(IPAProxy, Error) << "Failed to call stop: " << _ret;
return;
}
}
int32_t IPAProxyRPiIsolated::configure(
const IPACameraSensorInfo &sensorInfo,
const ConfigParams &params,
ConfigResult *result)
{
controlSerializer_.reset();
IPCMessage::Header _header = { static_cast<uint32_t>(_RPiCmd::Configure), seq_++ };
IPCMessage _ipcInputBuf(_header);
IPCMessage _ipcOutputBuf;
std::vector<uint8_t> sensorInfoBuf;
std::tie(sensorInfoBuf, std::ignore) =
IPADataSerializer<libcamera::IPACameraSensorInfo>::serialize(sensorInfo);
std::vector<uint8_t> paramsBuf;
std::vector<SharedFD> paramsFds;
std::tie(paramsBuf, paramsFds) =
IPADataSerializer<ipa::RPi::ConfigParams>::serialize(params, &controlSerializer_);
appendPOD<uint32_t>(_ipcInputBuf.data(), sensorInfoBuf.size());
appendPOD<uint32_t>(_ipcInputBuf.data(), paramsBuf.size());
appendPOD<uint32_t>(_ipcInputBuf.data(), paramsFds.size());
_ipcInputBuf.data().insert(_ipcInputBuf.data().end(), sensorInfoBuf.begin(), sensorInfoBuf.end());
_ipcInputBuf.data().insert(_ipcInputBuf.data().end(), paramsBuf.begin(), paramsBuf.end());
_ipcInputBuf.fds().insert(_ipcInputBuf.fds().end(), paramsFds.begin(), paramsFds.end());
int _ret = ipc_->sendSync(_ipcInputBuf, &_ipcOutputBuf);
if (_ret < 0) {
LOG(IPAProxy, Error) << "Failed to call configure: " << _ret;
return static_cast<int32_t>(_ret);
}
int32_t _retValue = IPADataSerializer<int32_t>::deserialize(_ipcOutputBuf.data(), 0);
const size_t resultStart = 4;
if (result) {
*result =
IPADataSerializer<ipa::RPi::ConfigResult>::deserialize(
_ipcOutputBuf.data().cbegin() + resultStart,
_ipcOutputBuf.data().cend(),
&controlSerializer_);
}
return _retValue;
}
void IPAProxyRPiIsolated::mapBuffers(
const std::vector<libcamera::IPABuffer> &buffers)
{
IPCMessage::Header _header = { static_cast<uint32_t>(_RPiCmd::MapBuffers), seq_++ };
IPCMessage _ipcInputBuf(_header);
std::vector<uint8_t> buffersBuf;
std::vector<SharedFD> buffersFds;
std::tie(buffersBuf, buffersFds) =
IPADataSerializer<std::vector<libcamera::IPABuffer>>::serialize(buffers);
_ipcInputBuf.data().insert(_ipcInputBuf.data().end(), buffersBuf.begin(), buffersBuf.end());
_ipcInputBuf.fds().insert(_ipcInputBuf.fds().end(), buffersFds.begin(), buffersFds.end());
int _ret = ipc_->sendSync(_ipcInputBuf);
if (_ret < 0) {
LOG(IPAProxy, Error) << "Failed to call mapBuffers: " << _ret;
return;
}
}
void IPAProxyRPiIsolated::unmapBuffers(
const std::vector<uint32_t> &ids)
{
IPCMessage::Header _header = { static_cast<uint32_t>(_RPiCmd::UnmapBuffers), seq_++ };
IPCMessage _ipcInputBuf(_header);
std::vector<uint8_t> idsBuf;
std::tie(idsBuf, std::ignore) =
IPADataSerializer<std::vector<uint32_t>>::serialize(ids);
_ipcInputBuf.data().insert(_ipcInputBuf.data().end(), idsBuf.begin(), idsBuf.end());
int _ret = ipc_->sendSync(_ipcInputBuf);
if (_ret < 0) {
LOG(IPAProxy, Error) << "Failed to call unmapBuffers: " << _ret;
return;
}
}
void IPAProxyRPiIsolated::prepareIsp(
const PrepareParams &params)
{
IPCMessage::Header _header = { static_cast<uint32_t>(_RPiCmd::PrepareIsp), seq_++ };
IPCMessage _ipcInputBuf(_header);
std::vector<uint8_t> paramsBuf;
std::tie(paramsBuf, std::ignore) =
IPADataSerializer<ipa::RPi::PrepareParams>::serialize(params, &controlSerializer_);
_ipcInputBuf.data().insert(_ipcInputBuf.data().end(), paramsBuf.begin(), paramsBuf.end());
int _ret = ipc_->sendAsync(_ipcInputBuf);
if (_ret < 0) {
LOG(IPAProxy, Error) << "Failed to call prepareIsp: " << _ret;
return;
}
}
void IPAProxyRPiIsolated::processStats(
const ProcessParams &params)
{
IPCMessage::Header _header = { static_cast<uint32_t>(_RPiCmd::ProcessStats), seq_++ };
IPCMessage _ipcInputBuf(_header);
std::vector<uint8_t> paramsBuf;
std::tie(paramsBuf, std::ignore) =
IPADataSerializer<ipa::RPi::ProcessParams>::serialize(params);
_ipcInputBuf.data().insert(_ipcInputBuf.data().end(), paramsBuf.begin(), paramsBuf.end());
int _ret = ipc_->sendAsync(_ipcInputBuf);
if (_ret < 0) {
LOG(IPAProxy, Error) << "Failed to call processStats: " << _ret;
return;
}
}
void IPAProxyRPiIsolated::recvMessage(const IPCMessage &data)
{
size_t dataSize = data.data().size();
_RPiEventCmd _cmd = static_cast<_RPiEventCmd>(data.header().cmd);
switch (_cmd) {
case _RPiEventCmd::PrepareIspComplete: {
prepareIspCompleteHandler(data.data().cbegin(), dataSize, data.fds());
break;
}
case _RPiEventCmd::ProcessStatsComplete: {
processStatsCompleteHandler(data.data().cbegin(), dataSize, data.fds());
break;
}
case _RPiEventCmd::MetadataReady: {
metadataReadyHandler(data.data().cbegin(), dataSize, data.fds());
break;
}
case _RPiEventCmd::SetIspControls: {
setIspControlsHandler(data.data().cbegin(), dataSize, data.fds());
break;
}
case _RPiEventCmd::SetDelayedControls: {
setDelayedControlsHandler(data.data().cbegin(), dataSize, data.fds());
break;
}
case _RPiEventCmd::SetLensControls: {
setLensControlsHandler(data.data().cbegin(), dataSize, data.fds());
break;
}
case _RPiEventCmd::SetCameraTimeout: {
setCameraTimeoutHandler(data.data().cbegin(), dataSize, data.fds());
break;
}
default:
LOG(IPAProxy, Error) << "Unknown command " << static_cast<uint32_t>(_cmd);
}
}
void IPAProxyRPiIsolated::prepareIspCompleteHandler(
[[maybe_unused]] std::vector<uint8_t>::const_iterator data,
[[maybe_unused]] size_t dataSize,
[[maybe_unused]] const std::vector<SharedFD> &fds)
{
[[maybe_unused]] const size_t buffersBufSize = readPOD<uint32_t>(data, 0, data + dataSize);
[[maybe_unused]] const size_t stitchSwapBuffersBufSize = readPOD<uint32_t>(data, 4, data + dataSize);
const size_t buffersStart = 8;
const size_t stitchSwapBuffersStart = buffersStart + buffersBufSize;
BufferIds buffers =
IPADataSerializer<ipa::RPi::BufferIds>::deserialize(
data + buffersStart,
data + buffersStart + buffersBufSize);
bool stitchSwapBuffers =
IPADataSerializer<bool>::deserialize(
data + stitchSwapBuffersStart,
data + stitchSwapBuffersStart + stitchSwapBuffersBufSize);
prepareIspComplete.emit(buffers, stitchSwapBuffers);
}
void IPAProxyRPiIsolated::processStatsCompleteHandler(
[[maybe_unused]] std::vector<uint8_t>::const_iterator data,
[[maybe_unused]] size_t dataSize,
[[maybe_unused]] const std::vector<SharedFD> &fds)
{
const size_t buffersStart = 0;
BufferIds buffers =
IPADataSerializer<ipa::RPi::BufferIds>::deserialize(
data + buffersStart,
data + dataSize);
processStatsComplete.emit(buffers);
}
void IPAProxyRPiIsolated::metadataReadyHandler(
[[maybe_unused]] std::vector<uint8_t>::const_iterator data,
[[maybe_unused]] size_t dataSize,
[[maybe_unused]] const std::vector<SharedFD> &fds)
{
const size_t metadataStart = 0;
ControlList metadata =
IPADataSerializer<libcamera::ControlList>::deserialize(
data + metadataStart,
data + dataSize,
&controlSerializer_);
metadataReady.emit(metadata);
}
void IPAProxyRPiIsolated::setIspControlsHandler(
[[maybe_unused]] std::vector<uint8_t>::const_iterator data,
[[maybe_unused]] size_t dataSize,
[[maybe_unused]] const std::vector<SharedFD> &fds)
{
const size_t controlsStart = 0;
ControlList controls =
IPADataSerializer<libcamera::ControlList>::deserialize(
data + controlsStart,
data + dataSize,
&controlSerializer_);
setIspControls.emit(controls);
}
void IPAProxyRPiIsolated::setDelayedControlsHandler(
[[maybe_unused]] std::vector<uint8_t>::const_iterator data,
[[maybe_unused]] size_t dataSize,
[[maybe_unused]] const std::vector<SharedFD> &fds)
{
[[maybe_unused]] const size_t controlsBufSize = readPOD<uint32_t>(data, 0, data + dataSize);
[[maybe_unused]] const size_t delayContextBufSize = readPOD<uint32_t>(data, 4, data + dataSize);
const size_t controlsStart = 8;
const size_t delayContextStart = controlsStart + controlsBufSize;
ControlList controls =
IPADataSerializer<libcamera::ControlList>::deserialize(
data + controlsStart,
data + controlsStart + controlsBufSize,
&controlSerializer_);
uint32_t delayContext =
IPADataSerializer<uint32_t>::deserialize(
data + delayContextStart,
data + delayContextStart + delayContextBufSize);
setDelayedControls.emit(controls, delayContext);
}
void IPAProxyRPiIsolated::setLensControlsHandler(
[[maybe_unused]] std::vector<uint8_t>::const_iterator data,
[[maybe_unused]] size_t dataSize,
[[maybe_unused]] const std::vector<SharedFD> &fds)
{
const size_t controlsStart = 0;
ControlList controls =
IPADataSerializer<libcamera::ControlList>::deserialize(
data + controlsStart,
data + dataSize,
&controlSerializer_);
setLensControls.emit(controls);
}
void IPAProxyRPiIsolated::setCameraTimeoutHandler(
[[maybe_unused]] std::vector<uint8_t>::const_iterator data,
[[maybe_unused]] size_t dataSize,
[[maybe_unused]] const std::vector<SharedFD> &fds)
{
const size_t maxFrameLengthMsStart = 0;
uint32_t maxFrameLengthMs =
IPADataSerializer<uint32_t>::deserialize(
data + maxFrameLengthMsStart,
data + dataSize);
setCameraTimeout.emit(maxFrameLengthMs);
}
} /* namespace RPi */
} /* namespace ipa */
} /* namespace libcamera */

View File

@@ -0,0 +1,16 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* libcamera version
*
* This file is auto-generated. Do not edit.
*/
#include <libcamera/camera_manager.h>
namespace libcamera {
const std::string CameraManager::version_("v0.7.1+6234-8bf59a6b");
} /* namespace libcamera */