From patchwork Fri Jul 9 09:56:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12873 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 0DCB2BD794 for ; Fri, 9 Jul 2021 09:56:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BEF7F6852A; Fri, 9 Jul 2021 11:56:51 +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="WqD6P+9r"; dkim-atps=neutral Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 05F44684F3 for ; Fri, 9 Jul 2021 11:56:50 +0200 (CEST) Received: by mail-wr1-x430.google.com with SMTP id i8so11321555wrp.12 for ; Fri, 09 Jul 2021 02:56:50 -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=WqD6P+9rdFO2LpCmSkvhWpOTht2iZz5JXTc/epY8xqvvqLP6r4IsZNH8sXXjVZpo6I Pht5kJjM+atmdWPND/x8YVzmcdLfrRfpfP28ZOLJvqSUQykYzyNA3X81YgAFLRhaTlal ELiLkEqE5bhr7efH0t0DFtyv43Xadyaj3vAY//sxRd4XsbOzM/a0H3+cVs7wtok3ItST MgnnzUXOvwQvPWUYVwJ8Z1m4aBKPPYWeosvPvUcMkxey3izHTNIjEIAIULbMBNr7UeYQ +ihAGkeIM0wmfcdL9WQCDRZm4NENcLmVD7JomPcFMK6ui9KHepJ0bQuxLa4uVXzutmFX 6Opw== 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=ObKzXRCU5/7czFu/qc2b6ah53Ypvsi+bu5N6bt8fU0ITED29uFYM1SQ5Lhhah2fBN/ Jii/Vd3+DN7sCnt71f7WuEs4Ljk8zQBAeK+Cz5tcXyTAE0K7JgJ5hm1Orn+b0lDl52JV iKDmoemYgg24ia8WZujI+ddlm+CYLbZoE2gm+2wO/dDFcuEpkcMp410uDjZVBOhlNy/f zzTKvisPQSlrkh6BEc9vsDB2a0W9EkTxOODtjEvVprOb4ZxGkX/cm3ih7g6N93g6OCAu 8y8fGCYOZTxO8H+VZHiwnAaVKn5eRVLu/FLdiS33mtxsOn4Q3VuV3/x+E71af34mtIzv LTfQ== X-Gm-Message-State: AOAM531eJzQnYVIxtO10xUH7/jUxPc/ahz/R5pRjDUzOMJBock+D6KBd PiEy7unkg1rdH3JxRmHkGswTy17XQq5jAg== X-Google-Smtp-Source: ABdhPJwdeg29lNFlpnrWm1tlcdT1mPs/Hm1e0tWL6RrR0lRX7KaLHsL107oEKu9jdtpOFfLaesFGeQ== X-Received: by 2002:a5d:4573:: with SMTP id a19mr3051548wrc.346.1625824609567; Fri, 09 Jul 2021 02:56:49 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:35c2:26d3:e217:4410]) by smtp.gmail.com with ESMTPSA id b16sm1599014wrw.46.2021.07.09.02.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jul 2021 02:56:49 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Jul 2021 10:56:32 +0100 Message-Id: <20210709095638.2801713-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210709095638.2801713-1-naush@raspberrypi.com> References: <20210709095638.2801713-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 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 Reviewed-by: Kieran Bingham --- 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;