am 28c53c62: Merge "DO NOT MERGE: Camera: move YUV burst framerate check from ITS to CTS" into lmp-mr1-dev
* commit '28c53c620ac2042d3dd13c76203af937ed16e098':
DO NOT MERGE: Camera: move YUV burst framerate check from ITS to CTS
diff --git a/apps/CameraITS/tests/scene1/test_locked_burst.py b/apps/CameraITS/tests/scene1/test_locked_burst.py
index 90662db..8d7aa94 100644
--- a/apps/CameraITS/tests/scene1/test_locked_burst.py
+++ b/apps/CameraITS/tests/scene1/test_locked_burst.py
@@ -25,8 +25,8 @@
"""Test 3A lock + YUV burst (using auto settings).
This is a test that is designed to pass even on limited devices that
- don't have MANUAL_SENSOR or PER_FRAME_CONTROLS. (They must be able to
- capture bursts with full res @ full frame rate to pass, however).
+ don't have MANUAL_SENSOR or PER_FRAME_CONTROLS. The test checks
+ YUV image consistency while the frame rate check is in CTS.
"""
NAME = os.path.basename(__file__).split(".")[0]
@@ -67,26 +67,6 @@
" (min/max: ", min(means), "/", max(means), ")"
assert(spread < SPREAD_THRESH)
- # Also ensure that the burst was at full frame rate.
- fmt_code = 0x23
- configs = props['android.scaler.streamConfigurationMap']\
- ['availableStreamConfigurations']
- min_duration = None
- for cfg in configs:
- if cfg['format'] == fmt_code and cfg['input'] == False and \
- cfg['width'] == caps[0]["width"] and \
- cfg['height'] == caps[0]["height"]:
- min_duration = cfg["minFrameDuration"]
- assert(min_duration is not None)
- tstamps = [c['metadata']['android.sensor.timestamp'] for c in caps]
- deltas = [tstamps[i]-tstamps[i-1] for i in range(1,len(tstamps))]
- actual_fps = 1.0 / (max(deltas) / 1000000000.0)
- actual_fps_max = 1.0 / (min(deltas) / 1000000000.0)
- max_fps = 1.0 / (min_duration / 1000000000.0)
- print "Measure FPS min/max", actual_fps, "/", actual_fps_max
- print "FPS measured %.1f, max advertized %.1f" %(actual_fps, max_fps)
- assert(max_fps - FPS_MAX_DIFF <= actual_fps <= max_fps + FPS_MAX_DIFF)
-
if __name__ == '__main__':
main()
diff --git a/tests/tests/hardware/src/android/hardware/camera2/cts/BurstCaptureTest.java b/tests/tests/hardware/src/android/hardware/camera2/cts/BurstCaptureTest.java
index fa5b606..5d0841e 100644
--- a/tests/tests/hardware/src/android/hardware/camera2/cts/BurstCaptureTest.java
+++ b/tests/tests/hardware/src/android/hardware/camera2/cts/BurstCaptureTest.java
@@ -23,10 +23,8 @@
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.CaptureResult;
import android.hardware.camera2.CameraCharacteristics;
-import android.hardware.camera2.cts.helpers.StaticMetadata;
import android.hardware.camera2.cts.testcases.Camera2SurfaceViewTestCase;
import android.hardware.camera2.params.StreamConfigurationMap;
-import android.media.Image;
import android.util.Log;
import android.util.Range;
import android.util.Size;
@@ -40,7 +38,7 @@
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
/**
- * Test BURST_CAPTURE capability with full-AUTO capture.
+ * Test YUV burst capture with full-AUTO control.
* Also verifies sensor settings operation if READ_SENSOR_SETTINGS is available.
*/
public void testYuvBurst() throws Exception {
@@ -49,10 +47,9 @@
String id = mCameraIds[i];
Log.i(TAG, "Testing YUV Burst for camera " + id);
openDevice(id);
- if (!mStaticInfo.isCapabilitySupported(
- CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE)) {
- Log.i(TAG, "BURST_CAPTURE capability is not supported in camera " + id +
- ". Skip the test");
+
+ if (mStaticInfo.isHardwareLevelLegacy()) {
+ Log.i(TAG, "Skip burst test on legacy devices.");
continue;
}
@@ -64,7 +61,7 @@
}
}
- public void yuvBurstTestByCamera(String cameraId) throws Exception {
+ private void yuvBurstTestByCamera(String cameraId) throws Exception {
// Parameters
final int MAX_CONVERGENCE_FRAMES = 150; // 5 sec at 30fps
final long MAX_PREVIEW_RESULT_TIMEOUT_MS = 1000;
@@ -83,10 +80,6 @@
final int maxSyncLatency = mStaticInfo.getCharacteristics().get(
CameraCharacteristics.SYNC_MAX_LATENCY);
- assertTrue("Cam " + cameraId + ": maxSyncLatency is UNKNOWN;" +
- " not allowed for BURST_CAPTURE capability",
- maxSyncLatency >= 0);
-
// Find minimum frame duration for full-res YUV_420_888
StreamConfigurationMap config = mStaticInfo.getCharacteristics().get(
CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
@@ -137,13 +130,13 @@
// Create session and start up preview
SimpleCaptureCallback resultListener = new SimpleCaptureCallback();
- SimpleImageReaderListener imageListener = new SimpleImageReaderListener();
+ ImageDropperListener imageDropper = new ImageDropperListener();
prepareCaptureAndStartPreview(
previewBuilder, burstBuilder,
previewSize, stillSize,
ImageFormat.YUV_420_888, resultListener,
- /*maxNumImages*/ 3, imageListener);
+ /*maxNumImages*/ 3, imageDropper);
// Create burst
@@ -234,8 +227,13 @@
// Calculate how many requests we need to still send down to camera before we
// know the settings have settled for the burst
- int requestsNeededToSync = maxSyncLatency - pipelineDepth;
- for (int i = 0; i < maxSyncLatency; i++) {
+ int numFramesWaited = maxSyncLatency;
+ if (numFramesWaited == CameraCharacteristics.SYNC_MAX_LATENCY_UNKNOWN) {
+ numFramesWaited = NUM_FRAMES_WAITED_FOR_UNKNOWN_LATENCY;
+ }
+
+ int requestsNeededToSync = numFramesWaited - pipelineDepth;
+ for (int i = 0; i < numFramesWaited; i++) {
if (!burstSent && requestsNeededToSync <= 0) {
mSession.captureBurst(burst, resultListener, mHandler);
burstSent = true;
@@ -272,13 +270,6 @@
burstSensitivity > 0);
}
- // Process burst images
- for (int i = 0; i < BURST_SIZE; i++) {
- Image img = imageListener.getImage(CAPTURE_IMAGE_TIMEOUT_MS);
-
- img.close();
- }
-
// Process burst results
int burstIndex = 0;
CaptureResult burstResult =