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.
Showing the changes to test/api/encode_decode_api_test.cpp (1 of 1 file). Show all
Unified · Split
| @@ -37,6 +37,7 @@ using namespace WelsCommon; · 36 unmodified lines | ||
| 37 | 37 | #define MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA (6) |
| 38 | 38 | #define MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN (8) |
| 39 | 39 | |
| 40 | +#define GET_MB_WIDTH(x) (((x) + 15)/16) | |
| 40 | 41 | |
| 41 | 42 | typedef struct SLost_Sim { |
| 42 | 43 | WelsCommon::EWelsNalUnitType eNalType; |
| @@ -2591,14 +2592,14 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING · 2548 unmodified lines | ||
| 2591 | 2592 | sParam1.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING; |
| 2592 | 2593 | //prepare param2 |
| 2593 | 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 | 2596 | sParam2.iPicWidth = GetRandWidth(); |
| 2596 | 2597 | } |
| 2597 | 2598 | prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2); |
| 2598 | 2599 | sParam2.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING; |
| 2599 | 2600 | //prepare param3 |
| 2600 | 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 | 2603 | sParam3.iPicHeight = GetRandHeight(); |
| 2603 | 2604 | } |
| 2604 | 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 | 2770 | int max_count = 65; // make it more then twice as MAX_SPS_COUNT |
| 2770 | 2771 | std::vector<int> vWidthTable; |
| 2771 | − vWidthTable.push_back (sParam1.iPicWidth); | |
| 2772 | + vWidthTable.push_back (GET_MB_WIDTH (sParam1.iPicWidth)); | |
| 2772 | 2773 | |
| 2773 | 2774 | std::vector<int>::iterator vWidthTableIt; |
| 2774 | 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 | 2777 | memcpy (&sParam2, &sParam1, sizeof (SEncParamExt)); |
| 2777 | 2778 | do { |
| 2778 | 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 | 2781 | } while (vWidthTableIt != vWidthTable.end()); |
| 2781 | − vWidthTable.push_back (sParam2.iPicWidth); | |
| 2782 | + vWidthTable.push_back (GET_MB_WIDTH (sParam2.iPicWidth)); | |
| 2782 | 2783 | prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2); |
| 2783 | 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 | 2890 | sParam1.eSpsPpsIdStrategy = SPS_PPS_LISTING; |
| 2890 | 2891 | //prepare param2 |
| 2891 | 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 | 2894 | sParam2.iPicWidth = GetRandWidth(); |
| 2894 | 2895 | } |
| 2895 | 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 | 2949 | sParam1.eSpsPpsIdStrategy = SPS_PPS_LISTING; |
| 2949 | 2950 | //prepare param2 |
| 2950 | 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 | 2953 | sParam2.iPicWidth = GetRandWidth(); |
| 2953 | 2954 | } |
| 2954 | 2955 | prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2); |
| 2955 | 2956 | sParam2.eSpsPpsIdStrategy = SPS_PPS_LISTING; |
| 2956 | 2957 | //prepare param3 |
| 2957 | 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 | 2961 | sParam3.iPicWidth = GetRandWidth(); |
| 2960 | 2962 | } |
| 2961 | 2963 | prepareParam (iSpatialLayerNum, iSliceNum, sParam3.iPicWidth, sParam3.iPicHeight, fFrameRate, &sParam3); |