Patch Detail
Show a patch.
GET /api/patches/20487/?format=api
{ "id": 20487, "url": "https://patchwork.libcamera.org/api/patches/20487/?format=api", "web_url": "https://patchwork.libcamera.org/patch/20487/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20240628213535.6906-3-laurent.pinchart@ideasonboard.com>", "date": "2024-06-28T21:35:35", "name": "[2/2] apps: common: dng_writer: Fix RAW10 and RAW12 packing on BE machines", "commit_ref": "e3310749f5abb8003c85f7bdf01ce14b9e4b1fab", "pull_url": null, "state": "accepted", "archived": false, "hash": "a58f894b1cb60f8005ce1d4bee378212e6845590", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/20487/mbox/", "series": [ { "id": 4431, "url": "https://patchwork.libcamera.org/api/series/4431/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4431", "date": "2024-06-28T21:35:33", "name": "apps: common: dng_write: Endianness fixes", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4431/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/20487/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/20487/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 73CD0BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Jun 2024 21:36:05 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C9DAD62CA0;\n\tFri, 28 Jun 2024 23:36:04 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 73CC662C97\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Jun 2024 23:35:59 +0200 (CEST)", "from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7F9E32C5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Jun 2024 23:35:34 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Fv4lQhdm\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1719610534;\n\tbh=Fyt7eCbzpiE8cFJAPdaB6xFkpcdfQ+CgQcgioJGOLew=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=Fv4lQhdmoK5o2Ydtbes4Blm8YHrlJqTwVZ1cvkOjFGQla8f/xk7MArJ6b+3I/Hl3e\n\tEdp5ben65f/cOopozmU6Ip+3VFqR0mNs0GdbmbXae7RDjDAvpwqk19wNB5lCyRQ+pL\n\twd2dBW01Ec0jtXpyw4qfX7KgzUgEnKTkKLhAAdmo=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH 2/2] apps: common: dng_writer: Fix RAW10 and RAW12 packing on\n\tBE machines", "Date": "Sat, 29 Jun 2024 00:35:35 +0300", "Message-ID": "<20240628213535.6906-3-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.44.2", "In-Reply-To": "<20240628213535.6906-1-laurent.pinchart@ideasonboard.com>", "References": "<20240628213535.6906-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "The 16-bit padded raw 10 and raw 12 formats are stored in memory in\nlittle endian order, regardless of the machine's endianness. Read pixel\ndata as uint8_t values and hardcode bit shifting to little endian to fix\nscanline packing.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/apps/common/dng_writer.cpp | 24 ++++++++++++------------\n 1 file changed, 12 insertions(+), 12 deletions(-)", "diff": "diff --git a/src/apps/common/dng_writer.cpp b/src/apps/common/dng_writer.cpp\nindex 50db5eb33c83..355433b08d68 100644\n--- a/src/apps/common/dng_writer.cpp\n+++ b/src/apps/common/dng_writer.cpp\n@@ -139,29 +139,29 @@ void packScanlineRaw8(void *output, const void *input, unsigned int width)\n \n void packScanlineRaw10(void *output, const void *input, unsigned int width)\n {\n-\tconst uint16_t *in = static_cast<const uint16_t *>(input);\n+\tconst uint8_t *in = static_cast<const uint8_t *>(input);\n \tuint8_t *out = static_cast<uint8_t *>(output);\n \n \tfor (unsigned int i = 0; i < width; i += 4) {\n-\t\t*out++ = (in[0] & 0x3fc) >> 2;\n-\t\t*out++ = (in[0] & 0x003) << 6 | (in[1] & 0x3f0) >> 4;\n-\t\t*out++ = (in[1] & 0x00f) << 4 | (in[2] & 0x3c0) >> 6;\n-\t\t*out++ = (in[2] & 0x03f) << 2 | (in[3] & 0x300) >> 8;\n-\t\t*out++ = (in[3] & 0x0ff);\n-\t\tin += 4;\n+\t\t*out++ = in[1] << 6 | in[0] >> 2;\n+\t\t*out++ = in[0] << 6 | (in[3] & 0x03) << 4 | in[2] >> 4;\n+\t\t*out++ = in[2] << 4 | (in[5] & 0x03) << 2 | in[4] >> 6;\n+\t\t*out++ = in[4] << 2 | (in[7] & 0x03) << 0;\n+\t\t*out++ = in[6];\n+\t\tin += 8;\n \t}\n }\n \n void packScanlineRaw12(void *output, const void *input, unsigned int width)\n {\n-\tconst uint16_t *in = static_cast<const uint16_t *>(input);\n+\tconst uint8_t *in = static_cast<const uint8_t *>(input);\n \tuint8_t *out = static_cast<uint8_t *>(output);\n \n \tfor (unsigned int i = 0; i < width; i += 2) {\n-\t\t*out++ = (in[0] & 0xff0) >> 4;\n-\t\t*out++ = (in[0] & 0x00f) << 4 | (in[1] & 0xf00) >> 8;\n-\t\t*out++ = (in[1] & 0x0ff);\n-\t\tin += 2;\n+\t\t*out++ = in[1] << 4 | in[0] >> 4;\n+\t\t*out++ = in[0] << 4 | (in[3] & 0x0f);\n+\t\t*out++ = in[2];\n+\t\tin += 4;\n \t}\n }\n \n", "prefixes": [ "2/2" ] }