Changeset 1319 in SHVCSoftware for branches/SHM-dev/source/Lib/TLibDecoder
- Timestamp:
- 21 Jul 2015, 23:31:40 (10 years ago)
- Location:
- branches/SHM-dev/source/Lib/TLibDecoder
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibDecoder/NALread.cpp
r1259 r1319 34 34 /** 35 35 \file NALread.cpp 36 \brief reading fun tionality for NAL units36 \brief reading functionality for NAL units 37 37 */ 38 38 … … 105 105 Void readNalUnitHeader(InputNALUnit& nalu) 106 106 { 107 TComInputBitstream& bs = *nalu.m_Bitstream;107 TComInputBitstream& bs = nalu.getBitstream(); 108 108 109 109 Bool forbidden_zero_bit = bs.read(1); // forbidden_zero_bit … … 165 165 * a bitstream 166 166 */ 167 Void read(InputNALUnit& nalu , vector<uint8_t>& nalUnitBuf)167 Void read(InputNALUnit& nalu) 168 168 { 169 /* perform anti-emulation prevention */ 170 TComInputBitstream *pcBitstream = new TComInputBitstream(NULL); 171 convertPayloadToRBSP(nalUnitBuf, pcBitstream, (nalUnitBuf[0] & 64) == 0); 172 173 nalu.m_Bitstream = new TComInputBitstream(&nalUnitBuf); 174 nalu.m_Bitstream->setEmulationPreventionByteLocation(pcBitstream->getEmulationPreventionByteLocation()); 175 delete pcBitstream; 169 TComInputBitstream &bitstream = nalu.getBitstream(); 170 vector<uint8_t>& nalUnitBuf=bitstream.getFifo(); 171 // perform anti-emulation prevention 172 convertPayloadToRBSP(nalUnitBuf, &bitstream, (nalUnitBuf[0] & 64) == 0); 173 bitstream.resetToStart(); 176 174 readNalUnitHeader(nalu); 177 175 } -
branches/SHM-dev/source/Lib/TLibDecoder/NALread.h
r1259 r1319 34 34 /** 35 35 \file NALread.h 36 \brief reading fun tionality for NAL units36 \brief reading functionality for NAL units 37 37 */ 38 38 … … 53 53 * bitstream object. 54 54 */ 55 structInputNALUnit : public NALUnit55 class InputNALUnit : public NALUnit 56 56 { 57 InputNALUnit() : m_Bitstream(0) {};58 ~InputNALUnit() { delete m_Bitstream; }57 private: 58 TComInputBitstream m_Bitstream; 59 59 60 TComInputBitstream* m_Bitstream; 60 public: 61 InputNALUnit(const InputNALUnit &src) : NALUnit(src), m_Bitstream(src.m_Bitstream) {}; 62 InputNALUnit() : m_Bitstream() {}; 63 virtual ~InputNALUnit() { } 64 const TComInputBitstream &getBitstream() const { return m_Bitstream; } 65 TComInputBitstream &getBitstream() { return m_Bitstream; } 61 66 }; 62 67 63 Void read(InputNALUnit& nalu, std::vector<uint8_t>& nalUnitBuf); 68 Void read(InputNALUnit& nalu); 69 Void readNalUnitHeader(InputNALUnit& nalu); 64 70 65 71 //! \} -
branches/SHM-dev/source/Lib/TLibDecoder/SEIread.cpp
r1307 r1319 471 471 472 472 /* restore primary bitstream for sei_message */ 473 getBitstream()->deleteFifo();474 473 delete getBitstream(); 475 474 setBitstream(bs); -
branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp
r1292 r1319 154 154 for (UInt ui = 0; ui < uiNumSubstreams; ui++) 155 155 { 156 ppcSubstreams[ui]->deleteFifo();157 156 delete ppcSubstreams[ui]; 158 157 } -
branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp
r1316 r1319 63 63 64 64 TDecTop::TDecTop() 65 : m_pDecodedSEIOutputStream(NULL), 66 m_warningMessageSkipPicture(false) 67 { 68 m_pcPic = 0; 69 m_iMaxRefPicNum = 0; 65 : m_iMaxRefPicNum(0) 66 , m_associatedIRAPType(NAL_UNIT_INVALID) 67 , m_pocCRA(0) 68 , m_pocRandomAccess(MAX_INT) 69 , m_cListPic() 70 , m_parameterSetManager() 71 , m_apcSlicePilot(NULL) 72 , m_SEIs() 73 , m_cPrediction() 74 , m_cTrQuant() 75 , m_cGopDecoder() 76 , m_cSliceDecoder() 77 , m_cCuDecoder() 78 , m_cEntropyDecoder() 79 , m_cCavlcDecoder() 80 , m_cSbacDecoder() 81 , m_cBinCABAC() 82 , m_seiReader() 83 , m_cLoopFilter() 84 , m_cSAO() 85 , m_pcPic(NULL) 86 #if !SVC_EXTENSION 87 , m_prevPOC(MAX_INT) 88 #endif 89 , m_prevTid0POC(0) 90 , m_bFirstSliceInPicture(true) 91 #if !SVC_EXTENSION 92 , m_bFirstSliceInSequence(true) 93 #endif 94 , m_prevSliceSkipped(false) 95 , m_skippedPOC(0) 96 , m_bFirstSliceInBitstream(true) 97 , m_lastPOCNoOutputPriorPics(-1) 98 , m_isNoOutputPriorPics(false) 99 , m_craNoRaslOutputFlag(false) 100 #if O0043_BEST_EFFORT_DECODING 101 , m_forceDecodeBitDepth(8) 102 #endif 103 , m_pDecodedSEIOutputStream(NULL) 104 , m_warningMessageSkipPicture(false) 105 , m_prefixSEINALUs() 106 { 70 107 #if ENC_DEC_TRACE 71 108 if (g_hTrace == NULL) … … 76 113 g_nSymbolCounter = 0; 77 114 #endif 78 m_associatedIRAPType = NAL_UNIT_INVALID;79 m_pocCRA = 0;80 m_pocRandomAccess = MAX_INT;81 #if !SVC_EXTENSION82 m_prevPOC = MAX_INT;83 #endif84 m_prevTid0POC = 0;85 m_bFirstSliceInPicture = true;86 #if !SVC_EXTENSION87 m_bFirstSliceInSequence = true;88 #endif89 m_prevSliceSkipped = false;90 m_skippedPOC = 0;91 m_bFirstSliceInBitstream = true;92 m_lastPOCNoOutputPriorPics = -1;93 m_craNoRaslOutputFlag = false;94 m_isNoOutputPriorPics = false;95 115 96 116 #if SVC_EXTENSION … … 133 153 } 134 154 #endif 155 while (!m_prefixSEINALUs.empty()) 156 { 157 delete m_prefixSEINALUs.front(); 158 m_prefixSEINALUs.pop_front(); 159 } 135 160 #if CGS_3D_ASYMLUT 136 161 if(m_pColorMappedPic) … … 431 456 assert (0); 432 457 } 458 459 xParsePrefixSEImessages(); 433 460 434 461 #if RExt__HIGH_BIT_DEPTH_SUPPORT==0 … … 699 726 } 700 727 728 xParsePrefixSEImessages(); 729 701 730 // Check if any new SEI has arrived 702 731 if(!m_SEIs.empty()) … … 709 738 } 710 739 } 711 740 } 741 742 743 Void TDecTop::xParsePrefixSEIsForUnknownVCLNal() 744 { 745 while (!m_prefixSEINALUs.empty()) 746 { 747 // do nothing? 748 printf("Discarding Prefix SEI associated with unknown VCL NAL unit.\n"); 749 delete m_prefixSEINALUs.front(); 750 } 751 // TODO: discard following suffix SEIs as well? 752 } 753 754 755 Void TDecTop::xParsePrefixSEImessages() 756 { 757 #if SVC_EXTENSION 758 if (m_prevSliceSkipped) // No need to decode SEI messages of a skipped access unit 759 { 760 return; 761 } 762 #endif 763 764 while (!m_prefixSEINALUs.empty()) 765 { 766 InputNALUnit &nalu=*m_prefixSEINALUs.front(); 767 #if LAYERS_NOT_PRESENT_SEI 768 m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveVPS(), m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream ); 769 #else 770 m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_SEIs, nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream ); 771 #endif 772 delete m_prefixSEINALUs.front(); 773 m_prefixSEINALUs.pop_front(); 774 } 712 775 } 713 776 … … 783 846 m_apcSlicePilot->setPOC(m_skippedPOC); 784 847 } 848 849 xUpdatePreviousTid0POC(m_apcSlicePilot); 785 850 786 851 m_apcSlicePilot->setAssociatedIRAPPOC(m_pocCRA); … … 1795 1860 1796 1861 // Decode a picture 1797 m_cGopDecoder.decompressSlice( nalu.m_Bitstream, m_pcPic);1862 m_cGopDecoder.decompressSlice(&(nalu.getBitstream()), m_pcPic); 1798 1863 1799 1864 #if SVC_EXTENSION … … 1808 1873 } 1809 1874 1810 Void TDecTop::xDecodeVPS(const std::vector<UChar> *pNaluData)1875 Void TDecTop::xDecodeVPS(const std::vector<UChar> &naluData) 1811 1876 { 1812 1877 TComVPS* vps = new TComVPS(); 1813 1878 1814 1879 m_cEntropyDecoder.decodeVPS( vps ); 1815 m_parameterSetManager.storeVPS(vps, pNaluData);1880 m_parameterSetManager.storeVPS(vps, naluData); 1816 1881 #if SVC_EXTENSION 1817 1882 checkValueOfTargetOutputLayerSetIdx(vps); … … 1837 1902 } 1838 1903 1839 Void TDecTop::xDecodeSPS(const std::vector<UChar> *pNaluData)1904 Void TDecTop::xDecodeSPS(const std::vector<UChar> &naluData) 1840 1905 { 1841 1906 TComSPS* sps = new TComSPS(); … … 1847 1912 #endif 1848 1913 m_cEntropyDecoder.decodeSPS( sps ); 1849 m_parameterSetManager.storeSPS(sps, pNaluData);1914 m_parameterSetManager.storeSPS(sps, naluData); 1850 1915 } 1851 1916 1852 1917 #if CGS_3D_ASYMLUT 1853 Void TDecTop::xDecodePPS( const std::vector<UChar> *pNaluData, TCom3DAsymLUT * pc3DAsymLUT )1918 Void TDecTop::xDecodePPS( const std::vector<UChar> &naluData, TCom3DAsymLUT * pc3DAsymLUT ) 1854 1919 #else 1855 Void TDecTop::xDecodePPS(const std::vector<UChar> *pNaluData)1920 Void TDecTop::xDecodePPS(const std::vector<UChar> &naluData) 1856 1921 #endif 1857 1922 { … … 1866 1931 m_cEntropyDecoder.decodePPS( pps ); 1867 1932 #endif 1868 m_parameterSetManager.storePPS( pps, pNaluData); 1869 } 1870 1871 Void TDecTop::xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ) 1872 { 1873 if(nalUnitType == NAL_UNIT_SUFFIX_SEI) 1874 { 1875 #if SVC_EXTENSION 1876 if (m_prevSliceSkipped) // No need to decode SEI messages of a skipped access unit 1877 { 1878 return; 1879 } 1880 #endif 1881 #if LAYERS_NOT_PRESENT_SEI 1882 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManager.getActiveVPS(), m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream ); 1883 #else 1884 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream ); 1885 #endif 1886 } 1887 else 1888 { 1889 #if LAYERS_NOT_PRESENT_SEI 1890 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManager.getActiveVPS(), m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream ); 1891 #else 1892 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream ); 1893 #endif 1894 SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS); 1895 if (activeParamSets.size()>0) 1896 { 1897 SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin()); 1898 #if R0247_SEI_ACTIVE 1899 assert(seiAps->activeSeqParameterSetId.size()>0); 1900 if( !getLayerDec(0)->m_parameterSetManager.activateSPSWithSEI( seiAps->activeSeqParameterSetId[0] ) ) 1901 { 1902 printf ("Warning SPS activation with Active parameter set SEI failed"); 1903 } 1904 for (Int c=1 ; c <= seiAps->numSpsIdsMinus1; c++) 1905 { 1906 Int layerIdx = seiAps->layerSpsIdx[c]; 1907 if( !getLayerDec(layerIdx)->m_parameterSetManager.activateSPSWithSEI( seiAps->activeSeqParameterSetId[layerIdx] ) ) 1908 { 1909 printf ("Warning SPS activation with Active parameter set SEI failed"); 1910 } 1911 } 1912 #else 1913 assert(seiAps->activeSeqParameterSetId.size()>0); 1914 if (! m_parameterSetManager.activateSPSWithSEI(seiAps->activeSeqParameterSetId[0] )) 1915 { 1916 printf ("Warning SPS activation with Active parameter set SEI failed"); 1917 } 1918 #endif 1919 } 1920 } 1933 m_parameterSetManager.storePPS( pps, naluData); 1921 1934 } 1922 1935 … … 1937 1950 // Initialize entropy decoder 1938 1951 m_cEntropyDecoder.setEntropyDecoder (&m_cCavlcDecoder); 1939 m_cEntropyDecoder.setBitstream ( nalu.m_Bitstream);1952 m_cEntropyDecoder.setBitstream (&(nalu.getBitstream())); 1940 1953 1941 1954 #if SVC_EXTENSION … … 1952 1965 assert( nalu.m_nuhLayerId == 0 ); // Non-conforming bitstream. The value of nuh_layer_id of VPS NAL unit shall be equal to 0. 1953 1966 #endif 1954 xDecodeVPS(nalu. m_Bitstream->getFifo());1967 xDecodeVPS(nalu.getBitstream().getFifo()); 1955 1968 #if RExt__DECODER_DEBUG_BIT_STATISTICS 1956 TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS, nalu.m_Bitstream->readByteAlignment(),0);1969 TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS, nalu.getBitstream().readByteAlignment(), 0); 1957 1970 #endif 1958 1971 #if SVC_EXTENSION … … 1962 1975 1963 1976 case NAL_UNIT_SPS: 1964 xDecodeSPS(nalu. m_Bitstream->getFifo());1977 xDecodeSPS(nalu.getBitstream().getFifo()); 1965 1978 #if RExt__DECODER_DEBUG_BIT_STATISTICS 1966 TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS, nalu.m_Bitstream->readByteAlignment(),0);1979 TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS, nalu.getBitstream().readByteAlignment(), 0); 1967 1980 #endif 1968 1981 return false; … … 1970 1983 case NAL_UNIT_PPS: 1971 1984 #if CGS_3D_ASYMLUT 1972 xDecodePPS( nalu. m_Bitstream->getFifo(), &m_c3DAsymLUTPPS );1985 xDecodePPS( nalu.getBitstream().getFifo(), &m_c3DAsymLUTPPS ); 1973 1986 #else 1974 xDecodePPS(nalu. m_Bitstream->getFifo());1987 xDecodePPS(nalu.getBitstream().getFifo()); 1975 1988 #endif 1976 1989 #if RExt__DECODER_DEBUG_BIT_STATISTICS 1977 TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS, nalu.m_Bitstream->readByteAlignment(),0);1990 TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS, nalu.getBitstream().readByteAlignment(),0); 1978 1991 #endif 1979 1992 return false; 1980 1993 1981 1994 case NAL_UNIT_PREFIX_SEI: 1995 // Buffer up prefix SEI messages until SPS of associated VCL is known. 1996 m_prefixSEINALUs.push_back(new InputNALUnit(nalu)); 1997 return false; 1998 1982 1999 case NAL_UNIT_SUFFIX_SEI: 1983 2000 #if SVC_EXTENSION … … 1987 2004 } 1988 2005 #endif 1989 xDecodeSEI( nalu.m_Bitstream, nalu.m_nalUnitType ); 2006 if (m_pcPic) 2007 { 2008 #if SVC_EXTENSION 2009 m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveVPS(), m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream ); 2010 #else 2011 m_seiReader.parseSEImessage( &(nalu.getBitstream()), m_pcPic->getSEIs(), nalu.m_nalUnitType, m_parameterSetManager.getActiveSPS(), m_pDecodedSEIOutputStream ); 2012 #endif 2013 } 2014 else 2015 { 2016 printf ("Note: received suffix SEI but no picture currently active.\n"); 2017 } 1990 2018 return false; 1991 2019 … … 2079 2107 case NAL_UNIT_RESERVED_VCL30: 2080 2108 case NAL_UNIT_RESERVED_VCL31: 2109 printf ("Note: found reserved VCL NAL unit.\n"); 2110 xParsePrefixSEIsForUnknownVCLNal(); 2111 return false; 2081 2112 2082 2113 case NAL_UNIT_RESERVED_NVCL41: -
branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h
r1295 r1319 56 56 #include "SEIread.h" 57 57 58 structInputNALUnit;58 class InputNALUnit; 59 59 60 60 //! \ingroup TLibDecoder … … 79 79 TComSlice* m_apcSlicePilot; 80 80 81 SEIMessages m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices 81 SEIMessages m_SEIs; ///< List of SEI messages that have been received before the first slice and between slices, excluding prefix SEIs... 82 82 83 83 // functional classes … … 123 123 124 124 Bool m_warningMessageSkipPicture; 125 126 std::list<InputNALUnit*> m_prefixSEINALUs; /// Buffered up prefix SEI NAL Units. 125 127 126 128 #if SVC_EXTENSION … … 277 279 Bool xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay); 278 280 #endif 279 Void xDecodeVPS(const std::vector<UChar> *pNaluData);280 Void xDecodeSPS(const std::vector<UChar> *pNaluData);281 Void xDecodeVPS(const std::vector<UChar> &naluData); 282 Void xDecodeSPS(const std::vector<UChar> &naluData); 281 283 #if CGS_3D_ASYMLUT 282 Void xDecodePPS(const std::vector<UChar> *pNaluData, TCom3DAsymLUT *pc3DAsymLUT);284 Void xDecodePPS(const std::vector<UChar> &naluData, TCom3DAsymLUT *pc3DAsymLUT); 283 285 #else 284 Void xDecodePPS(const std::vector<UChar> *pNaluData);286 Void xDecodePPS(const std::vector<UChar> &naluData); 285 287 #endif 286 288 Void xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ); 287 289 Void xUpdatePreviousTid0POC( TComSlice *pSlice ) { if ((pSlice->getTLayer()==0) && (pSlice->isReferenceNalu() && (pSlice->getNalUnitType()!=NAL_UNIT_CODED_SLICE_RASL_R)&& (pSlice->getNalUnitType()!=NAL_UNIT_CODED_SLICE_RADL_R))) { m_prevTid0POC=pSlice->getPOC(); } } 290 Void xParsePrefixSEImessages(); 291 Void xParsePrefixSEIsForUnknownVCLNal(); 288 292 289 293
Note: See TracChangeset for help on using the changeset viewer.