add parameter and one case in UT
This commit is contained in:
parent
25cad576b3
commit
84ca659f06
@ -349,6 +349,9 @@ typedef struct TagEncParamExt {
|
||||
bool bEnableAdaptiveQuant; // adaptive quantization control
|
||||
bool bEnableFrameCroppingFlag;// enable frame cropping flag: TRUE always in application
|
||||
bool bEnableSceneChangeDetect;
|
||||
|
||||
/*LTR advanced setting*/
|
||||
bool bIsLosslessLink;
|
||||
} SEncParamExt;
|
||||
|
||||
//Define a new struct to show the property of video bitstream.
|
||||
|
@ -15,9 +15,9 @@ class BaseEncoderTest {
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
void EncodeFile (const char* fileName, EUsageType usageType, int width, int height, float frameRate,
|
||||
SliceModeEnum slices, bool denoise, int layers, Callback* cbk);
|
||||
SliceModeEnum slices, bool denoise, int layers, bool losslessLink, bool enableLtr, Callback* cbk);
|
||||
void EncodeStream (InputStream* in, EUsageType usageType, int width, int height, float frameRate, SliceModeEnum slices,
|
||||
bool denoise, int layers, Callback* cbk);
|
||||
bool denoise, int layers, bool losslessLink, bool enableLtr, Callback* cbk);
|
||||
|
||||
ISVCEncoder* encoder_;
|
||||
private:
|
||||
|
@ -6,8 +6,8 @@
|
||||
#include "BaseEncoderTest.h"
|
||||
|
||||
static int InitWithParam (ISVCEncoder* encoder, EUsageType usageType, int width,
|
||||
int height, float frameRate, SliceModeEnum sliceMode, bool denoise, int layers) {
|
||||
if (SM_SINGLE_SLICE == sliceMode && !denoise && layers == 1) {
|
||||
int height, float frameRate, SliceModeEnum sliceMode, bool denoise, int layers, bool losslessLink, bool enableLtr) {
|
||||
if (SM_SINGLE_SLICE == sliceMode && !denoise && layers == 1 && !losslessLink && !enableLtr) {
|
||||
SEncParamBase param;
|
||||
memset (¶m, 0, sizeof (SEncParamBase));
|
||||
|
||||
@ -29,6 +29,8 @@ static int InitWithParam (ISVCEncoder* encoder, EUsageType usageType, int width,
|
||||
param.iTargetBitrate = 5000000;
|
||||
param.bEnableDenoise = denoise;
|
||||
param.iSpatialLayerNum = layers;
|
||||
param.bIsLosslessLink = losslessLink;
|
||||
param.bEnableLongTermReference = enableLtr;
|
||||
|
||||
if (sliceMode != SM_SINGLE_SLICE && sliceMode != SM_DYN_SLICE) //SM_DYN_SLICE don't support multi-thread now
|
||||
param.iMultipleThreadIdc = 2;
|
||||
@ -67,8 +69,8 @@ void BaseEncoderTest::TearDown() {
|
||||
}
|
||||
|
||||
void BaseEncoderTest::EncodeStream (InputStream* in, EUsageType usageType, int width, int height,
|
||||
float frameRate, SliceModeEnum slices, bool denoise, int layers, Callback* cbk) {
|
||||
int rv = InitWithParam (encoder_, usageType, width, height, frameRate, slices, denoise, layers);
|
||||
float frameRate, SliceModeEnum slices, bool denoise, int layers, bool losslessLink, bool enableLtr, Callback* cbk) {
|
||||
int rv = InitWithParam (encoder_, usageType, width, height, frameRate, slices, denoise, layers, losslessLink, enableLtr);
|
||||
ASSERT_TRUE (rv == cmResultSuccess);
|
||||
|
||||
// I420: 1(Y) + 1/4(U) + 1/4(V)
|
||||
@ -101,8 +103,8 @@ void BaseEncoderTest::EncodeStream (InputStream* in, EUsageType usageType, int w
|
||||
}
|
||||
|
||||
void BaseEncoderTest::EncodeFile (const char* fileName, EUsageType usageType, int width, int height,
|
||||
float frameRate, SliceModeEnum slices, bool denoise, int layers, Callback* cbk) {
|
||||
float frameRate, SliceModeEnum slices, bool denoise, int layers, bool losslessLink, bool enableLtr, Callback* cbk) {
|
||||
FileInputStream fileStream;
|
||||
ASSERT_TRUE (fileStream.Open (fileName));
|
||||
EncodeStream (&fileStream, usageType, width, height, frameRate, slices, denoise, layers, cbk);
|
||||
EncodeStream (&fileStream, usageType, width, height, frameRate, slices, denoise, layers, losslessLink, enableLtr, cbk);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ TEST_P (DecodeEncodeTest, CompareOutput) {
|
||||
#else
|
||||
ASSERT_TRUE (Open (p.fileName));
|
||||
#endif
|
||||
EncodeStream (this, CAMERA_VIDEO_REAL_TIME, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, this);
|
||||
EncodeStream (this, CAMERA_VIDEO_REAL_TIME, p.width, p.height, p.frameRate, SM_SINGLE_SLICE, false, 1, false, false, this);
|
||||
unsigned char digest[SHA_DIGEST_LENGTH];
|
||||
SHA1Result (&ctx_, digest);
|
||||
if (!HasFatalFailure()) {
|
||||
|
@ -35,6 +35,8 @@ struct EncodeFileParam {
|
||||
SliceModeEnum slices;
|
||||
bool denoise;
|
||||
int layers;
|
||||
bool isLossless;
|
||||
bool enableLtr;
|
||||
};
|
||||
|
||||
class EncoderOutputTest : public ::testing::WithParamInterface<EncodeFileParam>,
|
||||
@ -59,9 +61,9 @@ TEST_P (EncoderOutputTest, CompareOutput) {
|
||||
EncodeFileParam p = GetParam();
|
||||
#if defined(ANDROID_NDK)
|
||||
std::string filename = std::string ("/sdcard/") + p.fileName;
|
||||
EncodeFile (filename.c_str(), p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, this);
|
||||
EncodeFile (filename.c_str(), p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, p.isLossless, p.enableLtr, this);
|
||||
#else
|
||||
EncodeFile (p.fileName, p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, this);
|
||||
EncodeFile (p.fileName, p.usageType , p.width, p.height, p.frameRate, p.slices, p.denoise, p.layers, p.isLossless, p.enableLtr, this);
|
||||
#endif
|
||||
//will remove this after screen content algorithms are ready,
|
||||
//because the bitstream output will vary when the different algorithms are added.
|
||||
@ -74,51 +76,56 @@ TEST_P (EncoderOutputTest, CompareOutput) {
|
||||
static const EncodeFileParam kFileParamArray[] = {
|
||||
{
|
||||
"res/CiscoVT2people_320x192_12fps.yuv",
|
||||
"0a36b75e423fc6b49f6adf7eee12c039a096f538", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1
|
||||
"0a36b75e423fc6b49f6adf7eee12c039a096f538", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false
|
||||
},
|
||||
{
|
||||
"res/CiscoVT2people_160x96_6fps.yuv",
|
||||
"73981e6ea5b62f7338212c538a7cc755e7c9c030", CAMERA_VIDEO_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1
|
||||
"73981e6ea5b62f7338212c538a7cc755e7c9c030", CAMERA_VIDEO_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false
|
||||
},
|
||||
{
|
||||
"res/Static_152_100.yuv",
|
||||
"02bbff550ee0630e44e46e14dc459d3686f2a360", CAMERA_VIDEO_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1
|
||||
"02bbff550ee0630e44e46e14dc459d3686f2a360", CAMERA_VIDEO_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false
|
||||
},
|
||||
{
|
||||
"res/CiscoVT2people_320x192_12fps.yuv",
|
||||
"c8b759bcec7ffa048f1d3ded594b8815bed0aead", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_ROWMB_SLICE, false, 1 // One slice per MB row
|
||||
"c8b759bcec7ffa048f1d3ded594b8815bed0aead", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_ROWMB_SLICE, false, 1, false, false // One slice per MB row
|
||||
},
|
||||
{
|
||||
"res/CiscoVT2people_320x192_12fps.yuv",
|
||||
"e64ba75456c821ca35a949eda89f85bff8ee69fa", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, true, 1
|
||||
"e64ba75456c821ca35a949eda89f85bff8ee69fa", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, true, 1, false, false
|
||||
},
|
||||
{
|
||||
"res/CiscoVT2people_320x192_12fps.yuv",
|
||||
"684e6d141ada776892bdb01ee93efe475983ed36", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2
|
||||
"684e6d141ada776892bdb01ee93efe475983ed36", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 2, false, false
|
||||
},
|
||||
{
|
||||
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
|
||||
"2bc06262d87fa0897ad4c336cc4047d5a67f7203", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1
|
||||
"2bc06262d87fa0897ad4c336cc4047d5a67f7203", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false
|
||||
},
|
||||
{
|
||||
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
|
||||
"68c3220e49b7a57d563faf7c99a870ab34a23400", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SINGLE_SLICE, false, 4
|
||||
"68c3220e49b7a57d563faf7c99a870ab34a23400", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SINGLE_SLICE, false, 4, false, false
|
||||
},
|
||||
{
|
||||
"res/CiscoVT2people_320x192_12fps.yuv",
|
||||
"030d0e2d742ac039c2ab6333fe7cb18623c0d283", SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1
|
||||
"030d0e2d742ac039c2ab6333fe7cb18623c0d283", SCREEN_CONTENT_REAL_TIME, 320, 192, 12.0f, SM_SINGLE_SLICE, false, 1, false, false
|
||||
},
|
||||
{
|
||||
"res/CiscoVT2people_160x96_6fps.yuv",
|
||||
"40aa19d4b2684a59e689860d2a793876f33904f7", SCREEN_CONTENT_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1
|
||||
"40aa19d4b2684a59e689860d2a793876f33904f7", SCREEN_CONTENT_REAL_TIME, 160, 96, 6.0f, SM_SINGLE_SLICE, false, 1, false, false
|
||||
},
|
||||
{
|
||||
"res/Static_152_100.yuv",
|
||||
"494068b59aa9ed9118a9f33174b732024effc870", SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1
|
||||
"494068b59aa9ed9118a9f33174b732024effc870", SCREEN_CONTENT_REAL_TIME, 152, 100, 6.0f, SM_SINGLE_SLICE, false, 1, false, false
|
||||
},
|
||||
{
|
||||
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
|
||||
"7a0be680c2c89cda208fb5890e64867f3787491e", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1
|
||||
"7a0be680c2c89cda208fb5890e64867f3787491e", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false
|
||||
},
|
||||
//for different strategy
|
||||
{
|
||||
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
|
||||
"868f327765dc8e705ad6a9a942bfc7e32c03c791", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, true, true
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user