From patchwork Wed Oct 27 09:27:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 14356 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 99749BDB1C for ; Wed, 27 Oct 2021 09:28:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3474D6488C; Wed, 27 Oct 2021 11:28:14 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="VHGYUORu"; dkim-atps=neutral Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5EF2664883 for ; Wed, 27 Oct 2021 11:28:09 +0200 (CEST) Received: by mail-wr1-x42c.google.com with SMTP id d13so2938854wrf.11 for ; Wed, 27 Oct 2021 02:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ak4WdejPa9HUDndTNCMXCBy684jtdEGrsEPQLBKMh3U=; b=VHGYUORuH1hZNhfDO0oN6kldDnyhRcytJoHplWB2aK0q0VvVQ/IWX51raIqTHLE9NU m66mXeUPZ8HR5cNushYhohew4aDDgPZnamgD5XK8FmhN6wh97mE4QShEak1SKkAGyjUD CuLF5W3e3+RFWMH6KmVJUft4Vpy0mqcvZuH6+SpARNoQTQ5NjnFlwxrxwikeT99gj3wT oC1QIQ2ECKCegcZG4VKuJ1IsPcqHr5EinxvKk2so2lMTKZ46y5JjsESzZoVuonMY5laT Dsi3HiSjXL8mpPeRIDXMFtYhGRTq9d9qqtiUOzGjbhQ9muHXzHldY2SpZRhM+30y0Nj8 G4KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ak4WdejPa9HUDndTNCMXCBy684jtdEGrsEPQLBKMh3U=; b=VofU8tjU+q0ugvxCyZIwB3yfCoatj+QrGSrrc80np51R3b5x3d4JnZBtMesoM8jXNm KyEzj0n7+wgCwjIKknCKdogLIlK1iVO66MQimipLkHKDzjUytJ0eC7sNGUrqhUme1dXd BaYVetdl66RCTcTc9EPIMmczMNWGzZmJLkzXlI5VViEOsqJBR0yqaFwbMBEltnhHXgI0 D6Itm27l7TuO9F9Ht7JGroOdf3hQ43OptxHrqS4q1xKQbm8jUVOGOWa4orhMn2I7HhGP Ti9cEESBMKglNGY7Lve1vZD5qB+AVP9Mg7Ll2j4kujyQZ6FxloYNVVdWnz4uqg265RDU mgXA== X-Gm-Message-State: AOAM532iYe0PBeKnwzzWtyJa2RkPi7wyjvJIsBMLg10OfmGPs8GOPhqe YkzVbuq5NnotEDsegWzd/0gzqgOJk8P6VBqI X-Google-Smtp-Source: ABdhPJxkcre0tC4uymIyuj3zpdl/HU0tqAOYbDQaak5iTvLUJu3Y48OjOVEA9I5Y84WRjNuREUx7Lg== X-Received: by 2002:adf:d236:: with SMTP id k22mr39629190wrh.11.1635326888744; Wed, 27 Oct 2021 02:28:08 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:6561:eb24:3f00:ce98]) by smtp.gmail.com with ESMTPSA id x2sm2861360wmj.3.2021.10.27.02.28.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 02:28:08 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Wed, 27 Oct 2021 10:27:56 +0100 Message-Id: <20211027092803.3671096-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211027092803.3671096-1-naush@raspberrypi.com> References: <20211027092803.3671096-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 2/9] libcamera: formats: Add R10 and R12 formats X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Laurent Pinchart These new formats corresponds to the V4L2 V4L2_PIX_FMT_Y10 and V4L2_PIX_FMT_Y12 formats, and are the little-endian version of the DRM_FORMAT_R10 and DRM_FORMAT_R12 formats. Signed-off-by: Laurent Pinchart Signed-off-by: Naushir Patuck Reviewed-by: Kieran Bingham --- src/libcamera/formats.cpp | 26 ++++++++++++++++++++++++++ src/libcamera/formats.yaml | 4 ++++ src/libcamera/v4l2_pixelformat.cpp | 4 ++++ 3 files changed, 34 insertions(+) diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index 1c29e1f2c5ab..9f96e9dc4e41 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -484,6 +484,32 @@ const std::map pixelFormatInfo{ .pixelsPerGroup = 1, .planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }}, } }, + { formats::R10, { + .name = "R10", + .format = formats::R10, + .v4l2Formats = { + .single = V4L2PixelFormat(V4L2_PIX_FMT_Y10), + .multi = V4L2PixelFormat(), + }, + .bitsPerPixel = 10, + .colourEncoding = PixelFormatInfo::ColourEncodingYUV, + .packed = false, + .pixelsPerGroup = 1, + .planes = {{ { 2, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, + { formats::R12, { + .name = "R12", + .format = formats::R12, + .v4l2Formats = { + .single = V4L2PixelFormat(V4L2_PIX_FMT_Y12), + .multi = V4L2PixelFormat(), + }, + .bitsPerPixel = 10, + .colourEncoding = PixelFormatInfo::ColourEncodingYUV, + .packed = false, + .pixelsPerGroup = 1, + .planes = {{ { 2, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, /* Bayer formats. */ { formats::SBGGR8, { diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml index 43b5877e08f2..22a8e473a183 100644 --- a/src/libcamera/formats.yaml +++ b/src/libcamera/formats.yaml @@ -7,6 +7,10 @@ formats: - R8: fourcc: DRM_FORMAT_R8 + - R10: + fourcc: DRM_FORMAT_R10 + - R12: + fourcc: DRM_FORMAT_R12 - RGB565: fourcc: DRM_FORMAT_RGB565 diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 3649c6002620..0e0da3f0df07 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -117,6 +117,10 @@ const std::map vpf2pf{ /* Greyscale formats. */ { V4L2PixelFormat(V4L2_PIX_FMT_GREY), { formats::R8, "8-bit Greyscale" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_Y10), + { formats::R10, "10-bit Greyscale" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_Y12), + { formats::R12, "12-bit Greyscale" } }, /* Bayer formats. */ { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8),