Merge pull request #188 from ruil2/MaxGOPSize_update
update Max GOP size and minor fixes for early return-- review request#59
This commit is contained in:
commit
c0e72338c1
@ -36,7 +36,7 @@
|
||||
////////////////Data and /or structures introduced in Cisco OpenH264 application////////////////
|
||||
|
||||
/* Constants */
|
||||
#define MAX_TEMPORAL_LAYER_NUM 5
|
||||
#define MAX_TEMPORAL_LAYER_NUM 4
|
||||
#define MAX_SPATIAL_LAYER_NUM 4
|
||||
#define MAX_QUALITY_LAYER_NUM 4
|
||||
|
||||
|
@ -754,6 +754,13 @@ int ProcessEncodingSvcWithParam (ISVCEncoder* pPtrEnc, int argc, char** argv) {
|
||||
SFrameBSInfo sFbi;
|
||||
SVCEncodingParam sSvcParam;
|
||||
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 )
|
||||
FILE* fTrackStream = fopen ("coding_size.stream", "wb");;
|
||||
#endif
|
||||
@ -776,20 +783,17 @@ int ProcessEncodingSvcWithParam (ISVCEncoder* pPtrEnc, int argc, char** argv) {
|
||||
int iParsedNum = 3;
|
||||
if (ParseCommandLine (argc - iParsedNum, argv + iParsedNum, sSvcParam) != 0) {
|
||||
printf ("parse pCommand line failed\n");
|
||||
fclose (pFpSrc);
|
||||
return 1;
|
||||
ret = 1;
|
||||
goto ERROR_RET;
|
||||
}
|
||||
|
||||
if (cmResultSuccess != pPtrEnc->Initialize (&sSvcParam, INIT_TYPE_PARAMETER_BASED)) {
|
||||
fprintf (stderr, "Encoder Initialization failed!\n");
|
||||
fclose (pFpSrc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const int32_t iPicLumaSize = sSvcParam.iPicWidth * sSvcParam.iPicHeight;
|
||||
int32_t iFrameSize = 0;
|
||||
uint8_t* pPlanes[3] = { 0 };
|
||||
ret = 1;
|
||||
goto ERROR_RET;
|
||||
}
|
||||
|
||||
iPicLumaSize = sSvcParam.iPicWidth * sSvcParam.iPicHeight;
|
||||
switch (sSvcParam.iInputCsp) {
|
||||
int iStride;
|
||||
case videoFormatI420:
|
||||
@ -821,10 +825,10 @@ int ProcessEncodingSvcWithParam (ISVCEncoder* pPtrEnc, int argc, char** argv) {
|
||||
pPlanes[0] = new uint8_t[iFrameSize];
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
ret = 1;
|
||||
goto ERROR_RET;
|
||||
}
|
||||
|
||||
int32_t iFrame = 0;
|
||||
while (true) {
|
||||
if (feof (pFpSrc))
|
||||
break;
|
||||
@ -872,7 +876,7 @@ int ProcessEncodingSvcWithParam (ISVCEncoder* pPtrEnc, int argc, char** argv) {
|
||||
delete [] pPlanes[0];
|
||||
pPlanes[0] = NULL;
|
||||
}
|
||||
|
||||
ERROR_RET:
|
||||
if (pFpBs) {
|
||||
fclose (pFpBs);
|
||||
pFpBs = NULL;
|
||||
@ -882,7 +886,7 @@ int ProcessEncodingSvcWithParam (ISVCEncoder* pPtrEnc, int argc, char** argv) {
|
||||
pFpSrc = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -1196,7 +1200,7 @@ INSIDE_MEM_FREE: {
|
||||
pSrcPicList[i] = NULL;
|
||||
}
|
||||
}
|
||||
delete pSrcPicList;
|
||||
delete []pSrcPicList;
|
||||
pSrcPicList = NULL;
|
||||
}
|
||||
|
||||
|
@ -257,6 +257,8 @@ void FillDefault (const bool_t kbEnableRc) {
|
||||
bPrefixNalAddingCtrl = true; // prefix NAL adding control
|
||||
iNumDependencyLayer = 0; // number of dependency(Spatial/CGS) layers used to be encoded
|
||||
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) {
|
||||
|
@ -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] = {
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0
|
||||
}, // gop size = 1
|
||||
}, // uiGopSize = 1
|
||||
{
|
||||
0, 1, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0
|
||||
}, // uiGopSize = 2
|
||||
{
|
||||
0, 2, 1, 2, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0
|
||||
}, // uiGopSize = 4
|
||||
{
|
||||
0, 3, 2, 3, 1, 3, 2, 3,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0
|
||||
}, // uiGopSize = 8
|
||||
{
|
||||
0, 4, 3, 4, 2, 4, 3, 4,
|
||||
1, 4, 3, 4, 2, 4, 3, 4,
|
||||
0
|
||||
} // uiGopSize = 16
|
||||
} //uiGopSize = 8
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// extern at svc_encode_slice.h
|
||||
|
@ -319,7 +319,7 @@ void RcTraceVGopBitrate (sWelsEncCtx* pEncCtx) {
|
||||
if (pWelsSvcRc->iFrameCodedInVGop) {
|
||||
const int32_t kiHighestTid = pEncCtx->pSvcParam->sDependencyLayers[kiDid].iHighestTemporalId;
|
||||
SRCTemporal* pTOverRc = pWelsSvcRc->pTemporalOverRc;
|
||||
int32_t iVGopBitrate;
|
||||
int32_t iVGopBitrate = 0;
|
||||
int32_t iTotalBits = pWelsSvcRc->iPaddingBitrateStat;
|
||||
int32_t iTid = 0;
|
||||
while (iTid <= kiHighestTid) {
|
||||
|
@ -76,7 +76,6 @@ const uint8_t g_kuiRefTemporalIdx[MAX_TEMPORAL_LEVEL][MAX_GOP_SIZE] = {
|
||||
{ 0, 0, }, // 1
|
||||
{ 0, 0, 0, 1, }, // 2
|
||||
{ 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user