From patchwork Wed Jul 20 15:42:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Sylvestre X-Patchwork-Id: 16706 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 54D19BD1F1 for ; Wed, 20 Jul 2022 15:42:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0EFEB63318; Wed, 20 Jul 2022 17:42:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1658331754; bh=QXWBpXyd0SowZcrnrw816J37WkH0rmmWPGgP0X8vZJs=; 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=mg+Ay0RMvSVMbKP1vSRJH9//POT0m4LVF1sz7MNXwIPWNEBQVZ3n0aMQHomf2dSGw WK4vPeYacr2FTmFUpMUq73DwW1a1aUFdr0v9991bQE8fqmlkL+gMgtxmeVW4eX2UEF lEWM7aQoAZoFX92l80ni87II0uqAQuDiAbVK/C/xVpe4p0K5RiYWF3DZm3p4YBZN1y iTH+7XMXU2+P7wXJMhzYnLLqfOIzFRWHIzyRAk4qX65A9d7EleTM6gyXHeLBwpRcSi kRqEuwontI43MIczDr+sAFyRfu56hm9tx4TLGlpf1oPNuw2JSqpLNmQjjxjqACFgeT HZXSPHdgkpdBw== Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7BFCE6330D for ; Wed, 20 Jul 2022 17:42:32 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="hq7BA65H"; dkim-atps=neutral Received: by mail-wr1-x42b.google.com with SMTP id z13so7118498wro.13 for ; Wed, 20 Jul 2022 08:42:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W1TeYFQ7GLWFHVHmgPIyyLYNxD2xypTxkXFayFTwW0U=; b=hq7BA65H//O26TS1rf6V3SZYnbkc6NY+JiDBrvbUHqL7OqvzVJ0PlabXz14+I3zkj7 K+uVcNRJapfG/WVlv3ThleKlwcA8MJu93/A/8g6MRbl53kpQoTRfEHrCoXWgOzaRbHk5 Ch+wwhvNEwkx6NflfK6e8XqC8gPAO4ESLCjMN08F5SBJhl1SbSEoB3/yS+ui9PVzOXrX XFlTnJOxEqoDl9YJ1rGod0eKXxuMixT/tQCuJS/gcNpB78CgBvK5jsOnKnC4/CRxg7Ab zwkITcZS9rbrWc8gyjhvnJDnkQLVDmzyglKXnKaizWlfpPtqskaW7OlgfpjK97tRzOJW 3eeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W1TeYFQ7GLWFHVHmgPIyyLYNxD2xypTxkXFayFTwW0U=; b=eaOLLN4a0CvBsGrxZ3PsePX78Y+z92BfeoHCxjD8GVvyF6Ulx/c7cmu4jjOUbEyoCH o+pChWVvVYPmkSoRu8PO4/qSZGmCjr6v8G/zDg7pV5eFGPyE49rMqbBI45QQ0ZEFBIAU QVePECkpjktauvIMNw6pdaM3oGqZU5+SXY52wKXcCtA+oAjfdJYQxMze+yauRIUoaum4 rp2Pl01+MqYg9Mzc+sEFBhdUqPoQMfP0qUDA62GI2yxwC4TynauopNr6Bbmv5PLmZUda QXWNeaph0YIH5KOq6B8QnSk29c3f4eFEL1Sv3fpAZ4GIHgU/jR2DNgGZbVnWy92IChPI uT+Q== X-Gm-Message-State: AJIora8zOK8l21jOcMGybF0tOP2wU+I8Cmwck1wdJv3kJjWvGI5U4Ibk eZ02yvWfsbl1FPqPI5GsrUOVUGj1ly5c5Ij4 X-Google-Smtp-Source: AGRyM1t99KD9VjY3urxiUxo6BorNK2G+v79rVEci6GROkpcxFtNWAdEbO6owIpDONO1iROqTHUIitA== X-Received: by 2002:adf:fcc6:0:b0:21d:8093:1b5c with SMTP id f6-20020adffcc6000000b0021d80931b5cmr30550606wrs.41.1658331751910; Wed, 20 Jul 2022 08:42:31 -0700 (PDT) Received: from BL087.. ([2a01:e34:eea9:e630:516d:f303:6345:b768]) by smtp.gmail.com with ESMTPSA id d2-20020adffbc2000000b0021e489ec78bsm2159294wrs.21.2022.07.20.08.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 08:42:31 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 20 Jul 2022 17:42:18 +0200 Message-Id: <20220720154221.50937-2-fsylvestre@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220720154221.50937-1-fsylvestre@baylibre.com> References: <20220720154221.50937-1-fsylvestre@baylibre.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/4] ipa: libipa: algorithm: Add queueRequest() to the Algorithm class 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: Florian Sylvestre via libcamera-devel From: Florian Sylvestre Reply-To: Florian Sylvestre Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add queueRequest() function to the Algorithm class. The queueRequest() function provides controls values coming from the application to each algorithm. Each algorithm is responsible for retrieving the controls associated to them. Signed-off-by: Florian Sylvestre Reviewed-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/ipa/libipa/algorithm.cpp | 16 ++++++++++++++++ src/ipa/libipa/algorithm.h | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp index 8549fe3f..38200e57 100644 --- a/src/ipa/libipa/algorithm.cpp +++ b/src/ipa/libipa/algorithm.cpp @@ -81,6 +81,22 @@ namespace ipa { * includes setting fields and flags that enable those processing blocks. */ +/** + * \fn Algorithm::queueRequest() + * \brief Provide control values to the algorithm + * \param[in] context The shared IPA context + * \param[in] frame The frame number to apply the control values + * \param[in] controls The list of user controls + * + * This function is called for each request queued to the camera. It provides + * the controls stored in the request to the algorithm. The \a frame number + * is the Request sequence number and identifies the desired corresponding + * frame to target for the controls to take effect. + * + * Algorithms shall read the applicable controls and store their value for later + * use during frame processing. + */ + /** * \fn Algorithm::process() * \brief Process ISP statistics, and run algorithm operations diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h index 2a8871d8..ccc659a6 100644 --- a/src/ipa/libipa/algorithm.h +++ b/src/ipa/libipa/algorithm.h @@ -9,6 +9,8 @@ #include #include +#include + namespace libcamera { class YamlObject; @@ -40,6 +42,12 @@ public: { } + virtual void queueRequest([[maybe_unused]] typename Module::Context &context, + [[maybe_unused]] const uint32_t frame, + [[maybe_unused]] const ControlList &controls) + { + } + virtual void process([[maybe_unused]] typename Module::Context &context, [[maybe_unused]] typename Module::FrameContext *frameContext, [[maybe_unused]] const typename Module::Stats *stats) From patchwork Wed Jul 20 15:42:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Sylvestre X-Patchwork-Id: 16707 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 5743ABD1F1 for ; Wed, 20 Jul 2022 15:42:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9ABE66331B; Wed, 20 Jul 2022 17:42:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1658331754; bh=B4CInFeCJuK8l1NH3IN6ut1ImmTBaZzVpmuGaDPXV+A=; 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=oo2HfmhLvr2LQrXjE6ZSRDx36koIEhza4mGn9XsBJKifte7nnTXpyMYWzL8UrfdkK GOcPwKIKlheGaumeuDKsz76c7NAxVl1NRJ5ugkW/Y0ManmNAH4ehjN13E07f3e+UE0 3srJ97fN743p1Ea9jl/O2f3Rfpna+MGJIVFsP1ZVArxN6STK66DeRJwfDEPS7ogey2 RrHYVNhjmECOThEqSzaIm0P4tPA8RTtyh5MYnM6oygzDzPkPZEtqdNvvQvOoaSFMDA Cu5IYr1hjY9k1Ogec6yNIEJIRifZbBncH0znqJMYiM8Or/4tocfuhXm/vFnls3sDbG KTdg8el5/5Rkw== Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 45A566330D for ; Wed, 20 Jul 2022 17:42:33 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="equXuNgl"; dkim-atps=neutral Received: by mail-wr1-x429.google.com with SMTP id d8so6726037wrp.6 for ; Wed, 20 Jul 2022 08:42:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gA0iT8RDrNPKRg5o5iqBwPGdGx6XlOTQhR6ridrzt+c=; b=equXuNgllxqRRxQZxEAQPa9bvm0XUpoIxxm/6zJjkxQcIH9ZERcGhXZ/n5hQzBDZfG GkLnmLaLtP85pXN8d2r25uAQcs4/ho2oUscPd3WWqJ9pSC6hXVwwIUXrUsrHuu38s6b5 NR0plh/+0+zrp6ZAfCJAuOAEe6GF3g1R7BmUXsjmu3PNsFi9sy6Q7ZlOWFXiRg6FGhLx g3JUiiSg1SKX9Al8mlYaY7K2eAG28NLpCtG4alsD6nzt2lVM44QhD2nWOOacpQT/vHsU kHQuUDFXus7Eewqa/jXfhrFpy0skWoZ3G1YJoUO6xQ6sWhsJpd0EE1cFrQ34asLbgVwB Un5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gA0iT8RDrNPKRg5o5iqBwPGdGx6XlOTQhR6ridrzt+c=; b=ZwjUsTo8hqKT1JnRh62EJHl++IyUaSFiMJn3KUZkp6F0Br2LD2GrbSmHxouydILtmj A2CsusgMdz7t2pk1lLi6a8/iqTmrj9D6NS+49SsQM7mPrUJk4kUJy2le3GRGCXXY/ZEL lkymqK0Xj94VqJ31AD5m7Mm7JWsCYp5RAhRBi01gVH8I3R+tO05nyE4e+IzkqF/N7lJm uONgGImAJpmUGyQkLRKYEXj916TgZptXWt4++FI5bqlw2cmnpqv8RhlJRyzaxACWZrA4 u6c2vZdQQtkhufznu7DJ2ihf7bUfKOIlzHLK6OOu4kuVnVMB3ljacth/0bPlI+Gbj0wb AZUA== X-Gm-Message-State: AJIora9hdy0cKiv/dTtU9BnPwmXgXEAvWUdf/aGVOYga6HmvM/y4fviA j4vuaU2mur/N0fCTILYRZfUa8iK/n/oZz/eb X-Google-Smtp-Source: AGRyM1svr4oRkUZ+8LqKgrFPnL6rchrw9jCYGjjGotuB2Po3NWnt3p9N82hQRCrd3rO1ONiG1rZJdw== X-Received: by 2002:a05:6000:15c3:b0:21d:9f5a:df83 with SMTP id y3-20020a05600015c300b0021d9f5adf83mr31782430wry.360.1658331752680; Wed, 20 Jul 2022 08:42:32 -0700 (PDT) Received: from BL087.. ([2a01:e34:eea9:e630:516d:f303:6345:b768]) by smtp.gmail.com with ESMTPSA id d2-20020adffbc2000000b0021e489ec78bsm2159294wrs.21.2022.07.20.08.42.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 08:42:32 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 20 Jul 2022 17:42:19 +0200 Message-Id: <20220720154221.50937-3-fsylvestre@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220720154221.50937-1-fsylvestre@baylibre.com> References: <20220720154221.50937-1-fsylvestre@baylibre.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/4] ipa: rkisp1: Transfer queueRequest() call to each algorithm 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: Florian Sylvestre via libcamera-devel From: Florian Sylvestre Reply-To: Florian Sylvestre Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Implement rkisp1 queueRequest() function to update each algorithm with user controls. Signed-off-by: Florian Sylvestre Reviewed-by: Laurent Pinchart Reviewed-by: Paul Elder Reviewed-by: Kieran Bingham --- src/ipa/rkisp1/rkisp1.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index a32bb9d1..34034526 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -269,10 +269,10 @@ void IPARkISP1::unmapBuffers(const std::vector &ids) } } -void IPARkISP1::queueRequest([[maybe_unused]] const uint32_t frame, - [[maybe_unused]] const ControlList &controls) +void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls) { - /* \todo Start processing for 'frame' based on 'controls'. */ + for (auto const &algo : algorithms()) + algo->queueRequest(context_, frame, controls); } void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) From patchwork Wed Jul 20 15:42:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Sylvestre X-Patchwork-Id: 16708 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 6E163BD1F1 for ; Wed, 20 Jul 2022 15:42:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 295BA6331E; Wed, 20 Jul 2022 17:42:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1658331757; bh=N6m86BYNr3brvqxQw+DsuRHS9vY8zBPseaNyrwh0rDI=; 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=LeM7gN6OETFkizADm7cg7U+jGU3xwV6VHpsfpktBMFkhUIi5nriJ6Fanvv2IdMRgh XWG5UA9Eu7XLP/nz+cEdba7jgvnDcPoCVbXBkA0RXUBmYZIlNRloB+/2hMTLDdt7xC Gw8VfijvuHveYJvWqBRw10B0wk316C6nQ0KNOOInoswlVGy1IpBAFfn4Jo4gY9L963 x7QdJXvt1O+On/k1ifu3wFYkTZo1HFtUory8gD5d0YhnlfN4Lx1a3ylBOGvyorMiEC QQHW9igWorBFEu/pdLVxWR9XYUP+pIGzfiX4joAOLE9FL3jtK9Xt7gSkHmCDi3NwfP Xj2V6wGm4A+SQ== 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 5B23E6331A for ; Wed, 20 Jul 2022 17:42:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="2v2QEDqo"; dkim-atps=neutral Received: by mail-wm1-x335.google.com with SMTP id h14-20020a1ccc0e000000b0039eff745c53so1523355wmb.5 for ; Wed, 20 Jul 2022 08:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cuvyk6OqGESFgQnoygLrvmtHcgBgxWfAz3NtCXSLi5M=; b=2v2QEDqovw3EWg5hoZ/UKx55Db4dcvTAE0JCfDeOdA/uLl7XvSrOIjurlT5YS02aih +5F9JAOvnb0AGLDCGYHiGHSz02zol/c42BnCU0a0ROFOx0smQXKXKXYYcBMcAAhr3Coe 2b2h6b8/j2OApXsAQ0heqOr8jZLC43DF6qCdP1VMpp+F/XPabDA0NJphuLVceX+rfUIy zAmZDse2nK2qJfH3SAcTKiMo2irYvc8/cSDhayvruKzQVK0HO6h/7hamwe1ynAFQsaWH abrDW/VbknnBvCCQn0My4tGDj0yPLZurB9yo1k1RbvNDB/sEZC1nbcW0CuTOvQHr1OVo SvjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cuvyk6OqGESFgQnoygLrvmtHcgBgxWfAz3NtCXSLi5M=; b=EqaYpOWk1TmkIJY+eUB5VcbMk12G98ZOEj0IU1A3+hBw1Ter0fKM/u7YWPq/sKAAMl aaBcbT5DVQrMRAmTZtYFIVBWa4o4+mBjiDN+PuVtHQ6CoYhz4Jk+QVIVbWYtbKcrZQ0c OS4p8q74ppv40iZHAonb5O43YaXgbg6FxB77q37afLPEI0LRZRQpxGdiem71wgPYmazn Jy1G11vykSq+jTrRyy2D17aeTvuLUSFkfEzqv46Up+qo03tOOToEj4AiByPLigzvEZKc /J8yWJf4LRxenar8hdP6Zzp5zAsSLidzIqZGP3MPd/kDoNUXInM7dH2JnXiW6Bv2BnoV ziMw== X-Gm-Message-State: AJIora/UoiFI4uj/Y7a1WHQ8TDnRbVRfbfFbLiUpe7YqBleaiIbslud4 a67+TYynSkA4eOSggvoBm3I5twNS1kP1pUp1 X-Google-Smtp-Source: AGRyM1v78lIsbkP/XfqlfhJGvpAjtDmbx9uiWq6QP+7z+9ADY31nb+utLCyQd0i7RO2Rx3zTBX8A5w== X-Received: by 2002:a05:600c:4e88:b0:3a3:1bdc:cb72 with SMTP id f8-20020a05600c4e8800b003a31bdccb72mr4502989wmq.59.1658331753459; Wed, 20 Jul 2022 08:42:33 -0700 (PDT) Received: from BL087.. ([2a01:e34:eea9:e630:516d:f303:6345:b768]) by smtp.gmail.com with ESMTPSA id d2-20020adffbc2000000b0021e489ec78bsm2159294wrs.21.2022.07.20.08.42.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 08:42:33 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 20 Jul 2022 17:42:20 +0200 Message-Id: <20220720154221.50937-4-fsylvestre@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220720154221.50937-1-fsylvestre@baylibre.com> References: <20220720154221.50937-1-fsylvestre@baylibre.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/4] ipa: rkisp1: Add support of Demosaicing control 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: Florian Sylvestre via libcamera-devel From: Florian Sylvestre Reply-To: Florian Sylvestre Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" During the demosaicing step, rkisp1 ISP is processing denoising and sharpness control. Add demosaicing algorithm with denoise and sharpness values based on user controls. Signed-off-by: Florian Sylvestre --- src/ipa/rkisp1/algorithms/demosaicing.cpp | 197 ++++++++++++++++++++++ src/ipa/rkisp1/algorithms/demosaicing.h | 30 ++++ src/ipa/rkisp1/algorithms/meson.build | 1 + src/ipa/rkisp1/data/ov5640.yaml | 1 + src/ipa/rkisp1/ipa_context.h | 6 + src/ipa/rkisp1/rkisp1.cpp | 1 + src/libcamera/pipeline/rkisp1/rkisp1.cpp | 8 + 7 files changed, 244 insertions(+) create mode 100644 src/ipa/rkisp1/algorithms/demosaicing.cpp create mode 100644 src/ipa/rkisp1/algorithms/demosaicing.h diff --git a/src/ipa/rkisp1/algorithms/demosaicing.cpp b/src/ipa/rkisp1/algorithms/demosaicing.cpp new file mode 100644 index 00000000..7d55eaab --- /dev/null +++ b/src/ipa/rkisp1/algorithms/demosaicing.cpp @@ -0,0 +1,197 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021-2022, Ideas On Board + * + * demosaicing.cpp - RkISP1 Demosaicing control + */ + +#include "demosaicing.h" + +#include + +#include + +#include "libcamera/internal/yaml_parser.h" + +/** + * \file demosaicing.h + */ + +static constexpr uint32_t kFiltLumWeightDefault = 0x00022040; +static constexpr uint32_t kFiltModeDefault = 0x000004f2; + +namespace libcamera { + +namespace ipa::rkisp1::algorithms { + +/** + * \class Demosaicing + * \brief RkISP1 Demosaicing control + * + * The Demosaicing algorithm is responsible for reconstructing a full color + * image from the sensor raw data. During the demosaicing step, The RKISP1 + * will additionally process denoise and sharpness controls. + * + * /todo In current version the denoise and sharpness control is based on user + * controls. In a future version it should be controlled automatically by the + * algorithm. + */ + +LOG_DEFINE_CATEGORY(RkISP1Demosaicing) + +/** + * \copydoc libcamera::ipa::Algorithm::queueRequest + */ +void Demosaicing::queueRequest([[maybe_unused]] IPAContext &context, + [[maybe_unused]] const uint32_t frame, + const ControlList &controls) +{ + const auto &sharpness = controls.get(controls::Sharpness); + if (sharpness) { + context.frameContext.demosaicing.sharpness = std::clamp(int(*sharpness), 0, 10); + context.frameContext.demosaicing.updateParams = true; + + LOG(RkISP1Demosaicing, Debug) << "Set sharpness to " << *sharpness; + } + + const auto &denoise = controls.get(controls::draft::NoiseReductionMode); + if (denoise) { + LOG(RkISP1Demosaicing, Debug) << "Set denoise to " << *denoise; + + switch (*denoise) { + case controls::draft::NoiseReductionModeOff: + context.frameContext.demosaicing.denoise = 0; + context.frameContext.demosaicing.updateParams = true; + break; + case controls::draft::NoiseReductionModeMinimal: + context.frameContext.demosaicing.denoise = 1; + context.frameContext.demosaicing.updateParams = true; + break; + case controls::draft::NoiseReductionModeHighQuality: + case controls::draft::NoiseReductionModeFast: + context.frameContext.demosaicing.denoise = 3; + context.frameContext.demosaicing.updateParams = true; + break; + default: + LOG(RkISP1Demosaicing, Error) + << "Unsupported denoise value " + << *denoise; + } + } +} + +/** + * \copydoc libcamera::ipa::Algorithm::prepare + */ +void Demosaicing::prepare([[maybe_unused]] IPAContext &context, + rkisp1_params_cfg *params) +{ + /* Check if the algorithm configuration has been updated. */ + if (!context.frameContext.demosaicing.updateParams) + return; + + context.frameContext.demosaicing.updateParams = false; + + static constexpr uint16_t filt_fac_sh0[] = { + 0x04, 0x07, 0x0A, 0x0C, 0x10, 0x14, 0x1A, 0x1E, 0x24, 0x2A, 0x30 + }; + + static constexpr uint16_t filt_fac_sh1[] = { + 0x04, 0x08, 0x0C, 0x10, 0x16, 0x1B, 0x20, 0x26, 0x2C, 0x30, 0x3F + }; + + static constexpr uint16_t filt_fac_mid[] = { + 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x10, 0x13, 0x17, 0x1D, 0x22, 0x28 + }; + + static constexpr uint16_t filt_fac_bl0[] = { + 0x02, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x10, 0x15, 0x1A, 0x24 + }; + + static constexpr uint16_t filt_fac_bl1[] = { + 0x00, 0x00, 0x00, 0x02, 0x04, 0x04, 0x06, 0x08, 0x0D, 0x14, 0x20 + }; + + static constexpr uint16_t filt_thresh_sh0[] = { + 0, 18, 26, 36, 41, 75, 90, 120, 170, 250, 1023 + }; + + static constexpr uint16_t filt_thresh_sh1[] = { + 0, 33, 44, 51, 67, 100, 120, 150, 200, 300, 1023 + }; + + static constexpr uint16_t filt_thresh_bl0[] = { + 0, 8, 13, 23, 26, 50, 60, 80, 140, 180, 1023 + }; + + static constexpr uint16_t filt_thresh_bl1[] = { + 0, 2, 5, 10, 15, 20, 26, 51, 100, 150, 1023 + }; + + static constexpr uint16_t stage1_select[] = { + 6, 6, 4, 4, 3, 3, 2, 2, 2, 2, 2 + }; + + static constexpr uint16_t filt_chr_v_mode[] = { + 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 + }; + + static constexpr uint16_t filt_chr_h_mode[] = { + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 + }; + + uint8_t denoise = context.frameContext.demosaicing.denoise; + uint8_t sharpness = context.frameContext.demosaicing.sharpness; + + params->others.flt_config.fac_sh0 = filt_fac_sh0[sharpness]; + params->others.flt_config.fac_sh1 = filt_fac_sh1[sharpness]; + params->others.flt_config.fac_mid = filt_fac_mid[sharpness]; + params->others.flt_config.fac_bl0 = filt_fac_bl0[sharpness]; + params->others.flt_config.fac_bl1 = filt_fac_bl1[sharpness]; + + params->others.flt_config.lum_weight = kFiltLumWeightDefault; + params->others.flt_config.mode = kFiltModeDefault; + params->others.flt_config.thresh_sh0 = filt_thresh_sh0[denoise]; + params->others.flt_config.thresh_sh1 = filt_thresh_sh1[denoise]; + params->others.flt_config.thresh_bl0 = filt_thresh_bl0[denoise]; + params->others.flt_config.thresh_bl1 = filt_thresh_bl1[denoise]; + params->others.flt_config.grn_stage1 = stage1_select[denoise]; + params->others.flt_config.chr_v_mode = filt_chr_v_mode[denoise]; + params->others.flt_config.chr_h_mode = filt_chr_h_mode[denoise]; + + if (denoise == 9) { + if (sharpness > 3) + params->others.flt_config.grn_stage1 = 2; + else + params->others.flt_config.grn_stage1 = 1; + } else if (denoise == 10) { + if (sharpness > 5) + params->others.flt_config.grn_stage1 = 2; + else if (sharpness > 3) + params->others.flt_config.grn_stage1 = 1; + else + params->others.flt_config.grn_stage1 = 0; + } else if (denoise > 7) { + if (sharpness > 7) { + params->others.flt_config.fac_bl0 = + params->others.flt_config.fac_bl0 / 2; + params->others.flt_config.fac_bl1 = + params->others.flt_config.fac_bl1 / 4; + } else if (sharpness > 4) { + params->others.flt_config.fac_bl0 = + params->others.flt_config.fac_bl0 * 3 / 4; + params->others.flt_config.fac_bl1 = + params->others.flt_config.fac_bl1 / 2; + } + } + + params->module_en_update |= RKISP1_CIF_ISP_MODULE_FLT; + params->module_ens |= RKISP1_CIF_ISP_MODULE_FLT; + params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_FLT; +} + +REGISTER_IPA_ALGORITHM(Demosaicing, "Demosaicing") + +} /* namespace ipa::rkisp1::algorithms */ + +} /* namespace libcamera */ diff --git a/src/ipa/rkisp1/algorithms/demosaicing.h b/src/ipa/rkisp1/algorithms/demosaicing.h new file mode 100644 index 00000000..0d0f778f --- /dev/null +++ b/src/ipa/rkisp1/algorithms/demosaicing.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021-2022, Ideas On Board + * + * demosaicing.h - RkISP1 Demosaicing control + */ + +#pragma once + +#include + +#include "algorithm.h" + +namespace libcamera { + +namespace ipa::rkisp1::algorithms { + +class Demosaicing : public Algorithm +{ +public: + Demosaicing() = default; + ~Demosaicing() = default; + + void queueRequest(IPAContext &context, const uint32_t frame, + const ControlList &controls) override; + void prepare(IPAContext &context, rkisp1_params_cfg *params) override; +}; + +} /* namespace ipa::rkisp1::algorithms */ +} /* namespace libcamera */ diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build index 87007493..7e078b0d 100644 --- a/src/ipa/rkisp1/algorithms/meson.build +++ b/src/ipa/rkisp1/algorithms/meson.build @@ -4,6 +4,7 @@ rkisp1_ipa_algorithms = files([ 'agc.cpp', 'awb.cpp', 'blc.cpp', + 'demosaicing.cpp', 'dpcc.cpp', 'gsl.cpp', 'lsc.cpp', diff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml index 51228218..4ae0ffc0 100644 --- a/src/ipa/rkisp1/data/ov5640.yaml +++ b/src/ipa/rkisp1/data/ov5640.yaml @@ -157,4 +157,5 @@ algorithms: rnd-offsets: green: 2 red-blue: 2 + - Demosaicing: ... diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h index f387cace..241a4d04 100644 --- a/src/ipa/rkisp1/ipa_context.h +++ b/src/ipa/rkisp1/ipa_context.h @@ -56,6 +56,12 @@ struct IPAFrameContext { double temperatureK; } awb; + struct { + uint8_t denoise; + uint8_t sharpness; + bool updateParams; + } demosaicing; + struct { uint32_t exposure; double gain; diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 34034526..aeec8f50 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -31,6 +31,7 @@ #include "algorithms/algorithm.h" #include "algorithms/awb.h" #include "algorithms/blc.h" +#include "algorithms/demosaicing.h" #include "algorithms/dpcc.h" #include "algorithms/gsl.h" #include "algorithms/lsc.h" diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 99eecd44..4e000d31 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -968,6 +968,14 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) hasSelfPath_ ? &selfPath_ : nullptr); ControlInfoMap::Map ctrls; + ctrls.emplace(std::piecewise_construct, + std::forward_as_tuple(&controls::Sharpness), + std::forward_as_tuple(0.0f, 10.0f, 1.0f)); + + ctrls.emplace(std::piecewise_construct, + std::forward_as_tuple(&controls::draft::NoiseReductionMode), + std::forward_as_tuple(controls::draft::NoiseReductionModeValues)); + ctrls.emplace(std::piecewise_construct, std::forward_as_tuple(&controls::AeEnable), std::forward_as_tuple(false, true)); From patchwork Wed Jul 20 15:42:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Sylvestre X-Patchwork-Id: 16709 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 1BC6CBD1F1 for ; Wed, 20 Jul 2022 15:42:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AAF1563317; Wed, 20 Jul 2022 17:42:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1658331757; bh=2E3bcs1TIXH8g9pWyRgtMsRwI4PM4PjapWAFqJQQXJ8=; 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=4DXzsAqLFjsMe/x3tDo6uNKMDIaZVF7i7MthNh6OM3FNly6JE5JYfif17Pg3UZL5R 8ngUddLOP3FTS0XiKTRT5JFffkWdvViREMjaD9wD99Bq5D7cowuYPkQPvrrEglJtGX I6rIci0bA/KAwTAkVwrVOZ2XxxTHu/22J/d29R9c+DX7Qftqa+vORCgu1eif3jI+ig 8jSg3JRR3Z02+LYhfkwZh4Zj+WoXd25CPDBOyfKn9rKNmkJIf46jhPbCzV8PVmUvOq +2/D4jwpqMLHwfcpRlDm+nb91WGnSqMAMdn0cR36dSKzrHWMQ1aUrMjqzKr5UzmpTX 0QcvjBs8HAbRA== Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D23063317 for ; Wed, 20 Jul 2022 17:42:35 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="rKbUyXEg"; dkim-atps=neutral Received: by mail-wm1-x32a.google.com with SMTP id ay11-20020a05600c1e0b00b003a3013da120so1601121wmb.5 for ; Wed, 20 Jul 2022 08:42:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jjruhyoiyW+4uTxXzzsM9Z4EbDLtkiXsS5Kv7O13Nwo=; b=rKbUyXEgHaFqGFKgddCdfTvlM5oJ6C+cDuoQI/JYGxtnOtEubcOZtDK0CYMsT+0EqU GbydqcRVOvkD5AFA20Y8+zfyHhEHlzQD/MSZjRZAe9YpNQK5W8FeUq6QxS1gkKTbnc4k 0U26E8hzDS6cxWeRcVL+yTnoJrN+yCwGtW+fIfb6hUXK5/xJR1tWxXDMoWYUyDhEpqJM 6AjcU+6MJeFS9rAvBs0X2qeaUbt66ghoUVDcbrIR1OmqO+SsfoEFQzOsprSLFOyyYdk7 9A3y7zHmmXhgaACusofkgvPiqRhFRIYnmRHNs3qqlQOiClDqGboh1qVHmCSGVvO3KAe9 Kjqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jjruhyoiyW+4uTxXzzsM9Z4EbDLtkiXsS5Kv7O13Nwo=; b=vkJa+bs81hcxl8vsfyxkmjv/pCE/x/eYv4fJcTP2K8S7FQK1o7Bmx8vkOzo3AlFo9n lNjJ9c0Lg7BTQ6dEzUPU3+fKGw7CXXN0DKAXMlimwk3Eij9D8vSrO9Avs/t0FzaGtWE+ pY5Al9WpjigPAWXDHRsNG+vZUJdO07/Oy7WvDnc66/q5HqhM7WPpuNM78pz5/VHxPndi LW0wajXdyYntLrdcm8Q/Dxn3w/x8mDKmdCOEM5r8JQMx4W6XcoFdxhixCKpIzi82mM/d eurZi/dOKGj6g/NVYVbgEn+hp+XdgU+o2M/4kZPCRF9EVLpT6V9e2frjvWV4tvdySIGE ka9Q== X-Gm-Message-State: AJIora9bZ+0WcjC+8hYjTQFmCDsrl7faCNZSRBfmPiImTRtHCte8Qq/b m1K3Cn8JSWRdALCL+mSu7fmrypEKxC90awa+ X-Google-Smtp-Source: AGRyM1syEyX66TiSrEYWI4f1TFUat4B6s1Fc9XEm/W9p0+3mkgGYqTY2pMeE0CGPJzfFmA4SkafkGw== X-Received: by 2002:a7b:ce8f:0:b0:3a2:ff2d:915f with SMTP id q15-20020a7bce8f000000b003a2ff2d915fmr4390047wmj.165.1658331754327; Wed, 20 Jul 2022 08:42:34 -0700 (PDT) Received: from BL087.. ([2a01:e34:eea9:e630:516d:f303:6345:b768]) by smtp.gmail.com with ESMTPSA id d2-20020adffbc2000000b0021e489ec78bsm2159294wrs.21.2022.07.20.08.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 08:42:33 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Wed, 20 Jul 2022 17:42:21 +0200 Message-Id: <20220720154221.50937-5-fsylvestre@baylibre.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220720154221.50937-1-fsylvestre@baylibre.com> References: <20220720154221.50937-1-fsylvestre@baylibre.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/4] ipa: rkisp1: Add support of ColorProcessing control 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: Florian Sylvestre via libcamera-devel From: Florian Sylvestre Reply-To: Florian Sylvestre Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add ColorProcessing algorithm that is in charge to manage brightness, contrast and saturation controls. These controls are currently based on user controls. Signed-off-by: Florian Sylvestre Reviewed-by: Laurent Pinchart --- src/ipa/rkisp1/algorithms/cproc.cpp | 94 ++++++++++++++++++++++++ src/ipa/rkisp1/algorithms/cproc.h | 30 ++++++++ src/ipa/rkisp1/algorithms/meson.build | 1 + src/ipa/rkisp1/data/ov5640.yaml | 1 + src/ipa/rkisp1/ipa_context.h | 7 ++ src/ipa/rkisp1/rkisp1.cpp | 1 + src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +++ 7 files changed, 146 insertions(+) create mode 100644 src/ipa/rkisp1/algorithms/cproc.cpp create mode 100644 src/ipa/rkisp1/algorithms/cproc.h diff --git a/src/ipa/rkisp1/algorithms/cproc.cpp b/src/ipa/rkisp1/algorithms/cproc.cpp new file mode 100644 index 00000000..7e9e8cf1 --- /dev/null +++ b/src/ipa/rkisp1/algorithms/cproc.cpp @@ -0,0 +1,94 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021-2022, Ideas On Board + * + * cproc.cpp - RkISP1 Color Processing control + */ + +#include "cproc.h" + +#include + +#include + +#include + +#include "libcamera/internal/yaml_parser.h" + +/** + * \file cproc.h + */ + +namespace libcamera { + +namespace ipa::rkisp1::algorithms { + +/** + * \class ColorProcessing + * \brief RkISP1 Color Processing control + * + * The ColorProcessing algorithm is responsible for applying brightness, + * contrast and saturation corrections. The values are directly provided + * through requests by the corresponding controls. + */ + +LOG_DEFINE_CATEGORY(RkISP1CProc) + +/** + * \copydoc libcamera::ipa::Algorithm::queueRequest + */ +void ColorProcessing::queueRequest([[maybe_unused]] IPAContext &context, + [[maybe_unused]] const uint32_t frame, + const ControlList &controls) +{ + const auto &brightness = controls.get(controls::Brightness); + if (brightness) { + context.frameContext.cproc.brightness = std::clamp(int(*brightness * 128), -128, 127); + context.frameContext.cproc.updateParams = true; + + LOG(RkISP1CProc, Debug) << "Set brightness to " << *brightness; + } + + const auto &contrast = controls.get(controls::Contrast); + if (contrast) { + context.frameContext.cproc.contrast = std::clamp(int(*contrast * 128), 0, 255); + context.frameContext.cproc.updateParams = true; + + LOG(RkISP1CProc, Debug) << "Set contrast to " << *contrast; + } + + const auto saturation = controls.get(controls::Saturation); + if (saturation) { + context.frameContext.cproc.saturation = std::clamp(int(*saturation) * 128, 0, 255); + context.frameContext.cproc.updateParams = true; + + LOG(RkISP1CProc, Debug) << "Set saturation to " << *saturation; + } +} + +/** + * \copydoc libcamera::ipa::Algorithm::prepare + */ +void ColorProcessing::prepare([[maybe_unused]] IPAContext &context, + rkisp1_params_cfg *params) +{ + /* Check if the algorithm configuration has been updated. */ + if (!context.frameContext.cproc.updateParams) + return; + + context.frameContext.cproc.updateParams = false; + + params->others.cproc_config.brightness = context.frameContext.cproc.brightness; + params->others.cproc_config.contrast = context.frameContext.cproc.contrast; + params->others.cproc_config.sat = context.frameContext.cproc.saturation; + + params->module_en_update |= RKISP1_CIF_ISP_MODULE_CPROC; + params->module_ens |= RKISP1_CIF_ISP_MODULE_CPROC; + params->module_cfg_update |= RKISP1_CIF_ISP_MODULE_CPROC; +} + +REGISTER_IPA_ALGORITHM(ColorProcessing, "ColorProcessing") + +} /* namespace ipa::rkisp1::algorithms */ + +} /* namespace libcamera */ diff --git a/src/ipa/rkisp1/algorithms/cproc.h b/src/ipa/rkisp1/algorithms/cproc.h new file mode 100644 index 00000000..4b7e4064 --- /dev/null +++ b/src/ipa/rkisp1/algorithms/cproc.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021-2022, Ideas On Board + * + * cproc.h - RkISP1 Color Processing control + */ + +#pragma once + +#include + +#include "algorithm.h" + +namespace libcamera { + +namespace ipa::rkisp1::algorithms { + +class ColorProcessing : public Algorithm +{ +public: + ColorProcessing() = default; + ~ColorProcessing() = default; + + void queueRequest(IPAContext &context, const uint32_t frame, + const ControlList &controls) override; + void prepare(IPAContext &context, rkisp1_params_cfg *params) override; +}; + +} /* namespace ipa::rkisp1::algorithms */ +} /* namespace libcamera */ diff --git a/src/ipa/rkisp1/algorithms/meson.build b/src/ipa/rkisp1/algorithms/meson.build index 7e078b0d..0ec17e07 100644 --- a/src/ipa/rkisp1/algorithms/meson.build +++ b/src/ipa/rkisp1/algorithms/meson.build @@ -4,6 +4,7 @@ rkisp1_ipa_algorithms = files([ 'agc.cpp', 'awb.cpp', 'blc.cpp', + 'cproc.cpp', 'demosaicing.cpp', 'dpcc.cpp', 'gsl.cpp', diff --git a/src/ipa/rkisp1/data/ov5640.yaml b/src/ipa/rkisp1/data/ov5640.yaml index 4ae0ffc0..331f9d2d 100644 --- a/src/ipa/rkisp1/data/ov5640.yaml +++ b/src/ipa/rkisp1/data/ov5640.yaml @@ -10,6 +10,7 @@ algorithms: Gr: 256 Gb: 256 B: 256 + - ColorProcessing: - GammaSensorLinearization: x-intervals: [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ] y: diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h index 241a4d04..e6a61c45 100644 --- a/src/ipa/rkisp1/ipa_context.h +++ b/src/ipa/rkisp1/ipa_context.h @@ -62,6 +62,13 @@ struct IPAFrameContext { bool updateParams; } demosaicing; + struct { + int8_t brightness; + uint8_t contrast; + uint8_t saturation; + bool updateParams; + } cproc; + struct { uint32_t exposure; double gain; diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index aeec8f50..c664642f 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -31,6 +31,7 @@ #include "algorithms/algorithm.h" #include "algorithms/awb.h" #include "algorithms/blc.h" +#include "algorithms/cproc.h" #include "algorithms/demosaicing.h" #include "algorithms/dpcc.h" #include "algorithms/gsl.h" diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 4e000d31..de687f4d 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -972,6 +972,18 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) std::forward_as_tuple(&controls::Sharpness), std::forward_as_tuple(0.0f, 10.0f, 1.0f)); + ctrls.emplace(std::piecewise_construct, + std::forward_as_tuple(&controls::Brightness), + std::forward_as_tuple(-1.0f, 0.993f)); + + ctrls.emplace(std::piecewise_construct, + std::forward_as_tuple(&controls::Contrast), + std::forward_as_tuple(0.0f, 1.993f)); + + ctrls.emplace(std::piecewise_construct, + std::forward_as_tuple(&controls::Saturation), + std::forward_as_tuple(0.0f, 1.993f)); + ctrls.emplace(std::piecewise_construct, std::forward_as_tuple(&controls::draft::NoiseReductionMode), std::forward_as_tuple(controls::draft::NoiseReductionModeValues));