[{"id":15852,"web_url":"https://patchwork.libcamera.org/comment/15852/","msgid":"<c633f633-4629-074c-a73f-5993072a69cb@ideasonboard.com>","date":"2021-03-24T07:13:40","subject":"Re: [libcamera-devel] [PATCH 2/7] libcamera: ipu3: imgu: Filter BDS\n\tby height","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"content":"Hi Jacopo,\n\nThanks for the patch,\n\nOn 18/03/2021 11:39, Jacopo Mondi wrote:\n> Apply to calculateBDS() function the content of commit 243d134 (\"Fix\n> some bug for some resolutions\") from\n> https://github.com/intel/intel-ipu3-pipecfg.git.\n> \n> The calculated BDS sizes are filtered by height and not only by width\n> anymore.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nTested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\nReviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> ---\n>  src/libcamera/pipeline/ipu3/imgu.cpp | 20 +++++++++++++++-----\n>  1 file changed, 15 insertions(+), 5 deletions(-)\n> \n> diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp b/src/libcamera/pipeline/ipu3/imgu.cpp\n> index 4a1b0a9528f2..d9296ea3e674 100644\n> --- a/src/libcamera/pipeline/ipu3/imgu.cpp\n> +++ b/src/libcamera/pipeline/ipu3/imgu.cpp\n> @@ -33,6 +33,7 @@ namespace {\n>   * at revision: 61e83f2f7606 (\"Add more information into README\")\n>   */\n>  \n> +static constexpr unsigned int FILTER_W = 4;\n>  static constexpr unsigned int FILTER_H = 4;\n>  \n>  static constexpr unsigned int IF_ALIGN_W = 2;\n> @@ -194,15 +195,20 @@ void calculateBDSHeight(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc\n>  \n>  void calculateBDS(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc, float bdsSF)\n>  {\n> -\tunsigned int minBDSWidth = gdc.width + FILTER_H * 2;\n> +\tunsigned int minBDSWidth = gdc.width + FILTER_W * 2;\n> +\tunsigned int minBDSHeight = gdc.height + FILTER_H * 2;\n>  \n>  \tfloat sf = bdsSF;\n>  \twhile (sf <= BDS_SF_MAX && sf >= BDS_SF_MIN) {\n>  \t\tfloat bdsWidth = static_cast<float>(iif.width) / sf;\n> +\t\tfloat bdsHeight = static_cast<float>(iif.height) / sf;\n>  \n> -\t\tif (std::fmod(bdsWidth, 1.0) == 0) {\n> +\t\tif (std::fmod(bdsWidth, 1.0) == 0 &&\n> +\t\t    std::fmod(bdsHeight, 1.0) == 0) {\n>  \t\t\tunsigned int bdsIntWidth = static_cast<unsigned int>(bdsWidth);\n> -\t\t\tif (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth)\n> +\t\t\tunsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight);\n> +\t\t\tif (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth &&\n> +\t\t\t    !(bdsIntHeight % BDS_ALIGN_H) && bdsHeight >= minBDSHeight)\n>  \t\t\t\tcalculateBDSHeight(pipe, iif, gdc, bdsIntWidth, sf);\n>  \t\t}\n>  \n> @@ -212,10 +218,14 @@ void calculateBDS(ImgUDevice::Pipe *pipe, const Size &iif, const Size &gdc, floa\n>  \tsf = bdsSF;\n>  \twhile (sf <= BDS_SF_MAX && sf >= BDS_SF_MIN) {\n>  \t\tfloat bdsWidth = static_cast<float>(iif.width) / sf;\n> +\t\tfloat bdsHeight = static_cast<float>(iif.height) / sf;\n>  \n> -\t\tif (std::fmod(bdsWidth, 1.0) == 0) {\n> +\t\tif (std::fmod(bdsWidth, 1.0) == 0 &&\n> +\t\t    std::fmod(bdsHeight, 1.0) == 0) {\n>  \t\t\tunsigned int bdsIntWidth = static_cast<unsigned int>(bdsWidth);\n> -\t\t\tif (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth)\n> +\t\t\tunsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight);\n> +\t\t\tif (!(bdsIntWidth % BDS_ALIGN_W) && bdsWidth >= minBDSWidth &&\n> +\t\t\t    !(bdsIntHeight % BDS_ALIGN_H) && bdsHeight >= minBDSHeight)\n>  \t\t\t\tcalculateBDSHeight(pipe, iif, gdc, bdsIntWidth, sf);\n>  \t\t}\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 3609FC32E7\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 24 Mar 2021 07:13:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EC46168D66;\n\tWed, 24 Mar 2021 08:13:42 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4273068D47\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 24 Mar 2021 08:13:41 +0100 (CET)","from [IPv6:2a01:e0a:169:7140:21bd:98cc:c21e:1364] (unknown\n\t[IPv6:2a01:e0a:169:7140:21bd:98cc:c21e:1364])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EF92E580;\n\tWed, 24 Mar 2021 08:13:40 +0100 (CET)"],"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=\"SzobXFSv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1616570021;\n\tbh=cCb31Dq/AEaTsoSOU6zg/aInIX5l310mwDDWsH3Tvh4=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=SzobXFSvvd0t1FtOuVX1umEeCxzF/h8zAMTz3UPdltSpSGMRBzfU4sxv+WQVKX6wu\n\t8k8Q24zQyWjs2acPQHzcNdOF/KHHwjDdc0KFSYfS6e57ONu2EcIMr83gpt5ODdav2J\n\tRAByhUFkx9MwKGSUL6AEve7dVZZD1nEZOZEbWWk8=","To":"Jacopo Mondi <jacopo@jmondi.org>, libcamera-devel@lists.libcamera.org","References":"<20210318103941.18837-1-jacopo@jmondi.org>\n\t<20210318103941.18837-3-jacopo@jmondi.org>","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","Message-ID":"<c633f633-4629-074c-a73f-5993072a69cb@ideasonboard.com>","Date":"Wed, 24 Mar 2021 08:13:40 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.7.1","MIME-Version":"1.0","In-Reply-To":"<20210318103941.18837-3-jacopo@jmondi.org>","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH 2/7] libcamera: ipu3: imgu: Filter BDS\n\tby height","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]