{"id":24887,"url":"https://patchwork.libcamera.org/api/1.1/patches/24887/?format=json","web_url":"https://patchwork.libcamera.org/patch/24887/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20251028211751.2761420-17-rui.wang@ideasonboard.com>","date":"2025-10-28T21:17:50","name":"[v1,17/17] ipa: rkisp1: data: add IMX219 tuning for DPF","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"85e3fb9a28022e089cb4a64aedcd618dfd42cced","submitter":{"id":241,"url":"https://patchwork.libcamera.org/api/1.1/people/241/?format=json","name":"Rui Wang","email":"rui.wang@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24887/mbox/","series":[{"id":5542,"url":"https://patchwork.libcamera.org/api/1.1/series/5542/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5542","date":"2025-10-28T21:17:34","name":"[v1,01/17] ipa: rkisp1: algorithms: add Denoise base class shell","version":1,"mbox":"https://patchwork.libcamera.org/series/5542/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24887/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24887/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 B1061BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Oct 2025 21:19:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 682EA6086F;\n\tTue, 28 Oct 2025 22:19:13 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BB58860808\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Oct 2025 22:19:11 +0100 (CET)","from rui-Precision-7560.local (unknown [209.216.122.90])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6890A1122;\n\tTue, 28 Oct 2025 22:17:22 +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=\"U3T6sCWs\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761686243;\n\tbh=i7npOlrFIDZGueYrXOlERwCf1wHEChuJd7PRFw7TVyk=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=U3T6sCWsnYMChmESYOlP95q/OqICLnjUAyHacyRH2cQYNLRl3Vh+p+Ll8kqZwoyCV\n\tsBag1u5SXQ2G3oF/hRyh+mJ2JYkOw3d4pZizX4rq464zSjRqRQMQRfrlYns2miZP+W\n\t/JehBNbaeYoANCMpBPNFx8VqlMFY6SQ/N5tA3u9k=","From":"Rui Wang <rui.wang@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Rui Wang <rui.wang@ideasonboard.com>","Subject":"[PATCH v1 17/17] ipa: rkisp1: data: add IMX219 tuning for DPF","Date":"Tue, 28 Oct 2025 17:17:50 -0400","Message-ID":"<20251028211751.2761420-17-rui.wang@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20251028211751.2761420-1-rui.wang@ideasonboard.com>","References":"<20251028211751.2761420-1-rui.wang@ideasonboard.com>","MIME-Version":"1.0","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":"Add comprehensive tuning data for IMX219 camera sensor including:\n- AGC metering modes and exposure modes\n- AWB Bayesian algorithm with color gains\n- CCM (Color Correction Matrix) for different color temperatures\n- DPCC (Defect Pixel Cluster Correction) configuration\n- DPF (Denoise Pre-Filter) with ISO-adaptive tuning\n  * Domain filter spatial kernels per ISO band\n  * Noise level functions with linear scaling\n  * Filter strength adjustments (64-140 range)\n  * AWB+LSC gain mode configuration\n  * Tuning covers ISO ranges: 100, 200, 400, 800, 1600, 3200.\n\nSigned-off-by: Rui Wang <rui.wang@ideasonboard.com>\n---\n src/ipa/rkisp1/data/imx219.yaml | 289 ++++++++++++++++++++++++++++++++\n 1 file changed, 289 insertions(+)","diff":"diff --git a/src/ipa/rkisp1/data/imx219.yaml b/src/ipa/rkisp1/data/imx219.yaml\nindex 0d99cb52..d8ac0c78 100644\n--- a/src/ipa/rkisp1/data/imx219.yaml\n+++ b/src/ipa/rkisp1/data/imx219.yaml\n@@ -4,8 +4,114 @@\n version: 1\n algorithms:\n   - Agc:\n+      AeMeteringMode:\n+        MeteringCentreWeighted: [ 0, 0, 0, 0, 0, 0, 6, 8, 6, 0, 0, 8, 16, 8, 0, 0, 6, 8, 6, 0, 0, 0, 0, 0, 0 ]\n+        MeteringSpot: [ 0, 0, 0, 0, 0, 0, 2, 4, 2, 0, 0, 4, 16, 4, 0, 0, 2, 4, 2, 0, 0, 0, 0, 0, 0 ]\n+        MeteringMatrix: [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]\n+      AeExposureMode:\n+        ExposureNormal:\n+          exposureTime: [ 100, 10000, 15000, 30000, 60000, 120000 ]\n+          gain: [ 1.0, 1.0, 2.0, 6.0, 6.0, 6.0 ]\n+        ExposureShort:\n+          exposureTime: [ 100, 5000, 10000, 20000, 120000 ]\n+          gain: [ 4.0, 4.0, 6.0, 6.0, 6.0 ]\n+        ExposureCustom:\n+          exposureTime: [ 100, 10000, 30000, 60000, 120000 ]\n+          gain: [ 6.0, 6.0, 6.0, 6.0, 6.0 ]\n+      AeConstraintMode:\n+        ConstraintNormal:\n+          lower:\n+            qLo: 0.96\n+            qHi: 1.0\n+            yTarget: 0.5\n+        ConstraintHighlight:\n+          lower:\n+            qLo: 0.98\n+            qHi: 1.0\n+            yTarget: 0.5\n+          upper:\n+            qLo: 0.98\n+            qHi: 1.0\n+            yTarget: 0.8\n+      relativeLuminanceTarget: 0.38\n+  - Lux:\n+      referenceY: 0.1100404927222605\n+      referenceExposureTime: 10000\n+      referenceAnalogueGain: 1.0\n+      referenceDigitalGain: 1.0\n+      referenceLux: 1000\n   - Awb:\n+      algorithm: \"bayes\"\n+      AwbMode:\n+        AwbAuto:\n+          lo: 2500\n+          hi: 8000\n+        AwbIncandescent:\n+          lo: 2500\n+          hi: 3000\n+        AwbTungsten:\n+          lo: 3000\n+          hi: 3500\n+        AwbFluorescent:\n+          lo: 4000\n+          hi: 4700\n+        AwbIndoor:\n+          lo: 3000\n+          hi: 5000\n+        AwbDaylight:\n+          lo: 5500\n+          hi: 6500\n+        AwbCloudy:\n+          lo: 6500\n+          hi: 8000\n+      priors:\n+        - lux: 0\n+          ct: [ 2000, 13000 ]\n+          probability: [ 1.0, 1.0 ]\n+      colourGains:\n+        - ct: 2000\n+          gains: [ 0.7052683546089288, 3.3036009250082587 ]\n+        - ct: 3500\n+          gains: [ 1.168770453482936, 2.509410288582183 ]\n+        - ct: 5000\n+          gains: [ 1.4365752047119666, 1.9519812609798948 ]\n+        - ct: 6500\n+          gains: [ 1.5730690577316344, 1.7325017325017324 ]\n+        - ct: 8000\n+          gains: [ 1.7298045320878743, 1.527650473571647 ]\n+      transversePos: 0.01\n+      transverseNeg: 0.01\n   - BlackLevelCorrection:\n+  - Ccm:\n+      ccms:\n+        - ct: 2000\n+          ccm: [\n+                 2.33831, 0.05412, -1.39242, -1.07561, 2.69265, -0.61704, -1.06246, -4.54151,\n+                 6.60396,\n+               ]\n+        - ct: 3500\n+          ccm: [\n+                 1.94309, -0.61703, -0.32605, -0.63624, 1.98043, -0.34419, -0.06228, -1.70311,\n+                 2.76539,\n+               ]\n+        - ct: 5000\n+          ccm: [\n+                 1.89171, -0.69651, -0.19519, -0.52877, 1.88519, -0.35641, -0.01512, -1.20358,\n+                 2.21871,\n+               ]\n+        - ct: 6500\n+          ccm: [\n+                 1.85577, -0.70949, -0.14627, -0.47878, 1.87216, -0.39337, -0.01145, -1.02604,\n+                 2.03749,\n+               ]\n+        - ct: 8000\n+          ccm: [\n+                 1.85859, -0.72919, -0.12939, -0.46756, 1.84927, -0.38171, -0.02651, -0.83045,\n+                 1.85695,\n+               ]\n+  - ColorProcessing:\n+  - GammaOutCorrection:\n+      gamma: 2.2\n   - LensShadingCorrection:\n       x-size: [ 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625 ]\n       y-size: [ 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625, 0.0625 ]\n@@ -111,4 +217,187 @@ algorithms:\n                1438, 1226, 1059, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1025, 1054, 1185,\n                1326, 1334, 1334,\n              ]\n+  - DefectPixelClusterCorrection:\n+      # DPCC (Defect Pixel Cluster Correction) algorithm\n+      # fixed-set: true would force use of pre-defined (fixed) set; keep false for dynamic.\n+      fixed-set: false\n+      # Up to 3 sets may be defined. Provide at least one with conservative defaults.\n+      # These zero / low values act as a no-op baseline; tune per sensor after characterization.\n+      sets:\n+        - pg-factor:       # PG (Projection Gain) method factors\n+            green: 0       # Typical range 0..15\n+            red-blue: 0\n+          ro-limits:       # RO (Rank Order) limits\n+            green: 0       # Typical range 0..63\n+            red-blue: 0\n+          rg-factor:       # RG (Region Growth) factors\n+            green: 0       # Typical range 0..15\n+            red-blue: 0\n+          rnd-offsets:     # RND (Random) offsets\n+            green: 0       # Typical range 0..31\n+            red-blue: 0\n+          rnd-threshold:   # RND thresholds\n+            green: 0       # Typical range 0..1023\n+            red-blue: 0\n+          line-threshold:  # LC line thresholds\n+            green: 0       # Typical range 0..1023\n+            red-blue: 0\n+          line-mad-factor: # LC line mean absolute deviation factor\n+            green: 0       # Typical range 0..63\n+            red-blue: 0\n+  - Dpf:\n+      # Master toggle (optional). Set to false to disable DPF programming.\n+      enable: true\n+      # Developer mode toggle (optional). Set to false to hide advanced controls from clients.\n+      devmode: false\n+      # Tuning parameters for rkisp1 DPF (denoise)\n+      DomainFilter:\n+        # 9x9 kernel for green is always 6 coefficients\n+        g:  [ 18, 13,  9,  5,  3,  1 ]\n+        # RB: keep moderate width; IsoLevels override per ISO\n+        rb: [ 18, 15, 12,  8,  5,  2 ]\n+      NoiseLevelFunction:\n+        # Base NLL: mild increase vs previous to better classify low-level noise\n+        coeff: [\n+          0,  14,  28,  42,  58,  76,  96, 120,\n+          148, 180, 216, 256, 300, 348, 400, 456,\n+          520\n+        ]\n+        scale-mode: \"linear\"\n+      FilterStrength:\n+        # Base strength (was 72) -> 80 for stronger baseline denoise while preserving detail\n+        r: 80\n+        g: 80\n+        b: 80\n+      Gain:\n+        # Base gain settings - supports all 7 modes: 0=disabled, 1=NF, 2=LSC, 3=NF+LSC, 4=AWB, 5=AWB+LSC, 6=MAX\n+        gain_mode: 5  # AWB+LSC gains for optimal denoising with color correction\n+        nf_r_gain: 256\n+        nf_b_gain: 256\n+        nf_gr_gain: 256\n+        nf_gb_gain: 256\n+      IsoLevels:\n+        # ISO-banded tuning for 100/200/400/800/1600/3200 (placeholders; refine with measurements).\n+        - maxIso: 100\n+          DomainFilter:\n+            g:  [ 14, 10,  7,  4,  2,  1 ]\n+            rb: [ 14, 11,  8,  4,  2,  1 ]\n+          NoiseLevelFunction:\n+            coeff: [ 0, 10, 20, 30, 42, 56, 72, 90, 112, 138, 168, 200, 236, 276, 320, 368, 420 ]\n+            scale-mode: \"linear\"\n+          FilterStrength:\n+            r: 64\n+            g: 64\n+            b: 64\n+          Gain:\n+            gain_mode: 5  # AWB+LSC gains\n+            nf_r_gain: 256\n+            nf_b_gain: 256\n+            nf_gr_gain: 256\n+            nf_gb_gain: 256\n+        - maxIso: 200\n+          DomainFilter:\n+            g:  [ 15, 11,  8,  4,  2,  1 ]\n+            # Low ISO: conservative RB kernel to retain fine detail\n+            rb: [ 15, 12,  9,  5,  3,  1 ]\n+          NoiseLevelFunction:\n+            # Slightly steeper early ramp to suppress chroma speckle\n+            coeff: [\n+              0,  12,  24,  36,  50,  66,  84, 104,\n+              128, 154, 184, 216, 252, 292, 336, 384,\n+              440\n+            ]\n+            scale-mode: \"linear\"\n+          FilterStrength:\n+            # Low ISO strength (was 64) -> 72\n+            r: 72\n+            g: 72\n+            b: 72\n+          Gain:\n+            gain_mode: 5  # AWB+LSC gains\n+            nf_r_gain: 256\n+            nf_b_gain: 256\n+            nf_gr_gain: 256\n+            nf_gb_gain: 256\n+        - maxIso: 400\n+          DomainFilter:\n+            g:  [ 16, 12,  9,  5,  3,  1 ]\n+            rb: [ 16, 13, 10,  6,  4,  2 ]\n+          NoiseLevelFunction:\n+            coeff: [ 0, 16, 32, 48, 66, 86, 108, 132, 160, 192, 228, 268, 312, 360, 412, 468, 528 ]\n+            scale-mode: \"linear\"\n+          FilterStrength:\n+            r: 88\n+            g: 88\n+            b: 88\n+          Gain:\n+            gain_mode: 5  # AWB+LSC gains\n+            nf_r_gain: 256\n+            nf_b_gain: 256\n+            nf_gr_gain: 256\n+            nf_gb_gain: 256\n+        - maxIso: 800\n+          DomainFilter:\n+            g:  [ 18, 14, 10,  6,  3,  1 ]\n+            # Mid ISO: widen RB for stronger smoothing\n+            rb: [ 18, 16, 13,  9,  5,  3 ]\n+          NoiseLevelFunction:\n+            coeff: [\n+              0,  20,  40,  60,  82, 106, 132, 160,\n+              192, 228, 268, 312, 360, 412, 468, 528,\n+              592\n+            ]\n+            scale-mode: \"linear\"\n+          FilterStrength:\n+            # Mid ISO strength (was 88) -> 100\n+            r: 100\n+            g: 100\n+            b: 100\n+          Gain:\n+            gain_mode: 5  # AWB+LSC gains\n+            nf_r_gain: 256\n+            nf_b_gain: 256\n+            nf_gr_gain: 256\n+            nf_gb_gain: 256\n+        - maxIso: 1600\n+          DomainFilter:\n+            # Emulate 13x9-like smoothing for green (hardware green kernel size fixed; increase coeff magnitudes)\n+            g:  [ 22, 18, 13,  8,  5,  2 ]\n+            # High ISO: wider RB kernel for stronger spatial denoise\n+            rb: [ 20, 18, 16, 11,  7,  3 ]\n+          NoiseLevelFunction:\n+            coeff: [\n+              0,  26,  52,  78, 106, 138, 172, 208,\n+              248, 292, 340, 392, 448, 508, 572, 640,\n+              712\n+            ]\n+            scale-mode: \"linear\"\n+          FilterStrength:\n+            # High ISO strength (was 108) -> 120\n+            r: 120\n+            g: 120\n+            b: 120\n+          Gain:\n+            gain_mode: 5  # AWB+LSC gains\n+            nf_r_gain: 256\n+            nf_b_gain: 256\n+            nf_gr_gain: 256\n+            nf_gb_gain: 256\n+        - maxIso: 3200\n+          DomainFilter:\n+            g:  [ 26, 22, 16, 10,  6,  3 ]\n+            rb: [ 24, 22, 18, 12,  8,  4 ]\n+          NoiseLevelFunction:\n+            coeff: [ 0, 32, 64, 96, 130, 168, 210, 256, 306, 360, 418, 480, 546, 616, 690, 768, 850 ]\n+            scale-mode: \"linear\"\n+          FilterStrength:\n+            r: 140\n+            g: 140\n+            b: 140\n+          Gain:\n+            gain_mode: 5  # AWB+LSC gains\n+            nf_r_gain: 256\n+            nf_b_gain: 256\n+            nf_gr_gain: 256\n+            nf_gb_gain: 256\n ...\n","prefixes":["v1","17/17"]}