From patchwork Fri May 10 10:02:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 20037 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 E751FBDE6B for ; Fri, 10 May 2024 10:02:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C290363464; Fri, 10 May 2024 12:02:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Zrv59scR"; dkim-atps=neutral Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7E5E36345E for ; Fri, 10 May 2024 12:02:13 +0200 (CEST) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-41ba0bb5837so12880385e9.3 for ; Fri, 10 May 2024 03:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1715335333; x=1715940133; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8EqzroIAQoi+6KeMfKrXGaZOdJttqi872UhOH/ydd0I=; b=Zrv59scR8veRrNLast9BCFglLDa3CUV4q0CntmkVz9o3NLcRLuRG2SI8/H80yUUZsl c1Uhy1/QusbZnNNvztfMjfDraoA3z0pxXWFFt6ZLP+RrA5PLxKqAWzJZg+/OoFa5fyWO nEWMHd9xvhoBIwUOUbzrVWni38kCoLvSa80GtcpmPKiPhrQ6tbzmHkqeKpA+TEtmQ8Z8 Jbqh1QPJD1n0g9Aw5PyPZKNenY7d3WlACVs6lTo8TbmUwnbxYG8wLlOVO8JqJSTaVREG n6f+ti+4vtV1wuBAlfev+A8LriYvDVs8msOlfvZzfhXNcrL6ycXlG5NvetgCcqFQs9zj VgGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715335333; x=1715940133; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8EqzroIAQoi+6KeMfKrXGaZOdJttqi872UhOH/ydd0I=; b=SX0mF0JVUOQFJQ0/vQ2oxvgH4xO/wkZOxlciNPicibdlLrjIAmplUZ6kKq6tDpJbXD M4a9JurHI4TeAUNi+d2Oh6C/jZzhlrxdRUQiIObr7rVrA9pK6N1jE9YUIbGxTEc6aex7 xbsORpyxHphyXUhsgm+8+ytqXCf/jgIAIaZTNQIouOK8+QgB5ogZZyntH4KopUdGkIzS K6yMY/SZxZkL9g9FvJojph2soaKD9PkYJpc/2PbP7zcqxf7iYWprMHZZUi5IWemXwTE0 tvA6FCgk/qNIdR2sdEonJLSO1/gPX6xyODvJW1q8vB5G6hO+/YpkitHQo4Zh7wRNvKtU KwiQ== X-Gm-Message-State: AOJu0YzncI3N1p4DJtGWEreXKMrrmcBJtLWz7FrfC+C+wB0BhiR0vn2r 99WhjxHA0OvEkjNSKsIL5AViSJT3tl+J+yTFbdCqq/AjBOlQvNqUJgX9JNZ+NwblMFZbKiRj+P1 O X-Google-Smtp-Source: AGHT+IFX4ink8DW3kch+mMewf5SS6hQWMxvugE2x0Qw8jUw6pH6Lb3rdVVjCuopGC4S/S8+chuoTKA== X-Received: by 2002:a05:600c:3548:b0:419:f3f9:8ee3 with SMTP id 5b1f17b1804b1-41fea93a80amr18045885e9.5.1715335332497; Fri, 10 May 2024 03:02:12 -0700 (PDT) Received: from localhost.localdomain ([188.39.149.98]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccee9318sm57936385e9.30.2024.05.10.03.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 03:02:12 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Naushir Patuck , Jacopo Mondi , Kieran Bingham Subject: [PATCH v3 2/7] libcamera: formats: Add RGB48 formats Date: Fri, 10 May 2024 11:02:03 +0100 Message-Id: <20240510100208.12188-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240510100208.12188-1-naush@raspberrypi.com> References: <20240510100208.12188-1-naush@raspberrypi.com> MIME-Version: 1.0 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-bps (48-bpp) RGB output formats to libcamera. These new formats are defined for the RGB and BGR ordering. Signed-off-by: Naushir Patuck Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/libcamera/formats.cpp | 20 ++++++++++++++++++++ src/libcamera/formats.yaml | 5 +++++ src/libcamera/v4l2_pixelformat.cpp | 4 ++++ 3 files changed, 29 insertions(+) diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp index e6dea719d69e..e2d292c232a5 100644 --- a/src/libcamera/formats.cpp +++ b/src/libcamera/formats.cpp @@ -270,6 +270,26 @@ const std::map pixelFormatInfo{ .pixelsPerGroup = 1, .planes = {{ { 4, 1 }, { 0, 0 }, { 0, 0 } }}, } }, + { formats::BGR161616, { + .name = "BGR161616", + .format = formats::BGR161616, + .v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_RGB48), }, + .bitsPerPixel = 48, + .colourEncoding = PixelFormatInfo::ColourEncodingRGB, + .packed = false, + .pixelsPerGroup = 1, + .planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, + { formats::RGB161616, { + .name = "RGB161616", + .format = formats::RGB161616, + .v4l2Formats = { V4L2PixelFormat(V4L2_PIX_FMT_BGR48), }, + .bitsPerPixel = 48, + .colourEncoding = PixelFormatInfo::ColourEncodingRGB, + .packed = false, + .pixelsPerGroup = 1, + .planes = {{ { 3, 1 }, { 0, 0 }, { 0, 0 } }}, + } }, /* YUV packed formats. */ { formats::YUYV, { diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml index d8a379923b56..bde2cc803b98 100644 --- a/src/libcamera/formats.yaml +++ b/src/libcamera/formats.yaml @@ -43,6 +43,11 @@ formats: - BGRA8888: fourcc: DRM_FORMAT_BGRA8888 + - RGB161616: + fourcc: DRM_FORMAT_RGB161616 + - BGR161616: + fourcc: DRM_FORMAT_BGR161616 + - YUYV: fourcc: DRM_FORMAT_YUYV - YVYU: diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp index 1ca5ef92c39d..d3a882dc69a5 100644 --- a/src/libcamera/v4l2_pixelformat.cpp +++ b/src/libcamera/v4l2_pixelformat.cpp @@ -71,6 +71,10 @@ const std::map vpf2pf{ { formats::BGRA8888, "32-bit ARGB 8-8-8-8" } }, { V4L2PixelFormat(V4L2_PIX_FMT_BGRA32), { formats::RGBA8888, "32-bit ABGR 8-8-8-8" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_RGB48), + { formats::BGR161616, "48-bit RGB 16-16-16" } }, + { V4L2PixelFormat(V4L2_PIX_FMT_BGR48), + { formats::RGB161616, "48-bit BGR 16-16-16" } }, /* YUV packed formats. */ { V4L2PixelFormat(V4L2_PIX_FMT_YUYV),