Don't have SEncParamExt inherit SEncParamBase

Instead just duplicate the common fields. These fields had to
be duplicated for the C interface compatibility anyway - but
this way there is no risk to accidentally introduce an ABI
break since there is no need for the layout of SEncParamBase to
actually match the start of SEncParamExt.
This commit is contained in:
Martin Storsjö 2014-02-18 12:12:55 +02:00
parent 80f5aa216a
commit a899f05f2d
5 changed files with 16 additions and 81 deletions

View File

@ -56,7 +56,7 @@ class ISVCEncoder {
/*
* return: CM_RETURN: 0 - success; otherwise - failed;
*/
virtual int EXTAPI Initialize (const SEncParamBase* pParam, const INIT_TYPE kiInitType = INIT_TYPE_PARAMETER_BASED) = 0;
virtual int EXTAPI Initialize (const void* pParam, const INIT_TYPE kiInitType = INIT_TYPE_PARAMETER_BASED) = 0;
virtual int EXTAPI Uninitialize() = 0;
@ -140,7 +140,7 @@ typedef struct ISVCEncoderVtbl ISVCEncoderVtbl;
typedef const ISVCEncoderVtbl* ISVCEncoder;
struct ISVCEncoderVtbl {
int (*Initialize) (ISVCEncoder*, const SEncParamBase* pParam, const INIT_TYPE kiInitType);
int (*Initialize) (ISVCEncoder*, const void* pParam, const INIT_TYPE kiInitType);
int (*Uninitialize) (ISVCEncoder*);

View File

@ -185,7 +185,6 @@ typedef struct {
SSliceConfig sSliceCfg;
} SSpatialLayerConfig;
#ifdef __cplusplus
/* SVC Encoding Parameters */
typedef struct TagEncParamBase{
@ -201,8 +200,17 @@ typedef struct TagEncParamBase{
} SEncParamBase, *PEncParamBase;
typedef struct TagEncParamExt:SEncParamBase
typedef struct TagEncParamExt
{
int iUsageType; //enable_screen_content_signal;// 0: //camera video signal; 1: screen content signal;
int iInputCsp; // color space of input sequence
int iPicWidth; // width of picture in samples
int iPicHeight; // height of picture in samples
int iTargetBitrate; // target bitrate desired
int iRCMode; // RC mode
float fMaxFrameRate; // input maximal frame rate
int iTemporalLayerNum; // layer number at temporal level
int iSpatialLayerNum; // layer number at spatial level
@ -247,79 +255,6 @@ typedef struct TagEncParamExt:SEncParamBase
int iMinQp;
}SEncParamExt;
#else
/* SVC Encoding Parameters */
typedef struct TagEncParamBase{
int iUsageType; //enable_screen_content_signal;// 0: //camera video signal; 1: screen content signal;
int iInputCsp; // color space of input sequence
int iPicWidth; // width of picture in samples
int iPicHeight; // height of picture in samples
int iTargetBitrate; // target bitrate desired
int iRCMode; // RC mode
float fMaxFrameRate; // input maximal frame rate
} SEncParamBase, *PEncParamBase;
typedef struct TagEncParamExt
{
int iUsageType; //enable_screen_content_signal;// 0: //camera video signal; 1: screen content signal;
int iInputCsp; // color space of input sequence
int iPicWidth; // width of picture in samples
int iPicHeight; // height of picture in samples
int iTargetBitrate; // target bitrate desired
int iRCMode; // RC mode
float fMaxFrameRate; // input maximal frame rate
int iTemporalLayerNum; // layer number at temporal level
int iSpatialLayerNum; // layer number at spatial level
unsigned int uiIntraPeriod; // period of Intra frame
bool bEnableSpsPpsIdAddition;
bool bPrefixNalAddingCtrl;
bool bEnableDenoise; // denoise control
bool bEnableBackgroundDetection;// background detection control //VAA_BACKGROUND_DETECTION //BGD cmd
bool bEnableAdaptiveQuant; // adaptive quantization control
bool bEnableFrameSkip; // allow skipping frames to keep the bitrate within limits
bool bEnableCropPic; // enable cropping source picture. 8/25/2010
// false: Streaming Video Sharing; true: Video Conferencing Meeting;
bool bEnableLongTermReference; // 0: on, 1: off
int iLtrMarkPeriod;
int iPaddingFlag; // 0:disable padding;1:padding
int iEtropyCodingModeFlag;
SSpatialLayerConfig sSpatialLayers[MAX_SPATIAL_LAYER_NUM];
int iNumRefFrame; // number of reference frame used
unsigned int uiFrameToBeCoded; // frame to be encoded (at input frame rate)
unsigned int uiGopSize;
bool bEnableRc;
short iMultipleThreadIdc; // 1 # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads;
short iCountThreadsNum; // # derived from disable_multiple_slice_idc (=0 or >1) means;
int iLTRRefNum;
bool bEnableSSEI;
bool bEnableFrameCroppingFlag;// enable frame cropping flag: TRUE always in application
/* Deblocking loop filter */
int iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries
int iLoopFilterAlphaC0Offset;// AlphaOffset: valid range [-6, 6], default 0
int iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 0
int iInterLayerLoopFilterDisableIdc; // Employed based upon inter-layer, same comment as above
int iInterLayerLoopFilterAlphaC0Offset; // InterLayerLoopFilterAlphaC0Offset
int iInterLayerLoopFilterBetaOffset; // InterLayerLoopFilterBetaOffset
bool bEnableSceneChangeDetect;
//added
int iMaxQp;
int iMinQp;
}SEncParamExt;
#endif
//Define a new struct to show the property of video bitstream.
typedef struct {

View File

@ -66,7 +66,7 @@ class CWelsH264SVCEncoder : public ISVCEncoder {
/*
* return: CM_RETURN: 0 - success; otherwise - failed;
*/
virtual int EXTAPI Initialize (const SEncParamBase* argv, const INIT_TYPE init_type);
virtual int EXTAPI Initialize (const void* argv, const INIT_TYPE init_type);
virtual int EXTAPI Uninitialize();

View File

@ -200,7 +200,7 @@ void CWelsH264SVCEncoder::InitEncoder (void) {
/*
* SVC Encoder Initialization
*/
int CWelsH264SVCEncoder::Initialize (const SEncParamBase* argv, const INIT_TYPE iInitType) {
int CWelsH264SVCEncoder::Initialize (const void* argv, const INIT_TYPE iInitType) {
if ((INIT_TYPE_PARAMETER_BASED != iInitType && INIT_TYPE_PARAMETER_EXT != iInitType)|| NULL == argv) {
@ -213,7 +213,7 @@ int CWelsH264SVCEncoder::Initialize (const SEncParamBase* argv, const INIT_TYPE
if(iInitType == INIT_TYPE_PARAMETER_BASED)
{
// Convert SEncParamBase into WelsSVCParamConfig here..
if (sConfig.ParamBaseTranscode (*argv, true)) {
if (sConfig.ParamBaseTranscode (*(const SEncParamBase*)argv, true)) {
WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), parameter_translation failed.\n");
Uninitialize();
return cmInitParaError;

View File

@ -22,7 +22,7 @@ static void* gThis;
*/
struct SVCEncoderImpl : public ISVCEncoder {
virtual ~SVCEncoderImpl() {}
virtual int EXTAPI Initialize(const SEncParamBase* pParam,
virtual int EXTAPI Initialize(const void* pParam,
const INIT_TYPE kiInitType) {
EXPECT_TRUE(gThis == this);
return 1;