From patchwork Wed Jul 1 12:50:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 8543 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 DA9DDBE905 for ; Wed, 1 Jul 2020 12:50:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 66BFE60C58; Wed, 1 Jul 2020 14:50:31 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Q7jsFKFX"; dkim-atps=neutral Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F0E06603B4 for ; Wed, 1 Jul 2020 14:50:29 +0200 (CEST) Received: by mail-wr1-x431.google.com with SMTP id a6so23682377wrm.4 for ; Wed, 01 Jul 2020 05:50:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/ruwLN1bKzrJGDtGxsf8sj5mp/DyO3tRSKj/vQWJgV0=; b=Q7jsFKFXkflCAXdK+alCESp//Nmwc9hIk8nPlMfiUUjZBWUc9/50hylO7MrVhoo01E 3x7/2opEBsxGWN+r/xds8yh7PZUcYUNfZM/niix8iSERTy9F9xCU9rGHSt9gq3n1HEYw PMlurMhFsfTOAeUgBqBgKdgt6KE0oiCIYgCrZ9ws6rjOvXAjcEEAZ3xHta5M1CHgnwFD 3GGhKukB/Bw0FGu6vxgaf5SodgYBxTW6kXeCbl7Wzx5b7SfzYpwYSSQXD7PKaAzw6Kiv nmLC3tWldXWtfKbXIhabHFeEdZ4BELRHrUlTvk3PkDkXbLaD9fMUWV2B9gAIbR4Thc81 Y6AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/ruwLN1bKzrJGDtGxsf8sj5mp/DyO3tRSKj/vQWJgV0=; b=L3KyprkOaOtYmFIjH1h8S2Ly7PifJfTp1avBtsd16IG+CkqoDEyIljPqkaYcn+6vca vyBy7vxIsoYM4DzLNt2UvKQ7cycBcqnBAg8d6i5OH/5s66A/HGQyz3eml5lkOsAOGase DseJin2aRGpyAmtdldikm3Rha+uygZsLuq2PyhjSI48RVSiN1QhJmaWg2hS+Q6r+HJ3Y dXMuZEpSwBpv/F40lzjzJOCoc15XGRZ47zwYHJknKBvwcK+0BmD8LfV6q8sk0IYExZha FcJmU3OAUnyyQh53MRR71FN5ZFy+eNW6k5g27y92xv4Bg5pt43sw0Yllq2PAsUBZyH3V B98w== X-Gm-Message-State: AOAM530tfCK4k8AYfPVF7zfNEI/T2tyj70sb+LAYxEvRLhWCYgz8rHgW LWBlGhbUHtXDa9EytNP5gDIyA8pBGUg= X-Google-Smtp-Source: ABdhPJxHy6YAgeC1pxPep445sP0890Q0srNMppdhL2BNhlUgVALxNbdULpaEjQ99oer70erOWxRa0w== X-Received: by 2002:adf:ec42:: with SMTP id w2mr26898588wrn.269.1593607829205; Wed, 01 Jul 2020 05:50:29 -0700 (PDT) Received: from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72]) by smtp.gmail.com with ESMTPSA id g14sm2950029wrw.83.2020.07.01.05.50.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 05:50:28 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Wed, 1 Jul 2020 13:50:21 +0100 Message-Id: <20200701125021.1388-1-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] libcamera: ipa: raspberrypi: Enable focus measure without recompile 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" Previously, output of the focus measure could not be enabled without recompiling (because of the RPI_LOGGING_ENABLE macro). This uses the libcamera logging mechanism instead, so can be enabled/disabled at runtime. Signed-off-by: David Plowman Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/ipa/raspberrypi/controller/rpi/focus.cpp | 16 ++++++---------- src/ipa/raspberrypi/controller/rpi/focus.hpp | 3 --- src/ipa/raspberrypi/data/imx477.json | 2 +- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/ipa/raspberrypi/controller/rpi/focus.cpp b/src/ipa/raspberrypi/controller/rpi/focus.cpp index 1e2b649..573831b 100644 --- a/src/ipa/raspberrypi/controller/rpi/focus.cpp +++ b/src/ipa/raspberrypi/controller/rpi/focus.cpp @@ -6,11 +6,15 @@ */ #include +#include "libcamera/internal/log.h" + #include "../focus_status.h" -#include "../logging.hpp" #include "focus.hpp" using namespace RPi; +using namespace libcamera; + +LOG_DEFINE_CATEGORY(RPI_FOCUS) #define NAME "rpi.focus" @@ -24,11 +28,6 @@ char const *Focus::Name() const return NAME; } -void Focus::Read(boost::property_tree::ptree const ¶ms) -{ - print_ = params.get("print", 0); -} - void Focus::Process(StatisticsPtr &stats, Metadata *image_metadata) { FocusStatus status; @@ -37,10 +36,7 @@ void Focus::Process(StatisticsPtr &stats, Metadata *image_metadata) status.focus_measures[i] = stats->focus_stats[i].contrast_val[1][1] / 1000; status.num = i; image_metadata->Set("focus.status", status); - if (print_) { - uint32_t value = (status.focus_measures[5] + status.focus_measures[6]) / 10; - RPI_LOG("Focus contrast measure: " << value); - } + LOG(RPI_FOCUS, Debug) << "Focus contrast measure: " << (status.focus_measures[5] + status.focus_measures[6]) / 10; } /* Register algorithm with the system. */ diff --git a/src/ipa/raspberrypi/controller/rpi/focus.hpp b/src/ipa/raspberrypi/controller/rpi/focus.hpp index d53401f..a9756ea 100644 --- a/src/ipa/raspberrypi/controller/rpi/focus.hpp +++ b/src/ipa/raspberrypi/controller/rpi/focus.hpp @@ -22,10 +22,7 @@ class Focus : public Algorithm public: Focus(Controller *controller); char const *Name() const override; - void Read(boost::property_tree::ptree const ¶ms) override; void Process(StatisticsPtr &stats, Metadata *image_metadata) override; -private: - bool print_; }; } /* namespace RPi */ diff --git a/src/ipa/raspberrypi/data/imx477.json b/src/ipa/raspberrypi/data/imx477.json index 389e8ce..747cd8d 100644 --- a/src/ipa/raspberrypi/data/imx477.json +++ b/src/ipa/raspberrypi/data/imx477.json @@ -415,6 +415,6 @@ }, "rpi.focus": { - "print": 1 + } }