From patchwork Thu Jun 13 15:09:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 20299 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 DF9BEBD87C for ; Thu, 13 Jun 2024 15:10:02 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 183466548B; Thu, 13 Jun 2024 17:10:02 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ukT8jiir"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1CE0065462 for ; Thu, 13 Jun 2024 17:10:00 +0200 (CEST) Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CB9874CC; Thu, 13 Jun 2024 17:09:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1718291385; bh=k/BMADhvul0BAO5h5N1rhsijOZ44fOTgszQtFyW5mxw=; h=From:To:Cc:Subject:Date:From; b=ukT8jiirOdZ6IgIodJcJLvSZ6/jKVmVCwcztU0BRcEgMQEFf1phj/Qe15CA2gCClY pUUPq+6heJtXmThL6wZi3WJfztCB3y42+g/A/nJ/px79HOeWv2cM+Nszk2/T0MmO98 wCWMcu569/tUbut6vmxmbKwcxJj06HxLRbiOgl3A= From: Daniel Scally To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally Subject: [PATCH] apps: common: dng_writer: Support RAW16 formats Date: Thu, 13 Jun 2024 16:09:49 +0100 Message-Id: <20240613150950.1035299-1-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 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 RAW16 formats to the DNGWriter helpers so that we can produce dng files from the mali-c55. Signed-off-by: Daniel Scally Reviewed-by: Laurent Pinchart Reviewed-by: Stefan Klug --- src/apps/common/dng_writer.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/apps/common/dng_writer.cpp b/src/apps/common/dng_writer.cpp index 59f1fa23..150782e8 100644 --- a/src/apps/common/dng_writer.cpp +++ b/src/apps/common/dng_writer.cpp @@ -134,6 +134,14 @@ void packScanlineSBGGR8(void *output, const void *input, unsigned int width) std::copy(in, in + width, out); } +void packScanlineSBGGR16(void *output, const void *input, unsigned int width) +{ + const uint16_t *in = static_cast(input); + uint16_t *out = static_cast(output); + + std::copy(in, in + width, out); +} + void packScanlineSBGGR10P(void *output, const void *input, unsigned int width) { const uint8_t *in = static_cast(input); @@ -307,6 +315,30 @@ static const std::map formatInfo = { .packScanline = packScanlineSBGGR8, .thumbScanline = thumbScanlineSBGGRxxP, } }, + { formats::SBGGR16, { + .bitsPerSample = 16, + .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed }, + .packScanline = packScanlineSBGGR16, + .thumbScanline = thumbScanlineSBGGRxxP, + } }, + { formats::SGBRG16, { + .bitsPerSample = 16, + .pattern = { CFAPatternGreen, CFAPatternBlue, CFAPatternRed, CFAPatternGreen }, + .packScanline = packScanlineSBGGR16, + .thumbScanline = thumbScanlineSBGGRxxP, + } }, + { formats::SGRBG16, { + .bitsPerSample = 16, + .pattern = { CFAPatternGreen, CFAPatternRed, CFAPatternBlue, CFAPatternGreen }, + .packScanline = packScanlineSBGGR16, + .thumbScanline = thumbScanlineSBGGRxxP, + } }, + { formats::SRGGB16, { + .bitsPerSample = 16, + .pattern = { CFAPatternRed, CFAPatternGreen, CFAPatternGreen, CFAPatternBlue }, + .packScanline = packScanlineSBGGR16, + .thumbScanline = thumbScanlineSBGGRxxP, + } }, { formats::SBGGR10_CSI2P, { .bitsPerSample = 10, .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed },