add API only for decode parser for HW decoding support

This commit is contained in:
huili2
2014-09-28 18:06:17 -07:00
parent e4b373a800
commit efdefdba28
6 changed files with 40 additions and 4 deletions

View File

@@ -106,6 +106,14 @@ class ISVCDecoder {
unsigned char** ppDst, unsigned char** ppDst,
SBufferInfo* pDstInfo) = 0; SBufferInfo* pDstInfo) = 0;
/*
* This function parse input bitstream only, and rewrite possible SVC syntax to AVC syntax
* return: 0 - success; otherwise -failed;
*/
virtual DECODING_STATE EXTAPI DecodeParser (const unsigned char* pSrc,
const int iSrcLen,
SParserBsInfo* pDstInfo) = 0;
/* /*
* this API does not work for now!! This is for future use to support non-I420 color format output. * this API does not work for now!! This is for future use to support non-I420 color format output.
*/ */
@@ -169,6 +177,10 @@ DECODING_STATE (*DecodeFrame2) (ISVCDecoder*, const unsigned char* pSrc,
unsigned char** ppDst, unsigned char** ppDst,
SBufferInfo* pDstInfo); SBufferInfo* pDstInfo);
DECODING_STATE (*DecodeParser) (ISVCDecoder*, const unsigned char* pSrc,
const int iSrcLen,
SParserBsInfo* pDstInfo);
DECODING_STATE (*DecodeFrameEx) (ISVCDecoder*, const unsigned char* pSrc, DECODING_STATE (*DecodeFrameEx) (ISVCDecoder*, const unsigned char* pSrc,
const int iSrcLen, const int iSrcLen,
unsigned char* pDst, unsigned char* pDst,

View File

@@ -447,4 +447,12 @@ typedef struct TagDecoderCapability {
bool bRedPicCap; bool bRedPicCap;
} SDecoderCapability; } SDecoderCapability;
typedef struct TagParserBsInfo {
int iNalNum; //total NAL number in current AU
int iNalLenInByte [MAX_NAL_UNITS_IN_LAYER]; //each nal length
unsigned char* pDstBuff; //outputted dst buffer for parsed bitstream
int iSpsWidthInPixel; //required SPS width info
int iSpsHeightInPixel; //required SPS height info
} SParserBsInfo, PParserBsInfo;
#endif//WELS_VIDEO_CODEC_APPLICATION_DEFINITION_H__ #endif//WELS_VIDEO_CODEC_APPLICATION_DEFINITION_H__

View File

@@ -85,6 +85,9 @@ virtual DECODING_STATE EXTAPI DecodeFrame2 (const unsigned char* kpSrc,
const int kiSrcLen, const int kiSrcLen,
unsigned char** ppDst, unsigned char** ppDst,
SBufferInfo* pDstInfo); SBufferInfo* pDstInfo);
virtual DECODING_STATE EXTAPI DecodeParser (const unsigned char* kpSrc,
const int kiSrcLen,
SParserBsInfo* pDstInfo);
virtual DECODING_STATE EXTAPI DecodeFrameEx (const unsigned char* kpSrc, virtual DECODING_STATE EXTAPI DecodeFrameEx (const unsigned char* kpSrc,
const int kiSrcLen, const int kiSrcLen,
unsigned char* pDst, unsigned char* pDst,

View File

@@ -453,6 +453,13 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
return dsErrorFree; return dsErrorFree;
} }
DECODING_STATE CWelsDecoder::DecodeParser (const unsigned char* kpSrc,
const int kiSrcLen,
SParserBsInfo* pDstInfo) {
//TODO, add function here
return (DECODING_STATE) m_pDecContext->iErrorCode;
}
DECODING_STATE CWelsDecoder::DecodeFrame (const unsigned char* kpSrc, DECODING_STATE CWelsDecoder::DecodeFrame (const unsigned char* kpSrc,
const int kiSrcLen, const int kiSrcLen,
unsigned char** ppDst, unsigned char** ppDst,

View File

@@ -27,8 +27,9 @@ void CheckDecoderInterface(ISVCDecoder* p, CheckFunc check) {
CHECK(3, p, DecodeFrame); CHECK(3, p, DecodeFrame);
CHECK(4, p, DecodeFrame2); CHECK(4, p, DecodeFrame2);
CHECK(5, p, DecodeFrameEx); CHECK(5, p, DecodeFrameEx);
CHECK(6, p, SetOption); CHECK(6, p, DecodeParser);
CHECK(7, p, GetOption); CHECK(7, p, SetOption);
CHECK(8, p, GetOption);
} }
struct bool_test_struct { struct bool_test_struct {

View File

@@ -88,13 +88,18 @@ struct SVCDecoderImpl : public ISVCDecoder {
EXPECT_TRUE (gThis == this); EXPECT_TRUE (gThis == this);
return static_cast<DECODING_STATE> (5); return static_cast<DECODING_STATE> (5);
} }
virtual DECODING_STATE EXTAPI DecodeParser (const unsigned char* pSrc,
const int iSrcLen, SParserBsInfo* pDstInfo) {
EXPECT_TRUE (gThis == this);
return static_cast<DECODING_STATE> (6);
}
virtual long EXTAPI SetOption (DECODER_OPTION eOptionId, void* pOption) { virtual long EXTAPI SetOption (DECODER_OPTION eOptionId, void* pOption) {
EXPECT_TRUE (gThis == this); EXPECT_TRUE (gThis == this);
return 6; return 7;
} }
virtual long EXTAPI GetOption (DECODER_OPTION eOptionId, void* pOption) { virtual long EXTAPI GetOption (DECODER_OPTION eOptionId, void* pOption) {
EXPECT_TRUE (gThis == this); EXPECT_TRUE (gThis == this);
return 7; return 8;
} }
}; };