Merge pull request #467 from sijchen/add_more_slice_mode_test
Specific slice mode in encoder test
This commit is contained in:
commit
1477f36de2
@ -6,8 +6,8 @@
|
|||||||
#include "BaseEncoderTest.h"
|
#include "BaseEncoderTest.h"
|
||||||
|
|
||||||
static int InitWithParam(ISVCEncoder* encoder, int width,
|
static int InitWithParam(ISVCEncoder* encoder, int width,
|
||||||
int height, float frameRate, bool slices) {
|
int height, float frameRate, SliceModeEnum sliceMode) {
|
||||||
if (!slices) {
|
if (SM_SINGLE_SLICE == sliceMode) {
|
||||||
SEncParamBase param;
|
SEncParamBase param;
|
||||||
memset (¶m, 0, sizeof(SEncParamBase));
|
memset (¶m, 0, sizeof(SEncParamBase));
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ static int InitWithParam(ISVCEncoder* encoder, int width,
|
|||||||
param.sSpatialLayers[0].fFrameRate = frameRate;
|
param.sSpatialLayers[0].fFrameRate = frameRate;
|
||||||
param.sSpatialLayers[0].iSpatialBitrate = param.iTargetBitrate;
|
param.sSpatialLayers[0].iSpatialBitrate = param.iTargetBitrate;
|
||||||
|
|
||||||
param.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_ROWMB_SLICE;
|
param.sSpatialLayers[0].sSliceCfg.uiSliceMode = sliceMode;
|
||||||
|
|
||||||
return encoder->InitializeExt(¶m);
|
return encoder->InitializeExt(¶m);
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ void BaseEncoderTest::TearDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BaseEncoderTest::EncodeStream(InputStream* in, int width, int height,
|
void BaseEncoderTest::EncodeStream(InputStream* in, int width, int height,
|
||||||
float frameRate, bool slices, Callback* cbk) {
|
float frameRate, SliceModeEnum slices, Callback* cbk) {
|
||||||
int rv = InitWithParam(encoder_, width, height, frameRate, slices);
|
int rv = InitWithParam(encoder_, width, height, frameRate, slices);
|
||||||
ASSERT_TRUE(rv == cmResultSuccess);
|
ASSERT_TRUE(rv == cmResultSuccess);
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ void BaseEncoderTest::EncodeStream(InputStream* in, int width, int height,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BaseEncoderTest::EncodeFile(const char* fileName, int width, int height,
|
void BaseEncoderTest::EncodeFile(const char* fileName, int width, int height,
|
||||||
float frameRate, bool slices, Callback* cbk) {
|
float frameRate, SliceModeEnum slices, Callback* cbk) {
|
||||||
FileInputStream fileStream;
|
FileInputStream fileStream;
|
||||||
ASSERT_TRUE(fileStream.Open(fileName));
|
ASSERT_TRUE(fileStream.Open(fileName));
|
||||||
EncodeStream(&fileStream, width, height, frameRate, slices, cbk);
|
EncodeStream(&fileStream, width, height, frameRate, slices, cbk);
|
||||||
|
@ -14,8 +14,8 @@ class BaseEncoderTest {
|
|||||||
BaseEncoderTest();
|
BaseEncoderTest();
|
||||||
void SetUp();
|
void SetUp();
|
||||||
void TearDown();
|
void TearDown();
|
||||||
void EncodeFile(const char* fileName, int width, int height, float frameRate, bool slices, Callback* cbk);
|
void EncodeFile(const char* fileName, int width, int height, float frameRate, SliceModeEnum slices, Callback* cbk);
|
||||||
void EncodeStream(InputStream* in, int width, int height, float frameRate, bool slices, Callback* cbk);
|
void EncodeStream(InputStream* in, int width, int height, float frameRate, SliceModeEnum slices, Callback* cbk);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ISVCEncoder* encoder_;
|
ISVCEncoder* encoder_;
|
||||||
|
@ -95,7 +95,7 @@ TEST_P(DecodeEncodeTest, CompareOutput) {
|
|||||||
DecodeEncodeFileParam p = GetParam();
|
DecodeEncodeFileParam p = GetParam();
|
||||||
|
|
||||||
ASSERT_TRUE(Open(p.fileName));
|
ASSERT_TRUE(Open(p.fileName));
|
||||||
EncodeStream(this, p.width, p.height, p.frameRate, false, this);
|
EncodeStream(this, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, this);
|
||||||
unsigned char digest[SHA_DIGEST_LENGTH];
|
unsigned char digest[SHA_DIGEST_LENGTH];
|
||||||
SHA1Result(&ctx_, digest);
|
SHA1Result(&ctx_, digest);
|
||||||
if (!HasFatalFailure()) {
|
if (!HasFatalFailure()) {
|
||||||
|
@ -31,7 +31,7 @@ struct EncodeFileParam {
|
|||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
float frameRate;
|
float frameRate;
|
||||||
bool slices;
|
SliceModeEnum slices;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EncoderOutputTest : public ::testing::WithParamInterface<EncodeFileParam>,
|
class EncoderOutputTest : public ::testing::WithParamInterface<EncodeFileParam>,
|
||||||
@ -66,19 +66,19 @@ TEST_P(EncoderOutputTest, CompareOutput) {
|
|||||||
static const EncodeFileParam kFileParamArray[] = {
|
static const EncodeFileParam kFileParamArray[] = {
|
||||||
{
|
{
|
||||||
"res/CiscoVT2people_320x192_12fps.yuv",
|
"res/CiscoVT2people_320x192_12fps.yuv",
|
||||||
"06441376891cbc237a36e59b62131cd94ff9cb19", 320, 192, 12.0f, false
|
"06441376891cbc237a36e59b62131cd94ff9cb19", 320, 192, 12.0f, SM_SINGLE_SLICE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"res/CiscoVT2people_160x96_6fps.yuv",
|
"res/CiscoVT2people_160x96_6fps.yuv",
|
||||||
"4f3759fc44125b27a179ebff158dbba9e431bd0b", 160, 96, 6.0f, false
|
"4f3759fc44125b27a179ebff158dbba9e431bd0b", 160, 96, 6.0f, SM_SINGLE_SLICE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"res/Static_152_100.yuv",
|
"res/Static_152_100.yuv",
|
||||||
"af5c6a41b567ce1b2cb6fd427f4379473d3b829f", 152, 100, 6.0f, false
|
"af5c6a41b567ce1b2cb6fd427f4379473d3b829f", 152, 100, 6.0f, SM_SINGLE_SLICE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"res/CiscoVT2people_320x192_12fps.yuv",
|
"res/CiscoVT2people_320x192_12fps.yuv",
|
||||||
"be0079b022b18fdce04570db24e4327ca26a0ecb", 320, 192, 12.0f, true
|
"be0079b022b18fdce04570db24e4327ca26a0ecb", 320, 192, 12.0f, SM_ROWMB_SLICE // One slice per MB row
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user