Patch Detail
Show a patch.
GET /api/1.1/patches/11066/?format=api
{ "id": 11066, "url": "https://patchwork.libcamera.org/api/1.1/patches/11066/?format=api", "web_url": "https://patchwork.libcamera.org/patch/11066/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20210129151154.1051163-7-naush@raspberrypi.com>", "date": "2021-01-29T15:11:54", "name": "[libcamera-devel,v5,6/6] ipa: raspberrypi: Handle control::NoiseReductionMode in the controller", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "7da1d4706bcc696ddb98467ce58f4fca8921d06f", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/11066/mbox/", "series": [ { "id": 1627, "url": "https://patchwork.libcamera.org/api/1.1/series/1627/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1627", "date": "2021-01-29T15:11:48", "name": "Raspberry Pi: Colour denoise", "version": 5, "mbox": "https://patchwork.libcamera.org/series/1627/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/11066/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/11066/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id BB325BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 29 Jan 2021 15:12:08 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8C191683C0;\n\tFri, 29 Jan 2021 16:12:08 +0100 (CET)", "from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n\t[IPv6:2a00:1450:4864:20::331])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D4637683B5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 Jan 2021 16:12:06 +0100 (CET)", "by mail-wm1-x331.google.com with SMTP id f16so7093987wmq.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 29 Jan 2021 07:12:06 -0800 (PST)", "from naushir-VirtualBox.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tf13sm6517461wmf.1.2021.01.29.07.12.05\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 29 Jan 2021 07:12:05 -0800 (PST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"rXa9LedQ\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=LmT4odllwsOAcspD1V4FNjd+YRe6YykQ2WFPVm9Zw2Y=;\n\tb=rXa9LedQ2IYmeIAbrEpK/MCTPh8oDLIqnWyXTFV/kCOsu3Qaa8WNHJmJvK2NeuEACc\n\t0D7XByR2/FCp/SXZAEduo4GC/uOavtLa4AMHcZsw19dZdpGMF5+8TUeiVeC6GPwpwxUu\n\txYjDfpUv/5Oy96gZ1zrSsVQZjMUGV5UL78IpdTz9BoS9xtfM3c1b+ZqIdxObH3a7VjOD\n\tIYpi+9+kGvN9OIb6o1sbTiASHc/9TgZ/r+nltwnmzOCOayftoFOuF1bR7qehWAgCgFbe\n\tUfmOHN2QT2IIFSqlN0gaJob87RDJCW4H3m9jTGfeWjhKMI8So4rKDe5tovP293Etz/wB\n\tpTAQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=LmT4odllwsOAcspD1V4FNjd+YRe6YykQ2WFPVm9Zw2Y=;\n\tb=Tw4lW+VCp1EzPWph3TEFnx92NF8QEIm0EIy+wT11CcTajuHWdIbqIEfd7wnvQ07KUc\n\trBlgw3BzGchpgccCgQi9Jmcb3kUaC/bESXMSFYf8gp3Lcn3x0CJEVniyK7x31rP9AA/Z\n\tKM5jFQDAG4/StQbBqLqMbX9RXjGTwhOcQm9vAfNoe2c9KeD+0NVNS2ZwjNuc6ihVL6St\n\tnDVPCVUb0E310CXrL/smAJVyjiDTqDKrAN0DYMdYsSkmJzAtC/OH3RFzyvMTaFLB6j/b\n\tgILr4dU/CqWnEFVqQO7HSYexWdPL36A2Cm37rx3xU/z0IU1eFGzPj2OC3977pNmAEgkR\n\t+u2g==", "X-Gm-Message-State": "AOAM530uWCbBOacGKzHvjcGKwqgTvDI4n6Qy9mnUdf6Vo8bOK/CPMgeQ\n\t8li/YChBOd2yuTHG6s5l/hr1k3Hld7mDgUKz", "X-Google-Smtp-Source": "ABdhPJyvAdQC1C7oF4PnFc4fj3r9hGZXDOC4oSlUupZCnVzeZO1Heg1EpyRKpYOaRBEqbW19fcqZxg==", "X-Received": "by 2002:a7b:c246:: with SMTP id b6mr4340791wmj.118.1611933126297;\n\tFri, 29 Jan 2021 07:12:06 -0800 (PST)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 29 Jan 2021 15:11:54 +0000", "Message-Id": "<20210129151154.1051163-7-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20210129151154.1051163-1-naush@raspberrypi.com>", "References": "<20210129151154.1051163-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v5 6/6] ipa: raspberrypi: Handle\n\tcontrol::NoiseReductionMode in the controller", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The application provided noise reduction mode gets passed into the\ndenoise controller. The denoise controller in turn returns the mode to\nthe IPA which now sets up the colour denoise processing appropriately.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/ipa/raspberrypi.h | 1 +\n src/ipa/raspberrypi/raspberrypi.cpp | 51 ++++++++++++++++++++++++++++-\n 2 files changed, 51 insertions(+), 1 deletion(-)", "diff": "diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\nindex 1de36039cee0..3be79fc5ed73 100644\n--- a/include/libcamera/ipa/raspberrypi.h\n+++ b/include/libcamera/ipa/raspberrypi.h\n@@ -66,6 +66,7 @@ static const ControlInfoMap Controls = {\n \t{ &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) },\n \t{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },\n \t{ &controls::FrameDurations, ControlInfo(1000, 1000000000) },\n+\t{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },\n };\n \n } /* namespace RPi */\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 220cf174aa4f..862c52bde082 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -43,6 +43,7 @@\n #include \"contrast_algorithm.hpp\"\n #include \"contrast_status.h\"\n #include \"controller.hpp\"\n+#include \"denoise_algorithm.hpp\"\n #include \"denoise_status.h\"\n #include \"dpc_status.h\"\n #include \"focus_status.h\"\n@@ -565,6 +566,7 @@ bool IPARPi::validateIspControls()\n \t\tV4L2_CID_USER_BCM2835_ISP_SHARPEN,\n \t\tV4L2_CID_USER_BCM2835_ISP_DPC,\n \t\tV4L2_CID_USER_BCM2835_ISP_LENS_SHADING,\n+\t\tV4L2_CID_USER_BCM2835_ISP_CDN,\n \t};\n \n \tfor (auto c : ctrls) {\n@@ -614,6 +616,14 @@ static const std::map<int32_t, std::string> AwbModeTable = {\n \t{ controls::AwbCustom, \"custom\" },\n };\n \n+static const std::map<int32_t, RPiController::DenoiseMode> DenoiseModeTable = {\n+\t{ controls::draft::NoiseReductionModeOff, RPiController::DenoiseMode::Off },\n+\t{ controls::draft::NoiseReductionModeFast, RPiController::DenoiseMode::ColourFast },\n+\t{ controls::draft::NoiseReductionModeHighQuality, RPiController::DenoiseMode::ColourHighQuality },\n+\t{ controls::draft::NoiseReductionModeMinimal, RPiController::DenoiseMode::ColourOff },\n+\t{ controls::draft::NoiseReductionModeZSL, RPiController::DenoiseMode::ColourHighQuality },\n+};\n+\n void IPARPi::queueRequest(const ControlList &controls)\n {\n \t/* Clear the return metadata buffer. */\n@@ -836,6 +846,23 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\t\tbreak;\n \t\t}\n \n+\t\tcase controls::NOISE_REDUCTION_MODE: {\n+\t\t\tRPiController::DenoiseAlgorithm *sdn = dynamic_cast<RPiController::DenoiseAlgorithm *>(\n+\t\t\t\tcontroller_.GetAlgorithm(\"SDN\"));\n+\t\t\tASSERT(sdn);\n+\n+\t\t\tint32_t idx = ctrl.second.get<int32_t>();\n+\t\t\tauto mode = DenoiseModeTable.find(idx);\n+\t\t\tif (mode != DenoiseModeTable.end()) {\n+\t\t\t\tsdn->SetMode(mode->second);\n+\t\t\t\tlibcameraMetadata_.set(controls::draft::NoiseReductionMode, idx);\n+\t\t\t} else {\n+\t\t\t\tLOG(IPARPI, Error) << \"Noise reduction mode \" << idx\n+\t\t\t\t\t\t << \" not recognised\";\n+\t\t\t}\n+\t\t\tbreak;\n+\t\t}\n+\n \t\tdefault:\n \t\t\tLOG(IPARPI, Warning)\n \t\t\t\t<< \"Ctrl \" << controls::controls.at(ctrl.first)->name()\n@@ -1085,18 +1112,40 @@ void IPARPi::applyGEQ(const struct GeqStatus *geqStatus, ControlList &ctrls)\n \n void IPARPi::applyDenoise(const struct DenoiseStatus *denoiseStatus, ControlList &ctrls)\n {\n+\tusing RPiController::DenoiseMode;\n+\n \tbcm2835_isp_denoise denoise;\n+\tDenoiseMode mode = static_cast<DenoiseMode>(denoiseStatus->mode);\n \n-\tdenoise.enabled = 1;\n+\tdenoise.enabled = mode != DenoiseMode::Off;\n \tdenoise.constant = denoiseStatus->noise_constant;\n \tdenoise.slope.num = 1000 * denoiseStatus->noise_slope;\n \tdenoise.slope.den = 1000;\n \tdenoise.strength.num = 1000 * denoiseStatus->strength;\n \tdenoise.strength.den = 1000;\n \n+\t/* Set the CDN mode to match the SDN operating mode. */\n+\tbcm2835_isp_cdn cdn;\n+\tswitch (mode) {\n+\tcase DenoiseMode::ColourFast:\n+\t\tcdn.enabled = 1;\n+\t\tcdn.mode = CDN_MODE_FAST;\n+\t\tbreak;\n+\tcase DenoiseMode::ColourHighQuality:\n+\t\tcdn.enabled = 1;\n+\t\tcdn.mode = CDN_MODE_HIGH_QUALITY;\n+\t\tbreak;\n+\tdefault:\n+\t\tcdn.enabled = 0;\n+\t}\n+\n \tControlValue c(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&denoise),\n \t\t\t\t\t sizeof(denoise) });\n \tctrls.set(V4L2_CID_USER_BCM2835_ISP_DENOISE, c);\n+\n+\tc = ControlValue(Span<const uint8_t>{ reinterpret_cast<uint8_t *>(&cdn),\n+\t\t\t\t\t sizeof(cdn) });\n+\tctrls.set(V4L2_CID_USER_BCM2835_ISP_CDN, c);\n }\n \n void IPARPi::applySharpen(const struct SharpenStatus *sharpenStatus, ControlList &ctrls)\n", "prefixes": [ "libcamera-devel", "v5", "6/6" ] }