History

Compare macro block widths instead of picture widths

Since cropping is disabled (prepareParam does memset (pParam, 0, sizeof (SEncParamExt)); which clears the cropping flag), we need to make sure that the number of macroblocks differ, not only the number of pixels.

Martin Storsjö committed 11 years ago

Commit fcae7fd1 parent 58f1fef1 file · +10 −8Browse files

Showing the changes to test/api/encode_decode_api_test.cpp (1 of 1 file). Show all

Unified · Split

test/api/encode_decode_api_test.cpp+10−8
@@ -37,6 +37,7 @@ using namespace WelsCommon; · 36 unmodified lines
3737 #define MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA (6)
3838 #define MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN (8)
3939
40+#define GET_MB_WIDTH(x) (((x) + 15)/16)
4041
4142 typedef struct SLost_Sim {
4243 WelsCommon::EWelsNalUnitType eNalType;
@@ -2591,14 +2592,14 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING · 2548 unmodified lines
25912592 sParam1.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
25922593 //prepare param2
25932594 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2594− while (sParam2.iPicWidth == sParam1.iPicWidth) {
2595+ while (GET_MB_WIDTH (sParam2.iPicWidth) == GET_MB_WIDTH (sParam1.iPicWidth)) {
25952596 sParam2.iPicWidth = GetRandWidth();
25962597 }
25972598 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
25982599 sParam2.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
25992600 //prepare param3
26002601 memcpy (&sParam3, &sParam1, sizeof (SEncParamExt));
2601− while (sParam3.iPicHeight == sParam1.iPicHeight) {
2602+ while (GET_MB_WIDTH (sParam3.iPicHeight) == GET_MB_WIDTH (sParam1.iPicHeight)) {
26022603 sParam3.iPicHeight = GetRandHeight();
26032604 }
26042605 prepareParam (iSpatialLayerNum, iSliceNum, sParam3.iPicWidth, sParam3.iPicHeight, fFrameRate, &sParam3);
@@ -2768,7 +2769,7 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING · 163 unmodified lines
27682769
27692770 int max_count = 65; // make it more then twice as MAX_SPS_COUNT
27702771 std::vector<int> vWidthTable;
2771− vWidthTable.push_back (sParam1.iPicWidth);
2772+ vWidthTable.push_back (GET_MB_WIDTH (sParam1.iPicWidth));
27722773
27732774 std::vector<int>::iterator vWidthTableIt;
27742775 for (int times = 0; times < max_count; times++) {
@@ -2776,9 +2777,9 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING · 1 unmodified line
27762777 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
27772778 do {
27782779 sParam2.iPicWidth = GetRandWidth();
2779− vWidthTableIt = std::find (vWidthTable.begin(), vWidthTable.end(), sParam2.iPicWidth);
2780+ vWidthTableIt = std::find (vWidthTable.begin(), vWidthTable.end(), GET_MB_WIDTH (sParam2.iPicWidth));
27802781 } while (vWidthTableIt != vWidthTable.end());
2781− vWidthTable.push_back (sParam2.iPicWidth);
2782+ vWidthTable.push_back (GET_MB_WIDTH (sParam2.iPicWidth));
27822783 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
27832784 sParam2.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
27842785
@@ -2889,7 +2890,7 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_PPS_LISTING2) { · 104 unmodified lines
28892890 sParam1.eSpsPpsIdStrategy = SPS_PPS_LISTING;
28902891 //prepare param2
28912892 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2892− while (sParam2.iPicWidth == sParam1.iPicWidth) {
2893+ while (GET_MB_WIDTH (sParam2.iPicWidth) == GET_MB_WIDTH (sParam1.iPicWidth)) {
28932894 sParam2.iPicWidth = GetRandWidth();
28942895 }
28952896 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
@@ -2948,14 +2949,15 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_PPS_LISTING3) { · 52 unmodified lines
29482949 sParam1.eSpsPpsIdStrategy = SPS_PPS_LISTING;
29492950 //prepare param2
29502951 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2951− while (sParam2.iPicWidth == sParam1.iPicWidth) {
2952+ while (GET_MB_WIDTH (sParam2.iPicWidth) == GET_MB_WIDTH (sParam1.iPicWidth)) {
29522953 sParam2.iPicWidth = GetRandWidth();
29532954 }
29542955 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
29552956 sParam2.eSpsPpsIdStrategy = SPS_PPS_LISTING;
29562957 //prepare param3
29572958 memcpy (&sParam3, &sParam1, sizeof (SEncParamExt));
2958− while (sParam3.iPicWidth == sParam1.iPicWidth || sParam3.iPicWidth == sParam2.iPicWidth) {
2959+ while (GET_MB_WIDTH (sParam3.iPicWidth) == GET_MB_WIDTH (sParam1.iPicWidth) ||
2960+ GET_MB_WIDTH (sParam3.iPicWidth) == GET_MB_WIDTH (sParam2.iPicWidth)) {
29592961 sParam3.iPicWidth = GetRandWidth();
29602962 }
29612963 prepareParam (iSpatialLayerNum, iSliceNum, sParam3.iPicWidth, sParam3.iPicHeight, fFrameRate, &sParam3);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t