From patchwork Mon Sep 21 09:04:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 28360 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 8152AC3237 for ; Mon, 21 Sep 2026 09:04:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 045C76875C; Mon, 21 Sep 2026 11:04:43 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="DhNY0AuU"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AA4916862F for ; Mon, 21 Sep 2026 11:04:41 +0200 (CEST) Received: from pb-laptop.local (185.221.142.0.nat.pool.zt.hu [185.221.142.0]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4485F14C7; Mon, 21 Sep 2026 11:02:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1789981376; bh=DbRCQDJghoRlD7PYyP4+5EQQkqFIr5m29kBOGGRxLPo=; h=From:To:Cc:Subject:Date:From; b=DhNY0AuUBLTWHrdHsEQlSaZNAhyvw9+RXijc3YYTY1EEUC6oviDW94RZrqnCMqspT H7IQDbqSpDdTIfcYJ2SeeoyQrv38pBPz97H+o9TXKUUcylcM8cq9aI4TcpvgE/WwNu QHHXq2D6nroPisDxO9PSB1+OdRNiJUshDlJrJg1o= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Cc: Paul Elder Subject: [PATCH v4] libcamera: controls: Remove common enum prefix Date: Mon, 21 Sep 2026 11:04:37 +0200 Message-ID: <20260921090437.87339-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" At the moment all enumerators have a common prefix, in many cases the name of the control, but not always. This is reasonable for C++ because currently non-scoped enumerations are used, so some kind of prefix is needed to differentiate common names like `Auto`, `Manual`, `On`, `Off`, etc. However, for e.g. language bindings, it might be more desirable to have access to the the unprefixed name. (This is even the case for C++ scoped enumerations.) Currently, both the gstreamer and python bindings have extra code to strip the common prefix. So instead of doing that separately in every binding, etc. store the unprefixed name in the source of truth, the control/property definition yaml files. This affect all C++, python, gstreamer generated code. This is an API break, but its effects are largely minimal and easily addressable. As for C++, only those controls are affected where the enumerator is not prefixed with the control name: Controls: libcamera::AeMeteringMode MeteringCentreWeighted -> AeMeteringModeCentreWeighted MeteringSpot -> AeMeteringModeSpot MeteringMatrix -> AeMeteringModeMatrix MeteringCustom -> AeMeteringModeCustom libcamera::AeConstraintMode ConstraintNormal -> AeConstraintModeNormal ConstraintHighlight -> AeConstraintModeHighlight ConstraintShadows -> AeConstraintModeShadows ConstraintCustom -> AeConstraintModeCustom libcamera::AeExposureMode ExposureNormal -> AeExposureModeNormal ExposureShort -> AeExposureModeShort ExposureLong -> AeExposureModeLong ExposureCustom -> AeExposureModeCustom libcamera::AeFlickerMode FlickerOff -> AeFlickerModeOff FlickerManual -> AeFlickerModeManual FlickerAuto -> AeFlickerModeAuto libcamera::AwbMode AwbAuto -> AwbModeAuto AwbIncandescent -> AwbModeIncandescent AwbTungsten -> AwbModeTungsten AwbFluorescent -> AwbModeFluorescent AwbIndoor -> AwbModeIndoor AwbDaylight -> AwbModeDaylight AwbCloudy -> AwbModeCloudy AwbCustom -> AwbModeCustom libcamera::WdrMode WdrOff -> WdrModeOff WdrLinear -> WdrModeLinear WdrPower -> WdrModePower WdrExponential -> WdrModeExponential WdrHistogramEqualization -> WdrModeHistogramEqualization draft::ColorCorrectionAberrationMode ColorCorrectionAberrationOff -> ColorCorrectionAberrationModeOff ColorCorrectionAberrationFast -> ColorCorrectionAberrationModeFast ColorCorrectionAberrationHighQuality -> ColorCorrectionAberrationModeHighQuality draft::AwbState AwbConverged -> AwbStateConverged AwbLocked -> AwbStateLocked Properties: libcamera::Location CameraLocationFront -> LocationFront CameraLocationBack -> LocationBack CameraLocationExternal -> LocationExternal draft::ColorFilterArrangement RGGB -> ColorFilterArrangementRGGB GRBG -> ColorFilterArrangementGRBG GBRG -> ColorFilterArrangementGBRG BGGR -> ColorFilterArrangementBGGR RGB -> ColorFilterArrangementRGB MONO -> ColorFilterArrangementMONO As for python, there is already code to strip the common enum prefix, so there are only two enumerations that are affected. The following code was used to generate a list of enumerators: import libcamera TEST = ( ("controls", libcamera.controls), ("controls.draft", libcamera.controls.draft), ("controls.rpi", libcamera.controls.rpi), ("properties", libcamera.properties), ("properties.draft", libcamera.properties.draft), ) for (name, mod) in TEST: for k in mod.__dict__: if not k.endswith("Enum"): continue for e in getattr(mod, k).__dict__: if not e[0].isupper(): continue print('.'.join((name, k[:-4], e))) And comparing the diff shows two enumerators: libcamera.controls.draft.AwbStateEnum StateInactive -> Inactive StateSearching -> Searching This happens because other 2 enumerator in the enum were not prefix with "State", so the automatic prefix stripping didn't work. As for gstreamer, the generated `gstlibcamera-controls.cpp` files were compared, and no change in the names was observed. Additionally, in some cases the corresponding `*NameValueMap` objects are used to parse configuration files, these are also affected: * ipa::AgcMeanLuminance::parseConstraintModes * ipa::AwbAlgorithmBase::parseModeConfigs * ipa::rkisp1::algorithms::Agc::parseMeteringModes * ConfigParser::parseLocation Signed-off-by: Barnabás Pőcze Reviewed-by: Paul Elder --- changes in v4: * rebase changes in v3: * rebase -> controls::WdrMode changes in v2: * rebase * missed files: * utils/tuning/libtuning/modules/agc/rkisp1.py * utils/tuning/config-example.yaml * comments in src/ipa/libipa/agc_mean_luminance.cpp * comments in src/ipa/libipa/awb.cpp v3: https://patchwork.libcamera.org/patch/24496/ v2: https://patchwork.libcamera.org/patch/24258/ v1: https://patchwork.libcamera.org/patch/23381/ --- include/libcamera/control_ids.h.in | 2 +- src/android/camera_device.cpp | 6 +- src/android/camera_hal_manager.cpp | 2 +- src/apps/cam/main.cpp | 6 +- src/apps/qcam/cam_select_dialog.cpp | 6 +- src/gstreamer/gstlibcamera-controls.cpp.in | 4 +- src/ipa/libipa/agc.cpp | 4 +- src/ipa/libipa/agc_mean_luminance.cpp | 12 +- src/ipa/libipa/awb.cpp | 8 +- src/ipa/rkisp1/algorithms/agc.cpp | 4 +- src/ipa/rkisp1/algorithms/wdr.cpp | 16 +- src/ipa/rpi/common/ipa_base.cpp | 54 +-- src/libcamera/control_ids.cpp.in | 6 +- src/libcamera/control_ids_core.yaml | 316 +++++++++--------- src/libcamera/control_ids_draft.yaml | 54 +-- src/libcamera/control_ids_rpi.yaml | 10 +- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 4 +- src/libcamera/pipeline/virtual/README.md | 2 +- .../pipeline/virtual/config_parser.cpp | 4 +- .../pipeline/virtual/data/virtual.yaml | 6 +- src/libcamera/property_ids_core.yaml | 6 +- src/libcamera/sensor/camera_sensor_legacy.cpp | 18 +- src/libcamera/sensor/camera_sensor_raw.cpp | 18 +- src/py/libcamera/gen-py-controls.py | 28 -- src/py/libcamera/py_controls_generated.cpp.in | 2 +- utils/codegen/controls.py | 19 +- utils/codegen/gen-gst-controls.py | 17 - utils/tuning/config-example.yaml | 16 +- utils/tuning/libtuning/modules/agc/rkisp1.py | 10 +- 29 files changed, 318 insertions(+), 342 deletions(-) -- 2.55.0 diff --git a/include/libcamera/control_ids.h.in b/include/libcamera/control_ids.h.in index 0652531802..d82d23866e 100644 --- a/include/libcamera/control_ids.h.in +++ b/include/libcamera/control_ids.h.in @@ -43,7 +43,7 @@ enum { {% if ctrl.is_enum -%} enum {{ctrl.name}}Enum { {%- for enum in ctrl.enum_values %} - {{enum.name}} = {{enum.value}}, + {{enum.prefixed_name}} = {{enum.value}}, {%- endfor %} }; extern const std::array {{ctrl.name}}Values; diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 80ff248c2a..74981af99e 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -310,13 +310,13 @@ int CameraDevice::initialize(const CameraConfigData *cameraConfigData) const auto &location = properties.get(properties::Location); if (location) { switch (*location) { - case properties::CameraLocationFront: + case properties::LocationFront: facing_ = CAMERA_FACING_FRONT; break; - case properties::CameraLocationBack: + case properties::LocationBack: facing_ = CAMERA_FACING_BACK; break; - case properties::CameraLocationExternal: + case properties::LocationExternal: /* * If the camera is reported as external, but the * CameraHalManager has overriden it, use what is diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp index a7a2571754..03d1710b3e 100644 --- a/src/android/camera_hal_manager.cpp +++ b/src/android/camera_hal_manager.cpp @@ -125,7 +125,7 @@ void CameraHalManager::cameraAdded(std::shared_ptr cam) * Now check if this is an external camera and assign * its id accordingly. */ - if (cam->properties().get(properties::Location) == properties::CameraLocationExternal) { + if (cam->properties().get(properties::Location) == properties::LocationExternal) { isCameraExternal = true; id = nextExternalCameraId_; } else { diff --git a/src/apps/cam/main.cpp b/src/apps/cam/main.cpp index 120917eb63..17b30fa0e0 100644 --- a/src/apps/cam/main.cpp +++ b/src/apps/cam/main.cpp @@ -332,15 +332,15 @@ std::string CamApp::cameraName(const Camera *camera) const auto &location = props.get(properties::Location); if (location) { switch (*location) { - case properties::CameraLocationFront: + case properties::LocationFront: addModel = false; name = "Internal front camera "; break; - case properties::CameraLocationBack: + case properties::LocationBack: addModel = false; name = "Internal back camera "; break; - case properties::CameraLocationExternal: + case properties::LocationExternal: name = "External camera "; break; } diff --git a/src/apps/qcam/cam_select_dialog.cpp b/src/apps/qcam/cam_select_dialog.cpp index 7370567d22..fc04d071f9 100644 --- a/src/apps/qcam/cam_select_dialog.cpp +++ b/src/apps/qcam/cam_select_dialog.cpp @@ -98,13 +98,13 @@ void CameraSelectorDialog::updateCameraInfo(QString cameraId) const auto &location = properties.get(libcamera::properties::Location); if (location) { switch (*location) { - case libcamera::properties::CameraLocationFront: + case libcamera::properties::LocationFront: cameraLocation_->setText("Internal front camera"); break; - case libcamera::properties::CameraLocationBack: + case libcamera::properties::LocationBack: cameraLocation_->setText("Internal back camera"); break; - case libcamera::properties::CameraLocationExternal: + case libcamera::properties::LocationExternal: cameraLocation_->setText("External camera"); break; default: diff --git a/src/gstreamer/gstlibcamera-controls.cpp.in b/src/gstreamer/gstlibcamera-controls.cpp.in index 97bfd1f918..17e88a2375 100644 --- a/src/gstreamer/gstlibcamera-controls.cpp.in +++ b/src/gstreamer/gstlibcamera-controls.cpp.in @@ -23,9 +23,9 @@ using namespace libcamera; static const GEnumValue {{ ctrl.name|snake_case }}_types[] = { {%- for enum in ctrl.enum_values %} { - controls::{{ ctrl.namespace }}{{ enum.name }}, + controls::{{ ctrl.namespace }}{{ enum.prefixed_name }}, {{ enum.description|format_description|indent_str('\t\t') }}, - "{{ enum.gst_name }}" + "{{ enum.name|kebab_case }}" }, {%- endfor %} {0, nullptr, nullptr} diff --git a/src/ipa/libipa/agc.cpp b/src/ipa/libipa/agc.cpp index 51b05e3c2a..182dd7380e 100644 --- a/src/ipa/libipa/agc.cpp +++ b/src/ipa/libipa/agc.cpp @@ -488,8 +488,8 @@ int AgcAlgorithm::configure(agc::Session &session, agc::ActiveState &state, std::visit(utils::overloaded{ [&](AgcMSV &) { /* No constraint/exposure mode support. */ - state.constraintMode = controls::AeConstraintModeEnum::ConstraintNormal; - state.exposureMode = controls::AeExposureModeEnum::ExposureNormal; + state.constraintMode = controls::AeConstraintModeEnum::AeConstraintModeNormal; + state.exposureMode = controls::AeExposureModeEnum::AeExposureModeNormal; state.automatic.yTarget = 0; /* Not supported. */ diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp index 72833247c5..486c09c076 100644 --- a/src/ipa/libipa/agc_mean_luminance.cpp +++ b/src/ipa/libipa/agc_mean_luminance.cpp @@ -273,7 +273,7 @@ int AgcMeanLuminance::parseConstraintModes(const ValueNode &tuningData) Pwl({ { { 0.0, 0.5 } } }) }; - constraintModes_[controls::ConstraintNormal].push_back(std::move(constraint)); + constraintModes_[controls::AeConstraintModeNormal].push_back(std::move(constraint)); } return 0; @@ -333,7 +333,7 @@ int AgcMeanLuminance::parseExposureModes(const ValueNode &tuningData) * possible before touching gain. */ if (exposureModeHelpers_.empty()) - exposureModeHelpers_.try_emplace(controls::ExposureNormal, + exposureModeHelpers_.try_emplace(controls::AeExposureModeNormal, std::span>{}); return 0; @@ -375,12 +375,12 @@ void AgcMeanLuminance::configure(utils::Duration lineDuration, * algorithms: * - Agc: * AeConstraintMode: - * ConstraintNormal: + * Normal: * lower: * qLo: 0.98 * qHi: 1.0 * yTarget: 0.5 - * ConstraintHighlight: + * Highlight: * lower: * qLo: 0.98 * qHi: 1.0 @@ -402,10 +402,10 @@ void AgcMeanLuminance::configure(utils::Duration lineDuration, * algorithms: * - Agc: * AeExposureMode: - * ExposureNormal: + * Normal: * exposureTime: [ 100, 10000, 30000, 60000, 120000 ] * gain: [ 2.0, 4.0, 6.0, 8.0, 10.0 ] - * ExposureShort: + * Short: * exposureTime: [ 100, 10000, 30000, 60000, 120000 ] * gain: [ 2.0, 4.0, 6.0, 8.0, 10.0 ] * diff --git a/src/ipa/libipa/awb.cpp b/src/ipa/libipa/awb.cpp index 0e312690b8..cad2b5777f 100644 --- a/src/ipa/libipa/awb.cpp +++ b/src/ipa/libipa/awb.cpp @@ -234,7 +234,7 @@ int AwbAlgorithmBase::init(const ValueNode &tuningData) kDefaultColourTemperature); controls_[&controls::AwbEnable] = ControlInfo(false, true); - return parseModeConfigs(tuningData, controls::AwbAuto); + return parseModeConfigs(tuningData, controls::AwbModeAuto); } /** @@ -416,10 +416,10 @@ void AwbAlgorithmBase::process(awb::ActiveState &state, * algorithms: * - Awb: * AwbMode: - * AwbAuto: + * Auto: * lo: 2500 * hi: 8000 - * AwbIncandescent: + * Incandescent: * lo: 2500 * hi: 3000 * ... @@ -504,7 +504,7 @@ int AwbAlgorithmBase::parseModeConfigs(const ValueNode &tuningData, } controls_[&controls::AwbMode] = ControlInfo(availableModes, def); - currentMode_ = &modes_[controls::AwbAuto]; + currentMode_ = &modes_[controls::AwbModeAuto]; return 0; } diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 1f1d6c96a3..1c323ede87 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -69,7 +69,7 @@ int Agc::parseMeteringModes(IPAContext &context, const ValueNode &tuningData) << "No metering modes read from tuning file; defaulting to matrix"; std::vector weights(context.hw.numHistogramWeights, 1); - meteringModes_[controls::MeteringMatrix] = weights; + meteringModes_[controls::AeMeteringModeMatrix] = weights; } std::vector meteringModes; @@ -363,7 +363,7 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, if (params) { std::vector additionalConstraints; - if (context.activeState.wdr.mode != controls::WdrOff) + if (context.activeState.wdr.mode != controls::WdrModeOff) additionalConstraints.push_back(context.activeState.wdr.constraint); agc_.process(context.configuration.agc, context.activeState.agc, frameContext.agc, {{ diff --git a/src/ipa/rkisp1/algorithms/wdr.cpp b/src/ipa/rkisp1/algorithms/wdr.cpp index c3d73da2c5..c64ecc2b09 100644 --- a/src/ipa/rkisp1/algorithms/wdr.cpp +++ b/src/ipa/rkisp1/algorithms/wdr.cpp @@ -151,7 +151,7 @@ int WideDynamicRange::init([[maybe_unused]] IPAContext &context, } context.ctrlMap[&controls::WdrMode] = - ControlInfo(controls::WdrModeValues, controls::WdrOff); + ControlInfo(controls::WdrModeValues, controls::WdrModeOff); context.ctrlMap[&controls::WdrStrength] = ControlInfo(0.0f, 2.0f, 1.0f); context.ctrlMap[&controls::WdrMaxBrightPixels] = @@ -168,7 +168,7 @@ int WideDynamicRange::init([[maybe_unused]] IPAContext &context, int WideDynamicRange::configure(IPAContext &context, [[maybe_unused]] const IPACameraSensorInfo &configInfo) { - context.activeState.wdr.mode = controls::WdrOff; + context.activeState.wdr.mode = controls::WdrModeOff; context.activeState.wdr.gain = 1.0; context.activeState.wdr.strength = 1.0; auto &constraint = context.activeState.wdr.constraint; @@ -404,21 +404,21 @@ void WideDynamicRange::prepare(IPAContext &context, auto mode = frameContext.wdr.mode; auto config = params->block(); - config.setEnabled(mode != controls::WdrOff); + config.setEnabled(mode != controls::WdrModeOff); /* Calculate how much EV we need to compensate with the WDR curve. */ double gain = context.activeState.wdr.gain; frameContext.wdr.gain = gain; - if (mode == controls::WdrOff) { + if (mode == controls::WdrModeOff) { applyCompensationLinear(1.0, 0.0); - } else if (mode == controls::WdrLinear) { + } else if (mode == controls::WdrModeLinear) { applyCompensationLinear(gain, frameContext.wdr.strength); - } else if (mode == controls::WdrPower) { + } else if (mode == controls::WdrModePower) { applyCompensationPower(gain, frameContext.wdr.strength); - } else if (mode == controls::WdrExponential) { + } else if (mode == controls::WdrModeExponential) { applyCompensationExponential(gain, frameContext.wdr.strength); - } else if (mode == controls::WdrHistogramEqualization) { + } else if (mode == controls::WdrModeHistogramEqualization) { applyHistogramEqualization(frameContext.wdr.strength); } diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp index bc8e65cb08..d3f05a6f78 100644 --- a/src/ipa/rpi/common/ipa_base.cpp +++ b/src/ipa/rpi/common/ipa_base.cpp @@ -66,9 +66,9 @@ const ControlInfoMap::Map ipaControls{ { &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) }, { &controls::ExposureValue, ControlInfo(-8.0f, 8.0f, 0.0f) }, { &controls::AeFlickerMode, - ControlInfo({ { ControlValue(controls::FlickerOff), - ControlValue(controls::FlickerManual) } }, - ControlValue(controls::FlickerOff)) }, + ControlInfo({ { ControlValue(controls::AeFlickerModeOff), + ControlValue(controls::AeFlickerModeManual) } }, + ControlValue(controls::AeFlickerModeOff)) }, { &controls::AeFlickerPeriod, ControlInfo(100, 1000000) }, { &controls::Brightness, ControlInfo(-1.0f, 1.0f, 0.0f) }, { &controls::Contrast, ControlInfo(0.0f, 32.0f, 1.0f) }, @@ -172,7 +172,7 @@ int32_t IpaBase::init(const IPASettings &settings, const InitParams ¶ms, Ini if (platformCtrlsIt != platformControls.end()) ctrlMap.merge(ControlInfoMap::Map(platformCtrlsIt->second)); - monoSensor_ = params.sensorInfo.cfaPattern == properties::draft::ColorFilterArrangementEnum::MONO; + monoSensor_ = params.sensorInfo.cfaPattern == properties::draft::ColorFilterArrangementMONO; if (!monoSensor_) ctrlMap.merge(ControlInfoMap::Map(ipaColourControls)); @@ -713,35 +713,35 @@ bool IpaBase::validateLensControls() * must be kept up-to-date by hand. */ static const std::map MeteringModeTable = { - { controls::MeteringCentreWeighted, "centre-weighted" }, - { controls::MeteringSpot, "spot" }, - { controls::MeteringMatrix, "matrix" }, - { controls::MeteringCustom, "custom" }, + { controls::AeMeteringModeCentreWeighted, "centre-weighted" }, + { controls::AeMeteringModeSpot, "spot" }, + { controls::AeMeteringModeMatrix, "matrix" }, + { controls::AeMeteringModeCustom, "custom" }, }; static const std::map ConstraintModeTable = { - { controls::ConstraintNormal, "normal" }, - { controls::ConstraintHighlight, "highlight" }, - { controls::ConstraintShadows, "shadows" }, - { controls::ConstraintCustom, "custom" }, + { controls::AeConstraintModeNormal, "normal" }, + { controls::AeConstraintModeHighlight, "highlight" }, + { controls::AeConstraintModeShadows, "shadows" }, + { controls::AeConstraintModeCustom, "custom" }, }; static const std::map ExposureModeTable = { - { controls::ExposureNormal, "normal" }, - { controls::ExposureShort, "short" }, - { controls::ExposureLong, "long" }, - { controls::ExposureCustom, "custom" }, + { controls::AeExposureModeNormal, "normal" }, + { controls::AeExposureModeShort, "short" }, + { controls::AeExposureModeLong, "long" }, + { controls::AeExposureModeCustom, "custom" }, }; static const std::map AwbModeTable = { - { controls::AwbAuto, "auto" }, - { controls::AwbIncandescent, "incandescent" }, - { controls::AwbTungsten, "tungsten" }, - { controls::AwbFluorescent, "fluorescent" }, - { controls::AwbIndoor, "indoor" }, - { controls::AwbDaylight, "daylight" }, - { controls::AwbCloudy, "cloudy" }, - { controls::AwbCustom, "custom" }, + { controls::AwbModeAuto, "auto" }, + { controls::AwbModeIncandescent, "incandescent" }, + { controls::AwbModeTungsten, "tungsten" }, + { controls::AwbModeFluorescent, "fluorescent" }, + { controls::AwbModeIndoor, "indoor" }, + { controls::AwbModeDaylight, "daylight" }, + { controls::AwbModeCloudy, "cloudy" }, + { controls::AwbModeCustom, "custom" }, }; static const std::map AfModeTable = { @@ -1088,12 +1088,12 @@ void IpaBase::applyControls(const ControlList &controls) bool modeValid = true; switch (mode) { - case controls::FlickerOff: + case controls::AeFlickerModeOff: agc->setFlickerPeriod(0us); break; - case controls::FlickerManual: + case controls::AeFlickerModeManual: agc->setFlickerPeriod(flickerState_.manualPeriod); break; @@ -1127,7 +1127,7 @@ void IpaBase::applyControls(const ControlList &controls) * We note that it makes no difference if the mode gets set to "manual" * first, and the period updated after, or vice versa. */ - if (flickerState_.mode == controls::FlickerManual) + if (flickerState_.mode == controls::AeFlickerModeManual) agc->setFlickerPeriod(flickerState_.manualPeriod); break; diff --git a/src/libcamera/control_ids.cpp.in b/src/libcamera/control_ids.cpp.in index 65668d486d..c80d12d013 100644 --- a/src/libcamera/control_ids.cpp.in +++ b/src/libcamera/control_ids.cpp.in @@ -39,7 +39,7 @@ namespace {{vendor}} { * \brief Supported {{ctrl.name}} values {%- for enum in ctrl.enum_values %} * - * \var {{enum.name}} + * \var {{enum.prefixed_name}} * \brief {{enum.description|format_description}} {%- endfor %} */ @@ -81,12 +81,12 @@ namespace {{vendor}} { {% if ctrl.is_enum -%} extern const std::array {{ctrl.name}}Values = { {%- for enum in ctrl.enum_values %} - static_cast<{{ctrl.type}}>({{enum.name}}), + static_cast<{{ctrl.type}}>({{enum.prefixed_name}}), {%- endfor %} }; extern const std::map {{ctrl.name}}NameValueMap = { {%- for enum in ctrl.enum_values %} - { "{{enum.name}}", {{enum.name}} }, + { "{{enum.name}}", {{enum.prefixed_name}} }, {%- endfor %} }; extern const Control<{{ctrl.type}}> {{ctrl.name}}({{ctrl.name|snake_case|upper}}, "{{ctrl.name}}", "{{vendor}}", {{ctrl.direction}}, {{ctrl.name}}NameValueMap); diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml index 89991d03d7..73643e7e84 100644 --- a/src/libcamera/control_ids_core.yaml +++ b/src/libcamera/control_ids_core.yaml @@ -42,7 +42,7 @@ controls: When both the exposure time and analogue gain values are configured to be in Manual mode, the AEGC algorithm is quiescent and does not actively - compute any value and the AeState control will report AeStateIdle. + compute any value and the AeState control will report AeState.Idle. When at least the exposure time or analogue gain are configured to be computed by the AEGC algorithm, the AeState control will report if the @@ -53,7 +53,7 @@ controls: \sa ExposureTimeMode enum: - - name: AeStateIdle + - name: Idle value: 0 description: | The AEGC algorithm is inactive. @@ -61,7 +61,7 @@ controls: This state is returned when both AnalogueGainMode and ExposureTimeMode are set to Manual and the algorithm is not actively computing any value. - - name: AeStateSearching + - name: Searching value: 1 description: | The AEGC algorithm is actively computing new values, for either the @@ -73,8 +73,8 @@ controls: The AEGC algorithm converges once stable values are computed for all of the controls set to be computed in Auto mode. Once the - algorithm converges the state is moved to AeStateConverged. - - name: AeStateConverged + algorithm converges the state is moved to AeState.Converged. + - name: Converged value: 2 description: | The AEGC algorithm has converged. @@ -85,7 +85,7 @@ controls: If the measurements move too far away from the convergence point then the AEGC algorithm might start adjusting again, in which case - the state is moved to AeStateSearching. + the state is moved to AeState.Searching. # AeMeteringMode needs further attention: # - Auto-generate max enum value. @@ -100,16 +100,16 @@ controls: determine the scene brightness. Metering modes may be platform specific and not all metering modes may be supported. enum: - - name: MeteringCentreWeighted + - name: CentreWeighted value: 0 description: Centre-weighted metering mode. - - name: MeteringSpot + - name: Spot value: 1 description: Spot metering mode. - - name: MeteringMatrix + - name: Matrix value: 2 description: Matrix metering mode. - - name: MeteringCustom + - name: Custom value: 3 description: Custom metering mode. @@ -126,7 +126,7 @@ controls: adjusted to reach the desired target exposure. Constraint modes may be platform specific, and not all constraint modes may be supported. enum: - - name: ConstraintNormal + - name: Normal value: 0 description: | Default constraint mode. @@ -135,7 +135,7 @@ controls: image so as to reach a reasonable average level. However, highlights in the image may appear over-exposed and lowlights may appear under-exposed. - - name: ConstraintHighlight + - name: Highlight value: 1 description: | Highlight constraint mode. @@ -143,7 +143,7 @@ controls: This mode adjusts the exposure levels in order to try and avoid over-exposing the brightest parts (highlights) of an image. Other non-highlight parts of the image may appear under-exposed. - - name: ConstraintShadows + - name: Shadows value: 2 description: | Shadows constraint mode. @@ -151,7 +151,7 @@ controls: This mode adjusts the exposure levels in order to try and avoid under-exposing the dark parts (shadows) of an image. Other normally exposed parts of the image may appear over-exposed. - - name: ConstraintCustom + - name: Custom value: 3 description: | Custom constraint mode. @@ -176,16 +176,16 @@ controls: \sa ExposureTimeMode enum: - - name: ExposureNormal + - name: Normal value: 0 description: Default exposure mode. - - name: ExposureShort + - name: Short value: 1 description: Exposure mode allowing only short exposure times. - - name: ExposureLong + - name: Long value: 2 description: Exposure mode allowing long exposure times. - - name: ExposureCustom + - name: Custom value: 3 description: Custom exposure mode. @@ -244,7 +244,7 @@ controls: or Auto is not supported by the camera), the camera should use a best-effort default value. - If ExposureTimeModeManual is supported, the ExposureTime control must + If ExposureTimeMode.Manual is supported, the ExposureTime control must also be supported. Cameras that support manual control of the sensor shall support manual @@ -258,7 +258,7 @@ controls: \par Flickerless exposure mode transitions - Applications that wish to transition from ExposureTimeModeAuto to direct + Applications that wish to transition from ExposureTimeMode.Auto to direct control of the exposure time without causing extra flicker can do so by selecting an ExposureTime value as close as possible to the last value computed by the auto exposure algorithm in order to avoid any visible @@ -272,7 +272,7 @@ controls: immediately specify an ExposureTime value in the same request where ExposureTimeMode is set to Manual. They should instead wait for the first Request where ExposureTimeMode is reported as - ExposureTimeModeManual in the Request metadata, and use the reported + ExposureTimeMode.Manual in the Request metadata, and use the reported ExposureTime to populate the control value in the next Request to be queued to the Camera. @@ -281,12 +281,12 @@ controls: auto exposure use the last value provided by the application as starting point. - 1. Start with ExposureTimeMode set to Auto + 1. Start with ExposureTimeMode set to ExposureTimeMode.Auto - 2. Set ExposureTimeMode to Manual + 2. Set ExposureTimeMode to ExposureTimeMode.Manual 3. Wait for the first completed request that has ExposureTimeMode - set to Manual + set to ExposureTimeMode.Manual 4. Copy the value reported in ExposureTime into a new request, and submit it @@ -295,7 +295,7 @@ controls: \sa ExposureTime enum: - - name: ExposureTimeModeAuto + - name: Auto value: 0 description: | The exposure time will be calculated automatically and set by the @@ -304,18 +304,20 @@ controls: If ExposureTime is set while this mode is active, it will be ignored, and its value will not be retained. - When transitioning from Manual to Auto mode, the AEGC should start - its adjustments based on the last set manual ExposureTime value. - - name: ExposureTimeModeManual + When transitioning from ExposureTimeMode.Manual to ExposureTimeMode.Auto, + the AEGC should start its adjustments based on the last set manual + ExposureTime value. + - name: Manual value: 1 description: | The exposure time will not be updated by the AE algorithm. - When transitioning from Auto to Manual mode, the last computed - exposure value is used until a new value is specified through the - ExposureTime control. If an ExposureTime value is specified in the - same request where the ExposureTimeMode is changed from Auto to - Manual, the provided ExposureTime is applied immediately. + When transitioning from ExposureTimeMode.Auto to ExposureTimeMode.Manual, + the last computed exposure value is used until a new value is specified + through the ExposureTime control. If an ExposureTime value is specified + in the same request where the ExposureTimeMode is changed from + ExposureTimeMode.Auto to ExposureTimeMode.Manual, the provided + ExposureTime is applied immediately. - AnalogueGain: type: float @@ -356,7 +358,7 @@ controls: or Auto is not supported by the camera), the camera should use a best-effort default value. - If AnalogueGainModeManual is supported, the AnalogueGain control must + If AnalogueGainMode.Manual is supported, the AnalogueGain control must also be supported. For cameras where we have control over the ISP, both ExposureTimeMode @@ -376,7 +378,7 @@ controls: \sa ExposureTimeMode \sa AnalogueGain enum: - - name: AnalogueGainModeAuto + - name: Auto value: 0 description: | The analogue gain will be calculated automatically and set by the @@ -385,18 +387,20 @@ controls: If AnalogueGain is set while this mode is active, it will be ignored, and it will also not be retained. - When transitioning from Manual to Auto mode, the AEGC should start - its adjustments based on the last set manual AnalogueGain value. - - name: AnalogueGainModeManual + When transitioning from AnalogueGainMode.Manual to AnalogueGainMode.Auto, + the AEGC should start its adjustments based on the last set manual + AnalogueGain value. + - name: Manual value: 1 description: | The analogue gain will not be updated by the AEGC algorithm. - When transitioning from Auto to Manual mode, the last computed - gain value is used until a new value is specified through the - AnalogueGain control. If an AnalogueGain value is specified in the - same request where the AnalogueGainMode is changed from Auto to - Manual, the provided AnalogueGain is applied immediately. + When transitioning from AnalogueGainMode.Auto to AnalogueGainMode.Manual, + the last computed gain value is used until a new value is specified + through the AnalogueGain control. If an AnalogueGain value is specified + in the same request where the AnalogueGainMode is changed from + AnalogueGainMode.Auto to AnalogueGainMode.Manual, the provided + AnalogueGain is applied immediately. - AeFlickerMode: type: int32_t @@ -414,15 +418,15 @@ controls: Implementations may not support all of the flicker modes listed below. - By default the system will start in FlickerAuto mode if this is - supported, otherwise the flicker mode will be set to FlickerOff. + By default the system will start in AeFlickerMode.Auto mode if this is + supported, otherwise the flicker mode will be set to AeFlickerMode.Off. enum: - - name: FlickerOff + - name: "Off" value: 0 description: | No flicker avoidance is performed. - - name: FlickerManual + - name: Manual value: 1 description: | Manual flicker avoidance. @@ -430,7 +434,7 @@ controls: Suppress flicker effects caused by lighting running with a period specified by the AeFlickerPeriod control. \sa AeFlickerPeriod - - name: FlickerAuto + - name: Auto value: 2 description: | Automatic flicker period detection and avoidance. @@ -448,16 +452,16 @@ controls: Manual flicker period in microseconds. This value sets the current flicker period to avoid. It is used when - AeFlickerMode is set to FlickerManual. + AeFlickerMode is set to AeFlickerMode.Manual. To cancel 50Hz mains flicker, this should be set to 10000 (corresponding to 100Hz), or 8333 (120Hz) for 60Hz mains. - Setting the mode to FlickerManual when no AeFlickerPeriod has ever been + Setting the mode to AeFlickerMode.Manual when no AeFlickerPeriod has ever been set means that no flicker cancellation occurs (until the value of this control is updated). - Switching to modes other than FlickerManual has no effect on the + Switching to modes other than AeFlickerMode.Manual has no effect on the value of the AeFlickerPeriod control. \sa AeFlickerMode @@ -471,10 +475,10 @@ controls: The value reported here indicates the currently detected flicker period, or zero if no flicker at all is detected. - When AeFlickerMode is set to FlickerAuto, there may be a period during - which the value reported here remains zero. Once a non-zero value is - reported, then this is the flicker period that has been detected and is - now being cancelled. + When AeFlickerMode is set to AeFlickerMode.Auto, there may be a period + during which the value reported here remains zero. Once a non-zero value + is reported, then this is the flicker period that has been detected and + is now being cancelled. In the case of 50Hz mains flicker, the value would be 10000 (corresponding to 100Hz), or 8333 (120Hz) for 60Hz mains flicker. @@ -543,28 +547,28 @@ controls: The modes supported are platform specific, and not all modes may be supported. enum: - - name: AwbAuto + - name: Auto value: 0 description: Search over the whole colour temperature range. - - name: AwbIncandescent + - name: Incandescent value: 1 description: Incandescent AWB lamp mode. - - name: AwbTungsten + - name: Tungsten value: 2 description: Tungsten AWB lamp mode. - - name: AwbFluorescent + - name: Fluorescent value: 3 description: Fluorescent AWB lamp mode. - - name: AwbIndoor + - name: Indoor value: 4 description: Indoor AWB lighting mode. - - name: AwbDaylight + - name: Daylight value: 5 description: Daylight AWB lighting mode. - - name: AwbCloudy + - name: Cloudy value: 6 description: Cloudy AWB lighting mode. - - name: AwbCustom + - name: Custom value: 7 description: Custom AWB mode. @@ -801,7 +805,7 @@ controls: An implementation may choose not to implement all the modes. enum: - - name: AfModeManual + - name: Manual value: 0 description: | The AF algorithm is in manual mode. @@ -809,15 +813,15 @@ controls: In this mode it will never perform any action nor move the lens of its own accord, but an application can specify the desired lens position using the LensPosition control. The AfState will always - report AfStateIdle. + report AfState.Idle. - If the camera is started in AfModeManual, it will move the focus + If the camera is started in AfMode.Manual, it will move the focus lens to the position specified by the LensPosition control. This mode is the recommended default value for the AfMode control. External cameras (as reported by the Location property set to - CameraLocationExternal) may use a different default value. - - name: AfModeAuto + Location.External) may use a different default value. + - name: Auto value: 1 description: | The AF algorithm is in auto mode. @@ -827,18 +831,18 @@ controls: used to initiate a focus scan, the results of which will be reported by AfState. - If the autofocus algorithm is moved from AfModeAuto to another mode + If the autofocus algorithm is moved from AfMode.Auto to another mode while a scan is in progress, the scan is cancelled immediately, without waiting for the scan to finish. - When first entering this mode the AfState will report AfStateIdle. - When a trigger control is sent, AfState will report AfStateScanning - for a period before spontaneously changing to AfStateFocused or - AfStateFailed, depending on the outcome of the scan. It will remain + When first entering this mode the AfState will report AfState.Idle. + When a trigger control is sent, AfState will report AfState.Scanning + for a period before spontaneously changing to AfState.Focused or + AfState.Failed, depending on the outcome of the scan. It will remain in this state until another scan is initiated by the AfTrigger control. If a scan is cancelled (without changing to another mode), - AfState will return to AfStateIdle. - - name: AfModeContinuous + AfState will return to AfState.Idle. + - name: Continuous value: 2 description: | The AF algorithm is in continuous mode. @@ -853,9 +857,9 @@ controls: scanning by using the AfPause control. This allows video or still images to be captured whilst guaranteeing that the focus is fixed. - When set to AfModeContinuous, the system will immediately initiate a - scan so AfState will report AfStateScanning, and will settle on one - of AfStateFocused or AfStateFailed, depending on the scan result. + When set to AfMode.Continuous, the system will immediately initiate a + scan so AfState will report AfState.Scanning, and will settle on one + of AfState.Focused or AfState.Failed, depending on the scan result. - AfRange: type: int32_t @@ -865,7 +869,7 @@ controls: An implementation may choose not to implement all the options here. enum: - - name: AfRangeNormal + - name: Normal value: 0 description: | A wide range of focus distances is scanned. @@ -873,16 +877,16 @@ controls: Scanned distances cover all the way from infinity down to close distances, though depending on the implementation, possibly not including the very closest macro positions. - - name: AfRangeMacro + - name: Macro value: 1 description: | Only close distances are scanned. - - name: AfRangeFull + - name: Full value: 2 description: | The full range of focus distances is scanned. - This range is similar to AfRangeNormal but includes the very + This range is similar to AfRange.Normal but includes the very closest macro positions. - AfSpeed: @@ -897,10 +901,10 @@ controls: capture) it may be helpful to move the lens as quickly as is reasonably possible. enum: - - name: AfSpeedNormal + - name: Normal value: 0 description: Move the lens at its usual speed. - - name: AfSpeedFast + - name: Fast value: 1 description: Move the lens more quickly. @@ -910,11 +914,11 @@ controls: description: | The parts of the image used by the AF algorithm to measure focus. enum: - - name: AfMeteringAuto + - name: Auto value: 0 description: | Let the AF algorithm decide for itself where it will measure focus. - - name: AfMeteringWindows + - name: Windows value: 1 description: | Use the rectangles defined by the AfWindows control to measure focus. @@ -926,7 +930,7 @@ controls: direction: inout description: | The focus windows used by the AF algorithm when AfMetering is set to - AfMeteringWindows. + AfMetering.Windows. The units used are pixels within the rectangle returned by the ScalerCropMaximum property. @@ -957,19 +961,19 @@ controls: description: | Start an autofocus scan. - This control starts an autofocus scan when AfMode is set to AfModeAuto, - and is ignored if AfMode is set to AfModeManual or AfModeContinuous. It + This control starts an autofocus scan when AfMode is set to AfMode.Auto, + and is ignored if AfMode is set to AfMode.Manual or AfMode.Continuous. It can also be used to terminate a scan early. enum: - - name: AfTriggerStart + - name: Start value: 0 description: | Start an AF scan. - Setting the control to AfTriggerStart is ignored if a scan is in + Setting the control to AfTrigger.Start is ignored if a scan is in progress. - - name: AfTriggerCancel + - name: Cancel value: 1 description: | Cancel an AF scan. @@ -984,43 +988,43 @@ controls: Pause lens movements when in continuous autofocus mode. This control has no effect except when in continuous autofocus mode - (AfModeContinuous). It can be used to pause any lens movements while + (AfMode.Continuous). It can be used to pause any lens movements while (for example) images are captured. The algorithm remains inactive until it is instructed to resume. enum: - - name: AfPauseImmediate + - name: Immediate value: 0 description: | Pause the continuous autofocus algorithm immediately. The autofocus algorithm is paused whether or not any kind of scan is underway. AfPauseState will subsequently report - AfPauseStatePaused. AfState may report any of AfStateScanning, - AfStateFocused or AfStateFailed, depending on the algorithm's state + AfPauseState.Paused. AfState may report any of AfState.Scanning, + AfState.Focused or AfState.Failed, depending on the algorithm's state when it received this control. - - name: AfPauseDeferred + - name: Deferred value: 1 description: | Pause the continuous autofocus algorithm at the end of the scan. - This is similar to AfPauseImmediate, and if the AfState is - currently reporting AfStateFocused or AfStateFailed it will remain - in that state and AfPauseState will report AfPauseStatePaused. + This is similar to AfPause.Immediate, and if the AfState is + currently reporting AfState.Focused or AfState.Failed it will remain + in that state and AfPauseState will report AfPauseState.Paused. - However, if the algorithm is scanning (AfStateScanning), - AfPauseState will report AfPauseStatePausing until the scan is - finished, at which point AfState will report one of AfStateFocused - or AfStateFailed, and AfPauseState will change to - AfPauseStatePaused. + However, if the algorithm is scanning (AfState.Scanning), + AfPauseState will report AfPauseState.Pausing until the scan is + finished, at which point AfState will report one of AfState.Focused + or AfState.Failed, and AfPauseState will change to + AfPauseState.Paused. - - name: AfPauseResume + - name: Resume value: 2 description: | Resume continuous autofocus operation. The algorithm starts again from exactly where it left off, and - AfPauseState will report AfPauseStateRunning. + AfPauseState will report AfPauseState.Running. - LensPosition: type: float @@ -1032,7 +1036,7 @@ controls: also reports back the position of the lens for each frame. The LensPosition control is ignored unless the AfMode is set to - AfModeManual, though the value is reported back unconditionally in all + AfMode.Manual, though the value is reported back unconditionally in all modes. This value, which is generally a non-integer, is the reciprocal of the @@ -1069,50 +1073,50 @@ controls: though we note the following state transitions that occur when the AfMode is changed. - If the AfMode is set to AfModeManual, then the AfState will always - report AfStateIdle (even if the lens is subsequently moved). Changing - to the AfModeManual state does not initiate any lens movement. + If the AfMode is set to AfMode.Manual, then the AfState will always + report AfState.Idle (even if the lens is subsequently moved). Changing + to the AfMode.Manual state does not initiate any lens movement. - If the AfMode is set to AfModeAuto then the AfState will report - AfStateIdle. However, if AfModeAuto and AfTriggerStart are sent - together then AfState will omit AfStateIdle and move straight to - AfStateScanning (and start a scan). + If the AfMode is set to AfMode.Auto then the AfState will report + AfState.Idle. However, if AfMode.Auto and AfTrigger.Start are sent + together then AfState will omit AfState.Idle and move straight to + AfState.Scanning (and start a scan). - If the AfMode is set to AfModeContinuous then the AfState will - initially report AfStateScanning. + If the AfMode is set to AfMode.Continuous then the AfState will + initially report AfState.Scanning. enum: - - name: AfStateIdle + - name: Idle value: 0 description: | - The AF algorithm is in manual mode (AfModeManual) or in auto mode - (AfModeAuto) and a scan has not yet been triggered, or an + The AF algorithm is in manual mode (AfMode.Manual) or in auto mode + (AfMode.Auto) and a scan has not yet been triggered, or an in-progress scan was cancelled. - - name: AfStateScanning + - name: Scanning value: 1 description: | - The AF algorithm is in auto mode (AfModeAuto), and a scan has been + The AF algorithm is in auto mode (AfMode.Auto), and a scan has been started using the AfTrigger control. - The scan can be cancelled by sending AfTriggerCancel at which point - the algorithm will either move back to AfStateIdle or, if the scan + The scan can be cancelled by sending AfTrigger.Cancel at which point + the algorithm will either move back to AfState.Idle or, if the scan actually completes before the cancel request is processed, to one - of AfStateFocused or AfStateFailed. + of AfState.Focused or AfState.Failed. Alternatively the AF algorithm could be in continuous mode - (AfModeContinuous) at which point it may enter this state + (AfMode.Continuous) at which point it may enter this state spontaneously whenever it determines that a rescan is needed. - - name: AfStateFocused + - name: Focused value: 2 description: | - The AF algorithm is in auto (AfModeAuto) or continuous - (AfModeContinuous) mode and a scan has completed with the result + The AF algorithm is in auto (AfMode.Auto) or continuous + (AfMode.Continuous) mode and a scan has completed with the result that the algorithm believes the image is now in focus. - - name: AfStateFailed + - name: Failed value: 3 description: | - The AF algorithm is in auto (AfModeAuto) or continuous - (AfModeContinuous) mode and a scan has completed with the result + The AF algorithm is in auto (AfMode.Auto) or continuous + (AfMode.Continuous) mode and a scan has completed with the result that the algorithm did not find a good focus position. - AfPauseState: @@ -1121,35 +1125,35 @@ controls: description: | Report whether the autofocus is currently running, paused or pausing. - This control is only applicable in continuous (AfModeContinuous) mode, + This control is only applicable in continuous (AfMode.Continuous) mode, and reports whether the algorithm is currently running, paused or pausing (that is, will pause as soon as any in-progress scan completes). - Any change to AfMode will cause AfPauseStateRunning to be reported. + Any change to AfMode will cause AfPauseState.Running to be reported. enum: - - name: AfPauseStateRunning + - name: Running value: 0 description: | Continuous AF is running and the algorithm may restart a scan spontaneously. - - name: AfPauseStatePausing + - name: Pausing value: 1 description: | - Continuous AF has been sent an AfPauseDeferred control, and will + Continuous AF has been sent an AfPause.Deferred control, and will pause as soon as any in-progress scan completes. When the scan completes, the AfPauseState control will report - AfPauseStatePaused. No new scans will be start spontaneously until - the AfPauseResume control is sent. - - name: AfPauseStatePaused + AfPauseState.Paused. No new scans will be start spontaneously until + the AfPause.Resume control is sent. + - name: Paused value: 2 description: | Continuous AF is paused. No further state changes or lens movements will occur until the - AfPauseResume control is sent. + AfPause.Resume control is sent. - HdrMode: type: int32_t @@ -1170,13 +1174,13 @@ controls: \sa HdrChannel enum: - - name: HdrModeOff + - name: "Off" value: 0 description: | HDR is disabled. Metadata for this frame will not include the HdrChannel control. - - name: HdrModeMultiExposureUnmerged + - name: MultiExposureUnmerged value: 1 description: | Multiple exposures will be generated in an alternating fashion. @@ -1184,11 +1188,11 @@ controls: The multiple exposures will not be merged together and will be returned to the application as they are. Each image will be tagged with the correct HDR channel, indicating what kind of exposure it - is. The tag should be the same as in the HdrModeMultiExposure case. + is. The tag should be the same as in the HdrMode.MultiExposure case. The expectation is that an application using this mode would merge the frames to create HDR images for itself if it requires them. - - name: HdrModeMultiExposure + - name: MultiExposure value: 2 description: | Multiple exposures will be generated and merged to create HDR @@ -1201,7 +1205,7 @@ controls: alternately as the short and long channel. Systems that use three channels for HDR will cycle through the short, medium and long channel before repeating. - - name: HdrModeSingleExposure + - name: SingleExposure value: 3 description: | Multiple frames all at a single exposure will be used to create HDR @@ -1209,7 +1213,7 @@ controls: These images should be reported as all corresponding to the HDR short channel. - - name: HdrModeNight + - name: Night value: 4 description: | Multiple frames will be combined to produce "night mode" images. @@ -1235,20 +1239,20 @@ controls: \sa HdrMode enum: - - name: HdrChannelNone + - name: None value: 0 description: | This image does not correspond to any of the captures used to create an HDR image. - - name: HdrChannelShort + - name: Short value: 1 description: | This is a short exposure image. - - name: HdrChannelMedium + - name: Medium value: 2 description: | This is a medium exposure image. - - name: HdrChannelLong + - name: Long value: 3 description: | This is a long exposure image. @@ -1296,17 +1300,17 @@ controls: The algorithm then compensates for the loss of brightness by applying a global tone mapping curve to the image. enum: - - name: WdrOff + - name: "Off" value: 0 description: Wdr is disabled. - - name: WdrLinear + - name: Linear value: 1 description: Apply a linear global tone mapping curve. A curve with two linear sections is applied. This produces good results at the expense of a slightly artificial look. - - name: WdrPower + - name: Power value: 2 description: | Apply a power global tone mapping curve. @@ -1314,7 +1318,7 @@ controls: This curve has high gain values on the dark areas of an image and high compression values on the bright area. It therefore tends to produce noticeable noise artifacts. - - name: WdrExponential + - name: Exponential value: 3 description: | Apply an exponential global tone mapping curve. @@ -1322,7 +1326,7 @@ controls: This curve has lower gain values in dark areas compared to the power curve but produces a more natural look compared to the linear curve. It is therefore the best choice for most scenes. - - name: WdrHistogramEqualization + - name: HistogramEqualization value: 4 description: | Apply histogram equalization. diff --git a/src/libcamera/control_ids_draft.yaml b/src/libcamera/control_ids_draft.yaml index 03309eeac3..c72675909e 100644 --- a/src/libcamera/control_ids_draft.yaml +++ b/src/libcamera/control_ids_draft.yaml @@ -18,13 +18,13 @@ controls: Whether the camera device will trigger a precapture metering sequence when it processes this request. enum: - - name: AePrecaptureTriggerIdle + - name: Idle value: 0 description: The trigger is idle. - - name: AePrecaptureTriggerStart + - name: Start value: 1 description: The pre-capture AE metering is started by the camera. - - name: AePrecaptureTriggerCancel + - name: Cancel value: 2 description: | The camera will cancel any active or completed metering sequence. @@ -39,22 +39,22 @@ controls: Mode of operation for the noise reduction algorithm. enum: - - name: NoiseReductionModeOff + - name: "Off" value: 0 description: No noise reduction is applied - - name: NoiseReductionModeFast + - name: Fast value: 1 description: | Noise reduction is applied without reducing the frame rate. - - name: NoiseReductionModeHighQuality + - name: HighQuality value: 2 description: | High quality noise reduction at the expense of frame rate. - - name: NoiseReductionModeMinimal + - name: Minimal value: 3 description: | Minimal noise reduction is applied without reducing the frame rate. - - name: NoiseReductionModeZSL + - name: ZSL value: 4 description: | Noise reduction is applied at different levels to different streams. @@ -68,13 +68,13 @@ controls: Mode of operation for the chromatic aberration correction algorithm. enum: - - name: ColorCorrectionAberrationOff + - name: "Off" value: 0 description: No aberration correction is applied. - - name: ColorCorrectionAberrationFast + - name: Fast value: 1 description: Aberration correction will not slow down the frame rate. - - name: ColorCorrectionAberrationHighQuality + - name: HighQuality value: 2 description: | High quality aberration correction which might reduce the frame @@ -89,16 +89,16 @@ controls: Current state of the AWB algorithm. enum: - - name: AwbStateInactive + - name: Inactive value: 0 description: The AWB algorithm is inactive. - - name: AwbStateSearching + - name: Searching value: 1 description: The AWB algorithm has not converged yet. - - name: AwbConverged + - name: Converged value: 2 description: The AWB algorithm has converged. - - name: AwbLocked + - name: Locked value: 3 description: The AWB algorithm is locked. @@ -117,10 +117,10 @@ controls: Control to report if the lens shading map is available. Currently identical to ANDROID_STATISTICS_LENS_SHADING_MAP_MODE. enum: - - name: LensShadingMapModeOff + - name: "Off" value: 0 description: No lens shading map mode is available. - - name: LensShadingMapModeOn + - name: "On" value: 1 description: The lens shading map mode is available. @@ -156,18 +156,18 @@ controls: Control to select the test pattern mode. Currently identical to ANDROID_SENSOR_TEST_PATTERN_MODE. enum: - - name: TestPatternModeOff + - name: "Off" value: 0 description: | No test pattern mode is used. The camera device returns frames from the image sensor. - - name: TestPatternModeSolidColor + - name: SolidColor value: 1 description: | Each pixel in [R, G_even, G_odd, B] is replaced by its respective color channel provided in test pattern data. \todo Add control for test pattern data. - - name: TestPatternModeColorBars + - name: ColorBars value: 2 description: | All pixel data is replaced with an 8-bar color pattern. The vertical @@ -177,10 +177,10 @@ controls: should be rounded down to the nearest integer and the pattern can repeat on the right side. Each bar's height must always take up the full sensor pixel array height. - - name: TestPatternModeColorBarsFadeToGray + - name: ColorBarsFadeToGray value: 3 description: | - The test pattern is similar to TestPatternModeColorBars, + The test pattern is similar to TestPatternMode.ColorBars, except that each bar should start at its specified color at the top and fade to gray at the bottom. Furthermore each bar is further subdevided into a left and right half. The left half should have a @@ -191,7 +191,7 @@ controls: from the most significant bits of the smooth gradient. The height of each bar should always be a multiple of 128. When this is not the case, the pattern should repeat at the bottom of the image. - - name: TestPatternModePn9 + - name: Pn9 value: 4 description: | All pixel data is replaced by a pseudo-random sequence generated @@ -199,7 +199,7 @@ controls: a linear feedback shift register). The generator should be reset at the beginning of each frame, and thus each subsequent raw frame with this test pattern should be exactly the same as the last. - - name: TestPatternModeCustom1 + - name: Custom1 value: 256 description: | The first custom test pattern. All custom patterns that are @@ -221,19 +221,19 @@ controls: \sa FaceDetectFaceIds enum: - - name: FaceDetectModeOff + - name: "Off" value: 0 description: | Pipeline doesn't perform face detection and doesn't report any control related to face detection. - - name: FaceDetectModeSimple + - name: Simple value: 1 description: | Pipeline performs face detection and reports the FaceDetectFaceRectangles and FaceDetectFaceScores controls for each detected face. FaceDetectFaceLandmarks and FaceDetectFaceIds are optional. - - name: FaceDetectModeFull + - name: Full value: 2 description: | Pipeline performs face detection and reports all the controls diff --git a/src/libcamera/control_ids_rpi.yaml b/src/libcamera/control_ids_rpi.yaml index 2e6d1f4381..31a1356415 100644 --- a/src/libcamera/control_ids_rpi.yaml +++ b/src/libcamera/control_ids_rpi.yaml @@ -94,16 +94,16 @@ controls: \sa SyncFrames enum: - - name: SyncModeOff + - name: "Off" value: 0 description: Disable sync mode. - - name: SyncModeServer + - name: Server value: 1 description: | Enable sync mode, act as server. The server broadcasts timing messages to any clients that are listening, so that the clients can synchronise their camera frames with the server's. - - name: SyncModeClient + - name: Client value: 2 description: | Enable sync mode, act as client. A client listens for any server @@ -172,12 +172,12 @@ controls: direction: in description: | The number of frames the server should wait, after enabling - SyncModeServer, before signalling (via the SyncReady control) that + SyncMode.Server, before signalling (via the SyncReady control) that frames should be used. This therefore determines the "ready time" for all synchronised cameras. This control value should be set only for the device that is to act as - the server, before or at the same moment at which SyncModeServer is + the server, before or at the same moment at which SyncMode.Server is enabled. \sa SyncMode diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index 4b09bd6e2f..de5deda4f1 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -584,7 +584,7 @@ int UVCCameraData::init(std::shared_ptr media) * come from the ACPI _PLD, but that may be even more unreliable than * the _UPC. */ - properties::LocationEnum location = properties::CameraLocationExternal; + properties::LocationEnum location = properties::LocationExternal; std::ifstream file(video_->devicePath() + "/../removable"); if (file.is_open()) { std::string value; @@ -592,7 +592,7 @@ int UVCCameraData::init(std::shared_ptr media) file.close(); if (value == "fixed") - location = properties::CameraLocationFront; + location = properties::LocationFront; } properties_.set(properties::Location, location); diff --git a/src/libcamera/pipeline/virtual/README.md b/src/libcamera/pipeline/virtual/README.md index 6791281380..e5a33e458b 100644 --- a/src/libcamera/pipeline/virtual/README.md +++ b/src/libcamera/pipeline/virtual/README.md @@ -39,7 +39,7 @@ Each camera block is a dictionary, containing the following keys: - The path to a directory ends with "/". The name of the images in the directory are "{n}.jpg" with {n} is the sequence of images starting with 0. - `location` (`string`, default="front"): The location of the camera. Support - "CameraLocationFront", "CameraLocationBack", and "CameraLocationExternal". + "Front", "Back", and "External". - `model` (`string`, default="Unknown"): The model name of the camera. Check `data/virtual.yaml` as the sample config file. diff --git a/src/libcamera/pipeline/virtual/config_parser.cpp b/src/libcamera/pipeline/virtual/config_parser.cpp index 5169fd39bc..b76778df16 100644 --- a/src/libcamera/pipeline/virtual/config_parser.cpp +++ b/src/libcamera/pipeline/virtual/config_parser.cpp @@ -233,8 +233,8 @@ int ConfigParser::parseFrameGenerator(const ValueNode &cameraConfigData, Virtual int ConfigParser::parseLocation(const ValueNode &cameraConfigData, VirtualCameraData *data) { - /* Default value is properties::CameraLocationFront */ - int32_t location = properties::CameraLocationFront; + /* Default value is properties::LocationFront */ + int32_t location = properties::LocationFront; if (auto l = cameraConfigData["location"].get()) { auto it = properties::LocationNameValueMap.find(*l); diff --git a/src/libcamera/pipeline/virtual/data/virtual.yaml b/src/libcamera/pipeline/virtual/data/virtual.yaml index 20471bb94b..767107bbe1 100644 --- a/src/libcamera/pipeline/virtual/data/virtual.yaml +++ b/src/libcamera/pipeline/virtual/data/virtual.yaml @@ -14,7 +14,7 @@ - 70 - 80 test_pattern: "lines" - location: "CameraLocationFront" + location: "Front" model: "Virtual Video Device" "Virtual1": supported_formats: @@ -23,14 +23,14 @@ frame_rates: - 60 test_pattern: "bars" - location: "CameraLocationBack" + location: "Back" model: "Virtual Video Device1" "Virtual2": supported_formats: - width: 400 height: 300 test_pattern: "lines" - location: "CameraLocationFront" + location: "Front" model: "Virtual Video Device2" "Virtual3": test_pattern: "bars" diff --git a/src/libcamera/property_ids_core.yaml b/src/libcamera/property_ids_core.yaml index d5b3d309c0..a0ad9e9ea5 100644 --- a/src/libcamera/property_ids_core.yaml +++ b/src/libcamera/property_ids_core.yaml @@ -11,17 +11,17 @@ controls: description: | Camera mounting location enum: - - name: CameraLocationFront + - name: Front value: 0 description: | The camera is mounted on the front side of the device, facing the user - - name: CameraLocationBack + - name: Back value: 1 description: | The camera is mounted on the back side of the device, facing away from the user - - name: CameraLocationExternal + - name: External value: 2 description: | The camera is attached to the device in a way that allows it to diff --git a/src/libcamera/sensor/camera_sensor_legacy.cpp b/src/libcamera/sensor/camera_sensor_legacy.cpp index 83e2c25932..34333e5254 100644 --- a/src/libcamera/sensor/camera_sensor_legacy.cpp +++ b/src/libcamera/sensor/camera_sensor_legacy.cpp @@ -588,13 +588,13 @@ int CameraSensorLegacy::initProperties() << v4l2Orientation << ", setting to External"; [[fallthrough]]; case V4L2_CAMERA_ORIENTATION_EXTERNAL: - propertyValue = properties::CameraLocationExternal; + propertyValue = properties::LocationExternal; break; case V4L2_CAMERA_ORIENTATION_FRONT: - propertyValue = properties::CameraLocationFront; + propertyValue = properties::LocationFront; break; case V4L2_CAMERA_ORIENTATION_BACK: - propertyValue = properties::CameraLocationBack; + propertyValue = properties::LocationBack; break; } properties_.set(properties::Location, propertyValue); @@ -635,19 +635,19 @@ int CameraSensorLegacy::initProperties() int32_t cfa; switch (bayerFormat_->order) { case BayerFormat::BGGR: - cfa = properties::draft::BGGR; + cfa = properties::draft::ColorFilterArrangementBGGR; break; case BayerFormat::GBRG: - cfa = properties::draft::GBRG; + cfa = properties::draft::ColorFilterArrangementGBRG; break; case BayerFormat::GRBG: - cfa = properties::draft::GRBG; + cfa = properties::draft::ColorFilterArrangementGRBG; break; case BayerFormat::RGGB: - cfa = properties::draft::RGGB; + cfa = properties::draft::ColorFilterArrangementRGGB; break; case BayerFormat::MONO: - cfa = properties::draft::MONO; + cfa = properties::draft::ColorFilterArrangementMONO; break; } @@ -915,7 +915,7 @@ int CameraSensorLegacy::sensorInfo(IPACameraSensorInfo *info) const info->outputSize = format.size; std::optional cfa = properties_.get(properties::draft::ColorFilterArrangement); - info->cfaPattern = cfa ? *cfa : properties::draft::RGB; + info->cfaPattern = cfa ? *cfa : properties::draft::ColorFilterArrangementRGB; /* * Retrieve the pixel rate, line length and minimum/maximum frame diff --git a/src/libcamera/sensor/camera_sensor_raw.cpp b/src/libcamera/sensor/camera_sensor_raw.cpp index 6344a34fc4..9613bca830 100644 --- a/src/libcamera/sensor/camera_sensor_raw.cpp +++ b/src/libcamera/sensor/camera_sensor_raw.cpp @@ -595,13 +595,13 @@ int CameraSensorRaw::initProperties() << v4l2Orientation << ", setting to External"; [[fallthrough]]; case V4L2_CAMERA_ORIENTATION_EXTERNAL: - propertyValue = properties::CameraLocationExternal; + propertyValue = properties::LocationExternal; break; case V4L2_CAMERA_ORIENTATION_FRONT: - propertyValue = properties::CameraLocationFront; + propertyValue = properties::LocationFront; break; case V4L2_CAMERA_ORIENTATION_BACK: - propertyValue = properties::CameraLocationBack; + propertyValue = properties::LocationBack; break; } properties_.set(properties::Location, propertyValue); @@ -642,20 +642,20 @@ int CameraSensorRaw::initProperties() switch (cfaPattern_) { case BayerFormat::BGGR: - cfa = properties::draft::BGGR; + cfa = properties::draft::ColorFilterArrangementBGGR; break; case BayerFormat::GBRG: - cfa = properties::draft::GBRG; + cfa = properties::draft::ColorFilterArrangementGBRG; break; case BayerFormat::GRBG: - cfa = properties::draft::GRBG; + cfa = properties::draft::ColorFilterArrangementGRBG; break; case BayerFormat::RGGB: - cfa = properties::draft::RGGB; + cfa = properties::draft::ColorFilterArrangementRGGB; break; case BayerFormat::MONO: default: - cfa = properties::draft::MONO; + cfa = properties::draft::ColorFilterArrangementMONO; break; } @@ -1027,7 +1027,7 @@ int CameraSensorRaw::sensorInfo(IPACameraSensorInfo *info) const info->outputSize = format.size; std::optional cfa = properties_.get(properties::draft::ColorFilterArrangement); - info->cfaPattern = cfa ? *cfa : properties::draft::RGB; + info->cfaPattern = cfa ? *cfa : properties::draft::ColorFilterArrangementRGB; /* * Retrieve the pixel rate, line length and minimum/maximum frame diff --git a/src/py/libcamera/gen-py-controls.py b/src/py/libcamera/gen-py-controls.py index 97849eb342..34b127967e 100755 --- a/src/py/libcamera/gen-py-controls.py +++ b/src/py/libcamera/gen-py-controls.py @@ -11,18 +11,6 @@ import yaml from controls import Control -def find_common_prefix(strings): - prefix = strings[0] - - for string in strings[1:]: - while string[:len(prefix)] != prefix and prefix: - prefix = prefix[:len(prefix) - 1] - if not prefix: - break - - return prefix - - def extend_control(ctrl, mode): if ctrl.vendor != 'libcamera': ctrl.klass = ctrl.vendor @@ -31,22 +19,6 @@ def extend_control(ctrl, mode): ctrl.klass = mode ctrl.namespace = '' - if not ctrl.is_enum: - return ctrl - - if mode == 'controls': - # Adjustments for controls - if ctrl.name == 'LensShadingMapMode': - prefix = 'LensShadingMapMode' - else: - prefix = find_common_prefix([e.name for e in ctrl.enum_values]) - else: - # Adjustments for properties - prefix = find_common_prefix([e.name for e in ctrl.enum_values]) - - for enum in ctrl.enum_values: - enum.py_name = enum.name[len(prefix):] - return ctrl diff --git a/src/py/libcamera/py_controls_generated.cpp.in b/src/py/libcamera/py_controls_generated.cpp.in index c42a477bb3..cee4f35162 100644 --- a/src/py/libcamera/py_controls_generated.cpp.in +++ b/src/py/libcamera/py_controls_generated.cpp.in @@ -39,7 +39,7 @@ void init_py_{{mode}}_generated(py::module& m) py::enum_({{ctrl.klass}}, "{{ctrl.name}}Enum") {%- for enum in ctrl.enum_values %} - .value("{{enum.py_name}}", libcamera::{{mode}}::{{ctrl.namespace}}{{enum.name}}) + .value("{{enum.name}}", libcamera::{{mode}}::{{ctrl.namespace}}{{enum.prefixed_name}}) {%- endfor %} ; {%- endif %} diff --git a/utils/codegen/controls.py b/utils/codegen/controls.py index 083e22f088..a6f88169d7 100644 --- a/utils/codegen/controls.py +++ b/utils/codegen/controls.py @@ -21,6 +21,11 @@ class ControlEnum(object): """The enum name""" return self.__data.get('name') + @property + def prefixed_name(self): + """The prefixed enum name""" + return self.__data.get('prefixed_name') + @property def value(self): """The enum value""" @@ -37,7 +42,19 @@ class Control(object): enum_values = data.get('enum') if enum_values is not None: - self.__enum_values = [ControlEnum(enum) for enum in enum_values] + for enum in enum_values: + ename = enum['name'] + if type(ename) is not str: + raise ValueError(f'Enumerator `{self.__name}.{ename}` has a non-string name.') + if not ename[0].isupper(): + raise ValueError(f'Enumerator `{self.__name}.{ename}` must start with an uppercase letter.') + if ename.lower().startswith(name.lower()): + raise ValueError(f'Enumerator `{self.__name}.{ename}` must not be prefixed with the control name.') + + self.__enum_values = [ControlEnum({ + **enum, + 'prefixed_name': name + enum['name'], + }) for enum in enum_values] size = self.__data.get('size') if size is not None: diff --git a/utils/codegen/gen-gst-controls.py b/utils/codegen/gen-gst-controls.py index 31f18625f1..4a271c1ef3 100755 --- a/utils/codegen/gen-gst-controls.py +++ b/utils/codegen/gen-gst-controls.py @@ -29,18 +29,6 @@ exposed_controls = [ ] -def find_common_prefix(strings): - prefix = strings[0] - - for string in strings[1:]: - while string[:len(prefix)] != prefix and prefix: - prefix = prefix[:len(prefix) - 1] - if not prefix: - break - - return prefix - - def format_description(description): # Substitute doxygen keywords \sa (see also) and \todo description = re.sub(r'\\sa((?: \w+)+)', @@ -94,11 +82,6 @@ def extend_control(ctrl): ctrl.is_array = ctrl.size is not None if ctrl.is_enum: - # Remove common prefix from enum variant names - prefix = find_common_prefix([enum.name for enum in ctrl.enum_values]) - for enum in ctrl.enum_values: - enum.gst_name = kebab_case(enum.name.removeprefix(prefix)) - ctrl.gtype = 'enum' ctrl.default = '0' elif ctrl.element_type == 'bool': diff --git a/utils/tuning/config-example.yaml b/utils/tuning/config-example.yaml index 316ced08c4..238069a6f5 100644 --- a/utils/tuning/config-example.yaml +++ b/utils/tuning/config-example.yaml @@ -24,29 +24,29 @@ general: ct: [ 2000, 13000 ] probability: [ 1.0, 1.0 ] AwbMode: - AwbAuto: + Auto: lo: 2500 hi: 8000 - AwbIncandescent: + Incandescent: lo: 2500 hi: 3000 - AwbTungsten: + Tungsten: lo: 3000 hi: 3500 - AwbFluorescent: + Fluorescent: lo: 4000 hi: 4700 - AwbIndoor: + Indoor: lo: 3000 hi: 5000 - AwbDaylight: + Daylight: lo: 5500 hi: 6500 - AwbCloudy: + Cloudy: lo: 6500 hi: 8000 # One custom mode can be defined if needed - #AwbCustom: + #Custom: # lo: 2000 # hi: 1300 macbeth: diff --git a/utils/tuning/libtuning/modules/agc/rkisp1.py b/utils/tuning/libtuning/modules/agc/rkisp1.py index 2dad3a09ce..8a0aa53418 100644 --- a/utils/tuning/libtuning/modules/agc/rkisp1.py +++ b/utils/tuning/libtuning/modules/agc/rkisp1.py @@ -41,9 +41,9 @@ class AGCRkISP1(AGC): matrix = [1 for i in range(0, 25)] return { - 'MeteringCentreWeighted': centre_weighted, - 'MeteringSpot': spot, - 'MeteringMatrix': matrix + 'CentreWeighted': centre_weighted, + 'Spot': spot, + 'Matrix': matrix } def _generate_exposure_modes(self) -> dict: @@ -52,7 +52,7 @@ class AGCRkISP1(AGC): short = {'exposureTime': [100, 5000, 10000, 20000, 120000], 'gain': [2.0, 4.0, 6.0, 6.0, 6.0]} - return {'ExposureNormal': normal, 'ExposureShort': short} + return {'Normal': normal, 'Short': short} def _generate_constraint_modes(self) -> dict: normal = {'lower': {'qLo': 0.98, 'qHi': 1.0, 'yTarget': 0.5}} @@ -61,7 +61,7 @@ class AGCRkISP1(AGC): 'upper': {'qLo': 0.98, 'qHi': 1.0, 'yTarget': 0.8} } - return {'ConstraintNormal': normal, 'ConstraintHighlight': highlight} + return {'Normal': normal, 'Highlight': highlight} def _generate_y_target(self) -> list: return 0.5