[{"id":18631,"web_url":"https://patchwork.libcamera.org/comment/18631/","msgid":"<20210809155954.pyt3vpqjpsq4lnj5@uno.localdomain>","date":"2021-08-09T15:59:54","subject":"Re: [libcamera-devel] [PATCH 3/4] ipu3: cio2: Change sensor size\n\tselection policy","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Umang,\n\nOn Tue, Aug 03, 2021 at 07:02:04PM +0530, Umang Jain wrote:\n> From: Jacopo Mondi <jacopo@jmondi.org>\n\nwell, you wrote these bits, so you should get the authorship.\nMaybe a Suggested-by: tag if you wish to, but it's not that necessary\n:)\n\n>\n> The current implementation of getSensorFormat() prioritizes sensor\n> sizes that match the output size FOV ratio.\n>\n> Modify the frame size selection procedure to prioritize resolutions\n> with the same FOV as the sensor's native one, to avoid cropping in the\n> sensor pixel array.\n>\n> In example, with the current implementation :\n\nI would s/, with..//\n>\n> - on a Soraka device equipped with ov13858 as back sensor, with a\n>   native resolution of 4224x3136 (4:3), when requested to select the\n>   sensor output size to produce 1080p (16:9) a frame size of 2112x1188\n>   (16:9) is selected causing the ImgU configuration procedure to fail.\n>   If a resolution with the same FOV as the sensor's native size, such\n>   as 2112x1568 (4:3), is selected the pipeline works correctly.\n>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n>  src/libcamera/pipeline/ipu3/cio2.cpp | 8 +++++---\n>  1 file changed, 5 insertions(+), 3 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\n> index be063613..9980b8bd 100644\n> --- a/src/libcamera/pipeline/ipu3/cio2.cpp\n> +++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n> @@ -239,8 +239,8 @@ StreamConfiguration CIO2Device::generateConfiguration(Size size) const\n>   *\n>   * - The desired \\a size shall fit in the sensor output size to avoid the need\n>   *   to up-scale.\n> - * - The sensor output size shall match the desired aspect ratio to avoid the\n> - *   need to crop the field of view.\n> + * - The aspect ratio of sensor output size shall be as close as possible to\n> + *   the sensor's native resolution field of view.\n>   * - The sensor output size shall be as small as possible to lower the required\n>   *   bandwidth.\n>   * - The desired \\a size shall be supported by one of the media bus code listed\n> @@ -264,7 +264,9 @@ V4L2SubdeviceFormat CIO2Device::getSensorFormat(const std::vector<unsigned int>\n>  {\n>  \tunsigned int desiredArea = size.width * size.height;\n>  \tunsigned int bestArea = UINT_MAX;\n> -\tfloat desiredRatio = static_cast<float>(size.width) / size.height;\n> +\tconst Size &resolution = sensor_->resolution();\n> +\tfloat desiredRatio = static_cast<float>(resolution.width) /\n> +\t\t\t     resolution.height;\n\nDoes this fix your issues with Nautilus ?\n\nThe patch looks good!\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n\nThanks\n   j\n>  \tfloat bestRatio = FLT_MAX;\n>  \tSize bestSize;\n>  \tuint32_t bestCode = 0;\n> --\n> 2.31.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 D9BE7C3240\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  9 Aug 2021 15:59:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5E13B68826;\n\tMon,  9 Aug 2021 17:59:08 +0200 (CEST)","from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net\n\t[217.70.183.198])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3C97260269\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Aug 2021 17:59:06 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay6-d.mail.gandi.net (Postfix) with ESMTPSA id B9089C000A;\n\tMon,  9 Aug 2021 15:59:05 +0000 (UTC)"],"Date":"Mon, 9 Aug 2021 17:59:54 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<20210809155954.pyt3vpqjpsq4lnj5@uno.localdomain>","References":"<20210803133205.6599-1-umang.jain@ideasonboard.com>\n\t<20210803133205.6599-4-umang.jain@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210803133205.6599-4-umang.jain@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 3/4] ipu3: cio2: Change sensor size\n\tselection policy","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":18632,"web_url":"https://patchwork.libcamera.org/comment/18632/","msgid":"<2b7cf3a1-cc80-58ea-f557-077ea65a5f39@ideasonboard.com>","date":"2021-08-09T16:07:15","subject":"Re: [libcamera-devel] [PATCH 3/4] ipu3: cio2: Change sensor size\n\tselection policy","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Jacopo\n\nOn 8/9/21 9:29 PM, Jacopo Mondi wrote:\n> Hi Umang,\n>\n> On Tue, Aug 03, 2021 at 07:02:04PM +0530, Umang Jain wrote:\n>> From: Jacopo Mondi <jacopo@jmondi.org>\n> well, you wrote these bits, so you should get the authorship.\n> Maybe a Suggested-by: tag if you wish to, but it's not that necessary\n> :)\n>\n>> The current implementation of getSensorFormat() prioritizes sensor\n>> sizes that match the output size FOV ratio.\n>>\n>> Modify the frame size selection procedure to prioritize resolutions\n>> with the same FOV as the sensor's native one, to avoid cropping in the\n>> sensor pixel array.\n>>\n>> In example, with the current implementation :\n> I would s/, with..//\n>> - on a Soraka device equipped with ov13858 as back sensor, with a\n>>    native resolution of 4224x3136 (4:3), when requested to select the\n>>    sensor output size to produce 1080p (16:9) a frame size of 2112x1188\n>>    (16:9) is selected causing the ImgU configuration procedure to fail.\n>>    If a resolution with the same FOV as the sensor's native size, such\n>>    as 2112x1568 (4:3), is selected the pipeline works correctly.\n>>\n>> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n>> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>\n>> ---\n>>   src/libcamera/pipeline/ipu3/cio2.cpp | 8 +++++---\n>>   1 file changed, 5 insertions(+), 3 deletions(-)\n>>\n>> diff --git a/src/libcamera/pipeline/ipu3/cio2.cpp b/src/libcamera/pipeline/ipu3/cio2.cpp\n>> index be063613..9980b8bd 100644\n>> --- a/src/libcamera/pipeline/ipu3/cio2.cpp\n>> +++ b/src/libcamera/pipeline/ipu3/cio2.cpp\n>> @@ -239,8 +239,8 @@ StreamConfiguration CIO2Device::generateConfiguration(Size size) const\n>>    *\n>>    * - The desired \\a size shall fit in the sensor output size to avoid the need\n>>    *   to up-scale.\n>> - * - The sensor output size shall match the desired aspect ratio to avoid the\n>> - *   need to crop the field of view.\n>> + * - The aspect ratio of sensor output size shall be as close as possible to\n>> + *   the sensor's native resolution field of view.\n>>    * - The sensor output size shall be as small as possible to lower the required\n>>    *   bandwidth.\n>>    * - The desired \\a size shall be supported by one of the media bus code listed\n>> @@ -264,7 +264,9 @@ V4L2SubdeviceFormat CIO2Device::getSensorFormat(const std::vector<unsigned int>\n>>   {\n>>   \tunsigned int desiredArea = size.width * size.height;\n>>   \tunsigned int bestArea = UINT_MAX;\n>> -\tfloat desiredRatio = static_cast<float>(size.width) / size.height;\n>> +\tconst Size &resolution = sensor_->resolution();\n>> +\tfloat desiredRatio = static_cast<float>(resolution.width) /\n>> +\t\t\t     resolution.height;\n> Does this fix your issues with Nautilus ?\n\n4/4 is the fix for nautilus. This one is mainly for soraka. It \n(standalone) doesn't change status quo on nautilus as far as I remember \nin my testing.\n\nThanks!\n\n>\n> The patch looks good!\n> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n>\n> Thanks\n>     j\n>>   \tfloat bestRatio = FLT_MAX;\n>>   \tSize bestSize;\n>>   \tuint32_t bestCode = 0;\n>> --\n>> 2.31.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 1DCEDBD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  9 Aug 2021 16:07:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 934DC687EB;\n\tMon,  9 Aug 2021 18:07:22 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E109260269\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Aug 2021 18:07:20 +0200 (CEST)","from [192.168.1.104] (unknown [103.251.226.61])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E0F97466;\n\tMon,  9 Aug 2021 18:07:19 +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=\"CXLdjiIe\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1628525240;\n\tbh=tfTvIJ0WhSyTuaJza4tDA9cdVG44JSG6LUHxJ3KJ5Gs=;\n\th=Subject:To:Cc:References:From:Date:In-Reply-To:From;\n\tb=CXLdjiIeKTvM8NXOypeW8uBwi6WQHMRr+d6BDX417xtvwbMnRyfHASzd/SE5fedZs\n\tDlfa1dGdDxgwdfIlYoxRcVdS7hGRTvBLG8IqBV4qfkEkarXj+AHB808TgPkYSN9i3w\n\tQehkLbmPuCVoNG7yc9auYTpW5CNpvJTmIaT7r9TE=","To":"Jacopo Mondi <jacopo@jmondi.org>","References":"<20210803133205.6599-1-umang.jain@ideasonboard.com>\n\t<20210803133205.6599-4-umang.jain@ideasonboard.com>\n\t<20210809155954.pyt3vpqjpsq4lnj5@uno.localdomain>","From":"Umang Jain <umang.jain@ideasonboard.com>","Message-ID":"<2b7cf3a1-cc80-58ea-f557-077ea65a5f39@ideasonboard.com>","Date":"Mon, 9 Aug 2021 21:37:15 +0530","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.10.2","MIME-Version":"1.0","In-Reply-To":"<20210809155954.pyt3vpqjpsq4lnj5@uno.localdomain>","Content-Type":"text/plain; charset=utf-8; format=flowed","Content-Transfer-Encoding":"7bit","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH 3/4] ipu3: cio2: Change sensor size\n\tselection policy","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>"}}]