From patchwork Sat Aug 22 20:00:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 9371 X-Patchwork-Delegate: laurent.pinchart@ideasonboard.com 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 4160EBD87C for ; Sat, 22 Aug 2020 20:01:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 11A9062113; Sat, 22 Aug 2020 22:01:07 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="fbOyAt96"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9425762758 for ; Sat, 22 Aug 2020 22:01:02 +0200 (CEST) Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 13AB829E for ; Sat, 22 Aug 2020 22:01:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1598126462; bh=ATzgUPvlZS3LwLn5S05NCzfu0Y55E4Q5lYTWezzpEoI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fbOyAt96e3S6T6L/m/Q8tfkl+5fFMFhaEFG3eBhO4zWjhvRZ2R93bHrD+JyGcCr4S +sW9t+nI3f7cK81PzbuxDVjdbI9nfBFS9dmj3tEO523mcC956tKKb6mpLUEKC2gXpU jJ3KVWl1aXrzQz8OOoM4PnjD2ZKn/IdTGWpOC2cw= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 22 Aug 2020 23:00:37 +0300 Message-Id: <20200822200037.20892-6-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200822200037.20892-1-laurent.pinchart@ideasonboard.com> References: <20200822200037.20892-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/5] ipa: raspberrypi: Replace void cast with [[maybe_unused]] 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 standard way in C++17 to specify that a function or function argument may be unused it to specify the [[maybe_unused]] attribute. Replace manual void casts to silence compiler warnings. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Niklas Söderlund --- src/ipa/raspberrypi/controller/algorithm.cpp | 16 ++++++---------- src/ipa/raspberrypi/controller/rpi/alsc.cpp | 8 +++----- src/ipa/raspberrypi/controller/rpi/contrast.cpp | 4 ++-- src/ipa/raspberrypi/controller/rpi/noise.cpp | 5 ++--- src/ipa/raspberrypi/controller/rpi/sharpen.cpp | 5 ++--- 5 files changed, 15 insertions(+), 23 deletions(-) diff --git a/src/ipa/raspberrypi/controller/algorithm.cpp b/src/ipa/raspberrypi/controller/algorithm.cpp index 55cb2012e63b..1b80e29602f4 100644 --- a/src/ipa/raspberrypi/controller/algorithm.cpp +++ b/src/ipa/raspberrypi/controller/algorithm.cpp @@ -9,28 +9,24 @@ using namespace RPi; -void Algorithm::Read(boost::property_tree::ptree const ¶ms) +void Algorithm::Read([[maybe_unused]] boost::property_tree::ptree const ¶ms) { - (void)params; } void Algorithm::Initialise() {} -void Algorithm::SwitchMode(CameraMode const &camera_mode, Metadata *metadata) +void Algorithm::SwitchMode([[maybe_unused]] CameraMode const &camera_mode, + [[maybe_unused]] Metadata *metadata) { - (void)camera_mode; - (void)metadata; } -void Algorithm::Prepare(Metadata *image_metadata) +void Algorithm::Prepare([[maybe_unused]] Metadata *image_metadata) { - (void)image_metadata; } -void Algorithm::Process(StatisticsPtr &stats, Metadata *image_metadata) +void Algorithm::Process([[maybe_unused]] StatisticsPtr &stats, + [[maybe_unused]] Metadata *image_metadata) { - (void)stats; - (void)image_metadata; } // For registering algorithms with the system: diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp index 9df713a37a69..0d0e0b0c8fc4 100644 --- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp +++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp @@ -200,10 +200,9 @@ static bool compare_modes(CameraMode const &cm0, CameraMode const &cm1) top_diff > threshold_y || bottom_diff > threshold_y; } -void Alsc::SwitchMode(CameraMode const &camera_mode, Metadata *metadata) +void Alsc::SwitchMode(CameraMode const &camera_mode, + [[maybe_unused]] Metadata *metadata) { - (void)metadata; - // We're going to start over with the tables if there's any "significant" // change. bool reset_tables = first_time_ || compare_modes(camera_mode_, camera_mode); @@ -490,7 +489,7 @@ void compensate_lambdas_for_cal(double const cal_table[XY], new_lambdas[i] /= min_new_lambda; } -static void print_cal_table(double const C[XY]) +[[maybe_unused]] static void print_cal_table(double const C[XY]) { printf("table: [\n"); for (int j = 0; j < Y; j++) { @@ -710,7 +709,6 @@ void Alsc::doAlsc() resample_cal_table(cal_table_tmp, camera_mode_, cal_table_b); // You could print out the cal tables for this image here, if you're // tuning the algorithm... - (void)print_cal_table; // Apply any calibration to the statistics, so the adaptive algorithm // makes only the extra adjustments. apply_cal_table(cal_table_r, Cr); diff --git a/src/ipa/raspberrypi/controller/rpi/contrast.cpp b/src/ipa/raspberrypi/controller/rpi/contrast.cpp index e4967990c577..c8d9ab6184f5 100644 --- a/src/ipa/raspberrypi/controller/rpi/contrast.cpp +++ b/src/ipa/raspberrypi/controller/rpi/contrast.cpp @@ -137,9 +137,9 @@ Pwl apply_manual_contrast(Pwl const &gamma_curve, double brightness, return new_gamma_curve; } -void Contrast::Process(StatisticsPtr &stats, Metadata *image_metadata) +void Contrast::Process(StatisticsPtr &stats, + [[maybe_unused]] Metadata *image_metadata) { - (void)image_metadata; double brightness = brightness_, contrast = contrast_; Histogram histogram(stats->hist[0].g_hist, NUM_HISTOGRAM_BINS); // We look at the histogram and adjust the gamma curve in the following diff --git a/src/ipa/raspberrypi/controller/rpi/noise.cpp b/src/ipa/raspberrypi/controller/rpi/noise.cpp index 2cafde3ab951..1b84ecb0b22c 100644 --- a/src/ipa/raspberrypi/controller/rpi/noise.cpp +++ b/src/ipa/raspberrypi/controller/rpi/noise.cpp @@ -27,10 +27,9 @@ char const *Noise::Name() const return NAME; } -void Noise::SwitchMode(CameraMode const &camera_mode, Metadata *metadata) +void Noise::SwitchMode(CameraMode const &camera_mode, + [[maybe_unused]] Metadata *metadata) { - (void)metadata; - // For example, we would expect a 2x2 binned mode to have a "noise // factor" of sqrt(2x2) = 2. (can't be less than one, right?) mode_factor_ = std::max(1.0, camera_mode.noise_factor); diff --git a/src/ipa/raspberrypi/controller/rpi/sharpen.cpp b/src/ipa/raspberrypi/controller/rpi/sharpen.cpp index 2b701db5367c..356c10588d01 100644 --- a/src/ipa/raspberrypi/controller/rpi/sharpen.cpp +++ b/src/ipa/raspberrypi/controller/rpi/sharpen.cpp @@ -26,10 +26,9 @@ char const *Sharpen::Name() const return NAME; } -void Sharpen::SwitchMode(CameraMode const &camera_mode, Metadata *metadata) +void Sharpen::SwitchMode(CameraMode const &camera_mode, + [[maybe_unused]] Metadata *metadata) { - (void)metadata; - // can't be less than one, right? mode_factor_ = std::max(1.0, camera_mode.noise_factor); }