From patchwork Wed Dec 6 10:38:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 19285 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 26352C32BC for ; Wed, 6 Dec 2023 10:38:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AFC0E629E1; Wed, 6 Dec 2023 11:38:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1701859126; bh=VHu1D8QcGt3QTtWrGB09AuC+u5A4cHlLLdus5GFWFhc=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=V6xF+rQEvIFzAZvGli+/e5ttX6ShB3RrZTQWQc9jksyJ1p+sPMTKcfMpJeAsMVYgM n321AOVNx9OKujq0WrvcwhV+AJYKeM6JaNCwzwG4HMo9UQiwYdvzMqOL0uaqWrX77P UXoBPe9p44BBk3Gcl2QWnkXq58eUP4TmcAkx8wsKEGRW6S5vjrMpR/mu6+YlB65gCO dNE5GSKvzi9Wh5k+saho1wK7QoXWM/0Is/ZSB0FHw0NGB0180SBwGi9x4QqyyxZTAD puSodCmp89NLPSlkx+6Xzy2OpVu5pqptiwX+TuMDHmzbn81KAT0BAUXcLUe7kgo+NQ kz5fesKoqAByA== Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 50D2361D9D for ; Wed, 6 Dec 2023 11:38:44 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Z6bGHpfJ"; dkim-atps=neutral Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-33340c50af9so612263f8f.3 for ; Wed, 06 Dec 2023 02:38:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1701859123; x=1702463923; 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; bh=KfdxpVw/nqOtJSbSlLwQZUu9ot11A/cqlOXqcakgcC0=; b=Z6bGHpfJaXh5ND1jJu+4iHAbyOS/MigiwweKtTD/4H5RN7m49sfdVErmT37+iMeB2R 6IpjFaxOPFCn7HkOrkGU1TWCnvJMK5NHLJxAq34tWtGNvhVjYoWZ4fORD+W1c8OGiOdx T7KJ65FMgWVRo0OfGSuGDrLr3zLF9iAvo/0hk35oxjJXCyvi6aiCYUNIOs9q1Ixq5/ev pcBhqMH3WQV6DpIfV3Im66XwhDaI9Z4k04p21MGhjB6HDmwz/f3DfOB7OQQg2v24ATwt S0OcOa7srHaK24ntc2h1MOqC/4GqST68HjlDuhlnuIMEL/kq2JJTBvbKi++slD0FcAUJ vIoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701859123; x=1702463923; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KfdxpVw/nqOtJSbSlLwQZUu9ot11A/cqlOXqcakgcC0=; b=UoGEmZ0NNNu2K0uyQi2Gpqh3ojwmolt7DnzS/leJNrrsIWP945sUF5ac8t6Vc2ATIB 7I9ksHYHXwPft3CVtQQlmsAwsUn9aPEneuE/3DR+P6Wlgdsku7TsnlO5Nr1KT5V46U8Y BiKbJ6sDq5uYtELVDHXIMvHV07Ce3R1dGPz1LGoUs20Qjv/XcE3MAXTmKAIRZlnaSsYX PXgh8ypdKjtCTcyRwA+HlbjNKc7u+TMSMiHAIbOiNhauALWu7rpPutnQAiitBB5OppMg Ad3yizYNXr9QtwrbMWcku2HeNzgO09hitt9qn1Z6ymDGCZikGEkl40h9jpC4WTydBOLt rGlA== X-Gm-Message-State: AOJu0Ywxd0YU9NKF2fEjIGuYUq6OK55jUWCkyeJlnxomViZ9vpnI71bZ lfSx7HsdQEHgQ/uazwJZiMSqs+gfAoMtScwwKmU= X-Google-Smtp-Source: AGHT+IFDd1R6CByowznNthXLw1sqWQevBn76xueZKdHwnGytaTAddTFI3aXljUHSiMGgP9115RiluQ== X-Received: by 2002:adf:f652:0:b0:333:3cf1:baaa with SMTP id x18-20020adff652000000b003333cf1baaamr255662wrp.60.1701859123434; Wed, 06 Dec 2023 02:38:43 -0800 (PST) Received: from localhost.localdomain ([194.233.231.115]) by smtp.gmail.com with ESMTPSA id w7-20020a5d6087000000b0033340937da6sm9733697wrt.95.2023.12.06.02.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 02:38:43 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Wed, 6 Dec 2023 10:38:38 +0000 Message-Id: <20231206103839.16607-2-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231206103839.16607-1-david.plowman@raspberrypi.com> References: <20231206103839.16607-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/2] ipa: rpi: black_level: Add an initialValues method 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: , X-Patchwork-Original-From: David Plowman via libcamera-devel From: David Plowman Reply-To: David Plowman Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This allows the IPA to discover the correct black level values even before any frames have been processed. This is important on the PiSP platform where the front end black level blocks must be programmed in advance. Signed-off-by: David Plowman Reviewed-by: Naushir Patuck --- .../rpi/controller/black_level_algorithm.h | 23 +++++++++++++++++++ src/ipa/rpi/controller/rpi/black_level.cpp | 10 +++++++- src/ipa/rpi/controller/rpi/black_level.h | 6 +++-- 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 src/ipa/rpi/controller/black_level_algorithm.h diff --git a/src/ipa/rpi/controller/black_level_algorithm.h b/src/ipa/rpi/controller/black_level_algorithm.h new file mode 100644 index 00000000..c2cff2f5 --- /dev/null +++ b/src/ipa/rpi/controller/black_level_algorithm.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ +/* + * Copyright (C) 2023, Raspberry Pi Ltd + * + * black_level_algorithm.h - black level control algorithm interface + */ +#pragma once + +#include "algorithm.h" + +namespace RPiController { + +class BlackLevelAlgorithm : public Algorithm +{ +public: + BlackLevelAlgorithm(Controller *controller) + : Algorithm(controller) {} + /* A black level algorithm must provide the following: */ + virtual void initialValues(uint16_t &blackLevelR, uint16_t &blackLevelG, + uint16_t &blackLevelB) = 0; +}; + +} /* namespace RPiController */ diff --git a/src/ipa/rpi/controller/rpi/black_level.cpp b/src/ipa/rpi/controller/rpi/black_level.cpp index 85baec3f..2e3db51f 100644 --- a/src/ipa/rpi/controller/rpi/black_level.cpp +++ b/src/ipa/rpi/controller/rpi/black_level.cpp @@ -22,7 +22,7 @@ LOG_DEFINE_CATEGORY(RPiBlackLevel) #define NAME "rpi.black_level" BlackLevel::BlackLevel(Controller *controller) - : Algorithm(controller) + : BlackLevelAlgorithm(controller) { } @@ -45,6 +45,14 @@ int BlackLevel::read(const libcamera::YamlObject ¶ms) return 0; } +void BlackLevel::initialValues(uint16_t &blackLevelR, uint16_t &blackLevelG, + uint16_t &blackLevelB) +{ + blackLevelR = blackLevelR_; + blackLevelG = blackLevelG_; + blackLevelB = blackLevelB_; +} + void BlackLevel::prepare(Metadata *imageMetadata) { /* diff --git a/src/ipa/rpi/controller/rpi/black_level.h b/src/ipa/rpi/controller/rpi/black_level.h index 2403f7f7..d8c41c62 100644 --- a/src/ipa/rpi/controller/rpi/black_level.h +++ b/src/ipa/rpi/controller/rpi/black_level.h @@ -6,19 +6,21 @@ */ #pragma once -#include "../algorithm.h" +#include "../black_level_algorithm.h" #include "../black_level_status.h" /* This is our implementation of the "black level algorithm". */ namespace RPiController { -class BlackLevel : public Algorithm +class BlackLevel : public BlackLevelAlgorithm { public: BlackLevel(Controller *controller); char const *name() const override; int read(const libcamera::YamlObject ¶ms) override; + void initialValues(uint16_t &blackLevelR, uint16_t &blackLevelG, + uint16_t &blackLevelB) override; void prepare(Metadata *imageMetadata) override; private: