{"id":25277,"url":"https://patchwork.libcamera.org/api/patches/25277/?format=json","web_url":"https://patchwork.libcamera.org/patch/25277/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20251130011823.2754645-1-rui.wang@ideasonboard.com>","date":"2025-11-30T01:18:23","name":"[v2] media: rkisp1: Fix filter mode handling for sharpness and DNR","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ce8a751737f15081e18eedcce78434fce4e08dfd","submitter":{"id":241,"url":"https://patchwork.libcamera.org/api/people/241/?format=json","name":"Rui Wang","email":"rui.wang@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/25277/mbox/","series":[{"id":5622,"url":"https://patchwork.libcamera.org/api/series/5622/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5622","date":"2025-11-30T01:18:23","name":"[v2] media: rkisp1: Fix filter mode handling for sharpness and DNR","version":2,"mbox":"https://patchwork.libcamera.org/series/5622/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25277/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25277/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 1A4FEC0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 30 Nov 2025 01:18:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 15ECD60A9E;\n\tSun, 30 Nov 2025 02:18:41 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 252546069A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 30 Nov 2025 02:18:39 +0100 (CET)","from rui-Precision-7560.local (unknown [209.216.103.65])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 839AA42B;\n\tSun, 30 Nov 2025 02:16:26 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"XClrjTGV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1764465387;\n\tbh=Gu/gL4+Ifmj3QaSxwEOXzftCdAvmTl8w8CamGRF65lE=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=XClrjTGVKZx8V3jVG/4PyCj0Aj+dRSdVuiiDB8AIWqqaML8m5tVBt6g35QLacglIx\n\txruJjHOlBOYaTCWLYig2h9MLsu9q6vzqcZUTP6m2ct0L+X4/tlMv7OyoFnRJ/c/BYd\n\t0I3sVKM9c32HGSlF2t4YDecynzLzEIg2fhmSvuVc=","From":"Rui Wang <rui.wang@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Rui Wang <rui.wang@ideasonboard.com>","Subject":"[PATCH v2] media: rkisp1: Fix filter mode handling for sharpness and\n\tDNR","Date":"Sat, 29 Nov 2025 20:18:23 -0500","Message-ID":"<20251130011823.2754645-1-rui.wang@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"The filter mode register was not configured correctly during mode\nchanges. When sharpness is enabled, the driver also enables the DNR\nmode, but the default mode value (0x4f2) has bit 0 cleared, which\ndisables the filter module entirely.\n\nAs a result, neither sharpness nor DNR are actually enabled after a\nNoiseReductionMode transition such as OFF → FAST. Additionally, the\nfilter block is not retriggered when switching states.\n\nSigned-off-by: Rui Wang <rui.wang@ideasonboard.com>\n\n---\nchangelog : delete bit set for sharpness control from prepare()\n---\n Makefile                             | 117 +++++++++++++++++++++++++++\n src/ipa/rkisp1/algorithms/filter.cpp |   2 +-\n 2 files changed, 118 insertions(+), 1 deletion(-)\n create mode 100644 Makefile","diff":"diff --git a/Makefile b/Makefile\nnew file mode 100644\nindex 00000000..ff4e6188\n--- /dev/null\n+++ b/Makefile\n@@ -0,0 +1,117 @@\n+# Support execution in a docker environment\n+\n+define run-in-docker\n+\t# CONTAINER=$1\n+\t# COMMAND=$2\n+\t# OPTIONS=$3\n+\tdocker run \\\n+\t\t-v \"${PWD}\":\"${PWD}\" \\\n+\t\t-w \"${PWD}\" \\\n+\t\t${3} \\\n+\t\t--rm -i ${1} ${2}\n+\n+\t\t#--privileged=true \\\n+\t\t#--cap-add=SYS_PTRACE \\\n+\t\t#--security-opt seccomp=unconfined \\\n+\t\t#-v \"${HOME}\":\"${HOME}\" \\\n+\t\t#-v /var/run/docker.sock:/var/run/docker.sock \\\n+\n+endef\n+\n+define git-uk-bookworm-arm64-cross\n+\t$(call run-in-docker,git.uk.ideasonboard.com/camera/containers:debian-bookworm-cross-arm64,$1,$2)\n+endef\n+\n+define bookworm-arm64\n+\t$(call run-in-docker,debian-bookworm-cross-arm64,$1,$2)\n+endef\n+\n+# Helper function to run clang-tidy with proper setup\n+# $1 = git command to list files\n+# $2 = output log file\n+define run-tidy\n+\t@echo \"Running clang-tidy and saving to $(2)...\"\n+\t@$(call bookworm-arm64,sh -c \"mkdir -p $(RESULTS_DIR) && chmod 777 $(RESULTS_DIR) && ($(1) | xargs -r -I{} clang-tidy {} -p $(BUILD) || true)\") > $(2) 2>&1 || touch $(2)\n+\t@test -f $(2) && echo \"Done. Output saved to $(2)\" || echo \"No files to check\"\n+\t@test -f $(2) && python3 utils/log_to_html.py $(2) $(basename $(2)).html || true\n+endef\n+\n+BUILD=build/bookworm-arm64\n+RESULTS_DIR=$(BUILD)/clang-tidy-results\n+\n+libcamera: $(BUILD)/build.ninja\n+\t$(call bookworm-arm64,ninja -C $(BUILD))\n+\n+# /usr/share/meson/arm64-cross is provided by the debian-bookworm-cross-arm64 container\n+configure $(BUILD)/build.ninja:\n+\t$(call bookworm-arm64,meson setup $(BUILD) \\\n+\t\t$(RECONFIGURE) \\\n+\t\t--cross-file /usr/share/meson/arm64-cross \\\n+\t\t-Dprefix=/usr \\\n+\t\t-Dpycamera=enabled \\\n+\t\t-Ddocumentation=disabled \\\n+\t\t-Dlibdir=/lib/aarch64-linux-gnu \\\n+\t\t)\n+\n+reconfigure: RECONFIGURE=--reconfigure\n+reconfigure: configure\n+\n+PYTHON_DIST=usr/lib/python3.11/dist-packages\n+PACKAGE_TGZ=libcamera-aarch64.tgz\n+.PHONY: package\n+package:\n+\t$(call bookworm-arm64,rm -rf $(BUILD)/install)\n+\t$(call bookworm-arm64,mkdir -p $(BUILD)/install)\n+\t$(call bookworm-arm64,ninja -C $(BUILD) install,--env DESTDIR=install)\n+\t$(call bookworm-arm64,mkdir -p $(BUILD)/install/$(PYTHON_DIST))\n+# \t$(call bookworm-arm64,mv \\\n+# \t\t$(BUILD)/install/usr/lib/python3/dist-packages/libcamera \\\n+# \t\t$(BUILD)/install/$(PYTHON_DIST))\n+\ttar -C $(BUILD)/install -czf $(PACKAGE_TGZ) ./\n+\n+.PHONY: tmp_install\n+tmp_install:\n+\t$(call bookworm-arm64,rm -rf $(BUILD)/install)\n+\t$(call bookworm-arm64,mkdir -p $(BUILD)/install)\n+\t$(call bookworm-arm64,ninja -C $(BUILD) install,--env DESTDIR=install)\n+\t$(call bookworm-arm64,mkdir -p $(BUILD)/install/$(PYTHON_DIST))\n+\t$(call bookworm-arm64,mv \\\n+\t\t$(BUILD)/install/usr/lib/python3/dist-packages/libcamera \\\n+\t\t$(BUILD)/install/$(PYTHON_DIST))\n+\n+# Directly install on a target\n+kastor kakip debix-som debix-model-A: libcamera tmp_install\n+\trsync --keep-dirlinks -rav --progress build/bookworm-arm64/install/ rui@192.168.31.73:~/libcamera-install/\n+\n+\n+beehive: package\n+\tscp $(PACKAGE_TGZ) rui@192.168.31.73:~/python3-disp/\n+\tssh $@ -tC \"cd / && sudo tar --keep-directory-symlink --no-same-owner -vxhf ~/python3-disp/$(PACKAGE_TGZ)\"\n+rui: package\n+\tscp $(PACKAGE_TGZ) rui@192.168.31.73:/tmp/\n+\tssh rui@192.168.31.73 -tC \"cd / && sudo tar --keep-directory-symlink --no-same-owner -vxhf /tmp/$(PACKAGE_TGZ)\"\n+\n+.PHONY: tidy-diff\n+tidy-diff:\n+\t$(call run-tidy,git diff --name-only -- '*.c' '*.cpp' '*.cc' '*.h',$(RESULTS_DIR)/tidy-diff.log)\n+\n+.PHONY: tidy\n+tidy:\n+\t$(call run-tidy,git ls-files -- '*.c' '*.cpp' '*.cc' '*.h',$(RESULTS_DIR)/tidy.log)\n+\n+.PHONY: tidy-last-commit\n+tidy-last-commit:\n+\t$(call run-tidy,git diff --name-only HEAD~1 HEAD -- '*.c' '*.cpp' '*.cc' '*.h',$(RESULTS_DIR)/tidy-last-commit.log)\n+\n+.PHONY: tidy-branch\n+tidy-branch:\n+\t$(call run-tidy,git diff --name-only master...HEAD -- '*.c' '*.cpp' '*.cc' '*.h',$(RESULTS_DIR)/tidy-branch.log)\n+\n+.PHONY: tidy-staged\n+tidy-staged:\n+\t$(call run-tidy,git diff --name-only --cached -- '*.c' '*.cpp' '*.cc' '*.h',$(RESULTS_DIR)/tidy-staged.log)\n+\n+.PHONY: build-and-check-branch\n+build-and-check-branch:\n+\tgit diff master...HEAD\n+\ndiff --git a/src/ipa/rkisp1/algorithms/filter.cpp b/src/ipa/rkisp1/algorithms/filter.cpp\nindex 8ad79801..dfa2b65a 100644\n--- a/src/ipa/rkisp1/algorithms/filter.cpp\n+++ b/src/ipa/rkisp1/algorithms/filter.cpp\n@@ -37,7 +37,7 @@ namespace ipa::rkisp1::algorithms {\n LOG_DEFINE_CATEGORY(RkISP1Filter)\n \n static constexpr uint32_t kFiltLumWeightDefault = 0x00022040;\n-static constexpr uint32_t kFiltModeDefault = 0x000004f2;\n+static constexpr uint32_t kFiltModeDefault = 0x000004f3;\n \n /**\n  * \\copydoc libcamera::ipa::Algorithm::init\n","prefixes":["v2"]}