Showing the changes to test/api/encode_decode_api_test.cpp (1 of 4 files). Show all
Unified · Split
| @@ -3030,8 +3030,7 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_PPS_LISTING3) { · 3029 unmodified lines | |||
| 3030 | 3030 | ||
| 3031 | 3031 | ||
| 3032 | TEST_F (EncodeDecodeTestAPI, SimulcastSVC) { | 3032 | TEST_F (EncodeDecodeTestAPI, SimulcastSVC) { |
| 3033 | #define LAYER_NUM (4) | 3033 | int iSpatialLayerNum = WelsClip3 ((rand() % MAX_SPATIAL_LAYER_NUM), 2, MAX_SPATIAL_LAYER_NUM); |
| 3034 | int iSpatialLayerNum = WelsClip3 ((rand() % LAYER_NUM), 2, LAYER_NUM); | ||
| 3035 | int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_WIDTH); | 3034 | int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_WIDTH); |
| 3036 | int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_HEIGHT); | 3035 | int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_HEIGHT); |
| 3037 | float fFrameRate = rand() + 0.5f; | 3036 | float fFrameRate = rand() + 0.5f; |
| @@ -3043,12 +3042,12 @@ TEST_F (EncodeDecodeTestAPI, SimulcastSVC) { · 5 unmodified lines | |||
| 3043 | int rv = encoder_->InitializeExt (¶m_); | 3042 | int rv = encoder_->InitializeExt (¶m_); |
| 3044 | ASSERT_TRUE (rv == cmResultSuccess); | 3043 | ASSERT_TRUE (rv == cmResultSuccess); |
| 3045 | 3044 | ||
| 3046 | unsigned char* pBsBuf[LAYER_NUM]; | 3045 | unsigned char* pBsBuf[MAX_SPATIAL_LAYER_NUM]; |
| 3047 | int aLen[LAYER_NUM] = {0}; | 3046 | int aLen[MAX_SPATIAL_LAYER_NUM] = {0}; |
| 3048 | ISVCDecoder* decoder[LAYER_NUM]; | 3047 | ISVCDecoder* decoder[MAX_SPATIAL_LAYER_NUM]; |
| 3049 | 3048 | ||
| 3050 | #ifdef DEBUG_FILE_SAVE2 | 3049 | #ifdef DEBUG_FILE_SAVE2 |
| 3051 | FILE* fEnc[LAYER_NUM] = { NULL }; | 3050 | FILE* fEnc[MAX_SPATIAL_LAYER_NUM] = { NULL }; |
| 3052 | fEnc[0] = fopen ("enc0.264", "wb"); | 3051 | fEnc[0] = fopen ("enc0.264", "wb"); |
| 3053 | fEnc[1] = fopen ("enc1.264", "wb"); | 3052 | fEnc[1] = fopen ("enc1.264", "wb"); |
| 3054 | fEnc[2] = fopen ("enc2.264", "wb"); | 3053 | fEnc[2] = fopen ("enc2.264", "wb"); |
| @@ -3059,11 +3058,12 @@ TEST_F (EncodeDecodeTestAPI, SimulcastSVC) { · 4 unmodified lines | |||
| 3059 | int iIdx = 0; | 3058 | int iIdx = 0; |
| 3060 | for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) { | 3059 | for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) { |
| 3061 | pBsBuf[iIdx] = static_cast<unsigned char*> (malloc (iWidth * iHeight * 3 * sizeof (unsigned char) / 2)); | 3060 | pBsBuf[iIdx] = static_cast<unsigned char*> (malloc (iWidth * iHeight * 3 * sizeof (unsigned char) / 2)); |
| 3061 | EXPECT_TRUE (pBsBuf[iIdx] != NULL); | ||
| 3062 | aLen[iIdx] = 0; | 3062 | aLen[iIdx] = 0; |
| 3063 | 3063 | ||
| 3064 | long rv = WelsCreateDecoder (&decoder[iIdx]); | 3064 | long rv = WelsCreateDecoder (&decoder[iIdx]); |
| 3065 | ASSERT_EQ (0, rv); | 3065 | ASSERT_EQ (0, rv); |
| 3066 | ASSERT_TRUE (decoder[iIdx] != NULL); | 3066 | EXPECT_TRUE (decoder[iIdx] != NULL); |
| 3067 | 3067 | ||
| 3068 | SDecodingParam decParam; | 3068 | SDecodingParam decParam; |
| 3069 | memset (&decParam, 0, sizeof (SDecodingParam)); | 3069 | memset (&decParam, 0, sizeof (SDecodingParam)); |
| @@ -3144,8 +3144,7 @@ TEST_F (EncodeDecodeTestAPI, SimulcastSVC) { · 74 unmodified lines | |||
| 3144 | 3144 | ||
| 3145 | TEST_F (EncodeDecodeTestAPI, SimulcastAVC) { | 3145 | TEST_F (EncodeDecodeTestAPI, SimulcastAVC) { |
| 3146 | //#define DEBUG_FILE_SAVE3 | 3146 | //#define DEBUG_FILE_SAVE3 |
| 3147 | #define LAYER_NUM (4) | 3147 | int iSpatialLayerNum = WelsClip3 ((rand() % MAX_SPATIAL_LAYER_NUM), 2, MAX_SPATIAL_LAYER_NUM); |
| 3148 | int iSpatialLayerNum = WelsClip3 ((rand() % LAYER_NUM), 2, LAYER_NUM); | ||
| 3149 | int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_WIDTH); | 3148 | int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_WIDTH); |
| 3150 | int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_HEIGHT); | 3149 | int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_HEIGHT); |
| 3151 | float fFrameRate = rand() + 0.5f; | 3150 | float fFrameRate = rand() + 0.5f; |
| @@ -3160,12 +3159,12 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVC) { · 8 unmodified lines | |||
| 3160 | int rv = encoder_->InitializeExt (¶m_); | 3159 | int rv = encoder_->InitializeExt (¶m_); |
| 3161 | ASSERT_TRUE (rv == cmResultSuccess); | 3160 | ASSERT_TRUE (rv == cmResultSuccess); |
| 3162 | 3161 | ||
| 3163 | unsigned char* pBsBuf[LAYER_NUM]; | 3162 | unsigned char* pBsBuf[MAX_SPATIAL_LAYER_NUM]; |
| 3164 | int aLen[LAYER_NUM] = {0}; | 3163 | int aLen[MAX_SPATIAL_LAYER_NUM] = {0}; |
| 3165 | ISVCDecoder* decoder[LAYER_NUM]; | 3164 | ISVCDecoder* decoder[MAX_SPATIAL_LAYER_NUM]; |
| 3166 | 3165 | ||
| 3167 | #ifdef DEBUG_FILE_SAVE3 | 3166 | #ifdef DEBUG_FILE_SAVE3 |
| 3168 | FILE* fEnc[LAYER_NUM]; | 3167 | FILE* fEnc[MAX_SPATIAL_LAYER_NUM]; |
| 3169 | fEnc[0] = fopen ("enc0.264", "wb"); | 3168 | fEnc[0] = fopen ("enc0.264", "wb"); |
| 3170 | fEnc[1] = fopen ("enc1.264", "wb"); | 3169 | fEnc[1] = fopen ("enc1.264", "wb"); |
| 3171 | fEnc[2] = fopen ("enc2.264", "wb"); | 3170 | fEnc[2] = fopen ("enc2.264", "wb"); |
| @@ -3177,11 +3176,12 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVC) { · 5 unmodified lines | |||
| 3177 | //create decoder | 3176 | //create decoder |
| 3178 | for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) { | 3177 | for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) { |
| 3179 | pBsBuf[iIdx] = static_cast<unsigned char*> (malloc (iWidth * iHeight * 3 * sizeof (unsigned char) / 2)); | 3178 | pBsBuf[iIdx] = static_cast<unsigned char*> (malloc (iWidth * iHeight * 3 * sizeof (unsigned char) / 2)); |
| 3179 | EXPECT_TRUE (pBsBuf[iIdx] != NULL); | ||
| 3180 | aLen[iIdx] = 0; | 3180 | aLen[iIdx] = 0; |
| 3181 | 3181 | ||
| 3182 | long rv = WelsCreateDecoder (&decoder[iIdx]); | 3182 | long rv = WelsCreateDecoder (&decoder[iIdx]); |
| 3183 | ASSERT_EQ (0, rv); | 3183 | ASSERT_EQ (0, rv); |
| 3184 | ASSERT_TRUE (decoder[iIdx] != NULL); | 3184 | EXPECT_TRUE (decoder[iIdx] != NULL); |
| 3185 | 3185 | ||
| 3186 | SDecodingParam decParam; | 3186 | SDecodingParam decParam; |
| 3187 | memset (&decParam, 0, sizeof (SDecodingParam)); | 3187 | memset (&decParam, 0, sizeof (SDecodingParam)); |