ControlInfoMap does not have a ControlId map associated, but rather creates one with the generateIdMap() function at creation time. As a consequence, when in the need to de-serialize a ControlInfoMap all the ControlId it contains are created by the deserializer instance, not being able to discern if the controls the ControlIdMap refers to are the global libcamera controls (and properties) or instances local to the V4L2 device that has first initialized the controls. As a consequence the ControlId stored in a de-serialized map will always be newly created entities, preventing lookup by ControlId reference on a de-serialized ControlInfoMap. In order to make it possible to use globally available ControlId instances whenever possible, create ControlInfoMap with a reference to an externally allocated ControlIdMap instead of generating one internally. As a consequence the class constructors take and additional argument, which might be not pleasant to type in, but enforces the concepts that ControlInfoMap should be created with controls part of the same id map. As the ControlIdMap the ControlInfoMap refers to needs to be allocated externally: - Use the globally available controls::controls (or properties::properties) id map when referring to libcamera controls - The V4L2 device that creates ControlInfoMap by parsing the device's controls has to allocate a ControlIdMap - The ControlSerializer that de-serializes a ControlInfoMap has to create and store the ControlIdMap the de-serialized info map refers to Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
58 lines
2.2 KiB
C++
58 lines
2.2 KiB
C++
/* 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 <stdint.h>
|
|
|
|
#include <libcamera/control_ids.h>
|
|
#include <libcamera/controls.h>
|
|
|
|
#ifndef __DOXYGEN__
|
|
|
|
namespace libcamera {
|
|
|
|
namespace RPi {
|
|
|
|
/*
|
|
* List of controls handled by the Raspberry Pi IPA
|
|
*
|
|
* \todo This list will need to be built dynamically from the control
|
|
* algorithms loaded by the json file, once this is supported. At that
|
|
* point applications should check first whether a control is supported,
|
|
* and the pipeline handler may be reverted so that it aborts when an
|
|
* unsupported control is encountered.
|
|
*/
|
|
static const ControlInfoMap Controls({
|
|
{ &controls::AeEnable, ControlInfo(false, true) },
|
|
{ &controls::ExposureTime, ControlInfo(0, 999999) },
|
|
{ &controls::AnalogueGain, ControlInfo(1.0f, 32.0f) },
|
|
{ &controls::AeMeteringMode, ControlInfo(controls::AeMeteringModeValues) },
|
|
{ &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) },
|
|
{ &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) },
|
|
{ &controls::ExposureValue, ControlInfo(0.0f, 16.0f) },
|
|
{ &controls::AwbEnable, ControlInfo(false, true) },
|
|
{ &controls::ColourGains, ControlInfo(0.0f, 32.0f) },
|
|
{ &controls::AwbMode, ControlInfo(controls::AwbModeValues) },
|
|
{ &controls::Brightness, ControlInfo(-1.0f, 1.0f) },
|
|
{ &controls::Contrast, ControlInfo(0.0f, 32.0f) },
|
|
{ &controls::Saturation, ControlInfo(0.0f, 32.0f) },
|
|
{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },
|
|
{ &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) },
|
|
{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },
|
|
{ &controls::FrameDurationLimits, ControlInfo(INT64_C(1000), INT64_C(1000000000)) },
|
|
{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }
|
|
}, controls::controls);
|
|
|
|
} /* namespace RPi */
|
|
|
|
} /* namespace libcamera */
|
|
|
|
#endif /* __DOXYGEN__ */
|
|
|
|
#endif /* __LIBCAMERA_IPA_INTERFACE_RASPBERRYPI_H__ */
|