[{"id":26140,"web_url":"https://patchwork.libcamera.org/comment/26140/","msgid":"<aeb18f80a76778f99db08d3600036e34257024cc.camel@ndufresne.ca>","date":"2022-12-23T15:51:33","subject":"Re: [libcamera-devel] [PATCH] Add bayer8 support to gstlibcamera","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"content":"Lets make proper review ;-P\n\nnit: On the tile, I'd prefix with \"gstreamer: ...\", as this has been the most\ncommon tiled in patches, make search really easy.\n\nLe mercredi 21 décembre 2022 à 18:43 +0100, Pavel Machek a écrit :\n> Bayer8 support is useful on hardware such as Librem 5, as gstreamer\n\nnit: s/gstreamer/GStreamer\n\n> provides easy solution for debayering and display of the camera\n> data. Add neccessary glue to gstlibcamera.\n\nnit: s/gstlibcamera/libcamerasrc element/\n\n> \n> Signed-off-by: Pavel Machek <pavel@ucw.cz>\n> \n> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\n> index 36b9564c..b2cc7661 100644\n> --- a/src/gstreamer/gstlibcamera-utils.cpp\n> +++ b/src/gstreamer/gstlibcamera-utils.cpp\n> @@ -20,6 +20,12 @@ static struct {\n>  \t/* Compressed */\n>  \t{ GST_VIDEO_FORMAT_ENCODED, formats::MJPEG },\n>  \n> +\t/* Bayer formats, gstreamer only supports 8-bit */\n> +\t{ GST_VIDEO_FORMAT_ENCODED, formats::SGRBG8 },\n> +\t{ GST_VIDEO_FORMAT_ENCODED, formats::SGBRG8 },\n> +\t{ GST_VIDEO_FORMAT_ENCODED, formats::SRGGB8 },\n> +\t{ GST_VIDEO_FORMAT_ENCODED, formats::SBGGR8 },\n> +\n>  \t/* RGB16 */\n>  \t{ GST_VIDEO_FORMAT_RGB16, formats::RGB565 },\n>  \n> @@ -228,6 +234,22 @@ gst_format_to_pixel_format(GstVideoFormat gst_format)\n>  \treturn PixelFormat{};\n>  }\n>  \n> +static const gchar *\n> +bayer_format_to_string(int format)\n> +{\n> +\tswitch (format) {\n> +\tcase formats::SGRBG8:\n> +\t\treturn \"grbg\";\n> +\tcase formats::SGBRG8:\n> +\t\treturn \"gbrg\";\n> +\tcase formats::SRGGB8:\n> +\t\treturn \"rggb\";\n> +\tcase formats::SBGGR8:\n> +\t\treturn \"bggr\";\n> +\t}\n> +\treturn NULL;\n> +}\n> +\n>  static GstStructure *\n>  bare_structure_from_format(const PixelFormat &format)\n>  {\n> @@ -243,6 +265,12 @@ bare_structure_from_format(const PixelFormat &format)\n>  \tswitch (format) {\n>  \tcase formats::MJPEG:\n>  \t\treturn gst_structure_new_empty(\"image/jpeg\");\n> +\tcase formats::SGRBG8:\n> +\tcase formats::SGBRG8:\n> +\tcase formats::SRGGB8:\n> +\tcase formats::SBGGR8:\n> +\t\treturn gst_structure_new(\"video/x-bayer\", \"format\", G_TYPE_STRING,\n> +\t\t\t\t\t bayer_format_to_string(format), nullptr);\n>  \tdefault:\n>  \t\treturn nullptr;\n>  \t}\n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\n> index 8d97d7c2..2ceeeb99 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -161,7 +161,7 @@ G_DEFINE_TYPE_WITH_CODE(GstLibcameraSrc, gst_libcamera_src, GST_TYPE_ELEMENT,\n>  \t\t\tGST_DEBUG_CATEGORY_INIT(source_debug, \"libcamerasrc\", 0,\n>  \t\t\t\t\t\t\"libcamera Source\"))\n>  \n> -#define TEMPLATE_CAPS GST_STATIC_CAPS(\"video/x-raw; image/jpeg\")\n> +#define TEMPLATE_CAPS GST_STATIC_CAPS(\"video/x-raw; video/x-bayer; image/jpeg\")\n\nAs discussed previously, let go for:\n\n+#define TEMPLATE_CAPS GST_STATIC_CAPS(\"video/x-raw; image/jpeg; video/x-bayer;\")\n\nWith these very minor changes:\n\nReviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\n>  \n>  /* For the simple case, we have a src pad that is always present. */\n>  GstStaticPadTemplate src_template = {\n> \n>","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 76EA7BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 23 Dec 2022 15:51:38 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A4103623B8;\n\tFri, 23 Dec 2022 16:51:37 +0100 (CET)","from mail-qt1-x833.google.com (mail-qt1-x833.google.com\n\t[IPv6:2607:f8b0:4864:20::833])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7A47C62398\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Dec 2022 16:51:36 +0100 (CET)","by mail-qt1-x833.google.com with SMTP id z12so3983609qtv.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Dec 2022 07:51:36 -0800 (PST)","from nicolas-tpx395.localdomain (192-222-136-102.qc.cable.ebox.net.\n\t[192.222.136.102]) by smtp.gmail.com with ESMTPSA id\n\tay34-20020a05620a17a200b006b929a56a2bsm2484084qkb.3.2022.12.23.07.51.34\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 23 Dec 2022 07:51:34 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1671810697;\n\tbh=h0bPNuOdLAKlT9MEUy+7vGf55JIw98+EWG2X80f1i+Q=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=4LsqkRP9yMTEsfQXMGHfsvo5KZu6TSgPPdnSHrlcbmZjGQgt7ux5etV2SwJw9/yFk\n\tvqr8SfMmIkj87xiYwupaQg+KWxRrRVvATxy9Zp0RIlcXwcjJGai/9J3Xz3hufpEaL1\n\ta2tLo493asVmtiq9Ig1Lu9rGms61RJL3n5VsJGFAIs5AM6fo8/A0Y8Lh+iMdTxxj4Z\n\t2uadKhnKspnlDAnypVtNMdCEzOeydrG4n/AEBPX8os58kamzZd+VvKuBee3b9H59E7\n\te0rxQbMhtRbISou2bv/yfYhapn+9Dto+ow74VQFu4F/WIi8z9rSBvrLkeJNcRd1kot\n\tTzd1Cjnn9mYYg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ndufresne-ca.20210112.gappssmtp.com; s=20210112;\n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject\n\t:date:message-id:reply-to;\n\tbh=or6/UAuREqWuOQH8PeXag1uNQmYXkCbROB0/w8iNPtg=;\n\tb=4uV1nfp4lAPmGw3dofxlmakKB/DBtEdn9LJVkfl5v6whwwhiJEXrv1efJlt5Al99NR\n\tpkSGJweMQJDYgVSSjtBcUqDFAhQQlJcIeigGyS9Eq1uQlYcZGC+1sTVzpejqX332/9rD\n\tXjtCNNLlGHny3xIu0dLkuN+lF9dBkeFCf1JH7paPT/oklaEzK/QlaDBjCsrrWUcMWFPx\n\t+psaNbI95sdHAx/mOQA2nWShLix7ywWV+tOYFYFeT8eoykdPq5XYcUph4Hk4BXENrAb0\n\tSmIS2h5tMmOasj+hGcuW+rnYMKyUDt9zWD63lTeOaicPRDH/6tBcZYyBUqcOWWAy5avj\n\tqDhA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected)\n\theader.d=ndufresne-ca.20210112.gappssmtp.com\n\theader.i=@ndufresne-ca.20210112.gappssmtp.com header.b=\"4uV1nfp4\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state\n\t:from:to:cc:subject:date:message-id:reply-to;\n\tbh=or6/UAuREqWuOQH8PeXag1uNQmYXkCbROB0/w8iNPtg=;\n\tb=Bhc35g9GD/q6SwaQ0QBPHOpgsJ6b1w2b7CSg7uH25ZeUlVKGBvo0x9x4pbLoGV8Fnw\n\tvAD7GUQ5QrpIXH3jY6UJTmm2j4mjFWcK+ZiBKHq5Lmd6IscEhS2NtYleRrfs9SLK8tCD\n\tZSwQEdfE0/QHW6BuNoPhDfwxfbQFzY6qq2XUcJg1VjiZ5WSXM+561PbTBxvsxmvnXfOb\n\trgbRxxjdkCJOWVZADWFQpPkawJ86XImqM2wNd08HxBCv2jlYoSC+2wNz1uqP4fLX504B\n\t5mn2CJ40AKP6rFLGZgPdK0eYJIn9/a7AkU39uz6AwPIREbhbrNlkyQA0Uc7wrkkTWxHh\n\t+UHw==","X-Gm-Message-State":"AFqh2kriYv+f25jd/besRDyC3020dsp3Ovwg/1Uaz15bfB7nDzXzxcT/\n\tC7SnsOqjjukb0dHAi486cXIoKA==","X-Google-Smtp-Source":"AMrXdXtKpW5yUC6Un3trrMcI7jh9RsqqRoIVzFcSABqYkZPowmm/7VEppF/1CH7lBtmW7FLXXZrYuQ==","X-Received":"by 2002:a05:622a:488e:b0:3ab:6e0c:16b1 with SMTP id\n\tfc14-20020a05622a488e00b003ab6e0c16b1mr4592100qtb.45.1671810695419; \n\tFri, 23 Dec 2022 07:51:35 -0800 (PST)","Message-ID":"<aeb18f80a76778f99db08d3600036e34257024cc.camel@ndufresne.ca>","To":"Pavel Machek <pavel@ucw.cz>, Kieran Bingham\n\t<kieran.bingham@ideasonboard.com>","Date":"Fri, 23 Dec 2022 10:51:33 -0500","In-Reply-To":"<Y6NFu/O6VDG+WYdN@duo.ucw.cz>","References":"<Y52jM6iQtzs0Vysm@duo.ucw.cz>\n\t<CAKQmDh9BDUWonGdnOqz4uNPwS+L6cQMh1A2O4Be3Z=z+JqbQTQ@mail.gmail.com>\n\t<Y545RJF0JMWIQUwe@duo.ucw.cz>\n\t<a060b121a53465d2118d8d6194cd866e32ccc238.camel@ndufresne.ca>\n\t<Y6IzhjY3XQZn2oci@duo.ucw.cz>\n\t<167162721688.3944359.738999548555516756@Monstersaurus>\n\t<Y6NFu/O6VDG+WYdN@duo.ucw.cz>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","User-Agent":"Evolution 3.46.2 (3.46.2-1.fc37) ","MIME-Version":"1.0","Subject":"Re: [libcamera-devel] [PATCH] Add bayer8 support to gstlibcamera","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>","From":"Nicolas Dufresne via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Nicolas Dufresne <nicolas@ndufresne.ca>","Cc":"Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>,\n\tPavel Machek via libcamera-devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]