[{"id":16068,"web_url":"https://patchwork.libcamera.org/comment/16068/","msgid":"<CAO5uPHMmT3q_eCui+o3xsc55hjBSqu9vejK7Uaj1Jx9VG6mCtQ@mail.gmail.com>","date":"2021-03-31T06:55:37","subject":"Re: [libcamera-devel] [PATCH] android: CameraDevice: Report proper\n\tmin and max frame durations","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Paul, thanks for the patch.\n\nOn Tue, Mar 30, 2021 at 6:50 PM Paul Elder <paul.elder@ideasonboard.com> wrote:\n>\n> The HAL layer was getting the min and max frame durations from from the\n\nnit: durations from the\n\n> camera, then rounding it to fps to report as available fps ranges. The\n> same min and max frame durations were then being reported as min and max\n> frame durations. Since the fps are integer values while the frame\n> durations are in ns, this caused a rounding error making it seem like we\n> were reporting an available max fps that was higher than was was allowed\n> by the minimum frame duration.\n>\n\nIt might be nice to have one example of the case.\n\n> Fix this by recalculating the frame durations based on the rounded fps\n> values.\n>\n> This allows the following CTS test to pass:\n> - android.hardware.camera2.cts.SurfaceViewPreviewTest#testPreviewFpsRange\n>\n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> ---\n>  src/android/camera_device.cpp | 4 ++++\n>  1 file changed, 4 insertions(+)\n>\n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 931e9f37..91d4e8d4 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -799,6 +799,10 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n>                 int32_t minFps = std::round(1e9 / maxFrameDurationNsec);\n>                 minFps = std::max(1, minFps);\n>\n> +               /* Avoid rounding errors when we reuse these variables later */\n> +               minFrameDurationNsec = 1e9 / maxFps;\n> +               maxFrameDurationNsec = 1e9 / minFps;\n> +\n>                 /*\n>                  * Register to the camera service {min, max} and {max, max}\n>                  * intervals as requested by the metadata documentation.\n> --\n> 2.27.0\n>\n\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n\n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 EE586C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 31 Mar 2021 06:55:50 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3BDDB6877F;\n\tWed, 31 Mar 2021 08:55:50 +0200 (CEST)","from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com\n\t[IPv6:2a00:1450:4864:20::62f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8A312602DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 31 Mar 2021 08:55:48 +0200 (CEST)","by mail-ej1-x62f.google.com with SMTP id hq27so28399022ejc.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Mar 2021 23:55:48 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"BWCRmJbi\"; 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=H/X5DSABz9aNhZtsha9lETmLeStTgrw88nX95LlRcGw=;\n\tb=BWCRmJbiEreHQ0i+FbQ/V2IpbIaGamN30MLHKjtw8YzXH5pMUGKquT/QXpQs3/zyOm\n\tO5WGDLuwC/GNa2FvbwcVbRGFqGpy1kqr0OCTgrWySx/g4nVqA+UBnm6AKBAxBOzf6udP\n\tySlIc53V1e2u5Q7Qe1Gp472K5ib8cEfjT3bME=","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=H/X5DSABz9aNhZtsha9lETmLeStTgrw88nX95LlRcGw=;\n\tb=E2RDRSvwVoIzhSUqyzmQXYIHAW6kQJQX0SXJTv3sD9ZyBX0vIMVCZ4HqvmWMRTTHs7\n\t4GnT3tCk7LVeCUq+zdzhDQ4fxS4Z7G58cozYdwez3b3arvCrtXa5sbaZ25k64pRb0WAn\n\t1BW3F1DbLuO/sPgTyaZw8H6wV0SzfSKIwwmj3ISUWewIrcxOfwHlO/h9WFS9FUZyekjY\n\tKr3CQI6YiDbTk066hXQORk/GS60hY0rZ2DqMK2o8v6Qe3Quw2wl0K7yI5n6L7RaX3oXT\n\tL7RwVBhxFU1P2yiRDtfiJQ/1cPg91iOuBtw6HkNNeApyLXp8gjF4c2pY+7Qaj4x9SKmk\n\tVTLg==","X-Gm-Message-State":"AOAM531GfyeOkcgRB4v70ANGtAnEUuo+YYQDOS2cRnM+GVIdWujliV7z\n\t7IVf5hitxrxmgWJb3gvniBxMohg5qrffIgA2Cxwk+A==","X-Google-Smtp-Source":"ABdhPJxcOnQn3BCxo5ZoR8Y3fyUZyT1wIC1TmCfkeo6VE5D968r8b238wEmGp7yEVMYLG5xeUSxxN3wXY+lA1MIlNLc=","X-Received":"by 2002:a17:906:1a4b:: with SMTP id\n\tj11mr1937863ejf.55.1617173748170; \n\tTue, 30 Mar 2021 23:55:48 -0700 (PDT)","MIME-Version":"1.0","References":"<20210330094941.127664-1-paul.elder@ideasonboard.com>","In-Reply-To":"<20210330094941.127664-1-paul.elder@ideasonboard.com>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Wed, 31 Mar 2021 15:55:37 +0900","Message-ID":"<CAO5uPHMmT3q_eCui+o3xsc55hjBSqu9vejK7Uaj1Jx9VG6mCtQ@mail.gmail.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH] android: CameraDevice: Report proper\n\tmin and max frame durations","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>","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>"}}]