[{"id":38830,"web_url":"https://patchwork.libcamera.org/comment/38830/","msgid":"<20260508200119.GB2186850@killaraus.ideasonboard.com>","date":"2026-05-08T20:01:19","subject":"Re: [PATCH 1/2] libcamera: libipa: Add right-shift operators to\n\tVector","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Fri, May 08, 2026 at 01:19:25PM -0600, Javier Tia wrote:\n> Add operator>> and operator>>= for right-shifting all elements by a\n> scalar shift amount. Both operate element-wise: operator>> returns a\n> new Vector with each element shifted, operator>>= shifts in place and\n> returns a reference to *this.\n> \n> The motivating use case is SwStatsCpu::finishFrame(), which right-shifts\n> three individual components of the RGB sum by the same sumShift_ value.\n> With these operators that becomes a single sum_ >>= sumShift_ expression.\n> \n> Suggested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> Signed-off-by: Javier Tia <floss@jetm.me>\n> ---\n>  include/libcamera/internal/vector.h | 15 +++++++++++++++\n>  1 file changed, 15 insertions(+)\n> \n> diff --git a/include/libcamera/internal/vector.h b/include/libcamera/internal/vector.h\n> index ed7490e1..475bc522 100644\n> --- a/include/libcamera/internal/vector.h\n> +++ b/include/libcamera/internal/vector.h\n> @@ -111,6 +111,14 @@ public:\n>  \t\treturn apply(*this, scalar, std::divides<>{});\n>  \t}\n>  \n> +\tconstexpr Vector operator>>(unsigned int shift) const\n> +\t{\n> +\t\tVector result;\n> +\t\tstd::transform(data_.begin(), data_.end(), result.data_.begin(),\n> +\t\t\t       [shift](T v) { return v >> shift; });\n> +\t\treturn result;\n\nWhat's the reason to implement this operator differently from the other\nones ?\n\n> +\t}\n> +\n>  \tVector &operator+=(const Vector &other)\n>  \t{\n>  \t\treturn apply(other, [](T a, T b) { return a + b; });\n> @@ -151,6 +159,13 @@ public:\n>  \t\treturn apply(scalar, [](T a, T b) { return a / b; });\n>  \t}\n>  \n> +\tVector &operator>>=(unsigned int shift)\n> +\t{\n> +\t\tstd::for_each(data_.begin(), data_.end(),\n> +\t\t\t      [shift](T &v) { v >>= shift; });\n> +\t\treturn *this;\n> +\t}\n> +\n>  \tconstexpr Vector min(const Vector &other) const\n>  \t{\n>  \t\treturn apply(*this, other, [](T a, T b) { return std::min(a, b); });","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 483D4BDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 May 2026 20:01:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 19EDB6301A;\n\tFri,  8 May 2026 22:01:23 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CC57362FD3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 May 2026 22:01:21 +0200 (CEST)","from killaraus.ideasonboard.com\n\t(2001-14ba-70f3-e800--a06.rev.dnainternet.fi\n\t[IPv6:2001:14ba:70f3:e800::a06])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 6BF9BBCA;\n\tFri,  8 May 2026 22:01:16 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"f2FDWszZ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1778270476;\n\tbh=WyGRkkA3/eYYQ+dsH7l5HOQ2+2fGD/hdf6LUz6+Ccm4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=f2FDWszZRkMJXukvzIFsz158KF/BdWSUyYXq9NBkDLUw2uhqfoexjFW/jld4RSLrp\n\t5hbfvD/ZyFPptB1JqG1RMqbQRdZNAgIJ9f7ymdArpMVws5KA1/gW9QTUNXypQxoUE1\n\tn1AwYasrkO9KbuIDFsUP49Pg9gvsZ3edrAjqJJsw=","Date":"Fri, 8 May 2026 23:01:19 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Javier Tia <floss@jetm.me>","Cc":"libcamera-devel@lists.libcamera.org, mzamazal@redhat.com,\n\tkieran.bingham@ideasonboard.com, barnabas.pocze@ideasonboard.com,\n\trobert.mader@collabora.com","Subject":"Re: [PATCH 1/2] libcamera: libipa: Add right-shift operators to\n\tVector","Message-ID":"<20260508200119.GB2186850@killaraus.ideasonboard.com>","References":"<177826797798.345005.11618565886801750854@jetm.me>\n\t<20260508191941.9DB451EA006C@mailuser.phl.internal>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20260508191941.9DB451EA006C@mailuser.phl.internal>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":38832,"web_url":"https://patchwork.libcamera.org/comment/38832/","msgid":"<20260508200305.GD2186850@killaraus.ideasonboard.com>","date":"2026-05-08T20:03:05","subject":"Re: [PATCH 1/2] libcamera: libipa: Add right-shift operators to\n\tVector","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Fri, May 08, 2026 at 11:01:21PM +0300, Laurent Pinchart wrote:\n> On Fri, May 08, 2026 at 01:19:25PM -0600, Javier Tia wrote:\n> > Add operator>> and operator>>= for right-shifting all elements by a\n> > scalar shift amount. Both operate element-wise: operator>> returns a\n> > new Vector with each element shifted, operator>>= shifts in place and\n> > returns a reference to *this.\n> > \n> > The motivating use case is SwStatsCpu::finishFrame(), which right-shifts\n> > three individual components of the RGB sum by the same sumShift_ value.\n> > With these operators that becomes a single sum_ >>= sumShift_ expression.\n> > \n> > Suggested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> > Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > Signed-off-by: Javier Tia <floss@jetm.me>\n> > ---\n> >  include/libcamera/internal/vector.h | 15 +++++++++++++++\n> >  1 file changed, 15 insertions(+)\n> > \n> > diff --git a/include/libcamera/internal/vector.h b/include/libcamera/internal/vector.h\n> > index ed7490e1..475bc522 100644\n> > --- a/include/libcamera/internal/vector.h\n> > +++ b/include/libcamera/internal/vector.h\n> > @@ -111,6 +111,14 @@ public:\n> >  \t\treturn apply(*this, scalar, std::divides<>{});\n> >  \t}\n> >  \n> > +\tconstexpr Vector operator>>(unsigned int shift) const\n> > +\t{\n> > +\t\tVector result;\n> > +\t\tstd::transform(data_.begin(), data_.end(), result.data_.begin(),\n> > +\t\t\t       [shift](T v) { return v >> shift; });\n> > +\t\treturn result;\n> \n> What's the reason to implement this operator differently from the other\n> ones ?\n\nAlso, please compile libcamera with documentation=enabled and\ndoc_werror=true.\n\n> > +\t}\n> > +\n> >  \tVector &operator+=(const Vector &other)\n> >  \t{\n> >  \t\treturn apply(other, [](T a, T b) { return a + b; });\n> > @@ -151,6 +159,13 @@ public:\n> >  \t\treturn apply(scalar, [](T a, T b) { return a / b; });\n> >  \t}\n> >  \n> > +\tVector &operator>>=(unsigned int shift)\n> > +\t{\n> > +\t\tstd::for_each(data_.begin(), data_.end(),\n> > +\t\t\t      [shift](T &v) { v >>= shift; });\n> > +\t\treturn *this;\n> > +\t}\n> > +\n> >  \tconstexpr Vector min(const Vector &other) const\n> >  \t{\n> >  \t\treturn apply(*this, other, [](T a, T b) { return std::min(a, b); });","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 53847BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 May 2026 20:03:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EE3C762FE1;\n\tFri,  8 May 2026 22:03:08 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A1CBA62FD3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 May 2026 22:03:06 +0200 (CEST)","from killaraus.ideasonboard.com\n\t(2001-14ba-70f3-e800--a06.rev.dnainternet.fi\n\t[IPv6:2001:14ba:70f3:e800::a06])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 87DE613BE;\n\tFri,  8 May 2026 22:03:01 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"GcUAdjT7\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1778270581;\n\tbh=kwPazPWVFotvD+V7y8sV/GqhGetohgLlI4OiOSZoGUI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=GcUAdjT7uGfSF/whELDoJPbcRpAm/wlH12bFv/TYhxJD95dpmHwQvRieg4kw1KFJY\n\tRtVpqjQOzjyYT2pD4Rd8LBZ5THikehDh/P0cvX5po+pwo0faWS/MiTNwcCxff0YNVq\n\tZkxDjkfyXGmhmrlbQff2x08fz31G3EbMCbUYeSh4=","Date":"Fri, 8 May 2026 23:03:05 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Javier Tia <floss@jetm.me>","Cc":"libcamera-devel@lists.libcamera.org, mzamazal@redhat.com,\n\tkieran.bingham@ideasonboard.com, barnabas.pocze@ideasonboard.com,\n\trobert.mader@collabora.com","Subject":"Re: [PATCH 1/2] libcamera: libipa: Add right-shift operators to\n\tVector","Message-ID":"<20260508200305.GD2186850@killaraus.ideasonboard.com>","References":"<177826797798.345005.11618565886801750854@jetm.me>\n\t<20260508191941.9DB451EA006C@mailuser.phl.internal>\n\t<20260508200119.GB2186850@killaraus.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20260508200119.GB2186850@killaraus.ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":38833,"web_url":"https://patchwork.libcamera.org/comment/38833/","msgid":"<20260508204358.D331C1EA006C@mailuser.phl.internal>","date":"2026-05-08T20:41:10","subject":"Re: [PATCH 1/2] libcamera: libipa: Add right-shift operators to\n\tVector","submitter":{"id":261,"url":"https://patchwork.libcamera.org/api/people/261/","name":"Javier Tia","email":"floss@jetm.me"},"content":"Hi Laurent,\n\nOn Fri, May 08, 2026 at 11:03:01PM +0300, Laurent Pinchart wrote:\n> On Fri, May 08, 2026 at 11:01:21PM +0300, Laurent Pinchart wrote:\n> > > +\tconstexpr Vector operator>>(unsigned int shift) const\n> > > +\t{\n> > > +\t\tVector result;\n> > > +\t\tstd::transform(data_.begin(), data_.end(), result.data_.begin(),\n> > > +\t\t\t       [shift](T v) { return v >> shift; });\n> > > +\t\treturn result;\n> >\n> > What's the reason to implement this operator differently from the other\n> > ones ?\n\nNo good reason - I should have used apply() from the start. The shift\namount is unsigned int rather than T, which is why I sidestepped apply()\ninitially, but the cleaner fix is to template the scalar apply()\noverloads on the scalar type so they accept any integral type while\nexisting call sites keep deducing U as T.\n\nIn v2 both operators are one-liners on top of apply():\n\n  constexpr Vector operator>>(unsigned int shift) const\n  {\n          return apply(*this, shift, [](T a, unsigned int b) { return a >> b; });\n  }\n\n  Vector &operator>>=(unsigned int shift)\n  {\n          return apply(shift, [](T a, unsigned int b) { return a >> b; });\n  }\n\n> Also, please compile libcamera with documentation=enabled and\n> doc_werror=true.\n\nDone. v2 adds \\fn blocks for both operators in src/libcamera/vector.cpp\nnext to the other arithmetic operator entries, and the build passes\nwith -Ddocumentation=enabled -Ddoc_werror=true.\n\nSending v2 momentarily.\n\nBest,\nJavier","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 9EA0BBDCBD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 May 2026 20:44:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B029063025;\n\tFri,  8 May 2026 22:44:02 +0200 (CEST)","from fout-a2-smtp.messagingengine.com\n\t(fout-a2-smtp.messagingengine.com [103.168.172.145])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 061C162FD3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 May 2026 22:44:00 +0200 (CEST)","from phl-compute-02.internal (phl-compute-02.internal\n\t[10.202.2.42])\n\tby mailfout.phl.internal (Postfix) with ESMTP id 2761AEC034A;\n\tFri,  8 May 2026 16:43:59 -0400 (EDT)","from phl-imap-07 ([10.202.2.97])\n\tby phl-compute-02.internal (MEProxy); Fri, 08 May 2026 16:43:59 -0400","by mailuser.phl.internal (Postfix, from userid 501)\n\tid D331C1EA006C; Fri,  8 May 2026 16:43:58 -0400 (EDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=jetm.me header.i=@jetm.me header.b=\"hexq/txp\";\n\tdkim=pass (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com header.b=\"X9QD6P+m\"; \n\tdkim-atps=neutral","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=jetm.me; h=cc:cc\n\t:content-transfer-encoding:content-type:content-type:date:date\n\t:from:from:in-reply-to:in-reply-to:message-id:mime-version\n\t:references:reply-to:subject:subject:to:to; s=fm2; t=1778273039;\n\tx=1778359439; bh=qn+Bjg7MrxgINtsKJIlVcmAwT/n1XzLs0Ci9v+xUGKo=; b=\n\thexq/txpKJkpugCw1vtUziQ058csYCTxZ0myObtkBu2CyiqPAiDjjJKb8XWc3jKx\n\ttoXcBNVtr7Fc/nolB/CmQIBLL+lj7+zo0zpWb8fTb8kdJda9hGapKsO86hIMzuWv\n\tn8K6Y3KoZtkjp33cbhxP+rm9QyAylI5xXvOe/eMjIWaTfLCc6p3zzZM9V8TQf04J\n\taql8kKtKDm1dGJtrsfKuBHX4NJG/+G5V2QK5xPsVo/oRQ+WvxNbkDbCxxIKloFrZ\n\th1aYACkCXLblG8IouQGau2awpMzT1HPBr3bwT7Ty1BIPoTcZegV1+Us4h8dP8HBe\n\ta/w/WrNUWSlR8DHcrH7WrA==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n\tmessagingengine.com; h=cc:cc:content-transfer-encoding\n\t:content-type:content-type:date:date:feedback-id:feedback-id\n\t:from:from:in-reply-to:in-reply-to:message-id:mime-version\n\t:references:reply-to:subject:subject:to:to:x-me-proxy\n\t:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1778273039; x=\n\t1778359439; bh=qn+Bjg7MrxgINtsKJIlVcmAwT/n1XzLs0Ci9v+xUGKo=; b=X\n\t9QD6P+mEkfFH0fxG3y+P1rcxh8VC2fpTEe/AVkFMgGtCM7YV5NLlS4C5Tel4/kX9\n\tK5Gr8QYn3ATgIfn8fIdkZWA5C9Bc2GnkNBSo1ZyxgRHQOndvbxWag8iEZb+Az8Uk\n\tQZJTt5PWUwsOs2ZDSt39xn2VVRXooOYIWq6S/0ebxEKWwTA41Lzy5AC7pIeR1Nx1\n\tZ+GwqHNnzzWsil50IzfsFt5cgx6uC8TESxPrF0VDUOiBOqlqhjbQEQcZRWzVaWhp\n\tBUm1usggvmvcRyjI9v6xabk2xrXm27pVk82K455W6QObusNT5ifBTFoDWbYS9OG4\n\t7CCKeUtjqAh2YIPcoO8+A=="],"X-ME-Sender":"<xms:Dkv-aey2vGHsxmmxap2pAGuLrGfW9WM18kA6dbCNYV-7ixzwtFGF9A>\n\t<xme:Dkv-aVG-0E5xdnmRmmqbecvHkJT5Pai4_E7JU7-IVhHF1ZXIRBq9Mm2WKrnITZbiV\n\tQMDBOFaOuh5D1klCcTXz24XRdZSms8kp-aTsYg9kIy-EYXHGC5kaSK3>","X-ME-Proxy-Cause":"gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdduuddufeegucetufdoteggodetrf\n\tdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu\n\trghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegopf\n\thokfffucdluddtmdenucfjughrpefotggggffhvfffufevjghfsehtkedttdertdejnecu\n\thfhrohhmpeflrghvihgvrhcuvfhirgcuoehflhhoshhssehjvghtmhdrmhgvqeenucggtf\n\tfrrghtthgvrhhnpedtudejffejkeekteelueefvdejvdeuhfefteehkeevtddvleduteek\n\tleetvdelhfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh\n\thmpehflhhoshhssehjvghtmhdrmhgvpdhnsggprhgtphhtthhopeejpdhmohguvgepshhm\n\tthhpohhuthdprhgtphhtthhopehrohgsvghrthdrmhgruggvrhestgholhhlrggsohhrrg\n\tdrtghomhdprhgtphhtthhopegsrghrnhgrsggrshdrphhotgiivgesihguvggrshhonhgs\n\tohgrrhgurdgtohhmpdhrtghpthhtohepkhhivghrrghnrdgsihhnghhhrghmsehiuggvrg\n\thsohhnsghorghrugdrtghomhdprhgtphhtthhopehlrghurhgvnhhtrdhpihhntghhrghr\n\tthesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepfhhlohhsshesjhgvth\n\thmrdhmvgdprhgtphhtthhopehlihgstggrmhgvrhgrqdguvghvvghlsehlihhsthhsrdhl\n\tihgstggrmhgvrhgrrdhorhhgpdhrtghpthhtohepmhiirghmrgiirghlsehrvgguhhgrth\n\tdrtghomh","X-ME-Proxy":"<xmx:Dkv-aZoVNhlxMRbg85o6KfNJmqTySBderEZiQ_24U5xpZrq-hkGJww>\n\t<xmx:Dkv-acX8FlgCcnk_q2Q6XHFdkQLvrOsbdt19piTPUkzLjZYPnwveKw>\n\t<xmx:Dkv-aUZyM0xeL7Ls6231MCOfjLR9OJKAvGQ_wXlAU1gx2vxvR79VSw>\n\t<xmx:Dkv-aZfrZwnz-qp-rpe1nIbnekZi0zLk_OKwHL31BnhOiGSLEpJ14A>\n\t<xmx:D0v-aeIYy0agl8G-uuEJa7rBoDR7LpLJEF2lvCrL4pDYuUFEJjIg6v9A>","Feedback-ID":"i9dde48b3:Fastmail","X-Mailer":"MessagingEngine.com Webmail Interface","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","From":"Javier Tia <floss@jetm.me>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Date":"Fri, 08 May 2026 14:41:10 -0600","Subject":"Re: [PATCH 1/2] libcamera: libipa: Add right-shift operators to\n\tVector","Cc":"libcamera-devel@lists.libcamera.org, mzamazal@redhat.com,\n\tkieran.bingham@ideasonboard.com, barnabas.pocze@ideasonboard.com,\n\trobert.mader@collabora.com","In-Reply-To":"<20260508200305.GD2186850@killaraus.ideasonboard.com>","References":"<177826797798.345005.11618565886801750854@jetm.me>\n\t<20260508191941.9DB451EA006C@mailuser.phl.internal>\n\t<20260508200119.GB2186850@killaraus.ideasonboard.com>\n\t<20260508200305.GD2186850@killaraus.ideasonboard.com>","Message-Id":"<20260508204358.D331C1EA006C@mailuser.phl.internal>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":38834,"web_url":"https://patchwork.libcamera.org/comment/38834/","msgid":"<20260508205719.GA2386704@killaraus.ideasonboard.com>","date":"2026-05-08T20:57:19","subject":"Re: [PATCH 1/2] libcamera: libipa: Add right-shift operators to\n\tVector","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Fri, May 08, 2026 at 02:41:10PM -0600, Javier Tia wrote:\n> Hi Laurent,\n> \n> On Fri, May 08, 2026 at 11:03:01PM +0300, Laurent Pinchart wrote:\n> > On Fri, May 08, 2026 at 11:01:21PM +0300, Laurent Pinchart wrote:\n> > > > +\tconstexpr Vector operator>>(unsigned int shift) const\n> > > > +\t{\n> > > > +\t\tVector result;\n> > > > +\t\tstd::transform(data_.begin(), data_.end(), result.data_.begin(),\n> > > > +\t\t\t       [shift](T v) { return v >> shift; });\n> > > > +\t\treturn result;\n> > >\n> > > What's the reason to implement this operator differently from the other\n> > > ones ?\n> \n> No good reason - I should have used apply() from the start. The shift\n> amount is unsigned int rather than T, which is why I sidestepped apply()\n> initially,\n\nAh that's a good point.\n\n> but the cleaner fix is to template the scalar apply()\n> overloads on the scalar type so they accept any integral type while\n> existing call sites keep deducing U as T.\n\nHmmm... OK let's see how it goes. This also makes me think we may want a\nstatic_assert in these two new operators to ensure that T is an integer.\n\n> In v2 both operators are one-liners on top of apply():\n> \n>   constexpr Vector operator>>(unsigned int shift) const\n>   {\n>           return apply(*this, shift, [](T a, unsigned int b) { return a >> b; });\n>   }\n> \n>   Vector &operator>>=(unsigned int shift)\n>   {\n>           return apply(shift, [](T a, unsigned int b) { return a >> b; });\n>   }\n> \n> > Also, please compile libcamera with documentation=enabled and\n> > doc_werror=true.\n> \n> Done. v2 adds \\fn blocks for both operators in src/libcamera/vector.cpp\n> next to the other arithmetic operator entries, and the build passes\n> with -Ddocumentation=enabled -Ddoc_werror=true.\n> \n> Sending v2 momentarily.","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 2A266BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 May 2026 20:57:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7A10D62FE1;\n\tFri,  8 May 2026 22:57:22 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D4EC562FD3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 May 2026 22:57:20 +0200 (CEST)","from killaraus.ideasonboard.com\n\t(2001-14ba-70f3-e800--a06.rev.dnainternet.fi\n\t[IPv6:2001:14ba:70f3:e800::a06])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 633F0BCA;\n\tFri,  8 May 2026 22:57:15 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"ggQpwC0j\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1778273835;\n\tbh=XYJAk+V4PhmfOSppLLiH/Ca9U/ocXJqEA5hqjn3RIIs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=ggQpwC0jOfFhmUMt1MURNN3mRdieStMGfbRvXj5jQ2xQXNAme4Q18/NLqI4KsMcGH\n\tNoPBM87Q34YS3P3rOfpe9iRLh7B8uLW4FD/ojp4VpyHWHX4wiTcVpQ63EJ5ulMk8o4\n\tQk5uq4Aku+Mz4uKlL894YMGAzsLQm35TqTLeVnH8=","Date":"Fri, 8 May 2026 23:57:19 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Javier Tia <floss@jetm.me>","Cc":"libcamera-devel@lists.libcamera.org, mzamazal@redhat.com,\n\tkieran.bingham@ideasonboard.com, barnabas.pocze@ideasonboard.com,\n\trobert.mader@collabora.com","Subject":"Re: [PATCH 1/2] libcamera: libipa: Add right-shift operators to\n\tVector","Message-ID":"<20260508205719.GA2386704@killaraus.ideasonboard.com>","References":"<177826797798.345005.11618565886801750854@jetm.me>\n\t<20260508191941.9DB451EA006C@mailuser.phl.internal>\n\t<20260508200119.GB2186850@killaraus.ideasonboard.com>\n\t<20260508200305.GD2186850@killaraus.ideasonboard.com>\n\t<20260508204358.D331C1EA006C@mailuser.phl.internal>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20260508204358.D331C1EA006C@mailuser.phl.internal>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":38835,"web_url":"https://patchwork.libcamera.org/comment/38835/","msgid":"<20260508223743.427E11EA006C@mailuser.phl.internal>","date":"2026-05-08T21:46:16","subject":"Re: [PATCH 1/2] libcamera: libipa: Add right-shift operators to\n\tVector","submitter":{"id":261,"url":"https://patchwork.libcamera.org/api/people/261/","name":"Javier Tia","email":"floss@jetm.me"},"content":"Hi Laurent,\n\nOn Fri, May 08, 2026 at 11:57:19PM +0300, Laurent Pinchart wrote:\n> Hmmm... OK let's see how it goes. This also makes me think we may want a\n> static_assert in these two new operators to ensure that T is an integer.\n\nGood call. v2 1/2 adds static_assert(std::is_integral_v<T>) in both\noperator>> and operator>>= with a message pointing at the operator.","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0EFC7BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 May 2026 22:37:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C543B6302A;\n\tSat,  9 May 2026 00:37:45 +0200 (CEST)","from fhigh-a5-smtp.messagingengine.com\n\t(fhigh-a5-smtp.messagingengine.com [103.168.172.156])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1E6B763021\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  9 May 2026 00:37:44 +0200 (CEST)","from phl-compute-02.internal (phl-compute-02.internal\n\t[10.202.2.42])\n\tby mailfhigh.phl.internal (Postfix) with ESMTP id 624D21400105;\n\tFri,  8 May 2026 18:37:43 -0400 (EDT)","from phl-imap-07 ([10.202.2.97])\n\tby phl-compute-02.internal (MEProxy); Fri, 08 May 2026 18:37:43 -0400","by mailuser.phl.internal (Postfix, from userid 501)\n\tid 427E11EA006C; Fri,  8 May 2026 18:37:43 -0400 (EDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=jetm.me header.i=@jetm.me header.b=\"jWmCqyhV\";\n\tdkim=pass (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com header.b=\"QtiRaM3P\"; \n\tdkim-atps=neutral","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=jetm.me; h=cc:cc\n\t:content-transfer-encoding:content-type:content-type:date:date\n\t:from:from:in-reply-to:in-reply-to:message-id:mime-version\n\t:references:reply-to:subject:subject:to:to; s=fm2; t=1778279863;\n\tx=1778366263; bh=ZUD4OArNFiBUlK44COevwjeKudT8ICjeJ5lOPp8oLXo=; b=\n\tjWmCqyhVB5jCCg+zWMZTSrZJiH+Efwe+hz7Xth4IVn6mYmF4FtJhuChukZIThlsv\n\tSoizwfYEk4Bvb7Qp/HK6oqbn3706MZonVq1dqwlu5DYkrseMe4+iKezY2tgXEWo1\n\taCtAHqTWAlMHGgODhj6V8rv+7WaXKnHMJj4DKCddGZSuNgBz0AOKJZKb5rjltk3z\n\tAKe87plqmGGs0b16lGdZGRCQ1TGaFIREeYph5Ha1rU9XV7vmfm0E20ibx/6qgBzN\n\tn2oVFJ4ZluUGCY3nnBmGe4Ch9a7Bracxil1uVchzxdFE3uB+4fJKpiJbbW0Smgpt\n\tu+yw7634mazdvt08qPMuzQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n\tmessagingengine.com; h=cc:cc:content-transfer-encoding\n\t:content-type:content-type:date:date:feedback-id:feedback-id\n\t:from:from:in-reply-to:in-reply-to:message-id:mime-version\n\t:references:reply-to:subject:subject:to:to:x-me-proxy\n\t:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1778279863; x=\n\t1778366263; bh=ZUD4OArNFiBUlK44COevwjeKudT8ICjeJ5lOPp8oLXo=; b=Q\n\ttiRaM3PRSBur4o5aXHYeQdbQ6TEHMP/ci4vMTbV26kJG74uUzQhG0+ETpVdgeFW9\n\tQ52HTBLheVum6ViolrSVT/Bl8y2Vkd6c8kfBSVM4oOxIL0KLm3ENYCdNlaaWpTNe\n\tQ0/FMa1bT61O++2JemfTj3/3ch34BHYqs93OW/SoEXNKrI1k34EBVwcCBhc4Uaqu\n\ttSsLR7qA96b1dlOByJZ4dC0AnyYtLk6EoLnRWZ8SlBaUBNLDIlok4ipwvQb/7J1d\n\twxP6ZwwsSe1RlUFlWuY+gDnVDv78K31JEFuRYQhv/2xVzYVIIbPjQaIB82Jd2nx1\n\t2otdCI6eOFJcIYpQmuFHA=="],"X-ME-Sender":"<xms:t2X-aS-mJKi3IDn3BiLwmoQw_g-R_LGm1lZnsuSusurwDFGGfbYDAw>\n\t<xme:t2X-adjPy1UMyQmlIdAvUcvWu9elLNIPgmr2-hhL-nUdNELtwy7bqhfhvbokn8l5X\n\tlMfZt8N90KmI2GUwZaDnS-XjjleJK0MFcVVJicdeWYvzYbAVfUnwKk>","X-ME-Proxy-Cause":"gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdduudduheejucetufdoteggodetrf\n\tdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu\n\trghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegopf\n\thokfffucdluddtmdenucfjughrpefotggggffhvfffufevjghfsehtkedttdertdejnecu\n\thfhrohhmpeflrghvihgvrhcuvfhirgcuoehflhhoshhssehjvghtmhdrmhgvqeenucggtf\n\tfrrghtthgvrhhnpedtudejffejkeekteelueefvdejvdeuhfefteehkeevtddvleduteek\n\tleetvdelhfenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhroh\n\thmpehflhhoshhssehjvghtmhdrmhgvpdhnsggprhgtphhtthhopeejpdhmohguvgepshhm\n\tthhpohhuthdprhgtphhtthhopehrohgsvghrthdrmhgruggvrhestgholhhlrggsohhrrg\n\tdrtghomhdprhgtphhtthhopegsrghrnhgrsggrshdrphhotgiivgesihguvggrshhonhgs\n\tohgrrhgurdgtohhmpdhrtghpthhtohepkhhivghrrghnrdgsihhnghhhrghmsehiuggvrg\n\thsohhnsghorghrugdrtghomhdprhgtphhtthhopehlrghurhgvnhhtrdhpihhntghhrghr\n\tthesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepfhhlohhsshesjhgvth\n\thmrdhmvgdprhgtphhtthhopehlihgstggrmhgvrhgrqdguvghvvghlsehlihhsthhsrdhl\n\tihgstggrmhgvrhgrrdhorhhgpdhrtghpthhtohepmhiirghmrgiirghlsehrvgguhhgrth\n\tdrtghomh","X-ME-Proxy":"<xmx:t2X-aaV-mUyojYt3VH3sG7Xh6ap6DIFz-R3VmYoCXgJhFK4Xfk94SQ>\n\t<xmx:t2X-aXSY7ungQ5Ts1ZU6VT_tK1VWfA5lCTRKyW_MQeKYizlHhrNeow>\n\t<xmx:t2X-acn1M2J11zN2dcv3urn8xLIpZFeKyD2b0a3OHyI7ouhsOLsugA>\n\t<xmx:t2X-aV6ci7SpLwDDRDjxIv1Wf6NbadubdxA3tSKX0IRTfOT0hrdrwg>\n\t<xmx:t2X-aZ3aWOq-2DD2lpPKsVNbagyKOTKLGTRmQ4LcV0Qr7qqpftsNVJ9z>","Feedback-ID":"i9dde48b3:Fastmail","X-Mailer":"MessagingEngine.com Webmail Interface","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","From":"Javier Tia <floss@jetm.me>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Date":"Fri, 08 May 2026 15:46:16 -0600","Subject":"Re: [PATCH 1/2] libcamera: libipa: Add right-shift operators to\n\tVector","Cc":"libcamera-devel@lists.libcamera.org, mzamazal@redhat.com,\n\tkieran.bingham@ideasonboard.com, barnabas.pocze@ideasonboard.com,\n\trobert.mader@collabora.com","In-Reply-To":"<20260508205719.GA2386704@killaraus.ideasonboard.com>","References":"<177826797798.345005.11618565886801750854@jetm.me>\n\t<20260508191941.9DB451EA006C@mailuser.phl.internal>\n\t<20260508200119.GB2186850@killaraus.ideasonboard.com>\n\t<20260508200305.GD2186850@killaraus.ideasonboard.com>\n\t<20260508204358.D331C1EA006C@mailuser.phl.internal>\n\t<20260508205719.GA2386704@killaraus.ideasonboard.com>","Message-Id":"<20260508223743.427E11EA006C@mailuser.phl.internal>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]