[{"id":3640,"web_url":"https://patchwork.libcamera.org/comment/3640/","msgid":"<20200208010017.GH4726@pendragon.ideasonboard.com>","date":"2020-02-08T01:00:17","subject":"Re: [libcamera-devel] [PATCH v2 6/7] libcamera: sensor: ov5670:\n\tRegister pixel array properties","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Thu, Feb 06, 2020 at 07:52:46PM +0100, Jacopo Mondi wrote:\n> Implement sensor specific pixel array properties initialization for the\n> OV5670 sensor driver by overriding CameraSensor::initProperties()\n> method.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/sensor/ov5670.cpp | 41 +++++++++++++++++++++++++++++++++\n>  src/libcamera/sensor/ov5670.h   |  3 +++\n>  2 files changed, 44 insertions(+)\n> \n> diff --git a/src/libcamera/sensor/ov5670.cpp b/src/libcamera/sensor/ov5670.cpp\n> index de6011875a2d..a49fcebb2d9d 100644\n> --- a/src/libcamera/sensor/ov5670.cpp\n> +++ b/src/libcamera/sensor/ov5670.cpp\n> @@ -6,6 +6,12 @@\n>   */\n>  \n>  #include \"ov5670.h\"\n> +\n> +#include <array>\n> +\n> +#include <libcamera/controls.h>\n> +#include <libcamera/property_ids.h>\n> +\n>  #include \"camera_sensor.h\"\n>  \n>  /**\n> @@ -38,6 +44,41 @@ OV5670CameraSensor::OV5670CameraSensor(const MediaEntity *entity)\n>  {\n>  }\n>  \n> +/**\n> + * \\brief Initialize Camera properties with ov5670 specific values\n> + * \\param[in] controlMap The map of control information provided by the sensor\n> + * \\return 0 on success, a negative error code otherwise\n> + */\n> +int OV5670CameraSensor::initProperties(const ControlInfoMap &controlMap)\n> +{\n> +\t/* Pixel Array Properties. */\n> +\tstd::array<float, 2> pixelArraySize = { 2.9f, 1.18f };\n\nThat's a very weird aspect ratio... According to the product brief, the\nimage area is 2.9457mm x 2.214mm.\n\n> +\tproperties_.set(properties::PixelArraySize,\n> +\t\t\tSpan<float>{ pixelArraySize });\n> +\n> +\tstd::array<int32_t, 2> pixelArrayBounds = { 2592, 1944 };\n> +\tproperties_.set(properties::PixelArrayBounds,\n> +\t\t\tSpan<int32_t>{ pixelArrayBounds });\n> +\n> +\tstd::array<int32_t, 2> pixelArrays = { 2592, 1944 };\n> +\tproperties_.set(properties::PixelArrays,\n> +\t\t\tSpan<int32_t>{ pixelArrays });\n> +\n> +\tstd::array<int32_t, 4> activeAreaSize = { 16, 6, 2560, 1920 };\n> +\tproperties_.set(properties::ActiveAreaSize,\n> +\t\t\tSpan<int32_t>{ activeAreaSize });\n> +\n> +\tint32_t bayerFilter = properties::BayerFilterGRBG;\n> +\tproperties_.set(properties::BayerFilterArrangement, bayerFilter);\n\nThese 4 properties should really be retrieved from the kernel :-S\n\n> +\n> +\tstd::array<int32_t, 2> isoSensitivities = { 50, 800 };\n> +\tproperties_.set(properties::ISOSensitivityRange,\n> +\t\t\tSpan<int32_t>{ isoSensitivities });\n> +\n> +\treturn CameraSensor::initProperties(controlMap);\n> +}\n> +\n>  REGISTER_CAMERA_SENSOR(OV5670);\n>  \n>  }; /* namespace libcamera */\n> +\n> diff --git a/src/libcamera/sensor/ov5670.h b/src/libcamera/sensor/ov5670.h\n> index 4acf02a8b06b..a66bdb6ae276 100644\n> --- a/src/libcamera/sensor/ov5670.h\n> +++ b/src/libcamera/sensor/ov5670.h\n> @@ -11,12 +11,15 @@\n>  \n>  namespace libcamera {\n>  \n> +class ControlInfoMap;\n> +\n>  class OV5670CameraSensor final : public CameraSensor\n>  {\n>  public:\n>  \tstatic const char *entityName();\n>  \n>  \tOV5670CameraSensor(const MediaEntity *entity);\n> +\tint initProperties(const ControlInfoMap &controlMap);\n>  };\n>  \n>  }; /* namespace libcamera */","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 482AD607EC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  8 Feb 2020 02:00:36 +0100 (CET)","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 A5DDC9F3;\n\tSat,  8 Feb 2020 02:00:35 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1581123635;\n\tbh=Xz2wN9JCKDah1hUxtzGv20KBA9i+0jrfpD/OoxO4Tlc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=SiKEBz9tfrEzDe5KWre70f3ppou4HIAAsHILDT4c6QnO5FEPz/oHHGwQTBsBWHw3W\n\tL4v3X6E5Lb/TPf0CQN7WIiaLIRFuNT7HZumROTaGw036Rt5W57IXPWIn6FvnoSgrZR\n\twLJzb49LjRDWg1IrmxvxMWOQre9k82pTEPCIdqnU=","Date":"Sat, 8 Feb 2020 03:00:17 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20200208010017.GH4726@pendragon.ideasonboard.com>","References":"<20200206185247.202233-1-jacopo@jmondi.org>\n\t<20200206185247.202233-7-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200206185247.202233-7-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 6/7] libcamera: sensor: ov5670:\n\tRegister pixel array properties","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>","X-List-Received-Date":"Sat, 08 Feb 2020 01:00:36 -0000"}}]