Showing the changes to test/api/encode_decode_api_test.cpp (1 of 10 files). Show all
Unified · Split
| @@ -1032,6 +1032,53 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECFlag_ERROR_CON_SLICE_COPY) { · 1031 unmodified lines | ||
| 1032 | 1032 | (void) iSkipedBytes; |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | +TEST_P (EncodeDecodeTestAPI, InOutTimeStamp) { | |
| 1036 | + EncodeDecodeFileParamBase p = GetParam(); | |
| 1037 | + prepareParam (1, p.slicenum, p.width, p.height, p.frameRate); | |
| 1038 | + encoder_->Uninitialize(); | |
| 1039 | + int rv = encoder_->InitializeExt (¶m_); | |
| 1040 | + ASSERT_TRUE (rv == cmResultSuccess); | |
| 1041 | + | |
| 1042 | + InitialEncDec (p.width, p.height); | |
| 1043 | + int32_t iTraceLevel = WELS_LOG_QUIET; | |
| 1044 | + encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel); | |
| 1045 | + decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel); | |
| 1046 | + int32_t iSpsPpsIdAddition = 1; | |
| 1047 | + encoder_->SetOption (ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, &iSpsPpsIdAddition); | |
| 1048 | + int32_t iIDRPeriod = 60; | |
| 1049 | + encoder_->SetOption (ENCODER_OPTION_IDR_INTERVAL, &iIDRPeriod); | |
| 1050 | + SLTRConfig sLtrConfigVal; | |
| 1051 | + sLtrConfigVal.bEnableLongTermReference = 1; | |
| 1052 | + sLtrConfigVal.iLTRRefNum = 1; | |
| 1053 | + encoder_->SetOption (ENCODER_OPTION_LTR, &sLtrConfigVal); | |
| 1054 | + int32_t iLtrPeriod = 2; | |
| 1055 | + encoder_->SetOption (ENCODER_LTR_MARKING_PERIOD, &iLtrPeriod); | |
| 1056 | + int iIdx = 0; | |
| 1057 | + int iSkipedBytes; | |
| 1058 | + unsigned long long uiEncTimeStamp = 100; | |
| 1059 | + while (iIdx <= p.numframes) { | |
| 1060 | + EncodeOneFrame (1); | |
| 1061 | + //decoding after each encoding frame | |
| 1062 | + int len = 0; | |
| 1063 | + encToDecData (info, len); | |
| 1064 | + unsigned char* pData[3] = { NULL }; | |
| 1065 | + memset (&dstBufInfo_, 0, sizeof (SBufferInfo)); | |
| 1066 | + uint32_t uiEcIdc = ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE; | |
| 1067 | + decoder_->SetOption (DECODER_OPTION_ERROR_CON_IDC, &uiEcIdc); | |
| 1068 | + dstBufInfo_.uiInBsTimeStamp = uiEncTimeStamp; | |
| 1069 | + rv = decoder_->DecodeFrame2 (info.sLayerInfo[0].pBsBuf, len, pData, &dstBufInfo_); | |
| 1070 | + memset (&dstBufInfo_, 0, sizeof (SBufferInfo)); | |
| 1071 | + dstBufInfo_.uiInBsTimeStamp = uiEncTimeStamp; | |
| 1072 | + rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //reconstruction | |
| 1073 | + if(dstBufInfo_.iBufferStatus == 1) { | |
| 1074 | + EXPECT_EQ (uiEncTimeStamp, dstBufInfo_.uiOutYuvTimeStamp); | |
| 1075 | + } | |
| 1076 | + iIdx++; | |
| 1077 | + uiEncTimeStamp++; | |
| 1078 | + } | |
| 1079 | + (void) iSkipedBytes; | |
| 1080 | +} | |
| 1081 | + | |
| 1035 | 1082 | TEST_P (EncodeDecodeTestAPI, GetOptionTid_AVC_NOPREFIX) { |
| 1036 | 1083 | SLTRMarkingFeedback m_LTR_Marking_Feedback; |
| 1037 | 1084 | SLTRRecoverRequest m_LTR_Recover_Request; |