[v2] media: rkisp1: Fix filter mode handling for sharpness and DNR
diff mbox series

Message ID 20251130011823.2754645-1-rui.wang@ideasonboard.com
State New
Headers show
Series
  • [v2] media: rkisp1: Fix filter mode handling for sharpness and DNR
Related show

Commit Message

Rui Wang Nov. 30, 2025, 1:18 a.m. UTC
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 <rui.wang@ideasonboard.com>

---
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

Patch
diff mbox series

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