{"id":12330,"url":"https://patchwork.libcamera.org/api/1.1/patches/12330/?format=json","web_url":"https://patchwork.libcamera.org/patch/12330/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210520151714.3366445-4-naush@raspberrypi.com>","date":"2021-05-20T15:17:13","name":"[libcamera-devel,v2,3/4] ipa: raspberrypi: Switch AgcAlgorithm API to use utils::Duration","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"c7596289966317af51db4f686ab94d082bcd9688","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12330/mbox/","series":[{"id":2039,"url":"https://patchwork.libcamera.org/api/1.1/series/2039/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2039","date":"2021-05-20T15:17:10","name":"Switch RaspberryPi IPA to use std::chrono::duration","version":2,"mbox":"https://patchwork.libcamera.org/series/2039/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12330/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12330/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 9F2E4C31FF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 20 May 2021 15:17:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 278A168925;\n\tThu, 20 May 2021 17:17:26 +0200 (CEST)","from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B63B768921\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 20 May 2021 17:17:22 +0200 (CEST)","by mail-wr1-x42a.google.com with SMTP id n2so18150943wrm.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 20 May 2021 08:17:22 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:de31:dc1f:6be5:f58e])\n\tby smtp.gmail.com with ESMTPSA id\n\ta11sm3583885wrr.48.2021.05.20.08.17.21\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 20 May 2021 08:17:21 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"aqqY4f5c\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=l9Rhxy7l9fwAKZj9Q2e2L0sQKBLDPV0pSpzK9+xure4=;\n\tb=aqqY4f5cKXoJmjAbpnevjMAVVUf3R490qkZNfTUXLVpsX4E437y9iKu2HicIQw7JRk\n\tsJWFmwww2R7DdG51Q6aikJd1p9nIFelXfZe3L2Xih1vNSsUqN4qDra0aQ+Ly2Oo1DoEf\n\t7nXwHdfaTCgaVu+YCHDh3bn5sfXnQjOIC+h/PpkTCeRvrF5CU2cImePNlr4ulbGqgT+o\n\tKQ4uZVSVwhvX6S2XHG+EtRQqAivZSpyBsO4xE6P0J9fD/S6WsCWEe34TGyPjrf7s46yK\n\t9FzsLvyH/xpp9h0mQvQWnotmniFERl2QMnxP8H7fAbBmX4woFPpAgmltAvP65t/nu3Rv\n\tU/tg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=l9Rhxy7l9fwAKZj9Q2e2L0sQKBLDPV0pSpzK9+xure4=;\n\tb=tN0hKTa8v9V9muDO2uTmiebaORS9//CEA4BkubiqFst+U7VubIpoJiPg4SWOvjUFru\n\tIdfeNva3Sfr9kaFL8dyTbwjfISmhfmhqBlxYdRJNedKIad2fBDW7zvltBIQX0wCzkPFy\n\t+abcAsvOSL97rj7TB7yM5QbItxIWlmnl0Oi5dq988QSr6lMUKWxORvrAX6J0abwQootZ\n\tlx2wepLFt82NyhSJ2L9bTiJVLDSjcRi4FZxrVtISwUXcVSmVKEofVQ8WmT92a4VgYNBR\n\tRYYfdQ5bGZDvawtzFLErn5Vn5jfa2Ev1kAE4aUybhYw4i0Rgey0fyW/0RsgZdEkq6dEJ\n\t1xWw==","X-Gm-Message-State":"AOAM532aE/zP9kpajA6R2ZKVkossrIPG85zL1Nl32uTtdhtMRxRxsZsF\n\t9v6/YXuYkJY06Pq5jphFZjZc7GNfnyoZDw==","X-Google-Smtp-Source":"ABdhPJzJB+nWj9MjJ9zDD8HbjlgXrPbU07NnsmQkGcAMJyfS3OXDs3kYIxyWvv8vCVPArO8wZxltvg==","X-Received":"by 2002:adf:e84e:: with SMTP id\n\td14mr4765399wrn.323.1621523842162; \n\tThu, 20 May 2021 08:17:22 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 20 May 2021 16:17:13 +0100","Message-Id":"<20210520151714.3366445-4-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20210520151714.3366445-1-naush@raspberrypi.com>","References":"<20210520151714.3366445-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 3/4] ipa: raspberrypi: Switch\n\tAgcAlgorithm API to use utils::Duration","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Switch the AgcAlgorithm API functions to use utils::Duration for all\ntime based variables.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/controller/agc_algorithm.hpp |  9 ++++++---\n src/ipa/raspberrypi/controller/rpi/agc.cpp       | 12 ++++++------\n src/ipa/raspberrypi/controller/rpi/agc.hpp       |  6 +++---\n src/ipa/raspberrypi/raspberrypi.cpp              |  6 +++---\n 4 files changed, 18 insertions(+), 15 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/controller/agc_algorithm.hpp b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\nindex f97deb0fca59..dabb814ea3dd 100644\n--- a/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n+++ b/src/ipa/raspberrypi/controller/agc_algorithm.hpp\n@@ -6,10 +6,13 @@\n  */\n #pragma once\n \n+#include \"libcamera/internal/utils.h\"\n #include \"algorithm.hpp\"\n \n namespace RPiController {\n \n+using libcamera::utils::Duration;\n+\n class AgcAlgorithm : public Algorithm\n {\n public:\n@@ -17,9 +20,9 @@ public:\n \t// An AGC algorithm must provide the following:\n \tvirtual unsigned int GetConvergenceFrames() const = 0;\n \tvirtual void SetEv(double ev) = 0;\n-\tvirtual void SetFlickerPeriod(double flicker_period) = 0;\n-\tvirtual void SetFixedShutter(double fixed_shutter) = 0; // microseconds\n-\tvirtual void SetMaxShutter(double max_shutter) = 0; // microseconds\n+\tvirtual void SetFlickerPeriod(const Duration &flicker_period) = 0;\n+\tvirtual void SetFixedShutter(const Duration &fixed_shutter) = 0;\n+\tvirtual void SetMaxShutter(const Duration &max_shutter) = 0;\n \tvirtual void SetFixedAnalogueGain(double fixed_analogue_gain) = 0;\n \tvirtual void SetMeteringMode(std::string const &metering_mode_name) = 0;\n \tvirtual void SetExposureMode(std::string const &exposure_mode_name) = 0;\ndiff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\nindex f4cd5d26fb4e..482eb3ef962d 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n@@ -222,19 +222,19 @@ void Agc::SetEv(double ev)\n \tev_ = ev;\n }\n \n-void Agc::SetFlickerPeriod(double flicker_period)\n+void Agc::SetFlickerPeriod(const Duration &flicker_period)\n {\n-\tflicker_period_ = flicker_period;\n+\tflicker_period_ = flicker_period.get<std::micro>();\n }\n \n-void Agc::SetMaxShutter(double max_shutter)\n+void Agc::SetMaxShutter(const Duration &max_shutter)\n {\n-\tmax_shutter_ = max_shutter;\n+\tmax_shutter_ = max_shutter.get<std::micro>();\n }\n \n-void Agc::SetFixedShutter(double fixed_shutter)\n+void Agc::SetFixedShutter(const Duration &fixed_shutter)\n {\n-\tfixed_shutter_ = fixed_shutter;\n+\tfixed_shutter_ = fixed_shutter.get<std::micro>();\n \t// Set this in case someone calls Pause() straight after.\n \tstatus_.shutter_time = clipShutter(fixed_shutter_);\n }\ndiff --git a/src/ipa/raspberrypi/controller/rpi/agc.hpp b/src/ipa/raspberrypi/controller/rpi/agc.hpp\nindex 0427fb59ec1b..16a65959d90e 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.hpp\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.hpp\n@@ -77,9 +77,9 @@ public:\n \tvoid Resume() override;\n \tunsigned int GetConvergenceFrames() const override;\n \tvoid SetEv(double ev) override;\n-\tvoid SetFlickerPeriod(double flicker_period) override;\n-\tvoid SetMaxShutter(double max_shutter) override; // microseconds\n-\tvoid SetFixedShutter(double fixed_shutter) override; // microseconds\n+\tvoid SetFlickerPeriod(const Duration &flicker_period) override;\n+\tvoid SetMaxShutter(const Duration &max_shutter) override;\n+\tvoid SetFixedShutter(const Duration &fixed_shutter) override;\n \tvoid SetFixedAnalogueGain(double fixed_analogue_gain) override;\n \tvoid SetMeteringMode(std::string const &metering_mode_name) override;\n \tvoid SetExposureMode(std::string const &exposure_mode_name) override;\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 4e02e94084f7..e083f6c254cc 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -640,8 +640,8 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\t\t\tbreak;\n \t\t\t}\n \n-\t\t\t/* This expects units of micro-seconds. */\n-\t\t\tagc->SetFixedShutter(ctrl.second.get<int32_t>());\n+\t\t\t/* The control provides units of microseconds. */\n+\t\t\tagc->SetFixedShutter(ctrl.second.get<int32_t>() * 1.0us);\n \n \t\t\tlibcameraMetadata_.set(controls::ExposureTime, ctrl.second.get<int32_t>());\n \t\t\tbreak;\n@@ -1094,7 +1094,7 @@ void IPARPi::applyFrameDurations(const Duration &minFrameDuration,\n \n \tRPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(\n \t\tcontroller_.GetAlgorithm(\"agc\"));\n-\tagc->SetMaxShutter(maxShutter.get<std::micro>());\n+\tagc->SetMaxShutter(maxShutter);\n }\n \n void IPARPi::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls)\n","prefixes":["libcamera-devel","v2","3/4"]}