From patchwork Tue Oct 18 08:09:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 17620 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 8EA5FBD16B for ; Tue, 18 Oct 2022 08:09:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 46FAD62E1A; Tue, 18 Oct 2022 10:09:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1666080563; bh=jiR7pmW81e7tnDg6TeUsJLBOTbHn/E+BmMeey25UKFQ=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=tqDZAJ1YLh3HSvPn6XU6DY6ar9pPmUvqGMXT6iSXHSC4cyhZYkZbvEzoQYRbkbjSB taF8+DL7R2epkD10+sZv2t/12H/yTFmF5cDoYsWlrLUZw0dRXTOrTle35Gi0lHw7Fn p1qb2LRC+7SAGJyg2YRAI0m+eD+n8zGkczoUTQJIOmzgloTfRqgNFtcddLxda7YLJT P8/zdahUw7SW3SQ5UI/3tj8IKa/G7j395pKOwSq6aovHC9bS2MnbhZjJTChDQvuiC6 RxY6FM7SNIkjd0gODrLoCjWIOlJeH1vBtkmXmKKbU4iXW4xSGNnDNoUudkP+YxBDr2 BjlE51SyvQrrA== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2FA1662E19 for ; Tue, 18 Oct 2022 10:09:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="IxlmLXND"; dkim-atps=neutral Received: from pyrite.rasen.tech (h175-177-042-159.catv02.itscom.jp [175.177.42.159]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id ACE69AF2; Tue, 18 Oct 2022 10:09:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1666080561; bh=jiR7pmW81e7tnDg6TeUsJLBOTbHn/E+BmMeey25UKFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IxlmLXND1+JC7olZPvn+Ugdy1SnlcS8Ki2KBoqM/dx7fuXDgWDpQ8Gt8tesxvNcDW 9VkLdTn5EdIXy7UMI+hAZ/SfNbqJ5IOPNGI+mE2lZtMncHxkE/sUrn3eJXPGrI7QVk vHXpqtGShV9e/HmECekOHjIVUZnB/nExONhF/ioY= To: libcamera-devel@lists.libcamera.org Date: Tue, 18 Oct 2022 17:09:08 +0900 Message-Id: <20221018080908.2841339-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221018080908.2841339-1-paul.elder@ideasonboard.com> References: <20221018080908.2841339-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/3] cam: dng_writer: Add support for 8-bit raw 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: , X-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add support for 8-bit raw formats in DNGWriter. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Eric Curtin --- Changes in v2: - replace copy loop with std::copy --- src/cam/dng_writer.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/cam/dng_writer.cpp b/src/cam/dng_writer.cpp index 6dd7d0f4..c945edce 100644 --- a/src/cam/dng_writer.cpp +++ b/src/cam/dng_writer.cpp @@ -126,6 +126,14 @@ struct Matrix3d { float m[9]; }; +void packScanlineSBGGR8(void *output, const void *input, unsigned int width) +{ + const uint8_t *in = static_cast(input); + uint8_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); @@ -274,6 +282,30 @@ void thumbScanlineIPU3([[maybe_unused]] const FormatInfo &info, void *output, } static const std::map formatInfo = { + { formats::SBGGR8, { + .bitsPerSample = 8, + .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed }, + .packScanline = packScanlineSBGGR8, + .thumbScanline = thumbScanlineSBGGRxxP, + } }, + { formats::SGBRG8, { + .bitsPerSample = 8, + .pattern = { CFAPatternGreen, CFAPatternBlue, CFAPatternRed, CFAPatternGreen }, + .packScanline = packScanlineSBGGR8, + .thumbScanline = thumbScanlineSBGGRxxP, + } }, + { formats::SGRBG8, { + .bitsPerSample = 8, + .pattern = { CFAPatternGreen, CFAPatternRed, CFAPatternBlue, CFAPatternGreen }, + .packScanline = packScanlineSBGGR8, + .thumbScanline = thumbScanlineSBGGRxxP, + } }, + { formats::SRGGB8, { + .bitsPerSample = 8, + .pattern = { CFAPatternRed, CFAPatternGreen, CFAPatternGreen, CFAPatternBlue }, + .packScanline = packScanlineSBGGR8, + .thumbScanline = thumbScanlineSBGGRxxP, + } }, { formats::SBGGR10_CSI2P, { .bitsPerSample = 10, .pattern = { CFAPatternBlue, CFAPatternGreen, CFAPatternGreen, CFAPatternRed },