日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

CTS测试中testYuvBurst[1]项

發(fā)布時間:2023/12/20 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CTS测试中testYuvBurst[1]项 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

(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*/);}//...
  • 拿到previewSize (最大的preview size,不大于1080P),拿到stillSize (最大的YUV_420_888 Size);
  • 拿到maxPipelineDepth (REQUEST_PIPELINE_MAX_DEPTH),拿到maxSyncLatency (SYNC_MAX_LATENCY);
  • 拿到minStillFrameDuration(stillSize的OutputMinFrameDuration);
  • 分別創(chuàng)建previewBuilder 和 burstBuilder (都是TEMPLATE_PREVIEW),并為burstBuilder設(shè)置CONTROL_AE_TARGET_FPS_RANGE 、CONTROL_AE_LOCK (true)、CONTROL_AWB_LOCK (true);
  • 開始預(yù)覽(用resultListener 監(jiān)聽預(yù)覽結(jié)果),并創(chuàng)建100個burst request;
  • while循環(huán)遍歷每個resultListener 結(jié)果,并檢查其CONTROL_AE_STATE 、 CONTROL_AWB_STATE,如果aeState 是 AE_STATE_CONVERGED或者AE_STATE_FLASH_REQUIRED ,且awbState 是AWB_STATE_CONVERGED算有效幀,檢測:如果前150幀以內(nèi)都沒有檢測到有效幀,報failed;
  • lock住previewBuilder的 CONTROL_AE_LOCK 、CONTROL_AWB_LOCK 、CONTROL_AF_TRIGGER_START,重新預(yù)覽;
  • 檢測此時的sensor setting (burstExposure / burstFrameDuration / burstSensitivity 都要大于0);
  • 進行burst拍照,檢測burstResult(SENSOR_EXPOSURE_TIME和SENSOR_SENSITIVITY),并計算每一偵的frameDurations;
  • 檢測平均frameDurations是否小于等于minStillFrameDuration;
  • 簡單看一下判斷條件:

    final float FRAME_DURATION_MARGIN_FRACTION = 0.1f; //獲取的metadata當(dāng)中的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,從而導(dǎo)致frameDurations大于frameDurationBound,進而出現(xiàn)Failed項。

    (3)修改方案

    在metadata當(dāng)中修改最大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當(dāng)中的最大YUV Size的 frame duration由原來的50000000修改成66666666,按照上面的計算公式可得:
    72727504.0 < 66666666 * (1 + 0.1) = 73333332.6,進而得到frameDurations <= frameDurationBound,所以可以Pass。

    總結(jié)

    以上是生活随笔為你收集整理的CTS测试中testYuvBurst[1]项的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。