Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 120 files). Show all
Unified · Split
| @@ -970,7 +970,8 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid · 969 unmodified lines | ||
| 970 | 970 | pCtx->sMb.pInterPredictionDoneFlag[i] = (int8_t*) WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof ( |
| 971 | 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 | 976 | // check memory block valid due above allocated.. |
| 976 | 977 | WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY, |
| @@ -1482,60 +1483,63 @@ void WelsDecodeAccessUnitEnd (PWelsDecoderContext pCtx) { · 505 unmodified lines | ||
| 1482 | 1483 | * return: |
| 1483 | 1484 | * true - the AU to be construct is the start of new sequence; false - not |
| 1484 | 1485 | */ |
| 1485 | −static bool CheckNewSeqBeginAndUpdateActiveLayerSps(PWelsDecoderContext pCtx) { | |
| 1486 | +static bool CheckNewSeqBeginAndUpdateActiveLayerSps (PWelsDecoderContext pCtx) { | |
| 1486 | 1487 | bool bNewSeq = false; |
| 1487 | 1488 | PAccessUnit pCurAu = pCtx->pAccessUnitList; |
| 1488 | 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 | 1491 | pTmpLayerSps[i] = NULL; |
| 1491 | 1492 | } |
| 1492 | 1493 | // 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 | 1495 | uint32_t uiDid = pCurAu->pNalUnitsList[i]->sNalHeaderExt.uiDependencyId; |
| 1495 | 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 | 1499 | bNewSeq = true; |
| 1498 | 1500 | } |
| 1499 | 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 | 1503 | if (pCtx->pActiveLayerSps[i] != NULL) { |
| 1502 | 1504 | iMaxActiveLayer = i; |
| 1503 | 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 | 1509 | if (pTmpLayerSps[i] != NULL) { |
| 1508 | 1510 | iMaxCurrentLayer = i; |
| 1509 | 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 | 1516 | bNewSeq = true; |
| 1514 | 1517 | } |
| 1515 | 1518 | // fill active sps if the current sps is not null while active layer is null |
| 1516 | 1519 | if (!bNewSeq) { |
| 1517 | − for(int i = 0; i < MAX_LAYER_NUM; i++) { | |
| 1520 | + for (int i = 0; i < MAX_LAYER_NUM; i++) { | |
| 1518 | 1521 | if (pCtx->pActiveLayerSps[i] == NULL && pTmpLayerSps[i] != NULL) { |
| 1519 | 1522 | pCtx->pActiveLayerSps[i] = pTmpLayerSps[i]; |
| 1520 | 1523 | } |
| 1521 | 1524 | } |
| 1522 | 1525 | } else { |
| 1523 | 1526 | // 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 | 1529 | return bNewSeq; |
| 1527 | 1530 | } |
| 1528 | 1531 | |
| 1529 | −static void WriteBackActiveParameters(PWelsDecoderContext pCtx) { | |
| 1532 | +static void WriteBackActiveParameters (PWelsDecoderContext pCtx) { | |
| 1530 | 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 | 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 | 1538 | pCtx->bNewSeqBegin = true; |
| 1536 | 1539 | } |
| 1537 | 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 | 1543 | pCtx->bNewSeqBegin = true; |
| 1540 | 1544 | } |
| 1541 | 1545 | pCtx->iOverwriteFlags = OVERWRITE_NONE; |
| @@ -1561,7 +1565,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 19 unmodified lines | ||
| 1561 | 1565 | |
| 1562 | 1566 | pCtx->bAuReadyFlag = false; |
| 1563 | 1567 | pCtx->bLastHasMmco5 = false; |
| 1564 | − bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps(pCtx); | |
| 1568 | + bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps (pCtx); | |
| 1565 | 1569 | pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || bTmpNewSeqBegin; |
| 1566 | 1570 | iErr = WelsDecodeAccessUnitStart (pCtx); |
| 1567 | 1571 | GetVclNalTemporalId (pCtx); |
| @@ -1595,11 +1599,11 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 27 unmodified lines | ||
| 1595 | 1599 | ImplementErrorCon (pCtx); |
| 1596 | 1600 | |
| 1597 | 1601 | pCtx->bNewSeqBegin = false; |
| 1598 | − WriteBackActiveParameters(pCtx); | |
| 1602 | + WriteBackActiveParameters (pCtx); | |
| 1599 | 1603 | pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin; |
| 1600 | 1604 | pCtx->bNextNewSeqBegin = false; // reset it |
| 1601 | 1605 | if (pCtx->bNewSeqBegin) |
| 1602 | − ResetActiveSPSForEachLayer(pCtx); | |
| 1606 | + ResetActiveSPSForEachLayer (pCtx); | |
| 1603 | 1607 | if (ERR_NONE != iErr) { |
| 1604 | 1608 | WelsLog (pCtx, WELS_LOG_INFO, "returned error from decoding:[0x%x]\n", iErr); |
| 1605 | 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 decoded | |
| 1939 | + // need update frame_num due current frame is well decoded | |
| 1936 | 1940 | pCtx->iPrevFrameNum = pSh->iFrameNum; |
| 1937 | 1941 | if (pCtx->bLastHasMmco5) |
| 1938 | 1942 | pCtx->iPrevFrameNum = 0; |