{"id":10698,"url":"https://patchwork.libcamera.org/api/patches/10698/?format=json","web_url":"https://patchwork.libcamera.org/patch/10698/","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":"<20201223121055.14178-2-sebastian.fricke.linux@gmail.com>","date":"2020-12-23T12:10:54","name":"[libcamera-devel,1/2] libcamera: Add the fromV4L2PixelFormat method","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"ca6fe65f65bf38828c8e4cd1ce53652bb22e1d28","submitter":{"id":73,"url":"https://patchwork.libcamera.org/api/people/73/?format=json","name":"Sebastian Fricke","email":"sebastian.fricke.linux@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10698/mbox/","series":[{"id":1542,"url":"https://patchwork.libcamera.org/api/series/1542/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1542","date":"2020-12-23T12:10:53","name":"Improve BayerFormat class","version":1,"mbox":"https://patchwork.libcamera.org/series/1542/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10698/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10698/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 A1FBDC0F1A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 23 Dec 2020 12:11:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 717AC60529;\n\tWed, 23 Dec 2020 13:11:17 +0100 (CET)","from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n\t[IPv6:2a00:1450:4864:20::331])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CABF460527\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Dec 2020 13:11:15 +0100 (CET)","by mail-wm1-x331.google.com with SMTP id 3so5942526wmg.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Dec 2020 04:11:15 -0800 (PST)","from basti.fritz.box\n\t(p200300d1ff2be200e1a8f8b471c12212.dip0.t-ipconnect.de.\n\t[2003:d1:ff2b:e200:e1a8:f8b4:71c1:2212])\n\tby smtp.gmail.com with ESMTPSA id\n\tu6sm36787733wrm.90.2020.12.23.04.11.14\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 23 Dec 2020 04:11:15 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"X3r3K2iZ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=CAC/Tm4ejwSsZarJXbXK7kFPNNrqy+c4VbTAK8m4opA=;\n\tb=X3r3K2iZ3OVSKqVI/+okq46QaI1r0BtFYNCvhlZ1r6NxCP16cwEqYuqvewyph2vxfc\n\tTYSEjDQtXzeEJNg8lR3pKwiYhuqZZd2hkwdUnhsImQcSBSWMbhRR+bKrxr0LitL6GvV8\n\tKHDfmEg90543mli2QPFfF68WdprYGq6YV88HGR5RzfPu8YmpFw1ukz66P2KsvYM2onzn\n\tLk5g8DSBPF5X6tRpj0/VnZyKS/fSlyRi9szQa4g0elgEtACec2EWRedblVtMJWD7aTa8\n\tLlz/fVURWRcqXofI0d5VmKq5FFRfvrkHJpbspfEDUDmwSEhQcvR3w+++kyiTdvw4OcNa\n\tHXfw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\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=CAC/Tm4ejwSsZarJXbXK7kFPNNrqy+c4VbTAK8m4opA=;\n\tb=f/ikVA5JbXv69MAKDGWo8odgggW1s9Jz5ixxpasaucjcbyGrI73Q50IprLZxcAV4g8\n\twmfsb/3oiAJ64Y1v5Mj6QpMuJDVXJBnB1GEMuhlCye0ITvkFpRezVUVx1REcyfVjnCB9\n\tYIsrK1TBylMMmMfI+NEUMLcUURHx/3Bxfx4Iq4wH0+6t45BkHCT5OzSbmDbVUnrS/cdY\n\th+4geNMskfxStU1eFndChWVCTRTF2QdNO+5lcrb2qcTSaev4wsHOxQjHzASIOhBxVXRM\n\tMcpU8eWMsUt7IYHC6Ebu8GBZcdtKik3h7NQYRbxn7rOAwTRUYFqSPra8SeExr1ILROzM\n\tn/DQ==","X-Gm-Message-State":"AOAM531ndF1rFtAXVOEYxGWmp0Hb6oOMwObuYdFTbc1F5d/ZZPLNYHUe\n\t5fPgvGtr/Axl2QWIUJt7WaD9dnrHIlWQpw==","X-Google-Smtp-Source":"ABdhPJxlj+iyaahbanRyrcrfryl88G27i0+JlsiGf0v4o6Ouhn2ebpTutKxSzYvM1joxZ50aGBpmFQ==","X-Received":"by 2002:a1c:6a10:: with SMTP id\n\tf16mr26279242wmc.106.1608725475651; \n\tWed, 23 Dec 2020 04:11:15 -0800 (PST)","From":"Sebastian Fricke <sebastian.fricke.linux@gmail.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 23 Dec 2020 13:10:54 +0100","Message-Id":"<20201223121055.14178-2-sebastian.fricke.linux@gmail.com>","X-Mailer":"git-send-email 2.29.2","In-Reply-To":"<20201223121055.14178-1-sebastian.fricke.linux@gmail.com>","References":"<20201223121055.14178-1-sebastian.fricke.linux@gmail.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 1/2] libcamera: Add the\n\tfromV4L2PixelFormat method","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":"Add the method to get the corresponding bayer-format from a given\nV4L2-pixel-format. Uses the existing mapping table.\n\nSigned-off-by: Sebastian Fricke <sebastian.fricke.linux@gmail.com>\n---\n include/libcamera/internal/bayer_format.h |  1 +\n src/libcamera/bayer_format.cpp            | 14 ++++++++++++++\n 2 files changed, 15 insertions(+)","diff":"diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h\nindex 4280b76b..a8060029 100644\n--- a/include/libcamera/internal/bayer_format.h\n+++ b/include/libcamera/internal/bayer_format.h\n@@ -48,6 +48,7 @@ public:\n \tstd::string toString() const;\n \n \tV4L2PixelFormat toV4L2PixelFormat() const;\n+\tBayerFormat fromV4L2PixelFormat(V4L2PixelFormat v4l2Format) 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 c42792ff..f4f0e8ca 100644\n--- a/src/libcamera/bayer_format.cpp\n+++ b/src/libcamera/bayer_format.cpp\n@@ -217,6 +217,20 @@ V4L2PixelFormat BayerFormat::toV4L2PixelFormat() const\n \treturn V4L2PixelFormat();\n }\n \n+/**\n+ * \\brief Convert a V4L2PixelFormat into the corresponding BayerFormat\n+ * \\param[in] v4l2Format The raw format to convert into a BayerFormat\n+ * \\return The BayerFormat corresponding to the V4L2PixelFormat parameter\n+ */\n+BayerFormat BayerFormat::fromV4L2PixelFormat(V4L2PixelFormat v4l2Format) const\n+{\n+\tconst auto it = v4l2ToBayer.find(v4l2Format);\n+\tif (it != v4l2ToBayer.end())\n+\t        return it->second;\n+\n+\treturn BayerFormat();\n+}\n+\n /**\n  * \\brief Apply a transform to this BayerFormat\n  * \\param[in] t The transform to apply\n","prefixes":["libcamera-devel","1/2"]}