From patchwork Mon Nov 1 09:15:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 14437 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 04367BDB1C for ; Mon, 1 Nov 2021 09:15:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 18A2760125; Mon, 1 Nov 2021 10:15:17 +0100 (CET) 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="jLGi/aCm"; dkim-atps=neutral Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1022F600BF for ; Mon, 1 Nov 2021 10:15:15 +0100 (CET) Received: by mail-wr1-x436.google.com with SMTP id r8so14352900wra.7 for ; Mon, 01 Nov 2021 02:15:15 -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=RG3zcG/cyCZQubLgG1F5CIX3ibyjzBGfN4/E1yy8ruU=; b=jLGi/aCmhSCQk8/fgy9+QcXhjWeYj+jclttvdJz0BvsZAhrnID08trusMCpgLgeBdi TLR/G5LWKZn+0X2U13lUSYH+MnPRCQDqjXHFw5cqNgJwwIwn24ISl6taXNreJBmHvWEB PFu9Sg1Plm5pBlK33Y5PzPKBEFzA8OXsNmJT3Z0c15luNvYxuJFBQqZ43ubG3RHKde9J SjVVvQZhO8DwqwhuAKPMEmCLVwutoBie8ejyzo5Lf0vp5ow8xHjUYGlFrZVzAQcIcm4O Ik925Nf/bY6E4t0PIGrctpS+0YgYANYnyS7/fxeAak1oDqflRiBPHoxM0r/M/Jpb7Rv0 Y6yA== 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=RG3zcG/cyCZQubLgG1F5CIX3ibyjzBGfN4/E1yy8ruU=; b=e/myiRDJNCQ5WZOU3FIvETS3VBIkGoPpqfmetIXCQJyk5UUOluHqMaVabLNfUek53z yKlNNEemC9Si5c5irwBo0ZgAJjcCjKsYfVrtIBgB51XHyd695105mkZL9NYQYHliQGXb BAICb2hNj8X4OhKQaeO8tE3lS3ctFjwBgtnOD3R/f34nfVvX8zb1ny4sYReb9T8RRB9b fgUdiOGo4ZehcFn252IL3eIlD31vPydELsUcWOyPy7RfJXS5WhjG4MZa+b+kCgXqfIVf NIRD7a1frYhefMPRXGqyZ4U5STzRYbED+XSDREfYJxj3pEV5/Jwkz58fjSRBjvxsc6za XfnA== X-Gm-Message-State: AOAM531UL46vruTpy0aXFcY9lUHB1X4GqwYJIKv+7nIzJa3EPNVio19m +zm2WgEoebgHH+Vp/JPNCpWvxEU9xqiCl/ej X-Google-Smtp-Source: ABdhPJx/V4+SKPprUDTKMDsHvAjwq1+SyZeAehJmUyLcGtk6h+stj4BPZU47ByZRnUUdLoH7Lr53kg== X-Received: by 2002:a05:6000:1a86:: with SMTP id f6mr36444997wry.343.1635758114621; Mon, 01 Nov 2021 02:15:14 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:3a2b:9d8c:92b9:ece6]) by smtp.gmail.com with ESMTPSA id w10sm13168849wrq.88.2021.11.01.02.15.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 02:15:14 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 1 Nov 2021 09:15:01 +0000 Message-Id: <20211101091510.23204-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211101091510.23204-1-naush@raspberrypi.com> References: <20211101091510.23204-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v5 02/11] 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: 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..d4781dfb3874 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 = 12, + .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),