From patchwork Wed Sep 9 08:13:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "D. Manresa" X-Patchwork-Id: 28215 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 74B89C3272 for ; Wed, 9 Sep 2026 08:13:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 78D8068649; Wed, 9 Sep 2026 10:13:46 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="bN8dVHLs"; dkim-atps=neutral Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 39152685E3 for ; Wed, 9 Sep 2026 10:13:44 +0200 (CEST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-499ac87c92bso59014595e9.1 for ; Wed, 09 Sep 2026 01:13:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788941624; x=1789546424; darn=lists.libcamera.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=BWj7BZHpD6zsJxtHUqAxM/h1r+kvlHoQSUMaRfgSS1Y=; b=bN8dVHLsESaxpbyZNw2FA84/oHoPFDSPQdqeaG0QtrdRkXXoU9Qw3gg0bUmvS8mRtU M4coy1FO4p5sssHM7070S6iB2OXj72TWgzcTg66BOKDF7iGS7v6s6OB9JskWCuTktQyn V3FOgR3lyMwjxdZ26vfnr/Et0Mm1OfTJiKK1TujpUg/dSUSIuEK/NYOnCeiViDzGraSh quwiliBOsmh0RSYrmhGsrp9aeBnC/PhySUCptVTc41AWTyk0EXAaNRfvKK6NnSWBrEnr 7l3g774OBWcJ7kKziF327hC1MXJfBunOmBQPmjoMZWulixhyNNbS8+wM0RvyZE/UdOw6 d+aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788941624; x=1789546424; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=BWj7BZHpD6zsJxtHUqAxM/h1r+kvlHoQSUMaRfgSS1Y=; b=sF7e8jvE3f/grh77RJYB56pUGxmQZ2ChV6b6/9ThbKlaoTxIDpvr9IIrdYgxY3FjeK /sHVd9zTcdDzrCiWhgeyM9tHq1+3s77XvLnGtzbuwt8EVq1Xk6OD+xdNhVdZ47BN9bYJ eEB+51zKByILy5qrbBj2Agb7ZSS3oMLi6E1bhQhiYQg44YJHZdnIXeLGa5yQEWHGTZt5 IEEykC3A8pR5ZVR5Q6egT9g2RJG7jEPmIdQm90eyg6TUjoDFVfHNnTSI4qQxpdqJK4m7 yFC+s31IfI9Px2MUJZ+O/surxXGyEm6O/CUnD0zsQy/Y+X3fHPAxhr30nceLXDp+CujY 3Mqw== X-Gm-Message-State: AFuF++k3eftzyFYUKRAH9owxw4pUWf7rTHlNbIQqYnLOUcXQ0cXOOHpp hjgKXfmjg/yGMzroZ5h0zyLbSD8BVNBFpV6MrqK3DIprJlSRPIyd2qmMX1xH3f3Kgw== X-Gm-Gg: AYBFou2RoLSVueLyTd5FWXT1VZsEk4yCTEtoVZsDxhsmMy/vp8cZHUpkK2DZz+zBG07 GL/cR7tfAVgmjqv5j184nXw3sIltUvdvnPGK3bGyudNAvaGcljoRV9lqtk5pVcSviaGvG7VeWy0 fZ8fbnjM5eSvEakPX2z6/8ouPwbvZrX+jcKgYRzawT+Cd3ZknNayw1bWRpBy142pj+ipX60crce STc96ORb0x7P9oZC+lrQG1Fjiv9v5mzVwyx9P8xpwDw8luRzHwma/ZfUuw+AQV5m+22i4oyoWyv fdbufneyBWyDEmMFPrL+LcZNC05PZmQvfDYCbZxiaE0+loi6u2oyO90CbVbyFfSoofJx04FtdLV MZRgKyM33wFZNLt6A4pwtYiAl/pwQlyASipvsqJ0/DbXV3i7AsG86wDbqiw5uAdmRnupqUpnlhj H3kQuGQG/tLdXaX5e0gsj0ihKGT1KfR+tb6LDDHxrREIanUqg9hKfhl5+BzbvoY+3pXyGcZjhdz ldV/ypQEEYUC5GmnOWQ5/j0bPkPyU3dtRjEbaKNS2ez0pnae2KZNgDmwM8= X-Received: by 2002:a05:600c:a00d:b0:49c:cfbe:5a76 with SMTP id 5b1f17b1804b1-49cf81e4a05mr316789545e9.2.1788941623275; Wed, 09 Sep 2026 01:13:43 -0700 (PDT) Received: from latitude7275 (84.124.213.91.dyn.user.ono.com. [84.124.213.91]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49d04fe7f9dsm355283515e9.0.2026.09.09.01.13.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2026 01:13:42 -0700 (PDT) From: "D. Manresa" To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally , =?utf-8?q?Barnab=C3=A1s_P?= =?utf-8?b?xZFjemU=?= Subject: [PATCH v2 0/2] ipa: ipu3: Add Saturation and Sharpness algorithms Date: Wed, 9 Sep 2026 10:13:53 +0200 Message-ID: <20260909081355.28471-1-dmanresa@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909070146.18825-1-dmanresa@gmail.com> References: <20260909070146.18825-1-dmanresa@gmail.com> 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" These two algorithms expose the two ImgU blocks that currently run with the driver defaults and cannot be changed from libcamera: the Total Color Correction chroma gain (as controls::Saturation) and the IEFD sharpening (as controls::Sharpness). Both program the block with the ImgU driver defaults and scale them, so enabling them with the default value of 1.0 does not change the output; 0.0 gives greyscale / no sharpening. The series is based on Dan's "[PATCH v3 00/10] libipa: Re-work IPU3 IPA to use libipa algorithms" (patchwork series 6162), which introduces the IPAContext::ctrlMap the algorithms use to register their controls. Tested on a Dell Latitude 7275 (IPU3, OV5670); the v2 code gives the same results as v1 (chroma doubles from 1.0 to 2.0, sharpness metric 2.86 -> 4.10 from 1.0 to 9.0 on today's scene). Changes in v2 (thanks Barnabás): - Use float throughout instead of double. - Drop 'static' on the tables in the anonymous namespace. - Quantize with UQ<> from libipa/fixedpoint.h instead of lround/clamp (u12.0 gain, u4.5 unsharp amount, u1.6 direct sharpening weight, u13.0 overshoot limits). - Copy the TCC r_sqr table by struct assignment as the kernel does, and note that the TCC configuration up to the gain table replicates the kernel's imgu_css_cfg_acc(). - Write the IEFD defaults with designated initializers as in ipu3-tables.c. D. Manresa (2): ipa: ipu3: Add a Saturation algorithm ipa: ipu3: Add a Sharpness algorithm src/ipa/ipu3/algorithms/meson.build | 2 + src/ipa/ipu3/algorithms/saturation.cpp | 202 ++++++++++++++++++++++++ src/ipa/ipu3/algorithms/saturation.h | 43 ++++++ src/ipa/ipu3/algorithms/sharpness.cpp | 205 +++++++++++++++++++++++++ src/ipa/ipu3/algorithms/sharpness.h | 43 ++++++ src/ipa/ipu3/data/uncalibrated.yaml | 2 + src/ipa/ipu3/ipa_context.h | 18 +++ 7 files changed, 515 insertions(+) create mode 100644 src/ipa/ipu3/algorithms/saturation.cpp create mode 100644 src/ipa/ipu3/algorithms/saturation.h create mode 100644 src/ipa/ipu3/algorithms/sharpness.cpp create mode 100644 src/ipa/ipu3/algorithms/sharpness.h