From patchwork Thu Dec 11 14:25:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 25489 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 3A7C3C3257 for ; Thu, 11 Dec 2025 14:28:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8730A61604; Thu, 11 Dec 2025 15:28:32 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="kM+kO7qq"; dkim-atps=neutral Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 08E5D609D8 for ; Thu, 11 Dec 2025 15:28:30 +0100 (CET) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-47790b080e4so909875e9.3 for ; Thu, 11 Dec 2025 06:28:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1765463309; x=1766068109; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zzEO/jU62eEXeIAWdru8AgO4qN8JNfAd67RhdfVgyF0=; b=kM+kO7qqJajhuLRyxTAObU+6xXdxMfl4xiot5OZ9VKAvxQsmNkrMnB9BEJr/6kMHv0 TPfchSCZXXwcgP/n4brbsUXsxdEMBxXwVulnWTO/lK/G2gPQK2vbInXAdV2xOlQv4zjx 0H8DhOlJEKWW7YkmtoOhCOES2z11SsiJHx+cDRUy6OUJRpeFDMjmaeF8ir4XwenDhbZB rEGoA9WZeayLWWsMvAvjzUGC3aSQIFoqHm3CDSthiqM/iTj0Wn7iiYwLHfzgHJFc50a6 hq+tW3H59u8ZpL6xMgDsMSHWDRmonSRAPt7lgCvVkmZSdbeUvbVUWMxGel8wQDqs1Ax0 /A8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765463309; x=1766068109; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zzEO/jU62eEXeIAWdru8AgO4qN8JNfAd67RhdfVgyF0=; b=kfgGsloiQgdL72H3TE7EKq3NAJ/ShxSGXFlEEi69WcAZxPos8oFLEPVBhcfLX8rxqW 4LURPfXKpa6KCdABwr2ZdzPXCR/Nw7tkf3ubRGfcghBpj0yRPsrOF8NXJmf44p0NTIZF tkLTTLCUaMoiW0fbz+Lndx8jyI8GO71i1+AvpYCaChwGjK5yAWjB6SiKu8darZQiWqey AOGo3FjFgl9muCFe9cJK5YPZtjPFtb83aPfEhXFHtvKssugZvZ2LFPwyeD+93Z+5HgTL hKHTjSDg4Gyuy4CBaQh9wWKLtx0mI8ZiFnGtDiLmBJgeYjPwjk79xsAJawhPF7RhgMub ztTg== X-Gm-Message-State: AOJu0YyaMFcxICU3cTZqVzD+x21PZsTDbc6cx31z1KfoIyhv5uPzi3IE tr0ZuFAN9zfi6MmbCcdY1aU+vY1PxX/aoLRIUhwbLGtdRO7xJOsf0G/CgKj7REgNkN2jowfiktb Pfhb6 X-Gm-Gg: AY/fxX5Jj/p3vy1661PMi5h3j6PQATbO1TsJBI9imo5ceSba53psb5svEt8wEybPbbu JL7G5x4h2+YnaC2ahqGa6rfJxwb9I9yy5ZNrUxm9+5PuRxVzjTlhBpS8UTMFo/wepxA4p+BXOFS g51iERy4qysfXdcIV80LG0qJLEIxufUaaMgH5cWMYgvCSXS1D9iqkwxY1C0o+rqbHGIrFRUR+CU yZb90HrKtoGZmux+q/Ts7kCibqCVEOhONfNDtBJcMI07939o5X1YVhzQSza1Ws0VawIoOZayUZZ Wy6r+rQ3K1xGGMSepfK2n5Y/vnsIaxhkM9FMXBuhuZ4JkfL4uaX+YoKIAsiaV5urur7zS4Ej3qq Rsk0fa91C2Ubs6iLadq7tE8hKBBdzv0UvQ/gT2UMiMHeG0CQfvqMeOWG918BVvxKQrC3mB/ifWz lrvb2uT29LCVPZZdqB7Y2XwecwwwKcRKvH/cGUbZOo1dwmzgYTBPbA20i6EvM0JxHJ1m5WuX7ax aDln1pyhWJZ8TSrsnnOA14zGASQQg== X-Google-Smtp-Source: AGHT+IGkj+2S/znDDvxHsVisDJWD6WyXcQe0K9k3WN3KnH6IDUV3T1e/fARpRJE5NhJkCxn5HFv4uw== X-Received: by 2002:a05:600c:681b:b0:477:632a:fd67 with SMTP id 5b1f17b1804b1-47a838040e1mr68380325e9.12.1765463308547; Thu, 11 Dec 2025 06:28:28 -0800 (PST) Received: from davidp-pi5.pitowers.org ([2a00:1098:3142:1f:88ea:c658:5b20:5e46]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47a89da4756sm39999505e9.6.2025.12.11.06.28.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Dec 2025 06:28:27 -0800 (PST) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: David Plowman Subject: [PATCH v2 0/4] Raspberry Pi AWB using neural networks Date: Thu, 11 Dec 2025 14:25:56 +0000 Message-ID: <20251211142824.26635-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 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" Hi again Thanks for the various review comments, here's version 2 of the set. I think I've applied changes for all the comments that were made: * A few cosmetic things. * I've removed the .tflite neural network files from these commits. They'll come from our software repos. * I've added a meson option "rpi-awb-nn" to enable/disable the new algorithm explicitly. Default is auto, which builds it if libtensorflow-lite is available. * I went with an explicit "enabled" field in our algos as per Barnabas' suggestion, which can be set to false to disable them. The only other small change I made was to make the code fail if, for example, it tries to load and run two AWB algorithms at the same time. You just know someone will do this by mistake, and nothing good will come of it! Thanks again to everyone David Peter Bailey (4): ipa: rpi: controller: awb: Separate Bayesian AWB into AwbBayes ipa: rpi: controller: awb: Add Neural Network AWB ipa: rpi: controller: Ignore algorithms that are not enabled ipa: rpi: pisp: vc4: Update tuning files for new AWB meson_options.txt | 5 + src/ipa/rpi/controller/controller.cpp | 18 + src/ipa/rpi/controller/meson.build | 10 + src/ipa/rpi/controller/rpi/awb.cpp | 409 ++--------------- src/ipa/rpi/controller/rpi/awb.h | 99 ++-- src/ipa/rpi/controller/rpi/awb_bayes.cpp | 444 ++++++++++++++++++ src/ipa/rpi/controller/rpi/awb_nn.cpp | 446 +++++++++++++++++++ src/ipa/rpi/pisp/data/imx219.json | 67 ++- src/ipa/rpi/pisp/data/imx296.json | 66 ++- src/ipa/rpi/pisp/data/imx296_16mm.json | 66 ++- src/ipa/rpi/pisp/data/imx296_6mm.json | 66 ++- src/ipa/rpi/pisp/data/imx477.json | 65 +++ src/ipa/rpi/pisp/data/imx477_16mm.json | 67 ++- src/ipa/rpi/pisp/data/imx477_6mm.json | 67 ++- src/ipa/rpi/pisp/data/imx477_scientific.json | 81 +++- src/ipa/rpi/pisp/data/imx500.json | 69 +++ src/ipa/rpi/pisp/data/imx708.json | 66 ++- src/ipa/rpi/pisp/data/imx708_wide.json | 64 +++ src/ipa/rpi/pisp/data/ov5647.json | 65 +++ src/ipa/rpi/vc4/data/imx219.json | 66 +++ src/ipa/rpi/vc4/data/imx296.json | 66 +++ src/ipa/rpi/vc4/data/imx477.json | 71 +++ src/ipa/rpi/vc4/data/imx500.json | 69 +++ src/ipa/rpi/vc4/data/imx708.json | 74 +++ src/ipa/rpi/vc4/data/imx708_wide.json | 64 +++ src/ipa/rpi/vc4/data/ov5647.json | 66 +++ 26 files changed, 2288 insertions(+), 428 deletions(-) create mode 100644 src/ipa/rpi/controller/rpi/awb_bayes.cpp create mode 100644 src/ipa/rpi/controller/rpi/awb_nn.cpp