| 815 | } |
| 816 | |
| 817 | void EncoderInterfaceTest::ChangeResolutionAndCheckStatistics (const SEncParamBase& sEncParamBase, |
| 818 | SEncoderStatistics* pEncoderStatistics) { |
| 819 | unsigned int uiExistingFrameCount = pEncoderStatistics->uiInputFrameCount; |
| 820 | unsigned int uiExistingIDR = pEncoderStatistics->uiIDRSentNum; |
| 821 | unsigned int uiExistingResolutionChange = pEncoderStatistics->uiResolutionChangeTimes; |
| 822 | |
| 823 | // 1, get the existing param |
| 824 | int iResult = pPtrEnc->GetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, pParamExt); |
| 825 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 826 | |
| 827 | // 2, change setting |
| 828 | unsigned int uiKnownResolutionChangeTimes = uiExistingResolutionChange; |
| 829 | bool bCheckIDR = false; |
| 830 | if (pParamExt->iPicWidth != sEncParamBase.iPicWidth || pParamExt->iPicHeight != sEncParamBase.iPicHeight) { |
| 831 | uiKnownResolutionChangeTimes += 1; |
| 832 | bCheckIDR = true; |
| 833 | } |
| 834 | pParamExt->iPicWidth = pParamExt->sSpatialLayers[0].iVideoWidth = sEncParamBase.iPicWidth; |
| 835 | pParamExt->iPicHeight = pParamExt->sSpatialLayers[0].iVideoHeight = sEncParamBase.iPicHeight; |
| 836 | pPtrEnc->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, pParamExt); |
| 837 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 838 | |
| 839 | // 3, code one frame |
| 840 | PrepareOneSrcFrame(); |
| 841 | pSrcPic->uiTimeStamp = 30 * pEncoderStatistics->uiInputFrameCount; |
| 842 | iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi); |
| 843 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 844 | iResult = pPtrEnc->GetOption (ENCODER_OPTION_GET_STATISTICS, pEncoderStatistics); |
| 845 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 846 | |
| 847 | EXPECT_EQ (pEncoderStatistics->uiInputFrameCount, uiExistingFrameCount + 1); |
| 848 | EXPECT_EQ (pEncoderStatistics->uiResolutionChangeTimes, uiKnownResolutionChangeTimes); |
| 849 | if (bCheckIDR) { |
| 850 | EXPECT_EQ (pEncoderStatistics->uiIDRSentNum, uiExistingIDR + 1); |
| 851 | } |
| 852 | |
| 853 | EXPECT_EQ (pEncoderStatistics->uiWidth, static_cast<unsigned int> (sEncParamBase.iPicWidth)); |
| 854 | EXPECT_EQ (pEncoderStatistics->uiHeight, static_cast<unsigned int> (sEncParamBase.iPicHeight)); |
| 855 | } |
| 856 | |
| 857 | |
| 858 | TEST_F (EncoderInterfaceTest, GetStatistics) { |
nothing calls this directly
no test coverage detected