Showing the changes to test/api/BaseEncoderTest.cpp (1 of 5 files). Show all
Unified · Split
| @@ -5,12 +5,13 @@ · 4 unmodified lines | |||
| 5 | #include "utils/FileInputStream.h" | 5 | #include "utils/FileInputStream.h" |
| 6 | #include "BaseEncoderTest.h" | 6 | #include "BaseEncoderTest.h" |
| 7 | 7 | ||
| 8 | static int InitWithParam(ISVCEncoder* encoder, int width, | 8 | static int InitWithParam(ISVCEncoder* encoder, EUsageType usageType,int width, |
| 9 | int height, float frameRate, SliceModeEnum sliceMode, bool denoise, int layers) { | 9 | int height, float frameRate, SliceModeEnum sliceMode, bool denoise, int layers) { |
| 10 | if (SM_SINGLE_SLICE == sliceMode && !denoise && layers == 1) { | 10 | if (SM_SINGLE_SLICE == sliceMode && !denoise && layers == 1) { |
| 11 | SEncParamBase param; | 11 | SEncParamBase param; |
| 12 | memset (¶m, 0, sizeof(SEncParamBase)); | 12 | memset (¶m, 0, sizeof(SEncParamBase)); |
| 13 | 13 | ||
| 14 | param.iUsageType = usageType; | ||
| 14 | param.fMaxFrameRate = frameRate; | 15 | param.fMaxFrameRate = frameRate; |
| 15 | param.iPicWidth = width; | 16 | param.iPicWidth = width; |
| 16 | param.iPicHeight = height; | 17 | param.iPicHeight = height; |
| @@ -22,6 +23,7 @@ static int InitWithParam(ISVCEncoder* encoder, int width, · 5 unmodified lines | |||
| 22 | SEncParamExt param; | 23 | SEncParamExt param; |
| 23 | encoder->GetDefaultParams(¶m); | 24 | encoder->GetDefaultParams(¶m); |
| 24 | 25 | ||
| 26 | param.iUsageType = usageType; | ||
| 25 | param.fMaxFrameRate = frameRate; | 27 | param.fMaxFrameRate = frameRate; |
| 26 | param.iPicWidth = width; | 28 | param.iPicWidth = width; |
| 27 | param.iPicHeight = height; | 29 | param.iPicHeight = height; |
| @@ -61,9 +63,9 @@ void BaseEncoderTest::TearDown() { · 33 unmodified lines | |||
| 61 | } | 63 | } |
| 62 | } | 64 | } |
| 63 | 65 | ||
| 64 | void BaseEncoderTest::EncodeStream(InputStream* in, int width, int height, | 66 | void BaseEncoderTest::EncodeStream(InputStream* in, EUsageType usageType, int width, int height, |
| 65 | float frameRate, SliceModeEnum slices, bool denoise, int layers, Callback* cbk) { | 67 | float frameRate, SliceModeEnum slices, bool denoise, int layers, Callback* cbk) { |
| 66 | int rv = InitWithParam(encoder_, width, height, frameRate, slices, denoise, layers); | 68 | int rv = InitWithParam(encoder_, usageType, width, height, frameRate, slices, denoise, layers); |
| 67 | ASSERT_TRUE(rv == cmResultSuccess); | 69 | ASSERT_TRUE(rv == cmResultSuccess); |
| 68 | 70 | ||
| 69 | // I420: 1(Y) + 1/4(U) + 1/4(V) | 71 | // I420: 1(Y) + 1/4(U) + 1/4(V) |
| @@ -95,9 +97,9 @@ void BaseEncoderTest::EncodeStream(InputStream* in, int width, int height, · 25 unmodified lines | |||
| 95 | } | 97 | } |
| 96 | } | 98 | } |
| 97 | 99 | ||
| 98 | void BaseEncoderTest::EncodeFile(const char* fileName, int width, int height, | 100 | void BaseEncoderTest::EncodeFile(const char* fileName, EUsageType usageType, int width, int height, |
| 99 | float frameRate, SliceModeEnum slices, bool denoise, int layers, Callback* cbk) { | 101 | float frameRate, SliceModeEnum slices, bool denoise, int layers, Callback* cbk) { |
| 100 | FileInputStream fileStream; | 102 | FileInputStream fileStream; |
| 101 | ASSERT_TRUE(fileStream.Open(fileName)); | 103 | ASSERT_TRUE(fileStream.Open(fileName)); |
| 102 | EncodeStream(&fileStream, width, height, frameRate, slices, denoise, layers, cbk); | 104 | EncodeStream(&fileStream, usageType, width, height, frameRate, slices, denoise, layers, cbk); |
| 103 | } | 105 | } |