{"id":14260,"url":"https://patchwork.libcamera.org/api/1.1/patches/14260/?format=json","web_url":"https://patchwork.libcamera.org/patch/14260/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20211022143907.3089419-2-naush@raspberrypi.com>","date":"2021-10-22T14:39:02","name":"[libcamera-devel,v2,1/6] libcamera: bayer_format: Add a toPixelFormat() helpers to the BayerFormat class","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"9ba95161fef3b8fc5b7bf086f520b156ef38439a","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14260/mbox/","series":[{"id":2650,"url":"https://patchwork.libcamera.org/api/1.1/series/2650/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2650","date":"2021-10-22T14:39:01","name":"Raspberry Pi: Conversion to media controller","version":2,"mbox":"https://patchwork.libcamera.org/series/2650/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14260/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14260/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 E71BBBDB1C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Oct 2021 14:40:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 89E7668F5F;\n\tFri, 22 Oct 2021 16:40:16 +0200 (CEST)","from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com\n\t[IPv6:2a00:1450:4864:20::32f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D10346023B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Oct 2021 16:40:13 +0200 (CEST)","by mail-wm1-x32f.google.com with SMTP id\n\tz11-20020a1c7e0b000000b0030db7b70b6bso3665019wmc.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Oct 2021 07:40:13 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:f00d:ddf0:61b0:a4cd])\n\tby smtp.gmail.com with ESMTPSA id\n\tr205sm8577878wma.3.2021.10.22.07.40.12\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 22 Oct 2021 07:40:12 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"jET7vTux\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=mi1BmveZO0MDVL5rAfXrj96e0ld5nDzmh+AbmduPjhM=;\n\tb=jET7vTuxFjUYaUUm/WFUJNSVo+SB7CcF4uLj/nZdhepNpmiKs8DurCm9Pdk/V/xGfH\n\tbgfwKCesbcx0b3JlXUdRoI1DG5T2RyBNIYYGZXDXvqjyaimiVmDa/tXQE1tB5vS4hFpz\n\tw+qCQPd0y1xNjUPcbEotBMIAt1ph694e5dPxELpkQPyFiUnvRaMhREQB5f/jnVbnma8C\n\tHK9gkvGByCVOPnNS9qq5RbTcmAYgn1cqElm4fir43FLxDj5nmdLUKdb/qIUvTEyoNNCn\n\tVKdgGD4C5kmS4+vml8EBHBAa56Ji8Lu2gCaoA9N4yi2/2goVqslZjLIVKJC13/A+a0cr\n\tRD3g==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=mi1BmveZO0MDVL5rAfXrj96e0ld5nDzmh+AbmduPjhM=;\n\tb=CxqMXas//3DiU5wNTGSbWIIUHqetcedK3QdjyNsVp/s5snYbhTrjvtiHnZCK5XZxIv\n\txjtIbp1Z13dL/CU3PM0Vn4XTBOzx56KzL6U/t3Yix4coX+3EceORI0rzdi57ofjlKO9c\n\t+wSKrKJjSp1OepGv/jk/5i5MTEO49ebphcKJSwkHExbH7j7QhLfyt4WKvi8+o6vjuCos\n\tF4wNzR3EFyo9kLU7XyACIRBQ+Uzk6e9ZRNiY0hWUiQdONF0VCO1T3+dLT0m5e99/ouo9\n\tTQt71PE5sym5Eo8AnIYEssW0B/pMi1F0NuhLuWch6H+X2Cgvtf6jAfIooCkA8zCy2g/d\n\t7PtA==","X-Gm-Message-State":"AOAM532HAKocxZsjx8ML4JTHPtO0SXbWfJRS0hfgvBZwf6nH3AUYFopd\n\tDNzwXkQ/fWg/PhZZ+La2QGH38OmvoY4oEUI7","X-Google-Smtp-Source":"ABdhPJzj1e0J7sS9TmES0mGZ8M8uEpC9UAJcB6MFnydQuK4efryMW6v9j2r1ShnEXhCvXe10mdP5Qw==","X-Received":"by 2002:a05:600c:3b88:: with SMTP id\n\tn8mr119428wms.93.1634913613400; \n\tFri, 22 Oct 2021 07:40:13 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri, 22 Oct 2021 15:39:02 +0100","Message-Id":"<20211022143907.3089419-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20211022143907.3089419-1-naush@raspberrypi.com>","References":"<20211022143907.3089419-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 1/6] libcamera: bayer_format: Add a\n\ttoPixelFormat() helpers to the BayerFormat class","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 a BayerFormat::toPixelFormat() member function to convert a BayerFormat to a\nPixelFormat type. This conversion uses the existing bayerToV4l2 conversion\ntable.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n include/libcamera/internal/bayer_format.h |  3 +++\n src/libcamera/bayer_format.cpp            | 13 +++++++++++++\n 2 files changed, 16 insertions(+)","diff":"diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\nindex 723382d4168d..247a60cf0e36 100644\n--- a/include/libcamera/internal/bayer_format.h\n+++ b/include/libcamera/internal/bayer_format.h\n@@ -10,6 +10,8 @@\n #include <stdint.h>\n #include <string>\n \n+#include <libcamera/pixel_format.h>\n+\n #include \"libcamera/internal/v4l2_pixelformat.h\"\n \n namespace libcamera {\n@@ -50,6 +52,7 @@ public:\n \n \tV4L2PixelFormat toV4L2PixelFormat() const;\n \tstatic BayerFormat fromV4L2PixelFormat(V4L2PixelFormat v4l2Format);\n+\tPixelFormat toPixelFormat() const;\n \tBayerFormat transform(Transform t) const;\n \n \tOrder order;\ndiff --git a/src/libcamera/bayer_format.cpp b/src/libcamera/bayer_format.cpp\nindex 11355f144f66..c662ba36604c 100644\n--- a/src/libcamera/bayer_format.cpp\n+++ b/src/libcamera/bayer_format.cpp\n@@ -269,6 +269,19 @@ BayerFormat BayerFormat::fromV4L2PixelFormat(V4L2PixelFormat v4l2Format)\n \treturn BayerFormat();\n }\n \n+/**\n+ * \\brief Convert a BayerFormat into the corresponding PixelFormat\n+ * \\return The PixelFormat corresponding to this BayerFormat\n+ */\n+PixelFormat BayerFormat::toPixelFormat() const\n+{\n+\tconst auto it = bayerToV4l2.find(*this);\n+\tif (it != bayerToV4l2.end())\n+\t\treturn PixelFormat(it->second);\n+\n+\treturn PixelFormat();\n+}\n+\n /**\n  * \\brief Apply a transform to this BayerFormat\n  * \\param[in] t The transform to apply\n","prefixes":["libcamera-devel","v2","1/6"]}