From patchwork Fri Oct 9 12:20:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10028 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 9B709BEEE0 for ; Fri, 9 Oct 2020 12:17:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 790096081E; Fri, 9 Oct 2020 14:17:10 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4511160358 for ; Fri, 9 Oct 2020 14:17:09 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id A4CF6C0004; Fri, 9 Oct 2020 12:17:08 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Oct 2020 14:20:52 +0200 Message-Id: <20201009122101.73858-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009122101.73858-1-jacopo@jmondi.org> References: <20201009122101.73858-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 01/10] libcamera: Support draft controls and properties 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" From: Kieran Bingham Extend the control and property framework to support exposing draft controls and properties in a scoped namespace. The controls/properties themselves will retain the same ordering in the relevant enum/id maps - but the access to any draft control will require explicitly referencing through its' draft:: namespace prefix. Signed-off-by: Kieran Bingham # Added missing hunk in control_ids.cpp.in and changed subject Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- include/libcamera/control_ids.h.in | 6 +++++ include/libcamera/property_ids.h.in | 6 +++++ src/libcamera/control_ids.cpp.in | 13 +++++++++++ src/libcamera/property_ids.cpp.in | 13 +++++++++++ utils/gen-controls.py | 36 ++++++++++++++++++++++------- 5 files changed, 66 insertions(+), 8 deletions(-) -- 2.28.0 diff --git a/include/libcamera/control_ids.h.in b/include/libcamera/control_ids.h.in index 95a7a7f1e260..baadca83b103 100644 --- a/include/libcamera/control_ids.h.in +++ b/include/libcamera/control_ids.h.in @@ -26,6 +26,12 @@ ${controls} extern const ControlIdMap controls; +namespace draft { + +${draft_controls} + +} /* namespace draft */ + } /* namespace controls */ } /* namespace libcamera */ diff --git a/include/libcamera/property_ids.h.in b/include/libcamera/property_ids.h.in index e4dea335cd3b..52646c1f78ae 100644 --- a/include/libcamera/property_ids.h.in +++ b/include/libcamera/property_ids.h.in @@ -24,6 +24,12 @@ ${ids} ${controls} +namespace draft { + +${draft_controls} + +} /* namespace draft */ + extern const ControlIdMap properties; } /* namespace properties */ diff --git a/src/libcamera/control_ids.cpp.in b/src/libcamera/control_ids.cpp.in index cba6258d68dd..d31c1f5011b9 100644 --- a/src/libcamera/control_ids.cpp.in +++ b/src/libcamera/control_ids.cpp.in @@ -23,14 +23,27 @@ namespace controls { ${controls_doc} +namespace draft { + +${draft_controls_doc} + +} /* namespace draft */ + #ifndef __DOXYGEN__ /* * Keep the controls definitions hidden from doxygen as it incorrectly parses * them as functions. */ ${controls_def} + +namespace draft { + +${draft_controls_def} + +} /* namespace draft */ #endif + /** * \brief List of all supported libcamera controls * diff --git a/src/libcamera/property_ids.cpp.in b/src/libcamera/property_ids.cpp.in index bfdd823f63b0..275c1caff3ec 100644 --- a/src/libcamera/property_ids.cpp.in +++ b/src/libcamera/property_ids.cpp.in @@ -23,12 +23,25 @@ namespace properties { ${controls_doc} +namespace draft { + +${draft_controls_doc} + +} /* namespace draft */ + #ifndef __DOXYGEN__ /* * Keep the properties definitions hidden from doxygen as it incorrectly parses * them as functions. */ ${controls_def} + +namespace draft { + +${draft_controls_def} + +} /* namespace draft */ + #endif /** diff --git a/utils/gen-controls.py b/utils/gen-controls.py index 87c3d52ada6d..f28db27ba19f 100755 --- a/utils/gen-controls.py +++ b/utils/gen-controls.py @@ -36,6 +36,8 @@ ${description} ctrls_doc = [] ctrls_def = [] + draft_ctrls_doc = [] + draft_ctrls_def = [] ctrls_map = [] for ctrl in controls: @@ -55,6 +57,12 @@ ${description} 'id_name': id_name, } + target_doc = ctrls_doc + target_def = ctrls_def + if ctrl.get('draft'): + target_doc = draft_ctrls_doc + target_def = draft_ctrls_def + enum = ctrl.get('enum') if enum: enum_doc = [] @@ -70,15 +78,21 @@ ${description} enum_doc = '\n *\n'.join(enum_doc) enum_doc += '\n */' - ctrls_doc.append(enum_doc) + target_doc.append(enum_doc) + + target_doc.append(doc_template.substitute(info)) + target_def.append(def_template.substitute(info)) + + if ctrl.get('draft'): + name = 'draft::' + name - ctrls_doc.append(doc_template.substitute(info)) - ctrls_def.append(def_template.substitute(info)) ctrls_map.append('\t{ ' + id_name + ', &' + name + ' },') return { 'controls_doc': '\n\n'.join(ctrls_doc), 'controls_def': '\n'.join(ctrls_def), + 'draft_controls_doc': '\n\n'.join(draft_ctrls_doc), + 'draft_controls_def': '\n\n'.join(draft_ctrls_def), 'controls_map': '\n'.join(ctrls_map), } @@ -89,6 +103,7 @@ def generate_h(controls): template = string.Template('''extern const Control<${type}> ${name};''') ctrls = [] + draft_ctrls = [] ids = [] id_value = 1 @@ -109,22 +124,27 @@ def generate_h(controls): 'type': ctrl_type, } + target_ctrls = ctrls + if ctrl.get('draft'): + target_ctrls = draft_ctrls + enum = ctrl.get('enum') if enum: - ctrls.append(enum_template_start.substitute(info)) + target_ctrls.append(enum_template_start.substitute(info)) for entry in enum: value_info = { 'name': entry['name'], 'value': entry['value'], } - ctrls.append(enum_value_template.substitute(value_info)) - ctrls.append("};") + target_ctrls.append(enum_value_template.substitute(value_info)) + target_ctrls.append("};") - ctrls.append(template.substitute(info)) + target_ctrls.append(template.substitute(info)) id_value += 1 - return {'ids': '\n'.join(ids), 'controls': '\n'.join(ctrls)} + return {'ids': '\n'.join(ids), 'controls': '\n'.join(ctrls), + 'draft_controls': '\n'.join(draft_ctrls)} def fill_template(template, data): From patchwork Fri Oct 9 12:20:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10029 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 D7CB6BEEE0 for ; Fri, 9 Oct 2020 12:17:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 97FB86081E; Fri, 9 Oct 2020 14:17:13 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3C5B0605D1 for ; Fri, 9 Oct 2020 14:17:10 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 6D5C5C0009; Fri, 9 Oct 2020 12:17:09 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Oct 2020 14:20:53 +0200 Message-Id: <20201009122101.73858-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009122101.73858-1-jacopo@jmondi.org> References: <20201009122101.73858-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 02/10] libcamera: controls: Define AwbLocked control 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" Define a control to report the AWB algorithm locking state. The control definition is copied from the AeLocked one. Reviewed-by: Kieran Bingham Reviewed-by: Niklas Söderlund Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/control_ids.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 3560d4a81882..4c415545dcae 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -208,6 +208,17 @@ controls: value: 7 description: Maximum allowed value (place any new values above here). + - AwbLocked: + type: bool + description: | + Report the lock status of a running AWB algorithm. + + If the AWB algorithm is locked the value shall be set to true, if it's + converging it shall be set to false. If the AWB algorithm is not + running the control shall not be present in the metadata control list. + + \sa AwbEnable + - ColourGains: type: float description: | From patchwork Fri Oct 9 12:20:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10030 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 8DD17BEEE0 for ; Fri, 9 Oct 2020 12:17:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 512F9609C2; Fri, 9 Oct 2020 14:17:14 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CA9DF60359 for ; Fri, 9 Oct 2020 14:17:10 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 6AD6AC0004; Fri, 9 Oct 2020 12:17:10 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Oct 2020 14:20:54 +0200 Message-Id: <20201009122101.73858-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009122101.73858-1-jacopo@jmondi.org> References: <20201009122101.73858-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 03/10] libcamera: property_ids: Define draft properties 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" Libcamera is in the process of defining its own set of properties, to advertise the camera capabilities. To temporary close the gap in the Android camera HAL and support all static metadata required in the LIMITED hw level, define a set of Draft properties whose values are taken from their Android definition, in order to allow pipeline handlers to support them. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham Acked-by: Laurent Pinchart --- src/libcamera/property_ids.yaml | 74 +++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml index 7261263a9ba3..e524a0718dc3 100644 --- a/src/libcamera/property_ids.yaml +++ b/src/libcamera/property_ids.yaml @@ -663,4 +663,78 @@ controls: \todo Rename this property to ActiveAreas once we will have property categories (i.e. Properties::PixelArray::ActiveAreas) + - AvailableNoiseReductionModes: + type: int32_t + draft: true + size: [n] + description: | + Draft property to report the list of supported noise reduction modes. + Currently identical to + ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES. + enum: + - name: NoiseReductionModeOff + value: 0 + description: No noise reduction is applied + - name: NoiseReductionModeFast + value: 1 + description: | + Noise reduction is applied without reducing the frame rate. + - name: NoiseReductionModeHighQuality + value: 2 + description: | + High quality noise reduction at the expense of frame rate. + - name: NoiseReductionModeMinimal + value: 3 + description: | + Minimal noise reduction is applied without reducing the frame rate. + - name: NoiseReductionModeZSL + value: 4 + description: | + Noise reduction is applied at different levels to different streams. + + - AvailableColorCorrectionAberrationModes: + type: int32_t + draft: true + size: [n] + description: | + Draft property to report the list of supported color correction + aberration modes. Currently identical to + ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES. + enum: + - name: ColorCorrectionAberrationOff + value: 0 + description: No aberration correction is applied. + - name: ColorCorrectionAberrationFast + value: 1 + description: Aberration correction will not slow down the frame rate. + - name: ColorCorrectionAberrationHighQuality + value: 2 + description: | + High quality aberration correction which might reduce the frame + rate. + + - AvailableLensShadingMapModes: + type: int32_t + draft: true + size: [n] + description: | + Draft property to report the list of supported lens shading map modes. + Currently identical to + ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES. + enum: + - name: LensShadingMapModeOff + value: 0 + description: No lens shading map mode is available. + - name: LensShadingMapModeOn + value: 1 + description: The lens shading map mode is available. + + - PipelineMaxDepth: + type: int32_t + draft: true + description: | + Draft control to report the maximum number of pipeline stages a frame + has to go through from when it is exposed to when it is available to + applications. Currently identical to ANDROID_REQUEST_PIPELINE_MAX_DEPTH. + ... From patchwork Fri Oct 9 12:20:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10031 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 9C6FBBEEE0 for ; Fri, 9 Oct 2020 12:17:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E36B360933; Fri, 9 Oct 2020 14:17:14 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5F6F160358 for ; Fri, 9 Oct 2020 14:17:11 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id F2934C0004; Fri, 9 Oct 2020 12:17:10 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Oct 2020 14:20:55 +0200 Message-Id: <20201009122101.73858-5-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009122101.73858-1-jacopo@jmondi.org> References: <20201009122101.73858-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 04/10] libcamera: control_ids: Define draft controls 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" Libcamera is in the process of defining its own set of controls to enable applications to control the image capture process and return information on the captured frames. To temporary close the gap in the Android camera HAL and support all controls required in the LIMITED hw level, define a set of Draft controls whose values are taken from their Android definition, in order to allow pipeline handlers to support Android. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham Acked-by: Laurent Pinchart --- src/libcamera/control_ids.yaml | 266 +++++++++++++++++++++++++++++++++ 1 file changed, 266 insertions(+) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 4c415545dcae..62724b218380 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -284,4 +284,270 @@ controls: order in an array of 9 floating point values. size: [3x3] + + - AePrecaptureTrigger: + type: int32_t + draft: true + description: | + Draft control for AE metering trigger. Currently identical to + ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER. + + Whether the camera device will trigger a precapture metering sequence + when it processes this request. + enum: + - name: AePrecaptureTriggerIdle + value: 0 + description: The trigger is idle. + - name: AePrecaptureTriggerStart + value: 1 + description: The pre-capture AE metering is started by the camera. + - name: AePrecaptureTriggerCancel + value: 2 + description: | + The camera will cancel any active or completed metering sequence. + The AE algorithm is reset to its initial state. + + - AfTrigger: + type: int32_t + draft: true + description: | + Draft control for AF trigger. Currently identical to + ANDROID_CONTROL_AF_TRIGGER. + + Whether the camera device will trigger autofocus for this request. + enum: + - name: AfTriggerIdle + value: 0 + description: The trigger is idle. + - name: AfTriggerStart + value: 1 + description: The AF routine is started by the camera. + - name: AfTriggerCancel + value: 2 + description: | + The camera will cancel any active trigger and the AF routine is + reset to its initial state. + + - NoiseReductionMode: + type: int32_t + draft: true + description: | + Draft control to select the noise reduction algorithm mode. Currently + identical to ANDROID_NOISE_REDUCTION_MODE. + + Mode of operation for the noise reduction algorithm. + + \sa properties::draft::AvailableNoiseReductionModes. + enum: + - name: NoiseReductionModeOff + value: 0 + description: No noise reduction is applied + - name: NoiseReductionModeFast + value: 1 + description: | + Noise reduction is applied without reducing the frame rate. + - name: NoiseReductionModeHighQuality + value: 2 + description: | + High quality noise reduction at the expense of frame rate. + - name: NoiseReductionModeMinimal + value: 3 + description: | + Minimal noise reduction is applied without reducing the frame rate. + - name: NoiseReductionModeZSL + value: 4 + description: | + Noise reduction is applied at different levels to different streams. + + - ColorCorrectionAberrationMode: + type: int32_t + draft: true + description: | + Draft control to select the color correction aberration mode. Currently + identical to ANDROID_COLOR_CORRECTION_ABERRATION_MODE. + + Mode of operation for the chromatic aberration correction algorithm. + + \sa properties::draft::AvailableColorCorrectionAberrationModes. + enum: + - name: ColorCorrectionAberrationOff + value: 0 + description: No aberration correction is applied. + - name: ColorCorrectionAberrationFast + value: 1 + description: Aberration correction will not slow down the frame rate. + - name: ColorCorrectionAberrationHighQuality + value: 2 + description: | + High quality aberration correction which might reduce the frame + rate. + + - AeState: + type: int32_t + draft: true + description: | + Draft control to report the current AE algorithm state. Currently + identical to ANDROID_CONTROL_AE_STATE. + + Current state of the AE algorithm. + enum: + - name: AeStateInactive + value: 0 + description: The AE algorithm is inactive. + - name: AeStateSearching + value: 1 + description: The AE algorithm has not converged yet. + - name: AeStateConverged + value: 2 + description: The AE algorithm has converged. + - name: AeStateLocked + value: 3 + description: The AE algorithm is locked. + - name: AeStateFlashRequired + value: 4 + description: The AE algorithm would need a flash for good results + - name: AeStatePrecapture + value: 5 + description: | + The AE algorithm has started a pre-capture metering session. + \sa AePrecaptureTrigger + + - AfState: + type: int32_t + draft: true + description: | + Draft control to report the current AF algorithm state. Currently + identical to ANDROID_CONTROL_AF_STATE. + + Current state of the AF algorithm. + enum: + - name: AfStateInactive + value: 0 + description: The AF algorithm is inactive. + - name: AfStatePassiveScan + value: 1 + description: | + AF is performing a passive scan of the scene in continuous + auto-focus mode. + - name: AfStatePassiveFocused + value: 2 + description: | + AF believes the scene is in focus, but might restart scanning. + - name: AfStateActiveScan + value: 3 + description: | + AF is performing a scan triggered by an AF trigger request. + \sa AfTrigger + - name: AfStateFocusedLock + value: 4 + description: | + AF believes has focused correctly and has locked focus. + - name: AfStateNotFocusedLock + value: 5 + description: | + AF has not been able to focus and has locked. + - name: AfStatePassiveUnfocused + value: 6 + description: | + AF has completed a passive scan without finding focus. + + - AwbState: + type: int32_t + draft: true + description: | + Draft control to report the current AWB algorithm state. Currently + identical to ANDROID_CONTROL_AWB_STATE. + + Current state of the AWB algorithm. + enum: + - name: AwbStateInactive + value: 0 + description: The AWB algorithm is inactive. + - name: AwbStateSearching + value: 1 + description: The AWB algorithm has not converged yet. + - name: AwbConverged + value: 2 + description: The AWB algorithm has converged. + - name: AwbLocked + value: 3 + description: The AWB algorithm is locked. + + - ScalerCropRegion: + type: Rectangle + draft: true + description: | + Draft control to report the region of the sensor that has been read-out. + Currently identical to ANDROID_SCALER_CROP_REGION. + + The area of the sensor that has been read out, defined relatively to + the active pixel array size. + + \sa properties::PixelArrayActiveAreas + + - SensorTimestamp: + type: int64_t + draft: true + description: | + Draft control to report the start of exposure of the first row of the + captured image. Currently identical to ANDROID_SENSOR_TIMESTAMP. + + - SensorRollingShutterSkew: + type: int64_t + draft: true + description: | + Draft control to report the time between the start of exposure of the + first row and the start of exposure of the last row. Currently + identical to ANDROID_SENSOR_ROLLING_SHUTTER_SKEW + + - LensShadingMapMode: + type: int32_t + draft: true + description: | + Draft control to report if the lens shading map is available. Currently + identical to ANDROID_STATISTICS_LENS_SHADING_MAP_MODE. + + \sa properties::draft::AvailableLensShadingMapModes. + enum: + - name: LensShadingMapModeOff + value: 0 + description: No lens shading map mode is available. + - name: LensShadingMapModeOn + value: 1 + description: The lens shading map mode is available. + + - SceneFlicker: + type: int32_t + draft: true + description: | + Draft control to report the detected scene light frequency. Currently + identical to ANDROID_STATISTICS_SCENE_FLICKER. + enum: + - name: SceneFickerOff + value: 0 + description: No flickering detected. + - name: SceneFicker50Hz + value: 1 + description: 50Hz flickering detected. + - name: SceneFicker60Hz + value: 2 + description: 60Hz flickering detected. + + - PipelineDepth: + type: int32_t + draft: true + description: | + Specifies the number of pipeline stages the frame went through from when + it was exposed to when the final completed result was available to the + framework. Always less than or equal to PipelineMaxDepth. Currently + identical to ANDROID_REQUEST_PIPELINE_DEPTH. + + The typical value for this control is 3 as a frame is first exposed, + captured and then processed in a single pass through the ISP. Any + additional processing step performed after the ISP pass (in example face + detection, additional format conversions etc) count as an additional + pipeline stage. + + \sa properties::draft:PipelineMaxDepth + ... From patchwork Fri Oct 9 12:20:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10032 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 2A295BEEE0 for ; Fri, 9 Oct 2020 12:17:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1E3ED609EE; Fri, 9 Oct 2020 14:17:15 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E9C0860358 for ; Fri, 9 Oct 2020 14:17:11 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 8527DC0004; Fri, 9 Oct 2020 12:17:11 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Oct 2020 14:20:56 +0200 Message-Id: <20201009122101.73858-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009122101.73858-1-jacopo@jmondi.org> References: <20201009122101.73858-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 05/10] libcamera: ipu3: Register pipeline properties 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" Register three pipeline properties in the IPU3 pipeline handler: - properties::draft::PipelineMaxDepth - properties::draft::AvailableNoiseReductionModes - properties::draft::AvailableColorCorrectionAberrationModes - properties::draft::AvailableLensShadingMapModes IPU3 reports a maximum of 3 processing stages: exposure, capture and ISP processing. It does not support noise reduction, color aberration and lens shading map modes. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/ipu3/ipu3.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index f5a20d30fd03..f7ade2a6d5f3 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -770,6 +771,13 @@ int PipelineHandlerIPU3::registerCameras() /* Initialize the camera properties. */ data->properties_ = cio2->sensor()->properties(); + data->properties_.set(properties::draft::PipelineMaxDepth, 3); + data->properties_.set(properties::draft::AvailableNoiseReductionModes, + { static_cast(properties::draft::NoiseReductionModeOff) }); + data->properties_.set(properties::draft::AvailableColorCorrectionAberrationModes, + { static_cast(properties::draft::ColorCorrectionAberrationOff) }); + data->properties_.set(properties::draft::AvailableLensShadingMapModes, + { static_cast(properties::draft::LensShadingMapModeOff) }); /** * \todo Dynamically assign ImgU and output devices to each From patchwork Fri Oct 9 12:20:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10033 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 9562CBEEE0 for ; Fri, 9 Oct 2020 12:17:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 42A9C609F5; Fri, 9 Oct 2020 14:17:15 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 75F4B60358 for ; Fri, 9 Oct 2020 14:17:12 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 1B1B9C0004; Fri, 9 Oct 2020 12:17:11 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Oct 2020 14:20:57 +0200 Message-Id: <20201009122101.73858-7-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009122101.73858-1-jacopo@jmondi.org> References: <20201009122101.73858-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 06/10] libcamera: ipu3: Report pipeline depth 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" Report for each request the pipeline depth describing the number of processing steps the frames went through. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham Acked-by: Laurent Pinchart --- src/libcamera/pipeline/ipu3/ipu3.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index f7ade2a6d5f3..413c2b8b1f07 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -841,6 +842,7 @@ void IPU3CameraData::imguOutputBufferReady(FrameBuffer *buffer) return; /* Mark the request as complete. */ + request->metadata().set(controls::draft::PipelineDepth, 3); pipe_->completeRequest(camera_, request); } @@ -866,6 +868,7 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer) if (request->findBuffer(&rawStream_)) { bool isComplete = pipe_->completeBuffer(camera_, request, buffer); if (isComplete) { + request->metadata().set(controls::draft::PipelineDepth, 2); pipe_->completeRequest(camera_, request); return; } From patchwork Fri Oct 9 12:20:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10034 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 0CE75BEEE0 for ; Fri, 9 Oct 2020 12:17:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8CA33609C8; Fri, 9 Oct 2020 14:17:15 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 08CC660725 for ; Fri, 9 Oct 2020 14:17:13 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id A1AFBC0004; Fri, 9 Oct 2020 12:17:12 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Oct 2020 14:20:58 +0200 Message-Id: <20201009122101.73858-8-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009122101.73858-1-jacopo@jmondi.org> References: <20201009122101.73858-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 07/10] android: camera_device: Handle PIPELINE_MAX_DEPTH 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" Register the ANDROID_REQUEST_PIPELINE_MAX_DEPTH static property inspecting what the value returned by the pipeline handler through the properties::draft::PipelineMaxDepth libcamera property. Report the result metadata ANDROID_REQUEST_PIPELINE_DEPTH that reports the processing stage a frame went through by inspecting the controls::draft::PipelineDepth libcamera control reported in the completed Request. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/android/camera_device.cpp | 28 ++++++++++++++++++++++------ src/android/camera_device.h | 3 ++- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 0a94c1ae17ac..bccec358ea13 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -576,6 +577,8 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() return nullptr; } + const ControlList &cameraProperties = camera_->properties(); + /* Color correction static metadata. */ std::vector aberrationModes = { ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF, @@ -867,9 +870,12 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() staticMetadata_->addEntry(ANDROID_REQUEST_PARTIAL_RESULT_COUNT, &partialResultCount, 1); - uint8_t maxPipelineDepth = 2; - staticMetadata_->addEntry(ANDROID_REQUEST_PIPELINE_MAX_DEPTH, - &maxPipelineDepth, 1); + if (cameraProperties.contains(properties::draft::PipelineMaxDepth)) { + uint8_t maxPipelineDepth = + cameraProperties.get(properties::draft::PipelineMaxDepth); + staticMetadata_->addEntry(ANDROID_REQUEST_PIPELINE_MAX_DEPTH, + &maxPipelineDepth, 1); + } /* LIMITED does not support reprocessing. */ uint32_t maxNumInputStreams = 0; @@ -1480,7 +1486,8 @@ void CameraDevice::requestComplete(Request *request) * pipeline handlers) timestamp in the Request itself. */ FrameBuffer *buffer = buffers.begin()->second; - resultMetadata = getResultMetadata(descriptor->frameNumber, + resultMetadata = getResultMetadata(request->metadata(), + descriptor->frameNumber, buffer->metadata().timestamp); /* Handle any JPEG compression. */ @@ -1600,7 +1607,8 @@ void CameraDevice::notifyError(uint32_t frameNumber, camera3_stream_t *stream) * Produce a set of fixed result metadata. */ std::unique_ptr -CameraDevice::getResultMetadata([[maybe_unused]] int frame_number, +CameraDevice::getResultMetadata(ControlList &metadata, + [[maybe_unused]] int frame_number, int64_t timestamp) { /* @@ -1608,7 +1616,7 @@ CameraDevice::getResultMetadata([[maybe_unused]] int frame_number, * Currently: 18 entries, 62 bytes */ std::unique_ptr resultMetadata = - std::make_unique(18, 62); + std::make_unique(19, 63); if (!resultMetadata->isValid()) { LOG(HAL, Error) << "Failed to allocate static metadata"; return nullptr; @@ -1658,6 +1666,14 @@ CameraDevice::getResultMetadata([[maybe_unused]] int frame_number, resultMetadata->addEntry(ANDROID_STATISTICS_SCENE_FLICKER, &scene_flicker, 1); + /* Add metadata tags reported by libcamera. */ + if (metadata.contains(controls::draft::PipelineDepth)) { + uint8_t pipeline_depth = + metadata.get(controls::draft::PipelineDepth); + resultMetadata->addEntry(ANDROID_REQUEST_PIPELINE_DEPTH, + &pipeline_depth, 1); + } + /* * Return the result metadata pack even is not valid: get() will return * nullptr. diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 777d1a35e801..8cf1006c0840 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -102,7 +102,8 @@ private: void notifyError(uint32_t frameNumber, camera3_stream_t *stream); CameraMetadata *requestTemplatePreview(); libcamera::PixelFormat toPixelFormat(int format); - std::unique_ptr getResultMetadata(int frame_number, + std::unique_ptr getResultMetadata(libcamera::ControlList &metadata, + int frame_number, int64_t timestamp); unsigned int id_; From patchwork Fri Oct 9 12:20:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10035 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 361B0BEEE1 for ; Fri, 9 Oct 2020 12:17:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AAE9C60BD2; Fri, 9 Oct 2020 14:17:15 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9518F60725 for ; Fri, 9 Oct 2020 14:17:13 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 2CF1BC0007; Fri, 9 Oct 2020 12:17:13 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Oct 2020 14:20:59 +0200 Message-Id: <20201009122101.73858-9-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009122101.73858-1-jacopo@jmondi.org> References: <20201009122101.73858-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 08/10] android: camera_device: Handle NOISE_REDUCTION_MODES 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" Register the ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES static metadata property inspecting the values retuned by the pipeline handler through the properties::draft::AvailableNoiseReductionModes libcamera property. Reserve in the static metadata pack enough space to support all the 5 available noise reduction modes Android defines. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/android/camera_device.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index bccec358ea13..39d8218a67e5 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -538,7 +538,7 @@ std::tuple CameraDevice::calculateStaticMetadataSize() * Currently: 51 entries, 687 bytes of static metadata */ uint32_t numEntries = 51; - uint32_t byteSize = 687; + uint32_t byteSize = 691; /* * Calculate space occupation in bytes for dynamically built metadata @@ -815,9 +815,18 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() &minFocusDistance, 1); /* Noise reduction modes. */ - uint8_t noiseReductionModes = ANDROID_NOISE_REDUCTION_MODE_OFF; - staticMetadata_->addEntry(ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES, - &noiseReductionModes, 1); + if (cameraProperties.contains(properties::draft::AvailableNoiseReductionModes)) { + Span pipelineNoiseReductionModes = + cameraProperties.get> + (properties::draft::AvailableNoiseReductionModes); + + std::vector noiseReductionModes; + for (int32_t mode : pipelineNoiseReductionModes) + noiseReductionModes.push_back(mode); + staticMetadata_->addEntry(ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES, + noiseReductionModes.data(), + noiseReductionModes.size()); + } /* Scaler static metadata. */ float maxDigitalZoom = 1; From patchwork Fri Oct 9 12:21:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10036 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 17C16BEEE0 for ; Fri, 9 Oct 2020 12:17:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DD517607D6; Fri, 9 Oct 2020 14:17:17 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2C6ED609A3 for ; Fri, 9 Oct 2020 14:17:14 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id BC7ABC0004; Fri, 9 Oct 2020 12:17:13 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Oct 2020 14:21:00 +0200 Message-Id: <20201009122101.73858-10-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009122101.73858-1-jacopo@jmondi.org> References: <20201009122101.73858-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 09/10] android: camera_device: Handle COLOR_CORRECTION_ABERRATION_MODE 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" Register the ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES static metadata property inspecting the values retuned by the pipeline handler through the properties::draft::AvailableNoiseReductionModes libcamera property. Reserve in the static metadata pack enough space to support all the 3 available color correction aberration modes Android defines. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/android/camera_device.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 39d8218a67e5..172676f98059 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -538,7 +538,7 @@ std::tuple CameraDevice::calculateStaticMetadataSize() * Currently: 51 entries, 687 bytes of static metadata */ uint32_t numEntries = 51; - uint32_t byteSize = 691; + uint32_t byteSize = 693; /* * Calculate space occupation in bytes for dynamically built metadata @@ -580,12 +580,18 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() const ControlList &cameraProperties = camera_->properties(); /* Color correction static metadata. */ - std::vector aberrationModes = { - ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF, - }; - staticMetadata_->addEntry(ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES, - aberrationModes.data(), - aberrationModes.size()); + if (cameraProperties.contains(properties::draft::AvailableColorCorrectionAberrationModes)) { + Span pipelineAberrationModes = + cameraProperties.get> + (properties::draft::AvailableColorCorrectionAberrationModes); + + std::vector aberrationModes; + for (int32_t mode : pipelineAberrationModes) + aberrationModes.push_back(mode); + staticMetadata_->addEntry(ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES, + aberrationModes.data(), + aberrationModes.size()); + } /* Control static metadata. */ std::vector aeAvailableAntiBandingModes = { From patchwork Fri Oct 9 12:21:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10037 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 4F37ABEEE1 for ; Fri, 9 Oct 2020 12:17:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 29E4460983; Fri, 9 Oct 2020 14:17:18 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B0C4A60358 for ; Fri, 9 Oct 2020 14:17:14 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 4F0E5C000B; Fri, 9 Oct 2020 12:17:14 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Oct 2020 14:21:01 +0200 Message-Id: <20201009122101.73858-11-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201009122101.73858-1-jacopo@jmondi.org> References: <20201009122101.73858-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 10/10] android: camera_device: Handle LENS_SHADING_MAP_MODES 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" Register the ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES static metadata property inspecting the values retuned by the pipeline handler through the properties::draft::AvailableLensShadingMapModes libcamera property. Reserve in static metadata pack enough space to support all the 2 available lens shading map modes Android defines. Signed-off-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/android/camera_device.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 172676f98059..d776b61c07e6 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -537,8 +537,8 @@ std::tuple CameraDevice::calculateStaticMetadataSize() * \todo Keep this in sync with the actual number of entries. * Currently: 51 entries, 687 bytes of static metadata */ - uint32_t numEntries = 51; - uint32_t byteSize = 693; + uint32_t numEntries = 52; + uint32_t byteSize = 694; /* * Calculate space occupation in bytes for dynamically built metadata @@ -766,6 +766,18 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() staticMetadata_->addEntry(ANDROID_STATISTICS_INFO_MAX_FACE_COUNT, &maxFaceCount, 1); + if (cameraProperties.contains(properties::draft::AvailableLensShadingMapModes)) { + Span pipelineLensShadingMapModes = + cameraProperties.get> + (properties::draft::AvailableLensShadingMapModes); + + std::vector lensMapModes; + for (int32_t mode : pipelineLensShadingMapModes) + lensMapModes.push_back(mode); + staticMetadata_->addEntry(ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES, + lensMapModes.data(), lensMapModes.size()); + } + /* Sync static metadata. */ int32_t maxLatency = ANDROID_SYNC_MAX_LATENCY_UNKNOWN; staticMetadata_->addEntry(ANDROID_SYNC_MAX_LATENCY, &maxLatency, 1);