From patchwork Wed Feb 9 07:19:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanlin Chen X-Patchwork-Id: 15352 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 2A5F8C3263 for ; Wed, 9 Feb 2022 07:19:57 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E7E7E610FA; Wed, 9 Feb 2022 08:19:45 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NWnxySjH"; dkim-atps=neutral Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4C49D610EB for ; Wed, 9 Feb 2022 08:19:44 +0100 (CET) Received: by mail-pl1-x636.google.com with SMTP id x4so1478953plb.4 for ; Tue, 08 Feb 2022 23:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Xt4lfOQkowpQXAH73t5mp6GGmsHlhDFYyEAO6kd44jw=; b=NWnxySjHAJucfSDM8cwryoE6s3y8rS8NfNIwN2UyE2r4vg+LkyQCXrP2izT741vtnG ZDnr6UA3WtZ/8RzqQdSSylVa+5WgDcRaBewYJIv0UToIEnELGps4aKmMkMiS6k3b2AtT WsJWne9cKpdPIDlnMR3OtQHtS4jjipmxFliP8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xt4lfOQkowpQXAH73t5mp6GGmsHlhDFYyEAO6kd44jw=; b=AokOVHA1/Hf8eKY7gIYgR9ucQtfOBKOdLp0AyBMCoE+LCpxRvNXymoFAenWZzadKmO AdDgUIP6T5pHsPafTSyUX0F0euFwynKH7b/KDozMi7J03q2HbSIT3jxI3CSQdxeNkPEB VtI5XseOnTjqtb4apCZ0jBjGQdm8JXNXpw+AgwOLkC9nyXsnwi9t3shCR3RvaQZiQMlM 4jAGBRK/YmOJP0KdTMAXm+XzZlYYqSUjNgX3qSYWaUM4xAgd50Q5zRr7yIrDHRnJ2Hbk NpFK917107+V163Xm+9Ydm6qrvuYwaW727duy/7UHBEcIFjWyz4pFPfD2mb0x2uW38gf JmWg== X-Gm-Message-State: AOAM532YkO2d6eNiHyNPedIMJo/z18iaqrmtFXQJNwPXRE8d8T1LvmUs BcpKI1zGcFfhgWwejLjXe8paXuGl4+Nwlw== X-Google-Smtp-Source: ABdhPJz87QWNvko2IRU+AgRe2OkTsd6kMAambt90bk2CEQp6d/kyLP/PT/36vd6FU7tbumvFWzAF6g== X-Received: by 2002:a17:903:2d2:: with SMTP id s18mr1139085plk.56.1644391182728; Tue, 08 Feb 2022 23:19:42 -0800 (PST) Received: from localhost ([2401:fa00:1:10:a5cf:9a43:1c6d:824]) by smtp.gmail.com with UTF8SMTPSA id k16sm12562724pgh.45.2022.02.08.23.19.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Feb 2022 23:19:42 -0800 (PST) From: Han-Lin Chen To: libcamera-devel@lists.libcamera.org Date: Wed, 9 Feb 2022 15:19:17 +0800 Message-Id: <20220209071917.559993-10-hanlinchen@chromium.org> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog In-Reply-To: <20220209071917.559993-1-hanlinchen@chromium.org> References: <20220209071917.559993-1-hanlinchen@chromium.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 9/9] android: Elevate min duration to 30 FPS if it's lower within 2% X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" It's notice that Chrome Camera App filters out the resolutions which cannot achieve 30 FPS. Elevate the minimum frame duration to 30 FPS if FPS is lower within 2%. Signed-off-by: Han-Lin Chen --- src/android/camera_capabilities.cpp | 31 +++++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index 55d651f3..e10ab036 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -655,7 +655,9 @@ int CameraCapabilities::initializeStreamConfigurations() int64_t maxFrameDuration = frameDurations->second.max().get() * 1000; /* - * Cap min frame duration to 30 FPS with 1% tolerance. + * Cap min frame duration to 30 FPS with 1% tolerance, + * and elevate min frame duration to 30 FPS with 2% + * tolerance. * * 30 frames per second has been validated as the most * opportune frame rate for quality tuning, and power @@ -675,17 +677,24 @@ int CameraCapabilities::initializeStreamConfigurations() * to the in-development configuration API rework. */ int64_t minFrameDurationCap = 1e9 / 30.0; - if (minFrameDuration < minFrameDurationCap) { - float tolerance = - (minFrameDurationCap - minFrameDuration) * 100.0 / minFrameDurationCap; + float tolerance = + (minFrameDurationCap - minFrameDuration) * 100.0 / minFrameDurationCap; - /* - * If the tolerance is less than 1%, do not cap - * the frame duration. - */ - if (tolerance > 1.0) - minFrameDuration = minFrameDurationCap; - } + /* + * If the tolerance is less than 1%, do not cap + * the frame duration. + */ + if (tolerance > 1.0) + minFrameDuration = minFrameDurationCap; + + /* + * Some applications, ex: Chrome Camera App filters out + * the resolutions which cannot achieve 30 FPS. Elevate + * the minimum frame duration to 30 FPS if FPS is lower + * within 2%. + */ + if (tolerance < 0 && tolerance > -2.0) + minFrameDuration = minFrameDurationCap; streamConfigurations_.push_back({ res, androidFormat, minFrameDuration, maxFrameDuration,