ref: 2df01852524dea6e967bca320470db2525b6edc7
parent: 01fd220ef9f9c0859d02e35ec7f56cc5596dd137
parent: d6f7a07b14c81b0817f35c1edad4ebdb09519d78
author: sijchen <sijchen@cisco.com>
date: Mon Jan 19 11:36:07 EST 2015
Merge pull request #1740 from mstorsjo/fix-tests Fix issues in the ParameterSetStrategy tests
--- a/test/api/encode_decode_api_test.cpp
+++ b/test/api/encode_decode_api_test.cpp
@@ -37,6 +37,7 @@
#define MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA (6)
#define MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN (8)
+#define GET_MB_WIDTH(x) (((x) + 15)/16)
typedef struct SLost_Sim {
WelsCommon::EWelsNalUnitType eNalType;
@@ -148,11 +149,11 @@
virtual int GetRandWidth() {
- return (WELS_CLIP3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 2, MAX_WIDTH));
+ return WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 2, MAX_WIDTH);
}
virtual int GetRandHeight() {
- return (WELS_CLIP3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 2, MAX_HEIGHT));
+ return WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 2, MAX_HEIGHT);
}
protected:
@@ -2591,7 +2592,7 @@
sParam1.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
//prepare param2
memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
- while (sParam2.iPicWidth == sParam1.iPicWidth) {
+ while (GET_MB_WIDTH (sParam2.iPicWidth) == GET_MB_WIDTH (sParam1.iPicWidth)) {
sParam2.iPicWidth = GetRandWidth();
}
prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
@@ -2598,7 +2599,7 @@
sParam2.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
//prepare param3
memcpy (&sParam3, &sParam1, sizeof (SEncParamExt));
- while (sParam3.iPicHeight == sParam1.iPicHeight) {
+ while (GET_MB_WIDTH (sParam3.iPicHeight) == GET_MB_WIDTH (sParam1.iPicHeight)) {
sParam3.iPicHeight = GetRandHeight();
}
prepareParam (iSpatialLayerNum, iSliceNum, sParam3.iPicWidth, sParam3.iPicHeight, fFrameRate, &sParam3);
@@ -2682,7 +2683,7 @@
ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv;
}
-#define DEBUG_FILE_SAVE5
+//#define DEBUG_FILE_SAVE5
TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING2) {
//usage 3: 2 Params with different num_ref, encode IDR0, P1, IDR2;
//the bs will show two SPS and different PPS
@@ -2768,7 +2769,7 @@
int max_count = 65; // make it more then twice as MAX_SPS_COUNT
std::vector<int> vWidthTable;
- vWidthTable.push_back (sParam1.iPicWidth);
+ vWidthTable.push_back (GET_MB_WIDTH (sParam1.iPicWidth));
std::vector<int>::iterator vWidthTableIt;
for (int times = 0; times < max_count; times++) {
@@ -2776,9 +2777,9 @@
memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
do {
sParam2.iPicWidth = GetRandWidth();
- vWidthTableIt = std::find (vWidthTable.begin(), vWidthTable.end(), sParam2.iPicWidth);
- } while (vWidthTableIt == vWidthTable.end());
- vWidthTable.push_back (sParam2.iPicWidth);
+ vWidthTableIt = std::find (vWidthTable.begin(), vWidthTable.end(), GET_MB_WIDTH (sParam2.iPicWidth));
+ } while (vWidthTableIt != vWidthTable.end());
+ vWidthTable.push_back (GET_MB_WIDTH (sParam2.iPicWidth));
prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
sParam2.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
@@ -2889,7 +2890,7 @@
sParam1.eSpsPpsIdStrategy = SPS_PPS_LISTING;
//prepare param2
memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
- while (sParam2.iPicWidth == sParam1.iPicWidth) {
+ while (GET_MB_WIDTH (sParam2.iPicWidth) == GET_MB_WIDTH (sParam1.iPicWidth)) {
sParam2.iPicWidth = GetRandWidth();
}
prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
@@ -2948,7 +2949,7 @@
sParam1.eSpsPpsIdStrategy = SPS_PPS_LISTING;
//prepare param2
memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
- while (sParam2.iPicWidth == sParam1.iPicWidth) {
+ while (GET_MB_WIDTH (sParam2.iPicWidth) == GET_MB_WIDTH (sParam1.iPicWidth)) {
sParam2.iPicWidth = GetRandWidth();
}
prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
@@ -2955,7 +2956,8 @@
sParam2.eSpsPpsIdStrategy = SPS_PPS_LISTING;
//prepare param3
memcpy (&sParam3, &sParam1, sizeof (SEncParamExt));
- while (sParam3.iPicWidth == sParam1.iPicWidth || sParam3.iPicWidth == sParam2.iPicWidth) {
+ while (GET_MB_WIDTH (sParam3.iPicWidth) == GET_MB_WIDTH (sParam1.iPicWidth) ||
+ GET_MB_WIDTH (sParam3.iPicWidth) == GET_MB_WIDTH (sParam2.iPicWidth)) {
sParam3.iPicWidth = GetRandWidth();
}
prepareParam (iSpatialLayerNum, iSliceNum, sParam3.iPicWidth, sParam3.iPicHeight, fFrameRate, &sParam3);