From f934fd1cb9371dc49e32aee061284a2dadd8ea89 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 15 May 2020 19:01:30 +0300 Subject: libcamera: Move IPA headers from include/ipa/ to include/libcamera/ipa/ The IPA headers are installed into $prefix/include/libcamera/ipa/, but are located in the source tree in include/ipa/. This requires files within libcamera to include them with #include while a third party IPA would need to use #include Not only is this inconsistent, it can create issues later if IPA headers need to include each other, as the first form of include directive wouldn't be valid once the headers are installed. Fix the problem by moving the IPA headers to include/libcamera/ipa/. Signed-off-by: Laurent Pinchart Acked-by: Jacopo Mondi --- include/ipa/ipa_controls.h | 47 ------ include/ipa/ipa_interface.h | 173 ----------------------- include/ipa/ipa_module_info.h | 29 ---- include/ipa/ipa_vimc.h | 24 ---- include/ipa/meson.build | 10 -- include/ipa/raspberrypi.h | 58 -------- include/ipa/rkisp1.h | 18 --- include/libcamera/internal/ipa_context_wrapper.h | 2 +- include/libcamera/internal/ipa_manager.h | 4 +- include/libcamera/internal/ipa_module.h | 4 +- include/libcamera/internal/ipa_proxy.h | 2 +- include/libcamera/ipa/ipa_controls.h | 47 ++++++ include/libcamera/ipa/ipa_interface.h | 173 +++++++++++++++++++++++ include/libcamera/ipa/ipa_module_info.h | 29 ++++ include/libcamera/ipa/ipa_vimc.h | 24 ++++ include/libcamera/ipa/meson.build | 10 ++ include/libcamera/ipa/raspberrypi.h | 58 ++++++++ include/libcamera/ipa/rkisp1.h | 18 +++ include/libcamera/meson.build | 1 + include/meson.build | 1 - 20 files changed, 366 insertions(+), 366 deletions(-) delete mode 100644 include/ipa/ipa_controls.h delete mode 100644 include/ipa/ipa_interface.h delete mode 100644 include/ipa/ipa_module_info.h delete mode 100644 include/ipa/ipa_vimc.h delete mode 100644 include/ipa/meson.build delete mode 100644 include/ipa/raspberrypi.h delete mode 100644 include/ipa/rkisp1.h create mode 100644 include/libcamera/ipa/ipa_controls.h create mode 100644 include/libcamera/ipa/ipa_interface.h create mode 100644 include/libcamera/ipa/ipa_module_info.h create mode 100644 include/libcamera/ipa/ipa_vimc.h create mode 100644 include/libcamera/ipa/meson.build create mode 100644 include/libcamera/ipa/raspberrypi.h create mode 100644 include/libcamera/ipa/rkisp1.h (limited to 'include') diff --git a/include/ipa/ipa_controls.h b/include/ipa/ipa_controls.h deleted file mode 100644 index 6d3bf279..00000000 --- a/include/ipa/ipa_controls.h +++ /dev/null @@ -1,47 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2019, Google Inc. - * - * ipa_controls.h - IPA Control handling - */ -#ifndef __LIBCAMERA_IPA_CONTROLS_H__ -#define __LIBCAMERA_IPA_CONTROLS_H__ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define IPA_CONTROLS_FORMAT_VERSION 1 - -struct ipa_controls_header { - uint32_t version; - uint32_t handle; - uint32_t entries; - uint32_t size; - uint32_t data_offset; - uint32_t reserved[3]; -}; - -struct ipa_control_value_entry { - uint32_t id; - uint8_t type; - uint8_t is_array; - uint16_t count; - uint32_t offset; - uint32_t padding[1]; -}; - -struct ipa_control_info_entry { - uint32_t id; - uint32_t type; - uint32_t offset; - uint32_t padding[1]; -}; - -#ifdef __cplusplus -} -#endif - -#endif /* __LIBCAMERA_IPA_CONTROLS_H__ */ diff --git a/include/ipa/ipa_interface.h b/include/ipa/ipa_interface.h deleted file mode 100644 index dc9fc714..00000000 --- a/include/ipa/ipa_interface.h +++ /dev/null @@ -1,173 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2019, Google Inc. - * - * ipa_interface.h - Image Processing Algorithm interface - */ -#ifndef __LIBCAMERA_IPA_INTERFACE_H__ -#define __LIBCAMERA_IPA_INTERFACE_H__ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct ipa_context { - const struct ipa_context_ops *ops; -}; - -struct ipa_settings { - const char *configuration_file; -}; - -struct ipa_sensor_info { - const char *model; - uint8_t bits_per_pixel; - struct { - uint32_t width; - uint32_t height; - } active_area; - struct { - int32_t left; - int32_t top; - uint32_t width; - uint32_t height; - } analog_crop; - struct { - uint32_t width; - uint32_t height; - } output_size; - uint64_t pixel_rate; - uint32_t line_length; -}; - -struct ipa_stream { - unsigned int id; - unsigned int pixel_format; - unsigned int width; - unsigned int height; -}; - -struct ipa_control_info_map { - unsigned int id; - const uint8_t *data; - size_t size; -}; - -struct ipa_buffer_plane { - int dmabuf; - size_t length; -}; - -struct ipa_buffer { - unsigned int id; - unsigned int num_planes; - struct ipa_buffer_plane planes[3]; -}; - -struct ipa_control_list { - const uint8_t *data; - unsigned int size; -}; - -struct ipa_operation_data { - unsigned int operation; - const uint32_t *data; - unsigned int num_data; - const struct ipa_control_list *lists; - unsigned int num_lists; -}; - -struct ipa_callback_ops { - void (*queue_frame_action)(void *cb_ctx, unsigned int frame, - struct ipa_operation_data &data); -}; - -struct ipa_context_ops { - void (*destroy)(struct ipa_context *ctx); - void *(*get_interface)(struct ipa_context *ctx); - void (*init)(struct ipa_context *ctx, - const struct ipa_settings *settings); - int (*start)(struct ipa_context *ctx); - void (*stop)(struct ipa_context *ctx); - void (*register_callbacks)(struct ipa_context *ctx, - const struct ipa_callback_ops *callbacks, - void *cb_ctx); - void (*configure)(struct ipa_context *ctx, - const struct ipa_sensor_info *sensor_info, - const struct ipa_stream *streams, - unsigned int num_streams, - const struct ipa_control_info_map *maps, - unsigned int num_maps); - void (*map_buffers)(struct ipa_context *ctx, - const struct ipa_buffer *buffers, - size_t num_buffers); - void (*unmap_buffers)(struct ipa_context *ctx, const unsigned int *ids, - size_t num_buffers); - void (*process_event)(struct ipa_context *ctx, - const struct ipa_operation_data *data); -}; - -struct ipa_context *ipaCreate(); - -#ifdef __cplusplus -} - -#include -#include - -#include -#include -#include -#include - -namespace libcamera { - -struct IPASettings { - std::string configurationFile; -}; - -struct IPAStream { - unsigned int pixelFormat; - Size size; -}; - -struct IPABuffer { - unsigned int id; - std::vector planes; -}; - -struct IPAOperationData { - unsigned int operation; - std::vector data; - std::vector controls; -}; - -struct CameraSensorInfo; - -class IPAInterface -{ -public: - virtual ~IPAInterface() {} - - virtual int init(const IPASettings &settings) = 0; - virtual int start() = 0; - virtual void stop() = 0; - - virtual void configure(const CameraSensorInfo &sensorInfo, - const std::map &streamConfig, - const std::map &entityControls) = 0; - - virtual void mapBuffers(const std::vector &buffers) = 0; - virtual void unmapBuffers(const std::vector &ids) = 0; - - virtual void processEvent(const IPAOperationData &data) = 0; - Signal queueFrameAction; -}; - -} /* namespace libcamera */ -#endif - -#endif /* __LIBCAMERA_IPA_INTERFACE_H__ */ diff --git a/include/ipa/ipa_module_info.h b/include/ipa/ipa_module_info.h deleted file mode 100644 index 3b1c37d2..00000000 --- a/include/ipa/ipa_module_info.h +++ /dev/null @@ -1,29 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2019, Google Inc. - * - * ipa_module_info.h - Image Processing Algorithm module information - */ -#ifndef __LIBCAMERA_IPA_MODULE_INFO_H__ -#define __LIBCAMERA_IPA_MODULE_INFO_H__ - -#include - -#define IPA_MODULE_API_VERSION 1 - -namespace libcamera { - -struct IPAModuleInfo { - int moduleAPIVersion; - uint32_t pipelineVersion; - char pipelineName[256]; - char name[256]; -} __attribute__((packed)); - -extern "C" { -extern const struct IPAModuleInfo ipaModuleInfo; -} - -} /* namespace libcamera */ - -#endif /* __LIBCAMERA_IPA_MODULE_INFO_H__ */ diff --git a/include/ipa/ipa_vimc.h b/include/ipa/ipa_vimc.h deleted file mode 100644 index 8e82dd94..00000000 --- a/include/ipa/ipa_vimc.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2019, Google Inc. - * - * ipa_vimc.h - Vimc Image Processing Algorithm module - */ - -#ifndef __LIBCAMERA_IPA_VIMC_H__ -#define __LIBCAMERA_IPA_VIMC_H__ - -namespace libcamera { - -#define VIMC_IPA_FIFO_PATH "/tmp/libcamera_ipa_vimc_fifo" - -enum IPAOperationCode { - IPAOperationNone, - IPAOperationInit, - IPAOperationStart, - IPAOperationStop, -}; - -} /* namespace libcamera */ - -#endif /* __LIBCAMERA_IPA_VIMC_H__ */ diff --git a/include/ipa/meson.build b/include/ipa/meson.build deleted file mode 100644 index 3d5c0dd6..00000000 --- a/include/ipa/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: CC0-1.0 - -libcamera_ipa_api = files([ - 'ipa_controls.h', - 'ipa_interface.h', - 'ipa_module_info.h', -]) - -install_headers(libcamera_ipa_api, - subdir: join_paths(libcamera_include_dir, 'ipa')) diff --git a/include/ipa/raspberrypi.h b/include/ipa/raspberrypi.h deleted file mode 100644 index c109469e..00000000 --- a/include/ipa/raspberrypi.h +++ /dev/null @@ -1,58 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2019-2020, Raspberry Pi Ltd. - * - * raspberrypi.h - Image Processing Algorithm interface for Raspberry Pi - */ -#ifndef __LIBCAMERA_IPA_INTERFACE_RASPBERRYPI_H__ -#define __LIBCAMERA_IPA_INTERFACE_RASPBERRYPI_H__ - -#include -#include - -enum RPiOperations { - RPI_IPA_ACTION_V4L2_SET_STAGGERED = 1, - RPI_IPA_ACTION_V4L2_SET_ISP, - RPI_IPA_ACTION_STATS_METADATA_COMPLETE, - RPI_IPA_ACTION_RUN_ISP, - RPI_IPA_ACTION_RUN_ISP_AND_DROP_FRAME, - RPI_IPA_ACTION_SET_SENSOR_CONFIG, - RPI_IPA_ACTION_EMBEDDED_COMPLETE, - RPI_IPA_EVENT_SIGNAL_STAT_READY, - RPI_IPA_EVENT_SIGNAL_ISP_PREPARE, - RPI_IPA_EVENT_QUEUE_REQUEST, - RPI_IPA_EVENT_LS_TABLE_ALLOCATION, -}; - -enum RPiIpaMask { - ID = 0x0ffff, - STATS = 0x10000, - EMBEDDED_DATA = 0x20000, - BAYER_DATA = 0x40000 -}; - -/* Size of the LS grid allocation. */ -#define MAX_LS_GRID_SIZE (32 << 10) - -namespace libcamera { - -/* List of controls handled by the Raspberry Pi IPA */ -static const ControlInfoMap RPiControls = { - { &controls::AeEnable, ControlInfo(false, true) }, - { &controls::ExposureTime, ControlInfo(0, 999999) }, - { &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) }, - { &controls::AeMeteringMode, ControlInfo(0, static_cast(controls::MeteringModeMax)) }, - { &controls::AeConstraintMode, ControlInfo(0, static_cast(controls::ConstraintModeMax)) }, - { &controls::AeExposureMode, ControlInfo(0, static_cast(controls::ExposureModeMax)) }, - { &controls::ExposureValue, ControlInfo(0.0f, 16.0f) }, - { &controls::AwbEnable, ControlInfo(false, true) }, - { &controls::ColourGains, ControlInfo(0.0f, 32.0f) }, - { &controls::AwbMode, ControlInfo(0, static_cast(controls::AwbModeMax)) }, - { &controls::Brightness, ControlInfo(-1.0f, 1.0f) }, - { &controls::Contrast, ControlInfo(0.0f, 32.0f) }, - { &controls::Saturation, ControlInfo(0.0f, 32.0f) }, -}; - -} /* namespace libcamera */ - -#endif /* __LIBCAMERA_IPA_INTERFACE_RASPBERRYPI_H__ */ diff --git a/include/ipa/rkisp1.h b/include/ipa/rkisp1.h deleted file mode 100644 index 4fe0482b..00000000 --- a/include/ipa/rkisp1.h +++ /dev/null @@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: LGPL-2.1-or-later */ -/* - * Copyright (C) 2019, Google Inc. - * - * rkisp1.h - Image Processing Algorithm interface for RkISP1 - */ -#ifndef __LIBCAMERA_IPA_INTERFACE_RKISP1_H__ -#define __LIBCAMERA_IPA_INTERFACE_RKISP1_H__ - -enum RkISP1Operations { - RKISP1_IPA_ACTION_V4L2_SET = 1, - RKISP1_IPA_ACTION_PARAM_FILLED = 2, - RKISP1_IPA_ACTION_METADATA = 3, - RKISP1_IPA_EVENT_SIGNAL_STAT_BUFFER = 4, - RKISP1_IPA_EVENT_QUEUE_REQUEST = 5, -}; - -#endif /* __LIBCAMERA_IPA_INTERFACE_RKISP1_H__ */ diff --git a/include/libcamera/internal/ipa_context_wrapper.h b/include/libcamera/internal/ipa_context_wrapper.h index a717d406..bd770e13 100644 --- a/include/libcamera/internal/ipa_context_wrapper.h +++ b/include/libcamera/internal/ipa_context_wrapper.h @@ -7,7 +7,7 @@ #ifndef __LIBCAMERA_IPA_CONTEXT_WRAPPER_H__ #define __LIBCAMERA_IPA_CONTEXT_WRAPPER_H__ -#include +#include #include "libcamera/internal/control_serializer.h" diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h index f07d91fc..2412d757 100644 --- a/include/libcamera/internal/ipa_manager.h +++ b/include/libcamera/internal/ipa_manager.h @@ -10,8 +10,8 @@ #include #include -#include -#include +#include +#include #include "libcamera/internal/ipa_module.h" #include "libcamera/internal/pipeline_handler.h" diff --git a/include/libcamera/internal/ipa_module.h b/include/libcamera/internal/ipa_module.h index 2f569db0..5b54cb31 100644 --- a/include/libcamera/internal/ipa_module.h +++ b/include/libcamera/internal/ipa_module.h @@ -11,8 +11,8 @@ #include #include -#include -#include +#include +#include #include "libcamera/internal/log.h" #include "libcamera/internal/pipeline_handler.h" diff --git a/include/libcamera/internal/ipa_proxy.h b/include/libcamera/internal/ipa_proxy.h index 1111065b..e9a36608 100644 --- a/include/libcamera/internal/ipa_proxy.h +++ b/include/libcamera/internal/ipa_proxy.h @@ -11,7 +11,7 @@ #include #include -#include +#include namespace libcamera { diff --git a/include/libcamera/ipa/ipa_controls.h b/include/libcamera/ipa/ipa_controls.h new file mode 100644 index 00000000..6d3bf279 --- /dev/null +++ b/include/libcamera/ipa/ipa_controls.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * ipa_controls.h - IPA Control handling + */ +#ifndef __LIBCAMERA_IPA_CONTROLS_H__ +#define __LIBCAMERA_IPA_CONTROLS_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define IPA_CONTROLS_FORMAT_VERSION 1 + +struct ipa_controls_header { + uint32_t version; + uint32_t handle; + uint32_t entries; + uint32_t size; + uint32_t data_offset; + uint32_t reserved[3]; +}; + +struct ipa_control_value_entry { + uint32_t id; + uint8_t type; + uint8_t is_array; + uint16_t count; + uint32_t offset; + uint32_t padding[1]; +}; + +struct ipa_control_info_entry { + uint32_t id; + uint32_t type; + uint32_t offset; + uint32_t padding[1]; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* __LIBCAMERA_IPA_CONTROLS_H__ */ diff --git a/include/libcamera/ipa/ipa_interface.h b/include/libcamera/ipa/ipa_interface.h new file mode 100644 index 00000000..dc9fc714 --- /dev/null +++ b/include/libcamera/ipa/ipa_interface.h @@ -0,0 +1,173 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * ipa_interface.h - Image Processing Algorithm interface + */ +#ifndef __LIBCAMERA_IPA_INTERFACE_H__ +#define __LIBCAMERA_IPA_INTERFACE_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct ipa_context { + const struct ipa_context_ops *ops; +}; + +struct ipa_settings { + const char *configuration_file; +}; + +struct ipa_sensor_info { + const char *model; + uint8_t bits_per_pixel; + struct { + uint32_t width; + uint32_t height; + } active_area; + struct { + int32_t left; + int32_t top; + uint32_t width; + uint32_t height; + } analog_crop; + struct { + uint32_t width; + uint32_t height; + } output_size; + uint64_t pixel_rate; + uint32_t line_length; +}; + +struct ipa_stream { + unsigned int id; + unsigned int pixel_format; + unsigned int width; + unsigned int height; +}; + +struct ipa_control_info_map { + unsigned int id; + const uint8_t *data; + size_t size; +}; + +struct ipa_buffer_plane { + int dmabuf; + size_t length; +}; + +struct ipa_buffer { + unsigned int id; + unsigned int num_planes; + struct ipa_buffer_plane planes[3]; +}; + +struct ipa_control_list { + const uint8_t *data; + unsigned int size; +}; + +struct ipa_operation_data { + unsigned int operation; + const uint32_t *data; + unsigned int num_data; + const struct ipa_control_list *lists; + unsigned int num_lists; +}; + +struct ipa_callback_ops { + void (*queue_frame_action)(void *cb_ctx, unsigned int frame, + struct ipa_operation_data &data); +}; + +struct ipa_context_ops { + void (*destroy)(struct ipa_context *ctx); + void *(*get_interface)(struct ipa_context *ctx); + void (*init)(struct ipa_context *ctx, + const struct ipa_settings *settings); + int (*start)(struct ipa_context *ctx); + void (*stop)(struct ipa_context *ctx); + void (*register_callbacks)(struct ipa_context *ctx, + const struct ipa_callback_ops *callbacks, + void *cb_ctx); + void (*configure)(struct ipa_context *ctx, + const struct ipa_sensor_info *sensor_info, + const struct ipa_stream *streams, + unsigned int num_streams, + const struct ipa_control_info_map *maps, + unsigned int num_maps); + void (*map_buffers)(struct ipa_context *ctx, + const struct ipa_buffer *buffers, + size_t num_buffers); + void (*unmap_buffers)(struct ipa_context *ctx, const unsigned int *ids, + size_t num_buffers); + void (*process_event)(struct ipa_context *ctx, + const struct ipa_operation_data *data); +}; + +struct ipa_context *ipaCreate(); + +#ifdef __cplusplus +} + +#include +#include + +#include +#include +#include +#include + +namespace libcamera { + +struct IPASettings { + std::string configurationFile; +}; + +struct IPAStream { + unsigned int pixelFormat; + Size size; +}; + +struct IPABuffer { + unsigned int id; + std::vector planes; +}; + +struct IPAOperationData { + unsigned int operation; + std::vector data; + std::vector controls; +}; + +struct CameraSensorInfo; + +class IPAInterface +{ +public: + virtual ~IPAInterface() {} + + virtual int init(const IPASettings &settings) = 0; + virtual int start() = 0; + virtual void stop() = 0; + + virtual void configure(const CameraSensorInfo &sensorInfo, + const std::map &streamConfig, + const std::map &entityControls) = 0; + + virtual void mapBuffers(const std::vector &buffers) = 0; + virtual void unmapBuffers(const std::vector &ids) = 0; + + virtual void processEvent(const IPAOperationData &data) = 0; + Signal queueFrameAction; +}; + +} /* namespace libcamera */ +#endif + +#endif /* __LIBCAMERA_IPA_INTERFACE_H__ */ diff --git a/include/libcamera/ipa/ipa_module_info.h b/include/libcamera/ipa/ipa_module_info.h new file mode 100644 index 00000000..3b1c37d2 --- /dev/null +++ b/include/libcamera/ipa/ipa_module_info.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * ipa_module_info.h - Image Processing Algorithm module information + */ +#ifndef __LIBCAMERA_IPA_MODULE_INFO_H__ +#define __LIBCAMERA_IPA_MODULE_INFO_H__ + +#include + +#define IPA_MODULE_API_VERSION 1 + +namespace libcamera { + +struct IPAModuleInfo { + int moduleAPIVersion; + uint32_t pipelineVersion; + char pipelineName[256]; + char name[256]; +} __attribute__((packed)); + +extern "C" { +extern const struct IPAModuleInfo ipaModuleInfo; +} + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_IPA_MODULE_INFO_H__ */ diff --git a/include/libcamera/ipa/ipa_vimc.h b/include/libcamera/ipa/ipa_vimc.h new file mode 100644 index 00000000..8e82dd94 --- /dev/null +++ b/include/libcamera/ipa/ipa_vimc.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * ipa_vimc.h - Vimc Image Processing Algorithm module + */ + +#ifndef __LIBCAMERA_IPA_VIMC_H__ +#define __LIBCAMERA_IPA_VIMC_H__ + +namespace libcamera { + +#define VIMC_IPA_FIFO_PATH "/tmp/libcamera_ipa_vimc_fifo" + +enum IPAOperationCode { + IPAOperationNone, + IPAOperationInit, + IPAOperationStart, + IPAOperationStop, +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_IPA_VIMC_H__ */ diff --git a/include/libcamera/ipa/meson.build b/include/libcamera/ipa/meson.build new file mode 100644 index 00000000..3d5c0dd6 --- /dev/null +++ b/include/libcamera/ipa/meson.build @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: CC0-1.0 + +libcamera_ipa_api = files([ + 'ipa_controls.h', + 'ipa_interface.h', + 'ipa_module_info.h', +]) + +install_headers(libcamera_ipa_api, + subdir: join_paths(libcamera_include_dir, 'ipa')) diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h new file mode 100644 index 00000000..c109469e --- /dev/null +++ b/include/libcamera/ipa/raspberrypi.h @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019-2020, Raspberry Pi Ltd. + * + * raspberrypi.h - Image Processing Algorithm interface for Raspberry Pi + */ +#ifndef __LIBCAMERA_IPA_INTERFACE_RASPBERRYPI_H__ +#define __LIBCAMERA_IPA_INTERFACE_RASPBERRYPI_H__ + +#include +#include + +enum RPiOperations { + RPI_IPA_ACTION_V4L2_SET_STAGGERED = 1, + RPI_IPA_ACTION_V4L2_SET_ISP, + RPI_IPA_ACTION_STATS_METADATA_COMPLETE, + RPI_IPA_ACTION_RUN_ISP, + RPI_IPA_ACTION_RUN_ISP_AND_DROP_FRAME, + RPI_IPA_ACTION_SET_SENSOR_CONFIG, + RPI_IPA_ACTION_EMBEDDED_COMPLETE, + RPI_IPA_EVENT_SIGNAL_STAT_READY, + RPI_IPA_EVENT_SIGNAL_ISP_PREPARE, + RPI_IPA_EVENT_QUEUE_REQUEST, + RPI_IPA_EVENT_LS_TABLE_ALLOCATION, +}; + +enum RPiIpaMask { + ID = 0x0ffff, + STATS = 0x10000, + EMBEDDED_DATA = 0x20000, + BAYER_DATA = 0x40000 +}; + +/* Size of the LS grid allocation. */ +#define MAX_LS_GRID_SIZE (32 << 10) + +namespace libcamera { + +/* List of controls handled by the Raspberry Pi IPA */ +static const ControlInfoMap RPiControls = { + { &controls::AeEnable, ControlInfo(false, true) }, + { &controls::ExposureTime, ControlInfo(0, 999999) }, + { &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) }, + { &controls::AeMeteringMode, ControlInfo(0, static_cast(controls::MeteringModeMax)) }, + { &controls::AeConstraintMode, ControlInfo(0, static_cast(controls::ConstraintModeMax)) }, + { &controls::AeExposureMode, ControlInfo(0, static_cast(controls::ExposureModeMax)) }, + { &controls::ExposureValue, ControlInfo(0.0f, 16.0f) }, + { &controls::AwbEnable, ControlInfo(false, true) }, + { &controls::ColourGains, ControlInfo(0.0f, 32.0f) }, + { &controls::AwbMode, ControlInfo(0, static_cast(controls::AwbModeMax)) }, + { &controls::Brightness, ControlInfo(-1.0f, 1.0f) }, + { &controls::Contrast, ControlInfo(0.0f, 32.0f) }, + { &controls::Saturation, ControlInfo(0.0f, 32.0f) }, +}; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_IPA_INTERFACE_RASPBERRYPI_H__ */ diff --git a/include/libcamera/ipa/rkisp1.h b/include/libcamera/ipa/rkisp1.h new file mode 100644 index 00000000..4fe0482b --- /dev/null +++ b/include/libcamera/ipa/rkisp1.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * rkisp1.h - Image Processing Algorithm interface for RkISP1 + */ +#ifndef __LIBCAMERA_IPA_INTERFACE_RKISP1_H__ +#define __LIBCAMERA_IPA_INTERFACE_RKISP1_H__ + +enum RkISP1Operations { + RKISP1_IPA_ACTION_V4L2_SET = 1, + RKISP1_IPA_ACTION_PARAM_FILLED = 2, + RKISP1_IPA_ACTION_METADATA = 3, + RKISP1_IPA_EVENT_SIGNAL_STAT_BUFFER = 4, + RKISP1_IPA_EVENT_QUEUE_REQUEST = 5, +}; + +#endif /* __LIBCAMERA_IPA_INTERFACE_RKISP1_H__ */ diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index f9c8e64b..32b8d142 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -24,6 +24,7 @@ libcamera_api = files([ include_dir = join_paths(libcamera_include_dir, 'libcamera') subdir('internal') +subdir('ipa') install_headers(libcamera_api, subdir : include_dir) diff --git a/include/meson.build b/include/meson.build index 4f41c9ce..2ac9a3a0 100644 --- a/include/meson.build +++ b/include/meson.build @@ -3,5 +3,4 @@ libcamera_include_dir = 'libcamera' subdir('android') -subdir('ipa') subdir('libcamera') -- cgit v1.2.1