shithub: openh264

Download patch

ref: 1030820ec472b944126f022cd9170b3b17515969
parent: c420d724432569777b095600345a068cebc3f769
parent: ef329e33c30edfd21cda56b57c1b17e2227cadc3
author: HaiboZhu <[email protected]>
date: Mon Feb 1 04:08:05 EST 2016

Merge pull request #2342 from sijchen/enh_ut_tem

[UT] correct and enhance the ut template and trace improvement

--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -491,7 +491,7 @@
 void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) {
   WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
            "iUsageType = %d,iPicWidth= %d;iPicHeight= %d;iTargetBitrate= %d;iMaxBitrate= %d;iRCMode= %d;iPaddingFlag= %d;iTemporalLayerNum= %d;iSpatialLayerNum= %d;fFrameRate= %.6ff;uiIntraPeriod= %d;"
-           "eSpsPpsIdStrategy = %d;bPrefixNalAddingCtrl = %d;bEnableDenoise= %d;bEnableBackgroundDetection= %d;bEnableSceneChangeDetect = %d;bEnableAdaptiveQuant= %d;bEnableFrameSkip= %d;bEnableLongTermReference= %d;iLtrMarkPeriod= %d;"
+           "eSpsPpsIdStrategy = %d;bPrefixNalAddingCtrl = %d;bSimulcastAVC=%d;bEnableDenoise= %d;bEnableBackgroundDetection= %d;bEnableSceneChangeDetect = %d;bEnableAdaptiveQuant= %d;bEnableFrameSkip= %d;bEnableLongTermReference= %d;iLtrMarkPeriod= %d;"
            "iComplexityMode = %d;iNumRefFrame = %d;iEntropyCodingModeFlag = %d;uiMaxNalSize = %d;iLTRRefNum = %d;iMultipleThreadIdc = %d;iLoopFilterDisableIdc = %d (offset(alpha/beta): %d,%d;iMaxQp = %d;iMinQp = %d)",
            pParam->iUsageType,
            pParam->iPicWidth,
@@ -506,6 +506,7 @@
            pParam->uiIntraPeriod,
            pParam->eSpsPpsIdStrategy,
            pParam->bPrefixNalAddingCtrl,
+           pParam->bSimulcastAVC,
            pParam->bEnableDenoise,
            pParam->bEnableBackgroundDetection,
            pParam->bEnableSceneChangeDetect,
--- a/test/api/encode_decode_api_test.template
+++ b/test/api/encode_decode_api_test.template
@@ -21,8 +21,10 @@
   //int iEncFrameNum = $TOTAL_FRMS;
 
   //FillFirstParam
-  int rv = encoder_->InitializeExt (&param_);
-  ASSERT_TRUE (rv == cmResultSuccess);
+  int iTraceLevel = WELS_LOG_INFO;
+  int rv = encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
+  rv = encoder_->InitializeExt (&param_);
+  EXPECT_TRUE (rv == cmResultSuccess);
 
   unsigned char*  pBsBuf[MAX_SPATIAL_LAYER_NUM];
   int aLen[MAX_SPATIAL_LAYER_NUM] = {0};
@@ -45,7 +47,7 @@
     aLen[iIdx] = 0;
 
     long rv = WelsCreateDecoder (&decoder[iIdx]);
-    ASSERT_EQ (0, rv);
+    EXPECT_TRUE (0 == rv);
     EXPECT_TRUE (decoder[iIdx] != NULL);
 
     SDecodingParam decParam;
@@ -55,7 +57,7 @@
     decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
 
     rv = decoder[iIdx]->Initialize (&decParam);
-    ASSERT_EQ (0, rv);
+    EXPECT_TRUE (0 == rv);
   }
 
 
@@ -64,9 +66,15 @@
     int iLayerLen = 0;
     unsigned char* pData[3] = { NULL };
 
+	if (iFrame % 10 == 0) {
+		printf("current iFrame=%d\n", iFrame);
+	}
+
     //FillParam
 
     InitialEncDec (param_.iPicWidth, param_.iPicHeight);
+    rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &param_);
+    ASSERT_TRUE (rv == cmResultSuccess) << "SetOption Failed pParam: rv = " << rv;
     EncodeOneFrame (0);
 
     // init
@@ -93,7 +101,7 @@
       } else {
         if (layerInfo.uiLayerType == NON_VIDEO_CODING_LAYER) {
           // under SimulcastSVC, need to copy non-VCL to all layers
-          for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) {
+          for (iIdx = 0; iIdx < param_.iSpatialLayerNum; iIdx++) {
             memcpy ((pBsBuf[iIdx] + aLen[iIdx]), layerInfo.pBsBuf, iLayerLen * sizeof (unsigned char));
             aLen[iIdx] += iLayerLen;
           }
@@ -115,11 +123,11 @@
         fwrite (pBsBuf[iIdx], aLen[iIdx], 1, fEnc[iIdx]);
 #endif
         iResult = decoder[iIdx]->DecodeFrame2 (pBsBuf[iIdx], aLen[iIdx], pData, &dstBufInfo_);
-        EXPECT_TRUE (iResult == cmResultSuccess) << "iResult=" << iResult << "LayerIdx=" << iIdx;
+        EXPECT_TRUE (iResult == cmResultSuccess) << "iResult=" << iResult << " iFrame = " << iFrame << " LayerIdx=" << iIdx;
 
         iResult = decoder[iIdx]->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_);
-        EXPECT_TRUE (iResult == cmResultSuccess) << "iResult=" << iResult << "LayerIdx=" << iIdx;
-        EXPECT_EQ (dstBufInfo_.iBufferStatus, 1) << "LayerIdx=" << iIdx;
+        EXPECT_TRUE (iResult == cmResultSuccess) << "iResult=" << iResult << " iFrame = " << iFrame << " LayerIdx=" << iIdx;
+        EXPECT_EQ (dstBufInfo_.iBufferStatus, 1) << "LayerIdx=" << iIdx << " LayerLen=" << aLen[iIdx] << " iFrame = " << iFrame;
       }
     }
   }