From patchwork Fri May 8 21:35:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Javier Tia X-Patchwork-Id: 26705 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 B5A03BE173 for ; Fri, 8 May 2026 22:37:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6B3EA63026; Sat, 9 May 2026 00:37:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=jetm.me header.i=@jetm.me header.b="FUyVLTJO"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="ATvRgRdu"; dkim-atps=neutral Received: from fhigh-a5-smtp.messagingengine.com (fhigh-a5-smtp.messagingengine.com [103.168.172.156]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 57FB562010 for ; Sat, 9 May 2026 00:37:33 +0200 (CEST) Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id 758551400106; Fri, 8 May 2026 18:37:32 -0400 (EDT) Received: from phl-imap-07 ([10.202.2.97]) by phl-compute-02.internal (MEProxy); Fri, 08 May 2026 18:37:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jetm.me; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1778279852; x=1778366252; bh=pWwlo6720Nqw9qAZolKlDOrT9crU4MKLBJSHwaKqF24=; b= FUyVLTJONycGRRVn8RFHJY6XUgoLgIlAuYm12RHSUD8Cjfssc3OYc505KTsn4Qsg kDhv2PDd6oXbO8cxQ6mpRRvGbJfYmR/EPi2wuSPuTESIv72he/OHt/PK1QBVrPjN oFP1zAW6ZOb6Aek+et4UzM8pz91KtmHr6vWFWRIlWspMreWu1pNYbtV03OYEXcOT 8rwuV/vQm+VsSQnSyKdgvgM26L8Qdxd6DFUXgZ4dRxrgwlaDWbIE7TD1smGNh8IY X+PlycwMGJqr2nO9AJUGDF7jiWTyfeAN4QP0inT4CKRGwzNEMsu3y+HTFWgWB+2k pLn01aItuhqJBkBgEllKvQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1778279852; x= 1778366252; bh=pWwlo6720Nqw9qAZolKlDOrT9crU4MKLBJSHwaKqF24=; b=A TvRgRduGQCZoYH213d2VwKMQW9p+wUNNpuYyw9YUjjlr4HlxRSTNZo/shMpnLXGn CR619wZBN6xGs11+Zy5Zf5S+ktNr4FqjqR2zKkakQFZ5bPyURzYFhU/AfVcrQ1FR MkdLkiHoQGKBChKQoR+EZP8ASryWDH4vnoNcTTU2NVqzQcN4AQlDGNOe2v2jJn/B 6qAtIpHPZj3xGPoL+BeT7GP2xSWfMaQZPU5e0dMZPuR/bg221xIjTWndzy9KulhD jS1KSdse21bh8SlgZGjxAxccotZUXVHiHl8Jdf6qyUWP9OTwj9e7+aRbycX+tVBT 7xpSwFfb4RZYgYkmPMqKA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdduudduheejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefotggggffhvfffufevjghfkfesthekre dtredtjeenucfhrhhomheplfgrvhhivghrucfvihgruceofhhlohhsshesjhgvthhmrdhm vgeqnecuggftrfgrthhtvghrnhepgeehvdegudffffdtgfdtudeludefveeihfejfeelff egtdekueefgeejgeekgedunecuffhomhgrihhnpehlihgstggrmhgvrhgrrdhorhhgnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepfhhlohhssh esjhgvthhmrdhmvgdpnhgspghrtghpthhtohepjedpmhhouggvpehsmhhtphhouhhtpdhr tghpthhtoheprhhosggvrhhtrdhmrgguvghrsegtohhllhgrsghorhgrrdgtohhmpdhrtg hpthhtohepsggrrhhnrggsrghsrdhpohgtiigvsehiuggvrghsohhnsghorghrugdrtgho mhdprhgtphhtthhopehkihgvrhgrnhdrsghinhhghhgrmhesihguvggrshhonhgsohgrrh gurdgtohhmpdhrtghpthhtoheplhgruhhrvghnthdrphhinhgthhgrrhhtsehiuggvrghs ohhnsghorghrugdrtghomhdprhgtphhtthhopehflhhoshhssehjvghtmhdrmhgvpdhrtg hpthhtoheplhhisggtrghmvghrrgdquggvvhgvlheslhhishhtshdrlhhisggtrghmvghr rgdrohhrghdprhgtphhtthhopehmiigrmhgriigrlhesrhgvughhrghtrdgtohhm X-ME-Proxy: Feedback-ID: i9dde48b3:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 29F761EA006C; Fri, 8 May 2026 18:37:32 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 From: Javier Tia To: libcamera-devel@lists.libcamera.org Date: Fri, 08 May 2026 15:35:24 -0600 Subject: [PATCH v2 0/2] libcamera: Vector right-shift operators and SwStatsCpu use site Cc: mzamazal@redhat.com, kieran.bingham@ideasonboard.com, laurent.pinchart@ideasonboard.com, barnabas.pocze@ideasonboard.com, robert.mader@collabora.com In-Reply-To: <177826797798.345005.11618565886801750854@jetm.me> References: <177826797798.345005.11618565886801750854@jetm.me> Message-ID: <177827984964.786021.2242634090011461397@jetm.me> 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" Small follow-up suggested by Barnabás and Laurent during review of the sumShift_ cleanup in the OV2740 v2 series: https://patchwork.libcamera.org/project/libcamera/list/?series=5926 Patch 1/2 adds operator>> and operator>>= to the Vector class. Patch 2/2 uses the new operator in SwStatsCpu::finishFrame() to collapse the three per-component right-shifts on RGB::sum_ into a single sum_ >>= sumShift_ statement. Depends on the v2 OV2740 series above (specifically v2 1/3, which removes the if (sumShift_) guard around the three right-shifts that 2/2 here further simplifies). It does not apply on top of master without v2. Changes since v1: - Patch 1/2: rewrote operator>> and operator>>= to use the existing apply() helper for consistency with the other Vector operators; templated apply() on the scalar type to accept unsigned int. Added Doxygen \fn blocks for both operators in src/libcamera/vector.cpp. Verified with -Ddocumentation=enabled -Ddoc_werror=true. - Patch 1/2: added static_assert(std::is_integral_v) in both shift operators to enforce integer element type, per Laurent's follow-up review. - Patch 2/2: picked up Laurent's Reviewed-by. Link to v1: https://patchwork.libcamera.org/project/libcamera/list/?series=5927 Javier Tia (2): libcamera: libipa: Add right-shift operators to Vector libcamera: software_isp: Use Vector operator>>= in finishFrame include/libcamera/internal/vector.h | 22 ++++++++++++++++++---- src/libcamera/software_isp/swstats_cpu.cpp | 4 +--- src/libcamera/vector.cpp | 14 ++++++++++++++ 3 files changed, 33 insertions(+), 7 deletions(-)