[{"id":17508,"web_url":"https://patchwork.libcamera.org/comment/17508/","msgid":"<20210610160700.psw7zqhvg4qz3mxn@uno.localdomain>","date":"2021-06-10T16:07:00","subject":"Re: [libcamera-devel] [PATCH v8 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 Thu, Jun 10, 2021 at 05:25:36PM +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> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n  j\n\n> ---\n>  .../internal/camera_sensor_properties.h       |  2 ++\n>  src/libcamera/camera_sensor_properties.cpp    | 33 +++++++++++++++++++\n>  2 files changed, 35 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..f660743a 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,44 @@ 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\t/* \\todo fill test pattern modes for imx258. */\n> +\t\t\t.testPatternModes = {},\n>  \t\t} },\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 A6EF9BD78E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 10 Jun 2021 16:06:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7081F6892E;\n\tThu, 10 Jun 2021 18:06:12 +0200 (CEST)","from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0AD3C6029B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 10 Jun 2021 18:06:11 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 8D8EB60009;\n\tThu, 10 Jun 2021 16:06:10 +0000 (UTC)"],"Date":"Thu, 10 Jun 2021 18:07:00 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Hirokazu Honda <hiroh@chromium.org>","Message-ID":"<20210610160700.psw7zqhvg4qz3mxn@uno.localdomain>","References":"<20210610082539.529739-1-hiroh@chromium.org>\n\t<20210610082539.529739-3-hiroh@chromium.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210610082539.529739-3-hiroh@chromium.org>","Subject":"Re: [libcamera-devel] [PATCH v8 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>"}}]