From patchwork Fri Jul 2 15:09:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 12793 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 2A6C9BD794 for ; Fri, 2 Jul 2021 15:09:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D82E86850D; Fri, 2 Jul 2021 17:09:54 +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="biW6m5by"; dkim-atps=neutral Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 19872684E6 for ; Fri, 2 Jul 2021 17:09:52 +0200 (CEST) Received: by mail-wm1-x329.google.com with SMTP id l18-20020a1ced120000b029014c1adff1edso9303943wmh.4 for ; Fri, 02 Jul 2021 08:09:52 -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=OsExjRL2W95T4NHe/EVVkRdhs/8/IaCpdYq657jQA14=; b=biW6m5byaq+yLS1uPV8QS5MPMK3zVRC6Cljyz0VYIUb9kpR9GFDtlm7Aj0MkZJefEB LvWv+KzACL9a7gTkhfJHr0KISrNtlYC7XuaOdAqbI7Pq3K91HFQBl8/8BDYvxcFlwNwe RBzKmD9eUsWT5Ln+eDmF5lITNWfypj/fDJYzlRdFS/kCVXiKF1mShj9iB8TS4jZWcqI1 Pq5Irh6ezRMqbzJzfbVIk1qBw6aeWHtb+taJHYalIy7fxIPNiZYwbL4CVH6XgnReD8q5 8eihW6FXDUnr5iRXlIG7hY68Pb0viQQ0f2plNB+frtc05qmz8rag5uRaZRYK4BbakbIA ETvw== 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=OsExjRL2W95T4NHe/EVVkRdhs/8/IaCpdYq657jQA14=; b=VqliTKmhcxfnBMxeFrfk6u6g81aMDSq820jtwERNZyOoyleDjW4baom9YUehn0OZE9 gYUMBMgfRe7tnR6Opu7LcqnFBfmiUNMqwClYRIvMR4KIozCilC1Uo6wckdJO1PJQot+r vmBVN2AlqKGUM4lffTVa/xlOBRPU9g+yPc6ebawfS5R5B/n74+uuzCNpY9eW/vpLXUpb tV3vwqpoXHRLgNOa+DYHGxn5dDvLHqL6PoryqgzDUUceM6zObib6x5Czh3joNAKKRTzF R5nrPiOEUxSjqKUBsb57QhR3yh9tzzSR+i/zfeYOI5PFHB0Uk15KJ5gf/hZnGZlJkphN cq1g== X-Gm-Message-State: AOAM533PInJtJqenjr4Hl3xmCYgc0gxhS4J3sCKJF+bHavJCpWZPL2VO P8/bFIKCLq6dGXW56avLfBLz8B/1dgSVpw== X-Google-Smtp-Source: ABdhPJy2jUowg1ANRQ8CFtzSK7/rB50TWC4jeeI9AFQBhNkOZoJ5RvC7xp+e4i75iiWjlTeXxXAJOw== X-Received: by 2002:a7b:c214:: with SMTP id x20mr5853997wmi.171.1625238591627; Fri, 02 Jul 2021 08:09:51 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id n4sm3619335wrw.21.2021.07.02.08.09.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 08:09:51 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 2 Jul 2021 16:09:34 +0100 Message-Id: <20210702150940.226941-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210702150940.226941-1-naush@raspberrypi.com> References: <20210702150940.226941-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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 | 2 +- src/ipa/raspberrypi/controller/rpi/lux.cpp | 8 +------- 3 files changed, 8 insertions(+), 8 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..393cfacea025 100644 --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp @@ -172,7 +172,7 @@ 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_)); + 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..a3ae633b867a 100644 --- a/src/ipa/raspberrypi/controller/rpi/lux.cpp +++ b/src/ipa/raspberrypi/controller/rpi/lux.cpp @@ -61,13 +61,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;