ref: 0df6b1357b9a88949bf4ff309254314f89c06ca2
parent: 666e5d1290ff7bf0bdd7e152fadbdfc52e2f41cb
parent: 03e0e443e23718bd7dc9268e884597c195044bf0
author: sijchen <[email protected]>
date: Mon Mar 31 13:33:49 EDT 2014
Merge pull request #600 from ruil2/vp_console add usagetype setting for screen content
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -198,7 +198,10 @@
if (iRd > 0) {
if (strTag[0].empty())
continue;
- if (strTag[0].compare ("SourceWidth") == 0) {
+
+ if(strTag[0].compare ("UsageType") == 0){
+ pSvcParam.iUsageType = (EUsageType)atoi (strTag[1].c_str());
+ }else if (strTag[0].compare ("SourceWidth") == 0) {
pSrcPic->iPicWidth = atoi (strTag[1].c_str());
} else if (strTag[0].compare ("SourceHeight") == 0) {
pSrcPic->iPicHeight = atoi (strTag[1].c_str());
@@ -419,6 +422,9 @@
if (!strcmp (pCommand, "-bf") && (n < argc))
sFileSet.strBsFile.assign (argv[n++]);
+ else if (!strcmp (pCommand, "-utype") && (n < argc))
+ pSvcParam.iUsageType = (EUsageType)atoi (argv[n++]);
+
else if (!strcmp (pCommand, "-org") && (n < argc))
sFileSet.strSeqFile.assign (argv[n++]);
@@ -576,6 +582,7 @@
int FillSpecificParameters (SEncParamExt& sParam) {
/* Test for temporal, spatial, SNR scalability */
+ sParam.iUsageType = CAMERA_VIDEO_REAL_TIME;
sParam.fMaxFrameRate = 30.0f; // input frame rate
sParam.iPicWidth = 1280; // width of picture in samples
sParam.iPicHeight = 720; // height of picture in samples
--- a/codec/encoder/core/inc/param_svc.h
+++ b/codec/encoder/core/inc/param_svc.h
@@ -244,7 +244,7 @@
iInputCsp = pCodingParam.iInputCsp; // color space of input sequence
fMaxFrameRate = WELS_CLIP3 (pCodingParam.fMaxFrameRate, MIN_FRAME_RATE, MAX_FRAME_RATE);
iTargetBitrate = pCodingParam.iTargetBitrate;
-
+ iUsageType = pCodingParam.iUsageType;
iPicWidth = pCodingParam.iPicWidth;
iPicHeight = pCodingParam.iPicHeight;
@@ -306,7 +306,7 @@
iInputCsp = pCodingParam.iInputCsp; // color space of input sequence
uiFrameToBeCoded = (uint32_t) -
1; // frame to be encoded (at input frame rate), -1 dependents on length of input sequence
-
+ iUsageType = pCodingParam.iUsageType;
iPicWidth = pCodingParam.iPicWidth;
iPicHeight = pCodingParam.iPicHeight;
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -81,6 +81,10 @@
assert (pCfg != NULL);
+ if((pCfg->iUsageType != CAMERA_VIDEO_REAL_TIME)&&(pCfg->iUsageType != SCREEN_CONTENT_REAL_TIME)){
+ WelsLog (NULL, WELS_LOG_ERROR, "ParamValidation(),Invalid usage type = %d",pCfg->iUsageType);
+ return ENC_RETURN_UNSUPPORTED_PARA;
+ }
for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) {
SDLayerParam* fDlp = &pCfg->sDependencyLayers[i];
if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn
@@ -125,6 +129,10 @@
if (NULL == pCodingParam)
return ENC_RETURN_INVALIDINPUT;
+ if((pCodingParam->iUsageType != CAMERA_VIDEO_REAL_TIME)&&(pCodingParam->iUsageType != SCREEN_CONTENT_REAL_TIME)){
+ WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(),Invalid usage type = %d",pCodingParam->iUsageType);
+ return ENC_RETURN_UNSUPPORTED_PARA;
+ }
if (pCodingParam->iSpatialLayerNum < 1 || pCodingParam->iSpatialLayerNum > MAX_DEPENDENCY_LAYER) {
WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), monitor invalid pCodingParam->iSpatialLayerNum: %d!\n",
pCodingParam->iSpatialLayerNum);
--- a/testbin/welsenc.cfg
+++ b/testbin/welsenc.cfg
@@ -1,6 +1,7 @@
# Cisco Scalable H.264/AVC Extension Encoder Configuration File
#============================== GENERAL ==============================
+UsageType 0 #0: camera video 1:screen content
SourceWidth 320 #input video width
SourceHeight 192 #input video height
InputFile ../res/CiscoVT2people_320x192_12fps.yuv # Input file
--- a/testbin/welsenc_arbitrary_res.cfg
+++ b/testbin/welsenc_arbitrary_res.cfg
@@ -1,6 +1,7 @@
# Cisco Scalable H.264/AVC Extension Encoder Configuration File
#============================== GENERAL ==============================
+UsageType 0 #0: camera video 1:screen content
SourceWidth 152 # Input frame width
SourceHeight 100 # Input frame height
InputFile ../res/Static_152_100.yuv # Input file
--- a/testbin/welsenc_ios.cfg
+++ b/testbin/welsenc_ios.cfg
@@ -1,6 +1,7 @@
# Cisco Scalable H.264/AVC Extension Encoder Configuration File
#============================== GENERAL ==============================
+UsageType 0 #0: camera video 1:screen content
SourceWidth 320 #input video width
SourceHeight 192 #input video height
InputFile ../res/CiscoVT2people_320x192_12fps.yuv # Input file
--- a/testbin/welsenc_vd_1d.cfg
+++ b/testbin/welsenc_vd_1d.cfg
@@ -1,6 +1,7 @@
# Cisco Scalable H.264/AVC Extension Encoder Configuration File
#============================== GENERAL ==============================
+UsageType 0 #0: camera video 1:screen content
SourceWidth 320 # Input frame width
SourceHeight 192 # Input frame height
InputFile ../res/CiscoVT2people_320x192_12fps.yuv # Input file
--- a/testbin/welsenc_vd_rc.cfg
+++ b/testbin/welsenc_vd_rc.cfg
@@ -1,6 +1,7 @@
# Cisco Scalable H.264/AVC Extension Encoder Configuration File
#============================== GENERAL ==============================
+UsageType 0 #0: camera video 1:screen content
SourceWidth 320 # Input frame width
SourceHeight 192 # Input frame height
InputFile ../res/CiscoVT2people_320x192_12fps.yuv