ref: e6c072b3643c7763fee0a3a339a06905beb6bbd9
parent: e0ef0cabdd605f5f5809358e1999b0457ba4f3ac
author: ruil2 <[email protected]>
date: Thu Mar 20 13:02:32 EDT 2014
add leve parameter, update profile and usagetype type
--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -173,6 +173,42 @@
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 @@
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 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
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -143,7 +143,7 @@
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) {
--- a/codec/encoder/core/inc/param_svc.h
+++ b/codec/encoder/core/inc/param_svc.h
@@ -91,7 +91,7 @@
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 @@
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;
+ 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[iLayer].sSliceCfg.sSliceArgument.uiSliceMbNum[idx] = 960;
+ }
}
void FillDefault (const bool kbEnableRc) {
@@ -258,6 +262,7 @@
int8_t iIdxSpatial = 0;
uint8_t uiProfileIdc = PRO_BASELINE;
+
SDLayerParam* pDlp = &sDependencyLayers[0];
while (iIdxSpatial < iSpatialLayerNum) {
@@ -390,7 +395,8 @@
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);
--- a/codec/encoder/core/inc/wels_common_basis.h
+++ b/codec/encoder/core/inc/wels_common_basis.h
@@ -46,22 +46,6 @@
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)
*/