From patchwork Fri Jul 2 10:37:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 12771 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 B4F7CC3222 for ; Fri, 2 Jul 2021 10:38:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6C49A684F8; Fri, 2 Jul 2021 12:38:26 +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="TNnQ9Swi"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BF3A0684F6 for ; Fri, 2 Jul 2021 12:38:24 +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 4B3D54AB; Fri, 2 Jul 2021 12:38:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1625222304; bh=p8jz7QVzI8DLaijluE0KkGGqeckdX07fqMZpSOBqMKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TNnQ9SwivoF10kE3owWkq3HLwDHeBrYV0WgIavfVbvOarU2JFobKSbOPYCphaj3nz eHQySCPlQBPWB4kLWFjTfSbX9nm5VGFxwOlFKumkQxPzFDAtEVzYg4OZbuvu4WS2rI 1aVEIg+XmHLCs4iYrGajxpO1fTVjsHZII29NOYsU= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Fri, 2 Jul 2021 19:37:50 +0900 Message-Id: <20210702103800.41291-7-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210702103800.41291-1-paul.elder@ideasonboard.com> References: <20210702103800.41291-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v3 06/16] controls: Replace AwbEnable with AwbMode 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" Previously it was possible to have AwbEnable set to false, yet have AwbMode on anything. This caused a confusion situation, so merge the two into AwbMode. While at it, pull in the android AWB modes. Adjust the previous users of AwbEnable accordingly. Signed-off-by: Paul Elder --- Changes in v3: - resume raspberrypi awb on any non-off mode --- include/libcamera/ipa/raspberrypi.h | 1 - src/ipa/raspberrypi/raspberrypi.cpp | 27 ++++++++---------------- src/libcamera/control_ids.yaml | 32 +++++++++++++++-------------- test/controls/control_list.cpp | 6 +++--- 4 files changed, 29 insertions(+), 37 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index a8790000..63392a26 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -35,7 +35,6 @@ static const ControlInfoMap Controls = { { &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) }, { &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) }, { &controls::ExposureValue, ControlInfo(0.0f, 16.0f) }, - { &controls::AwbEnable, ControlInfo(false, true) }, { &controls::ColourGains, ControlInfo(0.0f, 32.0f) }, { &controls::AwbMode, ControlInfo(controls::AwbModeValues) }, { &controls::Brightness, ControlInfo(-1.0f, 1.0f) }, diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 4981aa29..620ed0f0 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -746,24 +746,6 @@ void IPARPi::queueRequest(const ControlList &controls) break; } - case controls::AWB_ENABLE: { - RPiController::Algorithm *awb = controller_.GetAlgorithm("awb"); - if (!awb) { - LOG(IPARPI, Warning) - << "Could not set AWB_ENABLE - no AWB algorithm"; - break; - } - - if (ctrl.second.get() == false) - awb->Pause(); - else - awb->Resume(); - - libcameraMetadata_.set(controls::AwbEnable, - ctrl.second.get()); - break; - } - case controls::AWB_MODE: { RPiController::AwbAlgorithm *awb = dynamic_cast( controller_.GetAlgorithm("awb")); @@ -774,6 +756,15 @@ void IPARPi::queueRequest(const ControlList &controls) } int32_t idx = ctrl.second.get(); + + if (idx == controls::AwbOff) { + awb->Pause(); + break; + } + + if (awb->IsPaused()) + awb->Resume(); + if (AwbModeTable.count(idx)) { awb->SetMode(AwbModeTable.at(idx)); libcameraMetadata_.set(controls::AwbMode, idx); diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 5717bc1f..2e62f61b 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -229,13 +229,6 @@ controls: Report an estimate of the current illuminance level in lux. The Lux control can only be returned in metadata. - - AwbEnable: - type: bool - description: | - Enable or disable the AWB. - - \sa ColourGains - # AwbMode needs further attention: # - Auto-generate max enum value. # - Better handling of custom types. @@ -245,29 +238,38 @@ controls: Specify the range of illuminants to use for the AWB algorithm. The modes supported are platform specific, and not all modes may be supported. enum: - - name: AwbAuto + - name: AwbOff value: 0 + description: The AWB routune is disabled. + - name: AwbAuto + value: 1 description: Search over the whole colour temperature range. - name: AwbIncandescent - value: 1 - description: Incandescent AWB lamp mode. - - name: AwbTungsten value: 2 - description: Tungsten AWB lamp mode. + description: Incandescent AWB lamp mode. - name: AwbFluorescent value: 3 description: Fluorescent AWB lamp mode. - - name: AwbIndoor + - name: AwbWarmFluorescent value: 4 - description: Indoor AWB lighting mode. + description: Warm fluorescent AWB lamp mode. - name: AwbDaylight value: 5 description: Daylight AWB lighting mode. - name: AwbCloudy value: 6 description: Cloudy AWB lighting mode. - - name: AwbCustom + - name: AwbTwilight value: 7 + description: Twilight AWB lamp mode. + - name: AwbTungsten + value: 8 + description: Tungsten AWB lamp mode. + - name: AwbIndoor + value: 9 + description: Indoor AWB lighting mode. + - name: AwbCustom + value: 10 description: Custom AWB mode. - AwbLocked: diff --git a/test/controls/control_list.cpp b/test/controls/control_list.cpp index 70cf61b8..ce55d09b 100644 --- a/test/controls/control_list.cpp +++ b/test/controls/control_list.cpp @@ -143,10 +143,10 @@ protected: * Attempt to set an invalid control and verify that the * operation failed. */ - list.set(controls::AwbEnable, true); + list.set(controls::AwbMode, true); - if (list.contains(controls::AwbEnable)) { - cout << "List shouldn't contain AwbEnable control" << endl; + if (list.contains(controls::AwbMode)) { + cout << "List shouldn't contain AwbMode control" << endl; return TestFail; }