{"id":12581,"url":"https://patchwork.libcamera.org/api/patches/12581/?format=json","web_url":"https://patchwork.libcamera.org/patch/12581/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20210614095340.3051816-2-naush@raspberrypi.com>","date":"2021-06-14T09:53:35","name":"[libcamera-devel,1/6] ipa: raspberrypi: Non-functional formatting fixes to md_parser.hpp","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ab5226e5bb33c8a0438bc159a66c4d8d63354395","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12581/mbox/","series":[{"id":2128,"url":"https://patchwork.libcamera.org/api/series/2128/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2128","date":"2021-06-14T09:53:34","name":"Raspberry Pi: Metadata parsing improvements","version":1,"mbox":"https://patchwork.libcamera.org/series/2128/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12581/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12581/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 B2658C3218\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 14 Jun 2021 09:53:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EAFF46893A;\n\tMon, 14 Jun 2021 11:53:48 +0200 (CEST)","from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com\n\t[IPv6:2a00:1450:4864:20::32f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 04A3D6892E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Jun 2021 11:53:47 +0200 (CEST)","by mail-wm1-x32f.google.com with SMTP id g204so11746411wmf.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 14 Jun 2021 02:53:47 -0700 (PDT)","from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:fd93:d554:2dff:83ca])\n\tby smtp.gmail.com with ESMTPSA id\n\tc2sm19834891wmf.24.2021.06.14.02.53.45\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 14 Jun 2021 02:53:45 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"OAPPAdz5\"; dkim-atps=neutral","DKIM-Signature":"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=kPuFk49pii5/tLsd+X1YpO60JWW5UTyY5zkbwfO6vXY=;\n\tb=OAPPAdz5P3/NNhMuA9iK/tzwOZ7p/i5nY6U++e8AxFzRxZg57gUuWyd6x3SQyz58kg\n\tBw+rdbo7Q9F9/0WJ/5F2GDCNX7bdgGoNRFg2R0Bd3gQ0IySl9WeKfFhkHH1Wn+MBjR7z\n\t+9/31gOwdQk930n087Mz+uUYeJxkSF9cxYFVZfYdVPddjQpfvQRRJiAFvnNlMkcOqYpP\n\tK3xWofuUILDkiWXi2HX8HitQ1gDPLIuFNJYdKUFxu0rLK/VZb6qXAPQ13a1Ss2s26GSc\n\twlNIez3205H4O8KiMQgSrcfnO5c3Qw7lEe1sF0WZWGyHxkHXBALeOWHVL7H5q4Dvxtyj\n\tJYRA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\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=kPuFk49pii5/tLsd+X1YpO60JWW5UTyY5zkbwfO6vXY=;\n\tb=V/BNthgHBnoZnnsCoYKbDwg3KgKqLZa/gVyfVXyeRhTOvYeznqmNGiLqb4srSELzGM\n\tu0lELBrYKzhO1RjrglpDs+o8MNqErbwsU07BE1nN+/8Ufj8i0kkbYrqShDOF06CkXspo\n\tHooXoevV2fRvcchCbAqbP1tpwHjtPqK/czmDtYAsolJpgd15EEBbYFDbbDLUMdZWfAy8\n\tzCFQ2nNiG3n3dYotj42HXtBOh7s5kpnyhSl2A9Bj97vrSEIAZ9JpfJRihL50BAgBtsg+\n\th+TocUCMQqKQGMnYYta73bdsdjeI6gBaUamakrruHoMU4tsgewVGHGCeyhBj2SRDsUiF\n\tOTrQ==","X-Gm-Message-State":"AOAM532nptT2X+ocRVHov1oeJiLle6gJqArdQVuOqOWx6yY0d03qu7XD\n\tVLKEOcMkrrusb7HOKuHF/KoJ+tmpd9sL5A==","X-Google-Smtp-Source":"ABdhPJzj0+4a2MQHE9wPcwVMuRyThPkLT4y5H1fZyb7tHQEQdiRySytjCFDl0CCtpdZgpTAazNQrCw==","X-Received":"by 2002:a7b:c7c5:: with SMTP id z5mr15247797wmk.77.1623664426310;\n\tMon, 14 Jun 2021 02:53:46 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 14 Jun 2021 10:53:35 +0100","Message-Id":"<20210614095340.3051816-2-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20210614095340.3051816-1-naush@raspberrypi.com>","References":"<20210614095340.3051816-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 1/6] ipa: raspberrypi: Non-functional\n\tformatting fixes to md_parser.hpp","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":"Adjust source formatting to closer match libcamera guidelines:\n\n- Remove unused header files.\n- Switch to C style comments.\n- Add whitespace for readability.\n\nThere are no functional changes in this commit.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/md_parser.hpp | 144 ++++++++++++++++++------------\n 1 file changed, 85 insertions(+), 59 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/md_parser.hpp b/src/ipa/raspberrypi/md_parser.hpp\nindex 8e22b1d7ca43..86e0577614e0 100644\n--- a/src/ipa/raspberrypi/md_parser.hpp\n+++ b/src/ipa/raspberrypi/md_parser.hpp\n@@ -6,75 +6,94 @@\n  */\n #pragma once\n \n-#include <stdint.h>\n-\n #include <libcamera/span.h>\n \n /* Camera metadata parser class. Usage as shown below.\n-\n-Setup:\n-\n-Usually the metadata parser will be made as part of the CamHelper class so\n-application code doesn't have to worry which to kind to instantiate. But for\n-the sake of example let's suppose we're parsing imx219 metadata.\n-\n-MdParser *parser = new MdParserImx219();  // for example\n-parser->SetBitsPerPixel(bpp);\n-parser->SetLineLengthBytes(pitch);\n-parser->SetNumLines(2);\n-\n-Note 1: if you don't know how many lines there are, the size of the input\n-buffer is used as a limit instead.\n-\n-Note 2: if you don't know the line length, you can leave the line length unset\n-(or set to zero) and the parser will hunt for the line start instead.\n-\n-Then on every frame:\n-\n-if (parser->Parse(buffer) != MdParser::OK)\n-    much badness;\n-unsigned int exposure_lines, gain_code\n-if (parser->GetExposureLines(exposure_lines) != MdParser::OK)\n-    exposure was not found;\n-if (parser->GetGainCode(parser, gain_code) != MdParser::OK)\n-    gain code was not found;\n-\n-(Note that the CamHelper class converts to/from exposure lines and time,\n-and gain_code / actual gain.)\n-\n-If you suspect your embedded data may have changed its layout, change any line\n-lengths, number of lines, bits per pixel etc. that are different, and\n-then:\n-\n-parser->Reset();\n-\n-before calling Parse again. */\n+ *\n+ * Setup:\n+ *\n+ * Usually the metadata parser will be made as part of the CamHelper class so\n+ * application code doesn't have to worry which to kind to instantiate. But for\n+ * the sake of example let's suppose we're parsing imx219 metadata.\n+ *\n+ * MdParser *parser = new MdParserImx219();  // for example\n+ * parser->SetBitsPerPixel(bpp);\n+ * parser->SetLineLengthBytes(pitch);\n+ * parser->SetNumLines(2);\n+ *\n+ * Note 1: if you don't know how many lines there are, the size of the input\n+ * buffer is used as a limit instead.\n+ *\n+ * Note 2: if you don't know the line length, you can leave the line length unset\n+ * (or set to zero) and the parser will hunt for the line start instead.\n+ *\n+ * Then on every frame:\n+ *\n+ * if (parser->Parse(buffer) != MdParser::OK)\n+ *     much badness;\n+ * unsigned int exposure_lines, gain_code\n+ * if (parser->GetExposureLines(exposure_lines) != MdParser::OK)\n+ *     exposure was not found;\n+ * if (parser->GetGainCode(parser, gain_code) != MdParser::OK)\n+ *     gain code was not found;\n+ *\n+ * (Note that the CamHelper class converts to/from exposure lines and time,\n+ * and gain_code / actual gain.)\n+ *\n+ * If you suspect your embedded data may have changed its layout, change any line\n+ * lengths, number of lines, bits per pixel etc. that are different, and\n+ * then:\n+ *\n+ * parser->Reset();\n+ *\n+ * before calling Parse again.\n+ */\n \n namespace RPiController {\n \n-// Abstract base class from which other metadata parsers are derived.\n+/* Abstract base class from which other metadata parsers are derived. */\n \n class MdParser\n {\n public:\n-\t// Parser status codes:\n-\t// OK       - success\n-\t// NOTFOUND - value such as exposure or gain was not found\n-\t// ERROR    - all other errors\n+\t/*\n+\t * Parser status codes:\n+\t * OK       - success\n+\t * NOTFOUND - value such as exposure or gain was not found\n+\t * ERROR    - all other errors\n+\t */\n \tenum Status {\n \t\tOK = 0,\n \t\tNOTFOUND = 1,\n \t\tERROR = 2\n \t};\n-\tMdParser() : reset_(true) {}\n+\n+\tMdParser() : reset_(true)\n+\t{\n+\t}\n+\n \tvirtual ~MdParser() = default;\n-\tvoid Reset() { reset_ = true; }\n-\tvoid SetBitsPerPixel(int bpp) { bits_per_pixel_ = bpp; }\n-\tvoid SetNumLines(unsigned int num_lines) { num_lines_ = num_lines; }\n+\n+\tvoid Reset()\n+\t{\n+\t\treset_ = true;\n+\t}\n+\n+\tvoid SetBitsPerPixel(int bpp)\n+\t{\n+\t\tbits_per_pixel_ = bpp;\n+\t}\n+\n+\tvoid SetNumLines(unsigned int num_lines)\n+\t{\n+\t\tnum_lines_ = num_lines;\n+\t}\n+\n \tvoid SetLineLengthBytes(unsigned int num_bytes)\n \t{\n \t\tline_length_bytes_ = num_bytes;\n \t}\n+\n \tvirtual Status Parse(libcamera::Span<const uint8_t> buffer) = 0;\n \tvirtual Status GetExposureLines(unsigned int &lines) = 0;\n \tvirtual Status GetGainCode(unsigned int &gain_code) = 0;\n@@ -87,22 +106,28 @@ protected:\n \tunsigned int buffer_size_bytes_;\n };\n \n-// This isn't a full implementation of a metadata parser for SMIA sensors,\n-// however, it does provide the findRegs method which will prove useful and make\n-// it easier to implement parsers for other SMIA-like sensors (see\n-// md_parser_imx219.cpp for an example).\n+/*\n+ * This isn't a full implementation of a metadata parser for SMIA sensors,\n+ * however, it does provide the findRegs method which will prove useful and make\n+ * it easier to implement parsers for other SMIA-like sensors (see\n+ * md_parser_imx219.cpp for an example).\n+ */\n \n class MdParserSmia : public MdParser\n {\n public:\n-\tMdParserSmia() : MdParser() {}\n+\tMdParserSmia() : MdParser()\n+\t{\n+\t}\n \n protected:\n-\t// Note that error codes > 0 are regarded as non-fatal; codes < 0\n-\t// indicate a bad data buffer. Status codes are:\n-\t// PARSE_OK     - found all registers, much happiness\n-\t// MISSING_REGS - some registers found; should this be a hard error?\n-\t// The remaining codes are all hard errors.\n+\t/*\n+\t * Note that error codes > 0 are regarded as non-fatal; codes < 0\n+\t * indicate a bad data buffer. Status codes are:\n+\t * PARSE_OK     - found all registers, much happiness\n+\t * MISSING_REGS - some registers found; should this be a hard error?\n+\t * The remaining codes are all hard errors.\n+\t */\n \tenum ParseStatus {\n \t\tPARSE_OK      =  0,\n \t\tMISSING_REGS  =  1,\n@@ -112,6 +137,7 @@ protected:\n \t\tBAD_LINE_END  = -4,\n \t\tBAD_PADDING   = -5\n \t};\n+\n \tParseStatus findRegs(libcamera::Span<const uint8_t> buffer, uint32_t regs[],\n \t\t\t     int offsets[], unsigned int num_regs);\n };\n","prefixes":["libcamera-devel","1/6"]}