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
37#define MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA (6)37#define MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA (6)
38#define MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN (8)38#define MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN (8)
39 39
40#define GET_MB_WIDTH(x) (((x) + 15)/16)
40 41
41typedef struct SLost_Sim {42typedef struct SLost_Sim {
42 WelsCommon::EWelsNalUnitType eNalType;43 WelsCommon::EWelsNalUnitType eNalType;
@@ -2591,14 +2592,14 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING · 2548 unmodified lines
2591 sParam1.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;2592 sParam1.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2592 //prepare param22593 //prepare param2
2593 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));2594 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2594 while (sParam2.iPicWidth == sParam1.iPicWidth) {2595 while (GET_MB_WIDTH (sParam2.iPicWidth) == GET_MB_WIDTH (sParam1.iPicWidth)) {
2595 sParam2.iPicWidth = GetRandWidth();2596 sParam2.iPicWidth = GetRandWidth();
2596 }2597 }
2597 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);2598 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
2598 sParam2.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;2599 sParam2.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2599 //prepare param32600 //prepare param3
2600 memcpy (&sParam3, &sParam1, sizeof (SEncParamExt));2601 memcpy (&sParam3, &sParam1, sizeof (SEncParamExt));
2601 while (sParam3.iPicHeight == sParam1.iPicHeight) {2602 while (GET_MB_WIDTH (sParam3.iPicHeight) == GET_MB_WIDTH (sParam1.iPicHeight)) {
2602 sParam3.iPicHeight = GetRandHeight();2603 sParam3.iPicHeight = GetRandHeight();
2603 }2604 }
2604 prepareParam (iSpatialLayerNum, iSliceNum, sParam3.iPicWidth, sParam3.iPicHeight, fFrameRate, &sParam3);2605 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
2768 2769
2769 int max_count = 65; // make it more then twice as MAX_SPS_COUNT2770 int max_count = 65; // make it more then twice as MAX_SPS_COUNT
2770 std::vector<int> vWidthTable;2771 std::vector<int> vWidthTable;
2771 vWidthTable.push_back (sParam1.iPicWidth);2772 vWidthTable.push_back (GET_MB_WIDTH (sParam1.iPicWidth));
2772 2773
2773 std::vector<int>::iterator vWidthTableIt;2774 std::vector<int>::iterator vWidthTableIt;
2774 for (int times = 0; times < max_count; times++) {2775 for (int times = 0; times < max_count; times++) {
@@ -2776,9 +2777,9 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING · 1 unmodified line
2776 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));2777 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2777 do {2778 do {
2778 sParam2.iPicWidth = GetRandWidth();2779 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));
2780 } while (vWidthTableIt != vWidthTable.end());2781 } while (vWidthTableIt != vWidthTable.end());
2781 vWidthTable.push_back (sParam2.iPicWidth);2782 vWidthTable.push_back (GET_MB_WIDTH (sParam2.iPicWidth));
2782 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);2783 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
2783 sParam2.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;2784 sParam2.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2784 2785
@@ -2889,7 +2890,7 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_PPS_LISTING2) { · 104 unmodified lines
2889 sParam1.eSpsPpsIdStrategy = SPS_PPS_LISTING;2890 sParam1.eSpsPpsIdStrategy = SPS_PPS_LISTING;
2890 //prepare param22891 //prepare param2
2891 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));2892 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2892 while (sParam2.iPicWidth == sParam1.iPicWidth) {2893 while (GET_MB_WIDTH (sParam2.iPicWidth) == GET_MB_WIDTH (sParam1.iPicWidth)) {
2893 sParam2.iPicWidth = GetRandWidth();2894 sParam2.iPicWidth = GetRandWidth();
2894 }2895 }
2895 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);2896 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
@@ -2948,14 +2949,15 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_PPS_LISTING3) { · 52 unmodified lines
2948 sParam1.eSpsPpsIdStrategy = SPS_PPS_LISTING;2949 sParam1.eSpsPpsIdStrategy = SPS_PPS_LISTING;
2949 //prepare param22950 //prepare param2
2950 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));2951 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2951 while (sParam2.iPicWidth == sParam1.iPicWidth) {2952 while (GET_MB_WIDTH (sParam2.iPicWidth) == GET_MB_WIDTH (sParam1.iPicWidth)) {
2952 sParam2.iPicWidth = GetRandWidth();2953 sParam2.iPicWidth = GetRandWidth();
2953 }2954 }
2954 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);2955 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
2955 sParam2.eSpsPpsIdStrategy = SPS_PPS_LISTING;2956 sParam2.eSpsPpsIdStrategy = SPS_PPS_LISTING;
2956 //prepare param32957 //prepare param3
2957 memcpy (&sParam3, &sParam1, sizeof (SEncParamExt));2958 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)) {
2959 sParam3.iPicWidth = GetRandWidth();2961 sParam3.iPicWidth = GetRandWidth();
2960 }2962 }
2961 prepareParam (iSpatialLayerNum, iSliceNum, sParam3.iPicWidth, sParam3.iPicHeight, fFrameRate, &sParam3);2963 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