[{"id":31407,"web_url":"https://patchwork.libcamera.org/comment/31407/","msgid":"<7jeq2vjnwbpqbdrklx5ybi2fv6fmuc3ewukxndymz5erq3ihhm@p5m4jhudh7vr>","date":"2024-09-26T14:11:10","subject":"Re: [PATCH v3] pipeline: rkisp1: Filter out sensor sizes not\n\tsupported by the pipeline","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Umang\n\nOn Thu, Sep 26, 2024 at 07:02:36PM GMT, Umang Jain wrote:\n> It is possible that the maximum sensor size (returned by\n> CameraSensor::resolution()) is not supported by the pipeline. In such\n> cases, a filter function is required to filter out resolutions of the\n> camera sensor, which cannot be supported by the pipeline.\n>\n> Introduce the filter function filterSensorResolution() in RkISP1Path\n> class and use it for validate() and generateConfiguration(). The\n> maximum sensor resolution is picked from that filtered set of\n> resolutions instead of CameraSensor::resolution().\n>\n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n> Changes v3:\n> - None, just a resent over latest master\n> - Split out from [v2,0/2] pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline\n>   so that, this can make independent progress.\n> ---\n>  src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 51 ++++++++++++++++++-\n>  src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  8 +++\n>  2 files changed, 57 insertions(+), 2 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> index c49017d1..2421d06c 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> @@ -126,12 +126,59 @@ void RkISP1Path::populateFormats()\n>  \t}\n>  }\n>\n> +/**\n> + * \\brief Filter the sensor resolutions that can be supported\n> + * \\param[in] sensor The camera sensor\n> + *\n> + * This function retrieves all the sizes supported by the sensor and\n> + * filters all the resolutions that can be supported on the pipeline.\n> + * It is possible that the sensor's maximum output resolution is higher\n> + * than the ISP maximum input. In that case, this function filters out all\n> + * the resolution incapable of being supported and returns the maximum\n> + * sensor resolution that can be supported by the pipeline.\n> + *\n> + * \\return Maximum sensor size supported on the pipeline\n> + */\n> +Size RkISP1Path::filterSensorResolution(const CameraSensor *sensor)\n> +{\n> +\tauto iter = sensorSizesMap_.find(sensor);\n> +\tif (iter != sensorSizesMap_.end() && !iter->second.empty())\n> +\t\treturn iter->second.back();\n> +\n> +\tsensorSizesMap_.emplace(sensor, std::vector<Size>());\n> +\n> +\tstd::vector<Size> sensorSizes;\n> +\tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n> +\tfor (const auto it : mbusCodes) {\n> +\t\tstd::vector<Size> sizes = sensor->sizes(it);\n> +\t\tfor (Size sz : sizes)\n\nCan't you filter out sizes that are larger than max sizes ?\n\nSo you can populate sensorSizesMap_.second directly avoiding copies ?\n\n> +\t\t\tsensorSizes.push_back(sz);\n> +\t}\n\nCan't we build this map once at populateFormats() time and solely\nreturn the max supported size when needed ?\n\n> +\n> +\tstd::sort(sensorSizes.begin(), sensorSizes.end());\n> +\n> +\t/* Remove duplicates. */\n> +\tauto last = std::unique(sensorSizes.begin(), sensorSizes.end());\n> +\tsensorSizes.erase(last, sensorSizes.end());\n> +\n> +\t/* Discard any sizes that the pipeline is unable to support. */\n> +\tfor (auto sz : sensorSizes) {\n> +\t\tif (sz.width > maxResolution_.width ||\n> +\t\t    sz.height > maxResolution_.height)\n> +\t\t\tcontinue;\n> +\n> +\t\tsensorSizesMap_[sensor].push_back(sz);\n> +\t}\n> +\n> +\treturn sensorSizesMap_[sensor].back();\n> +}\n> +\n>  StreamConfiguration\n>  RkISP1Path::generateConfiguration(const CameraSensor *sensor, const Size &size,\n>  \t\t\t\t  StreamRole role)\n>  {\n>  \tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n> -\tconst Size &resolution = sensor->resolution();\n> +\tSize resolution = filterSensorResolution(sensor);\n>\n>  \t/* Min and max resolutions to populate the available stream formats. */\n>  \tSize maxResolution = maxResolution_.boundedToAspectRatio(resolution)\n> @@ -220,7 +267,7 @@ CameraConfiguration::Status RkISP1Path::validate(const CameraSensor *sensor,\n>  \t\t\t\t\t\t StreamConfiguration *cfg)\n>  {\n>  \tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n> -\tconst Size &resolution = sensor->resolution();\n> +\tSize resolution = filterSensorResolution(sensor);\n>\n>  \tconst StreamConfiguration reqCfg = *cfg;\n>  \tCameraConfiguration::Status status = CameraConfiguration::Valid;\n> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n> index 08edefec..9f75fe1f 100644\n> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n> @@ -7,6 +7,7 @@\n>\n>  #pragma once\n>\n> +#include <map>\n>  #include <memory>\n>  #include <set>\n>  #include <vector>\n> @@ -63,6 +64,7 @@ public:\n>\n>  private:\n>  \tvoid populateFormats();\n> +\tSize filterSensorResolution(const CameraSensor *sensor);\n>\n>  \tstatic constexpr unsigned int RKISP1_BUFFER_COUNT = 4;\n>\n> @@ -77,6 +79,12 @@ private:\n>  \tstd::unique_ptr<V4L2Subdevice> resizer_;\n>  \tstd::unique_ptr<V4L2VideoDevice> video_;\n>  \tMediaLink *link_;\n> +\n> +\t/*\n> +\t * Map from camera sensors to the sizes (in increasing order),\n> +\t * which are guaranteed to be supported by the pipeline.\n> +\t */\n> +\tstd::map<const CameraSensor *, std::vector<Size>> sensorSizesMap_;\n>  };\n>\n>  class RkISP1MainPath : public RkISP1Path\n> --\n> 2.45.0\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 3BA16C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Sep 2024 14:11:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 82BA663510;\n\tThu, 26 Sep 2024 16:11:16 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6E8DC63502\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Sep 2024 16:11:14 +0200 (CEST)","from ideasonboard.com (mob-5-90-51-229.net.vodafone.it\n\t[5.90.51.229])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CBA588D4;\n\tThu, 26 Sep 2024 16:09:45 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"NcA47osk\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727359786;\n\tbh=c5vimMHdcYRjUyXzjetgDGekzxLrByHQXaN/V4pnSw8=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=NcA47osk5nzaDbNvneSrTugQFFuqDt43l7ju+S5wkEyxiGOTEWOaoV7AdNs+ABIUQ\n\tetDTPFvqGjsNsct4BvxU2NI9cdTNIqreGhNzARxc6Jvqahfy38OSYtb0+JaRbL/5Jo\n\txKcOD+3Ywp3kT4MSPBFCE3gu3nJBcYGoYk6kQLB0=","Date":"Thu, 26 Sep 2024 16:11:10 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Umang Jain <umang.jain@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, \n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v3] pipeline: rkisp1: Filter out sensor sizes not\n\tsupported by the pipeline","Message-ID":"<7jeq2vjnwbpqbdrklx5ybi2fv6fmuc3ewukxndymz5erq3ihhm@p5m4jhudh7vr>","References":"<20240926133236.98137-1-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240926133236.98137-1-umang.jain@ideasonboard.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":31412,"web_url":"https://patchwork.libcamera.org/comment/31412/","msgid":"<ae9a5f13-e1bf-43b2-aa06-808ace6ddf15@ideasonboard.com>","date":"2024-09-26T15:42:49","subject":"Re: [PATCH v3] pipeline: rkisp1: Filter out sensor sizes not\n\tsupported by the pipeline","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Jacopo,\n\nOn 26/09/24 7:41 pm, Jacopo Mondi wrote:\n> Hi Umang\n>\n> On Thu, Sep 26, 2024 at 07:02:36PM GMT, Umang Jain wrote:\n>> It is possible that the maximum sensor size (returned by\n>> CameraSensor::resolution()) is not supported by the pipeline. In such\n>> cases, a filter function is required to filter out resolutions of the\n>> camera sensor, which cannot be supported by the pipeline.\n>>\n>> Introduce the filter function filterSensorResolution() in RkISP1Path\n>> class and use it for validate() and generateConfiguration(). The\n>> maximum sensor resolution is picked from that filtered set of\n>> resolutions instead of CameraSensor::resolution().\n>>\n>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>> ---\n>> Changes v3:\n>> - None, just a resent over latest master\n>> - Split out from [v2,0/2] pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline\n>>    so that, this can make independent progress.\n>> ---\n>>   src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 51 ++++++++++++++++++-\n>>   src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  8 +++\n>>   2 files changed, 57 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n>> index c49017d1..2421d06c 100644\n>> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n>> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n>> @@ -126,12 +126,59 @@ void RkISP1Path::populateFormats()\n>>   \t}\n>>   }\n>>\n>> +/**\n>> + * \\brief Filter the sensor resolutions that can be supported\n>> + * \\param[in] sensor The camera sensor\n>> + *\n>> + * This function retrieves all the sizes supported by the sensor and\n>> + * filters all the resolutions that can be supported on the pipeline.\n>> + * It is possible that the sensor's maximum output resolution is higher\n>> + * than the ISP maximum input. In that case, this function filters out all\n>> + * the resolution incapable of being supported and returns the maximum\n>> + * sensor resolution that can be supported by the pipeline.\n>> + *\n>> + * \\return Maximum sensor size supported on the pipeline\n>> + */\n>> +Size RkISP1Path::filterSensorResolution(const CameraSensor *sensor)\n>> +{\n>> +\tauto iter = sensorSizesMap_.find(sensor);\n>> +\tif (iter != sensorSizesMap_.end() && !iter->second.empty())\n>> +\t\treturn iter->second.back();\n>> +\n>> +\tsensorSizesMap_.emplace(sensor, std::vector<Size>());\n>> +\n>> +\tstd::vector<Size> sensorSizes;\n>> +\tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n>> +\tfor (const auto it : mbusCodes) {\n>> +\t\tstd::vector<Size> sizes = sensor->sizes(it);\n>> +\t\tfor (Size sz : sizes)\n> Can't you filter out sizes that are larger than max sizes ?\n>\n> So you can populate sensorSizesMap_.second directly avoiding copies ?\n\nIf I try to directly populate sensorSizesMap_ with the max size filter, \nit might have duplicated sizes entries (same size for different codes).\n\nThat's why, I opted a temporary vector sensorSizes here, is used to \ncollect all sizes for the formats that the sensor supports.\n\nThen later sorted, de-duplicated and filtered, before populating the \nsensorSizeMap_.second\n\n>\n>> +\t\t\tsensorSizes.push_back(sz);\n>> +\t}\n> Can't we build this map once at populateFormats() time and solely\n\nThe map is only built once. Checkout the early return at the start of \nthe function\n> return the max supported size when needed ?\n\nI don't think you can do at populateFormats() as it is called in init()\n\nAnd RkISP1Path::init() is called in match() for RkISP1 pipeline handler, \nbefore the camera is even created.\n>\n>> +\n>> +\tstd::sort(sensorSizes.begin(), sensorSizes.end());\n>> +\n>> +\t/* Remove duplicates. */\n>> +\tauto last = std::unique(sensorSizes.begin(), sensorSizes.end());\n>> +\tsensorSizes.erase(last, sensorSizes.end());\n>> +\n>> +\t/* Discard any sizes that the pipeline is unable to support. */\n>> +\tfor (auto sz : sensorSizes) {\n>> +\t\tif (sz.width > maxResolution_.width ||\n>> +\t\t    sz.height > maxResolution_.height)\n>> +\t\t\tcontinue;\n>> +\n>> +\t\tsensorSizesMap_[sensor].push_back(sz);\n>> +\t}\n>> +\n>> +\treturn sensorSizesMap_[sensor].back();\n>> +}\n>> +\n>>   StreamConfiguration\n>>   RkISP1Path::generateConfiguration(const CameraSensor *sensor, const Size &size,\n>>   \t\t\t\t  StreamRole role)\n>>   {\n>>   \tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n>> -\tconst Size &resolution = sensor->resolution();\n>> +\tSize resolution = filterSensorResolution(sensor);\n>>\n>>   \t/* Min and max resolutions to populate the available stream formats. */\n>>   \tSize maxResolution = maxResolution_.boundedToAspectRatio(resolution)\n>> @@ -220,7 +267,7 @@ CameraConfiguration::Status RkISP1Path::validate(const CameraSensor *sensor,\n>>   \t\t\t\t\t\t StreamConfiguration *cfg)\n>>   {\n>>   \tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n>> -\tconst Size &resolution = sensor->resolution();\n>> +\tSize resolution = filterSensorResolution(sensor);\n>>\n>>   \tconst StreamConfiguration reqCfg = *cfg;\n>>   \tCameraConfiguration::Status status = CameraConfiguration::Valid;\n>> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n>> index 08edefec..9f75fe1f 100644\n>> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n>> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n>> @@ -7,6 +7,7 @@\n>>\n>>   #pragma once\n>>\n>> +#include <map>\n>>   #include <memory>\n>>   #include <set>\n>>   #include <vector>\n>> @@ -63,6 +64,7 @@ public:\n>>\n>>   private:\n>>   \tvoid populateFormats();\n>> +\tSize filterSensorResolution(const CameraSensor *sensor);\n>>\n>>   \tstatic constexpr unsigned int RKISP1_BUFFER_COUNT = 4;\n>>\n>> @@ -77,6 +79,12 @@ private:\n>>   \tstd::unique_ptr<V4L2Subdevice> resizer_;\n>>   \tstd::unique_ptr<V4L2VideoDevice> video_;\n>>   \tMediaLink *link_;\n>> +\n>> +\t/*\n>> +\t * Map from camera sensors to the sizes (in increasing order),\n>> +\t * which are guaranteed to be supported by the pipeline.\n>> +\t */\n>> +\tstd::map<const CameraSensor *, std::vector<Size>> sensorSizesMap_;\n>>   };\n>>\n>>   class RkISP1MainPath : public RkISP1Path\n>> --\n>> 2.45.0\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 639C4C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 26 Sep 2024 15:42:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7B79F6350F;\n\tThu, 26 Sep 2024 17:42:56 +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 5D8B6634F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 26 Sep 2024 17:42:55 +0200 (CEST)","from [IPV6:2405:201:2015:f873:c173:4b:4a04:3a21] (unknown\n\t[IPv6:2405:201:2015:f873:c173:4b:4a04:3a21])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 582FB163;\n\tThu, 26 Sep 2024 17:41:26 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"MtyINkAI\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727365287;\n\tbh=zR7OmboeGZAwIflWM61yWsF8vkM7Tlj/GrnWeRBGXdc=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=MtyINkAIHWErmOzVcYqnr7WJljo99LA73NTx3KEBBGKZzsw1w4gaorXgGo0iFgDif\n\tiR4xKv94/msb6GJlqUheyXdx4dEg9IkguWAs+tCctnhCTeeTlgLAglMBxltea7+QJ0\n\tDkqmw/47EJODqdGNOmAm2KuHxlumfrdH/pnLPnDE=","Message-ID":"<ae9a5f13-e1bf-43b2-aa06-808ace6ddf15@ideasonboard.com>","Date":"Thu, 26 Sep 2024 21:12:49 +0530","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3] pipeline: rkisp1: Filter out sensor sizes not\n\tsupported by the pipeline","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20240926133236.98137-1-umang.jain@ideasonboard.com>\n\t<7jeq2vjnwbpqbdrklx5ybi2fv6fmuc3ewukxndymz5erq3ihhm@p5m4jhudh7vr>","Content-Language":"en-US","From":"Umang Jain <umang.jain@ideasonboard.com>","In-Reply-To":"<7jeq2vjnwbpqbdrklx5ybi2fv6fmuc3ewukxndymz5erq3ihhm@p5m4jhudh7vr>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":31431,"web_url":"https://patchwork.libcamera.org/comment/31431/","msgid":"<km2g7i3uyc4hlntco7ctcg4yzc4qwiwet5se6jpepfzmx7z4xo@b23ve4bswaif>","date":"2024-09-27T07:25:55","subject":"Re: [PATCH v3] pipeline: rkisp1: Filter out sensor sizes not\n\tsupported by the pipeline","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hello Umang\n\nOn Thu, Sep 26, 2024 at 09:12:49PM GMT, Umang Jain wrote:\n> Hi Jacopo,\n>\n> On 26/09/24 7:41 pm, Jacopo Mondi wrote:\n> > Hi Umang\n> >\n> > On Thu, Sep 26, 2024 at 07:02:36PM GMT, Umang Jain wrote:\n> > > It is possible that the maximum sensor size (returned by\n> > > CameraSensor::resolution()) is not supported by the pipeline. In such\n> > > cases, a filter function is required to filter out resolutions of the\n> > > camera sensor, which cannot be supported by the pipeline.\n> > >\n> > > Introduce the filter function filterSensorResolution() in RkISP1Path\n> > > class and use it for validate() and generateConfiguration(). The\n> > > maximum sensor resolution is picked from that filtered set of\n> > > resolutions instead of CameraSensor::resolution().\n> > >\n> > > Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > > ---\n> > > Changes v3:\n> > > - None, just a resent over latest master\n> > > - Split out from [v2,0/2] pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline\n> > >    so that, this can make independent progress.\n> > > ---\n> > >   src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 51 ++++++++++++++++++-\n> > >   src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  8 +++\n> > >   2 files changed, 57 insertions(+), 2 deletions(-)\n> > >\n> > > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> > > index c49017d1..2421d06c 100644\n> > > --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> > > +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n> > > @@ -126,12 +126,59 @@ void RkISP1Path::populateFormats()\n> > >   \t}\n> > >   }\n> > >\n> > > +/**\n> > > + * \\brief Filter the sensor resolutions that can be supported\n> > > + * \\param[in] sensor The camera sensor\n> > > + *\n> > > + * This function retrieves all the sizes supported by the sensor and\n> > > + * filters all the resolutions that can be supported on the pipeline.\n> > > + * It is possible that the sensor's maximum output resolution is higher\n> > > + * than the ISP maximum input. In that case, this function filters out all\n> > > + * the resolution incapable of being supported and returns the maximum\n> > > + * sensor resolution that can be supported by the pipeline.\n> > > + *\n> > > + * \\return Maximum sensor size supported on the pipeline\n> > > + */\n> > > +Size RkISP1Path::filterSensorResolution(const CameraSensor *sensor)\n> > > +{\n> > > +\tauto iter = sensorSizesMap_.find(sensor);\n> > > +\tif (iter != sensorSizesMap_.end() && !iter->second.empty())\n\nCan iter->second.empty() happen ?\n\n> > > +\t\treturn iter->second.back();\n> > > +\n> > > +\tsensorSizesMap_.emplace(sensor, std::vector<Size>());\n> > > +\n> > > +\tstd::vector<Size> sensorSizes;\n> > > +\tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n> > > +\tfor (const auto it : mbusCodes) {\n> > > +\t\tstd::vector<Size> sizes = sensor->sizes(it);\n> > > +\t\tfor (Size sz : sizes)\n> > Can't you filter out sizes that are larger than max sizes ?\n> >\n> > So you can populate sensorSizesMap_.second directly avoiding copies ?\n>\n> If I try to directly populate sensorSizesMap_ with the max size filter, it\n> might have duplicated sizes entries (same size for different codes).\n>\n> That's why, I opted a temporary vector sensorSizes here, is used to collect\n> all sizes for the formats that the sensor supports.\n>\n> Then later sorted, de-duplicated and filtered, before populating the\n> sensorSizeMap_.second\n>\n\nI think you can do the same filtering/sorting directly on the vector\ninside the map already.\n\nWhat I mean is something like\n\nSize RkISP1Path::filterSensorResolution(const CameraSensor *sensor)\n{\n\tauto iter = sensorSizesMap_.find(sensor);\n\tif (iter != sensorSizesMap_.end())\n\t\treturn iter->second.back();\n\n\tstd::vector<Size> &sizes = sensorSizesMap_[sensor];\n\tfor (unsigned int code : sensor->mbusCodes()) {\n\t\tfor (const Size &size : sensor->sizes(code)) {\n\t\t\tif (size.width > maxResolution_.width ||\n\t\t\t    size.height > maxResolution_.height)\n\t\t\t\tcontinue;\n\n\t\t\tsizes.push_back(size);\n\t\t}\n\t}\n\n\t/* Sort in increasing order and remove duplicates. */\n\tstd::sort(sizes.begin(), sizes.end());\n\tauto last = std::unique(sizes.begin(), sizes.end());\n\tsizes.erase(last, sizes.end());\n\n\treturn sizes.back();\n}\n\nwarning: compile tested only\n\nDo you think we need the list of supported, unique and sorted formats\nanywhere else ? Otherwise you could just store the max res and not the\nwhole vector.\n\nI won't bikeshed too much on the name, but even if this function\nindeed does filter the sensor's resolutions, what it does is to return\nthe maxium sensor resolution supported by the pipeline, so I would\nhave gone for something like RkISP1Path::maxResolution(sensor *). Up\nto you.\n\nThanks\n  j\n\n> >\n> > > +\t\t\tsensorSizes.push_back(sz);\n> > > +\t}\n> > Can't we build this map once at populateFormats() time and solely\n>\n> The map is only built once. Checkout the early return at the start of the\n> function\n> > return the max supported size when needed ?\n>\n> I don't think you can do at populateFormats() as it is called in init()\n>\n> And RkISP1Path::init() is called in match() for RkISP1 pipeline handler,\n> before the camera is even created.\n> >\n\nRight, at init() time you don't have a sensor to operate with, fine\nthen!\n\n> > > +\n> > > +\tstd::sort(sensorSizes.begin(), sensorSizes.end());\n> > > +\n> > > +\t/* Remove duplicates. */\n> > > +\tauto last = std::unique(sensorSizes.begin(), sensorSizes.end());\n> > > +\tsensorSizes.erase(last, sensorSizes.end());\n> > > +\n> > > +\t/* Discard any sizes that the pipeline is unable to support. */\n> > > +\tfor (auto sz : sensorSizes) {\n> > > +\t\tif (sz.width > maxResolution_.width ||\n> > > +\t\t    sz.height > maxResolution_.height)\n> > > +\t\t\tcontinue;\n> > > +\n> > > +\t\tsensorSizesMap_[sensor].push_back(sz);\n> > > +\t}\n> > > +\n> > > +\treturn sensorSizesMap_[sensor].back();\n> > > +}\n> > > +\n> > >   StreamConfiguration\n> > >   RkISP1Path::generateConfiguration(const CameraSensor *sensor, const Size &size,\n> > >   \t\t\t\t  StreamRole role)\n> > >   {\n> > >   \tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n> > > -\tconst Size &resolution = sensor->resolution();\n> > > +\tSize resolution = filterSensorResolution(sensor);\n> > >\n> > >   \t/* Min and max resolutions to populate the available stream formats. */\n> > >   \tSize maxResolution = maxResolution_.boundedToAspectRatio(resolution)\n> > > @@ -220,7 +267,7 @@ CameraConfiguration::Status RkISP1Path::validate(const CameraSensor *sensor,\n> > >   \t\t\t\t\t\t StreamConfiguration *cfg)\n> > >   {\n> > >   \tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n> > > -\tconst Size &resolution = sensor->resolution();\n> > > +\tSize resolution = filterSensorResolution(sensor);\n> > >\n> > >   \tconst StreamConfiguration reqCfg = *cfg;\n> > >   \tCameraConfiguration::Status status = CameraConfiguration::Valid;\n> > > diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n> > > index 08edefec..9f75fe1f 100644\n> > > --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n> > > +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n> > > @@ -7,6 +7,7 @@\n> > >\n> > >   #pragma once\n> > >\n> > > +#include <map>\n> > >   #include <memory>\n> > >   #include <set>\n> > >   #include <vector>\n> > > @@ -63,6 +64,7 @@ public:\n> > >\n> > >   private:\n> > >   \tvoid populateFormats();\n> > > +\tSize filterSensorResolution(const CameraSensor *sensor);\n> > >\n> > >   \tstatic constexpr unsigned int RKISP1_BUFFER_COUNT = 4;\n> > >\n> > > @@ -77,6 +79,12 @@ private:\n> > >   \tstd::unique_ptr<V4L2Subdevice> resizer_;\n> > >   \tstd::unique_ptr<V4L2VideoDevice> video_;\n> > >   \tMediaLink *link_;\n> > > +\n> > > +\t/*\n> > > +\t * Map from camera sensors to the sizes (in increasing order),\n> > > +\t * which are guaranteed to be supported by the pipeline.\n> > > +\t */\n> > > +\tstd::map<const CameraSensor *, std::vector<Size>> sensorSizesMap_;\n> > >   };\n> > >\n> > >   class RkISP1MainPath : public RkISP1Path\n> > > --\n> > > 2.45.0\n> > >\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 69DAAC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Sep 2024 07:26:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3255663511;\n\tFri, 27 Sep 2024 09:26:01 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 716DC6350B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Sep 2024 09:25:59 +0200 (CEST)","from ideasonboard.com (mob-5-90-58-180.net.vodafone.it\n\t[5.90.58.180])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 505098BF;\n\tFri, 27 Sep 2024 09:24:30 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"t6LKtizy\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727421870;\n\tbh=nvmVCfvL8T/fV34dRmT7q1kOvwXX2UO3idGd/vbSEZU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=t6LKtizywXQAUnArFRVqtz7eoGPpdlZ2nbzLyN2sVSzp+vFKNDC2coAzuFCSrgFoy\n\tzacwGILxVXgSEVu0GrwDaX1c6Nl9GICtLhnxMpoJdKj+xEggPuJkNAPnM6ARoYpXLQ\n\te0GRo4uB2oTkBpHOvLow+GL3Ci83fcvae+wRKOZk=","Date":"Fri, 27 Sep 2024 09:25:55 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Umang Jain <umang.jain@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v3] pipeline: rkisp1: Filter out sensor sizes not\n\tsupported by the pipeline","Message-ID":"<km2g7i3uyc4hlntco7ctcg4yzc4qwiwet5se6jpepfzmx7z4xo@b23ve4bswaif>","References":"<20240926133236.98137-1-umang.jain@ideasonboard.com>\n\t<7jeq2vjnwbpqbdrklx5ybi2fv6fmuc3ewukxndymz5erq3ihhm@p5m4jhudh7vr>\n\t<ae9a5f13-e1bf-43b2-aa06-808ace6ddf15@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<ae9a5f13-e1bf-43b2-aa06-808ace6ddf15@ideasonboard.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":31433,"web_url":"https://patchwork.libcamera.org/comment/31433/","msgid":"<5e32e39f-ca9c-4cba-a169-ea999895c32e@ideasonboard.com>","date":"2024-09-27T07:37:18","subject":"Re: [PATCH v3] pipeline: rkisp1: Filter out sensor sizes not\n\tsupported by the pipeline","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Jacopo\n\nOn 27/09/24 12:55 pm, Jacopo Mondi wrote:\n> Hello Umang\n>\n> On Thu, Sep 26, 2024 at 09:12:49PM GMT, Umang Jain wrote:\n>> Hi Jacopo,\n>>\n>> On 26/09/24 7:41 pm, Jacopo Mondi wrote:\n>>> Hi Umang\n>>>\n>>> On Thu, Sep 26, 2024 at 07:02:36PM GMT, Umang Jain wrote:\n>>>> It is possible that the maximum sensor size (returned by\n>>>> CameraSensor::resolution()) is not supported by the pipeline. In such\n>>>> cases, a filter function is required to filter out resolutions of the\n>>>> camera sensor, which cannot be supported by the pipeline.\n>>>>\n>>>> Introduce the filter function filterSensorResolution() in RkISP1Path\n>>>> class and use it for validate() and generateConfiguration(). The\n>>>> maximum sensor resolution is picked from that filtered set of\n>>>> resolutions instead of CameraSensor::resolution().\n>>>>\n>>>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n>>>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>>>> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>>>> ---\n>>>> Changes v3:\n>>>> - None, just a resent over latest master\n>>>> - Split out from [v2,0/2] pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline\n>>>>     so that, this can make independent progress.\n>>>> ---\n>>>>    src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 51 ++++++++++++++++++-\n>>>>    src/libcamera/pipeline/rkisp1/rkisp1_path.h   |  8 +++\n>>>>    2 files changed, 57 insertions(+), 2 deletions(-)\n>>>>\n>>>> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n>>>> index c49017d1..2421d06c 100644\n>>>> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n>>>> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp\n>>>> @@ -126,12 +126,59 @@ void RkISP1Path::populateFormats()\n>>>>    \t}\n>>>>    }\n>>>>\n>>>> +/**\n>>>> + * \\brief Filter the sensor resolutions that can be supported\n>>>> + * \\param[in] sensor The camera sensor\n>>>> + *\n>>>> + * This function retrieves all the sizes supported by the sensor and\n>>>> + * filters all the resolutions that can be supported on the pipeline.\n>>>> + * It is possible that the sensor's maximum output resolution is higher\n>>>> + * than the ISP maximum input. In that case, this function filters out all\n>>>> + * the resolution incapable of being supported and returns the maximum\n>>>> + * sensor resolution that can be supported by the pipeline.\n>>>> + *\n>>>> + * \\return Maximum sensor size supported on the pipeline\n>>>> + */\n>>>> +Size RkISP1Path::filterSensorResolution(const CameraSensor *sensor)\n>>>> +{\n>>>> +\tauto iter = sensorSizesMap_.find(sensor);\n>>>> +\tif (iter != sensorSizesMap_.end() && !iter->second.empty())\n> Can iter->second.empty() happen ?\n\nProbably not (I believe).\n\n>\n>>>> +\t\treturn iter->second.back();\n>>>> +\n>>>> +\tsensorSizesMap_.emplace(sensor, std::vector<Size>());\n>>>> +\n>>>> +\tstd::vector<Size> sensorSizes;\n>>>> +\tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n>>>> +\tfor (const auto it : mbusCodes) {\n>>>> +\t\tstd::vector<Size> sizes = sensor->sizes(it);\n>>>> +\t\tfor (Size sz : sizes)\n>>> Can't you filter out sizes that are larger than max sizes ?\n>>>\n>>> So you can populate sensorSizesMap_.second directly avoiding copies ?\n>> If I try to directly populate sensorSizesMap_ with the max size filter, it\n>> might have duplicated sizes entries (same size for different codes).\n>>\n>> That's why, I opted a temporary vector sensorSizes here, is used to collect\n>> all sizes for the formats that the sensor supports.\n>>\n>> Then later sorted, de-duplicated and filtered, before populating the\n>> sensorSizeMap_.second\n>>\n> I think you can do the same filtering/sorting directly on the vector\n> inside the map already.\n>\n> What I mean is something like\n>\n> Size RkISP1Path::filterSensorResolution(const CameraSensor *sensor)\n> {\n> \tauto iter = sensorSizesMap_.find(sensor);\n> \tif (iter != sensorSizesMap_.end())\n> \t\treturn iter->second.back();\n>\n> \tstd::vector<Size> &sizes = sensorSizesMap_[sensor];\n> \tfor (unsigned int code : sensor->mbusCodes()) {\n> \t\tfor (const Size &size : sensor->sizes(code)) {\n> \t\t\tif (size.width > maxResolution_.width ||\n> \t\t\t    size.height > maxResolution_.height)\n> \t\t\t\tcontinue;\n>\n> \t\t\tsizes.push_back(size);\n> \t\t}\n> \t}\n>\n> \t/* Sort in increasing order and remove duplicates. */\n> \tstd::sort(sizes.begin(), sizes.end());\n> \tauto last = std::unique(sizes.begin(), sizes.end());\n> \tsizes.erase(last, sizes.end());\n>\n> \treturn sizes.back();\n> }\n>\n> warning: compile tested only\n>\n> Do you think we need the list of supported, unique and sorted formats\n> anywhere else ? Otherwise you could just store the max res and not the\n> whole vector.\n\nIt's something on my mind lately, that should be keep the whole vector, \nor just max filtered out sensor resolution.\n\nThere might be some value in keeping all the supported sensor resolution \non the pipeline but again, there should be a use case for it, which I \nhaven't found at the moment.\n\n>\n> I won't bikeshed too much on the name, but even if this function\n> indeed does filter the sensor's resolutions, what it does is to return\n> the maxium sensor resolution supported by the pipeline, so I would\n> have gone for something like RkISP1Path::maxResolution(sensor *). Up\n> to you.\n\nIf we ditch the vector and just focus on sensor max resolution, your \nsuggestion will be applied.\n\nThanks,\nUmang.\n>\n> Thanks\n>    j\n>\n>>>> +\t\t\tsensorSizes.push_back(sz);\n>>>> +\t}\n>>> Can't we build this map once at populateFormats() time and solely\n>> The map is only built once. Checkout the early return at the start of the\n>> function\n>>> return the max supported size when needed ?\n>> I don't think you can do at populateFormats() as it is called in init()\n>>\n>> And RkISP1Path::init() is called in match() for RkISP1 pipeline handler,\n>> before the camera is even created.\n> Right, at init() time you don't have a sensor to operate with, fine\n> then!\n>\n>>>> +\n>>>> +\tstd::sort(sensorSizes.begin(), sensorSizes.end());\n>>>> +\n>>>> +\t/* Remove duplicates. */\n>>>> +\tauto last = std::unique(sensorSizes.begin(), sensorSizes.end());\n>>>> +\tsensorSizes.erase(last, sensorSizes.end());\n>>>> +\n>>>> +\t/* Discard any sizes that the pipeline is unable to support. */\n>>>> +\tfor (auto sz : sensorSizes) {\n>>>> +\t\tif (sz.width > maxResolution_.width ||\n>>>> +\t\t    sz.height > maxResolution_.height)\n>>>> +\t\t\tcontinue;\n>>>> +\n>>>> +\t\tsensorSizesMap_[sensor].push_back(sz);\n>>>> +\t}\n>>>> +\n>>>> +\treturn sensorSizesMap_[sensor].back();\n>>>> +}\n>>>> +\n>>>>    StreamConfiguration\n>>>>    RkISP1Path::generateConfiguration(const CameraSensor *sensor, const Size &size,\n>>>>    \t\t\t\t  StreamRole role)\n>>>>    {\n>>>>    \tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n>>>> -\tconst Size &resolution = sensor->resolution();\n>>>> +\tSize resolution = filterSensorResolution(sensor);\n>>>>\n>>>>    \t/* Min and max resolutions to populate the available stream formats. */\n>>>>    \tSize maxResolution = maxResolution_.boundedToAspectRatio(resolution)\n>>>> @@ -220,7 +267,7 @@ CameraConfiguration::Status RkISP1Path::validate(const CameraSensor *sensor,\n>>>>    \t\t\t\t\t\t StreamConfiguration *cfg)\n>>>>    {\n>>>>    \tconst std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();\n>>>> -\tconst Size &resolution = sensor->resolution();\n>>>> +\tSize resolution = filterSensorResolution(sensor);\n>>>>\n>>>>    \tconst StreamConfiguration reqCfg = *cfg;\n>>>>    \tCameraConfiguration::Status status = CameraConfiguration::Valid;\n>>>> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n>>>> index 08edefec..9f75fe1f 100644\n>>>> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n>>>> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h\n>>>> @@ -7,6 +7,7 @@\n>>>>\n>>>>    #pragma once\n>>>>\n>>>> +#include <map>\n>>>>    #include <memory>\n>>>>    #include <set>\n>>>>    #include <vector>\n>>>> @@ -63,6 +64,7 @@ public:\n>>>>\n>>>>    private:\n>>>>    \tvoid populateFormats();\n>>>> +\tSize filterSensorResolution(const CameraSensor *sensor);\n>>>>\n>>>>    \tstatic constexpr unsigned int RKISP1_BUFFER_COUNT = 4;\n>>>>\n>>>> @@ -77,6 +79,12 @@ private:\n>>>>    \tstd::unique_ptr<V4L2Subdevice> resizer_;\n>>>>    \tstd::unique_ptr<V4L2VideoDevice> video_;\n>>>>    \tMediaLink *link_;\n>>>> +\n>>>> +\t/*\n>>>> +\t * Map from camera sensors to the sizes (in increasing order),\n>>>> +\t * which are guaranteed to be supported by the pipeline.\n>>>> +\t */\n>>>> +\tstd::map<const CameraSensor *, std::vector<Size>> sensorSizesMap_;\n>>>>    };\n>>>>\n>>>>    class RkISP1MainPath : public RkISP1Path\n>>>> --\n>>>> 2.45.0\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 0680FC0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 Sep 2024 07:37:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A04CA63510;\n\tFri, 27 Sep 2024 09:37:25 +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 09452618DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 Sep 2024 09:37:24 +0200 (CEST)","from [IPV6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f] (unknown\n\t[IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 909A98BF;\n\tFri, 27 Sep 2024 09:35:54 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"hSL+S/eD\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727422555;\n\tbh=yWBQe4M14A6NDn2yXdKK5g/W17LclgXU1UrxO6VfGFE=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=hSL+S/eDqNHFrcAmAedkd2ZiHXdTuehIUAXQZYUL6iagwTz4/noyVbGJ0O5r54Yn3\n\trYgxZIEVdXIM3yD6rrTrRl0vTwDQlbfBLD1Tw4yv2UtEqcwb57uvKb8M3ruspxilJ6\n\tnS2ISwGgFfkWAgRtWYKcbvSotu4hybdLGkpM1M1w=","Message-ID":"<5e32e39f-ca9c-4cba-a169-ea999895c32e@ideasonboard.com>","Date":"Fri, 27 Sep 2024 13:07:18 +0530","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3] pipeline: rkisp1: Filter out sensor sizes not\n\tsupported by the pipeline","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20240926133236.98137-1-umang.jain@ideasonboard.com>\n\t<7jeq2vjnwbpqbdrklx5ybi2fv6fmuc3ewukxndymz5erq3ihhm@p5m4jhudh7vr>\n\t<ae9a5f13-e1bf-43b2-aa06-808ace6ddf15@ideasonboard.com>\n\t<km2g7i3uyc4hlntco7ctcg4yzc4qwiwet5se6jpepfzmx7z4xo@b23ve4bswaif>","Content-Language":"en-US","From":"Umang Jain <umang.jain@ideasonboard.com>","In-Reply-To":"<km2g7i3uyc4hlntco7ctcg4yzc4qwiwet5se6jpepfzmx7z4xo@b23ve4bswaif>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]