From patchwork Thu Jun 16 08:46:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 16232 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 94435BD808 for ; Thu, 16 Jun 2022 08:46:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C80F865635; Thu, 16 Jun 2022 10:46:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655369208; bh=n119NyFdT6mH6bLbpjVMmJNDkvpmaxV89km5oAAJ6/w=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=2UYF9v1K5AxL9wAdFXmCZyz8b/TIop22gOSw+1+McQV+EGK5t+xf4UdTi1P/a3fRs vtrFOzm9g+n6pkpzELeP5ugDaQz4uW8t1GrKZuinn5SSluPTjU08aT8jjFtnjgvAAQ uCeE//hDRc3+Yw7/kWhM8Vt9MXdrxGIU8umO4J5mEKuGFxjXqKOVOdMLU9mFXxRo8k klEXr1ucrQTkEvkBQlnxKrJEkLKpIpj1pNL/Glj/DGyltNuXqiCbz3OCO9gDm1H06b HT5Gi6V7RN9tLMt3NSFix7DQEtm0hQZjW4rthtk//UXm9AWKL2s0l97DV/0CqzivFw 79Hv0N+1c7rzA== 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 7233E601F1 for ; Thu, 16 Jun 2022 10:46:47 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ElROXy0C"; dkim-atps=neutral Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:64d1:a349:8ac7:1dd0]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E8C94415; Thu, 16 Jun 2022 10:46:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1655369207; bh=n119NyFdT6mH6bLbpjVMmJNDkvpmaxV89km5oAAJ6/w=; h=From:To:Cc:Subject:Date:From; b=ElROXy0CaRxIT1y02SHmBQL6vLus8GaNQXsDpULLGz5sIml38vD5yaT+qu1Ra5uHl sq9/1N3+ki3aRSSJqjm5QnvHqrJq+ey699yVcc2bEEC6cgm2KbEOOzO7e+jA898m2I PT2ED4Q6e8Vsbn78ism3mVmLPpp/JOGW0HAuiMtk= To: libcamera-devel@lists.libcamera.org Date: Thu, 16 Jun 2022 10:46:42 +0200 Message-Id: <20220616084642.59823-1-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] qcam: dng: Make TIFFTAG_CFAPATTERN variable count 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: Jean-Michel Hautbois via libcamera-devel From: Jean-Michel Hautbois Reply-To: Jean-Michel Hautbois Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Since libtiff version 20201219, the CFAPATTERN tag is using a variable count and not the fixed 4 values size. For reference, the commit introducing this is: commit 2eb5a954cb7b7ad61559da00743c4b0e2fce34d0 Author: Sam Hasinoff Date: Sun Mar 8 21:23:16 2020 +0100 Make TIFFTAG_CFAPATTERN variable count Add a version check in the DNGWriter::write function when this tag is written as this breaks the raw capture in qcam. Signed-off-by: Jean-Michel Hautbois Reviewed-by: Laurent Pinchart --- src/qcam/dng_writer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qcam/dng_writer.cpp b/src/qcam/dng_writer.cpp index 34c8df5a..bfb867c6 100644 --- a/src/qcam/dng_writer.cpp +++ b/src/qcam/dng_writer.cpp @@ -506,7 +506,10 @@ int DNGWriter::write(const char *filename, const Camera *camera, TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT); TIFFSetField(tif, TIFFTAG_CFAREPEATPATTERNDIM, cfaRepeatPatternDim); - TIFFSetField(tif, TIFFTAG_CFAPATTERN, info->pattern); + if (TIFFLIB_VERSION < 20201219)) + TIFFSetField(tif, TIFFTAG_CFAPATTERN, info->pattern); + else + TIFFSetField(tif, TIFFTAG_CFAPATTERN, 4, info->pattern); TIFFSetField(tif, TIFFTAG_CFAPLANECOLOR, 3, cfaPlaneColor); TIFFSetField(tif, TIFFTAG_CFALAYOUT, 1);