Patch Detail
Show a patch.
GET /api/1.1/patches/16616/?format=api
{ "id": 16616, "url": "https://patchwork.libcamera.org/api/1.1/patches/16616/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16616/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20220713092159.9014-7-naush@raspberrypi.com>", "date": "2022-07-13T09:21:57", "name": "[libcamera-devel,v4,6/8] utils: raspberrypi: Add tuning file conversion script", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "f8f83531171fe1653b39e198a1afc76dfd5f7d80", "submitter": { "id": 34, "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api", "name": "Naushir Patuck", "email": "naush@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/16616/mbox/", "series": [ { "id": 3277, "url": "https://patchwork.libcamera.org/api/1.1/series/3277/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3277", "date": "2022-07-13T09:21:51", "name": "Replace boost JSON parser with libyaml in Raspberry Pi IPA", "version": 4, "mbox": "https://patchwork.libcamera.org/series/3277/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16616/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16616/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 40C44BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Jul 2022 09:22:26 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EBC5563311;\n\tWed, 13 Jul 2022 11:22:25 +0200 (CEST)", "from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com\n\t[IPv6:2a00:1450:4864:20::42b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 78CC86331E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Jul 2022 11:22:20 +0200 (CEST)", "by mail-wr1-x42b.google.com with SMTP id r14so14649175wrg.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Jul 2022 02:22:20 -0700 (PDT)", "from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tbd20-20020a05600c1f1400b0039747cf8354sm1514778wmb.39.2022.07.13.02.22.18\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 13 Jul 2022 02:22:18 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657704145;\n\tbh=6Qi+mMmtUhg+cXIdprUkkvhZHWWZEI1hR3V2T+/VXkk=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=kWkWwLsdU3kLhZ9NlpyobkDLiBzHmRdCqn2taLRvyI2dAX4oSH0SevxpKL8RXZqUq\n\tWFEgOiK3GYun+x6S1W9zGA+PND7+O3n5DThwJheDcILsqe9v4jqf+pl4NZwUfHrdOb\n\tUOfognHmVAvam51Db2XPygBkFBbq+ol48TcZpE3I6//GQvj5FAZa2HhwGEGMc3irJl\n\toU+8zj4W12X2FKt9Z0mJAucz2ma8hQ3aT6MMSagCFoGeyExC9yj7WOKSKHk0E4edUm\n\tjaNOIJb9DuNq7j9vT44PjvGf5yL0G4lvoFWwUaKWtXktsgMH/DN0roPO2zXM5PzWxN\n\t1o0xUTEsGEB4g==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=Ji6mFJZozAqosAIowcOQ7v5MRS1VSrt09iAFZRMrQjU=;\n\tb=oVzUy1pktxnl2O1cGh4keINqFM66/vvqpYrpLq1o5KX1QW3Mvm7hq/kJSgOTSb/GIR\n\t18HBPZ2p92Shq3cVNgk/76CYum3xAk+4HKSDrcVwJgd2B+tpe7I+Oz6ds7Xz50y9TnfV\n\tj7VSWL5ls0TaNN+58AHXWJ6cbYCHMvT5tBlGj0nBV6/NoRzSLD86LaU4Aiw+7SWl//jd\n\tjK6SgP+nLzZJURtZP/772DLPprNhoHpoQGH1MM5cpy2My+RaZRnv05FSr7o80Jhq+dIz\n\t0wzgHZLePHloUMBh+aL6+Whbn8l7FTIvSzyFw9s26BMmgnDsZxLVK9Hiqi6QyftWr0UE\n\tqSeQ==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"oVzUy1pk\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=Ji6mFJZozAqosAIowcOQ7v5MRS1VSrt09iAFZRMrQjU=;\n\tb=NUJBSmvfWoZZ0HxZnIZ13Y9hO0xYtkFUmAW6XayRuInb8Zd1pcz42j6oN+jng5uE23\n\tTuXUB/FttWd59o+W2YweQsXfzvtgi+pkmv1+6g2mBcAuA6+ijNstYIWBjN2EB8MCahQt\n\tVFeA/l6QcWxVfaUQjM0q2TDmbmTnfM+794agKspYp3zHwJOvKihHzBmm83v8MdA00jBR\n\tnXHAJoLxibfzVRJa14TvtMTP4MSiaRND2FyiP7f6ez5o16NgwmZWXiqtWeGSgfAyGdgl\n\tQRw5B/Qz4wQspMvZJV/BOqiKB+YDckIujCfIFha2ZuMTpT9NnHYARHzytN83y0S3716X\n\tI4zw==", "X-Gm-Message-State": "AJIora9BQ13GvcmlHDWh+GL1ZbzjzW3E8I2xTUcdCyKMl0ehPjGfnMJJ\n\tsZeaNlI5TX+10YNZsX2ks6LLQowvXawPCg==", "X-Google-Smtp-Source": "AGRyM1u+y4ufdkwNC7ybWM1jEf6bz1po4hh/fhL/m98vyMhZ2V23zYhHSmcV+pMxeqStojy8g+vb5Q==", "X-Received": "by 2002:a05:6000:168e:b0:21d:b9bf:5e39 with SMTP id\n\ty14-20020a056000168e00b0021db9bf5e39mr2431700wrd.71.1657704139273; \n\tWed, 13 Jul 2022 02:22:19 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Wed, 13 Jul 2022 10:21:57 +0100", "Message-Id": "<20220713092159.9014-7-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "In-Reply-To": "<20220713092159.9014-1-naush@raspberrypi.com>", "References": "<20220713092159.9014-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 6/8] utils: raspberrypi: Add tuning\n\tfile conversion script", "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>", "From": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Naushir Patuck <naush@raspberrypi.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add a script to convert the Raspberry Pi camera tuning file format from version\n1.0 to 2.0.\n\nThe version 1.0 format was originally used with the boost JSON parser that\nhappen to provided algorithm ordering based on the ordering in the file. The new\nformat provides implicit ordering by having the algorithms listed in an array.\n\nThis script also adds a root level version key set to 2.0 to the config file,\nallowing the controller to distinguish between the two formats.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n utils/raspberrypi/ctt/convert_tuning.py | 94 +++++++++++++++++++++++++\n 1 file changed, 94 insertions(+)\n create mode 100755 utils/raspberrypi/ctt/convert_tuning.py", "diff": "diff --git a/utils/raspberrypi/ctt/convert_tuning.py b/utils/raspberrypi/ctt/convert_tuning.py\nnew file mode 100755\nindex 000000000000..3396bebe8f4e\n--- /dev/null\n+++ b/utils/raspberrypi/ctt/convert_tuning.py\n@@ -0,0 +1,94 @@\n+#!/bin/python3\n+# Script to convert version 1.0 Raspberry Pi camera tuning files to version 2.0\n+# and later.\n+#\n+# Copyright 2022 Raspberry Pi Ltd.\n+\n+import argparse\n+import json\n+import textwrap\n+\n+\n+class Encoder(json.JSONEncoder):\n+\n+ def __init__(self, *args, **kwargs):\n+ super().__init__(*args, **kwargs)\n+ self.indentation_level = 0\n+ self.soft_break = 80\n+ self.hard_break = 120\n+\n+ def encode(self, o):\n+ if isinstance(o, (list, tuple)):\n+ if not any(isinstance(el, (list, tuple, dict)) for el in o):\n+ s = ', '.join(json.dumps(el) for el in o)\n+ if len(s) > self.soft_break:\n+ self.indentation_level += 1\n+ t = textwrap.wrap(s, self.hard_break, break_long_words=False,\n+ initial_indent=self.indent_str, subsequent_indent=self.indent_str)\n+ self.indentation_level -= 1\n+ output = '\\n'.join(t)\n+ output = f'\\n{self.indent_str}[\\n{output}\\n{self.indent_str}]'\n+ else:\n+ output = f' [ {s} ]'\n+ return output\n+ else:\n+ self.indentation_level += 1\n+ output = [self.indent_str + self.encode(el) for el in o]\n+ self.indentation_level -= 1\n+ output = ',\\n'.join(output)\n+ return f' [\\n{output}\\n{self.indent_str}]'\n+\n+ elif isinstance(o, dict):\n+ self.indentation_level += 1\n+ output = []\n+ for k, v in o.items():\n+ sep = f'\\n{self.indent_str}' if isinstance(v, dict) else ''\n+ output.append(self.indent_str + f'{json.dumps(k)}:{sep}{self.encode(v)}')\n+ self.indentation_level -= 1\n+ output = ',\\n'.join(output)\n+ return f'{{\\n{output}\\n{self.indent_str}}}'\n+\n+ else:\n+ return ' ' + json.dumps(o)\n+\n+ @property\n+ def indent_str(self) -> str:\n+ return ' ' * self.indentation_level * self.indent\n+\n+ def iterencode(self, o, **kwargs):\n+ return self.encode(o)\n+\n+\n+def convert_v2(in_json):\n+\n+ ver = 1.0 if 'version' not in in_json.keys() else in_json['version']\n+\n+ if ver != 1.0:\n+ print(f'Cannot convert version {ver} format to version 2.0!')\n+ exit(-1)\n+\n+ converted = {}\n+ converted['version'] = 2.0\n+ converted['algorithms'] = []\n+\n+ for k, v in in_json.items():\n+ if k == 'version':\n+ continue\n+ converted['algorithms'].append(dict(zip([k], [v])))\n+\n+ return json.dumps(converted, cls=Encoder, indent=4, sort_keys=False)\n+\n+\n+if __name__ == \"__main__\":\n+ parser = argparse.ArgumentParser(description='Convert the format of the Raspberry Pi camera tuning file from v1 to v2.')\n+ parser.add_argument('input', type=str, nargs=1, help='Input config file')\n+ parser.add_argument('output', type=str, nargs='?', help='Output converted config file', default=None)\n+ args = parser.parse_args()\n+\n+ with open(args.input[0], 'r') as f:\n+ in_json = json.load(f)\n+\n+ out_json = convert_v2(in_json)\n+\n+ with open(args.output if args.output is not None else args.input[0], 'w') as f:\n+ f.write(out_json)\n", "prefixes": [ "libcamera-devel", "v4", "6/8" ] }