{"id":11027,"url":"https://patchwork.libcamera.org/api/patches/11027/?format=json","web_url":"https://patchwork.libcamera.org/patch/11027/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210126184854.46156-5-sebastian.fricke@posteo.net>","date":"2021-01-26T18:48:53","name":"[libcamera-devel,v3,4/5] libcamera: Add the transpose transformation","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"355d540f6fe78a342a8befbc6a88233762a99728","submitter":{"id":78,"url":"https://patchwork.libcamera.org/api/people/78/?format=json","name":"Sebastian Fricke","email":"sebastian.fricke@posteo.net"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11027/mbox/","series":[{"id":1613,"url":"https://patchwork.libcamera.org/api/series/1613/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1613","date":"2021-01-26T18:48:49","name":"Improve BayerFormat class","version":3,"mbox":"https://patchwork.libcamera.org/series/1613/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11027/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11027/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 82FEBC0F2B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 26 Jan 2021 18:49:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2E67F68331;\n\tTue, 26 Jan 2021 19:49:16 +0100 (CET)","from mout02.posteo.de (mout02.posteo.de [185.67.36.66])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EB7B86831D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jan 2021 19:49:13 +0100 (CET)","from submission (posteo.de [89.146.220.130]) \n\tby mout02.posteo.de (Postfix) with ESMTPS id 8C7F62400FF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 26 Jan 2021 19:49:13 +0100 (CET)","from customer (localhost [127.0.0.1])\n\tby submission (posteo.de) with ESMTPSA id 4DQG3r6Z6dz6tm8;\n\tTue, 26 Jan 2021 19:49:12 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=posteo.net header.i=@posteo.net\n\theader.b=\"SjgioRzT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;\n\tt=1611686953; bh=FNWKW/f0pRuFSFWTBHX5dD9QOT5+GCUXbyd0LRC3eyI=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=SjgioRzTEklb4SJD+zDN8OnKREJQ8uNhTgHmoSUbf7chfQ5TaPHS5s0dwrPTy5Ujo\n\t+Z8ZYjWL29yZDcCaP1vXmBEmjT5QXN5KWts4k8PsR4N/xr39VcWZw9iV9Ue4f/RPPJ\n\teEt9H3TQxnWaZdtVk9HD07+EDgHHcX8CVPv8jcf7G1g8Rshz+OxemHT5rI9vFtkdBn\n\ts9omU0Co42+0OM0qBjMDCPsptSlOenAmQ1aR+1PYeTojmgO0C/FLEWU7JPTCUljdhd\n\t3uYUigPTwkHlLG/Bkc9MObZmpL3EFcrwJKd+iFroBCa1PqlCcwWoft9S/An5+VaFNT\n\tNYXcc4jPuxifQ==","From":"Sebastian Fricke <sebastian.fricke@posteo.net>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 26 Jan 2021 19:48:53 +0100","Message-Id":"<20210126184854.46156-5-sebastian.fricke@posteo.net>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20210126184854.46156-1-sebastian.fricke@posteo.net>","References":"<20210126184854.46156-1-sebastian.fricke@posteo.net>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v3 4/5] libcamera: Add the transpose\n\ttransformation","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"To transpose a BayerFormat means to flip it over its main-diagonal.\n\nFor example:\nG B    G R\n    ->\nR G    B G\n\nThe main-diagonal goes from the top left to the bottom right.\nThis means, that the only two orders affected by a transpose\nare GBRG & GRBG. When a transpose is used in combination with horizontal\nand/or vertical flips it is performed with the lowest priority.\nTherefore add the functionality by switching GBRG (index 1) with GRBG\n(index 2), after the flips have been applied.\n\nSigned-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>\n---\n src/libcamera/bayer_format.cpp | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)","diff":"diff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\nindex d4e7f142..e06cd6e8 100644\n--- a/src/libcamera/bayer_format.cpp\n+++ b/src/libcamera/bayer_format.cpp\n@@ -272,10 +272,6 @@ BayerFormat BayerFormat::fromV4L2PixelFormat(V4L2PixelFormat v4l2Format)\n  * The transformed image would have a GRBG order. The bit depth and modifiers\n  * are not affected.\n  *\n- * Note that transpositions are ignored as the order of a transpose with\n- * respect to the flips would have to be defined, and sensors are not expected\n- * to support transposition.\n- *\n  * \\return The transformed Bayer format\n  */\n BayerFormat BayerFormat::transform(Transform t) const\n@@ -292,6 +288,11 @@ BayerFormat BayerFormat::transform(Transform t) const\n \tif (!!(t & Transform::VFlip))\n \t\tresult.order = static_cast<Order>(result.order ^ 2);\n \n+\tif (!!(t & Transform::Transpose) && result.order == 1)\n+\t\tresult.order = static_cast<Order>(2);\n+\telse if (!!(t & Transform::Transpose) && result.order == 2)\n+\t\tresult.order = static_cast<Order>(1);\n+\n \treturn result;\n }\n \n","prefixes":["libcamera-devel","v3","4/5"]}