{"id":15735,"url":"https://patchwork.libcamera.org/api/patches/15735/?format=json","web_url":"https://patchwork.libcamera.org/patch/15735/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220427151334.609152-1-hanlinchen@chromium.org>","date":"2022-04-27T15:13:34","name":"[libcamera-devel,v3] android: camera_capabilities: Adjust minimum frame duration to match FPS","commit_ref":"49e85fbe9c3bf59c99f7d764abc9a7294e8b5e91","pull_url":null,"state":"accepted","archived":false,"hash":"1667d998e0adfa51a0b416a1e56d1fdba35d8a85","submitter":{"id":98,"url":"https://patchwork.libcamera.org/api/people/98/?format=json","name":"Hanlin Chen","email":"hanlinchen@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15735/mbox/","series":[{"id":3078,"url":"https://patchwork.libcamera.org/api/series/3078/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3078","date":"2022-04-27T15:13:34","name":"[libcamera-devel,v3] android: camera_capabilities: Adjust minimum frame duration to match FPS","version":3,"mbox":"https://patchwork.libcamera.org/series/3078/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15735/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15735/checks/","tags":{},"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 DE666C0F2A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 27 Apr 2022 15:13:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 947D365644;\n\tWed, 27 Apr 2022 17:13:41 +0200 (CEST)","from mail-pl1-x630.google.com (mail-pl1-x630.google.com\n\t[IPv6:2607:f8b0:4864:20::630])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8B1156042F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Apr 2022 17:13:39 +0200 (CEST)","by mail-pl1-x630.google.com with SMTP id d15so1791090pll.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 27 Apr 2022 08:13:39 -0700 (PDT)","from localhost ([2401:fa00:1:17:47e:a9de:8ea1:3876])\n\tby smtp.gmail.com with UTF8SMTPSA id\n\tw129-20020a628287000000b0050d4246fbedsm10974109pfd.187.2022.04.27.08.13.36\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tWed, 27 Apr 2022 08:13:37 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1651072421;\n\tbh=x04Oy2lJa4zSDd9yix498gcfUyOpvGniu4Be8Qijcj0=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=tKmQpoDWoS96Ml9Asld1V+eMcvPGFSttGRbkiSERvNhd9LptNZdkzVg/hrOkrVrch\n\t1BSX7EwbwbJFEg1IUz1bd7UAzAY30meXvhpCzmuspbY9i4b1wx24q2tKoxz7zAYyWN\n\tH6CBpu+S67s/FcWiH8XJ2QogMKUWx0O6rBbr5A49DvaMC/eocaeF7Typ0A3YkBxjBt\n\t+g8j0jAss4uC4NwSTt7CKLukUU3KnzBz5JMTFvMHNewScY9HtBbpTkUUZ7OAMOp/e9\n\t6JjQ2R4jp7Mgag+cHBg7Sr1KWssCB5184qjKYGQWsFZ/mSZ2Z8cDHFLtz25Quln36d\n\tHf0+149TYRWYw==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=9VhyuVoXH34kHBRgKw31YttWLfoy5j7qpx42uBmZMH8=;\n\tb=hnw6TWW8ebnxjbAuBsNq9/rmZRqj4DEIZV3KjmsI3jHIDQaeTVWw7Qe9m5WH4ha669\n\t0cXpehFxjJyPcNgHb5UGlYfXlkUPdIetvQkf6P70GrlTI5s/DhNNaT1fW31kMaAUx8y3\n\tJnQ/AFM8zugZnMvI/FxX4xuGPMv4wAwb40NN0="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"hnw6TWW8\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=9VhyuVoXH34kHBRgKw31YttWLfoy5j7qpx42uBmZMH8=;\n\tb=PJ1dqgyqmGrUEqn5cjQ/hLK5R/coBEE2FmC6vls+1uhtFllxgRoM5UANa9lUb0bDYA\n\tz1wEg5+Q9zImM5kO1p1goqMrJjS603x4MT2RKIzZfMaMLSVQZD8oMSpwZE7J/BblSxxg\n\t6P3fuhozU1eLspq4blnlgQ6ZrpYip6wDvf4CkM/PzJbTRskrvPdE0uP6mhigmG/SsmVQ\n\ttjKJSA2xFv0VNSEwfSnGrzCNad/eYr5YG0n1oePurvV838mGFB+kF64Gy3gcvws8WYRx\n\tKopRf1m6x4nEWqKh0HuolVPjbwUggKorCoE8DBcrdZuL+TWJF4NIr/ik+kgvOVRAhNFp\n\tXGVQ==","X-Gm-Message-State":"AOAM5318g4Z8RfZx7r/Ee9tRK38kLu2MEDrMvJDYtzWOlvoSaH5rrJpv\n\t7DREKDeEI4+qVCrLsryg2G4iFGOTnkN6cA==","X-Google-Smtp-Source":"ABdhPJxUM3zZX9HCdRpzOILiyXsJKppC6igW4Uq1BFvs+VLUtSe9V30Itnv+6x9yWbUyMVEN7AT+Ww==","X-Received":"by 2002:a17:90b:3949:b0:1d9:8717:9129 with SMTP id\n\toe9-20020a17090b394900b001d987179129mr15489317pjb.213.1651072417944; \n\tWed, 27 Apr 2022 08:13:37 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 27 Apr 2022 23:13:34 +0800","Message-Id":"<20220427151334.609152-1-hanlinchen@chromium.org>","X-Mailer":"git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3] android: camera_capabilities: Adjust\n\tminimum frame duration to match FPS","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>","From":"Han-Lin Chen via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Han-Lin Chen <hanlinchen@chromium.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"CTS calculates FPS with a rounding formula: See\nCamera2SurfaceViewTestCase.java:getSuitableFpsRangeForDuration()\n\nfps = floor(1e9 / minFrameDuration + 0.05f)\n\nThe android adapter reports it as the AE target FPS. The patch adjusts the\nreported minimum frame duration to match the reported FPS.\n\nSigned-off-by: Han-Lin Chen <hanlinchen@chromium.org>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n src/android/camera_capabilities.cpp | 16 +++++++++++-----\n 1 file changed, 11 insertions(+), 5 deletions(-)","diff":"diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp\nindex 55d651f3..ee17cdc7 100644\n--- a/src/android/camera_capabilities.cpp\n+++ b/src/android/camera_capabilities.cpp\n@@ -687,6 +687,14 @@ int CameraCapabilities::initializeStreamConfigurations()\n \t\t\t\t\tminFrameDuration = minFrameDurationCap;\n \t\t\t}\n \n+\t\t\t/*\n+\t\t\t * Calculate FPS as CTS does and adjust the minimum\n+\t\t\t * frame duration accordingly: see\n+\t\t\t * Camera2SurfaceViewTestCase.java:getSuitableFpsRangeForDuration()\n+\t\t\t */\n+\t\t\tminFrameDuration =\n+\t\t\t\t1e9 / static_cast<unsigned int>(floor(1e9 / minFrameDuration + 0.05f));\n+\n \t\t\tstreamConfigurations_.push_back({\n \t\t\t\tres, androidFormat, minFrameDuration, maxFrameDuration,\n \t\t\t});\n@@ -1287,12 +1295,10 @@ int CameraCapabilities::initializeStaticMetadata()\n \t\t * recording profile. Inspecting the Intel IPU3 HAL\n \t\t * implementation confirms this but no reference has been found\n \t\t * in the metadata documentation.\n-\t\t *\n-\t\t * Calculate FPS as CTS does: see\n-\t\t * Camera2SurfaceViewTestCase.java:getSuitableFpsRangeForDuration()\n \t\t */\n-\t\tunsigned int fps = static_cast<unsigned int>\n-\t\t\t\t   (floor(1e9 / entry.minFrameDurationNsec + 0.05f));\n+\t\tunsigned int fps =\n+\t\t\tstatic_cast<unsigned int>(floor(1e9 / entry.minFrameDurationNsec));\n+\n \t\tif (entry.androidFormat != HAL_PIXEL_FORMAT_BLOB && fps < 30)\n \t\t\tcontinue;\n \n","prefixes":["libcamera-devel","v3"]}