It also fix SetUnRef crashing which should only loop for LIST_1 if ref pic is B_SLICE.
Showing the changes to codec/decoder/plus/src/welsDecoderExt.cpp (1 of 8 files). Show all
Unified · Split
| @@ -73,8 +73,6 @@ extern "C" { · 72 unmodified lines | ||
| 73 | 73 | |
| 74 | 74 | #define _PICTURE_REORDERING_ 1 |
| 75 | 75 | |
| 76 | −static int32_t sIMinInt32 = -0x7FFFFFFF; | |
| 77 | − | |
| 78 | 76 | namespace WelsDec { |
| 79 | 77 | |
| 80 | 78 | ////////////////////////////////////////////////////////////////////// |
| @@ -92,13 +90,7 @@ namespace WelsDec { · 11 unmodified lines | ||
| 92 | 90 | ***************************************************************************/ |
| 93 | 91 | CWelsDecoder::CWelsDecoder (void) |
| 94 | 92 | : m_pDecContext (NULL), |
| 95 | − m_pWelsTrace (NULL), | |
| 96 | − m_iPictInfoIndex (0), | |
| 97 | − m_iMinPOC (sIMinInt32), | |
| 98 | − m_iNumOfPicts (0), | |
| 99 | − m_iLastGOPRemainPicts (0), | |
| 100 | − m_LastWrittenPOC (sIMinInt32), | |
| 101 | − m_iLargestBufferedPicIndex (0) { | |
| 93 | + m_pWelsTrace (NULL) { | |
| 102 | 94 | #ifdef OUTPUT_BIT_STREAM |
| 103 | 95 | char chFileName[1024] = { 0 }; //for .264 |
| 104 | 96 | int iBufUsed = 0; |
| @@ -120,10 +112,7 @@ CWelsDecoder::CWelsDecoder (void) · 15 unmodified lines | ||
| 120 | 112 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::CWelsDecoder() entry"); |
| 121 | 113 | } |
| 122 | 114 | |
| 123 | − for (int32_t i = 0; i < 16; ++i) { | |
| 124 | − m_sPictInfoList[i].bLastGOP = false; | |
| 125 | − m_sPictInfoList[i].iPOC = sIMinInt32; | |
| 126 | − } | |
| 115 | + ResetReorderingPictureBuffers (&m_sReoderingStatus, m_sPictInfoList, true); | |
| 127 | 116 | |
| 128 | 117 | #ifdef OUTPUT_BIT_STREAM |
| 129 | 118 | SWelsTime sCurTime; |
| @@ -274,6 +263,8 @@ int32_t CWelsDecoder::InitDecoder (const SDecodingParam* pParam) { · 144 unmodified lines | ||
| 274 | 263 | m_pDecContext->pLastDecPicInfo = &m_sLastDecPicInfo; |
| 275 | 264 | m_pDecContext->pDecoderStatistics = &m_sDecoderStatistics; |
| 276 | 265 | m_pDecContext->pVlcTable = &m_sVlcTable; |
| 266 | + m_pDecContext->pPictInfoList = m_sPictInfoList; | |
| 267 | + m_pDecContext->pPictReoderingStatus = &m_sReoderingStatus; | |
| 277 | 268 | WelsDecoderDefaults (m_pDecContext, &m_pWelsTrace->m_sLogCtx); |
| 278 | 269 | WelsDecoderSpsPpsDefaults (m_pDecContext->sSpsPpsCtx); |
| 279 | 270 | |
| @@ -304,7 +295,7 @@ int32_t CWelsDecoder::ResetDecoder() { · 24 unmodified lines | ||
| 304 | 295 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "ResetDecoder() failed as decoder context null"); |
| 305 | 296 | } |
| 306 | 297 | #ifdef _PICTURE_REORDERING_ |
| 307 | − ResetReorderingPictureBuffers(); | |
| 298 | + ResetReorderingPictureBuffers (&m_sReoderingStatus, m_sPictInfoList, false); | |
| 308 | 299 | #endif |
| 309 | 300 | return ERR_INFO_UNINIT; |
| 310 | 301 | } |
| @@ -483,7 +474,7 @@ long CWelsDecoder::GetOption (DECODER_OPTION eOptID, void* pOption) { · 172 unmodified lines | ||
| 483 | 474 | return cmResultSuccess; |
| 484 | 475 | } else if (DECODER_OPTION_NUM_OF_FRAMES_REMAINING_IN_BUFFER == eOptID) { |
| 485 | 476 | if (m_pDecContext->pSps && m_pDecContext->pSps->uiProfileIdc != 66) { |
| 486 | − * ((int*)pOption) = m_iNumOfPicts > 0 ? m_iNumOfPicts : 0; | |
| 477 | + * ((int*)pOption) = m_sReoderingStatus.iNumOfPicts > 0 ? m_sReoderingStatus.iNumOfPicts : 0; | |
| 487 | 478 | } else { |
| 488 | 479 | * ((int*)pOption) = 0; |
| 489 | 480 | } |
| @@ -688,36 +679,36 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 198 unmodified lines | ||
| 688 | 679 | |
| 689 | 680 | DECODING_STATE CWelsDecoder::FlushFrame (unsigned char** ppDst, |
| 690 | 681 | SBufferInfo* pDstInfo) { |
| 691 | − if (m_pDecContext->bEndOfStreamFlag && m_iNumOfPicts > 0) { | |
| 692 | − m_iMinPOC = sIMinInt32; | |
| 693 | − for (int32_t i = 0; i <= m_iLargestBufferedPicIndex; ++i) { | |
| 694 | − if (m_iMinPOC == sIMinInt32 && m_sPictInfoList[i].iPOC > sIMinInt32) { | |
| 695 | − m_iMinPOC = m_sPictInfoList[i].iPOC; | |
| 696 | − m_iPictInfoIndex = i; | |
| 682 | + if (m_pDecContext->bEndOfStreamFlag && m_sReoderingStatus.iNumOfPicts > 0) { | |
| 683 | + m_sReoderingStatus.iMinPOC = IMinInt32; | |
| 684 | + for (int32_t i = 0; i <= m_sReoderingStatus.iLargestBufferedPicIndex; ++i) { | |
| 685 | + if (m_sReoderingStatus.iMinPOC == IMinInt32 && m_sPictInfoList[i].iPOC > IMinInt32) { | |
| 686 | + m_sReoderingStatus.iMinPOC = m_sPictInfoList[i].iPOC; | |
| 687 | + m_sReoderingStatus.iPictInfoIndex = i; | |
| 697 | 688 | } |
| 698 | − if (m_sPictInfoList[i].iPOC > sIMinInt32 && m_sPictInfoList[i].iPOC < m_iMinPOC) { | |
| 699 | − m_iMinPOC = m_sPictInfoList[i].iPOC; | |
| 700 | − m_iPictInfoIndex = i; | |
| 689 | + if (m_sPictInfoList[i].iPOC > IMinInt32 && m_sPictInfoList[i].iPOC < m_sReoderingStatus.iMinPOC) { | |
| 690 | + m_sReoderingStatus.iMinPOC = m_sPictInfoList[i].iPOC; | |
| 691 | + m_sReoderingStatus.iPictInfoIndex = i; | |
| 701 | 692 | } |
| 702 | 693 | } |
| 703 | 694 | } |
| 704 | − if (m_iMinPOC > sIMinInt32) { | |
| 705 | − m_LastWrittenPOC = m_iMinPOC; | |
| 695 | + if (m_sReoderingStatus.iMinPOC > IMinInt32) { | |
| 696 | + m_sReoderingStatus.iLastWrittenPOC = m_sReoderingStatus.iMinPOC; | |
| 706 | 697 | #if defined (_DEBUG) |
| 707 | 698 | #ifdef _MOTION_VECTOR_DUMP_ |
| 708 | − fprintf (stderr, "Output POC: #%d\n", m_LastWrittenPOC); | |
| 699 | + fprintf (stderr, "Output POC: #%d\n", m_sReoderingStatus.iLastWrittenPOC); | |
| 709 | 700 | #endif |
| 710 | 701 | #endif |
| 711 | − memcpy (pDstInfo, &m_sPictInfoList[m_iPictInfoIndex].sBufferInfo, sizeof (SBufferInfo)); | |
| 712 | − ppDst[0] = m_sPictInfoList[m_iPictInfoIndex].pData[0]; | |
| 713 | − ppDst[1] = m_sPictInfoList[m_iPictInfoIndex].pData[1]; | |
| 714 | − ppDst[2] = m_sPictInfoList[m_iPictInfoIndex].pData[2]; | |
| 715 | − m_sPictInfoList[m_iPictInfoIndex].iPOC = sIMinInt32; | |
| 716 | − if (m_sPictInfoList[m_iPictInfoIndex].iPicBuffIdx < m_pDecContext->pPicBuff->iCapacity) | |
| 717 | − m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[m_iPictInfoIndex].iPicBuffIdx]->bAvailableFlag = true; | |
| 718 | − m_sPictInfoList[m_iPictInfoIndex].bLastGOP = false; | |
| 719 | − m_iMinPOC = sIMinInt32; | |
| 720 | − --m_iNumOfPicts; | |
| 702 | + memcpy (pDstInfo, &m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].sBufferInfo, sizeof (SBufferInfo)); | |
| 703 | + ppDst[0] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[0]; | |
| 704 | + ppDst[1] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[1]; | |
| 705 | + ppDst[2] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[2]; | |
| 706 | + m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPOC = IMinInt32; | |
| 707 | + if (m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx < m_pDecContext->pPicBuff->iCapacity) | |
| 708 | + m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx]->bAvailableFlag = true; | |
| 709 | + m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP = false; | |
| 710 | + m_sReoderingStatus.iMinPOC = IMinInt32; | |
| 711 | + --m_sReoderingStatus.iNumOfPicts; | |
| 721 | 712 | } |
| 722 | 713 | return dsErrorFree; |
| 723 | 714 | } |
| @@ -775,36 +766,36 @@ DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SB · 51 unmodified lines | ||
| 775 | 766 | ++m_pDecContext->uiDecodingTimeStamp; |
| 776 | 767 | if (m_pDecContext->pSps->uiProfileIdc != 66 && m_pDecContext->pSps->uiProfileIdc != 83) { |
| 777 | 768 | /*if (m_pDecContext->pSliceHeader->iPicOrderCntLsb == 0) { |
| 778 | − m_LastWrittenPOC = 0; | |
| 769 | + m_sReoderingStatus.iLastWrittenPOC = 0; | |
| 779 | 770 | return dsErrorFree; |
| 780 | 771 | } |
| 781 | − if (m_iNumOfPicts == 0 && m_pDecContext->pLastDecPicInfo->pPreviousDecodedPictureInDpb->bNewSeqBegin | |
| 772 | + if (m_sReoderingStatus.iNumOfPicts == 0 && m_pDecContext->pLastDecPicInfo->pPreviousDecodedPictureInDpb->bNewSeqBegin | |
| 782 | 773 | && m_pDecContext->eSliceType != I_SLICE) { |
| 783 | − m_LastWrittenPOC = m_pDecContext->pSliceHeader->iPicOrderCntLsb; | |
| 774 | + m_sReoderingStatus.iLastWrittenPOC = m_pDecContext->pSliceHeader->iPicOrderCntLsb; | |
| 784 | 775 | return dsErrorFree; |
| 785 | 776 | }*/ |
| 786 | − if (m_iNumOfPicts && m_pDecContext->pLastDecPicInfo->pPreviousDecodedPictureInDpb | |
| 777 | + if (m_sReoderingStatus.iNumOfPicts && m_pDecContext->pLastDecPicInfo->pPreviousDecodedPictureInDpb | |
| 787 | 778 | && m_pDecContext->pLastDecPicInfo->pPreviousDecodedPictureInDpb->bNewSeqBegin) { |
| 788 | − m_iLastGOPRemainPicts = m_iNumOfPicts; | |
| 789 | − for (int32_t i = 0; i <= m_iLargestBufferedPicIndex; ++i) { | |
| 790 | − if (m_sPictInfoList[i].iPOC > sIMinInt32) { | |
| 779 | + m_sReoderingStatus.iLastGOPRemainPicts = m_sReoderingStatus.iNumOfPicts; | |
| 780 | + for (int32_t i = 0; i <= m_sReoderingStatus.iLargestBufferedPicIndex; ++i) { | |
| 781 | + if (m_sPictInfoList[i].iPOC > IMinInt32) { | |
| 791 | 782 | m_sPictInfoList[i].bLastGOP = true; |
| 792 | 783 | } |
| 793 | 784 | } |
| 794 | 785 | } else { |
| 795 | − if (m_iNumOfPicts > 0) { | |
| 786 | + if (m_sReoderingStatus.iNumOfPicts > 0) { | |
| 796 | 787 | //This can happen when decoder moves to next GOP without being able to decoder first picture PicOrderCntLsb = 0 |
| 797 | 788 | bool hasGOPChanged = false; |
| 798 | − for (int32_t i = 0; i <= m_iLargestBufferedPicIndex; ++i) { | |
| 789 | + for (int32_t i = 0; i <= m_sReoderingStatus.iLargestBufferedPicIndex; ++i) { | |
| 799 | 790 | if (m_sPictInfoList[i].iPOC == m_pDecContext->pSliceHeader->iPicOrderCntLsb) { |
| 800 | 791 | hasGOPChanged = true; |
| 801 | 792 | break; |
| 802 | 793 | } |
| 803 | 794 | } |
| 804 | 795 | if (hasGOPChanged) { |
| 805 | − m_iLastGOPRemainPicts = m_iNumOfPicts; | |
| 806 | − for (int32_t i = 0; i <= m_iLargestBufferedPicIndex; ++i) { | |
| 807 | − if (m_sPictInfoList[i].iPOC > sIMinInt32) { | |
| 796 | + m_sReoderingStatus.iLastGOPRemainPicts = m_sReoderingStatus.iNumOfPicts; | |
| 797 | + for (int32_t i = 0; i <= m_sReoderingStatus.iLargestBufferedPicIndex; ++i) { | |
| 798 | + if (m_sPictInfoList[i].iPOC > IMinInt32) { | |
| 808 | 799 | m_sPictInfoList[i].bLastGOP = true; |
| 809 | 800 | } |
| 810 | 801 | } |
| @@ -812,7 +803,7 @@ DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SB · 1 unmodified line | ||
| 812 | 803 | } |
| 813 | 804 | } |
| 814 | 805 | for (int32_t i = 0; i < 16; ++i) { |
| 815 | − if (m_sPictInfoList[i].iPOC == sIMinInt32) { | |
| 806 | + if (m_sPictInfoList[i].iPOC == IMinInt32) { | |
| 816 | 807 | memcpy (&m_sPictInfoList[i].sBufferInfo, pDstInfo, sizeof (SBufferInfo)); |
| 817 | 808 | m_sPictInfoList[i].pData[0] = ppDst[0]; |
| 818 | 809 | m_sPictInfoList[i].pData[1] = ppDst[1]; |
| @@ -823,79 +814,81 @@ DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay (unsigned char** ppDst, SB · 4 unmodified lines | ||
| 823 | 814 | m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[i].iPicBuffIdx]->bAvailableFlag = false; |
| 824 | 815 | m_sPictInfoList[i].bLastGOP = false; |
| 825 | 816 | pDstInfo->iBufferStatus = 0; |
| 826 | − ++m_iNumOfPicts; | |
| 827 | − if (i > m_iLargestBufferedPicIndex) { | |
| 828 | − m_iLargestBufferedPicIndex = i; | |
| 817 | + ++m_sReoderingStatus.iNumOfPicts; | |
| 818 | + if (i > m_sReoderingStatus.iLargestBufferedPicIndex) { | |
| 819 | + m_sReoderingStatus.iLargestBufferedPicIndex = i; | |
| 829 | 820 | } |
| 830 | 821 | break; |
| 831 | 822 | } |
| 832 | 823 | } |
| 833 | − if (m_iLastGOPRemainPicts > 0) { | |
| 834 | − m_iMinPOC = sIMinInt32; | |
| 835 | − for (int32_t i = 0; i <= m_iLargestBufferedPicIndex; ++i) { | |
| 836 | − if (m_iMinPOC == sIMinInt32 && m_sPictInfoList[i].iPOC > sIMinInt32 && m_sPictInfoList[i].bLastGOP) { | |
| 837 | − m_iMinPOC = m_sPictInfoList[i].iPOC; | |
| 838 | − m_iPictInfoIndex = i; | |
| 824 | + if (m_sReoderingStatus.iLastGOPRemainPicts > 0) { | |
| 825 | + m_sReoderingStatus.iMinPOC = IMinInt32; | |
| 826 | + for (int32_t i = 0; i <= m_sReoderingStatus.iLargestBufferedPicIndex; ++i) { | |
| 827 | + if (m_sReoderingStatus.iMinPOC == IMinInt32 && m_sPictInfoList[i].iPOC > IMinInt32 && m_sPictInfoList[i].bLastGOP) { | |
| 828 | + m_sReoderingStatus.iMinPOC = m_sPictInfoList[i].iPOC; | |
| 829 | + m_sReoderingStatus.iPictInfoIndex = i; | |
| 839 | 830 | } |
| 840 | − if (m_sPictInfoList[i].iPOC > sIMinInt32 && m_sPictInfoList[i].iPOC < m_iMinPOC && m_sPictInfoList[i].bLastGOP) { | |
| 841 | − m_iMinPOC = m_sPictInfoList[i].iPOC; | |
| 842 | − m_iPictInfoIndex = i; | |
| 831 | + if (m_sPictInfoList[i].iPOC > IMinInt32 && m_sPictInfoList[i].iPOC < m_sReoderingStatus.iMinPOC | |
| 832 | + && m_sPictInfoList[i].bLastGOP) { | |
| 833 | + m_sReoderingStatus.iMinPOC = m_sPictInfoList[i].iPOC; | |
| 834 | + m_sReoderingStatus.iPictInfoIndex = i; | |
| 843 | 835 | } |
| 844 | 836 | } |
| 845 | − m_LastWrittenPOC = m_iMinPOC; | |
| 837 | + m_sReoderingStatus.iLastWrittenPOC = m_sReoderingStatus.iMinPOC; | |
| 846 | 838 | #if defined (_DEBUG) |
| 847 | 839 | #ifdef _MOTION_VECTOR_DUMP_ |
| 848 | − fprintf (stderr, "Output POC: #%d\n", m_LastWrittenPOC); | |
| 840 | + fprintf (stderr, "Output POC: #%d\n", m_sReoderingStatus.iLastWrittenPOC); | |
| 849 | 841 | #endif |
| 850 | 842 | #endif |
| 851 | − memcpy (pDstInfo, &m_sPictInfoList[m_iPictInfoIndex].sBufferInfo, sizeof (SBufferInfo)); | |
| 852 | − ppDst[0] = m_sPictInfoList[m_iPictInfoIndex].pData[0]; | |
| 853 | − ppDst[1] = m_sPictInfoList[m_iPictInfoIndex].pData[1]; | |
| 854 | − ppDst[2] = m_sPictInfoList[m_iPictInfoIndex].pData[2]; | |
| 855 | − m_sPictInfoList[m_iPictInfoIndex].iPOC = sIMinInt32; | |
| 856 | − if (m_sPictInfoList[m_iPictInfoIndex].iPicBuffIdx < m_pDecContext->pPicBuff->iCapacity) | |
| 857 | − m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[m_iPictInfoIndex].iPicBuffIdx]->bAvailableFlag = true; | |
| 858 | − m_sPictInfoList[m_iPictInfoIndex].bLastGOP = false; | |
| 859 | − m_iMinPOC = sIMinInt32; | |
| 860 | − --m_iNumOfPicts; | |
| 861 | − --m_iLastGOPRemainPicts; | |
| 862 | − if (m_iLastGOPRemainPicts == 0) { | |
| 863 | − m_LastWrittenPOC = sIMinInt32; | |
| 843 | + memcpy (pDstInfo, &m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].sBufferInfo, sizeof (SBufferInfo)); | |
| 844 | + ppDst[0] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[0]; | |
| 845 | + ppDst[1] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[1]; | |
| 846 | + ppDst[2] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[2]; | |
| 847 | + m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPOC = IMinInt32; | |
| 848 | + if (m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx < m_pDecContext->pPicBuff->iCapacity) | |
| 849 | + m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx]->bAvailableFlag = true; | |
| 850 | + m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP = false; | |
| 851 | + m_sReoderingStatus.iMinPOC = IMinInt32; | |
| 852 | + --m_sReoderingStatus.iNumOfPicts; | |
| 853 | + --m_sReoderingStatus.iLastGOPRemainPicts; | |
| 854 | + if (m_sReoderingStatus.iLastGOPRemainPicts == 0) { | |
| 855 | + m_sReoderingStatus.iLastWrittenPOC = IMinInt32; | |
| 864 | 856 | } |
| 865 | 857 | return iRet; |
| 866 | 858 | } |
| 867 | − if (m_iNumOfPicts > 0) { | |
| 868 | − m_iMinPOC = sIMinInt32; | |
| 869 | − for (int32_t i = 0; i <= m_iLargestBufferedPicIndex; ++i) { | |
| 870 | − if (m_iMinPOC == sIMinInt32 && m_sPictInfoList[i].iPOC > sIMinInt32) { | |
| 871 | − m_iMinPOC = m_sPictInfoList[i].iPOC; | |
| 872 | − m_iPictInfoIndex = i; | |
| 859 | + if (m_sReoderingStatus.iNumOfPicts > 0) { | |
| 860 | + m_sReoderingStatus.iMinPOC = IMinInt32; | |
| 861 | + for (int32_t i = 0; i <= m_sReoderingStatus.iLargestBufferedPicIndex; ++i) { | |
| 862 | + if (m_sReoderingStatus.iMinPOC == IMinInt32 && m_sPictInfoList[i].iPOC > IMinInt32) { | |
| 863 | + m_sReoderingStatus.iMinPOC = m_sPictInfoList[i].iPOC; | |
| 864 | + m_sReoderingStatus.iPictInfoIndex = i; | |
| 873 | 865 | } |
| 874 | − if (m_sPictInfoList[i].iPOC > sIMinInt32 && m_sPictInfoList[i].iPOC < m_iMinPOC) { | |
| 875 | − m_iMinPOC = m_sPictInfoList[i].iPOC; | |
| 876 | − m_iPictInfoIndex = i; | |
| 866 | + if (m_sPictInfoList[i].iPOC > IMinInt32 && m_sPictInfoList[i].iPOC < m_sReoderingStatus.iMinPOC) { | |
| 867 | + m_sReoderingStatus.iMinPOC = m_sPictInfoList[i].iPOC; | |
| 868 | + m_sReoderingStatus.iPictInfoIndex = i; | |
| 877 | 869 | } |
| 878 | 870 | } |
| 879 | 871 | } |
| 880 | − if (m_iMinPOC > sIMinInt32) { | |
| 881 | − if ((m_LastWrittenPOC > sIMinInt32 && m_iMinPOC - m_LastWrittenPOC <= 1) | |
| 882 | − || m_iMinPOC < m_pDecContext->pSliceHeader->iPicOrderCntLsb) { | |
| 883 | − m_LastWrittenPOC = m_iMinPOC; | |
| 872 | + if (m_sReoderingStatus.iMinPOC > IMinInt32) { | |
| 873 | + if ((m_sReoderingStatus.iLastWrittenPOC > IMinInt32 | |
| 874 | + && m_sReoderingStatus.iMinPOC - m_sReoderingStatus.iLastWrittenPOC <= 1) | |
| 875 | + || m_sReoderingStatus.iMinPOC < m_pDecContext->pSliceHeader->iPicOrderCntLsb) { | |
| 876 | + m_sReoderingStatus.iLastWrittenPOC = m_sReoderingStatus.iMinPOC; | |
| 884 | 877 | #if defined (_DEBUG) |
| 885 | 878 | #ifdef _MOTION_VECTOR_DUMP_ |
| 886 | − fprintf (stderr, "Output POC: #%d\n", m_LastWrittenPOC); | |
| 879 | + fprintf (stderr, "Output POC: #%d\n", m_sReoderingStatus.iLastWrittenPOC); | |
| 887 | 880 | #endif |
| 888 | 881 | #endif |
| 889 | − memcpy (pDstInfo, &m_sPictInfoList[m_iPictInfoIndex].sBufferInfo, sizeof (SBufferInfo)); | |
| 890 | − ppDst[0] = m_sPictInfoList[m_iPictInfoIndex].pData[0]; | |
| 891 | − ppDst[1] = m_sPictInfoList[m_iPictInfoIndex].pData[1]; | |
| 892 | − ppDst[2] = m_sPictInfoList[m_iPictInfoIndex].pData[2]; | |
| 893 | − m_sPictInfoList[m_iPictInfoIndex].iPOC = sIMinInt32; | |
| 894 | − if (m_sPictInfoList[m_iPictInfoIndex].iPicBuffIdx < m_pDecContext->pPicBuff->iCapacity) | |
| 895 | − m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[m_iPictInfoIndex].iPicBuffIdx]->bAvailableFlag = true; | |
| 896 | − m_sPictInfoList[m_iPictInfoIndex].bLastGOP = false; | |
| 897 | − m_iMinPOC = sIMinInt32; | |
| 898 | − --m_iNumOfPicts; | |
| 882 | + memcpy (pDstInfo, &m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].sBufferInfo, sizeof (SBufferInfo)); | |
| 883 | + ppDst[0] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[0]; | |
| 884 | + ppDst[1] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[1]; | |
| 885 | + ppDst[2] = m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].pData[2]; | |
| 886 | + m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPOC = IMinInt32; | |
| 887 | + if (m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx < m_pDecContext->pPicBuff->iCapacity) | |
| 888 | + m_pDecContext->pPicBuff->ppPic[m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].iPicBuffIdx]->bAvailableFlag = true; | |
| 889 | + m_sPictInfoList[m_sReoderingStatus.iPictInfoIndex].bLastGOP = false; | |
| 890 | + m_sReoderingStatus.iMinPOC = IMinInt32; | |
| 891 | + --m_sReoderingStatus.iNumOfPicts; | |
| 899 | 892 | return iRet; |
| 900 | 893 | } |
| 901 | 894 | } |
| @@ -1026,19 +1019,6 @@ DECODING_STATE CWelsDecoder::DecodeFrameEx (const unsigned char* kpSrc, · 124 unmodified lines | ||
| 1026 | 1019 | return state; |
| 1027 | 1020 | } |
| 1028 | 1021 | |
| 1029 | −void CWelsDecoder::ResetReorderingPictureBuffers() { | |
| 1030 | − m_iPictInfoIndex = 0; | |
| 1031 | − m_iMinPOC = sIMinInt32; | |
| 1032 | − m_iNumOfPicts = 0; | |
| 1033 | − m_iLastGOPRemainPicts = 0; | |
| 1034 | − m_LastWrittenPOC = sIMinInt32; | |
| 1035 | − m_iLargestBufferedPicIndex = 0; | |
| 1036 | − for (int32_t i = 0; i < 16; ++i) { | |
| 1037 | − m_sPictInfoList[i].bLastGOP = false; | |
| 1038 | − m_sPictInfoList[i].iPOC = sIMinInt32; | |
| 1039 | − } | |
| 1040 | −} | |
| 1041 | − | |
| 1042 | 1022 | } // namespace WelsDec |
| 1043 | 1023 | |
| 1044 | 1024 | |