diff options
author | Han-Lin Chen <hanlinchen@chromium.org> | 2022-04-27 23:13:34 +0800 |
---|---|---|
committer | Kieran Bingham <kieran.bingham@ideasonboard.com> | 2022-07-25 20:12:04 +0100 |
commit | 49e85fbe9c3bf59c99f7d764abc9a7294e8b5e91 (patch) | |
tree | 96d022884d8ebc387f6afa629288c4247f3d707a /src | |
parent | f32eb2689bd30b87120f9cc6bfbbc313572ff674 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/android/camera_capabilities.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index 60c02c60..64bd8dde 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -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; |