From patchwork Sun Jun 21 00:23:04 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 27007 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 9116CC3306 for ; Sun, 21 Jun 2026 00:23:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 06B0A656E5; Sun, 21 Jun 2026 02:23:15 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="XRQ3XkX4"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F1BAD656E9 for ; Sun, 21 Jun 2026 02:23:11 +0200 (CEST) Received: from killaraus.ideasonboard.com (2001-14ba-70f3-e800--a06.rev.dnainternet.fi [IPv6:2001:14ba:70f3:e800::a06]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 84E6AB8B; Sun, 21 Jun 2026 02:22:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1782001354; bh=0WMvP4YZu3wStzAx0c8cs6xCUyzGowBc//PCpN3eih8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XRQ3XkX4zwJi1N+IDqAOwDVlRM7xrUg0Pc/mSbiU9Q1QtUCVxHU4G5M61F0lVt8uH xZgejhoi1Au50rUU2zTryjPWMM+imO6omNIwYRsnjDu7GRUUg+MYp3P8wVIUNGOWJf p71W/riGIPKNUV0ky624MV3UVo70yxZQJNP62cio= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: Kieran Bingham Subject: [PATCH 3/4] libcamera: vector: Support multiple scalar arguments to apply() Date: Sun, 21 Jun 2026 03:23:04 +0300 Message-ID: <20260621002305.3763752-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260621002305.3763752-1-laurent.pinchart@ideasonboard.com> References: <20260621002305.3763752-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 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" In preparation for the addition of a clamp() function to the vector class, extend the apply() function to support multiple scalar arguments. Signed-off-by: Laurent Pinchart --- include/libcamera/internal/vector.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/libcamera/internal/vector.h b/include/libcamera/internal/vector.h index 256de1d1c53a..7c90d6542352 100644 --- a/include/libcamera/internal/vector.h +++ b/include/libcamera/internal/vector.h @@ -274,13 +274,13 @@ private: return result; } - template - static constexpr Vector apply(const Vector &lhs, BinaryOp op, U rhs) + template + static constexpr Vector apply(const Vector &vector, Op op, U... scalar) { Vector result; - std::transform(lhs.data_.begin(), lhs.data_.end(), + std::transform(vector.data_.begin(), vector.data_.end(), result.data_.begin(), - [&op, rhs](T v) { return op(v, rhs); }); + [&op, scalar...](T v) { return op(v, scalar...); }); return result; } @@ -295,11 +295,11 @@ private: return *this; } - template - Vector &apply(BinaryOp op, U scalar) + template + Vector &apply(Op op, U... scalar) { std::for_each(data_.begin(), data_.end(), - [&op, scalar](T &v) { v = op(v, scalar); }); + [&op, scalar...](T &v) { v = op(v, scalar...); }); return *this; }