[{"id":17440,"web_url":"https://patchwork.libcamera.org/comment/17440/","msgid":"<20210607142926.zofyymvza3vasjjo@uno.localdomain>","date":"2021-06-07T14:29:26","subject":"Re: [libcamera-devel] [PATCH v7 3/6] libcamera:\n\tCameraSensorProperties: Add table of v4l2 index and test pattern","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Hiro,\n\nOn Mon, Jun 07, 2021 at 10:13:59AM +0900, Hirokazu Honda wrote:\n> The V4L2 specification defines the sensor test pattern modes\n> through a menu control, where a numerical index is associated to\n> a string that describes the test pattern. The index-to-pattern\n> mapping is driver specific and requires a corresponding representation\n> in the library.\n>\n> Add to the static list of CameraSensorProperties a map of indexes to\n> libcamera::controls::TestPatternModes values to be able to map the\n> indexes returned by the driver to the corresponding test pattern mode.\n>\n> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> ---\n>  .../internal/camera_sensor_properties.h       |  2 ++\n>  src/libcamera/camera_sensor_properties.cpp    | 31 +++++++++++++++++++\n>  2 files changed, 33 insertions(+)\n>\n> diff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h\n> index f5e242cb..67c77920 100644\n> --- a/include/libcamera/internal/camera_sensor_properties.h\n> +++ b/include/libcamera/internal/camera_sensor_properties.h\n> @@ -7,6 +7,7 @@\n>  #ifndef __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__\n>  #define __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__\n>\n> +#include <map>\n>  #include <string>\n>\n>  #include <libcamera/geometry.h>\n> @@ -17,6 +18,7 @@ struct CameraSensorProperties {\n>  \tstatic const CameraSensorProperties *get(const std::string &sensor);\n>\n>  \tSize unitCellSize;\n> +\tstd::map<int32_t, int32_t> testPatternModes;\n>  };\n>\n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/camera_sensor_properties.cpp b/src/libcamera/camera_sensor_properties.cpp\n> index a2c04009..14270ef9 100644\n> --- a/src/libcamera/camera_sensor_properties.cpp\n> +++ b/src/libcamera/camera_sensor_properties.cpp\n> @@ -9,6 +9,8 @@\n>\n>  #include <map>\n>\n> +#include <libcamera/control_ids.h>\n> +\n>  #include \"libcamera/internal/log.h\"\n>\n>  /**\n> @@ -34,6 +36,11 @@ LOG_DEFINE_CATEGORY(CameraSensorProperties)\n>   *\n>   * \\var CameraSensorProperties::unitCellSize\n>   * \\brief The physical size of a pixel, including pixel edges, in nanometers.\n> + *\n> + * \\var CameraSensorProperties::testPatternModes\n> + * \\brief Map that associates the indexes of the sensor test pattern modes as\n> + * returned by V4L2_CID_TEST_PATTERN with the corresponding TestPattern\n> + * control value\n>   */\n>\n>  /**\n> @@ -47,18 +54,42 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen\n>  \tstatic const std::map<std::string, const CameraSensorProperties> sensorProps = {\n>  \t\t{ \"imx219\", {\n>  \t\t\t.unitCellSize = { 1120, 1120 },\n> +\t\t\t.testPatternModes = {\n> +\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n> +\t\t\t\t{ 1, controls::draft::TestPatternModeColorBars },\n> +\t\t\t\t{ 2, controls::draft::TestPatternModeSolidColor },\n> +\t\t\t\t{ 3, controls::draft::TestPatternModeColorBarsFadeToGray },\n> +\t\t\t\t{ 4, controls::draft::TestPatternModePn9 },\n> +\t\t\t},\n>  \t\t} },\n>  \t\t{ \"imx258\", {\n>  \t\t\t.unitCellSize = { 1120, 1120 },\n>  \t\t} },\n\nI'm sad to report that with Clang 11.1.0 I get\n\n../src/libcamera/camera_sensor_properties.cpp: In static member function ‘static const libcamera::CameraSensorProperties* libcamera::CameraSensorProperties::get(const string&)’:\n../src/libcamera/camera_sensor_properties.cpp:94:2: error: missing initializer for member ‘libcamera::CameraSensorProperties::testPatternModes’ [-Werror=missing-field-initializers]\n   94 |  };\n      |  ^\ncc1plus: all warnings being treated as errors\n\nAs it seems the test patterns for imx258 are required.\n\nThanks\n   j\n\n>  \t\t{ \"ov5670\", {\n>  \t\t\t.unitCellSize = { 1120, 1120 },\n> +\t\t\t.testPatternModes = {\n> +\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n> +\t\t\t\t{ 1, controls::draft::TestPatternModeColorBars },\n> +\t\t\t},\n>  \t\t} },\n>  \t\t{ \"ov13858\", {\n>  \t\t\t.unitCellSize = { 1120, 1120 },\n> +\t\t\t.testPatternModes =  {\n> +\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n> +\t\t\t\t{ 1, controls::draft::TestPatternModeColorBars },\n> +\t\t\t},\n>  \t\t} },\n>  \t\t{ \"ov5693\", {\n>  \t\t\t.unitCellSize = { 1400, 1400 },\n> +\t\t\t.testPatternModes = {\n> +\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n> +\t\t\t\t{ 2, controls::draft::TestPatternModeColorBars },\n> +\t\t\t\t/*\n> +\t\t\t\t * No corresponding test pattern mode for\n> +\t\t\t\t * 1: \"Random data\" and 3: \"Colour Bars with\n> +\t\t\t\t * Rolling Bar\".\n> +\t\t\t\t */\n> +\t\t\t},\n>  \t\t} },\n>  \t};\n>\n> --\n> 2.32.0.rc1.229.g3e70b5a671-goog\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 B2F56C3206\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  7 Jun 2021 14:28:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 211496891F;\n\tMon,  7 Jun 2021 16:28:39 +0200 (CEST)","from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net\n\t[217.70.183.196])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E5E62602A7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  7 Jun 2021 16:28:37 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay4-d.mail.gandi.net (Postfix) with ESMTPSA id EEFF6E0006;\n\tMon,  7 Jun 2021 14:28:36 +0000 (UTC)"],"Date":"Mon, 7 Jun 2021 16:29:26 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Hirokazu Honda <hiroh@chromium.org>","Message-ID":"<20210607142926.zofyymvza3vasjjo@uno.localdomain>","References":"<20210607011402.55331-1-hiroh@chromium.org>\n\t<20210607011402.55331-3-hiroh@chromium.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20210607011402.55331-3-hiroh@chromium.org>","Subject":"Re: [libcamera-devel] [PATCH v7 3/6] libcamera:\n\tCameraSensorProperties: Add table of v4l2 index and test pattern","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":17451,"web_url":"https://patchwork.libcamera.org/comment/17451/","msgid":"<YL6TCm+pa4JieLOx@pendragon.ideasonboard.com>","date":"2021-06-07T21:43:38","subject":"Re: [libcamera-devel] [PATCH v7 3/6] libcamera:\n\tCameraSensorProperties: Add table of v4l2 index and test pattern","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hello,\n\nOn Mon, Jun 07, 2021 at 04:29:26PM +0200, Jacopo Mondi wrote:\n> On Mon, Jun 07, 2021 at 10:13:59AM +0900, Hirokazu Honda wrote:\n> > The V4L2 specification defines the sensor test pattern modes\n> > through a menu control, where a numerical index is associated to\n> > a string that describes the test pattern. The index-to-pattern\n> > mapping is driver specific and requires a corresponding representation\n> > in the library.\n> >\n> > Add to the static list of CameraSensorProperties a map of indexes to\n> > libcamera::controls::TestPatternModes values to be able to map the\n> > indexes returned by the driver to the corresponding test pattern mode.\n> >\n> > Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> > ---\n> >  .../internal/camera_sensor_properties.h       |  2 ++\n> >  src/libcamera/camera_sensor_properties.cpp    | 31 +++++++++++++++++++\n> >  2 files changed, 33 insertions(+)\n> >\n> > diff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h\n> > index f5e242cb..67c77920 100644\n> > --- a/include/libcamera/internal/camera_sensor_properties.h\n> > +++ b/include/libcamera/internal/camera_sensor_properties.h\n> > @@ -7,6 +7,7 @@\n> >  #ifndef __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__\n> >  #define __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__\n> >\n> > +#include <map>\n> >  #include <string>\n> >\n> >  #include <libcamera/geometry.h>\n> > @@ -17,6 +18,7 @@ struct CameraSensorProperties {\n> >  \tstatic const CameraSensorProperties *get(const std::string &sensor);\n> >\n> >  \tSize unitCellSize;\n> > +\tstd::map<int32_t, int32_t> testPatternModes;\n> >  };\n> >\n> >  } /* namespace libcamera */\n> > diff --git a/src/libcamera/camera_sensor_properties.cpp b/src/libcamera/camera_sensor_properties.cpp\n> > index a2c04009..14270ef9 100644\n> > --- a/src/libcamera/camera_sensor_properties.cpp\n> > +++ b/src/libcamera/camera_sensor_properties.cpp\n> > @@ -9,6 +9,8 @@\n> >\n> >  #include <map>\n> >\n> > +#include <libcamera/control_ids.h>\n> > +\n> >  #include \"libcamera/internal/log.h\"\n> >\n> >  /**\n> > @@ -34,6 +36,11 @@ LOG_DEFINE_CATEGORY(CameraSensorProperties)\n> >   *\n> >   * \\var CameraSensorProperties::unitCellSize\n> >   * \\brief The physical size of a pixel, including pixel edges, in nanometers.\n> > + *\n> > + * \\var CameraSensorProperties::testPatternModes\n> > + * \\brief Map that associates the indexes of the sensor test pattern modes as\n> > + * returned by V4L2_CID_TEST_PATTERN with the corresponding TestPattern\n> > + * control value\n> >   */\n> >\n> >  /**\n> > @@ -47,18 +54,42 @@ const CameraSensorProperties *CameraSensorProperties::get(const std::string &sen\n> >  \tstatic const std::map<std::string, const CameraSensorProperties> sensorProps = {\n> >  \t\t{ \"imx219\", {\n> >  \t\t\t.unitCellSize = { 1120, 1120 },\n> > +\t\t\t.testPatternModes = {\n> > +\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n> > +\t\t\t\t{ 1, controls::draft::TestPatternModeColorBars },\n> > +\t\t\t\t{ 2, controls::draft::TestPatternModeSolidColor },\n> > +\t\t\t\t{ 3, controls::draft::TestPatternModeColorBarsFadeToGray },\n> > +\t\t\t\t{ 4, controls::draft::TestPatternModePn9 },\n> > +\t\t\t},\n> >  \t\t} },\n> >  \t\t{ \"imx258\", {\n> >  \t\t\t.unitCellSize = { 1120, 1120 },\n> >  \t\t} },\n> \n> I'm sad to report that with Clang 11.1.0 I get\n> \n> ../src/libcamera/camera_sensor_properties.cpp: In static member function ‘static const libcamera::CameraSensorProperties* libcamera::CameraSensorProperties::get(const string&)’:\n> ../src/libcamera/camera_sensor_properties.cpp:94:2: error: missing initializer for member ‘libcamera::CameraSensorProperties::testPatternModes’ [-Werror=missing-field-initializers]\n>    94 |  };\n>       |  ^\n> cc1plus: all warnings being treated as errors\n> \n> As it seems the test patterns for imx258 are required.\n\nI want\nhttps://en.cppreference.com/w/cpp/language/aggregate_initialization#Designated_initializers\nin C++17 :-)\n\n\t\t\t.testPatternModes = {},\n\nwill fix this. With this change,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> >  \t\t{ \"ov5670\", {\n> >  \t\t\t.unitCellSize = { 1120, 1120 },\n> > +\t\t\t.testPatternModes = {\n> > +\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n> > +\t\t\t\t{ 1, controls::draft::TestPatternModeColorBars },\n> > +\t\t\t},\n> >  \t\t} },\n> >  \t\t{ \"ov13858\", {\n> >  \t\t\t.unitCellSize = { 1120, 1120 },\n> > +\t\t\t.testPatternModes =  {\n> > +\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n> > +\t\t\t\t{ 1, controls::draft::TestPatternModeColorBars },\n> > +\t\t\t},\n> >  \t\t} },\n> >  \t\t{ \"ov5693\", {\n> >  \t\t\t.unitCellSize = { 1400, 1400 },\n> > +\t\t\t.testPatternModes = {\n> > +\t\t\t\t{ 0, controls::draft::TestPatternModeOff },\n> > +\t\t\t\t{ 2, controls::draft::TestPatternModeColorBars },\n> > +\t\t\t\t/*\n> > +\t\t\t\t * No corresponding test pattern mode for\n> > +\t\t\t\t * 1: \"Random data\" and 3: \"Colour Bars with\n> > +\t\t\t\t * Rolling Bar\".\n> > +\t\t\t\t */\n> > +\t\t\t},\n> >  \t\t} },\n> >  \t};\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 1B772C3206\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  7 Jun 2021 21:43:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9681D6892B;\n\tMon,  7 Jun 2021 23:43:53 +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 F42056891F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  7 Jun 2021 23:43:52 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4D6788DB;\n\tMon,  7 Jun 2021 23:43:52 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"K6IAEOwK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1623102232;\n\tbh=HQkG537I80Bq+lfkErQQRkkf/9AShIx9lKRBILjeaGM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=K6IAEOwKQc0QpvoheHPrPeBwdE1cOnOZaUVp5ov0hSJs1oaqZG99taqRZslJCsst/\n\tYjjCjCMh9QPWvqe1QX2OLhwDzYbTxbPsldMOBS5ZPm08LBG55zgjVd/OR2f7JLmBeu\n\tlixvZKXGNpqfPaJgcp9MzyEtE9eNPmhGJ8Nj0GC8=","Date":"Tue, 8 Jun 2021 00:43:38 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YL6TCm+pa4JieLOx@pendragon.ideasonboard.com>","References":"<20210607011402.55331-1-hiroh@chromium.org>\n\t<20210607011402.55331-3-hiroh@chromium.org>\n\t<20210607142926.zofyymvza3vasjjo@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20210607142926.zofyymvza3vasjjo@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH v7 3/6] libcamera:\n\tCameraSensorProperties: Add table of v4l2 index and test pattern","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>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]