From patchwork Mon Sep 13 10:20:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13819 X-Patchwork-Delegate: paul.elder@ideasonboard.com 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 2A717BDC71 for ; Mon, 13 Sep 2021 10:20:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 76D7C69182; Mon, 13 Sep 2021 12:20:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="M4Fwc+cT"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2F1C66024C for ; Mon, 13 Sep 2021 12:20:21 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8C0EF8F; Mon, 13 Sep 2021 12:20:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631528420; bh=AQw5DDVAVz4zxHJihUaIHlq0ipyX5Ejdb8XWiawuUIE=; h=From:To:Cc:Subject:Date:From; b=M4Fwc+cTsKTqGZaDgXGp2kwZjDiQNUPmxjyXlf7Ef3FIN8HsRPOvIgxFFgImEr9TR ztuLLnYm4MXZj6xEbt8/WGQViCfH3JeLcp4xGwaTdToDuqu+joFZx3qV4X3W2E6x9U p+NEl5S4paPD8beHRRTLN0PgPJTZCYLnlXtu3XzU= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 13 Sep 2021 19:20:05 +0900 Message-Id: <20210913102007.2303225-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/3] controls: Promote NoiseReductionMode to non-draft 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" Promote NoiseReductionMode to a non-draft control. Upgrade the value descriptions. Update the raspberrypi IPA accordingly, as it is the only current user of this control. Signed-off-by: Paul Elder --- include/libcamera/ipa/raspberrypi.h | 2 +- src/android/camera_capabilities.cpp | 2 +- src/ipa/raspberrypi/raspberrypi.cpp | 12 ++--- src/libcamera/control_ids.yaml | 73 +++++++++++++++++------------ 4 files changed, 52 insertions(+), 37 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index 521eaecd..e0dc6f5e 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -45,7 +45,7 @@ static const ControlInfoMap Controls({ { &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) }, { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }, { &controls::FrameDurationLimits, ControlInfo(INT64_C(1000), INT64_C(1000000000)) }, - { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) } + { &controls::NoiseReductionMode, ControlInfo(controls::NoiseReductionModeValues) } }, controls::controls); } /* namespace RPi */ diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index e92bca42..08e44a1a 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -1175,7 +1175,7 @@ int CameraCapabilities::initializeStaticMetadata() { std::vector data; data.reserve(5); - const auto &infoMap = controlsInfo.find(&controls::draft::NoiseReductionMode); + const auto &infoMap = controlsInfo.find(&controls::NoiseReductionMode); if (infoMap != controlsInfo.end()) { for (const auto &value : infoMap->second.values()) data.push_back(value.get()); diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 047123ab..8d44ab0a 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -605,11 +605,11 @@ static const std::map AwbModeTable = { }; static const std::map DenoiseModeTable = { - { controls::draft::NoiseReductionModeOff, RPiController::DenoiseMode::Off }, - { controls::draft::NoiseReductionModeFast, RPiController::DenoiseMode::ColourFast }, - { controls::draft::NoiseReductionModeHighQuality, RPiController::DenoiseMode::ColourHighQuality }, - { controls::draft::NoiseReductionModeMinimal, RPiController::DenoiseMode::ColourOff }, - { controls::draft::NoiseReductionModeZSL, RPiController::DenoiseMode::ColourHighQuality }, + { controls::NoiseReductionModeOff, RPiController::DenoiseMode::Off }, + { controls::NoiseReductionModeFast, RPiController::DenoiseMode::ColourFast }, + { controls::NoiseReductionModeHighQuality, RPiController::DenoiseMode::ColourHighQuality }, + { controls::NoiseReductionModeMinimal, RPiController::DenoiseMode::ColourOff }, + { controls::NoiseReductionModeZSL, RPiController::DenoiseMode::ColourHighQuality }, }; void IPARPi::queueRequest(const ControlList &controls) @@ -898,7 +898,7 @@ void IPARPi::queueRequest(const ControlList &controls) * analysis image resolution or format mismatch, we should * report the status correctly in the metadata. */ - libcameraMetadata_.set(controls::draft::NoiseReductionMode, idx); + libcameraMetadata_.set(controls::NoiseReductionMode, idx); } else { LOG(IPARPI, Error) << "Noise reduction mode " << idx << " not recognised"; diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 9d4638ae..fffcca2d 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -381,6 +381,50 @@ controls: \todo Define how the sensor timestamp has to be used in the reprocessing use case. + - NoiseReductionMode: + type: int32_t + description: | + Mode of operation for the noise reduction algorithm. + + The noise reduction algorithm attempts to improve image quality by + removing excessive noise added by the capture process, especially in + dark conditions. + enum: + - name: NoiseReductionModeOff + value: 0 + description: | + No noise reduction will be applied by the camera device, for + both the raw and YUV domains. + - name: NoiseReductionModeFast + value: 1 + description: | + Noise reduction is applied without reducing the frame rate. + This may be the same as Raw if it is listed, or the same as Off if + any noise reduction will slow down the frame rate. + - name: NoiseReductionModeHighQuality + value: 2 + description: | + High quality noise reduction at the expense of frame rate. + - name: NoiseReductionModeRaw + value: 3 + description: | + Only sensor raw domain basic noise reduction is enabled, to remove + demosaicing or other processing artifacts. Frame rate will not be + reduced. + - name: NoiseReductionModeZSL + value: 4 + description: | + Noise reduction is applied at different levels to different streams. + + ZSL is meant to be used by applications that maintain a continuous + circular buffer of high-resolution images during preview and + reprocess image(s) from that buffer into a final capture when + triggered by the user. In this mode, the camera device applies + noise reduction to low-resolution streams (below maximum recording + resolution) to maximize preview quality, but does not apply noise + reduction to high-resolution streams, since those will be + reprocessed later if necessary. + # ---------------------------------------------------------------------------- # Draft controls section @@ -427,35 +471,6 @@ controls: The camera will cancel any active trigger and the AF routine is reset to its initial state. - - NoiseReductionMode: - type: int32_t - draft: true - description: | - Control to select the noise reduction algorithm mode. Currently - identical to ANDROID_NOISE_REDUCTION_MODE. - - Mode of operation for the noise reduction algorithm. - 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