[{"id":22577,"web_url":"https://patchwork.libcamera.org/comment/22577/","msgid":"<YkxqrQJlbRrihOrr@pendragon.ideasonboard.com>","date":"2022-04-05T16:13:33","subject":"Re: [libcamera-devel] [PATCH v2 1/5] define Span size as shape\n\tvector","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Christian,\n\nThank you for the patch.\n\nThe subject line should be\n\nlibcamera: controls: Define size of array controls as a shape vector\n\n(for the right prefix, and because you're modifying controls, not the\nSpan class)\n\nOn Tue, Apr 05, 2022 at 01:42:11AM +0100, Christian Rauch via libcamera-devel wrote:\n> This follows the convention in other Tensor APIs. Since all tensors are\n> represented as a Span with a single dimension, values provided in 'size'\n> are interpreted as fixed-size Spans, while an empty array (\"[]\") will be\n> interpreted as variable-sized Span.\n\nIn tensorflow notation (and I suppose other tensor APIs), the [] shape\ndescribes a scalar. Should we keep \"n\" to denote a variable number of\nelements, but still apply the change that uses the comma as a separator\ninstead of the 'x' ? Otherwise a variable-length array of objects that\nhave three components would have \"[3,]\" as a shape, which looks quite\nweird.\n\nThere may be alternatives, such as using \"*\" instead of \"n\" for\ninstance. I don't know if there's any standard(ish) notation.\n\n> Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de>\n> ---\n>  src/libcamera/control_ids.yaml  | 2 +-\n>  src/libcamera/property_ids.yaml | 4 ++--\n>  2 files changed, 3 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\n> index 9d4638ae..c3f593a1 100644\n> --- a/src/libcamera/control_ids.yaml\n> +++ b/src/libcamera/control_ids.yaml\n> @@ -291,7 +291,7 @@ controls:\n>          transformation. The 3x3 matrix is stored in conventional reading\n>          order in an array of 9 floating point values.\n> \n> -      size: [3x3]\n> +      size: [3,3]\n> \n>    - ScalerCrop:\n>        type: Rectangle\n> diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml\n> index 12ecbce5..47c350ed 100644\n> --- a/src/libcamera/property_ids.yaml\n> +++ b/src/libcamera/property_ids.yaml\n> @@ -497,7 +497,7 @@ controls:\n> \n>    - PixelArrayOpticalBlackRectangles:\n>        type: Rectangle\n> -      size: [n]\n> +      size: []\n>        description: |\n>          The pixel array region(s) which contain optical black pixels\n>          considered valid for calibration purposes.\n> @@ -592,7 +592,7 @@ controls:\n> \n>    - PixelArrayActiveAreas:\n>        type: Rectangle\n> -      size: [n]\n> +      size: []\n>        description: |\n>          The PixelArrayActiveAreas property defines the (possibly multiple and\n>          overlapping) portions of the camera sensor readable pixel matrix","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 57C46C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Apr 2022 16:13:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AB20265642;\n\tTue,  5 Apr 2022 18:13:38 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AF3CC604BB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Apr 2022 18:13:37 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2FD365D;\n\tTue,  5 Apr 2022 18:13:36 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649175218;\n\tbh=3woiXBmpfkWETIPmV8AXxMrGlT4kwAGvIxS0jv+YW5U=;\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=4G7yPJtS3JfvUpJF3xaTavHW8WeJRaof/fwCfgJ3abzFfB8+ZUvoK+C796L5wpSWX\n\thlHqqhZfaWBEXMug3yVnZWwNpo3eqbpn66dZDdeWYE37xnMSSGQ1mR2Vo81ringbG/\n\ta6heJQ4F3wwrrkoW9/TwKWX7mf6GfO5JHpCC9Jtn5DhvS46n/ZveaJJ4z9Ay9CL20B\n\tDVqYZpD2oHWBWib33oXNawm7Kjv5Vsg7NpG84kJC/VKBdcQTo043cwxZcvlKe8wAsh\n\tPAnBO1fiWEJI8wwYAlZKtvG8ddko9/BDxvaL9KMHCMnhNoz5Pt4eDHWC1uL3AhYDSi\n\tjJ/lQtx9O39Lw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1649175216;\n\tbh=3woiXBmpfkWETIPmV8AXxMrGlT4kwAGvIxS0jv+YW5U=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=RXSw7iGy78z+bycOTDrBMXIWIjVxBf2tQ86fis9qAWGN5HgMN1FkjGoFL2xAlXlKz\n\tJikCcgwbGJUqfIWHSh8v/UQrZGfe808t4B7NEKxa1x6Fp+ZaFd4l3fR55sod1sTk78\n\t/f80y832PKW9i6MHpnXobnq3m2SwSx8/QL7zIN/8="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"RXSw7iGy\"; dkim-atps=neutral","Date":"Tue, 5 Apr 2022 19:13:33 +0300","To":"Christian Rauch <Rauch.Christian@gmx.de>","Message-ID":"<YkxqrQJlbRrihOrr@pendragon.ideasonboard.com>","References":"<20220405004215.86340-1-Rauch.Christian@gmx.de>\n\t<20220405004215.86340-2-Rauch.Christian@gmx.de>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220405004215.86340-2-Rauch.Christian@gmx.de>","Subject":"Re: [libcamera-devel] [PATCH v2 1/5] define Span size as shape\n\tvector","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22584,"web_url":"https://patchwork.libcamera.org/comment/22584/","msgid":"<cd6d55bd-d844-9f56-54bb-5f29747f1d37@gmx.de>","date":"2022-04-05T22:37:05","subject":"Re: [libcamera-devel] [PATCH v2 1/5] define Span size as shape\n\tvector","submitter":{"id":111,"url":"https://patchwork.libcamera.org/api/people/111/","name":"Christian Rauch","email":"Rauch.Christian@gmx.de"},"content":"Hi Laurent,\n\nAm 05.04.22 um 17:13 schrieb Laurent Pinchart:\n> Hi Christian,\n>\n> Thank you for the patch.\n>\n> The subject line should be\n>\n> libcamera: controls: Define size of array controls as a shape vector\n>\n> (for the right prefix, and because you're modifying controls, not the\n> Span class)\n>\n> On Tue, Apr 05, 2022 at 01:42:11AM +0100, Christian Rauch via libcamera-devel wrote:\n>> This follows the convention in other Tensor APIs. Since all tensors are\n>> represented as a Span with a single dimension, values provided in 'size'\n>> are interpreted as fixed-size Spans, while an empty array (\"[]\") will be\n>> interpreted as variable-sized Span.\n>\n> In tensorflow notation (and I suppose other tensor APIs), the [] shape\n> describes a scalar. Should we keep \"n\" to denote a variable number of\n> elements, but still apply the change that uses the comma as a separator\n> instead of the 'x' ? Otherwise a variable-length array of objects that\n> have three components would have \"[3,]\" as a shape, which looks quite\n> weird.\n\nWe don't have to follow an established notation. For simplicity, I would\nsuggest that the \"size\" should be an array of the dimension sizes, since\nthis already matches the yaml format and is simple to parse.\nIn numpy, an empty array will give an empty shape (\"np.empty([]).shape\"\ngives \"()\"). This would align with the proposal above. One-dimensional\nshapes \"[3,]\" and \"[3]\" would be equivalent. I would not use a special\ncharacter to indicate variable-size Spans as this makes parsing more\ncomplex.\n\n>\n> There may be alternatives, such as using \"*\" instead of \"n\" for\n> instance. I don't know if there's any standard(ish) notation.\n>\n>> Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de>\n>> ---\n>>  src/libcamera/control_ids.yaml  | 2 +-\n>>  src/libcamera/property_ids.yaml | 4 ++--\n>>  2 files changed, 3 insertions(+), 3 deletions(-)\n>>\n>> diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\n>> index 9d4638ae..c3f593a1 100644\n>> --- a/src/libcamera/control_ids.yaml\n>> +++ b/src/libcamera/control_ids.yaml\n>> @@ -291,7 +291,7 @@ controls:\n>>          transformation. The 3x3 matrix is stored in conventional reading\n>>          order in an array of 9 floating point values.\n>>\n>> -      size: [3x3]\n>> +      size: [3,3]\n>>\n>>    - ScalerCrop:\n>>        type: Rectangle\n>> diff --git a/src/libcamera/property_ids.yaml b/src/libcamera/property_ids.yaml\n>> index 12ecbce5..47c350ed 100644\n>> --- a/src/libcamera/property_ids.yaml\n>> +++ b/src/libcamera/property_ids.yaml\n>> @@ -497,7 +497,7 @@ controls:\n>>\n>>    - PixelArrayOpticalBlackRectangles:\n>>        type: Rectangle\n>> -      size: [n]\n>> +      size: []\n>>        description: |\n>>          The pixel array region(s) which contain optical black pixels\n>>          considered valid for calibration purposes.\n>> @@ -592,7 +592,7 @@ controls:\n>>\n>>    - PixelArrayActiveAreas:\n>>        type: Rectangle\n>> -      size: [n]\n>> +      size: []\n>>        description: |\n>>          The PixelArrayActiveAreas property defines the (possibly multiple and\n>>          overlapping) portions of the camera sensor readable pixel matrix\n>","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 705ADC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Apr 2022 22:37:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B454265642;\n\tWed,  6 Apr 2022 00:37:08 +0200 (CEST)","from mout.gmx.net (mout.gmx.net [212.227.17.20])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 635F3633A5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Apr 2022 00:37:06 +0200 (CEST)","from [192.168.1.209] ([92.10.251.63]) by mail.gmx.net (mrgmx104\n\t[212.227.17.168]) with ESMTPSA (Nemesis) id 1Mnpnm-1oMXQB2Zsg-00pItG;\n\tWed, 06 Apr 2022 00:37:05 +0200"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649198228;\n\tbh=dRyW5mF/zvhg7Dwq/JzPGbTlFc90/oSNA5wMDmIbQMw=;\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=S5son0rWaZthwB4pBPkZcGZ3jj0ul8xB532RRaHK592n6JuQg0dkiKdgO1hCMWZ3H\n\tvwCncm1ZTBaLFMUnozJKoFwVgiPHS6PEgfqcOKvMhd9F6cwDgm2XLxibwYat7YzNCu\n\tc+nsurcEOKuQgBrlC3LY7jZTUf4r8GrYkGyO/ZsbYHaSvIOifoSTi3vvaV7pxm8Q85\n\tffTTbM4LChE1Hm43trCvgcJ4da3ha8LMZqwQU8gtPdv886WDkNQDvovz6cQWmSq2jt\n\tuZ6zhcdX4NihlfC9KmAwPcebTHTweh3QKPCRbCmNORLGFVE7N/c2rkjSlguQ/F7Br2\n\teQ2WMrfxD6foA==","v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;\n\ts=badeba3b8450; t=1649198225;\n\tbh=dRyW5mF/zvhg7Dwq/JzPGbTlFc90/oSNA5wMDmIbQMw=;\n\th=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To;\n\tb=RF5Hfe74ux7hxoM58Yk7HaFsuzU+NuXKe2MfxB0FWooY7xQemctJ/BW2xZzYjsLWg\n\tF/Q8E07HsuCFERET9edCWcl9Ev7RxdjgalXAoCmv8s9ZGomp2Wrr3r7wGmKgpwMhhd\n\tzuOkVSBLkE0hvWtETolYCS73i/JzLFk6iVosTDnk="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=gmx.net header.i=@gmx.net\n\theader.b=\"RF5Hfe74\"; dkim-atps=neutral","X-UI-Sender-Class":"01bb95c1-4bf8-414a-932a-4f6e2808ef9c","Message-ID":"<cd6d55bd-d844-9f56-54bb-5f29747f1d37@gmx.de>","Date":"Tue, 5 Apr 2022 23:37:05 +0100","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.7.0","Content-Language":"en-CA","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20220405004215.86340-1-Rauch.Christian@gmx.de>\n\t<20220405004215.86340-2-Rauch.Christian@gmx.de>\n\t<YkxqrQJlbRrihOrr@pendragon.ideasonboard.com>","In-Reply-To":"<YkxqrQJlbRrihOrr@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"quoted-printable","X-Provags-ID":"V03:K1:04GQAhfgCIsJV3xf6/vPZcZafIAg/ghcLgg/r5ZeWDfQFQTV+rr\n\trsrbKae/DVerLYMMAGbK4KwvY/RjR3oCpTBKWOJGXMmOjnIuYTXY+I1AjaYE1flNb5UMeQr\n\tixrpx9XTgciS3RtBfkAyJ36asraad96yS6XSb8pBZsThsHn/llwNJdpelfTTMt3MtyYRD3l\n\tbZbptgbQrF7zs/StIzUhQ==","X-Spam-Flag":"NO","X-UI-Out-Filterresults":"notjunk:1; V03:K0:zz+FJNkNbGA=:sBJljAFCZIzleqayfAbDjI\n\tNtFBYHOLkyZSe0MAtGpBAf8y56qKFaOeLnOqgYhTir6IrhxSQkIwMVEScvl0MuZTIIuSeBDZp\n\tW0lfX8vPtkWs0dbzAkwa7iZ95X8Qu5ah0IoN78Z14De+CfoWkg4BZeWLLvohqRCyk63Q6HSd6\n\tNTvNg0V7/iKzIJjF00xtLdwGCTMAM8v3v824l/c29LDPx/05cqdGxx8D3l62BKodbat44J3bI\n\tGoohz8KSBsLjSzOLwDBSCiuGsjlp2MubVNNKn8Atyz9G2AOGQTYN/vxsWME69rQ8iquk1tNSu\n\tsAbKzbCHbWmqTtsNwiiwx+O2cA/gVNCPgwx8Uf0ywZuXoQhOSXPB/GM56evlX6yCnLWmjQ4SH\n\tqg8JNnd7e8xGdPlXJtAOygCqpy0qEg+bpldGfGCUxUTINRJ2mt0i4lQewWXV0QaBM3zvsyvwb\n\tAFXXAP5kz3OG95k60y9dsyo3wHBcJF4eYR5lOFEHJ9npAWmRfjd6lg0AZ2I7bYe0r/9Ho95Yw\n\tGyJ4KTdhle8sLiIHFn0+CuT72zg4tuLURLcRx51s0WJ8scO/gMBW+B/PdG31w/pZd8IMzpjXp\n\tsFlbWyqTJTz+JafUk9CaeOvkezsDxHqtXib95QJzsVDCbdwHpcB0bgEiGrMMzXFvzE80pA2Gh\n\t2knGdOvVV2uIb+5Os1HDdzLjFKQTeya6fCCiKFcXtxO1Zin8KEq0nmRvBHnhK2ZXMi47ircJr\n\t/7lx6kn6A63y5ODIwpKgZCPV32pJ+hEDZpzepGSKn1QzozDMQWzSRBbxHhp47ss6TffDgxbws\n\tznldse6r5LHMaBkWpvM7ykTyzih9REvq2MRMUjmhdsFXuJyvl8R7LT1oy9qPCnr/ghVG928eQ\n\t9lZU2PptCsWsQTsFNU/VJjhv3ONaHs5Z8zgC9Gndl2RiixnH++w6ahYIO5PuqqbRYcOVqFjVP\n\t+EDrEPKUZYV2KZAmv/z8LU8ICAuhR2Jx8zs08UtRQZE/8nLPYOGhEoaSWPiz57zIUV+AfKA+s\n\tEtCehuTDik31pNn7oqqD8Xs6wEV16ONkOq0t8rQ7Xx7d1QOyQ+LrCptfI56KoHlxJbIEdpUOu\n\tDNxGkVtMi7+6ps=","Subject":"Re: [libcamera-devel] [PATCH v2 1/5] define Span size as shape\n\tvector","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":"Christian Rauch via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Christian Rauch <Rauch.Christian@gmx.de>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]