android: camera_capabilities: Adjust minimum frame duration to match FPS

CTS calculates FPS with a rounding formula: See
Camera2SurfaceViewTestCase.java:getSuitableFpsRangeForDuration()

fps = floor(1e9 / minFrameDuration + 0.05f)

The android adapter reports it as the AE target FPS. The patch adjusts the
reported minimum frame duration to match the reported FPS.

Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Han-Lin Chen 2022-04-27 23:13:34 +08:00 committed by Kieran Bingham
parent f32eb2689b
commit 49e85fbe9c

View file

@ -694,6 +694,14 @@ int CameraCapabilities::initializeStreamConfigurations()
minFrameDuration = minFrameDurationCap;
}
/*
* Calculate FPS as CTS does and adjust the minimum
* frame duration accordingly: see
* Camera2SurfaceViewTestCase.java:getSuitableFpsRangeForDuration()
*/
minFrameDuration =
1e9 / static_cast<unsigned int>(floor(1e9 / minFrameDuration + 0.05f));
streamConfigurations_.push_back({
res, androidFormat, minFrameDuration, maxFrameDuration,
});
@ -1293,12 +1301,10 @@ int CameraCapabilities::initializeStaticMetadata()
* recording profile. Inspecting the Intel IPU3 HAL
* implementation confirms this but no reference has been found
* in the metadata documentation.
*
* Calculate FPS as CTS does: see
* Camera2SurfaceViewTestCase.java:getSuitableFpsRangeForDuration()
*/
unsigned int fps = static_cast<unsigned int>
(floor(1e9 / entry.minFrameDurationNsec + 0.05f));
unsigned int fps =
static_cast<unsigned int>(floor(1e9 / entry.minFrameDurationNsec));
if (entry.androidFormat != HAL_PIXEL_FORMAT_BLOB && fps < 30)
continue;