ref: 4fd3bafa655150f4b968ac769dbae9e298081eea
parent: ae73411f9ab5de7f104d8bc046fc9db8ec05f716
author: ruil2 <ruil2@cisco.com>
date: Wed Jan 22 10:22:58 EST 2014
update Max GOP size and minor fixes for early return
--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -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
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -754,6 +754,13 @@
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 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;
- }
+ ret = 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) {
int iStride;
case videoFormatI420:
@@ -821,10 +825,10 @@
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 @@
delete [] pPlanes[0];
pPlanes[0] = NULL;
}
-
+ERROR_RET:
if (pFpBs) {
fclose (pFpBs);
pFpBs = NULL;
@@ -882,7 +886,7 @@
pFpSrc = NULL;
}
- return 0;
+ return ret;
}
@@ -1196,7 +1200,7 @@
pSrcPicList[i] = NULL;
}
}
- delete pSrcPicList;
+ delete []pSrcPicList;
pSrcPicList = NULL;
}
--- a/codec/encoder/core/inc/param_svc.h
+++ b/codec/encoder/core/inc/param_svc.h
@@ -257,6 +257,8 @@
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) {
--- a/codec/encoder/core/src/encoder_data_tables.cpp
+++ b/codec/encoder/core/src/encoder_data_tables.cpp
@@ -469,30 +469,22 @@
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
{
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
--- a/codec/encoder/core/src/ratectl.cpp
+++ b/codec/encoder/core/src/ratectl.cpp
@@ -319,7 +319,7 @@
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) {
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -76,7 +76,6 @@
{ 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;