From patchwork Wed Jul 7 09:48:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12846 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 0842CC3224 for ; Wed, 7 Jul 2021 09:48:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AED1F6852B; Wed, 7 Jul 2021 11:48:20 +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="mGD/JX6z"; dkim-atps=neutral Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9DAD168506 for ; Wed, 7 Jul 2021 11:48:19 +0200 (CEST) Received: by mail-wm1-x334.google.com with SMTP id t14-20020a05600c198eb029020c8aac53d4so10124906wmq.1 for ; Wed, 07 Jul 2021 02:48:19 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=xKQKDlA/B6wWUNDaLbnwgPOltVgogbkgEw+x4QjCkLg=; b=mGD/JX6zEIMZOmNAsMeNt5YcqfCHDqbppe+OcDIFh66ZKIS8Gaz5LmoZdS2hPyw5fk qAAxtQlZrbOCcQxDEfTVapXLMtTRXY26lhG0K3SXKnk3W0vRk2t15Yd8IMVIEjniS+A2 mv0uyOd9ZXHzCnKaAMRsA7wLp+bRCfyDvt6FcR+MPN9lOCqRc3qXKk1Flwpykh4wyzla WC7M2zvUZJqO+yeyWSHiWqwvFLpqa3jTV6q030JRTj88dC/28LRL92MPiYuhZ5IdLTKC onGW18piFS7QZVICUqWt6QkBN3ORFiFc2bP98bUeynl0b8h0THvLTtcP770hHMslT6eF TraA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=xKQKDlA/B6wWUNDaLbnwgPOltVgogbkgEw+x4QjCkLg=; b=ZsEXGr3/YjdrqjnQXUYXww/IS7NsdGLqIXXMOZJFCV6otpNYzGD51ifPQHEwDcFbEV AIryvGT0qT+BSK+4EKBaLLGLF6pFtllTkp/IBae4E6MvmyDXMYCu2TPTaQsQypvDDHXM ux/9Kkzg5kD8uOzpWlKbu9DB24hK2+/M8RCmyf8O9yI1hSbMiqu28AYJliedsjHMCWk+ uQTePb95x+Wi+W4XWHbjJANrexkUdLcjbflmy5S7DqwMUFr47hr1G17bZz6PS+CWGx5G WYAE7DEcq1ECFBrmt7u3D0YH6uTLC+yRJRJ9sGlhcsE1PjALUJ/1EX4aWnC623aGnr1F nhug== X-Gm-Message-State: AOAM531mYl0/eKwxYF0vxEbxvPq5B6OYoWX9DosMEB8lAs9IEkIkD2WQ DLNbKEW4a8x17lWBDnNFweseIruRoTPXRQ== X-Google-Smtp-Source: ABdhPJyLdeIMF+kfxRTXEGsQYjUphQkxje820efOHbKOLIYO1+8ofIrx+zhy+z8oO6U1j1uL8h65GA== X-Received: by 2002:a1c:f70d:: with SMTP id v13mr24800544wmh.183.1625651299144; Wed, 07 Jul 2021 02:48:19 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:f800:302e:bf7e:a06b]) by smtp.gmail.com with ESMTPSA id r16sm23377836wrx.63.2021.07.07.02.48.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jul 2021 02:48:18 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Wed, 7 Jul 2021 10:48:09 +0100 Message-Id: <20210707094815.1500917-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210707094815.1500917-1-naush@raspberrypi.com> References: <20210707094815.1500917-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 2/8] ipa: raspberrypi: Add a constructor struct DeviceStatus 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" The constructor sets all fields to 0. This replaces the memset(0) and default value initialisation usage in the agc and lux controllers respectively. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- src/ipa/raspberrypi/controller/device_status.h | 6 ++++++ src/ipa/raspberrypi/controller/rpi/agc.cpp | 1 - src/ipa/raspberrypi/controller/rpi/lux.cpp | 9 +-------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h index 733378dbfa27..73df7ce228dd 100644 --- a/src/ipa/raspberrypi/controller/device_status.h +++ b/src/ipa/raspberrypi/controller/device_status.h @@ -14,6 +14,12 @@ */ struct DeviceStatus { + DeviceStatus() + : shutter_speed(std::chrono::seconds(0)), analogue_gain(0.0), + lens_position(0.0), aperture(0.0), flash_intensity(0.0) + { + } + /* time shutter is open */ libcamera::utils::Duration shutter_speed; double analogue_gain; diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp index 6c3a4eb2a04d..f57783f821ec 100644 --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp @@ -172,7 +172,6 @@ Agc::Agc(Controller *controller) // it's not been calculated yet (i.e. Process hasn't yet run). memset(&status_, 0, sizeof(status_)); status_.ev = ev_; - memset(&last_device_status_, 0, sizeof(last_device_status_)); } char const *Agc::Name() const diff --git a/src/ipa/raspberrypi/controller/rpi/lux.cpp b/src/ipa/raspberrypi/controller/rpi/lux.cpp index f58d69397e1c..6367b17dc7f4 100644 --- a/src/ipa/raspberrypi/controller/rpi/lux.cpp +++ b/src/ipa/raspberrypi/controller/rpi/lux.cpp @@ -60,14 +60,7 @@ void Lux::Prepare(Metadata *image_metadata) void Lux::Process(StatisticsPtr &stats, Metadata *image_metadata) { - // set some initial values to shut the compiler up - DeviceStatus device_status = { - .shutter_speed = 1.0ms, - .analogue_gain = 1.0, - .lens_position = 0.0, - .aperture = 0.0, - .flash_intensity = 0.0 - }; + DeviceStatus device_status; if (image_metadata->Get("device.status", device_status) == 0) { double current_gain = device_status.analogue_gain; double current_aperture = device_status.aperture;