From patchwork Mon Jun 22 13:55:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 4109 Return-Path: Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AAC29603BE for ; Mon, 22 Jun 2020 15:56:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="OTALVZXR"; dkim-atps=neutral Received: by mail-wr1-x442.google.com with SMTP id q5so4385286wru.6 for ; Mon, 22 Jun 2020 06:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lwuzQcP5NtV0Djz+8ybqG+xX95tfmuqC7ARVnlPnPCk=; b=OTALVZXRAwnGdGyB5cuBgqCSpXhAiDiYs+LuIzGBD6HTOd3qbJgUlyYrKrGzQzjzH4 L6euSZXMRSLJmLQaEhFBBSgsdNFHo561mWgjyDywiBXrSLPLr4yuVjsNHqKKV/FbD8rv HbeSekMaLPXi9ts9oXVm96uF8rrqLvi6h7LeNuqIDv3chvXza4xnKGtjNgySm3TRIh8Y cfdNNQ3bqj25DbMmkqleUPHnIKQjs7noTU4f+N5ZNbdAKWzId/A2641YRoENp7M4ngVh jRUKTlKhPeA8p8SGQ4Ii0OU2cgsb32h6X1IglF+ib4xmiSREHgxJrD2OnczFWwAQLSKV g4Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lwuzQcP5NtV0Djz+8ybqG+xX95tfmuqC7ARVnlPnPCk=; b=YyappAq1qrhVa7DpJwIaX9sEbBIRWNJnYM43thrl7NGD2NbxcGBSzX6xwRS7YUMShf vV9KvG8E3LB2nXkGKOj099IETIZ81aWg1kMVT5oY57hb5w3/AEBf2KzHqFKJTa8Bhjs8 4ghrQc2S+P7c2Uww2oglstp4F1GYyYdfJzHjNm9fqKwbCD47TJ+GflZM0lBHWnc18PmT xsYlUvH7OfN9NP4CjHsiYQ1rq+eNV3E9n/chVEuh++sfGfcH/ctyGUklaqHEyT4k3OI9 KlNqbl+ZAGR/9hhrr6yjHruhRI1BwwmmeMKXdw+jTHFStrTrQOVUvbUJtpgvUDARrLD2 PiMA== X-Gm-Message-State: AOAM531/g+xsRmTOnXDnuffgp9UL4Q874xMaMTaP2+jX0PNCWCmk/2Gj piq3fiMdEuWJFSCgrGFjeOiPE74AI7Y= X-Google-Smtp-Source: ABdhPJyTARib66xE00uPm5ETQmhYP8YuMwIpz6sKABLWCFG7JIg2i98yH3eRfDO/Ooy4nSFwjZieDw== X-Received: by 2002:adf:db4d:: with SMTP id f13mr15534799wrj.336.1592834160108; Mon, 22 Jun 2020 06:56:00 -0700 (PDT) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id c201sm12742903wmd.4.2020.06.22.06.55.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 06:55:59 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Mon, 22 Jun 2020 14:55:47 +0100 Message-Id: <20200622135550.10788-2-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200622135550.10788-1-david.plowman@raspberrypi.com> References: <20200622135550.10788-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/4] libcamera: add a sharpness strength 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: , X-List-Received-Date: Mon, 22 Jun 2020 13:56:00 -0000 The control is a single float value with minimum, default and maximum values. Please read the description for more details. Signed-off-by: David Plowman Reviewed-by: Laurent Pinchart --- src/libcamera/control_ids.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 77ebc3f..8c3e4c7 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -239,4 +239,16 @@ controls: pixel range (as if pixels ranged from 0 to 65535). The SensorBlackLevels control can only be returned in metadata. size: [4] + + - Sharpness: + type: float + description: | + A value of 0.0 means no sharpening. The minimum value means + minimal sharpening, and shall be 0.0 unless the camera can't + disable sharpening completely. The default value shall give a + "reasonable" level of sharpening, suitable for most use cases. + The maximum value may apply extremely high levels of sharpening, + higher than anyone could reasonably want. Negative values are + not allowed. Note also that sharpening is not applied to raw + streams. ... From patchwork Mon Jun 22 13:55:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 4110 Return-Path: Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D1D1609A7 for ; Mon, 22 Jun 2020 15:56:02 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="C3f6E5ky"; dkim-atps=neutral Received: by mail-wr1-x429.google.com with SMTP id v3so9295489wrc.1 for ; Mon, 22 Jun 2020 06:56:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=blzNJOKYHnrUW4DxPt8nCOhq186OUDTiJdxCE82eKU0=; b=C3f6E5kyzGuCh2jEeLZGQZ8s3URPOGdqmUmrUkIUN6+zU6CnHuvwgIqdBHjDNdw6Bj xF0lictHjyS/1ajVmU4JiNh4UW3nbaKrBH1a9figrLuR+41ikHgvyo7U/TsJWi8DVMhj TOoqTK+X3oAeEEwbn1EKyiMJmOVyJ+x8+nutE4sNaAkc+3fKvyOCAigfej8yzJya/k51 441sCSpvQqQmrVWSPcjtVgfbjRwBrJdpIg8k/JqUfG7nWNYwf68Xvz4D9SqpILoBmjo5 Ho83qH5du+t0Z9ofXhemcxZ3bOkoe+ArPVGk477l3kvfkTbVdGhvD9t+YXbi5+UUwIMx eUWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=blzNJOKYHnrUW4DxPt8nCOhq186OUDTiJdxCE82eKU0=; b=HZ4gjwXhpbjAqmacGcPsricQ3sKfzYbyMomJ9vBj/JRBhxMXGqydwUUxEwPluLfMCN N/N14xuQU0P1ZqIbWF0KxFhHqQWKGwQmxsiloo166csei3XZOZIGq5pmWRm3U0HVSFoJ lqoLVXov3rO0nHqFQYJSFFErqLTBvptr9TPlXpRciq3m+1Qmz4IgNx+OJMiq3V+7+dBi HBKADPXeJj7W4MpBPFswhRf5MGYlJT870ocSxkfvQBKVoidB+UP7polS9M9LZqtKv4Cc hn9L/tm1efp83j/cUGwupvED55j+M/4WA4unwSMCrdqUzTZ9+ag0Ct5+bCTZnMnPsc1b TkRA== X-Gm-Message-State: AOAM532Ygu88BQHr4UfpuZL2GvsyKXmQ8raGvjm/ivuicauwWvNEUbKM tg88K6vSN+hVo/veUeJQwD+2+DuL/7o= X-Google-Smtp-Source: ABdhPJxIBzk1eV2arJ/9xuLKMRKccUVIgZ9jmT98ImGVBuoSI7I50WycgKGL699A+7thK8jhuOs5Ww== X-Received: by 2002:a05:6000:128c:: with SMTP id f12mr7315068wrx.67.1592834161664; Mon, 22 Jun 2020 06:56:01 -0700 (PDT) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id c201sm12742903wmd.4.2020.06.22.06.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 06:56:01 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Mon, 22 Jun 2020 14:55:48 +0100 Message-Id: <20200622135550.10788-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200622135550.10788-1-david.plowman@raspberrypi.com> References: <20200622135550.10788-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/4] libcamera: ipa: raspberrypi: make sharpening mode_factor an ordinary double 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: , X-List-Received-Date: Mon, 22 Jun 2020 13:56:02 -0000 No need for it to be std::atomic as SwitchMode runs synchronously with Prepare. Signed-off-by: David Plowman Reviewed-by: Laurent Pinchart --- src/ipa/raspberrypi/controller/rpi/sharpen.cpp | 7 +++---- src/ipa/raspberrypi/controller/rpi/sharpen.hpp | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ipa/raspberrypi/controller/rpi/sharpen.cpp b/src/ipa/raspberrypi/controller/rpi/sharpen.cpp index 086952f..4c2fdb3 100644 --- a/src/ipa/raspberrypi/controller/rpi/sharpen.cpp +++ b/src/ipa/raspberrypi/controller/rpi/sharpen.cpp @@ -44,13 +44,12 @@ void Sharpen::Read(boost::property_tree::ptree const ¶ms) void Sharpen::Prepare(Metadata *image_metadata) { - double mode_factor = mode_factor_; struct SharpenStatus status; // Binned modes seem to need the sharpening toned down with this // pipeline. - status.threshold = threshold_ * mode_factor; - status.strength = strength_ / mode_factor; - status.limit = limit_ / mode_factor; + status.threshold = threshold_ * mode_factor_; + status.strength = strength_ / mode_factor_; + status.limit = limit_ / mode_factor_; image_metadata->Set("sharpen.status", status); } diff --git a/src/ipa/raspberrypi/controller/rpi/sharpen.hpp b/src/ipa/raspberrypi/controller/rpi/sharpen.hpp index f871aa6..a3bf899 100644 --- a/src/ipa/raspberrypi/controller/rpi/sharpen.hpp +++ b/src/ipa/raspberrypi/controller/rpi/sharpen.hpp @@ -26,7 +26,7 @@ private: double threshold_; double strength_; double limit_; - std::atomic mode_factor_; + double mode_factor_; }; } // namespace RPi From patchwork Mon Jun 22 13:55:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 4111 Return-Path: Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 71D01603BE for ; Mon, 22 Jun 2020 15:56:04 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="WsZWUddc"; dkim-atps=neutral Received: by mail-wm1-x334.google.com with SMTP id a6so81407wmm.0 for ; Mon, 22 Jun 2020 06:56:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nW9c2ksYEoDsz8NJt0X7yIsYj0lj12jB3k4kkfsUo/I=; b=WsZWUddc5hpKD6rbpOnt+GrtERhRRloDye32876qhYeOA1JqMBSv+yidNAILcgM6HV 91bCoyFTr+BPitPSgc1m3a0twG4mE1/hU/IhaRnPqdpi6UkTsw6F52L2dDJg79COw+EC fyekegQMoLzfp5BthUQDjJ0we8P5WYT7EjOkvKc26qbJG84oFHvERBs/nzeYzi5dnXAp Gjzaba1Ld4Hm6abEnZ7qUmk5btcEjZZlPaZkzgWWzXYl9ZnzGxz3HMx91dUMLT3HL+HF jxkM1viM9J6F4Q/9qW0DbGvNAsx2R79i2x2JiErJDqU1T0GUui7i/AIjG6WOeyoQjzHM hhgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nW9c2ksYEoDsz8NJt0X7yIsYj0lj12jB3k4kkfsUo/I=; b=lrFdivi05eCcXc4dyvy5MnfPQkSDjIJbKFI/coVwL+8yRnDDBXFnXix+HzYwtoIpp6 5yU8jqmtssdwq6Q90ldjRTvT8KfBjKOq3zC2Z05392jDfX77+5CdcAir4AxNxe6NCChB iquWKtT7SC6P2Y76A4KsjmQ/pkzqapfYsstcQBG1FTI/cNCXKsyzfdlJ596bwQXf4CUO xecXnVKFsHeIAzOUisVwfw3AzEOv/Tyxik/4T7lNRI4noAh6pb2AEPfFH8fps3OnPuvf 1aFnWNuGGCIXBYhKMU+vpv2V88aYqpEvgZ4xFUeK1sFBpaA8Zqs0gmlLdF52v+dxAoe1 SbSw== X-Gm-Message-State: AOAM5302cBgXIB64eCQ3Y0tgO3IkX1PoyZCoKQlpb75bkS/6kN8LTxf2 zXGKeVBz/k7pdU1otQrBiyNmTVAiCbI= X-Google-Smtp-Source: ABdhPJx3S7RZbvysTtRxcn90bAAVSksko1Twic6w7w8Wd2/IRY5k3VLm/9VFfZdUTrQFbOExkw+b7Q== X-Received: by 2002:a1c:1b90:: with SMTP id b138mr8233523wmb.21.1592834163853; Mon, 22 Jun 2020 06:56:03 -0700 (PDT) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id c201sm12742903wmd.4.2020.06.22.06.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 06:56:03 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Mon, 22 Jun 2020 14:55:49 +0100 Message-Id: <20200622135550.10788-4-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200622135550.10788-1-david.plowman@raspberrypi.com> References: <20200622135550.10788-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/4] libcamera: ipa: raspberrypi: add sharpness strength control to Raspberry Pi IPAs 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: , X-List-Received-Date: Mon, 22 Jun 2020 13:56:04 -0000 The sharpness control is, loosely speaking, a gain applied to the amount of sharpening added to an image. We also report the sharpness setting used back to the caller in metadata. Signed-off-by: David Plowman --- .../raspberrypi/controller/rpi/sharpen.cpp | 30 +++++++++++++++---- .../raspberrypi/controller/rpi/sharpen.hpp | 6 ++-- .../controller/sharpen_algorithm.hpp | 21 +++++++++++++ .../raspberrypi/controller/sharpen_status.h | 2 ++ 4 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 src/ipa/raspberrypi/controller/sharpen_algorithm.hpp diff --git a/src/ipa/raspberrypi/controller/rpi/sharpen.cpp b/src/ipa/raspberrypi/controller/rpi/sharpen.cpp index 4c2fdb3..cd93529 100644 --- a/src/ipa/raspberrypi/controller/rpi/sharpen.cpp +++ b/src/ipa/raspberrypi/controller/rpi/sharpen.cpp @@ -17,7 +17,7 @@ using namespace RPi; #define NAME "rpi.sharpen" Sharpen::Sharpen(Controller *controller) - : Algorithm(controller) + : SharpenAlgorithm(controller), user_strength_(1.0) { } @@ -42,14 +42,34 @@ void Sharpen::Read(boost::property_tree::ptree const ¶ms) limit_ = params.get("limit", 1.0); } +void Sharpen::SetStrength(double strength) +{ + // Note that this method is how an application sets the overall + // sharpening "strength". We call this the "user strength" field + // as there already is a strength_ field - being an internal gain + // parameter that gets passed to the ISP control code. + user_strength_ = strength; +} + void Sharpen::Prepare(Metadata *image_metadata) { + // The user_strength affects the algorithm's internal gain directly, but + // we adjust the limit and threshold less aggressively. Using a sqrt + // function is an arbitrary but gentle way of accomplishing this. + double user_strength = user_strength_; + if (user_strength < 0.0) + user_strength = 0.0; + double user_strength_sqrt = sqrt(user_strength); struct SharpenStatus status; // Binned modes seem to need the sharpening toned down with this - // pipeline. - status.threshold = threshold_ * mode_factor_; - status.strength = strength_ / mode_factor_; - status.limit = limit_ / mode_factor_; + // pipeline, thus we use the mode_factor here. Also avoid + // divide-by-zero with the user_strength_sqrt. + status.threshold = threshold_ * mode_factor_ / + std::max(0.01, user_strength_sqrt); + status.strength = strength_ / mode_factor_ * user_strength; + status.limit = limit_ / mode_factor_ * user_strength_sqrt; + // Finally, report any application-supplied parameters that were used. + status.user_strength = user_strength; image_metadata->Set("sharpen.status", status); } diff --git a/src/ipa/raspberrypi/controller/rpi/sharpen.hpp b/src/ipa/raspberrypi/controller/rpi/sharpen.hpp index a3bf899..e9a71fd 100644 --- a/src/ipa/raspberrypi/controller/rpi/sharpen.hpp +++ b/src/ipa/raspberrypi/controller/rpi/sharpen.hpp @@ -6,20 +6,21 @@ */ #pragma once -#include "../algorithm.hpp" +#include "../sharpen_algorithm.hpp" #include "../sharpen_status.h" // This is our implementation of the "sharpen algorithm". namespace RPi { -class Sharpen : public Algorithm +class Sharpen : public SharpenAlgorithm { public: Sharpen(Controller *controller); char const *Name() const override; void SwitchMode(CameraMode const &camera_mode, Metadata *metadata) override; void Read(boost::property_tree::ptree const ¶ms) override; + void SetStrength(double strength) override; void Prepare(Metadata *image_metadata) override; private: @@ -27,6 +28,7 @@ private: double strength_; double limit_; double mode_factor_; + std::atomic user_strength_; }; } // namespace RPi diff --git a/src/ipa/raspberrypi/controller/sharpen_algorithm.hpp b/src/ipa/raspberrypi/controller/sharpen_algorithm.hpp new file mode 100644 index 0000000..3b27a74 --- /dev/null +++ b/src/ipa/raspberrypi/controller/sharpen_algorithm.hpp @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) 2020, Raspberry Pi (Trading) Limited + * + * sharpen_algorithm.hpp - sharpness control algorithm interface + */ +#pragma once + +#include "algorithm.hpp" + +namespace RPi { + +class SharpenAlgorithm : public Algorithm +{ +public: + SharpenAlgorithm(Controller *controller) : Algorithm(controller) {} + // A sharpness control algorithm must provide the following: + virtual void SetStrength(double strength) = 0; +}; + +} // namespace RPi diff --git a/src/ipa/raspberrypi/controller/sharpen_status.h b/src/ipa/raspberrypi/controller/sharpen_status.h index 6de80f4..7501b19 100644 --- a/src/ipa/raspberrypi/controller/sharpen_status.h +++ b/src/ipa/raspberrypi/controller/sharpen_status.h @@ -19,6 +19,8 @@ struct SharpenStatus { double strength; // upper limit of the allowed sharpening response double limit; + // The sharpening strength requested by the user or application. + double user_strength; }; #ifdef __cplusplus From patchwork Mon Jun 22 13:55:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 4112 Return-Path: Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2F761603BD for ; Mon, 22 Jun 2020 15:56:09 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="fs9O5tZj"; dkim-atps=neutral Received: by mail-wm1-x341.google.com with SMTP id g10so14966804wmh.4 for ; Mon, 22 Jun 2020 06:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=szZXl6QaV/4cRk25Zk5zyFZjAjLl0G9Vvu2sYyyNpS8=; b=fs9O5tZjswV2KulfyIakCXvAtpkbdAe6zWCvrVTrC8kPT84YTsychzxU/4k7+z9KjH 8rI0vkmU/dNKUlBE4iRrymP8CbxMAFyo00FFl62RQllrV8ucxQ4rRAoM6aMTlsjgKmPA Wq1oeXHHsytiRp0DxlTlf4vhHw9bgDQ1310PX9iYF6QSIDn3SyZvi1TfA5EUJBXgjQOu JBY8XEVYTU0c6M8wwvqKAhqaFSAiDRDxTbpQZJYQruf6luofNbY8WEh2oVE/SVsV7hdL tsZ0a/yiamNcpXxIbSznn+fid8o+yciAEvUu7q+ScTWyyW5WLrwF3J684wyBg9CwA4AM 0PNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=szZXl6QaV/4cRk25Zk5zyFZjAjLl0G9Vvu2sYyyNpS8=; b=tehJF6X2/bEVHpmsmyjYvrW2eKTgDyd120kzhxHFe3camGuA8VK2TncNytviriKMid uA2cmBMOvRZ8dkl7hdryCTCGwznybssKIJnjMe/pjq0kwWw949e2chIigr7fx4Utl3Q5 n8HxtsLnsl1xr+TJ5vyasAw36pXvQ2RLMvtdbcjxugcHiKMMiF/tfi1Cb7QR2fv0BIgt wr3qKBD5Em177KE8v2RfP+Q4yqI6ZIbPYdyIWEx8vDVAf7i38fPPusxshF7kJ84ga9WK cOr4KaisnoOD09gm/AytkmUrxfkOppjJOHIkyrLW9Cguhv6L7VGEnhtaa5JEhdXAFsfT GImw== X-Gm-Message-State: AOAM530nmwBBGOM368uCaybYTWA0tLwyqi4pxTtNcdRtGyunCxMyBTL3 hjFJN60WaE02rkCSGdzkG3Ii/OcRrCI= X-Google-Smtp-Source: ABdhPJwtiuzpeKl1qCe3J2ISQR5vI8wMxYiSEgv7vMAjqqwz2OEMgSBHnkpmCaZsSfTJiI24rs/JZA== X-Received: by 2002:a1c:4343:: with SMTP id q64mr7104104wma.20.1592834165686; Mon, 22 Jun 2020 06:56:05 -0700 (PDT) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id c201sm12742903wmd.4.2020.06.22.06.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2020 06:56:05 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Mon, 22 Jun 2020 14:55:50 +0100 Message-Id: <20200622135550.10788-5-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200622135550.10788-1-david.plowman@raspberrypi.com> References: <20200622135550.10788-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/4] libcamera: ipa: raspberrypi: plumb the libcamera sharpness control through to the Raspberry Pi implementation 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: , X-List-Received-Date: Mon, 22 Jun 2020 13:56:09 -0000 This simply wires up the libcamera sharpness control in the Raspberry Pi IPAs so that it controls the strength of the Raspberry Pi sharpness control algorithm. Signed-off-by: David Plowman Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/raspberrypi.h | 1 + src/ipa/raspberrypi/raspberrypi.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index c109469..a18ce9a 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -51,6 +51,7 @@ static const ControlInfoMap RPiControls = { { &controls::Brightness, ControlInfo(-1.0f, 1.0f) }, { &controls::Contrast, ControlInfo(0.0f, 32.0f) }, { &controls::Saturation, ControlInfo(0.0f, 32.0f) }, + { &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) }, }; } /* namespace libcamera */ diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 42c84b1..bc89ab5 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -47,6 +47,7 @@ #include "metadata.hpp" #include "noise_status.h" #include "sdn_status.h" +#include "sharpen_algorithm.hpp" #include "sharpen_status.h" namespace libcamera { @@ -633,6 +634,17 @@ void IPARPi::queueRequest(const ControlList &controls) break; } + case controls::SHARPNESS: { + RPi::SharpenAlgorithm *sharpen = dynamic_cast( + controller_.GetAlgorithm("sharpen")); + ASSERT(sharpen); + + sharpen->SetStrength(ctrl.second.get()); + libcameraMetadata_.set(controls::Sharpness, + ctrl.second.get()); + break; + } + default: LOG(IPARPI, Warning) << "Ctrl " << controls::controls.at(ctrl.first)->name()