From patchwork Fri Jul 24 17:14:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 8982 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 1BB19BD86F for ; Fri, 24 Jul 2020 17:14:20 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EB13761236; Fri, 24 Jul 2020 19:14:19 +0200 (CEST) Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 831056039B for ; Fri, 24 Jul 2020 19:14:16 +0200 (CEST) X-Halon-ID: 19808760-cdd1-11ea-933e-005056917a89 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de [79.202.46.202]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 19808760-cdd1-11ea-933e-005056917a89; Fri, 24 Jul 2020 19:14:15 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Jul 2020 19:14:04 +0200 Message-Id: <20200724171404.736509-3-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200724171404.736509-1-niklas.soderlund@ragnatech.se> References: <20200724171404.736509-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/2] libcamera: Add support for 16-bit Bayer 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" Add support for 16-bit Bayer formats. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/formats.cpp | 40 ++++++++++++++++++++++++++++++ src/libcamera/formats.yaml | 9 +++++++ src/libcamera/v4l2_pixelformat.cpp | 4 +++ 3 files changed, 53 insertions(+) diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index 11774b0cfb123f58..cd63c15cb926d569 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -563,6 +563,46 @@ const std::map pixelFormatInfo{ .pixelsPerGroup = 2, .planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }}, } }, + { formats::SBGGR16, { + .name = "SBGGR16", + .format = formats::SBGGR16, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16), + .bitsPerPixel = 16, + .colourEncoding = PixelFormatInfo::ColourEncodingRAW, + .packed = false, + .pixelsPerGroup = 2, + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, + { formats::SGBRG16, { + .name = "SGBRG16", + .format = formats::SGBRG16, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16), + .bitsPerPixel = 16, + .colourEncoding = PixelFormatInfo::ColourEncodingRAW, + .packed = false, + .pixelsPerGroup = 2, + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, + { formats::SGRBG16, { + .name = "SGRBG16", + .format = formats::SGRBG16, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16), + .bitsPerPixel = 16, + .colourEncoding = PixelFormatInfo::ColourEncodingRAW, + .packed = false, + .pixelsPerGroup = 2, + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, + { formats::SRGGB16, { + .name = "SRGGB16", + .format = formats::SRGGB16, + .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16), + .bitsPerPixel = 16, + .colourEncoding = PixelFormatInfo::ColourEncodingRAW, + .packed = false, + .pixelsPerGroup = 2, + .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, { formats::SBGGR10_IPU3, { .name = "SBGGR10_IPU3", .format = formats::SBGGR10_IPU3, diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml index 3a69c05fcc04fb93..6a2fb721b7c649b6 100644 --- a/src/libcamera/formats.yaml +++ b/src/libcamera/formats.yaml @@ -93,6 +93,15 @@ formats: - SBGGR12: fourcc: DRM_FORMAT_SBGGR12 + - SRGGB16: + fourcc: DRM_FORMAT_SRGGB16 + - SGRBG16: + fourcc: DRM_FORMAT_SGRBG16 + - SGBRG16: + fourcc: DRM_FORMAT_SGBRG16 + - SBGGR16: + fourcc: DRM_FORMAT_SBGGR16 + - SRGGB10_CSI2P: fourcc: DRM_FORMAT_SRGGB10 mod: MIPI_FORMAT_MOD_CSI2_PACKED diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index c8f69ee9654223b3..8391ec48ac1009b6 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -92,6 +92,10 @@ const std::map vpf2pf{ { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P), formats::SGBRG12_CSI2P }, { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P), formats::SGRBG12_CSI2P }, { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P), formats::SRGGB12_CSI2P }, + { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR16), formats::SBGGR16 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG16), formats::SGBRG16 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG16), formats::SGRBG16 }, + { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB16), formats::SRGGB16 }, /* Compressed formats. */ { V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), formats::MJPEG },