Show a patch.

GET /api/patches/26702/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 26702,
    "url": "https://patchwork.libcamera.org/api/patches/26702/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26702/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20260508191941.9DB451EA006C@mailuser.phl.internal>",
    "date": "2026-05-08T19:19:25",
    "name": "[1/2] libcamera: libipa: Add right-shift operators to Vector",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "a3fd04bf6ed88e4c2a25bab19b01070640c12501",
    "submitter": {
        "id": 261,
        "url": "https://patchwork.libcamera.org/api/people/261/?format=api",
        "name": "Javier Tia",
        "email": "floss@jetm.me"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26702/mbox/",
    "series": [
        {
            "id": 5927,
            "url": "https://patchwork.libcamera.org/api/series/5927/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5927",
            "date": "2026-05-08T19:19:13",
            "name": "libcamera: Vector right-shift operators and SwStatsCpu use site",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5927/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26702/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26702/checks/",
    "tags": {},
    "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 74718C32F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  8 May 2026 19:19:46 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4199163025;\n\tFri,  8 May 2026 21:19:44 +0200 (CEST)",
            "from fhigh-a2-smtp.messagingengine.com\n\t(fhigh-a2-smtp.messagingengine.com [103.168.172.153])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 74BED62FEA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  8 May 2026 21:19:42 +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 BC4D414000E1;\n\tFri,  8 May 2026 15:19:41 -0400 (EDT)",
            "from phl-imap-07 ([10.202.2.97])\n\tby phl-compute-02.internal (MEProxy); Fri, 08 May 2026 15:19:41 -0400",
            "by mailuser.phl.internal (Postfix, from userid 501)\n\tid 9DB451EA006C; Fri,  8 May 2026 15:19:41 -0400 (EDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=jetm.me header.i=@jetm.me header.b=\"WtCjh+X/\";\n\tdkim=pass (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com header.b=\"DvLtISIn\"; \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=1778267981;\n\tx=1778354381; bh=lgsJYtARUo3uiB8kvm5L7vqQwr7PVbssQxgHzP8KrxM=; b=\n\tWtCjh+X/roVhluKhD+BVqWAS5XaWI4O7tf23vqI6fHvhtG1HTn8ZH3SQ9cZaRnYj\n\tIwPoliAOc30QlxzM5Xgxrex5wmx1i9w/BWvGp5SNdoN0wt93SphXwCptxo4Hj5RR\n\txqNFwoPB50Pg6/KU6EI4KDLa70DfxJ1E8tRchqT4/0HD5Cx4teIWKjbjWXxYr6K9\n\tOflVpAOjRSKaMOM1rvxsnV5MBD5JoaIF0OEgJhdlkkpf+OImwG7fca8GzaS+CYMI\n\tP18RwEAl6aoUSsStLUWw9XGGrDABefa7NJyC+YKw/AQO4b2CzGzaFsdGpZKBxSu7\n\tdMk3Kns7HE2IwHN5+KkOUw==",
            "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=1778267981; x=\n\t1778354381; bh=lgsJYtARUo3uiB8kvm5L7vqQwr7PVbssQxgHzP8KrxM=; b=D\n\tvLtISInPNxkAQG1brnSywS8kLpL4/wse7YWcVdzxhQalfI7QbIIxOw3KvwExpFRp\n\ty4DNoIEeU67PWnklSDrJ1TZbkzUqwGUT/JoeR6JXoeyZsx88ZYUMO+8HFFMYLFql\n\tzStbOQzsraZUhnkUdBBxUPdJLXGo2D2bsId6/b8EVlczWuB77wkXZef1wKTWz4Dm\n\tCnjvJCITQs9aLt4g6t1Y+fRjdq1c+f4HEhxdbHYlqmLAQ4SuyL8ZglUIHZyVmFld\n\t4rp++D4G4qcgUxaLWmdsiEC9/xCpnSsIaoexEFMdP2JPJSs/Od6PDV6PqOKAYXzi\n\tN4SvyNFtojS1UBL3ObIJw=="
        ],
        "X-ME-Sender": "<xms:TTf-aZzmuFCPZPZDWRKZvZRJqIo3a5o9DU3N-Zz4PzBHErF78TSaBQ>\n\t<xme:TTf-aUEsSTnQi7l-2gS8vj7bw03quLEkgYw2-ar3QILNaXh-hg7mFZkAfHBeI4neH\n\tEsYBOqWnvzWSJIUmE-aEopDELdm1XYplhkpIikCk8SlmC2hGrw09Q>",
        "X-ME-Proxy-Cause": "gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdduudduudekucetufdoteggodetrf\n\tdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu\n\trghilhhouhhtmecufedttdenucgopfhokfffucdluddtmdenucfjughrpefotggggffhvf\n\tffufevjghfsehtkedttdertdejnecuhfhrohhmpeflrghvihgvrhcuvfhirgcuoehflhho\n\tshhssehjvghtmhdrmhgvqeenucggtffrrghtthgvrhhnpedtudejffejkeekteelueefvd\n\tejvdeuhfefteehkeevtddvleduteekleetvdelhfenucevlhhushhtvghrufhiiigvpedt\n\tnecurfgrrhgrmhepmhgrihhlfhhrohhmpehflhhoshhssehjvghtmhdrmhgvpdhnsggprh\n\tgtphhtthhopeejpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehrohgsvghrthdr\n\tmhgruggvrhestgholhhlrggsohhrrgdrtghomhdprhgtphhtthhopegsrghrnhgrsggrsh\n\tdrphhotgiivgesihguvggrshhonhgsohgrrhgurdgtohhmpdhrtghpthhtohepkhhivghr\n\trghnrdgsihhnghhhrghmsehiuggvrghsohhnsghorghrugdrtghomhdprhgtphhtthhope\n\thlrghurhgvnhhtrdhpihhntghhrghrthesihguvggrshhonhgsohgrrhgurdgtohhmpdhr\n\ttghpthhtohepfhhlohhsshesjhgvthhmrdhmvgdprhgtphhtthhopehlihgstggrmhgvrh\n\tgrqdguvghvvghlsehlihhsthhsrdhlihgstggrmhgvrhgrrdhorhhgpdhrtghpthhtohep\n\tmhiirghmrgiirghlsehrvgguhhgrthdrtghomh",
        "X-ME-Proxy": "<xmx:TTf-aco15huXYZ-ltUNftSSe-UX3nxnZPlYVxcmQg97CJy8-RQYY8g>\n\t<xmx:TTf-aTXRPwZBHGaZHZKKsKf7u7lMoB-Km9qxzxzHwCpVGIav3d8iBw>\n\t<xmx:TTf-afaFshkH0LENfhIez_PIrWEPLV2GIghhT0oRGJaO43YzHoTgUA>\n\t<xmx:TTf-aYdtc3p8RMTdGiBrlgqinWYa1hAncyE3k-J-I5hmYNVzU16E-g>\n\t<xmx:TTf-aRK8DRmvbJjp0yos7ar0BpzmLBST8oB6U62YQWabpVhkuuNX1lZn>",
        "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": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 08 May 2026 13:19:25 -0600",
        "Subject": "[PATCH 1/2] libcamera: libipa: Add right-shift operators to Vector",
        "Cc": "mzamazal@redhat.com, kieran.bingham@ideasonboard.com,\n\tlaurent.pinchart@ideasonboard.com, barnabas.pocze@ideasonboard.com,\n\trobert.mader@collabora.com",
        "In-Reply-To": "<177826797798.345005.11618565886801750854@jetm.me>",
        "References": "<177826797798.345005.11618565886801750854@jetm.me>",
        "Message-Id": "<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>"
    },
    "content": "Add operator>> and operator>>= for right-shifting all elements by a\nscalar shift amount. Both operate element-wise: operator>> returns a\nnew Vector with each element shifted, operator>>= shifts in place and\nreturns a reference to *this.\n\nThe motivating use case is SwStatsCpu::finishFrame(), which right-shifts\nthree individual components of the RGB sum by the same sumShift_ value.\nWith these operators that becomes a single sum_ >>= sumShift_ expression.\n\nSuggested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\nSuggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Javier Tia <floss@jetm.me>\n---\n include/libcamera/internal/vector.h | 15 +++++++++++++++\n 1 file changed, 15 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/vector.h b/include/libcamera/internal/vector.h\nindex 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+\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); });\n",
    "prefixes": [
        "1/2"
    ]
}