Showing the changes to test/encoder/EncUT_EncoderExt.cpp (1 of 6 files). Show all
Unified · Split
| @@ -770,3 +770,31 @@ TEST_F (EncoderInterfaceTest, GetStatistics) { · 769 unmodified lines | ||
| 770 | 770 | // finish |
| 771 | 771 | pPtrEnc->Uninitialize(); |
| 772 | 772 | } |
| 773 | + | |
| 774 | +TEST_F (EncoderInterfaceTest, FrameSizeCheck) { | |
| 775 | + SEncParamBase sEncParamBase; | |
| 776 | + GetValidEncParamBase (&sEncParamBase); | |
| 777 | + | |
| 778 | + int iResult = pPtrEnc->Initialize (&sEncParamBase); | |
| 779 | + EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | |
| 780 | + if (iResult != cmResultSuccess) { | |
| 781 | + fprintf (stderr, "Unexpected ParamBase? \ | |
| 782 | + iUsageType=%d, Pic=%dx%d, TargetBitrate=%d, iRCMode=%d, fMaxFrameRate=%.1f\n", | |
| 783 | + sEncParamBase.iUsageType, sEncParamBase.iPicWidth, sEncParamBase.iPicHeight, | |
| 784 | + sEncParamBase.iTargetBitrate, sEncParamBase.iRCMode, sEncParamBase.fMaxFrameRate); | |
| 785 | + } | |
| 786 | + | |
| 787 | + PrepareOneSrcFrame(); | |
| 788 | + iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi); | |
| 789 | + | |
| 790 | + uint32_t length = 0; | |
| 791 | + for (int i = 0; i < sFbi.iLayerNum; ++i) { | |
| 792 | + for (int j = 0; j < sFbi.sLayerInfo[i].iNalCount; ++j) { | |
| 793 | + length += sFbi.sLayerInfo[i].pNalLengthInByte[j]; | |
| 794 | + } | |
| 795 | + } | |
| 796 | + EXPECT_EQ (length, sFbi.iFrameSizeInBytes); | |
| 797 | + | |
| 798 | + // finish | |
| 799 | + pPtrEnc->Uninitialize(); | |
| 800 | +} | |