From patchwork Tue Mar 5 11:01:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Hollinghurst X-Patchwork-Id: 19630 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 149ACBD160 for ; Tue, 5 Mar 2024 11:01:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3131A62868; Tue, 5 Mar 2024 12:01:49 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="YO5VD20Q"; dkim-atps=neutral Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DA2BC61C8D for ; Tue, 5 Mar 2024 12:01:46 +0100 (CET) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-564647bcdbfso6353464a12.2 for ; Tue, 05 Mar 2024 03:01:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1709636506; x=1710241306; 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=GKqRlOMQqo2H8pDOZII7SiWT0iKJ/HC2YT/Zh6B7eic=; b=YO5VD20QMLaqrD74KtalX/3XSfU48MshMusv9WjD/OC9pbv/lYDrA/k2JRBDG4fm8d zEN8mGdVGpSQOtdkMWVFowyk8qEsFBPIyYnxLkR+Vpm/KTysloEMivyLaRB54hzeIgZ6 b3jolGae77Nl7D9Whk8vb+j33eiMc7rWvjUev9NA8tUHN0IHcmYtbFAx2l8JTqUWGCu6 /MEomsdVP+qeqSqd/Vf3EKpyI5bZ1It3nHkxupjr/05ddAN8sIN2z6l9aJTQkvSqsLhk he5uLvZAV31+CcrS/Be9KOUcc2k5GuOTDNPerP2nvtXXkZipfOWLHH8wohg1XKz2T8rK LgTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709636506; x=1710241306; 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=GKqRlOMQqo2H8pDOZII7SiWT0iKJ/HC2YT/Zh6B7eic=; b=vurdVILjq8EMzheYeydzfB4IfDH2nz2XnqTAyXp2Qt/EBuQ+xdd7Ll0654KWB1d9yl MDKTw3iGJX9cDVHadsiC7Mkx+d2oX8SWahtwMq0/dOHRGaB1kRoRqtnf0eYT4JlwPyL0 KmObvHUisYH/ZEHAOQkA/LIbc/FyfG6jTK4/i++Bt4jxuc56+pqPCq/P1dAdnhNe8WfG pVM81GvhQDdZZGczK4QMua3cKOjKELHFaVmouyd5e1KRQLpijs1CPqwYOt/OST7fA7Ca 7IRLxvDs8ULT+3wJJfLRnA0RejustDtudtxpzYblWrUJ5El60TKL7/lR7ZnRtnBFWser ENFg== X-Gm-Message-State: AOJu0YxtnohIyJKlcyu7TiSVrgKY40kQvZOQY7GcIa/aA38TOF8dAv9x jrZKgH+vlAyOcYcW2BynJIk5LbktmhpblUGA2MWInUAm0oouErEJ71cBvo09oi9XJlLMhj16Rlu 1 X-Google-Smtp-Source: AGHT+IFqjuNwTUsWd5CJ/HYZtlVYY/lgpwucZxmm0TWURvcYR8CZ987xUtK2Es076OqnbVF3E+smJA== X-Received: by 2002:a50:cb86:0:b0:565:1815:dfc5 with SMTP id k6-20020a50cb86000000b005651815dfc5mr8089802edi.0.1709636506576; Tue, 05 Mar 2024 03:01:46 -0800 (PST) Received: from raspberrypi.pitowers.org ([2001:4d4e:300:1f:47b7:9ea3:c642:9870]) by smtp.gmail.com with ESMTPSA id fk25-20020a056402399900b00566a461e1ecsm5613726edb.73.2024.03.05.03.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 03:01:46 -0800 (PST) From: Nick Hollinghurst To: libcamera-devel@lists.libcamera.org Subject: [PATCH 1/2] libcamera: v4l2_subdevice: Add 14-bit Bayer formats Date: Tue, 5 Mar 2024 11:01:35 +0000 Message-Id: <20240305110136.3624-2-nick.hollinghurst@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240305110136.3624-1-nick.hollinghurst@raspberrypi.com> References: <20240305110136.3624-1-nick.hollinghurst@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: , Cc: Nick Hollinghurst Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add MEDIA_BUS_FMT_SBGGR14_1X14 etc to formatInfoMap. Not adding any Y14 for now. Signed-off-by: Nick Hollinghurst Reviewed-by: Laurent Pinchart Reviewed-by: Naushir Patuck --- src/libcamera/v4l2_subdevice.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp index aea90aba..dfe46fa7 100644 --- a/src/libcamera/v4l2_subdevice.cpp +++ b/src/libcamera/v4l2_subdevice.cpp @@ -134,6 +134,10 @@ const std::map formatInfoMap = { { MEDIA_BUS_FMT_SGBRG12_1X12, { 12, "SGBRG12_1X12", PixelFormatInfo::ColourEncodingRAW } }, { MEDIA_BUS_FMT_SGRBG12_1X12, { 12, "SGRBG12_1X12", PixelFormatInfo::ColourEncodingRAW } }, { MEDIA_BUS_FMT_SRGGB12_1X12, { 12, "SRGGB12_1X12", PixelFormatInfo::ColourEncodingRAW } }, + { MEDIA_BUS_FMT_SBGGR14_1X14, { 14, "SBGGR14_1X14", PixelFormatInfo::ColourEncodingRAW } }, + { MEDIA_BUS_FMT_SGBRG14_1X14, { 14, "SGBRG14_1X14", PixelFormatInfo::ColourEncodingRAW } }, + { MEDIA_BUS_FMT_SGRBG14_1X14, { 14, "SGRBG14_1X14", PixelFormatInfo::ColourEncodingRAW } }, + { MEDIA_BUS_FMT_SRGGB14_1X14, { 14, "SRGGB14_1X14", PixelFormatInfo::ColourEncodingRAW } }, { MEDIA_BUS_FMT_SBGGR16_1X16, { 16, "SBGGR16_1x16", PixelFormatInfo::ColourEncodingRAW } }, { MEDIA_BUS_FMT_SGBRG16_1X16, { 16, "SGBRG16_1x16", PixelFormatInfo::ColourEncodingRAW } }, { MEDIA_BUS_FMT_SGRBG16_1X16, { 16, "SGRBG16_1x16", PixelFormatInfo::ColourEncodingRAW } }, From patchwork Tue Mar 5 11:01:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Hollinghurst X-Patchwork-Id: 19631 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 66271C326C for ; Tue, 5 Mar 2024 11:01:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 465FC62875; Tue, 5 Mar 2024 12:01:51 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="BbGZktws"; dkim-atps=neutral Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BAB3262868 for ; Tue, 5 Mar 2024 12:01:47 +0100 (CET) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-566e869f631so4508442a12.0 for ; Tue, 05 Mar 2024 03:01:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1709636507; x=1710241307; 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=PcSzdAggpLbnR/OqlyoIDDkxS4yw4uMH9BiGn/ZzXEw=; b=BbGZktwsinMR9OoHTOJqn5OPN+mIUr46ILoyblQxilCMpJnfW35pNNae8EHJDqqVRR +in7k8F0uFR10iyVXB2brvqI7hN/wltRG2IRNd60rGJzKq/RSSDGqf5XSluXGco62V45 NbNYbPICylTF03/6/l3C8z51tL30jY/rCgqFsga3TXCEUnXubYSHSkHGKRu9i2AFw/WX NNNOQf+k3YCqtZFPAYd+DSHqNSCjlaB3jRv142YvFKBXAdqws9TLXJBXRe39rRmSOFHV wlOaYvhxIzOICc2KJgWFvg9nzs4ozsLVwXwyu/W7J0zqA9HVP640BYMcG3qCI7ZGPXKc r8CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709636507; x=1710241307; 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=PcSzdAggpLbnR/OqlyoIDDkxS4yw4uMH9BiGn/ZzXEw=; b=kOGtHEF6sb9yNlOdNiExI8apEKRLZH2RMRRbMgk88tTlFHbknbM8bJDMzerHgEmnak rngTaWjLun9LMXyq/7biTA7/sWUsfcIxTHlAER862aQbXkvzprvFDcJ8/A876ZXiD7wW wckEEHCfzm5WpVXefKSiTXFajy3AMP+oJpOmMJAvkakgInU3HfDLrcr1vvy3KwCB1YFf f3QNgcwz5KJn6pJBURizhZ0hSA2nL0W+PuJ3XkdAFQ1izht7JDTCZ6yahyiW7VBRCO30 Qguc9j8XEJsQz1bjGrJUKYrnach+MuflJV5DbqTw4IEiUFemoGeKJgHszOWLHpzSzL4T vpbg== X-Gm-Message-State: AOJu0YzQEsSyhC7gQoHsK0Og/sJXgPo7S4oM4tttfV7FVs2fdpOIHPU7 WpJx8vawESW+jvpPiCvpw4uATX7jeuZc7b3nRUEttHCv6BOpodv7VCoOWkJLUVLV8W+d0UN4IGs 1 X-Google-Smtp-Source: AGHT+IHMylVSu/xRYsnIrmnarsCok5FeKlI1JHqTxx1k4M+aSY9Bf1XexdK4CW//Qvu8XivYe2iLxw== X-Received: by 2002:a05:6402:5c3:b0:566:66cc:633c with SMTP id n3-20020a05640205c300b0056666cc633cmr8092954edx.7.1709636507332; Tue, 05 Mar 2024 03:01:47 -0800 (PST) Received: from raspberrypi.pitowers.org ([2001:4d4e:300:1f:47b7:9ea3:c642:9870]) by smtp.gmail.com with ESMTPSA id fk25-20020a056402399900b00566a461e1ecsm5613726edb.73.2024.03.05.03.01.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 03:01:47 -0800 (PST) From: Nick Hollinghurst To: libcamera-devel@lists.libcamera.org Subject: [PATCH 2/2] ipa: rpi: cam_helper: Extend embedded data parsing to RAW14 modes Date: Tue, 5 Mar 2024 11:01:36 +0000 Message-Id: <20240305110136.3624-3-nick.hollinghurst@raspberrypi.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240305110136.3624-1-nick.hollinghurst@raspberrypi.com> References: <20240305110136.3624-1-nick.hollinghurst@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: , Cc: Nick Hollinghurst Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Fix embedded data byte-skipping for 14-bit modes (4 out of 7 bytes carry register data), and allow 14-bit modes in IMX708 PDAF parsing. Signed-off-by: Nick Hollinghurst Reviewed-by: Laurent Pinchart Reviewed-by: Naushir Patuck --- src/ipa/rpi/cam_helper/cam_helper_imx708.cpp | 2 +- src/ipa/rpi/cam_helper/md_parser_smia.cpp | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp index dce39cd5..906c6fa2 100644 --- a/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp +++ b/src/ipa/rpi/cam_helper/cam_helper_imx708.cpp @@ -269,7 +269,7 @@ bool CamHelperImx708::parsePdafData(const uint8_t *ptr, size_t len, { size_t step = bpp >> 1; /* bytes per PDAF grid entry */ - if (bpp < 10 || bpp > 12 || len < 194 * step || ptr[0] != 0 || ptr[1] >= 0x40) { + if (bpp < 10 || bpp > 14 || len < 194 * step || ptr[0] != 0 || ptr[1] >= 0x40) { LOG(IPARPI, Error) << "PDAF data in unsupported format"; return false; } diff --git a/src/ipa/rpi/cam_helper/md_parser_smia.cpp b/src/ipa/rpi/cam_helper/md_parser_smia.cpp index 210787ed..c5b806d7 100644 --- a/src/ipa/rpi/cam_helper/md_parser_smia.cpp +++ b/src/ipa/rpi/cam_helper/md_parser_smia.cpp @@ -86,10 +86,13 @@ MdParserSmia::ParseStatus MdParserSmia::findRegs(libcamera::Span while (1) { int tag = buffer[currentOffset++]; - if ((bitsPerPixel_ == 10 && - (currentOffset + 1 - currentLineStart) % 5 == 0) || - (bitsPerPixel_ == 12 && - (currentOffset + 1 - currentLineStart) % 3 == 0)) { + /* Non-dummy bytes come in even-sized blocks: skip can only ever follow tag */ + while ((bitsPerPixel_ == 10 && + (currentOffset + 1 - currentLineStart) % 5 == 0) || + (bitsPerPixel_ == 12 && + (currentOffset + 1 - currentLineStart) % 3 == 0) || + (bitsPerPixel_ == 14 && + (currentOffset - currentLineStart) % 7 >= 4)) { if (buffer[currentOffset++] != RegSkip) return BadDummy; }