change API for slicing part for easier usage (the UseLoadBalancing flag is still under working)
This commit is contained in:
parent
24916a652e
commit
33c378f7b7
4
Makefile
4
Makefile
@ -33,8 +33,8 @@ GMP_API_BRANCH=Firefox39
|
||||
CCASFLAGS=$(CFLAGS)
|
||||
STATIC_LDFLAGS=-lstdc++
|
||||
|
||||
VERSION=1.5
|
||||
SHAREDLIBVERSION=1
|
||||
VERSION=1.6
|
||||
SHAREDLIBVERSION=2
|
||||
|
||||
ifeq (,$(wildcard $(SRC_PATH)gmp-api))
|
||||
HAVE_GMP_API=No
|
||||
|
@ -254,29 +254,6 @@ typedef struct {
|
||||
int iLTRRefNum; ///< TODO: not supported to set it arbitrary yet
|
||||
} SLTRConfig;
|
||||
|
||||
/**
|
||||
* @brief Structure for slice argument
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned int
|
||||
uiSliceMbNum[MAX_SLICES_NUM_TMP]; ///< only used when uiSliceMode=2;here we use a tmp fixed value since MAX_SLICES_NUM is not defined here and its definition may be changed;
|
||||
unsigned int uiSliceNum; ///< only used when uiSliceMode=1
|
||||
unsigned int uiSliceSizeConstraint; ///< only used when uiSliceMode=4
|
||||
} SSliceArgument; ///< not all the elements in this argument will be used, how it will be used depends on uiSliceMode; please refer to SliceModeEnum
|
||||
|
||||
/**
|
||||
* @brief Enumerate the type of slice mode
|
||||
*/
|
||||
typedef enum {
|
||||
SM_SINGLE_SLICE = 0, ///< | SliceNum==1
|
||||
SM_FIXEDSLCNUM_SLICE = 1, ///< | according to SliceNum | enabled dynamic slicing for multi-thread
|
||||
SM_RASTER_SLICE = 2, ///< | according to SlicesAssign | need input of MB numbers each slice. In addition, if other constraint in SSliceArgument is presented, need to follow the constraints. Typically if MB num and slice size are both constrained, re-encoding may be involved.
|
||||
SM_ROWMB_SLICE = 3, ///< | according to PictureMBHeight | typical of single row of mbs each slice + slice size constraint which including re-encoding
|
||||
SM_DYN_SLICE = 4, ///< | according to SliceSize | dynamic slicing (have no idea about slice_nums until encoding current frame)
|
||||
SM_AUTO_SLICE = 5, ///< | according to thread number
|
||||
SM_RESERVED = 6
|
||||
} SliceModeEnum;
|
||||
|
||||
/**
|
||||
* @brief Enumerate the type of rate control mode
|
||||
*/
|
||||
@ -347,12 +324,26 @@ enum {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Structure for slice configuration
|
||||
*/
|
||||
* @brief Enumerate the type of slice mode
|
||||
*/
|
||||
typedef enum {
|
||||
SM_SINGLE_SLICE = 0, ///< | SliceNum==1
|
||||
SM_FIXEDSLCNUM_SLICE = 1, ///< | according to SliceNum | enabled dynamic slicing for multi-thread
|
||||
SM_RASTER_SLICE = 2, ///< | according to SlicesAssign | need input of MB numbers each slice. In addition, if other constraint in SSliceArgument is presented, need to follow the constraints. Typically if MB num and slice size are both constrained, re-encoding may be involved.
|
||||
SM_SIZELIMITED_SLICE = 3, ///< | according to SliceSize | slicing according to size, the slicing will be dynamic(have no idea about slice_nums until encoding current frame)
|
||||
SM_RESERVED = 4
|
||||
} SliceModeEnum;
|
||||
|
||||
/**
|
||||
* @brief Structure for slice argument
|
||||
*/
|
||||
typedef struct {
|
||||
SliceModeEnum uiSliceMode; ///< by default, uiSliceMode will be SM_SINGLE_SLICE
|
||||
SSliceArgument sSliceArgument;
|
||||
} SSliceConfig;
|
||||
unsigned int uiSliceNum; ///< only used when uiSliceMode=1, when uiSliceNum=0 means auto design it with cpu core number
|
||||
unsigned int uiSliceMbNum[MAX_SLICES_NUM_TMP]; ///< only used when uiSliceMode=2; when =0 means setting one MB row a slice
|
||||
unsigned int uiSliceSizeConstraint; ///< now only used when uiSliceMode=4
|
||||
} SSliceArgument;
|
||||
|
||||
/**
|
||||
* @brief Structure for spatial layer configuration
|
||||
*/
|
||||
@ -366,7 +357,7 @@ typedef struct {
|
||||
ELevelIdc uiLevelIdc; ///< value of profile IDC (0 for auto-detection)
|
||||
int iDLayerQp; ///< value of level IDC (0 for auto-detection)
|
||||
|
||||
SSliceConfig sSliceCfg; ///< slice configuration for a layer
|
||||
SSliceArgument sSliceArgument;
|
||||
} SSpatialLayerConfig;
|
||||
|
||||
/**
|
||||
@ -456,6 +447,7 @@ typedef struct TagEncParamExt {
|
||||
/* multi-thread settings*/
|
||||
unsigned short
|
||||
iMultipleThreadIdc; ///< 1 # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; lager than 1: count number of threads;
|
||||
bool bUseLoadBalancing; ///< only used when uiSliceMode=1 or 3, will change slicing of a picture during the run-time of multi-thread encoding, so the result of each run may be different
|
||||
|
||||
/* Deblocking loop filter */
|
||||
int iLoopFilterDisableIdc; ///< 0: on, 1: off, 2: on except for slice boundaries
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
#include "codec_app_def.h"
|
||||
|
||||
static const OpenH264Version g_stCodecVersion = {1, 5, 0, 0};
|
||||
static const char* const g_strCodecVer = "OpenH264 version:1.5.0.0";
|
||||
static const OpenH264Version g_stCodecVersion = {1, 6, 0, 0};
|
||||
static const char* const g_strCodecVer = "OpenH264 version:1.6.0.0";
|
||||
|
||||
#define OPENH264_MAJOR (1)
|
||||
#define OPENH264_MINOR (5)
|
||||
#define OPENH264_MINOR (6)
|
||||
#define OPENH264_REVISION (0)
|
||||
#define OPENH264_RESERVED (0)
|
||||
|
||||
|
@ -97,7 +97,7 @@ using namespace WelsEnc;
|
||||
*/
|
||||
typedef struct LayerpEncCtx_s {
|
||||
int32_t iDLayerQp;
|
||||
SSliceConfig sSliceCfg;
|
||||
SSliceArgument sSliceArgument;
|
||||
} SLayerPEncCtx;
|
||||
|
||||
typedef struct tagFilesSet {
|
||||
@ -183,26 +183,26 @@ int ParseLayerConfig (CReadConfig& cRdLayerCfg, const int iLayer, SEncParamExt&
|
||||
} else if (strTag[0].compare ("InitialQP") == 0) {
|
||||
sLayerCtx.iDLayerQp = atoi (strTag[1].c_str());
|
||||
} else if (strTag[0].compare ("SliceMode") == 0) {
|
||||
sLayerCtx.sSliceCfg.uiSliceMode = (SliceModeEnum)atoi (strTag[1].c_str());
|
||||
} else if (strTag[0].compare ("SliceSize") == 0) { //SM_DYN_SLICE
|
||||
sLayerCtx.sSliceCfg.sSliceArgument.uiSliceSizeConstraint = atoi (strTag[1].c_str());
|
||||
sLayerCtx.sSliceArgument.uiSliceMode = (SliceModeEnum)atoi (strTag[1].c_str());
|
||||
} else if (strTag[0].compare ("SliceSize") == 0) { //SM_SIZELIMITED_SLICE
|
||||
sLayerCtx.sSliceArgument.uiSliceSizeConstraint = atoi (strTag[1].c_str());
|
||||
continue;
|
||||
} else if (strTag[0].compare ("SliceNum") == 0) {
|
||||
sLayerCtx.sSliceCfg.sSliceArgument.uiSliceNum = atoi (strTag[1].c_str());
|
||||
sLayerCtx.sSliceArgument.uiSliceNum = atoi (strTag[1].c_str());
|
||||
} else if (strTag[0].compare (0, kiSize, str_) == 0) {
|
||||
const char* kpString = strTag[0].c_str();
|
||||
int uiSliceIdx = atoi (&kpString[kiSize]);
|
||||
assert (uiSliceIdx < MAX_SLICES_NUM);
|
||||
sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum[uiSliceIdx] = atoi (strTag[1].c_str());
|
||||
sLayerCtx.sSliceArgument.uiSliceMbNum[uiSliceIdx] = atoi (strTag[1].c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
pDLayer->iDLayerQp = sLayerCtx.iDLayerQp;
|
||||
pDLayer->sSliceCfg.uiSliceMode = sLayerCtx.sSliceCfg.uiSliceMode;
|
||||
pDLayer->sSliceArgument.uiSliceMode = sLayerCtx.sSliceArgument.uiSliceMode;
|
||||
|
||||
memcpy (&pDLayer->sSliceCfg, &sLayerCtx.sSliceCfg, sizeof (SSliceConfig)); // confirmed_safe_unsafe_usage
|
||||
memcpy (&pDLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0], &sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum[0],
|
||||
sizeof (sLayerCtx.sSliceCfg.sSliceArgument.uiSliceMbNum)); // confirmed_safe_unsafe_usage
|
||||
memcpy (&pDLayer->sSliceArgument, &sLayerCtx.sSliceArgument, sizeof (SSliceArgument)); // confirmed_safe_unsafe_usage
|
||||
memcpy (&pDLayer->sSliceArgument.uiSliceMbNum[0], &sLayerCtx.sSliceArgument.uiSliceMbNum[0],
|
||||
sizeof (sLayerCtx.sSliceArgument.uiSliceMbNum)); // confirmed_safe_unsafe_usage
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -292,6 +292,8 @@ int ParseConfig (CReadConfig& cRdCfg, SSourcePicture* pSrcPic, SEncParamExt& pSv
|
||||
pSvcParam.iMultipleThreadIdc = 0;
|
||||
else if (pSvcParam.iMultipleThreadIdc > MAX_THREADS_NUM)
|
||||
pSvcParam.iMultipleThreadIdc = MAX_THREADS_NUM;
|
||||
} else if (strTag[0].compare ("UseLoadBalancing") == 0) {
|
||||
pSvcParam.bUseLoadBalancing = (atoi (strTag[1].c_str()))?true:false;
|
||||
} else if (strTag[0].compare ("RCMode") == 0) {
|
||||
pSvcParam.iRCMode = (RC_MODES) atoi (strTag[1].c_str());
|
||||
} else if (strTag[0].compare ("TargetBitrate") == 0) {
|
||||
@ -381,7 +383,7 @@ void PrintHelp() {
|
||||
printf (" -frin input frame rate\n");
|
||||
printf (" -numtl Temporal layer number (default: 1)\n");
|
||||
printf (" -iper Intra period (default: -1) : must be a power of 2 of GOP size (or -1)\n");
|
||||
printf (" -nalsize the Maximum NAL size. which should be larger than the each layer slicesize when slice mode equals to SM_DYN_SLICE\n");
|
||||
printf (" -nalsize the Maximum NAL size. which should be larger than the each layer slicesize when slice mode equals to SM_SIZELIMITED_SLICE\n");
|
||||
printf (" -spsid Enable id adding in SPS/PPS per IDR \n");
|
||||
printf (" -cabac Entropy coding mode(0:cavlc 1:cabac \n");
|
||||
printf (" -denois Control denoising (default: 0)\n");
|
||||
@ -407,7 +409,7 @@ void PrintHelp() {
|
||||
printf (" -lqp (Layer) (base quality layer qp : must work with -ldeltaqp or -lqparr)\n");
|
||||
printf (" -ltarb (Layer) (spatial layer target bitrate)\n");
|
||||
printf (" -lmaxb (Layer) (spatial layer max bitrate)\n");
|
||||
printf (" -slcmd (Layer) (spatial layer slice mode): pls refer to layerX.cfg for details ( -slcnum: set target slice num; -slcsize: set target slice size constraint ) \n");
|
||||
printf (" -slcmd (Layer) (spatial layer slice mode): pls refer to layerX.cfg for details ( -slcnum: set target slice num; -slcsize: set target slice size constraint ; -slcload: turn load-balancing on/off; -slcmbnum: set the first slice mb num under some slice modes) \n");
|
||||
printf (" -trace (Level)\n");
|
||||
printf ("\n");
|
||||
}
|
||||
@ -502,7 +504,9 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
|
||||
|
||||
else if (!strcmp (pCommand, "-threadIdc") && (n < argc))
|
||||
pSvcParam.iMultipleThreadIdc = atoi (argv[n++]);
|
||||
|
||||
else if (!strcmp (pCommand, "-loadbalancing") && (n + 1 < argc)) {
|
||||
pSvcParam.bUseLoadBalancing = (atoi (argv[n++]))?true:false;
|
||||
}
|
||||
else if (!strcmp (pCommand, "-deblockIdc") && (n < argc))
|
||||
pSvcParam.iLoopFilterDisableIdc = atoi (argv[n++]);
|
||||
|
||||
@ -583,25 +587,19 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
|
||||
|
||||
switch (atoi (argv[n++])) {
|
||||
case 0:
|
||||
pDLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pDLayer->sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
break;
|
||||
case 1:
|
||||
pDLayer->sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
pDLayer->sSliceArgument.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
break;
|
||||
case 2:
|
||||
pDLayer->sSliceCfg.uiSliceMode = SM_RASTER_SLICE;
|
||||
pDLayer->sSliceArgument.uiSliceMode = SM_RASTER_SLICE;
|
||||
break;
|
||||
case 3:
|
||||
pDLayer->sSliceCfg.uiSliceMode = SM_ROWMB_SLICE;
|
||||
break;
|
||||
case 4:
|
||||
pDLayer->sSliceCfg.uiSliceMode = SM_DYN_SLICE;
|
||||
break;
|
||||
case 5:
|
||||
pDLayer->sSliceCfg.uiSliceMode = SM_AUTO_SLICE;
|
||||
pDLayer->sSliceArgument.uiSliceMode = SM_SIZELIMITED_SLICE;
|
||||
break;
|
||||
default:
|
||||
pDLayer->sSliceCfg.uiSliceMode = SM_RESERVED;
|
||||
pDLayer->sSliceArgument.uiSliceMode = SM_RESERVED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -609,13 +607,18 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
|
||||
else if (!strcmp (pCommand, "-slcsize") && (n + 1 < argc)) {
|
||||
unsigned int iLayer = atoi (argv[n++]);
|
||||
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
|
||||
pDLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = atoi (argv[n++]);
|
||||
pDLayer->sSliceArgument.uiSliceSizeConstraint = atoi (argv[n++]);
|
||||
}
|
||||
|
||||
else if (!strcmp (pCommand, "-slcnum") && (n + 1 < argc)) {
|
||||
unsigned int iLayer = atoi (argv[n++]);
|
||||
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
|
||||
pDLayer->sSliceCfg.sSliceArgument.uiSliceNum = atoi (argv[n++]);
|
||||
pDLayer->sSliceArgument.uiSliceNum = atoi (argv[n++]);
|
||||
}
|
||||
else if (!strcmp (pCommand, "-slcmbnum") && (n + 1 < argc)) {
|
||||
unsigned int iLayer = atoi (argv[n++]);
|
||||
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
|
||||
pDLayer->sSliceArgument.uiSliceMbNum[0] = atoi (argv[n++]);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -651,7 +654,7 @@ int FillSpecificParameters (SEncParamExt& sParam) {
|
||||
sParam.sSpatialLayers[iIndexLayer].fFrameRate = 7.5f;
|
||||
sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 64000;
|
||||
sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
|
||||
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
|
||||
++ iIndexLayer;
|
||||
sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE;
|
||||
@ -660,7 +663,7 @@ int FillSpecificParameters (SEncParamExt& sParam) {
|
||||
sParam.sSpatialLayers[iIndexLayer].fFrameRate = 15.0f;
|
||||
sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 160000;
|
||||
sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
|
||||
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
|
||||
++ iIndexLayer;
|
||||
sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE;
|
||||
@ -669,8 +672,8 @@ int FillSpecificParameters (SEncParamExt& sParam) {
|
||||
sParam.sSpatialLayers[iIndexLayer].fFrameRate = 30.0f;
|
||||
sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 512000;
|
||||
sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
|
||||
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.sSliceArgument.uiSliceNum = 1;
|
||||
sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceNum = 1;
|
||||
|
||||
++ iIndexLayer;
|
||||
sParam.sSpatialLayers[iIndexLayer].uiProfileIdc = PRO_SCALABLE_BASELINE;
|
||||
@ -679,8 +682,8 @@ int FillSpecificParameters (SEncParamExt& sParam) {
|
||||
sParam.sSpatialLayers[iIndexLayer].fFrameRate = 30.0f;
|
||||
sParam.sSpatialLayers[iIndexLayer].iSpatialBitrate = 1500000;
|
||||
sParam.sSpatialLayers[iIndexLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
|
||||
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
sParam.sSpatialLayers[iIndexLayer].sSliceCfg.sSliceArgument.uiSliceNum = 1;
|
||||
sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
sParam.sSpatialLayers[iIndexLayer].sSliceArgument.uiSliceNum = 1;
|
||||
|
||||
float fMaxFr = sParam.sSpatialLayers[sParam.iSpatialLayerNum - 1].fFrameRate;
|
||||
for (int32_t i = sParam.iSpatialLayerNum - 2; i >= 0; -- i) {
|
||||
|
@ -137,6 +137,7 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
|
||||
param.iTargetBitrate = UNSPECIFIED_BIT_RATE; // overall target bitrate introduced in RC module
|
||||
param.iMaxBitrate = UNSPECIFIED_BIT_RATE;
|
||||
param.iMultipleThreadIdc = 1;
|
||||
param.bUseLoadBalancing = true;
|
||||
|
||||
param.iLTRRefNum = 0;
|
||||
param.iLtrMarkPeriod = 30; //the min distance of two int32_t references
|
||||
@ -176,13 +177,15 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
|
||||
param.sSpatialLayers[iLayer].uiLevelIdc = LEVEL_UNKNOWN;
|
||||
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;
|
||||
|
||||
param.sSpatialLayers[iLayer].iMaxSpatialBitrate = UNSPECIFIED_BIT_RATE;
|
||||
|
||||
param.sSpatialLayers[iLayer].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
param.sSpatialLayers[iLayer].sSliceArgument.uiSliceNum = 0; //AUTO, using number of CPU cores
|
||||
param.sSpatialLayers[iLayer].sSliceArgument.uiSliceSizeConstraint = 1500;
|
||||
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;
|
||||
param.sSpatialLayers[iLayer].sSliceArgument.uiSliceMbNum[idx] = 0; //default, using one row a slice if uiSliceMode is SM_RASTER_MODE
|
||||
}
|
||||
}
|
||||
|
||||
@ -394,15 +397,11 @@ typedef struct TagWelsSvcCodingParam: SEncParamExt {
|
||||
pCodingParam.sSpatialLayers[iIdxSpatial].iMaxSpatialBitrate;
|
||||
|
||||
//multi slice
|
||||
pSpatialLayer->sSliceCfg.uiSliceMode = pCodingParam.sSpatialLayers[iIdxSpatial].sSliceCfg.uiSliceMode;
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint
|
||||
= (uint32_t) (pCodingParam.sSpatialLayers[iIdxSpatial].sSliceCfg.sSliceArgument.uiSliceSizeConstraint);
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum
|
||||
= pCodingParam.sSpatialLayers[iIdxSpatial].sSliceCfg.sSliceArgument.uiSliceNum;
|
||||
const int32_t kiLesserSliceNum = ((MAX_SLICES_NUM < MAX_SLICES_NUM_TMP) ? MAX_SLICES_NUM : MAX_SLICES_NUM_TMP);
|
||||
memcpy (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum,
|
||||
pCodingParam.sSpatialLayers[iIdxSpatial].sSliceCfg.sSliceArgument.uiSliceMbNum, // confirmed_safe_unsafe_usage
|
||||
kiLesserSliceNum * sizeof (uint32_t)) ;
|
||||
pSpatialLayer->sSliceArgument = pCodingParam.sSpatialLayers[iIdxSpatial].sSliceArgument;
|
||||
|
||||
memcpy (&(pSpatialLayer->sSliceArgument),
|
||||
&(pCodingParam.sSpatialLayers[iIdxSpatial].sSliceArgument), // confirmed_safe_unsafe_usage
|
||||
sizeof (SSliceArgument)) ;
|
||||
|
||||
pSpatialLayer->iDLayerQp = pCodingParam.sSpatialLayers[iIdxSpatial].iDLayerQp;
|
||||
|
||||
|
@ -123,7 +123,7 @@ int32_t InitSlicePEncCtx (SSliceCtx* pSliceCtx,
|
||||
bool bFmoUseFlag,
|
||||
int32_t iMbWidth,
|
||||
int32_t iMbHeight,
|
||||
SSliceConfig* pMulSliceOption,
|
||||
SSliceArgument* pSliceArgument,
|
||||
void* pPpsArg);
|
||||
|
||||
|
||||
@ -190,7 +190,7 @@ int32_t WelsGetNumMbInSlice (SSliceCtx* pSliceCtx, const int32_t kiSliceIdc);
|
||||
* Get slice count for multiple slice segment
|
||||
*
|
||||
*/
|
||||
int32_t GetInitialSliceNum (const int32_t kiMbWidth, const int32_t kiMbHeight, SSliceConfig* pMso);
|
||||
int32_t GetInitialSliceNum (const int32_t kiMbWidth, const int32_t kiMbHeight, SSliceArgument* pSliceArgument);
|
||||
int32_t GetCurrentSliceNum (const SSliceCtx* kpSliceCtx);
|
||||
SSlice* GetSliceByIndex(sWelsEncCtx* pCtx, const int32_t kiSliceIdc);
|
||||
|
||||
|
@ -754,7 +754,7 @@ void PerformDeblockingFilter (sWelsEncCtx* pEnc) {
|
||||
int32_t iSliceCount = 0;
|
||||
int32_t iSliceIdx = 0;
|
||||
|
||||
if (SM_DYN_SLICE != pSpatialLayer->sSliceCfg.uiSliceMode) {
|
||||
if (SM_SIZELIMITED_SLICE != pSpatialLayer->sSliceArgument.uiSliceMode) {
|
||||
iSliceCount = GetCurrentSliceNum (pCurLayer->pSliceEncCtx);
|
||||
do {
|
||||
DeblockingFilterSliceAvcbase (pCurLayer, pEnc->pFuncList, iSliceIdx);
|
||||
|
@ -411,14 +411,14 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
|
||||
if (pSpatialLayer->sSliceCfg.uiSliceMode >= SM_RESERVED) {
|
||||
if (pSpatialLayer->sSliceArgument.uiSliceMode >= SM_RESERVED) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!",
|
||||
pSpatialLayer->sSliceCfg.uiSliceMode);
|
||||
pSpatialLayer->sSliceArgument.uiSliceMode);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
if ((pCodingParam->uiMaxNalSize != 0) && (pSpatialLayer->sSliceCfg.uiSliceMode != SM_DYN_SLICE)) {
|
||||
if ((pCodingParam->uiMaxNalSize != 0) && (pSpatialLayer->sSliceArgument.uiSliceMode != SM_SIZELIMITED_SLICE)) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!,MaxNalSize = %d",
|
||||
pSpatialLayer->sSliceCfg.uiSliceMode, pCodingParam->uiMaxNalSize);
|
||||
pSpatialLayer->sSliceArgument.uiSliceMode, pCodingParam->uiMaxNalSize);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
CheckProfileSetting (pLogCtx, pCodingParam, i, pSpatialLayer->uiProfileIdc);
|
||||
@ -426,144 +426,142 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa
|
||||
//check pSlice settings under multi-pSlice
|
||||
if (kiPicWidth <= 16 && kiPicHeight <= 16) {
|
||||
//only have one MB, set to single_slice
|
||||
pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pSpatialLayer->sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
}
|
||||
switch (pSpatialLayer->sSliceCfg.uiSliceMode) {
|
||||
switch (pSpatialLayer->sSliceArgument.uiSliceMode) {
|
||||
case SM_SINGLE_SLICE:
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = 1;
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
pSpatialLayer->sSliceArgument.uiSliceNum = 1;
|
||||
pSpatialLayer->sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
for (iIdx = 0; iIdx < MAX_SLICES_NUM; iIdx++) {
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[iIdx] = 0;
|
||||
pSpatialLayer->sSliceArgument.uiSliceMbNum[iIdx] = 0;
|
||||
}
|
||||
break;
|
||||
case SM_FIXEDSLCNUM_SLICE: {
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
pSpatialLayer->sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
|
||||
iMbWidth = (kiPicWidth + 15) >> 4;
|
||||
iMbHeight = (kiPicHeight + 15) >> 4;
|
||||
iMbNumInFrame = iMbWidth * iMbHeight;
|
||||
iMaxSliceNum = MAX_SLICES_NUM;
|
||||
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 0
|
||||
|| pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) {
|
||||
if (pSpatialLayer->sSliceArgument.uiSliceNum == 0) {
|
||||
int32_t uiCpuCores = 0;
|
||||
WelsCPUFeatureDetect (&uiCpuCores); // detect cpu capacity features
|
||||
pSpatialLayer->sSliceArgument.uiSliceNum = uiCpuCores;
|
||||
|
||||
if (uiCpuCores <= 1) {
|
||||
WelsLog (pLogCtx, WELS_LOG_INFO, "ParamValidationExt(), uiCpuCores = 1, switched to SM_SINGLE_SLICE");
|
||||
pSpatialLayer->sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pSpatialLayer->sSliceArgument.uiSliceNum = 1;
|
||||
pSpatialLayer->sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
for (iIdx = 0; iIdx < MAX_SLICES_NUM; iIdx++) {
|
||||
pSpatialLayer->sSliceArgument.uiSliceMbNum[iIdx] = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pSpatialLayer->sSliceArgument.uiSliceNum > iMaxSliceNum) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings!",
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum);
|
||||
pSpatialLayer->sSliceArgument.uiSliceNum);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum == 1) {
|
||||
if (pSpatialLayer->sSliceArgument.uiSliceNum == 1) {
|
||||
WelsLog (pLogCtx, WELS_LOG_DEBUG,
|
||||
"ParamValidationExt(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type!",
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum);
|
||||
pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pSpatialLayer->sSliceArgument.uiSliceNum);
|
||||
pSpatialLayer->sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
break;
|
||||
}
|
||||
if (pCodingParam->iRCMode != RC_OFF_MODE) { // multiple slices verify with gom
|
||||
//check uiSliceNum and set uiSliceMbNum with current uiSliceNum
|
||||
if (!GomValidCheckSliceNum (iMbWidth, iMbHeight, &pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum)) {
|
||||
if (!GomValidCheckSliceNum (iMbWidth, iMbHeight, &pSpatialLayer->sSliceArgument.uiSliceNum)) {
|
||||
WelsLog (pLogCtx, WELS_LOG_WARNING,
|
||||
"ParamValidationExt(), unsupported setting with Resolution and uiSliceNum combination under RC on! So uiSliceNum is changed to %d!",
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum);
|
||||
pSpatialLayer->sSliceArgument.uiSliceNum);
|
||||
}
|
||||
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 1 ||
|
||||
!GomValidCheckSliceMbNum (iMbWidth, iMbHeight, &pSpatialLayer->sSliceCfg.sSliceArgument)) {
|
||||
if (pSpatialLayer->sSliceArgument.uiSliceNum <= 1 ||
|
||||
!GomValidCheckSliceMbNum (iMbWidth, iMbHeight, &pSpatialLayer->sSliceArgument)) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR,
|
||||
"ParamValidationExt(), unsupported setting with Resolution and uiSliceNum (%d) combination under RC on! Consider setting single slice with this resolution!",
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum);
|
||||
pSpatialLayer->sSliceArgument.uiSliceNum);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
assert (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > 1);
|
||||
assert (pSpatialLayer->sSliceArgument.uiSliceNum > 1);
|
||||
} else if (!CheckFixedSliceNumMultiSliceSetting (iMbNumInFrame,
|
||||
&pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
|
||||
&pSpatialLayer->sSliceArgument)) { // verify interleave mode settings
|
||||
//check uiSliceMbNum with current uiSliceNum
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
|
||||
pSpatialLayer->sSliceArgument.uiSliceMbNum[0]);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
// considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting
|
||||
if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) {
|
||||
pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = 1;
|
||||
pSpatialLayer->sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pSpatialLayer->sSliceArgument.uiSliceNum = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SM_AUTO_SLICE: {
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
}
|
||||
break;
|
||||
case SM_RASTER_SLICE: {
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
pSpatialLayer->sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
|
||||
iMbWidth = (kiPicWidth + 15) >> 4;
|
||||
iMbHeight = (kiPicHeight + 15) >> 4;
|
||||
iMbNumInFrame = iMbWidth * iMbHeight;
|
||||
iMaxSliceNum = MAX_SLICES_NUM;
|
||||
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0] <= 0) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
if (pSpatialLayer->sSliceArgument.uiSliceMbNum[0] == 0) {
|
||||
if (iMbHeight > iMaxSliceNum) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings more than MAX(%d)!",
|
||||
iMbHeight, MAX_SLICES_NUM);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
pSpatialLayer->sSliceArgument.uiSliceNum = iMbHeight;
|
||||
for (uint32_t j=0; j<iMbHeight; j++) {
|
||||
pSpatialLayer->sSliceArgument.uiSliceMbNum[j] = iMbWidth;
|
||||
}
|
||||
if (!CheckRowMbMultiSliceSetting (iMbWidth,
|
||||
&pSpatialLayer->sSliceArgument)) { // verify interleave mode settings
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
|
||||
pSpatialLayer->sSliceArgument.uiSliceMbNum[0]);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!CheckRasterMultiSliceSetting (iMbNumInFrame,
|
||||
&pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
|
||||
&pSpatialLayer->sSliceArgument)) { // verify interleave mode settings
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
|
||||
pSpatialLayer->sSliceArgument.uiSliceMbNum[0]);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 0
|
||||
|| pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { // verify interleave mode settings
|
||||
if (pSpatialLayer->sSliceArgument.uiSliceNum <= 0
|
||||
|| pSpatialLayer->sSliceArgument.uiSliceNum > iMaxSliceNum) { // verify interleave mode settings
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) in SM_RASTER_SLICE settings!",
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum);
|
||||
pSpatialLayer->sSliceArgument.uiSliceNum);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum == 1) {
|
||||
if (pSpatialLayer->sSliceArgument.uiSliceNum == 1) {
|
||||
WelsLog (pLogCtx, WELS_LOG_WARNING,
|
||||
"ParamValidationExt(), pSlice setting for SM_RASTER_SLICE now turn to SM_SINGLE_SLICE!");
|
||||
pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pSpatialLayer->sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
break;
|
||||
}
|
||||
if ((pCodingParam->iRCMode != RC_OFF_MODE) && pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > 1) {
|
||||
if ((pCodingParam->iRCMode != RC_OFF_MODE) && pSpatialLayer->sSliceArgument.uiSliceNum > 1) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), WARNING: GOM based RC do not support SM_RASTER_SLICE!");
|
||||
}
|
||||
// considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting
|
||||
if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) {
|
||||
pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = 1;
|
||||
pSpatialLayer->sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pSpatialLayer->sSliceArgument.uiSliceNum = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SM_ROWMB_SLICE: {
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
|
||||
case SM_SIZELIMITED_SLICE: {
|
||||
iMbWidth = (kiPicWidth + 15) >> 4;
|
||||
iMbHeight = (kiPicHeight + 15) >> 4;
|
||||
iMaxSliceNum = MAX_SLICES_NUM;
|
||||
if (iMbHeight > iMaxSliceNum) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings more than MAX(%d)!",
|
||||
iMbHeight, MAX_SLICES_NUM);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = iMbHeight;
|
||||
|
||||
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 0) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings!",
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
if (!CheckRowMbMultiSliceSetting (iMbWidth,
|
||||
&pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SM_DYN_SLICE: {
|
||||
iMbWidth = (kiPicWidth + 15) >> 4;
|
||||
iMbHeight = (kiPicHeight + 15) >> 4;
|
||||
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint <= 0) {
|
||||
if (pSpatialLayer->sSliceArgument.uiSliceSizeConstraint <= 0) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid iSliceSize (%d) settings!",
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint);
|
||||
pSpatialLayer->sSliceArgument.uiSliceSizeConstraint);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
|
||||
@ -574,19 +572,19 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
|
||||
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint > (pCodingParam->uiMaxNalSize -
|
||||
if (pSpatialLayer->sSliceArgument.uiSliceSizeConstraint > (pCodingParam->uiMaxNalSize -
|
||||
NAL_HEADER_ADD_0X30BYTES)) {
|
||||
WelsLog (pLogCtx, WELS_LOG_WARNING,
|
||||
"ParamValidationExt(), slice mode = SM_DYN_SLICE, uiSliceSizeConstraint = %d ,uiMaxNalsize = %d, will take uiMaxNalsize!",
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint, pCodingParam->uiMaxNalSize);
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = pCodingParam->uiMaxNalSize - NAL_HEADER_ADD_0X30BYTES;
|
||||
"ParamValidationExt(), slice mode = SM_SIZELIMITED_SLICE, uiSliceSizeConstraint = %d ,uiMaxNalsize = %d, will take uiMaxNalsize!",
|
||||
pSpatialLayer->sSliceArgument.uiSliceSizeConstraint, pCodingParam->uiMaxNalSize);
|
||||
pSpatialLayer->sSliceArgument.uiSliceSizeConstraint = pCodingParam->uiMaxNalSize - NAL_HEADER_ADD_0X30BYTES;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMode (%d) settings!",
|
||||
pCodingParam->sSpatialLayers[0].sSliceCfg.uiSliceMode);
|
||||
pCodingParam->sSpatialLayers[0].sSliceArgument.uiSliceMode);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
|
||||
}
|
||||
@ -696,7 +694,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara
|
||||
//Review this part and suggest no change, since the memory over-use
|
||||
//(1) counts little to the overall performance
|
||||
//(2) should not be critial even under mobile case
|
||||
if (SM_DYN_SLICE == pDLayer->sSliceCfg.uiSliceMode) {
|
||||
if (SM_SIZELIMITED_SLICE == pDLayer->sSliceArgument.uiSliceMode) {
|
||||
iCountNumNals += MAX_SLICES_NUM;
|
||||
// plus prefix NALs
|
||||
if (iDIndex == 0)
|
||||
@ -708,10 +706,10 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara
|
||||
iCountNumNals, iOrgNumNals, iDIndex, MAX_NAL_UNITS_IN_LAYER);
|
||||
return 1;
|
||||
}
|
||||
} else { /*if ( SM_SINGLE_SLICE != pDLayer->sSliceCfg.uiSliceMode )*/
|
||||
} else { /*if ( SM_SINGLE_SLICE != pDLayer->sSliceArgument.uiSliceMode )*/
|
||||
const int32_t kiNumOfSlice = GetInitialSliceNum ((pDLayer->iVideoWidth + 0x0f) >> 4,
|
||||
(pDLayer->iVideoHeight + 0x0f) >> 4,
|
||||
&pDLayer->sSliceCfg);
|
||||
&pDLayer->sSliceArgument);
|
||||
|
||||
// NEED check iCountNals value in case multiple slices is used
|
||||
iCountNumNals += kiNumOfSlice; // for pSlice VCL NALs
|
||||
@ -1159,7 +1157,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p
|
||||
const int32_t kiMbW = (pDlayer->iVideoWidth + 0x0f) >> 4;
|
||||
const int32_t kiMbH = (pDlayer->iVideoHeight + 0x0f) >> 4;
|
||||
int32_t iMaxSliceNum = 1;
|
||||
const int32_t kiSliceNum = GetInitialSliceNum (kiMbW, kiMbH, &pDlayer->sSliceCfg);
|
||||
const int32_t kiSliceNum = GetInitialSliceNum (kiMbW, kiMbH, &pDlayer->sSliceArgument);
|
||||
if (iMaxSliceNum < kiSliceNum)
|
||||
iMaxSliceNum = kiSliceNum;
|
||||
|
||||
@ -1168,7 +1166,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p
|
||||
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pDqLayer), FreeMemorySvc (ppCtx))
|
||||
|
||||
// for dynamic slicing mode
|
||||
if (SM_DYN_SLICE == pDlayer->sSliceCfg.uiSliceMode) {
|
||||
if (SM_SIZELIMITED_SLICE == pDlayer->sSliceArgument.uiSliceMode) {
|
||||
const int32_t iSize = pParam->iCountThreadsNum * sizeof (int32_t);
|
||||
|
||||
pDqLayer->pNumSliceCodedOfPartition = (int32_t*)pMa->WelsMallocz (iSize, "pNumSliceCodedOfPartition");
|
||||
@ -1201,7 +1199,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p
|
||||
pDqLayer->bDeblockingParallelFlag = pParam->bDeblockingParallelFlag;
|
||||
|
||||
//deblocking parameter adjustment
|
||||
if (SM_SINGLE_SLICE == pDlayer->sSliceCfg.uiSliceMode) {
|
||||
if (SM_SINGLE_SLICE == pDlayer->sSliceArgument.uiSliceMode) {
|
||||
//iLoopFilterDisableIdc: will be 0 or 1 under single_slice
|
||||
if (2 == pParam->iLoopFilterDisableIdc) {
|
||||
pDqLayer->iLoopFilterDisableIdc = 0;
|
||||
@ -1368,7 +1366,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p
|
||||
false,
|
||||
pSps->iMbWidth,
|
||||
pSps->iMbHeight,
|
||||
& (pDlayerParam->sSliceCfg),
|
||||
& (pDlayerParam->sSliceArgument),
|
||||
pPps);
|
||||
if (iResult) {
|
||||
WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "InitDqLayers(), InitSlicePEncCtx failed(%d)!", iResult);
|
||||
@ -1776,16 +1774,16 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa
|
||||
iLayerBsSize = WELS_ALIGN (iLayerBsSize, 4); // 4 bytes alinged
|
||||
iVclLayersBsSizeCount += iLayerBsSize;
|
||||
|
||||
SSliceConfig* pMso = & (fDlp->sSliceCfg);
|
||||
if (pMso->uiSliceMode == SM_DYN_SLICE) {
|
||||
SSliceArgument* pSliceArgument = & (fDlp->sSliceArgument);
|
||||
if (pSliceArgument->uiSliceMode == SM_SIZELIMITED_SLICE) {
|
||||
bDynamicSlice = true;
|
||||
uiMaxSliceNumEstimation = WELS_MIN (AVERSLICENUM_CONSTRAINT,
|
||||
(iLayerBsSize / pMso->sSliceArgument.uiSliceSizeConstraint) + 1);
|
||||
(iLayerBsSize / pSliceArgument->uiSliceSizeConstraint) + 1);
|
||||
(*ppCtx)->iMaxSliceCount = WELS_MAX ((*ppCtx)->iMaxSliceCount, (int) uiMaxSliceNumEstimation);
|
||||
iSliceBufferSize = (WELS_MAX(pMso->sSliceArgument.uiSliceSizeConstraint, iLayerBsSize/uiMaxSliceNumEstimation)<<1) + MAX_MACROBLOCK_SIZE_IN_BYTE_x2;
|
||||
iSliceBufferSize = (WELS_MAX(pSliceArgument->uiSliceSizeConstraint, iLayerBsSize/uiMaxSliceNumEstimation)<<1) + MAX_MACROBLOCK_SIZE_IN_BYTE_x2;
|
||||
} else {
|
||||
(*ppCtx)->iMaxSliceCount = WELS_MAX ((*ppCtx)->iMaxSliceCount, (int) pMso->sSliceArgument.uiSliceNum);
|
||||
iSliceBufferSize = ((iLayerBsSize / pMso->sSliceArgument.uiSliceNum)<<1) + MAX_MACROBLOCK_SIZE_IN_BYTE_x2;
|
||||
(*ppCtx)->iMaxSliceCount = WELS_MAX ((*ppCtx)->iMaxSliceCount, (int) pSliceArgument->uiSliceNum);
|
||||
iSliceBufferSize = ((iLayerBsSize / pSliceArgument->uiSliceNum)<<1) + MAX_MACROBLOCK_SIZE_IN_BYTE_x2;
|
||||
}
|
||||
iMaxSliceBufferSize = WELS_MAX(iMaxSliceBufferSize, iSliceBufferSize);
|
||||
|
||||
@ -2090,14 +2088,14 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) {
|
||||
SDqLayer* pDq = pCtx->ppDqLayerList[ilayer];
|
||||
SSpatialLayerConfig* pDlp = &pCtx->pSvcParam->sSpatialLayers[ilayer];
|
||||
|
||||
const bool kbIsDynamicSlicing = (SM_DYN_SLICE == pDlp->sSliceCfg.uiSliceMode);
|
||||
const bool kbIsDynamicSlicing = (SM_SIZELIMITED_SLICE == pDlp->sSliceArgument.uiSliceMode);
|
||||
|
||||
// pDq layers
|
||||
if (NULL != pDq) {
|
||||
if (NULL != pDq->sLayerInfo.pSliceInLayer) {
|
||||
int32_t iSliceIdx = 0;
|
||||
int32_t iSliceNum = GetInitialSliceNum (pDq->iMbWidth, pDq->iMbHeight, &pDlp->sSliceCfg);
|
||||
if (pDlp->sSliceCfg.uiSliceMode == SM_DYN_SLICE && pCtx->iActiveThreadsNum == 1) {
|
||||
int32_t iSliceNum = GetInitialSliceNum (pDq->iMbWidth, pDq->iMbHeight, &pDlp->sSliceArgument);
|
||||
if (pDlp->sSliceArgument.uiSliceMode == SM_SIZELIMITED_SLICE && pCtx->iActiveThreadsNum == 1) {
|
||||
if (iSliceNum < pDq->pSliceEncCtx->iMaxSliceNumConstraint) {
|
||||
iSliceNum = pDq->pSliceEncCtx->iMaxSliceNumConstraint;
|
||||
}
|
||||
@ -2248,29 +2246,93 @@ int32_t InitSliceSettings (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPar
|
||||
|
||||
do {
|
||||
SSpatialLayerConfig* pDlp = &pCodingParam->sSpatialLayers[iSpatialIdx];
|
||||
SSliceConfig* pMso = &pDlp->sSliceCfg;
|
||||
SSliceArgument* pSlcArg = &pMso->sSliceArgument;
|
||||
SSliceArgument* pSliceArgument = &pDlp->sSliceArgument;
|
||||
const int32_t kiMbWidth = (pDlp->iVideoWidth + 15) >> 4;
|
||||
const int32_t kiMbHeight = (pDlp->iVideoHeight + 15) >> 4;
|
||||
const int32_t kiMbNumInFrame = kiMbWidth * kiMbHeight;
|
||||
int32_t iSliceNum = (SM_AUTO_SLICE == pMso->uiSliceMode) ? kiCpuCores : pSlcArg->uiSliceNum;
|
||||
int32_t iSliceNum = (SM_FIXEDSLCNUM_SLICE == pSliceArgument->uiSliceMode && 0==pSliceArgument->uiSliceNum) ? kiCpuCores : pSliceArgument->uiSliceNum;
|
||||
// NOTE: Per design, in case MT/DYNAMIC_SLICE_ASSIGN enabled, for SM_FIXEDSLCNUM_SLICE mode,
|
||||
// uiSliceNum of current spatial layer settings equals to uiCpuCores number; SM_DYN_SLICE mode,
|
||||
// uiSliceNum of current spatial layer settings equals to uiCpuCores number; SM_SIZELIMITED_SLICE mode,
|
||||
// uiSliceNum intials as uiCpuCores also, stay tuned dynamically slicing in future
|
||||
pSlcArg->uiSliceNum = iSliceNum; // used fixed one
|
||||
pSliceArgument->uiSliceNum = iSliceNum; // used fixed one
|
||||
|
||||
switch (pMso->uiSliceMode) {
|
||||
case SM_DYN_SLICE:
|
||||
switch (pSliceArgument->uiSliceMode) {
|
||||
case SM_SIZELIMITED_SLICE:
|
||||
iMaxSliceCount = AVERSLICENUM_CONSTRAINT;
|
||||
break; // go through for SM_DYN_SLICE?
|
||||
break; // go through for SM_SIZELIMITED_SLICE?
|
||||
case SM_FIXEDSLCNUM_SLICE:
|
||||
if (iSliceNum > iMaxSliceCount)
|
||||
if (iSliceNum > iMaxSliceCount) {
|
||||
iMaxSliceCount = iSliceNum;
|
||||
}
|
||||
if (0==iSliceNum) {
|
||||
//the auto slice num logic
|
||||
pDlp->sSliceArgument.uiSliceNum = kiCpuCores;
|
||||
|
||||
if (0==kiCpuCores){
|
||||
int32_t uiCpuCores = 0;
|
||||
WelsCPUFeatureDetect (&uiCpuCores); // detect cpu capacity features
|
||||
pDlp->sSliceArgument.uiSliceNum = uiCpuCores;
|
||||
|
||||
if (uiCpuCores == 1) {
|
||||
WelsLog (pLogCtx, WELS_LOG_INFO, "InitSliceSettings(), uiCpuCores = 1, switched to SM_SINGLE_SLICE");
|
||||
pDlp->sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pDlp->sSliceArgument.uiSliceNum = 1;
|
||||
pDlp->sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
for (int32_t iIdx = 0; iIdx < MAX_SLICES_NUM; iIdx++) {
|
||||
pDlp->sSliceArgument.uiSliceMbNum[iIdx] = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pDlp->sSliceArgument.uiSliceNum == 1) {
|
||||
WelsLog (pLogCtx, WELS_LOG_DEBUG,
|
||||
"InitSliceSettings(), uiSliceNum(%d) you set for SM_AUTO_SLICE, now turn to SM_SINGLE_SLICE type!",
|
||||
pDlp->sSliceArgument.uiSliceNum);
|
||||
pDlp->sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (pDlp->sSliceArgument.uiSliceNum > MAX_SLICES_NUM) {
|
||||
pDlp->sSliceArgument.uiSliceNum = MAX_SLICES_NUM;
|
||||
}
|
||||
iMaxSliceCount = WELS_MAX(iMaxSliceCount, pDlp->sSliceArgument.uiSliceNum);
|
||||
|
||||
if (pCodingParam->iRCMode != RC_OFF_MODE) { // multiple slices verify with gom
|
||||
//check uiSliceNum and set uiSliceMbNum with current uiSliceNum
|
||||
if (!GomValidCheckSliceNum (kiMbWidth, kiMbHeight, &pDlp->sSliceArgument.uiSliceNum)) {
|
||||
WelsLog (pLogCtx, WELS_LOG_WARNING,
|
||||
"InitSliceSettings(), unsupported setting with Resolution and uiSliceNum combination under RC on! So uiSliceNum is changed to %d!",
|
||||
pDlp->sSliceArgument.uiSliceNum);
|
||||
}
|
||||
if (pDlp->sSliceArgument.uiSliceNum <= 1 ||
|
||||
!GomValidCheckSliceMbNum (kiMbWidth, kiMbHeight, &pDlp->sSliceArgument)) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR,
|
||||
"InitSliceSettings(), unsupported setting with Resolution and uiSliceNum (%d) combination under RC on! Consider setting single slice with this resolution!",
|
||||
pDlp->sSliceArgument.uiSliceNum);
|
||||
return ENC_RETURN_INVALIDINPUT;
|
||||
}
|
||||
} else if (!CheckFixedSliceNumMultiSliceSetting (kiMbNumInFrame,
|
||||
&pDlp->sSliceArgument)) { // verify interleave mode settings
|
||||
//check uiSliceMbNum with current uiSliceNum
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR,
|
||||
"InitSliceSettings(), invalid uiSliceMbNum (%d) settings!,now turn to SM_SINGLE_SLICE type",
|
||||
pDlp->sSliceArgument.uiSliceMbNum[0]);
|
||||
pDlp->sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pDlp->sSliceArgument.uiSliceNum = 1;
|
||||
}
|
||||
// considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting
|
||||
if (kiMbNumInFrame <= MIN_NUM_MB_PER_SLICE) {
|
||||
pDlp->sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pDlp->sSliceArgument.uiSliceNum = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// need perform check due uiSliceNum might change, although has been initialized somewhere outside
|
||||
if (pCodingParam->iRCMode != RC_OFF_MODE) {
|
||||
GomValidCheckSliceMbNum (kiMbWidth, kiMbHeight, pSlcArg);
|
||||
GomValidCheckSliceMbNum (kiMbWidth, kiMbHeight, pSliceArgument);
|
||||
} else {
|
||||
CheckFixedSliceNumMultiSliceSetting (kiMbNumInFrame, pSlcArg);
|
||||
CheckFixedSliceNumMultiSliceSetting (kiMbNumInFrame, pSliceArgument);
|
||||
}
|
||||
break;
|
||||
case SM_SINGLE_SLICE:
|
||||
@ -2281,53 +2343,6 @@ int32_t InitSliceSettings (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPar
|
||||
if (iSliceNum > iMaxSliceCount)
|
||||
iMaxSliceCount = iSliceNum;
|
||||
break;
|
||||
case SM_ROWMB_SLICE:
|
||||
if (iSliceNum > iMaxSliceCount)
|
||||
iMaxSliceCount = iSliceNum;
|
||||
break;
|
||||
case SM_AUTO_SLICE:
|
||||
pDlp->sSliceCfg.sSliceArgument.uiSliceNum = kiCpuCores;
|
||||
if (pDlp->sSliceCfg.sSliceArgument.uiSliceNum > MAX_SLICES_NUM) {
|
||||
pDlp->sSliceCfg.sSliceArgument.uiSliceNum = MAX_SLICES_NUM;
|
||||
}
|
||||
iMaxSliceCount = WELS_MAX(iMaxSliceCount, pDlp->sSliceCfg.sSliceArgument.uiSliceNum);
|
||||
if (pDlp->sSliceCfg.sSliceArgument.uiSliceNum == 1) {
|
||||
WelsLog (pLogCtx, WELS_LOG_DEBUG,
|
||||
"InitSliceSettings(), uiSliceNum(%d) you set for SM_AUTO_SLICE, now turn to SM_SINGLE_SLICE type!",
|
||||
pDlp->sSliceCfg.sSliceArgument.uiSliceNum);
|
||||
pDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
break;
|
||||
}
|
||||
if (pCodingParam->iRCMode != RC_OFF_MODE) { // multiple slices verify with gom
|
||||
//check uiSliceNum and set uiSliceMbNum with current uiSliceNum
|
||||
if (!GomValidCheckSliceNum (kiMbWidth, kiMbHeight, &pDlp->sSliceCfg.sSliceArgument.uiSliceNum)) {
|
||||
WelsLog (pLogCtx, WELS_LOG_WARNING,
|
||||
"ParamValidationExt(), unsupported setting with Resolution and uiSliceNum combination under RC on! So uiSliceNum is changed to %d!",
|
||||
pDlp->sSliceCfg.sSliceArgument.uiSliceNum);
|
||||
}
|
||||
if (pDlp->sSliceCfg.sSliceArgument.uiSliceNum <= 1 ||
|
||||
!GomValidCheckSliceMbNum (kiMbWidth, kiMbHeight, &pDlp->sSliceCfg.sSliceArgument)) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR,
|
||||
"ParamValidationExt(), unsupported setting with Resolution and uiSliceNum (%d) combination under RC on! Consider setting single slice with this resolution!",
|
||||
pDlp->sSliceCfg.sSliceArgument.uiSliceNum);
|
||||
return ENC_RETURN_INVALIDINPUT;
|
||||
}
|
||||
} else if (!CheckFixedSliceNumMultiSliceSetting (kiMbNumInFrame,
|
||||
&pDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
|
||||
//check uiSliceMbNum with current uiSliceNum
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR,
|
||||
"InitSliceSettings(), invalid uiSliceMbNum (%d) settings!,now turn to SM_SINGLE_SLICE type",
|
||||
pDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
|
||||
pDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1;
|
||||
}
|
||||
// considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting
|
||||
if (kiMbNumInFrame <= MIN_NUM_MB_PER_SLICE) {
|
||||
pDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -2858,8 +2873,8 @@ void WelsInitCurrentLayer (sWelsEncCtx* pCtx,
|
||||
|
||||
pCurDq->pDecPic = pDecPic;
|
||||
|
||||
if (fDlp->sSliceCfg.uiSliceMode == SM_DYN_SLICE) // need get extra slices for update
|
||||
iSliceCount = GetInitialSliceNum (pCurDq->iMbWidth, pCurDq->iMbHeight, &fDlp->sSliceCfg);
|
||||
if (fDlp->sSliceArgument.uiSliceMode == SM_SIZELIMITED_SLICE) // need get extra slices for update
|
||||
iSliceCount = GetInitialSliceNum (pCurDq->iMbWidth, pCurDq->iMbHeight, &fDlp->sSliceArgument);
|
||||
else
|
||||
iSliceCount = GetCurrentSliceNum (pCurDq->pSliceEncCtx);
|
||||
assert (iSliceCount > 0);
|
||||
@ -3869,17 +3884,17 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
||||
iDidList[iSpatialIdx] = iCurDid;
|
||||
|
||||
// Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed
|
||||
switch (pParam->sSliceCfg.uiSliceMode) {
|
||||
case SM_FIXEDSLCNUM_SLICE:
|
||||
case SM_AUTO_SLICE: {
|
||||
switch (pParam->sSliceArgument.uiSliceMode) {
|
||||
case SM_FIXEDSLCNUM_SLICE: {
|
||||
if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) &&
|
||||
(pSvcParam->sSpatialLayers[iCurDid].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE
|
||||
&& pSvcParam->iMultipleThreadIdc >= pSvcParam->sSpatialLayers[iCurDid].sSliceCfg.sSliceArgument.uiSliceNum)
|
||||
(pSvcParam->sSpatialLayers[iCurDid].sSliceArgument.uiSliceMode == SM_FIXEDSLCNUM_SLICE
|
||||
&& pSvcParam->bUseLoadBalancing
|
||||
&& pSvcParam->iMultipleThreadIdc >= pSvcParam->sSpatialLayers[iCurDid].sSliceArgument.uiSliceNum)
|
||||
)
|
||||
AdjustEnhanceLayer (pCtx, iCurDid);
|
||||
break;
|
||||
}
|
||||
case SM_DYN_SLICE: {
|
||||
case SM_SIZELIMITED_SLICE: {
|
||||
int32_t iPicIPartitionNum = PicPartitionNumDecision (pCtx);
|
||||
// MT compatibility
|
||||
pCtx->iActiveThreadsNum =
|
||||
@ -3961,7 +3976,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
||||
//TODO Complexity Calculation here for screen content
|
||||
iLayerSize = 0;
|
||||
|
||||
if (SM_SINGLE_SLICE == pParam->sSliceCfg.uiSliceMode) { // only one slice within a sQualityStat layer
|
||||
if (SM_SINGLE_SLICE == pParam->sSliceArgument.uiSliceMode) { // only one slice within a sQualityStat layer
|
||||
int32_t iSliceSize = 0;
|
||||
int32_t iPayloadSize = 0;
|
||||
|
||||
@ -4002,7 +4017,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
||||
pLayerBsInfo->iNalCount = ++ iNalIdxInLayer;
|
||||
}
|
||||
// for dynamic slicing single threading..
|
||||
else if ((SM_DYN_SLICE == pParam->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) {
|
||||
else if ((SM_SIZELIMITED_SLICE == pParam->sSliceArgument.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) {
|
||||
const int32_t kiLastMbInFrame = pCtx->pCurDqLayer->pSliceEncCtx->iMbNumInFrame;
|
||||
pCtx->iEncoderError = WelsCodeOnePicPartition (pCtx, pFbi, pLayerBsInfo, &iNalIdxInLayer, &iLayerSize, 0,
|
||||
kiLastMbInFrame, 0);
|
||||
@ -4010,14 +4025,13 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
||||
} else {
|
||||
//other multi-slice uiSliceMode
|
||||
int32_t iRet = 0;
|
||||
// THREAD_FULLY_FIRE_MODE/THREAD_PICK_UP_MODE for any mode of non-SM_DYN_SLICE
|
||||
if ((SM_DYN_SLICE != pParam->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
|
||||
|
||||
// THREAD_FULLY_FIRE_MODE/THREAD_PICK_UP_MODE for any mode of non-SM_SIZELIMITED_SLICE
|
||||
if ((SM_SIZELIMITED_SLICE != pParam->sSliceArgument.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
|
||||
iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx);
|
||||
if (iLayerNum + 1 >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info for further writing as followed
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR,
|
||||
"WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d) at iDid= %d uiSliceMode= %d, iSliceCount= %d!",
|
||||
iLayerNum, MAX_LAYER_NUM_OF_FRAME, iCurDid, pParam->sSliceCfg.uiSliceMode, iSliceCount);
|
||||
iLayerNum, MAX_LAYER_NUM_OF_FRAME, iCurDid, pParam->sSliceArgument.uiSliceMode, iSliceCount);
|
||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||
}
|
||||
if (iSliceCount <= 1) {
|
||||
@ -4038,8 +4052,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
||||
pCtx->pTaskManage->ExecuteTasks();
|
||||
iLayerSize = AppendSliceToFrameBs (pCtx, pLayerBsInfo, iSliceCount);
|
||||
}
|
||||
// THREAD_FULLY_FIRE_MODE && SM_DYN_SLICE
|
||||
else if ((SM_DYN_SLICE == pParam->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
|
||||
// THREAD_FULLY_FIRE_MODE && SM_SIZELIMITED_SLICE
|
||||
else if ((SM_SIZELIMITED_SLICE == pParam->sSliceArgument.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
|
||||
const int32_t kiPartitionCnt = pCtx->iActiveThreadsNum; //pSvcParam->iCountThreadsNum;
|
||||
|
||||
// to fire slice coding threads
|
||||
@ -4050,7 +4064,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
||||
if (iRet) {
|
||||
WelsLog (pLogCtx, WELS_LOG_ERROR,
|
||||
"[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!",
|
||||
iRet, pSvcParam->iCountThreadsNum, iSliceCount, pParam->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc);
|
||||
iRet, pSvcParam->iCountThreadsNum, iSliceCount, pParam->sSliceArgument.uiSliceMode, pSvcParam->iMultipleThreadIdc);
|
||||
return ENC_RETURN_UNEXPECTED;
|
||||
}
|
||||
|
||||
@ -4295,9 +4309,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
||||
iFrameSize += iPaddingNalSize;
|
||||
}
|
||||
|
||||
if ((pParam->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE || pParam->sSliceCfg.uiSliceMode == SM_AUTO_SLICE)
|
||||
if ((pParam->sSliceArgument.uiSliceMode == SM_FIXEDSLCNUM_SLICE)
|
||||
&& pSvcParam->bUseLoadBalancing
|
||||
&& pSvcParam->iMultipleThreadIdc > 1 &&
|
||||
pSvcParam->iMultipleThreadIdc >= pParam->sSliceCfg.sSliceArgument.uiSliceNum) {
|
||||
pSvcParam->iMultipleThreadIdc >= pParam->sSliceArgument.uiSliceNum) {
|
||||
CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], pCtx->pCurDqLayer->pSliceEncCtx,
|
||||
pCtx->pSliceThreading->pSliceConsumeTime[iCurDid]);
|
||||
#if defined(MT_DEBUG)
|
||||
@ -4342,13 +4357,12 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
||||
#endif//MT_DEBUG
|
||||
|
||||
if (pSvcParam->iMultipleThreadIdc > 1 && iDidList[0] == BASE_DEPENDENCY_ID
|
||||
&& ((pSvcParam->sSpatialLayers[0].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)
|
||||
|| (pSvcParam->sSpatialLayers[0].sSliceCfg.uiSliceMode == SM_AUTO_SLICE))
|
||||
&& pSvcParam->iMultipleThreadIdc >= pSvcParam->sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceNum
|
||||
&& ((pSvcParam->sSpatialLayers[iDidList[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)
|
||||
|| (pSvcParam->sSpatialLayers[iDidList[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_AUTO_SLICE))
|
||||
&& (pSvcParam->sSpatialLayers[0].sSliceArgument.uiSliceMode == SM_FIXEDSLCNUM_SLICE)
|
||||
&& pSvcParam->bUseLoadBalancing
|
||||
&& pSvcParam->iMultipleThreadIdc >= pSvcParam->sSpatialLayers[0].sSliceArgument.uiSliceNum
|
||||
&& ((pSvcParam->sSpatialLayers[iDidList[iSpatialNum - 1]].sSliceArgument.uiSliceMode == SM_FIXEDSLCNUM_SLICE))
|
||||
&& pSvcParam->iMultipleThreadIdc >= pSvcParam->sSpatialLayers[iDidList[iSpatialNum -
|
||||
1]].sSliceCfg.sSliceArgument.uiSliceNum) {
|
||||
1]].sSliceArgument.uiSliceNum) {
|
||||
AdjustBaseLayer (pCtx);
|
||||
}
|
||||
|
||||
@ -4483,10 +4497,10 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa
|
||||
break;
|
||||
}
|
||||
|
||||
if (pOldParam->sSpatialLayers[iIndexD].sSliceCfg.uiSliceMode != pNewParam->sSpatialLayers[iIndexD].sSliceCfg.uiSliceMode
|
||||
if (pOldParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceMode != pNewParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceMode
|
||||
||
|
||||
pOldParam->sSpatialLayers[iIndexD].sSliceCfg.sSliceArgument.uiSliceNum !=
|
||||
pNewParam->sSpatialLayers[iIndexD].sSliceCfg.sSliceArgument.uiSliceNum) {
|
||||
pOldParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceNum !=
|
||||
pNewParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceNum) {
|
||||
bNeedReset = true;
|
||||
break;
|
||||
}
|
||||
|
@ -169,9 +169,8 @@ void RcInitSequenceParameter (sWelsEncCtx* pEncCtx) {
|
||||
|
||||
RcInitLayerMemory (pWelsSvcRc, pEncCtx->pMemAlign, 1 + pEncCtx->pSvcParam->sDependencyLayers[j].iHighestTemporalId);
|
||||
|
||||
bMultiSliceMode = ((SM_RASTER_SLICE == pDLayerParam->sSliceCfg.uiSliceMode) ||
|
||||
(SM_ROWMB_SLICE == pDLayerParam->sSliceCfg.uiSliceMode) ||
|
||||
(SM_DYN_SLICE == pDLayerParam->sSliceCfg.uiSliceMode));
|
||||
bMultiSliceMode = ((SM_RASTER_SLICE == pDLayerParam->sSliceArgument.uiSliceMode) ||
|
||||
(SM_SIZELIMITED_SLICE == pDLayerParam->sSliceArgument.uiSliceMode));
|
||||
if (bMultiSliceMode)
|
||||
pWelsSvcRc->iNumberMbGom = pWelsSvcRc->iNumberMbFrame;
|
||||
}
|
||||
|
@ -360,11 +360,12 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara
|
||||
|
||||
iIdx = 0;
|
||||
while (iIdx < iNumSpatialLayers) {
|
||||
SSliceConfig* pMso = &pPara->sSpatialLayers[iIdx].sSliceCfg;
|
||||
const int32_t kiSliceNum = pMso->sSliceArgument.uiSliceNum;
|
||||
if (((pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pMso->uiSliceMode == SM_AUTO_SLICE))
|
||||
&& pPara->iMultipleThreadIdc > 1
|
||||
&& pPara->iMultipleThreadIdc >= kiSliceNum) {
|
||||
SSliceArgument* pSliceArgument = &pPara->sSpatialLayers[iIdx].sSliceArgument;
|
||||
const int32_t kiSliceNum = pSliceArgument->uiSliceNum;
|
||||
if ((pSliceArgument->uiSliceMode == SM_FIXEDSLCNUM_SLICE)
|
||||
&& (pPara->bUseLoadBalancing)
|
||||
&& (pPara->iMultipleThreadIdc > 1)
|
||||
&& (pPara->iMultipleThreadIdc >= kiSliceNum)) {
|
||||
pSmt->pSliceConsumeTime[iIdx] = (uint32_t*)pMa->WelsMallocz (kiSliceNum * sizeof (uint32_t), "pSliceConsumeTime[]");
|
||||
WELS_VERIFY_RETURN_PROC_IF (1, (NULL == pSmt->pSliceConsumeTime[iIdx]), FreeMemorySvc (ppCtx))
|
||||
pSmt->pSliceComplexRatio[iIdx] = (int32_t*)pMa->WelsMalloc (kiSliceNum * sizeof (int32_t), "pSliceComplexRatio[]");
|
||||
@ -374,8 +375,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara
|
||||
pSmt->pSliceComplexRatio[iIdx] = NULL;
|
||||
}
|
||||
|
||||
if ( pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE || pMso->uiSliceMode == SM_RASTER_SLICE
|
||||
|| pMso->uiSliceMode == SM_ROWMB_SLICE || pMso->uiSliceMode == SM_AUTO_SLICE) {
|
||||
if ( pSliceArgument->uiSliceMode == SM_FIXEDSLCNUM_SLICE || pSliceArgument->uiSliceMode == SM_RASTER_SLICE) {
|
||||
bWillUseTaskManage = true;
|
||||
}
|
||||
++ iIdx;
|
||||
@ -576,7 +576,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32
|
||||
SWelsSvcCodingParam* pCodingParam = pCtx->pSvcParam;
|
||||
SSpatialLayerConfig* pDlp = &pCodingParam->sSpatialLayers[pCtx->uiDependencyId];
|
||||
SWelsSliceBs* pSliceBs = NULL;
|
||||
const bool kbIsDynamicSlicingMode = (pDlp->sSliceCfg.uiSliceMode == SM_DYN_SLICE);
|
||||
const bool kbIsDynamicSlicingMode = (pDlp->sSliceArgument.uiSliceMode == SM_SIZELIMITED_SLICE);
|
||||
|
||||
int32_t iLayerSize = 0;
|
||||
int32_t iNalIdxBase = pLbi->iNalCount;
|
||||
@ -613,7 +613,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32
|
||||
++ iSliceIdx;
|
||||
++ pSliceBs;
|
||||
}
|
||||
} else { // for SM_DYN_SLICE
|
||||
} else { // for SM_SIZELIMITED_SLICE
|
||||
const int32_t kiPartitionCnt = iSliceCount;
|
||||
int32_t iPartitionIdx = 0;
|
||||
|
||||
@ -744,17 +744,16 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
|
||||
eNalRefIdc = pEncPEncCtx->eNalPriority;
|
||||
bNeedPrefix = pEncPEncCtx->bNeedPrefixNalFlag;
|
||||
|
||||
if (pParamD->sSliceCfg.uiSliceMode != SM_DYN_SLICE) {
|
||||
if (pParamD->sSliceArgument.uiSliceMode != SM_SIZELIMITED_SLICE) {
|
||||
int64_t iSliceStart = 0;
|
||||
bool bDsaFlag = false;
|
||||
iSliceIdx = pPrivateData->iSliceIndex;
|
||||
pSlice = &pCurDq->sLayerInfo.pSliceInLayer[iSliceIdx];
|
||||
pSliceBs = &pEncPEncCtx->pSliceBs[iSliceIdx];
|
||||
|
||||
bDsaFlag = (((pParamD->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)
|
||||
|| (pParamD->sSliceCfg.uiSliceMode == SM_AUTO_SLICE)) &&
|
||||
bDsaFlag = ((pParamD->sSliceArgument.uiSliceMode == SM_FIXEDSLCNUM_SLICE) &&
|
||||
pCodingParam->iMultipleThreadIdc > 1 &&
|
||||
pCodingParam->iMultipleThreadIdc >= pParamD->sSliceCfg.sSliceArgument.uiSliceNum);
|
||||
pCodingParam->iMultipleThreadIdc >= pParamD->sSliceArgument.uiSliceNum);
|
||||
if (bDsaFlag)
|
||||
iSliceStart = WelsTime();
|
||||
|
||||
@ -838,7 +837,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) {
|
||||
&pEncPEncCtx->pSliceThreading->pSliceCodedEvent[iEventIdx]); // mean finished coding current pSlice
|
||||
WelsEventSignal (
|
||||
&pEncPEncCtx->pSliceThreading->pSliceCodedMasterEvent);
|
||||
} else { // for SM_DYN_SLICE parallelization
|
||||
} else { // for SM_SIZELIMITED_SLICE parallelization
|
||||
SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx;
|
||||
const int32_t kiPartitionId = iThreadIdx;
|
||||
const int32_t kiSliceIdxStep = pEncPEncCtx->iActiveThreadsNum;
|
||||
@ -1090,9 +1089,9 @@ int32_t AdjustEnhanceLayer (sWelsEncCtx* pCtx, int32_t iCurDid) {
|
||||
// if using spatial base layer for complexity estimation
|
||||
|
||||
const bool kbModelingFromSpatial = (pCtx->pCurDqLayer->pRefLayer != NULL && iCurDid > 0)
|
||||
&& (pCtx->pSvcParam->sSpatialLayers[iCurDid - 1].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE
|
||||
&& (pCtx->pSvcParam->sSpatialLayers[iCurDid - 1].sSliceArgument.uiSliceMode == SM_FIXEDSLCNUM_SLICE
|
||||
&& pCtx->pSvcParam->iMultipleThreadIdc >= pCtx->pSvcParam->sSpatialLayers[iCurDid -
|
||||
1].sSliceCfg.sSliceArgument.uiSliceNum);
|
||||
1].sSliceArgument.uiSliceNum);
|
||||
|
||||
if (kbModelingFromSpatial) { // using spatial base layer for complexity estimation
|
||||
// do not need adjust due to not different at both slices of consumed time
|
||||
@ -1156,13 +1155,13 @@ void TrackSliceConsumeTime (sWelsEncCtx* pCtx, int32_t* pDidList, const int32_t
|
||||
while (iSpatialIdx < iSpatialNum) {
|
||||
const int32_t kiDid = pDidList[iSpatialIdx];
|
||||
SSpatialLayerInternal* pDlp = &pPara->sDependencyLayers[kiDid];
|
||||
SSliceConfig* pMso = &pDlp->sSliceCfg;
|
||||
SSliceConfig* pSliceArgument = &pDlp->sSliceArgument;
|
||||
SDqLayer* pCurDq = pCtx->ppDqLayerList[kiDid];
|
||||
SSliceCtx* pSliceCtx = pCurDq->pSliceEncCtx;
|
||||
const uint32_t kuiCountSliceNum = pSliceCtx->iSliceNumInFrame;
|
||||
if (pCtx->pSliceThreading) {
|
||||
if (pCtx->pSliceThreading->pFSliceDiff
|
||||
&& ((pMso->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pMso->uiSliceMode == SM_AUTO_SLICE))
|
||||
&& ((pSliceArgument->uiSliceMode == SM_FIXEDSLCNUM_SLICE) || (pSliceArgument->uiSliceMode == SM_AUTO_SLICE))
|
||||
&& pPara->iMultipleThreadIdc > 1
|
||||
&& pPara->iMultipleThreadIdc >= kuiCountSliceNum) {
|
||||
uint32_t i = 0;
|
||||
|
@ -66,11 +66,11 @@ int32_t AssignMbMapSingleSlice (void* pMbMap, const int32_t kiCountMbNum, const
|
||||
*
|
||||
* \return 0 - successful; none 0 - failed
|
||||
*/
|
||||
int32_t AssignMbMapMultipleSlices (SSliceCtx* pSliceSeg, const SSliceConfig* kpMso) {
|
||||
int32_t AssignMbMapMultipleSlices (SSliceCtx* pSliceSeg, const SSliceArgument* kpSliceArgument) {
|
||||
if (NULL == pSliceSeg || SM_SINGLE_SLICE == pSliceSeg->uiSliceMode)
|
||||
return 1;
|
||||
|
||||
if (SM_ROWMB_SLICE == pSliceSeg->uiSliceMode) {
|
||||
if ((SM_RASTER_SLICE == pSliceSeg->uiSliceMode) && (0 == kpSliceArgument->uiSliceMbNum[0])) {
|
||||
const int32_t kiMbWidth = pSliceSeg->iMbWidth;
|
||||
int32_t iSliceNum = pSliceSeg->iSliceNumInFrame, uiSliceIdx = 0;
|
||||
|
||||
@ -85,9 +85,8 @@ int32_t AssignMbMapMultipleSlices (SSliceCtx* pSliceSeg, const SSliceConfig* kpM
|
||||
|
||||
return 0;
|
||||
} else if (SM_RASTER_SLICE == pSliceSeg->uiSliceMode ||
|
||||
SM_FIXEDSLCNUM_SLICE == pSliceSeg->uiSliceMode ||
|
||||
SM_AUTO_SLICE == pSliceSeg->uiSliceMode) {
|
||||
const int32_t* kpSlicesAssignList = (int32_t*) & (kpMso->sSliceArgument.uiSliceMbNum[0]);
|
||||
SM_FIXEDSLCNUM_SLICE == pSliceSeg->uiSliceMode) {
|
||||
const int32_t* kpSlicesAssignList = (int32_t*) & (kpSliceArgument->uiSliceMbNum[0]);
|
||||
const int32_t kiCountNumMbInFrame = pSliceSeg->iMbNumInFrame;
|
||||
const int32_t kiCountSliceNumInFrame = pSliceSeg->iSliceNumInFrame;
|
||||
uint16_t iSliceIdx = 0;
|
||||
@ -109,7 +108,7 @@ int32_t AssignMbMapMultipleSlices (SSliceCtx* pSliceSeg, const SSliceConfig* kpM
|
||||
iMbIdx += kiCurRunLength;
|
||||
++ iSliceIdx;
|
||||
} while (iSliceIdx < kiCountSliceNumInFrame && iMbIdx < kiCountNumMbInFrame);
|
||||
} else if (SM_DYN_SLICE == pSliceSeg->uiSliceMode) {
|
||||
} else if (SM_SIZELIMITED_SLICE == pSliceSeg->uiSliceMode) {
|
||||
int32_t iSliceIdx = 0;
|
||||
const int32_t kiMaxSliceNum = pSliceSeg->iMaxSliceNumConstraint;
|
||||
const int32_t kiCountNumMbInFrame = pSliceSeg->iMbNumInFrame;
|
||||
@ -318,19 +317,18 @@ bool GomValidCheckSliceMbNum (const int32_t kiMbWidth, const int32_t kiMbHeight,
|
||||
* Get slice count for multiple slice segment
|
||||
*
|
||||
*/
|
||||
int32_t GetInitialSliceNum (const int32_t kiMbWidth, const int32_t kiMbHeight, SSliceConfig* pMso) {
|
||||
if (NULL == pMso)
|
||||
int32_t GetInitialSliceNum (const int32_t kiMbWidth, const int32_t kiMbHeight, SSliceArgument* pSliceArgument) {
|
||||
if (NULL == pSliceArgument)
|
||||
return -1;
|
||||
|
||||
switch (pMso->uiSliceMode) {
|
||||
switch (pSliceArgument->uiSliceMode) {
|
||||
case SM_SINGLE_SLICE:
|
||||
case SM_FIXEDSLCNUM_SLICE:
|
||||
case SM_RASTER_SLICE:
|
||||
case SM_ROWMB_SLICE:
|
||||
case SM_AUTO_SLICE: {
|
||||
return pMso->sSliceArgument.uiSliceNum;
|
||||
{
|
||||
return pSliceArgument->uiSliceNum;
|
||||
}
|
||||
case SM_DYN_SLICE: {
|
||||
case SM_SIZELIMITED_SLICE: {
|
||||
return AVERSLICENUM_CONSTRAINT;//at the beginning of dynamic slicing, set the uiSliceNum to be 1
|
||||
}
|
||||
case SM_RESERVED:
|
||||
@ -355,16 +353,16 @@ int32_t GetInitialSliceNum (const int32_t kiMbWidth, const int32_t kiMbHeight, S
|
||||
*/
|
||||
int32_t InitSliceSegment (SSliceCtx* pSliceSeg,
|
||||
CMemoryAlign* pMa,
|
||||
SSliceConfig* pMso,
|
||||
SSliceArgument* pSliceArgument,
|
||||
const int32_t kiMbWidth,
|
||||
const int32_t kiMbHeight) {
|
||||
const int32_t kiCountMbNum = kiMbWidth * kiMbHeight;
|
||||
SliceModeEnum uiSliceMode = SM_SINGLE_SLICE;
|
||||
|
||||
if (NULL == pSliceSeg || NULL == pMso || kiMbWidth == 0 || kiMbHeight == 0)
|
||||
if (NULL == pSliceSeg || NULL == pSliceArgument || kiMbWidth == 0 || kiMbHeight == 0)
|
||||
return 1;
|
||||
|
||||
uiSliceMode = pMso->uiSliceMode;
|
||||
uiSliceMode = pSliceArgument->uiSliceMode;
|
||||
if (pSliceSeg->iMbNumInFrame == kiCountMbNum && pSliceSeg->iMbWidth == kiMbWidth
|
||||
&& pSliceSeg->iMbHeight == kiMbHeight && pSliceSeg->uiSliceMode == uiSliceMode && pSliceSeg->pOverallMbMap != NULL)
|
||||
return 0;
|
||||
@ -416,8 +414,8 @@ int32_t InitSliceSegment (SSliceCtx* pSliceSeg,
|
||||
|
||||
return AssignMbMapSingleSlice (pSliceSeg->pOverallMbMap, kiCountMbNum, sizeof (pSliceSeg->pOverallMbMap[0]));
|
||||
} else { //if ( SM_MULTIPLE_SLICE == uiSliceMode )
|
||||
if (uiSliceMode != SM_FIXEDSLCNUM_SLICE && uiSliceMode != SM_ROWMB_SLICE && uiSliceMode != SM_RASTER_SLICE
|
||||
&& uiSliceMode != SM_DYN_SLICE && uiSliceMode != SM_AUTO_SLICE)
|
||||
if (uiSliceMode != SM_FIXEDSLCNUM_SLICE && uiSliceMode != SM_RASTER_SLICE
|
||||
&& uiSliceMode != SM_SIZELIMITED_SLICE )
|
||||
return 1;
|
||||
|
||||
pSliceSeg->pOverallMbMap = (uint16_t*)pMa->WelsMalloc (kiCountMbNum * sizeof (uint16_t), "pSliceSeg->pOverallMbMap");
|
||||
@ -426,8 +424,8 @@ int32_t InitSliceSegment (SSliceCtx* pSliceSeg,
|
||||
|
||||
WelsSetMemMultiplebytes_c(pSliceSeg->pOverallMbMap, 0, kiCountMbNum, sizeof(uint16_t));
|
||||
|
||||
//SM_DYN_SLICE: init, set pSliceSeg->iSliceNumInFrame = 1;
|
||||
pSliceSeg->iSliceNumInFrame = GetInitialSliceNum (kiMbWidth, kiMbHeight, pMso);
|
||||
//SM_SIZELIMITED_SLICE: init, set pSliceSeg->iSliceNumInFrame = 1;
|
||||
pSliceSeg->iSliceNumInFrame = GetInitialSliceNum (kiMbWidth, kiMbHeight, pSliceArgument);
|
||||
|
||||
if (-1 == pSliceSeg->iSliceNumInFrame)
|
||||
return 1;
|
||||
@ -441,13 +439,13 @@ int32_t InitSliceSegment (SSliceCtx* pSliceSeg,
|
||||
"pSliceSeg->pFirstMbInSlice");
|
||||
|
||||
WELS_VERIFY_RETURN_IF (1, NULL == pSliceSeg->pFirstMbInSlice)
|
||||
pSliceSeg->uiSliceMode = pMso->uiSliceMode;
|
||||
pSliceSeg->uiSliceMode = pSliceArgument->uiSliceMode;
|
||||
pSliceSeg->iMbWidth = kiMbWidth;
|
||||
pSliceSeg->iMbHeight = kiMbHeight;
|
||||
pSliceSeg->iMbNumInFrame = kiCountMbNum;
|
||||
if (SM_DYN_SLICE == pMso->uiSliceMode) {
|
||||
if (0 < pMso->sSliceArgument.uiSliceSizeConstraint) {
|
||||
pSliceSeg->uiSliceSizeConstraint = pMso->sSliceArgument.uiSliceSizeConstraint;
|
||||
if (SM_SIZELIMITED_SLICE == pSliceArgument->uiSliceMode) {
|
||||
if (0 < pSliceArgument->uiSliceSizeConstraint) {
|
||||
pSliceSeg->uiSliceSizeConstraint = pSliceArgument->uiSliceSizeConstraint;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
@ -455,13 +453,13 @@ int32_t InitSliceSegment (SSliceCtx* pSliceSeg,
|
||||
pSliceSeg->uiSliceSizeConstraint = DEFAULT_MAXPACKETSIZE_CONSTRAINT;
|
||||
}
|
||||
// about "iMaxSliceNumConstraint"
|
||||
//only used in SM_DYN_SLICE mode so far,
|
||||
//only used in SM_SIZELIMITED_SLICE mode so far,
|
||||
//now follows NAL_UNIT_CONSTRAINT, (see definition)
|
||||
//will be adjusted under MT if there is limitation on iLayerNum
|
||||
pSliceSeg->iMaxSliceNumConstraint = MAX_SLICES_NUM;
|
||||
|
||||
|
||||
return AssignMbMapMultipleSlices (pSliceSeg, pMso);
|
||||
return AssignMbMapMultipleSlices (pSliceSeg, pSliceArgument);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -518,14 +516,14 @@ int32_t InitSlicePEncCtx (SSliceCtx* pSliceCtx,
|
||||
bool bFmoUseFlag,
|
||||
int32_t iMbWidth,
|
||||
int32_t iMbHeight,
|
||||
SSliceConfig* pMso,
|
||||
SSliceArgument* pSliceArgument,
|
||||
void* pPpsArg) {
|
||||
if (NULL == pSliceCtx)
|
||||
return 1;
|
||||
|
||||
InitSliceSegment (pSliceCtx,
|
||||
pMa,
|
||||
pMso,
|
||||
pSliceArgument,
|
||||
iMbWidth,
|
||||
iMbHeight);
|
||||
return 0;
|
||||
|
@ -715,9 +715,9 @@ int32_t WelsCodeOneSlice (sWelsEncCtx* pEncCtx, const int32_t kiSliceIdx, const
|
||||
SNalUnitHeaderExt* pNalHeadExt = &pCurLayer->sLayerInfo.sNalHeaderExt;
|
||||
SSlice* pCurSlice = &pCurLayer->sLayerInfo.pSliceInLayer[kiSliceIdx];
|
||||
SBitStringAux* pBs = pCurSlice->pSliceBsa;
|
||||
const int32_t kiDynamicSliceFlag = (pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId].sSliceCfg.uiSliceMode
|
||||
const int32_t kiDynamicSliceFlag = (pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId].sSliceArgument.uiSliceMode
|
||||
==
|
||||
SM_DYN_SLICE);
|
||||
SM_SIZELIMITED_SLICE);
|
||||
|
||||
assert (kiSliceIdx == (int) pCurSlice->uiSliceIdx);
|
||||
|
||||
|
@ -162,7 +162,7 @@ WelsErrorType CWelsTaskManageBase::OnTaskExecuted (WelsCommon::IWelsTask* pTask
|
||||
}
|
||||
|
||||
void CWelsTaskManageBase::InitFrame (const int32_t kiCurDid) {
|
||||
m_iWaitTaskNum = m_pEncCtx->pSvcParam->sSpatialLayers[kiCurDid].sSliceCfg.sSliceArgument.uiSliceNum;
|
||||
m_iWaitTaskNum = m_pEncCtx->pSvcParam->sSpatialLayers[kiCurDid].sSliceArgument.uiSliceNum;
|
||||
//printf("InitFrame m_iWaitTaskNum=%d, slice_mode=%d\n", m_iWaitTaskNum, m_pEncCtx->pSvcParam->sSpatialLayers[kiCurDid].sSliceCfg.uiSliceMode);
|
||||
//TODO: update mbmap;
|
||||
}
|
||||
|
@ -524,16 +524,16 @@ void CWelsH264SVCEncoder::TraceParamInfo (SEncParamExt* pParam) {
|
||||
while (i < iSpatialLayers) {
|
||||
SSpatialLayerConfig* pSpatialCfg = &pParam->sSpatialLayers[i];
|
||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||
"sSpatialLayers[%d]: .iVideoWidth= %d; .iVideoHeight= %d; .fFrameRate= %.6ff; .iSpatialBitrate= %d; .iMaxSpatialBitrate= %d; .sSliceCfg.uiSliceMode= %d; .sSliceCfg.sSliceArgument.iSliceNum= %d; .sSliceCfg.sSliceArgument.uiSliceSizeConstraint= %d;"
|
||||
"sSpatialLayers[%d]: .iVideoWidth= %d; .iVideoHeight= %d; .fFrameRate= %.6ff; .iSpatialBitrate= %d; .iMaxSpatialBitrate= %d; .sSliceArgument.uiSliceMode= %d; .sSliceArgument.iSliceNum= %d; .sSliceArgument.uiSliceSizeConstraint= %d;"
|
||||
"uiProfileIdc = %d;uiLevelIdc = %d",
|
||||
i, pSpatialCfg->iVideoWidth,
|
||||
pSpatialCfg->iVideoHeight,
|
||||
pSpatialCfg->fFrameRate,
|
||||
pSpatialCfg->iSpatialBitrate,
|
||||
pSpatialCfg->iMaxSpatialBitrate,
|
||||
pSpatialCfg->sSliceCfg.uiSliceMode,
|
||||
pSpatialCfg->sSliceCfg.sSliceArgument.uiSliceNum,
|
||||
pSpatialCfg->sSliceCfg.sSliceArgument.uiSliceSizeConstraint,
|
||||
pSpatialCfg->sSliceArgument.uiSliceMode,
|
||||
pSpatialCfg->sSliceArgument.uiSliceNum,
|
||||
pSpatialCfg->sSliceArgument.uiSliceSizeConstraint,
|
||||
pSpatialCfg->uiProfileIdc,
|
||||
pSpatialCfg->uiLevelIdc
|
||||
);
|
||||
|
@ -256,8 +256,8 @@ class OpenH264VideoEncoder : public GMPVideoEncoder, public RefCounted {
|
||||
|
||||
//for controlling the NAL size (normally for packetization-mode=0)
|
||||
if (maxPayloadSize != 0) {
|
||||
layer->sSliceCfg.uiSliceMode = SM_DYN_SLICE;
|
||||
layer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = maxPayloadSize;
|
||||
layer->sSliceArgument.uiSliceMode = SM_SIZELIMITED_SLICE;
|
||||
layer->sSliceArgument.uiSliceSizeConstraint = maxPayloadSize;
|
||||
}
|
||||
rv = encoder_->InitializeExt (¶m);
|
||||
if (rv) {
|
||||
|
@ -24,8 +24,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,5,0,0
|
||||
PRODUCTVERSION 1,5,0,0
|
||||
FILEVERSION 1,6,0,0
|
||||
PRODUCTVERSION 1,6,0,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -43,12 +43,12 @@ BEGIN
|
||||
VALUE "Comments", "Cisco OpenH264 codec"
|
||||
VALUE "CompanyName", "Cisco Systems Inc."
|
||||
VALUE "FileDescription", "Cisco OpenH264 codec"
|
||||
VALUE "FileVersion", "1.5.0.0"
|
||||
VALUE "FileVersion", "1.6.0.0"
|
||||
VALUE "InternalName", "openh264.dll"
|
||||
VALUE "LegalCopyright", "© 2011-2015 Cisco and/or its affiliates. All rights reserved."
|
||||
VALUE "OriginalFilename", "openh264.dll"
|
||||
VALUE "ProductName", "Cisco OpenH264 codec"
|
||||
VALUE "ProductVersion", "1.5.0.0"
|
||||
VALUE "ProductVersion", "1.6.0.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
static int InitWithParam (ISVCEncoder* encoder, SEncParamExt* pEncParamExt) {
|
||||
|
||||
SliceModeEnum eSliceMode = pEncParamExt->sSpatialLayers[0].sSliceCfg.uiSliceMode;
|
||||
SliceModeEnum eSliceMode = pEncParamExt->sSpatialLayers[0].sSliceArgument.uiSliceMode;
|
||||
bool bBaseParamFlag = (SM_SINGLE_SLICE == eSliceMode && !pEncParamExt->bEnableDenoise
|
||||
&& pEncParamExt->iSpatialLayerNum == 1 && !pEncParamExt->bIsLosslessLink
|
||||
&& !pEncParamExt->bEnableLongTermReference && !pEncParamExt->iEntropyCodingModeFlag) ? true : false;
|
||||
@ -36,7 +36,7 @@ static int InitWithParam (ISVCEncoder* encoder, SEncParamExt* pEncParamExt) {
|
||||
param.bIsLosslessLink = pEncParamExt->bIsLosslessLink;
|
||||
param.bEnableLongTermReference = pEncParamExt->bEnableLongTermReference;
|
||||
param.iEntropyCodingModeFlag = pEncParamExt->iEntropyCodingModeFlag ? 1 : 0;
|
||||
if (eSliceMode != SM_SINGLE_SLICE && eSliceMode != SM_DYN_SLICE) //SM_DYN_SLICE don't support multi-thread now
|
||||
if (eSliceMode != SM_SINGLE_SLICE && eSliceMode != SM_SIZELIMITED_SLICE) //SM_SIZELIMITED_SLICE don't support multi-thread now
|
||||
param.iMultipleThreadIdc = 2;
|
||||
|
||||
for (int i = 0; i < param.iSpatialLayerNum; i++) {
|
||||
@ -45,9 +45,9 @@ static int InitWithParam (ISVCEncoder* encoder, SEncParamExt* pEncParamExt) {
|
||||
param.sSpatialLayers[i].fFrameRate = pEncParamExt->fMaxFrameRate;
|
||||
param.sSpatialLayers[i].iSpatialBitrate = param.iTargetBitrate;
|
||||
|
||||
param.sSpatialLayers[i].sSliceCfg.uiSliceMode = eSliceMode;
|
||||
if (eSliceMode == SM_DYN_SLICE) {
|
||||
param.sSpatialLayers[i].sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 600;
|
||||
param.sSpatialLayers[i].sSliceArgument.uiSliceMode = eSliceMode;
|
||||
if (eSliceMode == SM_SIZELIMITED_SLICE) {
|
||||
param.sSpatialLayers[i].sSliceArgument.uiSliceSizeConstraint = 600;
|
||||
param.uiMaxNalSize = 1500;
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ void DecEncFileParamToParamExt (DecodeEncodeFileParam* pDecEncFileParam, SEncPar
|
||||
pEnxParamExt->iEntropyCodingModeFlag = 0;
|
||||
|
||||
for (int i = 0; i < pEnxParamExt->iSpatialLayerNum; i++) {
|
||||
pEnxParamExt->sSpatialLayers[i].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
pEnxParamExt->sSpatialLayers[i].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -101,8 +101,8 @@ class EncodeDecodeTestBase : public BaseEncoderTest, public BaseDecoderTest {
|
||||
pParam->sSpatialLayers[i].iVideoWidth = width >> (iLayers - i - 1);
|
||||
pParam->sSpatialLayers[i].iVideoHeight = height >> (iLayers - i - 1);
|
||||
pParam->sSpatialLayers[i].fFrameRate = framerate;
|
||||
pParam->sSpatialLayers[i].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
pParam->sSpatialLayers[i].sSliceCfg.sSliceArgument.uiSliceNum = iSlices;
|
||||
pParam->sSpatialLayers[i].sSliceArgument.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
pParam->sSpatialLayers[i].sSliceArgument.uiSliceNum = iSlices;
|
||||
}
|
||||
}
|
||||
|
||||
@ -415,12 +415,12 @@ void EncodeDecodeTestAPIBase::RandomParamExtCombination() {
|
||||
pSpatialLayer->iSpatialBitrate = rand() % BIT_RATE_RANGE;
|
||||
|
||||
|
||||
pSpatialLayer->sSliceCfg.uiSliceMode = static_cast<SliceModeEnum> (rand() % SLICE_MODE_NUM);
|
||||
if (pSpatialLayer->sSliceCfg.uiSliceMode != SM_DYN_SLICE) {
|
||||
pSpatialLayer->sSliceArgument.uiSliceMode = static_cast<SliceModeEnum> (rand() % SLICE_MODE_NUM);
|
||||
if (pSpatialLayer->sSliceArgument.uiSliceMode != SM_SIZELIMITED_SLICE) {
|
||||
param_.uiMaxNalSize = 0;
|
||||
}
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = rand();
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = rand();
|
||||
pSpatialLayer->sSliceArgument.uiSliceNum = rand();
|
||||
pSpatialLayer->sSliceArgument.uiSliceSizeConstraint = rand();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -482,31 +482,30 @@ void EncodeDecodeTestAPIBase::ValidateParamExtCombination() {
|
||||
pSpatialLayer->iSpatialBitrate = WELS_CLIP3 (pSpatialLayer->iSpatialBitrate, 1, pSpatialLayer->iMaxSpatialBitrate);
|
||||
iTotalBitRate += pSpatialLayer->iSpatialBitrate;
|
||||
|
||||
uiSliceNum = pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum;
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = WELS_CLIP3 (uiSliceNum, 1, MAX_SLICES_NUM);
|
||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
uiSliceNum = pSpatialLayer->sSliceArgument.uiSliceNum;
|
||||
pSpatialLayer->sSliceArgument.uiSliceNum = WELS_CLIP3 (uiSliceNum, 1, MAX_SLICES_NUM);
|
||||
pSpatialLayer->sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
|
||||
|
||||
//for SM_FIXEDSLCNUM_SLICE
|
||||
// to do will add this when GOM bug fixed
|
||||
if (SM_FIXEDSLCNUM_SLICE == pSpatialLayer->sSliceCfg.uiSliceMode) {
|
||||
pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
if (SM_FIXEDSLCNUM_SLICE == pSpatialLayer->sSliceArgument.uiSliceMode) {
|
||||
pSpatialLayer->sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
}
|
||||
|
||||
//for slice mode = SM_DYN_SLICE
|
||||
if (SM_DYN_SLICE == pSpatialLayer->sSliceCfg.uiSliceMode) {
|
||||
//for slice mode = SM_SIZELIMITED_SLICE
|
||||
if (SM_SIZELIMITED_SLICE == pSpatialLayer->sSliceArgument.uiSliceMode) {
|
||||
bDynSliceModeFlag = true;
|
||||
}
|
||||
|
||||
//for slice mode = SM_RASTER_SLICE
|
||||
if (SM_RASTER_SLICE == pSpatialLayer->sSliceCfg.uiSliceMode) {
|
||||
SliceParamValidationForMode2 (iSpatialIdx);
|
||||
if (SM_RASTER_SLICE == pSpatialLayer->sSliceArgument.uiSliceMode) {
|
||||
if (0!=pSpatialLayer->sSliceArgument.uiSliceMbNum[0]) {
|
||||
SliceParamValidationForMode2 (iSpatialIdx);
|
||||
} else {
|
||||
SliceParamValidationForMode3 (iSpatialIdx);
|
||||
}
|
||||
}
|
||||
//for slice mode = SM_ROWMB_SLICE
|
||||
if (SM_ROWMB_SLICE == pSpatialLayer->sSliceCfg.uiSliceMode) {
|
||||
SliceParamValidationForMode3 (iSpatialIdx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//for RC
|
||||
@ -526,7 +525,7 @@ void EncodeDecodeTestAPIBase::ValidateParamExtCombination() {
|
||||
param_.iMinQp = iMinQP;
|
||||
param_.uiMaxNalSize = 0;
|
||||
|
||||
//for slice mode = SM_DYN_SLICE
|
||||
//for slice mode = SM_SIZELIMITED_SLICE
|
||||
if (true == bDynSliceModeFlag) {
|
||||
SliceParamValidationForMode4();
|
||||
}
|
||||
@ -549,8 +548,8 @@ void EncodeDecodeTestAPIBase::SliceParamValidationForMode2 (int iSpatialIdx) {
|
||||
|
||||
uiSliceIdx = 0;
|
||||
while (uiSliceIdx < MAX_SLICES_NUM) {
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceMbNum[uiSliceIdx] = rand() % uiMbNumInFrame;
|
||||
uiCountMb += param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceMbNum[uiSliceIdx];
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceArgument.uiSliceMbNum[uiSliceIdx] = rand() % uiMbNumInFrame;
|
||||
uiCountMb += param_.sSpatialLayers[iSpatialIdx].sSliceArgument.uiSliceMbNum[uiSliceIdx];
|
||||
uiActualSliceCount = uiSliceIdx + 1;
|
||||
|
||||
if (uiCountMb >= uiMbNumInFrame) {
|
||||
@ -561,14 +560,14 @@ void EncodeDecodeTestAPIBase::SliceParamValidationForMode2 (int iSpatialIdx) {
|
||||
}
|
||||
|
||||
if (uiCountMb >= uiMbNumInFrame) {
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceMbNum[uiActualSliceCount - 1] -=
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceArgument.uiSliceMbNum[uiActualSliceCount - 1] -=
|
||||
(uiCountMb - uiMbNumInFrame);
|
||||
|
||||
} else {
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceMbNum[uiActualSliceCount - 1 ] +=
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceArgument.uiSliceMbNum[uiActualSliceCount - 1 ] +=
|
||||
(uiMbNumInFrame - uiCountMb);
|
||||
}
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceNum = uiActualSliceCount;
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceArgument.uiSliceNum = uiActualSliceCount;
|
||||
|
||||
}
|
||||
void EncodeDecodeTestAPIBase::SliceParamValidationForMode3 (int iSpatialIdx) {
|
||||
@ -579,16 +578,16 @@ void EncodeDecodeTestAPIBase::SliceParamValidationForMode3 (int iSpatialIdx) {
|
||||
|
||||
//change slice mode to SM_SINGLE_SLICE
|
||||
if (uiMbHeight > MAX_SLICES_NUM) {
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceArgument.uiSliceMode = SM_SINGLE_SLICE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void EncodeDecodeTestAPIBase::SliceParamValidationForMode4() {
|
||||
//slice mode of all spatial layer should be set as SM_DYN_SLICE
|
||||
//slice mode of all spatial layer should be set as SM_SIZELIMITED_SLICE
|
||||
for (int iSpatialIdx = 0; iSpatialIdx < param_.iSpatialLayerNum; iSpatialIdx++) {
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 600;
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceCfg.uiSliceMode = SM_DYN_SLICE;
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceArgument.uiSliceSizeConstraint = 600;
|
||||
param_.sSpatialLayers[iSpatialIdx].sSliceArgument.uiSliceMode = SM_SIZELIMITED_SLICE;
|
||||
}
|
||||
param_.uiMaxNalSize = 1500;
|
||||
}
|
||||
@ -2385,12 +2384,12 @@ TEST_F (DecodeCrashTestAPI, DecoderCrashTest) {
|
||||
param_.iMultipleThreadIdc = 0;
|
||||
param_.sSpatialLayers[0].iSpatialBitrate = p.iTarBitrate;
|
||||
param_.sSpatialLayers[0].iMaxSpatialBitrate = p.iTarBitrate << 1;
|
||||
param_.sSpatialLayers[0].sSliceCfg.uiSliceMode = (rand() % 2) ? SM_DYN_SLICE : SM_SINGLE_SLICE;
|
||||
if (param_.sSpatialLayers[0].sSliceCfg.uiSliceMode == SM_DYN_SLICE) {
|
||||
param_.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 1400;
|
||||
param_.sSpatialLayers[0].sSliceArgument.uiSliceMode = (rand() % 2) ? SM_SIZELIMITED_SLICE : SM_SINGLE_SLICE;
|
||||
if (param_.sSpatialLayers[0].sSliceArgument.uiSliceMode == SM_SIZELIMITED_SLICE) {
|
||||
param_.sSpatialLayers[0].sSliceArgument.uiSliceSizeConstraint = 1400;
|
||||
param_.uiMaxNalSize = 1400;
|
||||
} else {
|
||||
param_.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
param_.sSpatialLayers[0].sSliceArgument.uiSliceSizeConstraint = 0;
|
||||
param_.uiMaxNalSize = 0;
|
||||
}
|
||||
|
||||
@ -3454,35 +3453,35 @@ struct EncodeOptionParam {
|
||||
};
|
||||
|
||||
static const EncodeOptionParam kOptionParamArray[] = {
|
||||
{true, true, false, 30, 600, 460, 1, SM_DYN_SLICE, 450, 15.0, 1, ""},
|
||||
{true, true, false, 30, 340, 96, 24, SM_DYN_SLICE, 1000, 30.0, 1, ""},
|
||||
{true, true, false, 30, 140, 196, 51, SM_DYN_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, false, 30, 110, 296, 50, SM_DYN_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, false, 30, 104, 416, 44, SM_DYN_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, false, 30, 16, 16, 2, SM_DYN_SLICE, 500, 7.5, 1, ""},
|
||||
{true, false, true, 30, 600, 460, 1, SM_DYN_SLICE, 450, 15.0, 1, ""},
|
||||
{true, false, true, 30, 340, 96, 24, SM_DYN_SLICE, 1000, 30.0, 1, ""},
|
||||
{true, false, true, 30, 140, 196, 51, SM_DYN_SLICE, 500, 7.5, 1, ""},
|
||||
{true, false, true, 30, 110, 296, 50, SM_DYN_SLICE, 500, 7.5, 1, ""},
|
||||
{true, false, true, 30, 104, 416, 44, SM_DYN_SLICE, 500, 7.5, 1, ""},
|
||||
{true, false, true, 30, 16, 16, 2, SM_DYN_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, true, 30, 600, 460, 1, SM_DYN_SLICE, 450, 15.0, 1, ""},
|
||||
{true, true, true, 30, 340, 96, 24, SM_DYN_SLICE, 1000, 30.0, 1, ""},
|
||||
{true, true, true, 30, 140, 196, 51, SM_DYN_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, true, 30, 110, 296, 50, SM_DYN_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, true, 30, 104, 416, 44, SM_DYN_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, true, 30, 16, 16, 2, SM_DYN_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, false, 30, 600, 460, 1, SM_SIZELIMITED_SLICE, 450, 15.0, 1, ""},
|
||||
{true, true, false, 30, 340, 96, 24, SM_SIZELIMITED_SLICE, 1000, 30.0, 1, ""},
|
||||
{true, true, false, 30, 140, 196, 51, SM_SIZELIMITED_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, false, 30, 110, 296, 50, SM_SIZELIMITED_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, false, 30, 104, 416, 44, SM_SIZELIMITED_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, false, 30, 16, 16, 2, SM_SIZELIMITED_SLICE, 500, 7.5, 1, ""},
|
||||
{true, false, true, 30, 600, 460, 1, SM_SIZELIMITED_SLICE, 450, 15.0, 1, ""},
|
||||
{true, false, true, 30, 340, 96, 24, SM_SIZELIMITED_SLICE, 1000, 30.0, 1, ""},
|
||||
{true, false, true, 30, 140, 196, 51, SM_SIZELIMITED_SLICE, 500, 7.5, 1, ""},
|
||||
{true, false, true, 30, 110, 296, 50, SM_SIZELIMITED_SLICE, 500, 7.5, 1, ""},
|
||||
{true, false, true, 30, 104, 416, 44, SM_SIZELIMITED_SLICE, 500, 7.5, 1, ""},
|
||||
{true, false, true, 30, 16, 16, 2, SM_SIZELIMITED_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, true, 30, 600, 460, 1, SM_SIZELIMITED_SLICE, 450, 15.0, 1, ""},
|
||||
{true, true, true, 30, 340, 96, 24, SM_SIZELIMITED_SLICE, 1000, 30.0, 1, ""},
|
||||
{true, true, true, 30, 140, 196, 51, SM_SIZELIMITED_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, true, 30, 110, 296, 50, SM_SIZELIMITED_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, true, 30, 104, 416, 44, SM_SIZELIMITED_SLICE, 500, 7.5, 1, ""},
|
||||
{true, true, true, 30, 16, 16, 2, SM_SIZELIMITED_SLICE, 500, 7.5, 1, ""},
|
||||
{false, false, true, 3, 4096, 2304, 2, SM_SINGLE_SLICE, 0, 7.5, 1, ""}, // large picture size
|
||||
{false, true, false, 30, 32, 16, 2, SM_DYN_SLICE, 500, 7.5, 1, ""},
|
||||
{false, true, false, 30, 600, 460, 1, SM_DYN_SLICE, 450, 15.0, 4, ""},
|
||||
{false, true, false, 30, 340, 96, 24, SM_DYN_SLICE, 1000, 30.0, 2, ""},
|
||||
{false, true, false, 30, 140, 196, 51, SM_DYN_SLICE, 500, 7.5, 3, ""},
|
||||
{false, true, false, 30, 110, 296, 50, SM_DYN_SLICE, 500, 7.5, 2, ""},
|
||||
{false, true, false, 30, 104, 416, 44, SM_DYN_SLICE, 500, 7.5, 2, ""},
|
||||
{false, true, false, 30, 16, 16, 2, SM_DYN_SLICE, 500, 7.5, 3, ""},
|
||||
{false, true, false, 30, 32, 16, 2, SM_DYN_SLICE, 500, 7.5, 3, ""},
|
||||
{false, true, false, 30, 32, 16, 2, SM_SIZELIMITED_SLICE, 500, 7.5, 1, ""},
|
||||
{false, true, false, 30, 600, 460, 1, SM_SIZELIMITED_SLICE, 450, 15.0, 4, ""},
|
||||
{false, true, false, 30, 340, 96, 24, SM_SIZELIMITED_SLICE, 1000, 30.0, 2, ""},
|
||||
{false, true, false, 30, 140, 196, 51, SM_SIZELIMITED_SLICE, 500, 7.5, 3, ""},
|
||||
{false, true, false, 30, 110, 296, 50, SM_SIZELIMITED_SLICE, 500, 7.5, 2, ""},
|
||||
{false, true, false, 30, 104, 416, 44, SM_SIZELIMITED_SLICE, 500, 7.5, 2, ""},
|
||||
{false, true, false, 30, 16, 16, 2, SM_SIZELIMITED_SLICE, 500, 7.5, 3, ""},
|
||||
{false, true, false, 30, 32, 16, 2, SM_SIZELIMITED_SLICE, 500, 7.5, 3, ""},
|
||||
{false, false, true, 30, 600, 460, 1, SM_FIXEDSLCNUM_SLICE, 0, 15.0, 4, ""},
|
||||
{false, false, true, 30, 600, 460, 1, SM_AUTO_SLICE, 0, 15.0, 4, ""},
|
||||
{false, false, true, 30, 600, 460, 1, SM_FIXEDSLCNUM_SLICE, 0, 15.0, 8, ""},
|
||||
};
|
||||
|
||||
class EncodeTestAPI : public ::testing::TestWithParam<EncodeOptionParam>, public ::EncodeDecodeTestAPIBase {
|
||||
@ -3533,9 +3532,9 @@ TEST_P (EncodeTestAPI, SetEncOptionSize) {
|
||||
param_.sSpatialLayers[0].iVideoWidth = p.iWidth ;
|
||||
param_.sSpatialLayers[0].iVideoHeight = p.iHeight;
|
||||
param_.sSpatialLayers[0].fFrameRate = p.fFramerate;
|
||||
param_.sSpatialLayers[0].sSliceCfg.uiSliceMode = p.eSliceMode;
|
||||
if (SM_AUTO_SLICE == p.eSliceMode || SM_FIXEDSLCNUM_SLICE == p.eSliceMode ) {
|
||||
param_.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceNum = 8;
|
||||
param_.sSpatialLayers[0].sSliceArgument.uiSliceMode = p.eSliceMode;
|
||||
if ( SM_FIXEDSLCNUM_SLICE == p.eSliceMode ) {
|
||||
param_.sSpatialLayers[0].sSliceArgument.uiSliceNum = 8;
|
||||
}
|
||||
|
||||
encoder_->Uninitialize();
|
||||
@ -3555,7 +3554,7 @@ TEST_P (EncodeTestAPI, SetEncOptionSize) {
|
||||
unsigned char* pData[3] = { NULL };
|
||||
|
||||
//FIXME: remove this after the multi-thread case is correctly handled in encoder
|
||||
if (p.iThreads>1 && SM_DYN_SLICE == p.eSliceMode) {
|
||||
if (p.iThreads>1 && SM_SIZELIMITED_SLICE == p.eSliceMode) {
|
||||
p.bAllRandom = false;
|
||||
}
|
||||
|
||||
@ -3742,18 +3741,19 @@ TEST_F (EncodeDecodeTestAPI, DiffSlicingInDlayer) {
|
||||
sParam.bSimulcastAVC = 1;
|
||||
sParam.sSpatialLayers[0].iVideoWidth = (iWidth >> 2);
|
||||
sParam.sSpatialLayers[0].iVideoHeight = (iHeight >> 2);
|
||||
sParam.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_ROWMB_SLICE;
|
||||
sParam.sSpatialLayers[0].sSliceArgument.uiSliceMode = SM_RASTER_SLICE;
|
||||
sParam.sSpatialLayers[1].sSliceArgument.uiSliceMbNum[0] = 0;
|
||||
|
||||
sParam.sSpatialLayers[1].iVideoWidth = (iWidth >> 1);
|
||||
sParam.sSpatialLayers[1].iVideoHeight = (iHeight >> 1);
|
||||
sParam.sSpatialLayers[1].sSliceCfg.uiSliceMode = SM_RASTER_SLICE;
|
||||
sParam.sSpatialLayers[1].sSliceCfg.sSliceArgument.uiSliceMbNum[0] = 30;
|
||||
sParam.sSpatialLayers[1].sSliceCfg.sSliceArgument.uiSliceMbNum[1] = 32;
|
||||
sParam.sSpatialLayers[1].sSliceArgument.uiSliceMode = SM_RASTER_SLICE;
|
||||
sParam.sSpatialLayers[1].sSliceArgument.uiSliceMbNum[0] = 30;
|
||||
sParam.sSpatialLayers[1].sSliceArgument.uiSliceMbNum[1] = 32;
|
||||
|
||||
sParam.sSpatialLayers[2].iVideoWidth = iWidth;
|
||||
sParam.sSpatialLayers[2].iVideoHeight = iHeight;
|
||||
sParam.sSpatialLayers[2].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
sParam.sSpatialLayers[2].sSliceCfg.sSliceArgument.uiSliceNum = (rand() % 30) + 1;
|
||||
sParam.sSpatialLayers[2].sSliceArgument.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
sParam.sSpatialLayers[2].sSliceArgument.uiSliceNum = (rand() % 30) + 1;
|
||||
|
||||
int rv = encoder_->InitializeExt (&sParam);
|
||||
ASSERT_TRUE (rv == cmResultSuccess) << "Init Failed sParam: rv = " << rv;;
|
||||
@ -3812,12 +3812,12 @@ TEST_F (EncodeDecodeTestAPI, DiffSlicingInDlayerMixed) {
|
||||
sParam.bSimulcastAVC = 1;
|
||||
sParam.sSpatialLayers[0].iVideoWidth = (iWidth >> 2);
|
||||
sParam.sSpatialLayers[0].iVideoHeight = (iHeight >> 2);
|
||||
sParam.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_ROWMB_SLICE;
|
||||
sParam.sSpatialLayers[0].sSliceArgument.uiSliceMode = SM_RASTER_SLICE;
|
||||
|
||||
sParam.sSpatialLayers[1].iVideoWidth = iWidth;
|
||||
sParam.sSpatialLayers[1].iVideoHeight = iHeight;
|
||||
sParam.sSpatialLayers[1].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
sParam.sSpatialLayers[1].sSliceCfg.sSliceArgument.uiSliceNum = 1;
|
||||
sParam.sSpatialLayers[1].sSliceArgument.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
sParam.sSpatialLayers[1].sSliceArgument.uiSliceNum = 1;
|
||||
|
||||
int rv = encoder_->InitializeExt (&sParam);
|
||||
ASSERT_TRUE (rv == cmResultSuccess) << "Init Failed sParam: rv = " << rv;;
|
||||
@ -3876,8 +3876,8 @@ TEST_F (EncodeDecodeTestAPI, ThreadNumAndSliceNum) {
|
||||
sParam.bSimulcastAVC = 1;
|
||||
sParam.sSpatialLayers[0].iVideoWidth = iWidth;
|
||||
sParam.sSpatialLayers[0].iVideoHeight = iHeight;
|
||||
sParam.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
sParam.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceNum = (rand() % 2) ? (sParam.iMultipleThreadIdc + 1) :
|
||||
sParam.sSpatialLayers[0].sSliceArgument.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
sParam.sSpatialLayers[0].sSliceArgument.uiSliceNum = (rand() % 2) ? (sParam.iMultipleThreadIdc + 1) :
|
||||
(sParam.iMultipleThreadIdc - 1);
|
||||
|
||||
int rv = encoder_->InitializeExt (&sParam);
|
||||
|
@ -56,7 +56,7 @@ void EncFileParamToParamExt (EncodeFileParam* pEncFileParam, SEncParamExt* pEnxP
|
||||
pEnxParamExt->iEntropyCodingModeFlag = pEncFileParam->bCabac ? 1 : 0;
|
||||
|
||||
for (int i = 0; i < pEnxParamExt->iSpatialLayerNum; i++) {
|
||||
pEnxParamExt->sSpatialLayers[i].sSliceCfg.uiSliceMode = pEncFileParam->eSliceMode;
|
||||
pEnxParamExt->sSpatialLayers[i].sSliceArgument.uiSliceMode = pEncFileParam->eSliceMode;
|
||||
}
|
||||
|
||||
}
|
||||
@ -115,7 +115,7 @@ static const EncodeFileParam kFileParamArray[] = {
|
||||
},
|
||||
{
|
||||
"res/CiscoVT2people_320x192_12fps.yuv",
|
||||
"21dbfaaf4f09af735298434c1f97cf95a464165b", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_ROWMB_SLICE, false, 1, false, false, false // One slice per MB row
|
||||
"21dbfaaf4f09af735298434c1f97cf95a464165b", CAMERA_VIDEO_REAL_TIME, 320, 192, 12.0f, SM_RASTER_SLICE, false, 1, false, false, false // One slice per MB row
|
||||
},
|
||||
{
|
||||
"res/CiscoVT2people_320x192_12fps.yuv",
|
||||
@ -127,7 +127,7 @@ static const EncodeFileParam kFileParamArray[] = {
|
||||
},
|
||||
{
|
||||
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
|
||||
"a747529a097f581b66f779860c2c491d8cac32fe", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false, false
|
||||
"a747529a097f581b66f779860c2c491d8cac32fe", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, false
|
||||
},
|
||||
{
|
||||
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
|
||||
@ -148,12 +148,12 @@ static const EncodeFileParam kFileParamArray[] = {
|
||||
},
|
||||
{
|
||||
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
|
||||
"aa0aaca96475c65d66e90e513618fa814b098dff", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false, false
|
||||
"aa0aaca96475c65d66e90e513618fa814b098dff", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, false
|
||||
},
|
||||
//for different strategy
|
||||
{
|
||||
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
|
||||
"5622722316eed2482bf78520eda7e448312e340e", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, true, true, false
|
||||
"5622722316eed2482bf78520eda7e448312e340e", SCREEN_CONTENT_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, true, true, false
|
||||
},
|
||||
{
|
||||
"res/CiscoVT2people_320x192_12fps.yuv",
|
||||
@ -161,7 +161,7 @@ static const EncodeFileParam kFileParamArray[] = {
|
||||
},
|
||||
{
|
||||
"res/Cisco_Absolute_Power_1280x720_30fps.yuv",
|
||||
"6c13d959d981d412343664b4830dd4042bc4ddf9", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_DYN_SLICE, false, 1, false, false, true
|
||||
"6c13d959d981d412343664b4830dd4042bc4ddf9", CAMERA_VIDEO_REAL_TIME, 1280, 720, 30.0f, SM_SIZELIMITED_SLICE, false, 1, false, false, true
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -892,7 +892,7 @@ TEST_F (EncoderInterfaceTest, SkipFrameCheck) {
|
||||
sEncParamExt.sSpatialLayers[0].fFrameRate = 28.248587f;
|
||||
sEncParamExt.sSpatialLayers[0].iSpatialBitrate = 573000;
|
||||
sEncParamExt.sSpatialLayers[0].iMaxSpatialBitrate = 895839855;
|
||||
sEncParamExt.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
sEncParamExt.sSpatialLayers[0].sSliceArgument.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
|
||||
pParamExt->iPicWidth = sEncParamExt.sSpatialLayers[0].iVideoWidth;
|
||||
pParamExt->iPicHeight = sEncParamExt.sSpatialLayers[0].iVideoHeight;
|
||||
@ -955,21 +955,21 @@ TEST_F (EncoderInterfaceTest, DiffResolutionCheck) {
|
||||
sEncParamExt.sSpatialLayers[0].iVideoHeight = 160;
|
||||
sEncParamExt.sSpatialLayers[0].fFrameRate = 6;
|
||||
sEncParamExt.sSpatialLayers[0].iSpatialBitrate = 80000;
|
||||
sEncParamExt.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
sEncParamExt.sSpatialLayers[0].sSliceArgument.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
|
||||
sEncParamExt.sSpatialLayers[1].uiLevelIdc = LEVEL_UNKNOWN;
|
||||
sEncParamExt.sSpatialLayers[1].iVideoWidth = 180;
|
||||
sEncParamExt.sSpatialLayers[1].iVideoHeight = 320;
|
||||
sEncParamExt.sSpatialLayers[1].fFrameRate = 12;
|
||||
sEncParamExt.sSpatialLayers[1].iSpatialBitrate = 200000;
|
||||
sEncParamExt.sSpatialLayers[1].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
sEncParamExt.sSpatialLayers[1].sSliceArgument.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
|
||||
sEncParamExt.sSpatialLayers[2].uiLevelIdc = LEVEL_UNKNOWN;
|
||||
sEncParamExt.sSpatialLayers[2].iVideoWidth = 360;
|
||||
sEncParamExt.sSpatialLayers[2].iVideoHeight = 640;
|
||||
sEncParamExt.sSpatialLayers[2].fFrameRate = 24;
|
||||
sEncParamExt.sSpatialLayers[2].iSpatialBitrate = 600000;
|
||||
sEncParamExt.sSpatialLayers[2].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
sEncParamExt.sSpatialLayers[2].sSliceArgument.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
|
||||
|
||||
pParamExt->iPicWidth = sEncParamExt.iPicWidth;
|
||||
pParamExt->iPicHeight = sEncParamExt.iPicWidth;
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -34,6 +34,6 @@ SlicesAssign7 0 # count number of MBs in slice #7
|
||||
# 1 SM_FIXEDSLCNUM_SLICE | according to SliceNum | Enabled dynamic slicing for multi-thread
|
||||
# 2 SM_RASTER_SLICE | according to SlicesAssign | Need input of MB numbers each slice. In addition, if other constraint in slice_argument is presented, need to follow the constraints. Typically if MB num and slice size are both constrained, re-encoding may be involved.
|
||||
# 3 SM_ROWMB_SLICE | according to PictureMBHeight | Typical of single row of mbs each slice?+ slice size constraint which including re-encoding
|
||||
# 4 SM_DYN_SLICE | according to SliceSize | Dynamic slicing (have no idea about slice_nums until encoding current frame)
|
||||
# 4 SM_SIZELIMITED_SLICE | according to SliceSize | Dynamic slicing (have no idea about slice_nums until encoding current frame)
|
||||
# 5 SM_AUTO_SLICE | according to thread number | the number of slices is decided by the number of threads,SliceNum is ignored
|
||||
|
||||
|
@ -27,6 +27,7 @@ LoopFilterAlphaC0Offset 0 # AlphaOffset(-6..+6): valid rang
|
||||
LoopFilterBetaOffset 0 # BetaOffset (-6..+6): valid range
|
||||
#============================== SOFTWARE IMPLEMENTATION ==============================
|
||||
MultipleThreadIdc 1 # 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads;
|
||||
UseLoadBalancing 1 # under particular slice mode, when multi-threading is used, whether apply dynamic slicing for load balancing
|
||||
|
||||
#============================== RATE CONTROL ==============================
|
||||
RCMode 0 # 0: quality mode; 1: bitrate mode; # 2: buffer based mode,can't control bitrate; -1: rc off mode;
|
||||
|
Loading…
Reference in New Issue
Block a user