Patch Detail
Show a patch.
GET /api/patches/19314/?format=api
{ "id": 19314, "url": "https://patchwork.libcamera.org/api/patches/19314/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19314/", "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": "<ZXjl/SEqU3X6skMC@duo.ucw.cz>", "date": "2023-12-12T23:00:13", "name": "[libcamera-devel] statistics cleanup was Re: ... libcamera: ipa: Soft IPA: add a Soft IPA implementation", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f9319fde92b4b46c7eb196ab20af45484e24235b", "submitter": { "id": 49, "url": "https://patchwork.libcamera.org/api/people/49/?format=api", "name": "Pavel Machek", "email": "pavel@ucw.cz" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19314/mbox/", "series": [ { "id": 4116, "url": "https://patchwork.libcamera.org/api/series/4116/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4116", "date": "2023-12-12T23:00:13", "name": "[libcamera-devel] statistics cleanup was Re: ... libcamera: ipa: Soft IPA: add a Soft IPA implementation", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4116/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19314/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19314/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 81EDFC31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 12 Dec 2023 23:00:17 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A8225629BD;\n\tWed, 13 Dec 2023 00:00:16 +0100 (CET)", "from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E045F629BD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Dec 2023 00:00:14 +0100 (CET)", "by jabberwock.ucw.cz (Postfix, from userid 1017)\n\tid 766001C0071; Wed, 13 Dec 2023 00:00:14 +0100 (CET)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1702422016;\n\tbh=IqqYRfcxcU4Dm4kKzrpx9dL2E2y6m2tpuDvvyDpYB/c=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=IRVV1S/DqariCiLf5evNW/Jrell+wIzDyfcm/ijwfcLyFEGZs+jeugnNloTdRku83\n\tkAFvBs8PUCS1KoWJX0GGXKjAHIAwtywDLFsiQXU/qReCBVMSaIaJllWLRzPkyeb14W\n\tjBHMKSLWgNuSIKns9EMTGzhMbIZGeTtqUmrNA6pPt/ixCdDpUgB6g3s8SnLVH2MorT\n\tP5wWCOcxUjOZ3S2EilkEUyRYYMy2tCQJH4LLVrSoofTIu6Ju2lS39swiMPgj/EyoL4\n\tlGNwDYWWoIzdqunxVneWpVMZdDpQgKQEe3fTWcS2ueXtuPN6K0f46KsDv2E/Clgtzf\n\tiEt97diHly/TQ==", "v=1; a=rsa-sha256; c=relaxed/relaxed; d=ucw.cz; s=gen1;\n\tt=1702422014;\n\th=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n\tto:to:cc:cc:mime-version:mime-version:content-type:content-type:\n\tin-reply-to:in-reply-to:references:references;\n\tbh=7w0xL6AB4mKl3Q24XSVREyQkLPmVtZgZelobhcJ8Sws=;\n\tb=hQuLTbK7xfVb4PNF3NDSUdZpcUF6aW5PM0IGf4ScZ2oUjyLkHj42/y+xpS+Hb9/FApJq+X\n\t5eaCjuOPJnvin5L8w4Bou1ToFX/+0JSmP8Rkq9QM49TK6yV3lq/wtqT/HEinkIpsEBAZQx\n\tROCqkNwXGSdNw/ND9wzTNoWmflhxmr0=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ucw.cz header.i=@ucw.cz\n\theader.b=\"hQuLTbK7\"; dkim-atps=neutral", "Date": "Wed, 13 Dec 2023 00:00:13 +0100", "To": "Hans de Goede <hdegoede@redhat.com>", "Message-ID": "<ZXjl/SEqU3X6skMC@duo.ucw.cz>", "References": "<20231212115046.102726-1-andrey.konovalov@linaro.org>\n\t<20231212115046.102726-5-andrey.konovalov@linaro.org>\n\t<ZXiBbvEBns4mdU9/@duo.ucw.cz>\n\t<170239706778.3044059.6462285174630637754@ping.linuxembedded.co.uk>\n\t<dfb2a76c-13ca-4c0b-8d90-a226e83b35f0@linaro.org>\n\t<170239891199.3044059.3154360492786632784@ping.linuxembedded.co.uk>\n\t<ZXiMNSek6vsOi4tA@duo.ucw.cz>\n\t<4dc8535c-53da-4c96-a2c0-1f786a8857f9@redhat.com>", "MIME-Version": "1.0", "Content-Type": "multipart/signed; micalg=pgp-sha1;\n\tprotocol=\"application/pgp-signature\"; boundary=\"iDemGdSRKj64B6dr\"", "Content-Disposition": "inline", "In-Reply-To": "<4dc8535c-53da-4c96-a2c0-1f786a8857f9@redhat.com>", "Subject": "[libcamera-devel] statistics cleanup was Re: ... libcamera: ipa:\n\tSoft IPA: add a Soft IPA implementation", "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": "Pavel Machek via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Pavel Machek <pavel@ucw.cz>", "Cc": "mripard@redhat.com, g.martti@gmail.com, t.langendam@gmail.com,\n\tPavel Machek via libcamera-devel <libcamera-devel@lists.libcamera.org>, \n\tsrinivas.kandagatla@linaro.org, bryan.odonoghue@linaro.org,\n\tadmin@dennisbonke.com", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Hi!\n\n> ATM the statistics and debayer classes are mostly ready,\n> but I need to merge this with Andrey's v2 RFC and\n> then produce a clean new series from this\n> (assuming people like the approach).\n\nCould I get you to apply this?\n\nMy camera is bayer8, so this is compile-tested only, but should give\nsame performance with shorter and more readable source. (It will also\nallow me to add bayer8 statistics with little modifications).\n\nThank you and best regards,\n\t\t\t\t\t\t\t\tPavel", "diff": "diff --git a/src/libcamera/software_isp/swstats_linaro.cpp b/src/libcamera/software_isp/swstats_linaro.cpp\nindex 0323f45f..2f203b17 100644\n--- a/src/libcamera/software_isp/swstats_linaro.cpp\n+++ b/src/libcamera/software_isp/swstats_linaro.cpp\n@@ -38,80 +38,55 @@ static const unsigned int RED_Y_MUL = 77;\t\t/* 0.30 * 256 */\n static const unsigned int GREEN_Y_MUL = 150;\t\t/* 0.59 * 256 */\n static const unsigned int BLUE_Y_MUL = 29;\t\t/* 0.11 * 256 */\n \n-/*\n- * These need to be macros because it accesses a whole bunch of local\n- * variables (and copy and pasting this x times is undesirable)\n- */\n-#define SWISP_LINARO_START_LINE_STATS()\t\t\t\\\n-\tuint8_t r, g, b;\t\t\t\t\\\n-\tunsigned int y_val;\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n-\tunsigned int sumR = 0;\t\t\t\t\\\n-\tunsigned int sumG = 0;\t\t\t\t\\\n-\tunsigned int sumB = 0;\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n-\tunsigned int bright_sum = 0;\t\t\t\\\n-\tunsigned int too_bright_sum = 0;\n-\n-#define SWISP_LINARO_ACCUMULATE_LINE_STATS()\t\t\\\n-\tsumR += r;\t\t\t\t\t\\\n-\tsumG += g;\t\t\t\t\t\\\n-\tsumB += b;\t\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n-\ty_val = r * RED_Y_MUL;\t\t\t\t\\\n-\ty_val += g * GREEN_Y_MUL;\t\t\t\\\n-\ty_val += b * BLUE_Y_MUL;\t\t\t\\\n-\tif (y_val > BRIGHT_LVL) ++bright_sum;\t\t\\\n-\tif (y_val > TOO_BRIGHT_LVL) ++too_bright_sum;\n-\n-#define SWISP_LINARO_FINISH_LINE_STATS()\t\t\\\n-\tstats_.sumR_ += sumR;\t\t\t\t\\\n-\tstats_.sumG_ += sumG;\t\t\t\t\\\n-\tstats_.sumB_ += sumB;\t\t\t\t\\\n-\t\t\t\t\t\t\t\\\n-\tbright_sum_ += bright_sum;\t\t\t\\\n-\ttoo_bright_sum_ += too_bright_sum;\n-\n-void SwStatsLinaro::statsBGGR10PLine(const uint8_t *src0, const uint8_t *src1)\n+static void inline statsBayer(const int width, const uint8_t *src0, const uint8_t *src1, bool bggr, unsigned int &bright_sum, unsigned int &too_bright_sum, StatsLinaro &stats)\n {\n-\tconst int width_in_bytes = width_ * 5 / 4;\n-\tuint8_t g2;\n+\tconst int width_in_bytes = width * 5 / 4;\n+\tuint8_t r, g, b, g2;\n+\tunsigned int y_val;\n \n-\tSWISP_LINARO_START_LINE_STATS()\n+\tstats.sumR_ = 0;\n+\tstats.sumG_ = 0;\n+\tstats.sumB_ = 0;\n \n-\tfor (int x = 0; x < width_in_bytes; x += 5) {\n-\t\t/* BGGR */\n-\t\tb = src0[x];\n-\t\tg = src0[x + 1];\n-\t\tg2 = src1[x];\n-\t\tr = src1[x + 1];\n+\tbright_sum = 0;\n+\ttoo_bright_sum = 0;\n \n+\tfor (int x = 0; x < width_in_bytes; x += 5) {\n+\t\tif (bggr) {\n+\t\t\t/* BGGR */\n+\t\t\tb = src0[x];\n+\t\t\tg = src0[x + 1];\n+\t\t\tg2 = src1[x];\n+\t\t\tr = src1[x + 1];\n+\t\t} else {\n+\t\t\t/* GBRG */\n+\t\t\tg = src0[x];\n+\t\t\tb = src0[x + 1];\n+\t\t\tr = src1[x];\n+\t\t\tg2 = src1[x + 1];\n+\t\t}\n \t\tg = g + g2 / 2;\n \n-\t\tSWISP_LINARO_ACCUMULATE_LINE_STATS()\n+\t\tstats.sumR_ += r;\n+\t\tstats.sumG_ += g;\n+\t\tstats.sumB_ += b;\n+\n+\t\ty_val = r * RED_Y_MUL;\n+\t\ty_val += g * GREEN_Y_MUL;\n+\t\ty_val += b * BLUE_Y_MUL;\n+\t\tif (y_val > BRIGHT_LVL) ++bright_sum;\n+\t\tif (y_val > TOO_BRIGHT_LVL) ++too_bright_sum;\n \t}\n-\tSWISP_LINARO_FINISH_LINE_STATS()\n }\n \n-void SwStatsLinaro::statsGBRG10PLine(const uint8_t *src0, const uint8_t *src1)\n+void SwStatsLinaro::statsBGGR10PLine(const uint8_t *src0, const uint8_t *src1)\n {\n-\tconst int width_in_bytes = width_ * 5 / 4;\n-\tuint8_t g2;\n-\n-\tSWISP_LINARO_START_LINE_STATS()\n-\n-\tfor (int x = 0; x < width_in_bytes; x += 5) {\n-\t\t/* GBRG */\n-\t\tg = src0[x];\n-\t\tb = src0[x + 1];\n-\t\tr = src1[x];\n-\t\tg2 = src1[x + 1];\n-\n-\t\tg = g + g2 / 2;\n+\tstatsBayer(width_, src0, src1, true, bright_sum_, too_bright_sum_, stats_);\n+}\n \n-\t\tSWISP_LINARO_ACCUMULATE_LINE_STATS()\n-\t}\n-\tSWISP_LINARO_FINISH_LINE_STATS()\n+void SwStatsLinaro::statsGBRG10PLine(const uint8_t *src0, const uint8_t *src1)\n+{\n+\tstatsBayer(width_, src0, src1, false, bright_sum_, too_bright_sum_, stats_);\n }\n \n void SwStatsLinaro::statsBGGR10PLine0(const uint8_t *src, unsigned int stride)\n", "prefixes": [ "libcamera-devel" ] }