CTS测试中testYuvBurst[1]项
生活随笔
收集整理的這篇文章主要介紹了
CTS测试中testYuvBurst[1]项
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
(1)源碼分析
//cts/tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java/*** Test YUV burst capture with full-AUTO control.* Also verifies sensor settings operation if READ_SENSOR_SETTINGS is available.*/@Testpublic void testYuvBurst() throws Exception {final int YUV_BURST_SIZE = 100;testBurst(ImageFormat.YUV_420_888, YUV_BURST_SIZE, true/*checkFrameRate*/,false/*testStillBokeh*/);}/*** Test JPEG burst capture with full-AUTO control.** Also verifies sensor settings operation if READ_SENSOR_SETTINGS is available.* Compared to testYuvBurst, this test uses STILL_CAPTURE intent, and exercises path where* enableZsl is enabled.*/@Testpublic void testJpegBurst() throws Exception {final int JPEG_BURST_SIZE = 10;testBurst(ImageFormat.JPEG, JPEG_BURST_SIZE, false/*checkFrameRate*/,false/*testStillBokeh*/);}/*** Test YUV burst capture with full-AUTO control and STILL_CAPTURE bokeh mode.* Also verifies sensor settings operation if READ_SENSOR_SETTINGS is available.*/@Testpublic void testYuvBurstWithStillBokeh() throws Exception {final int YUV_BURST_SIZE = 100;testBurst(ImageFormat.YUV_420_888, YUV_BURST_SIZE, true/*checkFrameRate*/,true/*testStillBokeh*/);}//...簡單看一下判斷條件:
final float FRAME_DURATION_MARGIN_FRACTION = 0.1f; //獲取的metadata當中的frame duration final long minStillFrameDuration = config.getOutputMinFrameDuration(fmt, stillSize);//計算出frameDurationBound final long frameDurationBound = (long) (minStillFrameDuration * (1 + FRAME_DURATION_MARGIN_FRACTION) );//計算出平均frameDurations float meanFrameDuration = (float) meanFrameSum / frameDurations.size();//判斷平均frameDurations是否小于frameDurationBound assertTrue(String.format("Cam %s: Burst frame duration mean %.1f ns is larger than " +"acceptable, expecting below %d ns, allowing below %d", cameraId,meanFrameDuration, minStillFrameDuration, frameDurationBound),meanFrameDuration <= frameDurationBound);(2)Failed Demo
03-10 09:39:52.590 19601 19630 E TestRunner: failed: testYuvBurst[1](android.hardware.camera2.cts.BurstCaptureTest) 03-10 09:39:52.590 19601 19630 E TestRunner: ----- begin exception ----- 03-10 09:39:52.591 19601 19630 E TestRunner: junit.framework.AssertionFailedError: Cam 0: Burst frame duration mean 72727504.0 ns is larger than acceptable, expecting below 50000000 ns, allowing below 55000000 03-10 09:39:52.591 19601 19630 E TestRunner: at junit.framework.Assert.fail(Assert.java:50) 03-10 09:39:52.591 19601 19630 E TestRunner: at junit.framework.Assert.assertTrue(Assert.java:20) 03-10 09:39:52.591 19601 19630 E TestRunner: at android.hardware.camera2.cts.BurstCaptureTest.burstTestByCamera(BurstCaptureTest.java:417) 03-10 09:39:52.591 19601 19630 E TestRunner: at android.hardware.camera2.cts.BurstCaptureTest.testBurst(BurstCaptureTest.java:123) 03-10 09:39:52.591 19601 19630 E TestRunner: at android.hardware.camera2.cts.BurstCaptureTest.testYuvBurst(BurstCaptureTest.java:56)可以看到實際的平均frameDurations = 72727504.0,而frameDurationBound = 50000000 * (1 + 0.1) = 55000000,從而導致frameDurations大于frameDurationBound,進而出現Failed項。
(3)修改方案
在metadata當中修改最大YUV_420_888 Size的frame duration。
CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_BLOB, MINT64) //13mp 4:3CONFIG_ENTRY_VALUE(4160, MINT64) // widthCONFIG_ENTRY_VALUE(3120, MINT64) // heightCONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT64) // output//CONFIG_ENTRY_VALUE(50000000, MINT64) // frame durationCONFIG_ENTRY_VALUE(66666666, MINT64) // frame durationCONFIG_ENTRY_VALUE(33333333, MINT64) // stall duration將metadata當中的最大YUV Size的 frame duration由原來的50000000修改成66666666,按照上面的計算公式可得:
72727504.0 < 66666666 * (1 + 0.1) = 73333332.6,進而得到frameDurations <= frameDurationBound,所以可以Pass。
總結
以上是生活随笔為你收集整理的CTS测试中testYuvBurst[1]项的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android 对短信的操作(伪造信息)
- 下一篇: Python读取中文Excel问题解决