Showing the changes to test/encoder/EncUT_EncoderExt.cpp (1 of 7 files). Show all
Unified · Split
| @@ -886,3 +886,72 @@ TEST_F (EncoderInterfaceTest, FrameSizeCheck) { · 885 unmodified lines | ||
| 886 | 886 | // finish |
| 887 | 887 | pPtrEnc->Uninitialize(); |
| 888 | 888 | } |
| 889 | + | |
| 890 | +TEST_F (EncoderInterfaceTest, SkipFrameCheck) { | |
| 891 | + SEncParamExt sEncParamExt; | |
| 892 | + int iResult = pPtrEnc->GetDefaultParams (&sEncParamExt); | |
| 893 | + EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | |
| 894 | + | |
| 895 | + //actual encode param: iUsageType = 0, spatial_layer_num = 1, temporal_layer_num = 3, frame_rate = 28.248587, target_bitrate = 573000, denoise =0, background_detection = 1, adaptive_quant = 1, enable_crop_pic = 1, scenechange_detection = 0, enable_long_term_reference = 0, ltr_mark_period = 30, ltr_ref_num = 0, enable_multiple_slice = 1, padding = 0, rc_mode = 1, enable_frame_skip = 1, max_bitrate = 573000, max_nalu_size = 0s | |
| 896 | + //actual encode param: spatial 0: width=360, height=640, frame_rate=28.248587, spatial_bitrate=573000, max_layer_bitrate =895839855, max_nalu_size=0, slice_mode=1,this=0x7c62ee48 | |
| 897 | + sEncParamExt.iUsageType = CAMERA_VIDEO_REAL_TIME; | |
| 898 | + sEncParamExt.iPicWidth = 360; | |
| 899 | + sEncParamExt.iPicHeight = 640; | |
| 900 | + sEncParamExt.iTargetBitrate = 573000; | |
| 901 | + sEncParamExt.iRCMode = RC_BITRATE_MODE; | |
| 902 | + sEncParamExt.fMaxFrameRate = 28.248587; | |
| 903 | + | |
| 904 | + sEncParamExt.iTemporalLayerNum = 3; | |
| 905 | + sEncParamExt.iSpatialLayerNum = 1; | |
| 906 | + sEncParamExt.bEnableLongTermReference = 0; | |
| 907 | + sEncParamExt.bEnableSceneChangeDetect = 0; | |
| 908 | + sEncParamExt.bEnableFrameSkip = 1; | |
| 909 | + sEncParamExt.iMaxBitrate = 895839855; | |
| 910 | + sEncParamExt.uiMaxNalSize = 0; | |
| 911 | + | |
| 912 | + sEncParamExt.sSpatialLayers[0].uiLevelIdc = LEVEL_5_0; | |
| 913 | + sEncParamExt.sSpatialLayers[0].iVideoWidth = 360; | |
| 914 | + sEncParamExt.sSpatialLayers[0].iVideoHeight = 640; | |
| 915 | + sEncParamExt.sSpatialLayers[0].fFrameRate = 28.248587; | |
| 916 | + sEncParamExt.sSpatialLayers[0].iSpatialBitrate = 573000; | |
| 917 | + sEncParamExt.sSpatialLayers[0].iMaxSpatialBitrate = 895839855; | |
| 918 | + sEncParamExt.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE; | |
| 919 | + | |
| 920 | + pParamExt->iPicWidth = sEncParamExt.sSpatialLayers[0].iVideoWidth; | |
| 921 | + pParamExt->iPicHeight = sEncParamExt.sSpatialLayers[0].iVideoHeight; | |
| 922 | + | |
| 923 | + iResult = pPtrEnc->InitializeExt (&sEncParamExt); | |
| 924 | + EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | |
| 925 | + if (iResult != cmResultSuccess) { | |
| 926 | + fprintf (stderr, "Unexpected sEncParamExt? \ | |
| 927 | + iUsageType=%d, Pic=%dx%d, TargetBitrate=%d, iRCMode=%d, fMaxFrameRate=%.1f\n", | |
| 928 | + sEncParamExt.iUsageType, sEncParamExt.iPicWidth, sEncParamExt.iPicHeight, | |
| 929 | + sEncParamExt.iTargetBitrate, sEncParamExt.iRCMode, sEncParamExt.fMaxFrameRate); | |
| 930 | + } | |
| 931 | + | |
| 932 | + int iInterval = 300; | |
| 933 | + iResult = pPtrEnc->SetOption (ENCODER_OPTION_STATISTICS_LOG_INTERVAL, &iInterval); | |
| 934 | + EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | |
| 935 | + | |
| 936 | + SEncoderStatistics sEncoderStatistics; | |
| 937 | + for (int i = 0; i < 50; i++) { | |
| 938 | + PrepareOneSrcFrame(); | |
| 939 | + pSrcPic->uiTimeStamp = i * 33; | |
| 940 | + iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi); | |
| 941 | + | |
| 942 | + if (i == 25) { | |
| 943 | + sEncParamExt.fMaxFrameRate = 28; | |
| 944 | + sEncParamExt.sSpatialLayers[0].fFrameRate = 28; | |
| 945 | + sEncParamExt.sSpatialLayers[0].iSpatialBitrate = 500000; | |
| 946 | + iResult = pPtrEnc->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sEncParamExt); | |
| 947 | + EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | |
| 948 | + } | |
| 949 | + | |
| 950 | + } | |
| 951 | + iResult = pPtrEnc->GetOption (ENCODER_OPTION_GET_STATISTICS, &sEncoderStatistics); | |
| 952 | + EXPECT_TRUE ((sEncoderStatistics.uiInputFrameCount - sEncoderStatistics.uiSkippedFrameCount) > 2) | |
| 953 | + << "uiInputFrameCount = " << sEncoderStatistics.uiInputFrameCount << ", uiSkippedFrameCount = " << | |
| 954 | + sEncoderStatistics.uiSkippedFrameCount; | |
| 955 | + // finish | |
| 956 | + pPtrEnc->Uninitialize(); | |
| 957 | +} | |