History

rename the strategy to enum

Sijia Chen committed 11 years ago

Commit d9502aa1 parent 7d1d2d69 files · +166 −74Browse files

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

Unified · Split

test/api/encode_decode_api_test.cpp+35−15
@@ -260,7 +260,27 @@ void EncodeDecodeTestAPI::RandomParamExtCombination() { · 259 unmodified lines
260 param_.iNumRefFrame = AUTO_REF_PIC_COUNT;260 param_.iNumRefFrame = AUTO_REF_PIC_COUNT;
261 param_.iMultipleThreadIdc = rand();261 param_.iMultipleThreadIdc = rand();
262 262
263 param_.iSpsPpsIdStrategy = rand() % 3;263 int iValue = rand() % 7;
264 switch (iValue) {
265 case 0:
266 param_.eSpsPpsIdStrategy = CONSTANT_ID;
267 break;
268 case 0x01:
269 param_.eSpsPpsIdStrategy = INCREASING_ID;
270 break;
271 case 0x02:
272 param_.eSpsPpsIdStrategy = SPS_LISTING;
273 break;
274 case 0x03:
275 param_.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
276 break;
277 case 0x06:
278 param_.eSpsPpsIdStrategy = SPS_PPS_LISTING;
279 break;
280 default:
281 param_.eSpsPpsIdStrategy = CONSTANT_ID;
282 break;
283 }
264 param_.bPrefixNalAddingCtrl = (rand() % 2 == 0) ? false : true;284 param_.bPrefixNalAddingCtrl = (rand() % 2 == 0) ? false : true;
265 param_.bEnableSSEI = (rand() % 2 == 0) ? false : true;285 param_.bEnableSSEI = (rand() % 2 == 0) ? false : true;
266 param_.iPaddingFlag = rand() % 2;286 param_.iPaddingFlag = rand() % 2;
@@ -2234,7 +2254,7 @@ TEST_F (DecodeCrashTestAPI, DecoderCrashTest) { · 1967 unmodified lines
2234 param_.iRCMode = RC_BITRATE_MODE;2254 param_.iRCMode = RC_BITRATE_MODE;
2235 param_.iTargetBitrate = p.iTarBitrate;2255 param_.iTargetBitrate = p.iTarBitrate;
2236 param_.uiIntraPeriod = 0;2256 param_.uiIntraPeriod = 0;
2237 param_.iSpsPpsIdStrategy = INCREASING_ID;2257 param_.eSpsPpsIdStrategy = INCREASING_ID;
2238 param_.bEnableBackgroundDetection = true;2258 param_.bEnableBackgroundDetection = true;
2239 param_.bEnableSceneChangeDetect = true;2259 param_.bEnableSceneChangeDetect = true;
2240 param_.bPrefixNalAddingCtrl = true;2260 param_.bPrefixNalAddingCtrl = true;
@@ -2568,21 +2588,21 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING · 327 unmodified lines
2568 SEncParamExt sParam3;2588 SEncParamExt sParam3;
2569 encoder_->GetDefaultParams (&sParam1);2589 encoder_->GetDefaultParams (&sParam1);
2570 prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);2590 prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);
2571 sParam1.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;2591 sParam1.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2572 //prepare param22592 //prepare param2
2573 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));2593 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2574 while (sParam2.iPicWidth == sParam1.iPicWidth) {2594 while (sParam2.iPicWidth == sParam1.iPicWidth) {
2575 sParam2.iPicWidth = GetRandWidth();2595 sParam2.iPicWidth = GetRandWidth();
2576 }2596 }
2577 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);2597 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
2578 sParam2.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;2598 sParam2.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2579 //prepare param32599 //prepare param3
2580 memcpy (&sParam3, &sParam1, sizeof (SEncParamExt));2600 memcpy (&sParam3, &sParam1, sizeof (SEncParamExt));
2581 while (sParam3.iPicHeight == sParam1.iPicHeight) {2601 while (sParam3.iPicHeight == sParam1.iPicHeight) {
2582 sParam3.iPicHeight = GetRandHeight();2602 sParam3.iPicHeight = GetRandHeight();
2583 }2603 }
2584 prepareParam (iSpatialLayerNum, iSliceNum, sParam3.iPicWidth, sParam3.iPicHeight, fFrameRate, &sParam3);2604 prepareParam (iSpatialLayerNum, iSliceNum, sParam3.iPicWidth, sParam3.iPicHeight, fFrameRate, &sParam3);
2585 sParam3.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;2605 sParam3.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2586 2606
2587 //prepare output if needed2607 //prepare output if needed
2588 FILE* fEnc = NULL;2608 FILE* fEnc = NULL;
@@ -2679,12 +2699,12 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING · 90 unmodified lines
2679 SEncParamExt sParam2;2699 SEncParamExt sParam2;
2680 encoder_->GetDefaultParams (&sParam1);2700 encoder_->GetDefaultParams (&sParam1);
2681 prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);2701 prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);
2682 sParam1.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;2702 sParam1.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2683 sParam1.iTemporalLayerNum = 1;2703 sParam1.iTemporalLayerNum = 1;
2684 //prepare param22704 //prepare param2
2685 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));2705 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2686 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);2706 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
2687 sParam2.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;2707 sParam2.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2688 sParam2.iTemporalLayerNum = 3;2708 sParam2.iTemporalLayerNum = 3;
2689 2709
2690 //prepare output if needed2710 //prepare output if needed
@@ -2734,7 +2754,7 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING · 43 unmodified lines
2734 SEncParamExt sParam2;2754 SEncParamExt sParam2;
2735 encoder_->GetDefaultParams (&sParam1);2755 encoder_->GetDefaultParams (&sParam1);
2736 prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);2756 prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);
2737 sParam1.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;2757 sParam1.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2738 2758
2739 //prepare output if needed2759 //prepare output if needed
2740 FILE* fEnc = NULL;2760 FILE* fEnc = NULL;
@@ -2760,7 +2780,7 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING · 19 unmodified lines
2760 } while (vWidthTableIt == vWidthTable.end());2780 } while (vWidthTableIt == vWidthTable.end());
2761 vWidthTable.push_back (sParam2.iPicWidth);2781 vWidthTable.push_back (sParam2.iPicWidth);
2762 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);2782 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
2763 sParam2.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;2783 sParam2.eSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2764 2784
2765 rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam2);2785 rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam2);
2766 ASSERT_TRUE (rv == cmResultSuccess) << "SetOption Failed sParam2: rv = " << rv << ", sParam2.iPicWidth=" <<2786 ASSERT_TRUE (rv == cmResultSuccess) << "SetOption Failed sParam2: rv = " << rv << ", sParam2.iPicWidth=" <<
@@ -2801,7 +2821,7 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_PPS_LISTING1) { · 34 unmodified lines
2801 SEncParamExt sParam1;2821 SEncParamExt sParam1;
2802 encoder_->GetDefaultParams (&sParam1);2822 encoder_->GetDefaultParams (&sParam1);
2803 prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);2823 prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);
2804 sParam1.iSpsPpsIdStrategy = SPS_PPS_LISTING;2824 sParam1.eSpsPpsIdStrategy = SPS_PPS_LISTING;
2805 2825
2806 //prepare output if needed2826 //prepare output if needed
2807 FILE* fEnc = NULL;2827 FILE* fEnc = NULL;
@@ -2866,14 +2886,14 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_PPS_LISTING2) { · 58 unmodified lines
2866 SEncParamExt sParam2;2886 SEncParamExt sParam2;
2867 encoder_->GetDefaultParams (&sParam1);2887 encoder_->GetDefaultParams (&sParam1);
2868 prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);2888 prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);
2869 sParam1.iSpsPpsIdStrategy = SPS_PPS_LISTING;2889 sParam1.eSpsPpsIdStrategy = SPS_PPS_LISTING;
2870 //prepare param22890 //prepare param2
2871 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));2891 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2872 while (sParam2.iPicWidth == sParam1.iPicWidth) {2892 while (sParam2.iPicWidth == sParam1.iPicWidth) {
2873 sParam2.iPicWidth = GetRandWidth();2893 sParam2.iPicWidth = GetRandWidth();
2874 }2894 }
2875 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);2895 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
2876 sParam2.iSpsPpsIdStrategy = SPS_PPS_LISTING;2896 sParam2.eSpsPpsIdStrategy = SPS_PPS_LISTING;
2877 2897
2878 //prepare output if needed2898 //prepare output if needed
2879 FILE* fEnc = NULL;2899 FILE* fEnc = NULL;
@@ -2925,21 +2945,21 @@ TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_PPS_LISTING3) { · 45 unmodified lines
2925 SEncParamExt sParam3;2945 SEncParamExt sParam3;
2926 encoder_->GetDefaultParams (&sParam1);2946 encoder_->GetDefaultParams (&sParam1);
2927 prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);2947 prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);
2928 sParam1.iSpsPpsIdStrategy = SPS_PPS_LISTING;2948 sParam1.eSpsPpsIdStrategy = SPS_PPS_LISTING;
2929 //prepare param22949 //prepare param2
2930 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));2950 memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2931 while (sParam2.iPicWidth == sParam1.iPicWidth) {2951 while (sParam2.iPicWidth == sParam1.iPicWidth) {
2932 sParam2.iPicWidth = GetRandWidth();2952 sParam2.iPicWidth = GetRandWidth();
2933 }2953 }
2934 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);2954 prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
2935 sParam2.iSpsPpsIdStrategy = SPS_PPS_LISTING;2955 sParam2.eSpsPpsIdStrategy = SPS_PPS_LISTING;
2936 //prepare param32956 //prepare param3
2937 memcpy (&sParam3, &sParam1, sizeof (SEncParamExt));2957 memcpy (&sParam3, &sParam1, sizeof (SEncParamExt));
2938 while (sParam3.iPicWidth == sParam1.iPicWidth || sParam3.iPicWidth == sParam2.iPicWidth) {2958 while (sParam3.iPicWidth == sParam1.iPicWidth || sParam3.iPicWidth == sParam2.iPicWidth) {
2939 sParam3.iPicWidth = GetRandWidth();2959 sParam3.iPicWidth = GetRandWidth();
2940 }2960 }
2941 prepareParam (iSpatialLayerNum, iSliceNum, sParam3.iPicWidth, sParam3.iPicHeight, fFrameRate, &sParam3);2961 prepareParam (iSpatialLayerNum, iSliceNum, sParam3.iPicWidth, sParam3.iPicHeight, fFrameRate, &sParam3);
2942 sParam3.iSpsPpsIdStrategy = SPS_PPS_LISTING;2962 sParam3.eSpsPpsIdStrategy = SPS_PPS_LISTING;
2943 2963
2944 //prepare output if needed2964 //prepare output if needed
2945 FILE* fEnc = NULL;2965 FILE* fEnc = NULL;

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