update Max GOP size and minor fixes for early return

This commit is contained in:
ruil2 2014-01-22 15:22:58 +08:00
parent ae73411f9a
commit 4fd3bafa65
6 changed files with 24 additions and 27 deletions

View File

@ -36,7 +36,7 @@
////////////////Data and /or structures introduced in Cisco OpenH264 application//////////////// ////////////////Data and /or structures introduced in Cisco OpenH264 application////////////////
/* Constants */ /* Constants */
#define MAX_TEMPORAL_LAYER_NUM 5 #define MAX_TEMPORAL_LAYER_NUM 4
#define MAX_SPATIAL_LAYER_NUM 4 #define MAX_SPATIAL_LAYER_NUM 4
#define MAX_QUALITY_LAYER_NUM 4 #define MAX_QUALITY_LAYER_NUM 4

View File

@ -754,6 +754,13 @@ int ProcessEncodingSvcWithParam (ISVCEncoder* pPtrEnc, int argc, char** argv) {
SFrameBSInfo sFbi; SFrameBSInfo sFbi;
SVCEncodingParam sSvcParam; SVCEncodingParam sSvcParam;
int64_t iStart = 0, iTotal = 0; int64_t iStart = 0, iTotal = 0;
int32_t ret = 0;
int32_t iPicLumaSize = 0;
int32_t iFrameSize = 0;
uint8_t* pPlanes[3] = { 0 };
int32_t iFrame = 0;
#if defined ( STICK_STREAM_SIZE ) #if defined ( STICK_STREAM_SIZE )
FILE* fTrackStream = fopen ("coding_size.stream", "wb");; FILE* fTrackStream = fopen ("coding_size.stream", "wb");;
#endif #endif
@ -776,20 +783,17 @@ int ProcessEncodingSvcWithParam (ISVCEncoder* pPtrEnc, int argc, char** argv) {
int iParsedNum = 3; int iParsedNum = 3;
if (ParseCommandLine (argc - iParsedNum, argv + iParsedNum, sSvcParam) != 0) { if (ParseCommandLine (argc - iParsedNum, argv + iParsedNum, sSvcParam) != 0) {
printf ("parse pCommand line failed\n"); printf ("parse pCommand line failed\n");
fclose (pFpSrc); ret = 1;
return 1; goto ERROR_RET;
} }
if (cmResultSuccess != pPtrEnc->Initialize (&sSvcParam, INIT_TYPE_PARAMETER_BASED)) { if (cmResultSuccess != pPtrEnc->Initialize (&sSvcParam, INIT_TYPE_PARAMETER_BASED)) {
fprintf (stderr, "Encoder Initialization failed!\n"); fprintf (stderr, "Encoder Initialization failed!\n");
fclose (pFpSrc); ret = 1;
return 1; goto ERROR_RET;
} }
const int32_t iPicLumaSize = sSvcParam.iPicWidth * sSvcParam.iPicHeight;
int32_t iFrameSize = 0;
uint8_t* pPlanes[3] = { 0 };
iPicLumaSize = sSvcParam.iPicWidth * sSvcParam.iPicHeight;
switch (sSvcParam.iInputCsp) { switch (sSvcParam.iInputCsp) {
int iStride; int iStride;
case videoFormatI420: case videoFormatI420:
@ -821,10 +825,10 @@ int ProcessEncodingSvcWithParam (ISVCEncoder* pPtrEnc, int argc, char** argv) {
pPlanes[0] = new uint8_t[iFrameSize]; pPlanes[0] = new uint8_t[iFrameSize];
break; break;
default: default:
return 1; ret = 1;
goto ERROR_RET;
} }
int32_t iFrame = 0;
while (true) { while (true) {
if (feof (pFpSrc)) if (feof (pFpSrc))
break; break;
@ -872,7 +876,7 @@ int ProcessEncodingSvcWithParam (ISVCEncoder* pPtrEnc, int argc, char** argv) {
delete [] pPlanes[0]; delete [] pPlanes[0];
pPlanes[0] = NULL; pPlanes[0] = NULL;
} }
ERROR_RET:
if (pFpBs) { if (pFpBs) {
fclose (pFpBs); fclose (pFpBs);
pFpBs = NULL; pFpBs = NULL;
@ -882,7 +886,7 @@ int ProcessEncodingSvcWithParam (ISVCEncoder* pPtrEnc, int argc, char** argv) {
pFpSrc = NULL; pFpSrc = NULL;
} }
return 0; return ret;
} }
@ -1196,7 +1200,7 @@ INSIDE_MEM_FREE: {
pSrcPicList[i] = NULL; pSrcPicList[i] = NULL;
} }
} }
delete pSrcPicList; delete []pSrcPicList;
pSrcPicList = NULL; pSrcPicList = NULL;
} }

View File

@ -257,6 +257,8 @@ void FillDefault (const bool_t kbEnableRc) {
bPrefixNalAddingCtrl = true; // prefix NAL adding control bPrefixNalAddingCtrl = true; // prefix NAL adding control
iNumDependencyLayer = 0; // number of dependency(Spatial/CGS) layers used to be encoded iNumDependencyLayer = 0; // number of dependency(Spatial/CGS) layers used to be encoded
iNumTemporalLayer = 0; // number of temporal layer specified iNumTemporalLayer = 0; // number of temporal layer specified
memset(sDependencyLayers,0,sizeof(SDLayerParam)*MAX_DEPENDENCY_LAYER);
} }
int32_t ParamTranscode (SVCEncodingParam& pCodingParam, const bool_t kbEnableRc = true) { int32_t ParamTranscode (SVCEncodingParam& pCodingParam, const bool_t kbEnableRc = true) {

View File

@ -468,31 +468,23 @@ const ALIGNED_DECLARE (uint8_t, g_kuiEncNcMapTable[18], 16) = {
const uint8_t g_kuiTemporalIdListTable[MAX_TEMPORAL_LEVEL][MAX_GOP_SIZE + 1] = { const uint8_t g_kuiTemporalIdListTable[MAX_TEMPORAL_LEVEL][MAX_GOP_SIZE + 1] = {
{ {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0 0
}, // gop size = 1 }, // gop size = 1
{ {
0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0 0
}, // uiGopSize = 2 }, // uiGopSize = 2
{ {
0, 2, 1, 2, 0, 0, 0, 0, 0, 2, 1, 2, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0 0
}, // uiGopSize = 4 }, // uiGopSize = 4
{ {
0, 3, 2, 3, 1, 3, 2, 3, 0, 3, 2, 3, 1, 3, 2, 3,
0, 0, 0, 0, 0, 0, 0, 0,
0 0
}, // uiGopSize = 8 } //uiGopSize = 8
{
0, 4, 3, 4, 2, 4, 3, 4,
1, 4, 3, 4, 2, 4, 3, 4,
0
} // uiGopSize = 16
}; };
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// extern at svc_encode_slice.h // extern at svc_encode_slice.h

View File

@ -319,7 +319,7 @@ void RcTraceVGopBitrate (sWelsEncCtx* pEncCtx) {
if (pWelsSvcRc->iFrameCodedInVGop) { if (pWelsSvcRc->iFrameCodedInVGop) {
const int32_t kiHighestTid = pEncCtx->pSvcParam->sDependencyLayers[kiDid].iHighestTemporalId; const int32_t kiHighestTid = pEncCtx->pSvcParam->sDependencyLayers[kiDid].iHighestTemporalId;
SRCTemporal* pTOverRc = pWelsSvcRc->pTemporalOverRc; SRCTemporal* pTOverRc = pWelsSvcRc->pTemporalOverRc;
int32_t iVGopBitrate; int32_t iVGopBitrate = 0;
int32_t iTotalBits = pWelsSvcRc->iPaddingBitrateStat; int32_t iTotalBits = pWelsSvcRc->iPaddingBitrateStat;
int32_t iTid = 0; int32_t iTid = 0;
while (iTid <= kiHighestTid) { while (iTid <= kiHighestTid) {

View File

@ -76,7 +76,6 @@ const uint8_t g_kuiRefTemporalIdx[MAX_TEMPORAL_LEVEL][MAX_GOP_SIZE] = {
{ 0, 0, }, // 1 { 0, 0, }, // 1
{ 0, 0, 0, 1, }, // 2 { 0, 0, 0, 1, }, // 2
{ 0, 0, 0, 2, 0, 1, 1, 2, }, // 3 { 0, 0, 0, 2, 0, 1, 1, 2, }, // 3
{ 0, 0, 0, 3, 0, 2, 2, 3, 0, 1, 1, 3, 1, 2, 2, 3 } // 4
}; };
const int32_t g_kiPixMapSizeInBits = sizeof (uint8_t) * 8; const int32_t g_kiPixMapSizeInBits = sizeof (uint8_t) * 8;