dump file refactor
This commit is contained in:
parent
b3fa8dd334
commit
594fc4fe7b
@ -89,7 +89,8 @@ typedef enum {
|
|||||||
ENCODER_OPTION_ENABLE_PREFIX_NAL_ADDING, //enable prefix: true--enable prefix; false--disable prefix
|
ENCODER_OPTION_ENABLE_PREFIX_NAL_ADDING, //enable prefix: true--enable prefix; false--disable prefix
|
||||||
ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, //disable pSps/pPps id addition: true--disable pSps/pPps id; false--enable pSps/pPps id addistion
|
ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, //disable pSps/pPps id addition: true--disable pSps/pPps id; false--enable pSps/pPps id addistion
|
||||||
|
|
||||||
ENCODER_OPTION_CURRENT_PATH
|
ENCODER_OPTION_CURRENT_PATH,
|
||||||
|
ENCODER_OPTION_DUMP_FILE
|
||||||
} ENCODER_OPTION;
|
} ENCODER_OPTION;
|
||||||
|
|
||||||
/* Option types introduced in decoder application */
|
/* Option types introduced in decoder application */
|
||||||
@ -295,5 +296,8 @@ typedef struct Source_Picture_s {
|
|||||||
long long uiTimeStamp;
|
long long uiTimeStamp;
|
||||||
} SSourcePicture;
|
} SSourcePicture;
|
||||||
|
|
||||||
|
typedef struct Dump_Layer_s{
|
||||||
|
int iLayer;
|
||||||
|
char *pFileName;
|
||||||
|
}SDumpLayer;
|
||||||
#endif//WELS_VIDEO_CODEC_APPLICATION_DEFINITION_H__
|
#endif//WELS_VIDEO_CODEC_APPLICATION_DEFINITION_H__
|
||||||
|
@ -48,9 +48,8 @@ using namespace std;
|
|||||||
typedef struct tagFilesSet {
|
typedef struct tagFilesSet {
|
||||||
string strBsFile;
|
string strBsFile;
|
||||||
string strSeqFile; // for cmd lines
|
string strSeqFile; // for cmd lines
|
||||||
struct {
|
string strLayerCfgFile[MAX_DEPENDENCY_LAYER];
|
||||||
string strLayerCfgFile;
|
char sRecFileName[MAX_DEPENDENCY_LAYER][MAX_FNAME_LEN];
|
||||||
} sSpatialLayers[MAX_DEPENDENCY_LAYER];
|
|
||||||
} SFilesSet;
|
} SFilesSet;
|
||||||
|
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ int ParseConfig (CReadConfig& cRdCfg, SSourcePicture* pSrcPic, SEncParamExt& pSv
|
|||||||
}
|
}
|
||||||
} else if (strTag[0].compare ("LayerCfg") == 0) {
|
} else if (strTag[0].compare ("LayerCfg") == 0) {
|
||||||
if (strTag[1].length() > 0)
|
if (strTag[1].length() > 0)
|
||||||
sFileSet.sSpatialLayers[iLayerCount].strLayerCfgFile = strTag[1];
|
sFileSet.strLayerCfgFile[iLayerCount] = strTag[1];
|
||||||
// pSvcParam.sDependencyLayers[iLayerCount].uiDependencyId = iLayerCount;
|
// pSvcParam.sDependencyLayers[iLayerCount].uiDependencyId = iLayerCount;
|
||||||
++ iLayerCount;
|
++ iLayerCount;
|
||||||
} else if (strTag[0].compare ("PrefixNALAddingCtrl") == 0) {
|
} else if (strTag[0].compare ("PrefixNALAddingCtrl") == 0) {
|
||||||
@ -305,7 +305,7 @@ int ParseConfig (CReadConfig& cRdCfg, SSourcePicture* pSrcPic, SEncParamExt& pSv
|
|||||||
|
|
||||||
for (int8_t iLayer = 0; iLayer < kiActualLayerNum; ++ iLayer) {
|
for (int8_t iLayer = 0; iLayer < kiActualLayerNum; ++ iLayer) {
|
||||||
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
|
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
|
||||||
CReadConfig cRdLayerCfg (sFileSet.sSpatialLayers[iLayer].strLayerCfgFile);
|
CReadConfig cRdLayerCfg (sFileSet.strLayerCfgFile[iLayer]);
|
||||||
if (-1==ParseLayerConfig( cRdLayerCfg, iLayer, pSvcParam ))
|
if (-1==ParseLayerConfig( cRdLayerCfg, iLayer, pSvcParam ))
|
||||||
{
|
{
|
||||||
iRet = 1;
|
iRet = 1;
|
||||||
@ -477,11 +477,11 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
|
|||||||
pSvcParam.iSpatialLayerNum = atoi (argv[n++]);
|
pSvcParam.iSpatialLayerNum = atoi (argv[n++]);
|
||||||
for (int ln = 0 ; (ln < pSvcParam.iSpatialLayerNum) && (n < argc) ; ln++) {
|
for (int ln = 0 ; (ln < pSvcParam.iSpatialLayerNum) && (n < argc) ; ln++) {
|
||||||
// pSvcParam.sDependencyLayers[ln].uiDependencyId = ln;
|
// pSvcParam.sDependencyLayers[ln].uiDependencyId = ln;
|
||||||
sFileSet.sSpatialLayers[ln].strLayerCfgFile.assign (argv[n++]);
|
sFileSet.strLayerCfgFile[ln].assign (argv[n++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int8_t iLayer = 0; iLayer < pSvcParam.iSpatialLayerNum; ++ iLayer) {
|
for (int8_t iLayer = 0; iLayer < pSvcParam.iSpatialLayerNum; ++ iLayer) {
|
||||||
CReadConfig cRdLayerCfg (sFileSet.sSpatialLayers[iLayer].strLayerCfgFile);
|
CReadConfig cRdLayerCfg (sFileSet.strLayerCfgFile[iLayer]);
|
||||||
if (-1==ParseLayerConfig( cRdLayerCfg, iLayer, pSvcParam ))
|
if (-1==ParseLayerConfig( cRdLayerCfg, iLayer, pSvcParam ))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
@ -489,19 +489,13 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!strcmp (pCommand, "-drec") && (n + 1 < argc)) {
|
else if (!strcmp (pCommand, "-drec") && (n + 1 < argc)) {
|
||||||
#ifdef ENABLE_FRAME_DUMP
|
|
||||||
unsigned int iLayer = atoi (argv[n++]);
|
unsigned int iLayer = atoi (argv[n++]);
|
||||||
const int iLen = strlen (argv[n]);
|
const int iLen = strlen (argv[n]);
|
||||||
SDLayerParam* pDLayer = &pSvcParam.sDependencyLayers[iLayer];
|
if (iLen >= sizeof(sFileSet.sRecFileName[iLayer]))
|
||||||
if (iLen >= sizeof(pDLayer->sRecFileName))
|
|
||||||
return 1;
|
return 1;
|
||||||
pDLayer->sRecFileName[iLen] = '\0';
|
sFileSet.sRecFileName[iLayer][iLen] = '\0';
|
||||||
strncpy (pDLayer->sRecFileName, argv[n++], iLen); // confirmed_safe_unsafe_usage
|
strncpy (sFileSet.sRecFileName[iLayer], argv[n++], iLen); // confirmed_safe_unsafe_usage
|
||||||
#else
|
|
||||||
n += 2;
|
|
||||||
#endif//ENABLE_FRAME_DUMP
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!strcmp (pCommand, "-dw") && (n + 1 < argc)) {
|
else if (!strcmp (pCommand, "-dw") && (n + 1 < argc)) {
|
||||||
unsigned int iLayer = atoi (argv[n++]);
|
unsigned int iLayer = atoi (argv[n++]);
|
||||||
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
|
SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
|
||||||
@ -700,7 +694,6 @@ int ProcessEncodingSvcWithParam (ISVCEncoder* pPtrEnc, int argc, char** argv) {
|
|||||||
ret = 1;
|
ret = 1;
|
||||||
goto ERROR_RET;
|
goto ERROR_RET;
|
||||||
}
|
}
|
||||||
|
|
||||||
iPicLumaSize = sSvcParam.iPicWidth * sSvcParam.iPicHeight;
|
iPicLumaSize = sSvcParam.iPicWidth * sSvcParam.iPicHeight;
|
||||||
switch (sSvcParam.iInputCsp) {
|
switch (sSvcParam.iInputCsp) {
|
||||||
int iStride;
|
int iStride;
|
||||||
@ -852,7 +845,7 @@ int ProcessEncodingSvcWithConfig (ISVCEncoder* pPtrEnc, int argc, char** argv) {
|
|||||||
|
|
||||||
memset (&sFbi, 0, sizeof (SFrameBSInfo));
|
memset (&sFbi, 0, sizeof (SFrameBSInfo));
|
||||||
memset (&sSvcParam, 0, sizeof (SEncParamExt));
|
memset (&sSvcParam, 0, sizeof (SEncParamExt));
|
||||||
|
memset (&fs,0,sizeof(SFilesSet));
|
||||||
sSvcParam.iInputCsp = videoFormatI420; // I420 in default
|
sSvcParam.iInputCsp = videoFormatI420; // I420 in default
|
||||||
sSvcParam.sSpatialLayers[0].uiProfileIdc = PRO_BASELINE;
|
sSvcParam.sSpatialLayers[0].uiProfileIdc = PRO_BASELINE;
|
||||||
// svc_cfg->sDependencyLayers[0].frext_mode = 0;
|
// svc_cfg->sDependencyLayers[0].frext_mode = 0;
|
||||||
@ -918,6 +911,20 @@ int ProcessEncodingSvcWithConfig (ISVCEncoder* pPtrEnc, int argc, char** argv) {
|
|||||||
iRet = 1;
|
iRet = 1;
|
||||||
goto INSIDE_MEM_FREE;
|
goto INSIDE_MEM_FREE;
|
||||||
}
|
}
|
||||||
|
for(int iLayer = 0;iLayer<MAX_DEPENDENCY_LAYER;iLayer++)
|
||||||
|
{
|
||||||
|
if(fs.sRecFileName[iLayer][0]!=0)
|
||||||
|
{
|
||||||
|
SDumpLayer sDumpLayer;
|
||||||
|
sDumpLayer.iLayer = iLayer;
|
||||||
|
sDumpLayer.pFileName = fs.sRecFileName[iLayer];
|
||||||
|
if(cmResultSuccess!=pPtrEnc->SetOption(ENCODER_OPTION_DUMP_FILE,&sDumpLayer)){
|
||||||
|
fprintf (stderr, "SetOption ENCODER_OPTION_DUMP_FILE failed!\n");
|
||||||
|
iRet = 1;
|
||||||
|
goto INSIDE_MEM_FREE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Inactive with sink with output file handler
|
// Inactive with sink with output file handler
|
||||||
if (fs.strBsFile.length() > 0) {
|
if (fs.strBsFile.length() > 0) {
|
||||||
pFpBs = fopen (fs.strBsFile.c_str(), "wb");
|
pFpBs = fopen (fs.strBsFile.c_str(), "wb");
|
||||||
|
@ -938,6 +938,15 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ENCODER_OPTION_DUMP_FILE:{
|
||||||
|
#ifdef ENABLE_FRAME_DUMP
|
||||||
|
if(m_pEncContext->pSvcParam!=NULL){
|
||||||
|
SDumpLayer*pDump = (static_cast<SDumpLayer *>(pOption));
|
||||||
|
WelsStrncpy(m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName, pDump->pFileName, sizeof(m_pEncContext->pSvcParam->sDependencyLayers[pDump->iLayer].sRecFileName))
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return cmInitParaError;
|
return cmInitParaError;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user