From patchwork Sun Nov 30 01:18:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rui Wang X-Patchwork-Id: 25277 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 1A4FEC0F2A for ; Sun, 30 Nov 2025 01:18:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 15ECD60A9E; Sun, 30 Nov 2025 02:18:41 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="XClrjTGV"; 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 252546069A for ; Sun, 30 Nov 2025 02:18:39 +0100 (CET) Received: from rui-Precision-7560.local (unknown [209.216.103.65]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 839AA42B; Sun, 30 Nov 2025 02:16:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1764465387; bh=Gu/gL4+Ifmj3QaSxwEOXzftCdAvmTl8w8CamGRF65lE=; h=From:To:Cc:Subject:Date:From; b=XClrjTGVKZx8V3jVG/4PyCj0Aj+dRSdVuiiDB8AIWqqaML8m5tVBt6g35QLacglIx xruJjHOlBOYaTCWLYig2h9MLsu9q6vzqcZUTP6m2ct0L+X4/tlMv7OyoFnRJ/c/BYd 0I3sVKM9c32HGSlF2t4YDecynzLzEIg2fhmSvuVc= From: Rui Wang To: libcamera-devel@lists.libcamera.org Cc: Rui Wang Subject: [PATCH v2] media: rkisp1: Fix filter mode handling for sharpness and DNR 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 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" The filter mode register was not configured correctly during mode changes. When sharpness is enabled, the driver also enables the DNR mode, but the default mode value (0x4f2) has bit 0 cleared, which disables the filter module entirely. As a result, neither sharpness nor DNR are actually enabled after a NoiseReductionMode transition such as OFF → FAST. Additionally, the filter block is not retriggered when switching states. Signed-off-by: Rui Wang --- changelog : delete bit set for sharpness control from prepare() --- Makefile | 117 +++++++++++++++++++++++++++ src/ipa/rkisp1/algorithms/filter.cpp | 2 +- 2 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..ff4e6188 --- /dev/null +++ b/Makefile @@ -0,0 +1,117 @@ +# Support execution in a docker environment + +define run-in-docker + # CONTAINER=$1 + # COMMAND=$2 + # OPTIONS=$3 + docker run \ + -v "${PWD}":"${PWD}" \ + -w "${PWD}" \ + ${3} \ + --rm -i ${1} ${2} + + #--privileged=true \ + #--cap-add=SYS_PTRACE \ + #--security-opt seccomp=unconfined \ + #-v "${HOME}":"${HOME}" \ + #-v /var/run/docker.sock:/var/run/docker.sock \ + +endef + +define git-uk-bookworm-arm64-cross + $(call run-in-docker,git.uk.ideasonboard.com/camera/containers:debian-bookworm-cross-arm64,$1,$2) +endef + +define bookworm-arm64 + $(call run-in-docker,debian-bookworm-cross-arm64,$1,$2) +endef + +# Helper function to run clang-tidy with proper setup +# $1 = git command to list files +# $2 = output log file +define run-tidy + @echo "Running clang-tidy and saving to $(2)..." + @$(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) + @test -f $(2) && echo "Done. Output saved to $(2)" || echo "No files to check" + @test -f $(2) && python3 utils/log_to_html.py $(2) $(basename $(2)).html || true +endef + +BUILD=build/bookworm-arm64 +RESULTS_DIR=$(BUILD)/clang-tidy-results + +libcamera: $(BUILD)/build.ninja + $(call bookworm-arm64,ninja -C $(BUILD)) + +# /usr/share/meson/arm64-cross is provided by the debian-bookworm-cross-arm64 container +configure $(BUILD)/build.ninja: + $(call bookworm-arm64,meson setup $(BUILD) \ + $(RECONFIGURE) \ + --cross-file /usr/share/meson/arm64-cross \ + -Dprefix=/usr \ + -Dpycamera=enabled \ + -Ddocumentation=disabled \ + -Dlibdir=/lib/aarch64-linux-gnu \ + ) + +reconfigure: RECONFIGURE=--reconfigure +reconfigure: configure + +PYTHON_DIST=usr/lib/python3.11/dist-packages +PACKAGE_TGZ=libcamera-aarch64.tgz +.PHONY: package +package: + $(call bookworm-arm64,rm -rf $(BUILD)/install) + $(call bookworm-arm64,mkdir -p $(BUILD)/install) + $(call bookworm-arm64,ninja -C $(BUILD) install,--env DESTDIR=install) + $(call bookworm-arm64,mkdir -p $(BUILD)/install/$(PYTHON_DIST)) +# $(call bookworm-arm64,mv \ +# $(BUILD)/install/usr/lib/python3/dist-packages/libcamera \ +# $(BUILD)/install/$(PYTHON_DIST)) + tar -C $(BUILD)/install -czf $(PACKAGE_TGZ) ./ + +.PHONY: tmp_install +tmp_install: + $(call bookworm-arm64,rm -rf $(BUILD)/install) + $(call bookworm-arm64,mkdir -p $(BUILD)/install) + $(call bookworm-arm64,ninja -C $(BUILD) install,--env DESTDIR=install) + $(call bookworm-arm64,mkdir -p $(BUILD)/install/$(PYTHON_DIST)) + $(call bookworm-arm64,mv \ + $(BUILD)/install/usr/lib/python3/dist-packages/libcamera \ + $(BUILD)/install/$(PYTHON_DIST)) + +# Directly install on a target +kastor kakip debix-som debix-model-A: libcamera tmp_install + rsync --keep-dirlinks -rav --progress build/bookworm-arm64/install/ rui@192.168.31.73:~/libcamera-install/ + + +beehive: package + scp $(PACKAGE_TGZ) rui@192.168.31.73:~/python3-disp/ + ssh $@ -tC "cd / && sudo tar --keep-directory-symlink --no-same-owner -vxhf ~/python3-disp/$(PACKAGE_TGZ)" +rui: package + scp $(PACKAGE_TGZ) rui@192.168.31.73:/tmp/ + ssh rui@192.168.31.73 -tC "cd / && sudo tar --keep-directory-symlink --no-same-owner -vxhf /tmp/$(PACKAGE_TGZ)" + +.PHONY: tidy-diff +tidy-diff: + $(call run-tidy,git diff --name-only -- '*.c' '*.cpp' '*.cc' '*.h',$(RESULTS_DIR)/tidy-diff.log) + +.PHONY: tidy +tidy: + $(call run-tidy,git ls-files -- '*.c' '*.cpp' '*.cc' '*.h',$(RESULTS_DIR)/tidy.log) + +.PHONY: tidy-last-commit +tidy-last-commit: + $(call run-tidy,git diff --name-only HEAD~1 HEAD -- '*.c' '*.cpp' '*.cc' '*.h',$(RESULTS_DIR)/tidy-last-commit.log) + +.PHONY: tidy-branch +tidy-branch: + $(call run-tidy,git diff --name-only master...HEAD -- '*.c' '*.cpp' '*.cc' '*.h',$(RESULTS_DIR)/tidy-branch.log) + +.PHONY: tidy-staged +tidy-staged: + $(call run-tidy,git diff --name-only --cached -- '*.c' '*.cpp' '*.cc' '*.h',$(RESULTS_DIR)/tidy-staged.log) + +.PHONY: build-and-check-branch +build-and-check-branch: + git diff master...HEAD + diff --git a/src/ipa/rkisp1/algorithms/filter.cpp b/src/ipa/rkisp1/algorithms/filter.cpp index 8ad79801..dfa2b65a 100644 --- a/src/ipa/rkisp1/algorithms/filter.cpp +++ b/src/ipa/rkisp1/algorithms/filter.cpp @@ -37,7 +37,7 @@ namespace ipa::rkisp1::algorithms { LOG_DEFINE_CATEGORY(RkISP1Filter) static constexpr uint32_t kFiltLumWeightDefault = 0x00022040; -static constexpr uint32_t kFiltModeDefault = 0x000004f2; +static constexpr uint32_t kFiltModeDefault = 0x000004f3; /** * \copydoc libcamera::ipa::Algorithm::init