History

astyle all files

huili2 committed 12 years ago

Commit 5ed24f21 parent 0c24686120 files · +3967 −3886Browse files

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

Unified · Split

codec/decoder/core/src/decoder_core.cpp+22−18
@@ -970,7 +970,8 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid · 969 unmodified lines
970 pCtx->sMb.pInterPredictionDoneFlag[i] = (int8_t*) WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (970 pCtx->sMb.pInterPredictionDoneFlag[i] = (int8_t*) WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (
971 int8_t), "pCtx->sMb.pInterPredictionDoneFlag[]");971 int8_t), "pCtx->sMb.pInterPredictionDoneFlag[]");
972 972
973 pCtx->sMb.pMbCorrectlyDecodedFlag[i] = (bool*) WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (bool), "pCtx->sMb.pMbCorrectlyDecodedFlag[]");973 pCtx->sMb.pMbCorrectlyDecodedFlag[i] = (bool*) WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (bool),
974 "pCtx->sMb.pMbCorrectlyDecodedFlag[]");
974 975
975 // check memory block valid due above allocated..976 // check memory block valid due above allocated..
976 WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY,977 WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY,
@@ -1482,60 +1483,63 @@ void WelsDecodeAccessUnitEnd (PWelsDecoderContext pCtx) { · 505 unmodified lines
1482 * return:1483 * return:
1483 * true - the AU to be construct is the start of new sequence; false - not1484 * true - the AU to be construct is the start of new sequence; false - not
1484 */1485 */
1485static bool CheckNewSeqBeginAndUpdateActiveLayerSps(PWelsDecoderContext pCtx) {1486static bool CheckNewSeqBeginAndUpdateActiveLayerSps (PWelsDecoderContext pCtx) {
1486 bool bNewSeq = false;1487 bool bNewSeq = false;
1487 PAccessUnit pCurAu = pCtx->pAccessUnitList;1488 PAccessUnit pCurAu = pCtx->pAccessUnitList;
1488 PSps pTmpLayerSps[MAX_LAYER_NUM];1489 PSps pTmpLayerSps[MAX_LAYER_NUM];
1489 for(int i = 0; i < MAX_LAYER_NUM; i++) {1490 for (int i = 0; i < MAX_LAYER_NUM; i++) {
1490 pTmpLayerSps[i] = NULL;1491 pTmpLayerSps[i] = NULL;
1491 }1492 }
1492 // track the layer sps for the current au1493 // track the layer sps for the current au
1493 for(unsigned int i = pCurAu->uiStartPos; i <= pCurAu->uiEndPos; i++) {1494 for (unsigned int i = pCurAu->uiStartPos; i <= pCurAu->uiEndPos; i++) {
1494 uint32_t uiDid = pCurAu->pNalUnitsList[i]->sNalHeaderExt.uiDependencyId;1495 uint32_t uiDid = pCurAu->pNalUnitsList[i]->sNalHeaderExt.uiDependencyId;
1495 pTmpLayerSps[uiDid] = pCurAu->pNalUnitsList[i]->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps;1496 pTmpLayerSps[uiDid] = pCurAu->pNalUnitsList[i]->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps;
1496 if ((pCurAu->pNalUnitsList[i]->sNalHeaderExt.sNalUnitHeader.eNalUnitType == NAL_UNIT_CODED_SLICE_IDR) || (pCurAu->pNalUnitsList[i]->sNalHeaderExt.bIdrFlag))1497 if ((pCurAu->pNalUnitsList[i]->sNalHeaderExt.sNalUnitHeader.eNalUnitType == NAL_UNIT_CODED_SLICE_IDR)
1498 || (pCurAu->pNalUnitsList[i]->sNalHeaderExt.bIdrFlag))
1497 bNewSeq = true;1499 bNewSeq = true;
1498 }1500 }
1499 int iMaxActiveLayer = 0, iMaxCurrentLayer = 0;1501 int iMaxActiveLayer = 0, iMaxCurrentLayer = 0;
1500 for(int i = MAX_LAYER_NUM - 1; i >= 0; i--) {1502 for (int i = MAX_LAYER_NUM - 1; i >= 0; i--) {
1501 if (pCtx->pActiveLayerSps[i] != NULL) {1503 if (pCtx->pActiveLayerSps[i] != NULL) {
1502 iMaxActiveLayer = i;1504 iMaxActiveLayer = i;
1503 break;1505 break;
1504 }1506 }
1505 }1507 }
1506 for(int i = MAX_LAYER_NUM - 1; i >= 0; i--) {1508 for (int i = MAX_LAYER_NUM - 1; i >= 0; i--) {
1507 if (pTmpLayerSps[i] != NULL) {1509 if (pTmpLayerSps[i] != NULL) {
1508 iMaxCurrentLayer = i;1510 iMaxCurrentLayer = i;
1509 break;1511 break;
1510 }1512 }
1511 }1513 }
1512 if ((iMaxCurrentLayer != iMaxActiveLayer) || (pTmpLayerSps[iMaxCurrentLayer] != pCtx->pActiveLayerSps[iMaxActiveLayer])) {1514 if ((iMaxCurrentLayer != iMaxActiveLayer)
1515 || (pTmpLayerSps[iMaxCurrentLayer] != pCtx->pActiveLayerSps[iMaxActiveLayer])) {
1513 bNewSeq = true;1516 bNewSeq = true;
1514 }1517 }
1515 // fill active sps if the current sps is not null while active layer is null1518 // fill active sps if the current sps is not null while active layer is null
1516 if (!bNewSeq) {1519 if (!bNewSeq) {
1517 for(int i = 0; i < MAX_LAYER_NUM; i++) {1520 for (int i = 0; i < MAX_LAYER_NUM; i++) {
1518 if (pCtx->pActiveLayerSps[i] == NULL && pTmpLayerSps[i] != NULL) {1521 if (pCtx->pActiveLayerSps[i] == NULL && pTmpLayerSps[i] != NULL) {
1519 pCtx->pActiveLayerSps[i] = pTmpLayerSps[i];1522 pCtx->pActiveLayerSps[i] = pTmpLayerSps[i];
1520 }1523 }
1521 }1524 }
1522 } else {1525 } else {
1523 // UpdateActiveLayerSps if new sequence start1526 // UpdateActiveLayerSps if new sequence start
1524 memcpy(&pCtx->pActiveLayerSps[0], &pTmpLayerSps[0], MAX_LAYER_NUM * sizeof(PSps));1527 memcpy (&pCtx->pActiveLayerSps[0], &pTmpLayerSps[0], MAX_LAYER_NUM * sizeof (PSps));
1525 }1528 }
1526 return bNewSeq;1529 return bNewSeq;
1527}1530}
1528 1531
1529static void WriteBackActiveParameters(PWelsDecoderContext pCtx) {1532static void WriteBackActiveParameters (PWelsDecoderContext pCtx) {
1530 if (pCtx->iOverwriteFlags & OVERWRITE_PPS) {1533 if (pCtx->iOverwriteFlags & OVERWRITE_PPS) {
1531 memcpy(&pCtx->sPpsBuffer[pCtx->sPpsBuffer[MAX_PPS_COUNT].iPpsId], &pCtx->sPpsBuffer[MAX_PPS_COUNT], sizeof(SPps));1534 memcpy (&pCtx->sPpsBuffer[pCtx->sPpsBuffer[MAX_PPS_COUNT].iPpsId], &pCtx->sPpsBuffer[MAX_PPS_COUNT], sizeof (SPps));
1532 }1535 }
1533 if (pCtx->iOverwriteFlags & OVERWRITE_SPS) {1536 if (pCtx->iOverwriteFlags & OVERWRITE_SPS) {
1534 memcpy(&pCtx->sSpsBuffer[pCtx->sSpsBuffer[MAX_SPS_COUNT].iSpsId], &pCtx->sSpsBuffer[MAX_SPS_COUNT], sizeof(SSps));1537 memcpy (&pCtx->sSpsBuffer[pCtx->sSpsBuffer[MAX_SPS_COUNT].iSpsId], &pCtx->sSpsBuffer[MAX_SPS_COUNT], sizeof (SSps));
1535 pCtx->bNewSeqBegin = true;1538 pCtx->bNewSeqBegin = true;
1536 }1539 }
1537 if (pCtx->iOverwriteFlags & OVERWRITE_SUBSETSPS) {1540 if (pCtx->iOverwriteFlags & OVERWRITE_SUBSETSPS) {
1538 memcpy(&pCtx->sSubsetSpsBuffer[pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT].sSps.iSpsId], &pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT], sizeof(SSubsetSps));1541 memcpy (&pCtx->sSubsetSpsBuffer[pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT].sSps.iSpsId],
1542 &pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT], sizeof (SSubsetSps));
1539 pCtx->bNewSeqBegin = true;1543 pCtx->bNewSeqBegin = true;
1540 }1544 }
1541 pCtx->iOverwriteFlags = OVERWRITE_NONE;1545 pCtx->iOverwriteFlags = OVERWRITE_NONE;
@@ -1561,7 +1565,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 19 unmodified lines
1561 1565
1562 pCtx->bAuReadyFlag = false;1566 pCtx->bAuReadyFlag = false;
1563 pCtx->bLastHasMmco5 = false;1567 pCtx->bLastHasMmco5 = false;
1564 bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps(pCtx);1568 bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps (pCtx);
1565 pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || bTmpNewSeqBegin;1569 pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || bTmpNewSeqBegin;
1566 iErr = WelsDecodeAccessUnitStart (pCtx);1570 iErr = WelsDecodeAccessUnitStart (pCtx);
1567 GetVclNalTemporalId (pCtx);1571 GetVclNalTemporalId (pCtx);
@@ -1595,11 +1599,11 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 27 unmodified lines
1595 ImplementErrorCon (pCtx);1599 ImplementErrorCon (pCtx);
1596 1600
1597 pCtx->bNewSeqBegin = false;1601 pCtx->bNewSeqBegin = false;
1598 WriteBackActiveParameters(pCtx);1602 WriteBackActiveParameters (pCtx);
1599 pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin;1603 pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin;
1600 pCtx->bNextNewSeqBegin = false; // reset it1604 pCtx->bNextNewSeqBegin = false; // reset it
1601 if (pCtx->bNewSeqBegin)1605 if (pCtx->bNewSeqBegin)
1602 ResetActiveSPSForEachLayer(pCtx);1606 ResetActiveSPSForEachLayer (pCtx);
1603 if (ERR_NONE != iErr) {1607 if (ERR_NONE != iErr) {
1604 WelsLog (pCtx, WELS_LOG_INFO, "returned error from decoding:[0x%x]\n", iErr);1608 WelsLog (pCtx, WELS_LOG_INFO, "returned error from decoding:[0x%x]\n", iErr);
1605 return iErr;1609 return iErr;
@@ -1932,7 +1936,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, int3 · 326 unmodified lines
1932 }1936 }
1933 }1937 }
1934 1938
1935 // need update frame_num due current frame is well decoded1939 // need update frame_num due current frame is well decoded
1936 pCtx->iPrevFrameNum = pSh->iFrameNum;1940 pCtx->iPrevFrameNum = pSh->iFrameNum;
1937 if (pCtx->bLastHasMmco5)1941 if (pCtx->bLastHasMmco5)
1938 pCtx->iPrevFrameNum = 0;1942 pCtx->iPrevFrameNum = 0;

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