{"id":3676,"url":"https://patchwork.libcamera.org/api/1.1/patches/3676/?format=json","web_url":"https://patchwork.libcamera.org/patch/3676/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200502225704.2911-6-laurent.pinchart@ideasonboard.com>","date":"2020-05-02T22:57:04","name":"[libcamera-devel,5/5] qcam: dng_writer: Generate thumbnail in RGB format","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"e8ec986b0d5b88620f84e8b66e5d051da771386e","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3676/mbox/","series":[{"id":874,"url":"https://patchwork.libcamera.org/api/1.1/series/874/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=874","date":"2020-05-02T22:56:59","name":"qcam: Improve DNG writer","version":1,"mbox":"https://patchwork.libcamera.org/series/874/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3676/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3676/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5EB9D6162E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  3 May 2020 00:57:12 +0200 (CEST)","from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 023F472C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  3 May 2020 00:57:11 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"d1aoB6+j\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1588460232;\n\tbh=WBjePhcF60gvK3H85ZX8vDSpxEG6HKuCVjORCGZbi4A=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=d1aoB6+jD7ZS0Qqc9dEy7/AsguLM7uiEBsoz5c4zcUn9Sz3NvF79jq8vpRBLrEEiL\n\tkTW2v+CLlmLRPu2hVL4+yc4zMGa4II0ya2N3QZqDmU729AyA3Pen8pScqCw1Wsh2vS\n\tIGUh5SKbArfiflDigugFLfIud/EEmXfmxS4GT/Zo=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sun,  3 May 2020 01:57:04 +0300","Message-Id":"<20200502225704.2911-6-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.25.3","In-Reply-To":"<20200502225704.2911-1-laurent.pinchart@ideasonboard.com>","References":"<20200502225704.2911-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 5/5] qcam: dng_writer: Generate thumbnail\n\tin RGB format","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Sat, 02 May 2020 22:57:13 -0000"},"content":"While the DNG specification supports greyscale (\"BlackIsZero\") for\nthumbnails, RawTherapee seems to have trouble reading them. Generate\nthumbnails in RGB instead (but still with greyscale content, to avoid\nhaving to interpolate colour components).\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/qcam/dng_writer.cpp | 14 +++++++++-----\n 1 file changed, 9 insertions(+), 5 deletions(-)","diff":"diff --git a/src/qcam/dng_writer.cpp b/src/qcam/dng_writer.cpp\nindex d04a8e161218..bc1a63e69799 100644\n--- a/src/qcam/dng_writer.cpp\n+++ b/src/qcam/dng_writer.cpp\n@@ -74,7 +74,10 @@ void thumbScanlineSBGGRxxP(const FormatInfo &info, void *output,\n \tunsigned int skip = info.bitsPerSample * 16 / 8;\n \n \tfor (unsigned int x = 0; x < width; x++) {\n-\t\t*out++ = (in[0] + in[1] + in[stride] + in[stride + 1]) >> 2;\n+\t\tuint8_t value = (in[0] + in[1] + in[stride] + in[stride + 1]) >> 2;\n+\t\t*out++ = value;\n+\t\t*out++ = value;\n+\t\t*out++ = value;\n \t\tin += skip;\n \t}\n }\n@@ -175,16 +178,17 @@ int DNGWriter::write(const char *filename, const Camera *camera,\n \tTIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);\n \n \t/*\n-\t * Thumbnail-specific tags. The thumbnail is stored as a greyscale image\n-\t * with 1/16 of the raw image resolution.\n+\t * Thumbnail-specific tags. The thumbnail is stored as an RGB image\n+\t * with 1/16 of the raw image resolution. Greyscale would save space,\n+\t * but doesn't seem well supported by RawTherapee.\n \t */\n \tTIFFSetField(tif, TIFFTAG_SUBFILETYPE, FILETYPE_REDUCEDIMAGE);\n \tTIFFSetField(tif, TIFFTAG_IMAGEWIDTH, config.size.width / 16);\n \tTIFFSetField(tif, TIFFTAG_IMAGELENGTH, config.size.height / 16);\n \tTIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);\n \tTIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);\n-\tTIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);\n-\tTIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);\n+\tTIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);\n+\tTIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 3);\n \tTIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n \tTIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);\n \n","prefixes":["libcamera-devel","5/5"]}