Merge pull request #768 from ruil2/enc_param
use the parameters set by app instead of the default values
This commit is contained in:
commit
2006efc1e0
@ -50,6 +50,7 @@
|
|||||||
#define SAVED_NALUNIT_NUM_TMP ( (MAX_SPATIAL_LAYER_NUM*MAX_QUALITY_LAYER_NUM) + 1 + MAX_SPATIAL_LAYER_NUM ) //SPS/PPS + SEI/SSEI + PADDING_NAL
|
#define SAVED_NALUNIT_NUM_TMP ( (MAX_SPATIAL_LAYER_NUM*MAX_QUALITY_LAYER_NUM) + 1 + MAX_SPATIAL_LAYER_NUM ) //SPS/PPS + SEI/SSEI + PADDING_NAL
|
||||||
#define MAX_SLICES_NUM_TMP ( ( MAX_NAL_UNITS_IN_LAYER - SAVED_NALUNIT_NUM_TMP ) / 3 )
|
#define MAX_SLICES_NUM_TMP ( ( MAX_NAL_UNITS_IN_LAYER - SAVED_NALUNIT_NUM_TMP ) / 3 )
|
||||||
|
|
||||||
|
#define AUTO_REF_PIC_COUNT -1 // encoder selects the number of reference frame automatically
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/* Errors derived from bitstream parsing */
|
/* Errors derived from bitstream parsing */
|
||||||
dsErrorFree = 0x00, /* Bitstream error-free */
|
dsErrorFree = 0x00, /* Bitstream error-free */
|
||||||
|
@ -139,7 +139,7 @@ TagWelsSvcCodingParam () {
|
|||||||
static void FillDefault (SEncParamExt& param) {
|
static void FillDefault (SEncParamExt& param) {
|
||||||
memset(¶m, 0, sizeof(param));
|
memset(¶m, 0, sizeof(param));
|
||||||
param.uiIntraPeriod = 0; // intra period (multiple of GOP size as desired)
|
param.uiIntraPeriod = 0; // intra period (multiple of GOP size as desired)
|
||||||
param.iNumRefFrame = MIN_REF_PIC_COUNT; // number of reference frame used
|
param.iNumRefFrame = AUTO_REF_PIC_COUNT;// number of reference frame used
|
||||||
|
|
||||||
param.iPicWidth = 0; // actual input picture width
|
param.iPicWidth = 0; // actual input picture width
|
||||||
param.iPicHeight = 0; // actual input picture height
|
param.iPicHeight = 0; // actual input picture height
|
||||||
@ -312,10 +312,10 @@ int32_t ParamTranscode (const SEncParamExt& pCodingParam) {
|
|||||||
iLoopFilterDisableIdc = pCodingParam.iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries,
|
iLoopFilterDisableIdc = pCodingParam.iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries,
|
||||||
if (iLoopFilterDisableIdc == 0) // Loop filter requested to be enabled
|
if (iLoopFilterDisableIdc == 0) // Loop filter requested to be enabled
|
||||||
iLoopFilterDisableIdc = 2; // Disable loop filter on slice boundaries since that's not allowed with multithreading
|
iLoopFilterDisableIdc = 2; // Disable loop filter on slice boundaries since that's not allowed with multithreading
|
||||||
iLoopFilterAlphaC0Offset = 0; // AlphaOffset: valid range [-6, 6], default 0
|
iLoopFilterAlphaC0Offset = pCodingParam.iLoopFilterAlphaC0Offset; // AlphaOffset: valid range [-6, 6], default 0
|
||||||
iLoopFilterBetaOffset = 0; // BetaOffset: valid range [-6, 6], default 0
|
iLoopFilterBetaOffset = pCodingParam.iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 0
|
||||||
|
|
||||||
bEnableFrameCroppingFlag = true;
|
bEnableFrameCroppingFlag = pCodingParam.bEnableFrameCroppingFlag;
|
||||||
|
|
||||||
/* Rate Control */
|
/* Rate Control */
|
||||||
iRCMode = pCodingParam.iRCMode; // rc mode
|
iRCMode = pCodingParam.iRCMode; // rc mode
|
||||||
@ -329,7 +329,7 @@ int32_t ParamTranscode (const SEncParamExt& pCodingParam) {
|
|||||||
bEnableDenoise = pCodingParam.bEnableDenoise ? true : false; // Denoise Control // only support 0 or 1 now
|
bEnableDenoise = pCodingParam.bEnableDenoise ? true : false; // Denoise Control // only support 0 or 1 now
|
||||||
|
|
||||||
/* Scene change detection control */
|
/* Scene change detection control */
|
||||||
bEnableSceneChangeDetect = true;
|
bEnableSceneChangeDetect = pCodingParam.bEnableSceneChangeDetect;
|
||||||
|
|
||||||
/* Background detection Control */
|
/* Background detection Control */
|
||||||
bEnableBackgroundDetection = pCodingParam.bEnableBackgroundDetection ? true : false;
|
bEnableBackgroundDetection = pCodingParam.bEnableBackgroundDetection ? true : false;
|
||||||
@ -347,7 +347,7 @@ int32_t ParamTranscode (const SEncParamExt& pCodingParam) {
|
|||||||
iMultipleThreadIdc = pCodingParam.iMultipleThreadIdc;
|
iMultipleThreadIdc = pCodingParam.iMultipleThreadIdc;
|
||||||
|
|
||||||
/* For ssei information */
|
/* For ssei information */
|
||||||
bEnableSSEI = true;
|
bEnableSSEI = pCodingParam.bEnableSSEI;
|
||||||
|
|
||||||
/* Layer definition */
|
/* Layer definition */
|
||||||
iSpatialLayerNum = (int8_t)WELS_CLIP3 (pCodingParam.iSpatialLayerNum, 1,
|
iSpatialLayerNum = (int8_t)WELS_CLIP3 (pCodingParam.iSpatialLayerNum, 1,
|
||||||
@ -365,15 +365,19 @@ int32_t ParamTranscode (const SEncParamExt& pCodingParam) {
|
|||||||
if (iUsageType == SCREEN_CONTENT_REAL_TIME) {
|
if (iUsageType == SCREEN_CONTENT_REAL_TIME) {
|
||||||
if (bEnableLongTermReference) {
|
if (bEnableLongTermReference) {
|
||||||
iLTRRefNum = WELS_CLIP3(pCodingParam.iLTRRefNum,1,LONG_TERM_REF_NUM_SCREEN);
|
iLTRRefNum = WELS_CLIP3(pCodingParam.iLTRRefNum,1,LONG_TERM_REF_NUM_SCREEN);
|
||||||
iNumRefFrame = WELS_MAX(1, WELS_LOG2 (uiGopSize)) + iLTRRefNum;
|
if( iNumRefFrame == AUTO_REF_PIC_COUNT)
|
||||||
|
iNumRefFrame = WELS_MAX(1, WELS_LOG2 (uiGopSize)) + iLTRRefNum;
|
||||||
} else {
|
} else {
|
||||||
iLTRRefNum = 0;
|
iLTRRefNum = 0;
|
||||||
iNumRefFrame = 1;
|
if( iNumRefFrame == AUTO_REF_PIC_COUNT)
|
||||||
|
iNumRefFrame = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
iLTRRefNum = bEnableLongTermReference ? WELS_CLIP3(pCodingParam.iLTRRefNum,1,LONG_TERM_REF_NUM) : 0;
|
iLTRRefNum = bEnableLongTermReference ? WELS_CLIP3(pCodingParam.iLTRRefNum,1,LONG_TERM_REF_NUM) : 0;
|
||||||
iNumRefFrame = ((uiGopSize >> 1) > 1) ? ((uiGopSize >> 1) + iLTRRefNum) : (MIN_REF_PIC_COUNT + iLTRRefNum);
|
if( iNumRefFrame == AUTO_REF_PIC_COUNT){
|
||||||
iNumRefFrame = WELS_CLIP3 (iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM);
|
iNumRefFrame = ((uiGopSize >> 1) > 1) ? ((uiGopSize >> 1) + iLTRRefNum) : (MIN_REF_PIC_COUNT + iLTRRefNum);
|
||||||
|
iNumRefFrame = WELS_CLIP3 (iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
iLtrMarkPeriod = pCodingParam.iLtrMarkPeriod;
|
iLtrMarkPeriod = pCodingParam.iLtrMarkPeriod;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user