ref: 66960220287208577c5b4101575fd175a5ceb549
parent: 60aaf48744fc8acec7bf423ed0f09f2eb951fea6
parent: 436da21ccfd7f1fe6d7f38be56da86f83fe8ea33
author: ruil2 <ruil2@cisco.com>
date: Thu Nov 26 12:03:54 EST 2015
Merge pull request #2283 from shihuade/MultiThread_V4.3_SliceBs_V2 initial for iReturn and refact PPS Sps bs write function
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3507,7 +3507,7 @@
// writing parasets for (simulcast) svc
int32_t WriteSsvcParaset (sWelsEncCtx* pCtx, const int32_t kiSpatialNum,
SLayerBSInfo*& pLayerBsInfo, int32_t& iLayerNum, int32_t& iFrameSize) {
- int32_t iNonVclSize = 0, iCountNal = 0, iReturn = 0;
+ int32_t iNonVclSize = 0, iCountNal = 0, iReturn = ENC_RETURN_SUCCESS;
iReturn = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal, &iNonVclSize);
WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
@@ -3532,7 +3532,7 @@
// writing parasets for simulcast avc
int32_t WriteSavcParaset (sWelsEncCtx* pCtx, const int32_t kiSpatialNum,
SLayerBSInfo*& pLayerBsInfo, int32_t& iLayerNum, int32_t& iFrameSize) {
- int32_t iNonVclSize = 0, iCountNal = 0, iReturn;
+ int32_t iNonVclSize = 0, iCountNal = 0, iReturn = ENC_RETURN_SUCCESS;
// write SPS
iNonVclSize = 0;
@@ -3542,7 +3542,9 @@
for (int32_t iIdx = 0; iIdx < pCtx->iSpsNum; iIdx++) {
//writing one NAL
int32_t iNalSize = 0;
- iReturn = WelsWriteOneSPS (pCtx, iIdx, iNalSize);
+ iCountNal = 0;
+
+ iReturn = WelsWriteOneSPS (pCtx, iIdx, iNalSize);
WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
pLayerBsInfo->pNalLengthInByte[iCountNal] = iNalSize;
@@ -3562,7 +3564,6 @@
pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
//update for external countings
- iCountNal = 0;
++ iLayerNum;
}
@@ -3574,7 +3575,9 @@
for (int32_t iIdx = 0; iIdx < pCtx->iPpsNum; iIdx++) {
//writing one NAL
int32_t iNalSize = 0;
- iReturn = WelsWriteOnePPS (pCtx, iIdx, iNalSize);
+ iCountNal = 0;
+
+ iReturn = WelsWriteOnePPS (pCtx, iIdx, iNalSize);
WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
pLayerBsInfo->pNalLengthInByte[iCountNal] = iNalSize;
@@ -3594,7 +3597,6 @@
pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
//update for external countings
- iCountNal = 0;
++ iLayerNum;
}
@@ -3612,7 +3614,7 @@
//cover the logic of simulcast avc + sps_pps_listing
int32_t WriteSavcParaset_Listing (sWelsEncCtx* pCtx, const int32_t kiSpatialNum,
SLayerBSInfo*& pLayerBsInfo, int32_t& iLayerNum, int32_t& iFrameSize) {
- int32_t iNonVclSize = 0, iCountNal = 0, iReturn;
+ int32_t iNonVclSize = 0, iCountNal = 0, iReturn = ENC_RETURN_SUCCESS;
// write SPS
iNonVclSize = 0;
@@ -3643,7 +3645,6 @@
pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
//update for external countings
- iCountNal = 0;
++ iLayerNum;
}
@@ -3679,7 +3680,6 @@
pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
//update for external countings
- iCountNal = 0;
++ iLayerNum;
}