Merge pull request #558 from ruil2/encoder_level

add leve parameter, update profile and usagetype type
This commit is contained in:
Licai Guo 2014-03-20 17:16:40 +08:00
commit 58966cb2e8
4 changed files with 62 additions and 32 deletions

View File

@ -173,6 +173,42 @@ typedef enum {
SM_RESERVED = 6
} SliceModeEnum;
typedef enum {
PRO_UNKNOWN = 0,
PRO_BASELINE = 66,
PRO_MAIN = 77,
PRO_EXTENDED = 88,
PRO_HIGH = 100,
PRO_HIGH10 = 110,
PRO_HIGH422 = 122,
PRO_HIGH444 = 144,
PRO_CAVLC444 = 244,
PRO_SCALABLE_BASELINE = 83,
PRO_SCALABLE_HIGH = 86,
}EProfileIdc;
typedef enum {
LEVEL_UNKNOWN,
LEVEL_1_0,
LEVEL_1_B,
LEVEL_1_1,
LEVEL_1_2,
LEVEL_1_3,
LEVEL_2_0,
LEVEL_2_1,
LEVEL_2_2,
LEVEL_3_0,
LEVEL_3_1,
LEVEL_3_2,
LEVEL_4_0,
LEVEL_4_1,
LEVEL_4_2,
LEVEL_5_0,
LEVEL_5_1,
LEVEL_5_2
}ELevelIdc;
typedef struct {
SliceModeEnum uiSliceMode; //by default, uiSliceMode will be SM_SINGLE_SLICE
SSliceArgument sSliceArgument;
@ -184,16 +220,20 @@ typedef struct {
float fFrameRate; // frame rate specified for a layer
int iSpatialBitrate; // target bitrate for a spatial layer
int iMaxSpatialBitrate;
unsigned int uiProfileIdc; // value of profile IDC (0 for auto-detection)
EProfileIdc uiProfileIdc; // value of profile IDC (PRO_UNKNOWN for auto-detection)
ELevelIdc uiLevelIdc;
int iDLayerQp;
SSliceConfig sSliceCfg;
} SSpatialLayerConfig;
typedef enum {
CAMERA_VIDEO_REAL_TIME, //camera video signal
SCREEN_CONTENT_REAL_TIME,//screen content signal
}EUsageType;
/* SVC Encoding Parameters */
typedef struct TagEncParamBase{
int iUsageType; //enable_screen_content_signal;// 0: //camera video signal; 1: screen content signal;
EUsageType iUsageType; //application type;// CAMERA_VIDEO_REAL_TIME: //camera video signal; SCREEN_CONTENT_REAL_TIME: screen content signal;
int iInputCsp; // color space of input sequence
int iPicWidth; // width of picture in samples
@ -207,7 +247,7 @@ typedef struct TagEncParamBase{
typedef struct TagEncParamExt
{
int iUsageType; //application type;// 0: //camera video signal; 1: screen content signal;
EUsageType iUsageType; //application type;// CAMERA_VIDEO_REAL_TIME: //camera video signal; SCREEN_CONTENT_REAL_TIME: screen content signal;
int iInputCsp; // color space of input sequence
int iPicWidth; // width of picture in samples

View File

@ -143,7 +143,7 @@ int ParseLayerConfig( CReadConfig & cRdLayerCfg, const int iLayer, SEncParamExt&
sFileSet.sRecFileName[iLayer][kiLen] = '\0';
strncpy (sFileSet.sRecFileName[iLayer], strTag[1].c_str(), kiLen); // confirmed_safe_unsafe_usage
} else if (strTag[0].compare ("ProfileIdc") == 0) {
pDLayer->uiProfileIdc = atoi (strTag[1].c_str());
pDLayer->uiProfileIdc = (EProfileIdc)atoi (strTag[1].c_str());
} else if (strTag[0].compare ("FRExt") == 0) {
// pDLayer->frext_mode = (bool)atoi(strTag[1].c_str());
} else if (strTag[0].compare ("SpatialBitrate") == 0) {

View File

@ -91,7 +91,7 @@ int32_t iDecompositionStages;
uint8_t uiCodingIdx2TemporalId[ (1 << MAX_TEMPORAL_LEVEL) + 1];
uint8_t uiProfileIdc; // value of profile IDC (0 for auto-detection)
uint8_t uiLevelIdc;
int8_t iHighestTemporalId;
// uint8_t uiDependencyId;
int8_t iDLayerQp;
@ -187,17 +187,21 @@ static void FillDefault (SEncParamExt& param, const bool kbEnableRc) {
param.iMaxQp = 51;
param.iMinQp = 0;
param.iUsageType = 0;
param.iUsageType = CAMERA_VIDEO_REAL_TIME;
param.sSpatialLayers[0].iDLayerQp = SVC_QUALITY_BASE_QP;
param.sSpatialLayers[0].fFrameRate = param.fMaxFrameRate;
param.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
param.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 1500;
param.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceNum = 1;
for(int32_t iLayer = 0;iLayer< MAX_SPATIAL_LAYER_NUM;iLayer++){
param.sSpatialLayers[iLayer].uiProfileIdc = PRO_BASELINE;
param.sSpatialLayers[iLayer].uiLevelIdc = LEVEL_5_0;
param.sSpatialLayers[iLayer].iDLayerQp = SVC_QUALITY_BASE_QP;
param.sSpatialLayers[iLayer].fFrameRate = param.fMaxFrameRate;
param.sSpatialLayers[iLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
param.sSpatialLayers[iLayer].sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 1500;
param.sSpatialLayers[iLayer].sSliceCfg.sSliceArgument.uiSliceNum = 1;
const int32_t kiLesserSliceNum = ((MAX_SLICES_NUM < MAX_SLICES_NUM_TMP) ? MAX_SLICES_NUM : MAX_SLICES_NUM_TMP);
for (int32_t idx = 0; idx < kiLesserSliceNum; idx++)
param.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceMbNum[idx] = 960;
param.sSpatialLayers[iLayer].sSliceCfg.sSliceArgument.uiSliceMbNum[idx] = 960;
}
}
void FillDefault (const bool kbEnableRc) {
@ -258,6 +262,7 @@ int32_t ParamBaseTranscode (const SEncParamBase& pCodingParam, const bool kbEnab
int8_t iIdxSpatial = 0;
uint8_t uiProfileIdc = PRO_BASELINE;
SDLayerParam* pDlp = &sDependencyLayers[0];
while (iIdxSpatial < iSpatialLayerNum) {
@ -390,7 +395,8 @@ int32_t ParamTranscode (const SEncParamExt& pCodingParam) {
uint8_t uiProfileIdc = PRO_BASELINE;
int8_t iIdxSpatial = 0;
while (iIdxSpatial < iSpatialLayerNum) {
pDlp->uiProfileIdc = uiProfileIdc;
pDlp->uiProfileIdc = (pCodingParam.sSpatialLayers[iIdxSpatial].uiProfileIdc == PRO_UNKNOWN)?uiProfileIdc:pCodingParam.sSpatialLayers[iIdxSpatial].uiProfileIdc;
pDlp->uiLevelIdc = (pCodingParam.sSpatialLayers[iIdxSpatial].uiLevelIdc == LEVEL_UNKNOWN)?LEVEL_5_0:pCodingParam.sSpatialLayers[iIdxSpatial].uiLevelIdc;
float fLayerFrameRate = WELS_CLIP3 (pCodingParam.sSpatialLayers[iIdxSpatial].fFrameRate,
MIN_FRAME_RATE, fParamMaxFrameRate);

View File

@ -46,22 +46,6 @@ namespace WelsSVCEnc {
extern const ALIGNED_DECLARE (uint16_t, g_kuiDequantCoeff[52][8], 16);
extern const uint8_t g_kuiChromaQpTable[52];
/* Profile IDC */
enum EProfileIdc {
PRO_BASELINE = 66,
PRO_MAIN = 77,
PRO_EXTENDED = 88,
PRO_HIGH = 100,
PRO_HIGH10 = 110,
PRO_HIGH422 = 122,
PRO_HIGH444 = 144,
PRO_CAVLC444 = 244,
PRO_SCALABLE_BASELINE = 83,
PRO_SCALABLE_HIGH = 86,
};
/*
* NAL Unit Type (5 Bits)
*/