[{"id":20160,"web_url":"https://patchwork.libcamera.org/comment/20160/","msgid":"<YWY504a8Mb/Sm35X@pendragon.ideasonboard.com>","date":"2021-10-13T01:43:47","subject":"Re: [libcamera-devel] [PATCH v3 14/16] android: Populate streams\n\tand duration in the same loop","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Mon, Oct 11, 2021 at 05:11:52PM +0200, Jacopo Mondi wrote:\n> The ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS and\n> ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS static metadata are\n> populated by looping on the streamConfigurations_ vector.\n> \n> Unify them in a single loop to avoid repeating it.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/android/camera_capabilities.cpp | 22 +++++++++-------------\n>  1 file changed, 9 insertions(+), 13 deletions(-)\n> \n> diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp\n> index e26c722ef4e5..2e9d1bcb3340 100644\n> --- a/src/android/camera_capabilities.cpp\n> +++ b/src/android/camera_capabilities.cpp\n> @@ -1266,7 +1266,9 @@ int CameraCapabilities::initializeStaticMetadata()\n>  \t\t\t\t  maxZoom);\n>  \n>  \tstd::vector<uint32_t> availableStreamConfigurations;\n> +\tstd::vector<int64_t> minFrameDurations;\n>  \tavailableStreamConfigurations.reserve(streamConfigurations_.size() * 4);\n> +\tminFrameDurations.reserve(streamConfigurations_.size() * 4);\n>  \tfor (const auto &entry : streamConfigurations_) {\n>  \t\t/*\n>  \t\t * Filter out YUV streams not capable of running at 30 FPS.\n> @@ -1285,12 +1287,19 @@ int CameraCapabilities::initializeStaticMetadata()\n>  \t\tif (entry.androidFormat != HAL_PIXEL_FORMAT_BLOB && fps < 30)\n>  \t\t\tcontinue;\n>  \n> +\t\t/* Stream configuration map. */\n>  \t\tavailableStreamConfigurations.push_back(entry.androidFormat);\n>  \t\tavailableStreamConfigurations.push_back(entry.resolution.width);\n>  \t\tavailableStreamConfigurations.push_back(entry.resolution.height);\n>  \t\tavailableStreamConfigurations.push_back(\n>  \t\t\tANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT);\n>  \n> +\t\t/* Per-stream durations. */\n> +\t\tminFrameDurations.push_back(entry.androidFormat);\n> +\t\tminFrameDurations.push_back(entry.resolution.width);\n> +\t\tminFrameDurations.push_back(entry.resolution.height);\n> +\t\tminFrameDurations.push_back(entry.minFrameDurationNsec);\n> +\n>  \t\tLOG(HAL, Debug)\n>  \t\t\t<< \"Output Stream: \" << utils::hex(entry.androidFormat)\n>  \t\t\t<< \" (\" << entry.resolution.toString() << \")[\"\n> @@ -1300,19 +1309,6 @@ int CameraCapabilities::initializeStaticMetadata()\n>  \tstaticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS,\n>  \t\t\t\t  availableStreamConfigurations);\n>  \n\nIn the review of v2, I meant dropping the blank line right here, not the\none you've added just above this addEntry() call. It doesn't matter\nmuch, please do what you like best.\n\n> -\tstd::vector<int64_t> minFrameDurations;\n> -\tminFrameDurations.reserve(streamConfigurations_.size() * 4);\n> -\tfor (const auto &entry : streamConfigurations_) {\n> -\t\tunsigned int fps = static_cast<unsigned int>\n> -\t\t\t\t   (floor(1e9 / entry.minFrameDurationNsec + 0.05f));\n> -\t\tif (entry.androidFormat != HAL_PIXEL_FORMAT_BLOB && fps < 30)\n> -\t\t\tcontinue;\n> -\n> -\t\tminFrameDurations.push_back(entry.androidFormat);\n> -\t\tminFrameDurations.push_back(entry.resolution.width);\n> -\t\tminFrameDurations.push_back(entry.resolution.height);\n> -\t\tminFrameDurations.push_back(entry.minFrameDurationNsec);\n> -\t}\n>  \tstaticMetadata_->addEntry(ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS,\n>  \t\t\t\t  minFrameDurations);\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 9096DC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Oct 2021 01:44:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1336868F4F;\n\tWed, 13 Oct 2021 03:44:03 +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 BE4EC6012B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Oct 2021 03:44:01 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 2035C291;\n\tWed, 13 Oct 2021 03:44:01 +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=\"qa9fe4qK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634089441;\n\tbh=3orIohzBe0m9shSj0NUHuhYx+PkjadzeB78vYjw9YTg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=qa9fe4qKt7q8kjqFaCdRDsR//ZeXdoZFjOUGbaX+mtmBobxxwNdlWm2GAEt7JyxPb\n\t4cLpBKCh6hxJBjM7gu43ZkKG6MGBYE5FVPOVVQ5exNQrOyGBPEBMDLlUc4qoOtrCPq\n\t9AG0vXrHrbQCJC2lD4B6hR+ijMabCEQnTo/24b/k=","Date":"Wed, 13 Oct 2021 04:43:47 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YWY504a8Mb/Sm35X@pendragon.ideasonboard.com>","References":"<20211011151154.72856-1-jacopo@jmondi.org>\n\t<20211011151154.72856-15-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211011151154.72856-15-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v3 14/16] android: Populate streams\n\tand duration in the same loop","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>"}}]