[{"id":16970,"web_url":"https://patchwork.libcamera.org/comment/16970/","msgid":"<CAO5uPHPxRodRF7sXEPyAC3788vze=NKwhtdOs7JKjL1oL+f9pA@mail.gmail.com>","date":"2021-05-17T03:57:38","subject":"Re: [libcamera-devel] [PATCH v3 1/8] libcamera: ipu3: imgu: Update\n\tBDS calculation process","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Jacopo, thank you for the patch.\n\nOn Fri, May 14, 2021 at 12:20 AM Jacopo Mondi <jacopo@jmondi.org> wrote:\n\n> Apply the last three hunks of commit 243d134 (\"Fix some bug for some\n> resolutions\") from https://github.com/intel/intel-ipu3-pipecfg.git\n> to the BDS calculation procedure.\n>\n> The BDS calculation is now perfomed by scaling both width and height,\n> and repeated by scaling width first.\n>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n> Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n>\n\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n\n>\n\n> ---\n>  src/libcamera/pipeline/ipu3/imgu.cpp | 36 ++++++++++++++++++++++++----\n>  1 file changed, 31 insertions(+), 5 deletions(-)\n>\n> diff --git a/src/libcamera/pipeline/ipu3/imgu.cpp\n> b/src/libcamera/pipeline/ipu3/imgu.cpp\n> index d5cf05b0c421..acc625ab0fac 100644\n> --- a/src/libcamera/pipeline/ipu3/imgu.cpp\n> +++ b/src/libcamera/pipeline/ipu3/imgu.cpp\n> @@ -394,19 +394,45 @@ ImgUDevice::PipeConfig\n> ImgUDevice::calculatePipeConfig(Pipe *pipe)\n>         const Size &in = pipe->input;\n>         Size gdc = calculateGDC(pipe);\n>\n> -       unsigned int ifWidth = utils::alignUp(in.width, IF_ALIGN_W);\n> -       unsigned int ifHeight = in.height;\n> -       unsigned int minIfWidth = in.width - IF_CROP_MAX_W;\n>         float bdsSF = static_cast<float>(in.width) / gdc.width;\n>         float sf = findScaleFactor(bdsSF, bdsScalingFactors, true);\n>\n> +       /* Populate the configurations vector by scaling width and height.\n> */\n> +       unsigned int ifWidth = utils::alignUp(in.width, IF_ALIGN_W);\n> +       unsigned int ifHeight = utils::alignUp(in.height, IF_ALIGN_H);\n> +       unsigned int minIfWidth = std::min(IF_ALIGN_W,\n> +                                          in.width - IF_CROP_MAX_W);\n> +       unsigned int minIfHeight = std::min(IF_ALIGN_H,\n> +                                           in.height - IF_CROP_MAX_H);\n>         while (ifWidth >= minIfWidth) {\n> -               Size iif{ ifWidth, ifHeight };\n> -               calculateBDS(pipe, iif, gdc, sf);\n> +               while (ifHeight >= minIfHeight) {\n> +                       Size iif{ ifWidth, ifHeight };\n> +                       calculateBDS(pipe, iif, gdc, sf);\n> +                       ifHeight -= IF_ALIGN_H;\n> +               }\n>\n>                 ifWidth -= IF_ALIGN_W;\n>         }\n>\n> +       /* Repeat search by scaling width first. */\n> +       ifWidth = utils::alignUp(in.width, IF_ALIGN_W);\n> +       ifHeight = utils::alignUp(in.height, IF_ALIGN_H);\n> +       minIfWidth = std::min(IF_ALIGN_W, in.width - IF_CROP_MAX_W);\n> +       minIfHeight = std::min(IF_ALIGN_H, in.height - IF_CROP_MAX_H);\n> +       while (ifHeight >= minIfHeight) {\n> +               /*\n> +                * \\todo This procedure is probably broken:\n> +                * https://github.com/intel/intel-ipu3-pipecfg/issues/2\n> +                */\n> +               while (ifWidth >= minIfWidth) {\n> +                       Size iif{ ifWidth, ifHeight };\n> +                       calculateBDS(pipe, iif, gdc, sf);\n> +                       ifWidth -= IF_ALIGN_W;\n> +               }\n> +\n> +               ifHeight -= IF_ALIGN_H;\n> +       }\n> +\n>         if (pipeConfigs.size() == 0) {\n>                 LOG(IPU3, Error) << \"Failed to calculate pipe\n> configuration\";\n>                 return {};\n> --\n> 2.31.1\n>\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel\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 1CDD0C31FB\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 17 May 2021 03:57:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D0F4C6891E;\n\tMon, 17 May 2021 05:57:50 +0200 (CEST)","from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com\n\t[IPv6:2a00:1450:4864:20::52f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D04B4602B1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 17 May 2021 05:57:49 +0200 (CEST)","by mail-ed1-x52f.google.com with SMTP id v5so5122289edc.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 16 May 2021 20:57:49 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"I06ZNZrs\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=VbE3Ees4TEZrwzMbAf8T8+CMS6EofKTXhbO2Jxg8LVY=;\n\tb=I06ZNZrsMz+q+K12AiqCvnDeJko38QsB3SvuUqXiWnw2r0sNSPdQTW5W5kXpvQXfgg\n\tosptGMoRplDOYVwsw5R1LgvhLQKUZGJFElQnuAHfumgZn7yCQWVaPuhL1A1tePGjNYLQ\n\tUe7X+HrrClgrcZZ6K2kamhRhettndml80UgYQ=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=VbE3Ees4TEZrwzMbAf8T8+CMS6EofKTXhbO2Jxg8LVY=;\n\tb=OkddaWm6qih04x+GtxPVOE/44k4t+lBXNWpIL7vBc7CV77OeCfg7QQcz8BQboDRSbT\n\tw8i1iEm1LEeevRsG36af+NizMglHqwK3RGD7+DHZCcVpPHoQWI/vzmroq/JCnhXbo3b4\n\tn7GDwO4Q6jM/hl3nJ5/rJPG4lFl3n1PVazKy2NPPHTOXtop1OB+bdZ0uwlW6DdnqOpOz\n\tQHluBv3J97ETyMqC9H8QsE4N5geSqJcHGoVemPsqVcrGK4uEtODk/ODbw2RCjIy5sTRP\n\tEAYAK2FIJV1JWEIcZZTae3FXEA3VJzXxcxWKRmSMBROliTd2fEsHhUvUxUzZLLMzUals\n\tz+hQ==","X-Gm-Message-State":"AOAM53199AXm2dZOra2oXDluJwGORw3zqWJj32Q+2LrPOCw2DkuQFwoG\n\ttclKoCBhmvP85/9njpO535E7Yt1Wb1UTn7yF0UMHbg==","X-Google-Smtp-Source":"ABdhPJyfWEAnA9D3KXHal+MLcXtSuW1IpEZEF7/RLwqBi1pZe9JnZ4w70yslI5olnT60qpdigflENriDJ72O/j0ADTg=","X-Received":"by 2002:a05:6402:cb8:: with SMTP id\n\tcn24mr3205832edb.325.1621223869587; \n\tSun, 16 May 2021 20:57:49 -0700 (PDT)","MIME-Version":"1.0","References":"<20210513152116.17666-1-jacopo@jmondi.org>\n\t<20210513152116.17666-2-jacopo@jmondi.org>","In-Reply-To":"<20210513152116.17666-2-jacopo@jmondi.org>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Mon, 17 May 2021 12:57:38 +0900","Message-ID":"<CAO5uPHPxRodRF7sXEPyAC3788vze=NKwhtdOs7JKjL1oL+f9pA@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Content-Type":"multipart/alternative; boundary=\"000000000000d92d6d05c27e98d0\"","Subject":"Re: [libcamera-devel] [PATCH v3 1/8] libcamera: ipu3: imgu: Update\n\tBDS calculation process","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]