History

add track sps change for each layer

Licai Guo committed 12 years ago

Commit 16cfb0a1 parent ca36beb2 files · +55 −8Browse files

Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 2 files). Show all

Unified · Split

codec/decoder/core/src/decoder_core.cpp+49−6
@@ -866,9 +866,9 @@ int32_t UpdateAccessUnit (PWelsDecoderContext pCtx) { · 865 unmodified lines
866866
867867 // Added for mosaic avoidance, 11/19/2009
868868 #ifdef LONG_TERM_REF
869− if (pCtx->bParamSetsLostFlag)
869+ if (pCtx->bParamSetsLostFlag || pCtx->bNewSeqBegin)
870870 #else
871− if (pCtx->bReferenceLostAtT0Flag)
871+ if (pCtx->bReferenceLostAtT0Flag || pCtx->bNewSeqBegin)
872872 #endif
873873 {
874874 uint32_t uiActualIdx = 0;
@@ -1458,8 +1458,51 @@ void WelsDecodeAccessUnitEnd (PWelsDecoderContext pCtx) { · 583 unmodified lines
14581458 ResetCurrentAccessUnit (pCtx);
14591459 }
14601460
1461−
1462−
1461+/* CheckNewSeqBeginAndUpdateActiveLayerSps
1462+ * return:
1463+ * true - the AU to be construct is the start of new sequence; false - not
1464+ */
1465+static bool CheckNewSeqBeginAndUpdateActiveLayerSps(PWelsDecoderContext pCtx) {
1466+ bool bNewSeq = false;
1467+ PAccessUnit pCurAu = pCtx->pAccessUnitList;
1468+ PSps pTmpLayerSps[MAX_LAYER_NUM];
1469+ for(int i = 0; i < MAX_LAYER_NUM; i++) {
1470+ pTmpLayerSps[i] = NULL;
1471+ }
1472+ // track the layer sps for the current au
1473+ for(int i = pCurAu->uiStartPos; i <= pCurAu->uiEndPos; i++) {
1474+ uint32_t uiDid = pCurAu->pNalUnitsList[i]->sNalHeaderExt.uiDependencyId;
1475+ pTmpLayerSps[uiDid] = pCurAu->pNalUnitsList[i]->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps;
1476+ }
1477+ int iMaxActiveLayer, iMaxCurrentLayer;
1478+ for(int i = MAX_LAYER_NUM - 1; i >= 0; i--) {
1479+ if (pCtx->pActiveLayerSps[i] != NULL) {
1480+ iMaxActiveLayer = i;
1481+ break;
1482+ }
1483+ }
1484+ for(int i = MAX_LAYER_NUM - 1; i >= 0; i--) {
1485+ if (pTmpLayerSps[i] != NULL) {
1486+ iMaxCurrentLayer = i;
1487+ break;
1488+ }
1489+ }
1490+ if (iMaxCurrentLayer != iMaxActiveLayer) {
1491+ bNewSeq = true;
1492+ }
1493+ // fill active sps if the current sps is not null while active layer is null
1494+ if (!bNewSeq) {
1495+ for(int i = 0; i < MAX_LAYER_NUM; i++) {
1496+ if (pCtx->pActiveLayerSps[i] == NULL && pTmpLayerSps[i] != NULL) {
1497+ pCtx->pActiveLayerSps[i] = pTmpLayerSps[i];
1498+ }
1499+ }
1500+ } else {
1501+ // UpdateActiveLayerSps if new sequence start
1502+ memcpy(&pCtx->pActiveLayerSps[0], &pTmpLayerSps[0], MAX_LAYER_NUM * sizeof(PSps));
1503+ }
1504+ return bNewSeq;
1505+}
14631506
14641507 /*
14651508 * ConstructAccessUnit
@@ -1483,7 +1526,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 17 unmodified lines
14831526
14841527 pCtx->bAuReadyFlag = false;
14851528 pCtx->bLastHasMmco5 = false;
1486−
1529+ pCtx->bNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps(pCtx);
14871530 iErr = WelsDecodeAccessUnitStart (pCtx);
14881531 GetVclNalTemporalId (pCtx);
14891532
@@ -1512,7 +1555,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 22 unmodified lines
15121555 iErr = DecodeCurrentAccessUnit (pCtx, ppDst, iStride, &iWidth, &iHeight, pDstInfo);
15131556
15141557 WelsDecodeAccessUnitEnd (pCtx);
1515−
1558+ pCtx->bNewSeqBegin = false;
15161559 if (ERR_NONE != iErr) {
15171560 WelsLog (pCtx, WELS_LOG_INFO, "returned error from decoding:[0x%x]\n", iErr);
15181561

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t