From patchwork Tue Sep 8 16:18:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Manresa" X-Patchwork-Id: 28207 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 568C9C3272 for ; Tue, 8 Sep 2026 16:18:01 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 864B268244; Tue, 8 Sep 2026 18:18:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="WEE1qm+H"; dkim-atps=neutral Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3AC3968244 for ; Tue, 8 Sep 2026 18:17:59 +0200 (CEST) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-49b392ccaacso71629085e9.2 for ; Tue, 08 Sep 2026 09:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788884278; x=1789489078; darn=lists.libcamera.org; h=content-transfer-encoding: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=Bl3SZ5hbhEA0CtRt2HDxkOIXspncgopzgnqtE4ul3+Y=; b=WEE1qm+HVMiyYsGXiiMvWVLAJYYVzs/b2u57vqAi9lGL6a3oJUtMaWp7EkwTa68bHH tLWo71CNFpYRRP6UbQvx2bTbzkoPVXFcCNnAIHRTLhr9AYRKwRENi7YEO9wtcm/mEvvM b99GOTlo+zYR5BoinX0wmeB+7JAzfLVWcSHVScTNt/MxZozqT6C6ODUa1vwJf9xnjenT Dd7O+NUZe9d6Le6sYMWZuJe1GvW82hcVvOqLIIYOqw1ZW8w7vI+UoeQpo4b8V4lo//Kc 4tbfr5kACKu7Hp5R6Qdcu8+Tr3Pzd+BzpmNkN+phGLhpg68raaH98kIIbN0zzPZsD8Ja xagg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788884278; x=1789489078; h=content-transfer-encoding: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=Bl3SZ5hbhEA0CtRt2HDxkOIXspncgopzgnqtE4ul3+Y=; b=MYdNzgVlkfSzcFLTmm1bUntvi8JjdJRzEHDn6/16Vi8Ng4OiOh2f/37F+OZ3NQtBiE l3j/KiftsxuCsJknrcSsg2JIn5Y4Q1PDP8tNoj2I2Ms0DtxcfUeY8C6fZNRJx54zut74 0s7crTPbvo+7D6ELh131DMOWsI/j1xik+b1d7tuMD7TqSGq6xx7GuwehoHtjXkoY6hIh SkH9PRSDByYFxS5Oa5X/lG2+ftbxn1C0+OX7rz/I+3bzxxS3eNlJr0VQ41kODq86sMc1 o8GoXGzzAVO6NyQ0FzeYhm6Ae5wK85roUXIi1XhHwSDDOkyn20CrB86mBayMb+pk+x/L WHbw== X-Gm-Message-State: AFuF++ktBYxJZ7TLTKKf7hkUa2S8U8pVkcJ0JCNypyTNfXZg4mnvbv95 pAN7ZCu71/JHzePGvMpZRQdQZUXlyru899MsztjgFxlkapZ/aOGBWJLmy3WZYlFesg== X-Gm-Gg: AYBFou0Fnp6iLxxoPNRncfrTth5xWnhRGGZ+wNAJIkvONv0doy040nN03vbc63sPyMw J10L7OYIbjVz7ihkrEvuCX+iIdlogMgdED3zw59zQLisnuDCARJqW7cADo9DZcSP3Nu36ouDild frWkz/E61ryhYVjKgBNyJ2kSEzb3oN2DPIL5kJEWBkptBzJ7QgvElPegiXMV8CXgENgrRzOznwA /S6oVE+/Qf7y6rlLHjstQbPI4UPHFTBYR46LQRGvT3vF3kCaY524xMXA6OJZE3UJzF+V10Psw2K bQdXSg0BW5wx5KBHL5QMZlxOp984SY4tO4NHNZvJBetnv6u3C8mM9KIyOzaZMWyUTvdsup/Ohz3 ZrzPGyU01OIBrD/5YvED7B4h0MxDx/NmZO4hg85QhVaXkURblssmm5/Mg//IJ55t8e7DGmp7UiI TLkdMlTT5tE6VQwyCEgq2FAy8oHu+r5qBOlKsDbxRt1HpvpFycek38uCbwc5ip3gXDTl834CNTS Lg9dmSlYt4PrH1lU41UjUxni850J6/LMfwSCgLQxuu+wwm5BQ== X-Received: by 2002:a05:600c:4e89:b0:49c:fa21:1c81 with SMTP id 5b1f17b1804b1-49cfa211d6bmr265714665e9.22.1788884278493; Tue, 08 Sep 2026 09:17:58 -0700 (PDT) Received: from latitude7275 (84.124.213.91.dyn.user.ono.com. [84.124.213.91]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-485885b7bfasm37789795f8f.29.2026.09.08.09.17.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2026 09:17:58 -0700 (PDT) From: "D. Manresa" To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally Subject: [PATCH v2] ipa: ipu3: agc: Fix swapped green and blue gains in luminance estimate Date: Tue, 8 Sep 2026 18:18:05 +0200 Message-ID: <20260908161805.335568-1-dmanresa@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904062840.46739-2-dmanresa@gmail.com> References: <20260904062840.46739-2-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" The AWB gains passed to the AGC traits are built as { red, blue, green }, but the RGB vector expects { red, green, blue }. The luminance estimate therefore weights the blue statistics with the green gain and the green statistics with the blue gain, which biases the exposure whenever the two gains differ (on an OV5670 they are 1.0 and ~1.8). Pass the gains in RGB order. Signed-off-by: D. Manresa Reviewed-by: Daniel Scally --- Changes in v2: - Rebase on current master (the bug is still present after the AgcAlgorithm port). - Add Dan's Reviewed-by. src/ipa/ipu3/algorithms/agc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipa/ipu3/algorithms/agc.cpp b/src/ipa/ipu3/algorithms/agc.cpp index 57cfb32..dd4f1ab 100644 --- a/src/ipa/ipu3/algorithms/agc.cpp +++ b/src/ipa/ipu3/algorithms/agc.cpp @@ -224,8 +224,8 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, rgbTriples_, {{ context.activeState.awb.gains.red, - context.activeState.awb.gains.blue, context.activeState.awb.gains.green, + context.activeState.awb.gains.blue, }}, bdsGrid_, },