Merge pull request #1220 from ruil2/interface_ut

add encoder interface ut
This commit is contained in:
huili2 2014-07-25 17:41:38 +08:00
commit e286144524
8 changed files with 41 additions and 7 deletions

View File

@ -43,6 +43,8 @@
#include "typedefs.h"
#define MAX_LOG_SIZE 1024
#define MAX_WIDTH (4096)
#define MAX_HEIGHT (2304)//MAX_FS_LEVEL51 (36864); MAX_FS_LEVEL51*256/4096 = 2304
/*
* Function pointer declaration for various tool sets
*/

View File

@ -246,9 +246,10 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa
uint32_t iMbHeight = 0;
int32_t iMbNumInFrame = 0;
uint32_t iMaxSliceNum = MAX_SLICES_NUM;
if (kiPicWidth <= 0 || kiPicHeight <= 0) {
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid %d x %d in dependency layer settings!\n", kiPicWidth,
kiPicHeight);
if ((kiPicWidth <= 0) || (kiPicHeight <= 0) || (kiPicWidth > MAX_WIDTH) || (kiPicHeight > MAX_HEIGHT)) {
WelsLog (pLogCtx, WELS_LOG_ERROR,
"ParamValidationExt(),width(1-%d),height(1-%d)invalid %d x %d in dependency layer settings!\n", MAX_WIDTH, MAX_HEIGHT,
kiPicWidth, kiPicHeight);
return ENC_RETURN_UNSUPPORTED_PARA;
}
if ((kiPicWidth & 0x0F) != 0 || (kiPicHeight & 0x0F) != 0) {

View File

@ -1190,8 +1190,6 @@ void CWelsPreProcess::WelsMoveMemoryWrapper (SWelsSvcCodingParam* pSvcParam, SP
const int32_t kiDstStrideY = pDstPic->iLineSize[0];
const int32_t kiDstStrideUV = pDstPic->iLineSize[1];
#define MAX_WIDTH (4096)
#define MAX_HEIGHT (2304)//MAX_FS_LEVEL51 (36864); MAX_FS_LEVEL51*256/4096 = 2304
if (pSrcY) {
if (iSrcWidth <= 0 || iSrcWidth > MAX_WIDTH || iSrcHeight <= 0 || iSrcHeight > MAX_HEIGHT)
return;

View File

@ -40,7 +40,7 @@
#include "../adaptivequantization/AdaptiveQuantization.h"
#include "../complexityanalysis/ComplexityAnalysis.h"
#include "../imagerotate/imagerotate.h"
#include "util.h"
/* interface API implement */

View File

@ -56,6 +56,7 @@ WELSVP_NAMESPACE_BEGIN
#define MAX_WIDTH (4096)
#define MAX_HEIGHT (2304)//MAX_FS_LEVEL51 (36864); MAX_FS_LEVEL51*256/4096 = 2304
#define MB_WIDTH_LUMA (16)
#define PESN (1e-6) // desired float precision
#define AQ_INT_MULTIPLY 10000000

View File

@ -19,8 +19,9 @@ class BaseEncoderTest {
void EncodeStream (InputStream* in, EUsageType usageType, int width, int height, float frameRate, SliceModeEnum slices,
bool denoise, int layers, Callback* cbk);
private:
ISVCEncoder* encoder_;
private:
};
#endif //__BASEENCODERTEST_H__

View File

@ -0,0 +1,30 @@
#include <gtest/gtest.h>
#include "codec_def.h"
#include "codec_api.h"
#include "BaseEncoderTest.h"
class EncInterfaceCallTest : public ::testing::Test, public BaseEncoderTest {
public:
virtual void SetUp() {
BaseEncoderTest::SetUp();
};
virtual void TearDown() {
BaseEncoderTest::TearDown();
};
//testing case
};
TEST_F (EncInterfaceCallTest, BaseParameterVerify) {
int ret = cmResultSuccess;
SEncParamBase baseparam;
memset (&baseparam, 0, sizeof (SEncParamBase));
baseparam.iPicWidth = 0;
baseparam.iPicHeight = 7896;
ret = encoder_->Initialize (&baseparam);
EXPECT_EQ (ret, static_cast<int> (cmInitParaError));
}

View File

@ -6,6 +6,7 @@ ENCODER_UNITTEST_CPP_SRCS=\
$(ENCODER_UNITTEST_SRCDIR)/EncUT_EncoderMbAux.cpp\
$(ENCODER_UNITTEST_SRCDIR)/EncUT_ExpGolomb.cpp\
$(ENCODER_UNITTEST_SRCDIR)/EncUT_GetIntraPredictor.cpp\
$(ENCODER_UNITTEST_SRCDIR)/EncUT_InterfaceTest.cpp\
$(ENCODER_UNITTEST_SRCDIR)/EncUT_MBCopy.cpp\
$(ENCODER_UNITTEST_SRCDIR)/EncUT_MemoryAlloc.cpp\
$(ENCODER_UNITTEST_SRCDIR)/EncUT_MemoryZero.cpp\