Changeset 362 in 3DVCSoftware for branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
- Timestamp:
- 3 May 2013, 15:34:11 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-DEV-0.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
r331 r362 175 175 } 176 176 177 /** copy SAO parameter178 * \param dst179 * \param src180 */181 inline Void copySaoOneLcuParam(SaoLcuParam* dst, SaoLcuParam* src)182 {183 Int i;184 dst->partIdx = src->partIdx;185 dst->typeIdx = src->typeIdx;186 if (dst->typeIdx != -1)187 {188 dst->subTypeIdx = src->subTypeIdx ;189 dst->length = src->length;190 for (i=0;i<dst->length;i++)191 {192 dst->offset[i] = src->offset[i];193 }194 }195 else196 {197 dst->length = 0;198 for (i=0;i<SAO_BO_LEN;i++)199 {200 dst->offset[i] = 0;201 }202 }203 }204 205 177 Void TDecCavlc::parsePPS(TComPPS* pcPPS) 206 178 { … … 400 372 401 373 READ_FLAG( uiCode, "field_seq_flag"); pcVUI->setFieldSeqFlag(uiCode); 402 assert(pcVUI->getFieldSeqFlag() == false); // not supported yet403 374 404 375 READ_FLAG(uiCode, "frame_field_info_present_flag"); pcVUI->setFrameFieldInfoPresentFlag(uiCode); … … 593 564 594 565 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 595 g_bitDepthY = 8 + uiCode; 596 pcSPS->setBitDepthY(g_bitDepthY); 566 pcSPS->setBitDepthY( uiCode + 8 ); 597 567 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 598 568 599 569 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 600 g_bitDepthC = 8 + uiCode; 601 pcSPS->setBitDepthC(g_bitDepthC); 570 pcSPS->setBitDepthC( uiCode + 8 ); 602 571 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 603 572 … … 608 577 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 609 578 { 579 #if L0323_DPB 580 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1"); 581 pcSPS->setMaxDecPicBuffering( uiCode + 1, i); 582 #else 610 583 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering"); 611 584 pcSPS->setMaxDecPicBuffering( uiCode, i); 585 #endif 612 586 READ_UVLC ( uiCode, "sps_num_reorder_pics" ); 613 587 pcSPS->setNumReorderPics(uiCode, i); … … 628 602 629 603 READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" ); 630 UInt log2MinCUSize = uiCode + 3; 604 Int log2MinCUSize = uiCode + 3; 605 pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); 631 606 READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" ); 632 UInt uiMaxCUDepthCorrect = uiCode; 633 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUWidth = 1<<(log2MinCUSize + uiMaxCUDepthCorrect); 634 pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + uiMaxCUDepthCorrect) ); g_uiMaxCUHeight = 1<<(log2MinCUSize + uiMaxCUDepthCorrect); 607 pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); 608 Int maxCUDepthDelta = uiCode; 609 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 610 pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 635 611 READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); 636 612 … … 640 616 READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" ); pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 ); 641 617 READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" ); pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 ); 642 g_uiAddCUDepth = 0; 643 while( ( pcSPS->getMaxCUWidth() >> uiMaxCUDepthCorrect ) > ( 1 << ( pcSPS->getQuadtreeTULog2MinSize() + g_uiAddCUDepth ) ) ) 644 { 645 g_uiAddCUDepth++; 646 } 647 pcSPS->setMaxCUDepth( uiMaxCUDepthCorrect+g_uiAddCUDepth ); 648 g_uiMaxCUDepth = uiMaxCUDepthCorrect+g_uiAddCUDepth; 649 // BB: these parameters may be removed completly and replaced by the fixed values 650 pcSPS->setMinTrDepth( 0 ); 651 pcSPS->setMaxTrDepth( 1 ); 618 619 Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() ); 620 pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth ); 621 652 622 READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); 653 623 if(pcSPS->getScalingListFlag()) … … 748 718 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 749 719 { 720 #if L0323_DPB 721 READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); 722 #else 750 723 READ_UVLC( uiCode, "vps_max_dec_pic_buffering[i]" ); pcVPS->setMaxDecPicBuffering( uiCode, i ); 724 #endif 751 725 READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 752 726 READ_UVLC( uiCode, "vps_max_latency_increase[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); … … 1056 1030 iPOCmsb = iPrevPOCmsb; 1057 1031 } 1058 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1059 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT1032 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1033 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1060 1034 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1061 1035 { … … 1066 1040 1067 1041 TComReferencePictureSet* rps; 1042 rps = rpcSlice->getLocalRPS(); 1043 rpcSlice->setRPS(rps); 1068 1044 READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); 1069 1045 if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header 1070 1046 { 1071 rps = rpcSlice->getLocalRPS();1072 1047 parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); 1073 rpcSlice->setRPS(rps);1074 1048 } 1075 1049 else // use reference to short-term reference picture set in PPS … … 1088 1062 uiCode = 0; 1089 1063 } 1090 rpcSlice->setRPS(sps->getRPSList()->getReferencePictureSet(uiCode)); 1091 1092 rps = rpcSlice->getRPS(); 1064 memcpy(rps,sps->getRPSList()->getReferencePictureSet(uiCode),sizeof(TComReferencePictureSet)); 1093 1065 } 1094 1066 if(sps->getLongTermRefsPresent()) … … 1113 1085 rps->setNumberOfLongtermPictures(numOfLtrp); 1114 1086 Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); 1115 Int prev LSB = 0, prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;;1087 Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; 1116 1088 for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) 1117 1089 { … … 1140 1112 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); 1141 1113 Bool deltaFlag = false; 1142 // First LTRP || First LTRP from SH || curr LSB != prev LSB1143 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) || (pocLsbLt != prevLSB))1114 // First LTRP || First LTRP from SH 1115 if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) 1144 1116 { 1145 1117 deltaFlag = true; … … 1166 1138 rps->setCheckLTMSBPresent(j,false); 1167 1139 } 1168 prevLSB = pocLsbLt;1169 1140 prevDeltaMSB = deltaPocMSBCycleLT; 1170 1141 } … … 1172 1143 rps->setNumberOfPictures(offset); 1173 1144 } 1174 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA 1175 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA NT1145 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1146 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL 1176 1147 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) 1177 1148 { … … 1405 1376 if(!rpcSlice->getDeblockingFilterDisable()) 1406 1377 { 1407 READ_SVLC( iCode, "beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 1408 READ_SVLC( iCode, "tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 1378 READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); 1379 assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && 1380 rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); 1381 READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); 1382 assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && 1383 rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); 1409 1384 } 1410 1385 } … … 1438 1413 } 1439 1414 1440 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() )1441 {1442 1415 UInt *entryPointOffset = NULL; 1443 1416 UInt numEntryPointOffsets, offsetLenMinus1; 1444 1417 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 1418 { 1445 1419 READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); 1446 1420 if (numEntryPointOffsets>0) … … 1459 1433 #endif 1460 1434 } 1435 } 1436 else 1437 { 1438 rpcSlice->setNumEntryPointOffsets ( 0 ); 1439 } 1440 1441 if(pps->getSliceHeaderExtensionPresentFlag()) 1442 { 1443 READ_UVLC(uiCode,"slice_header_extension_length"); 1444 for(Int i=0; i<uiCode; i++) 1445 { 1446 UInt ignore; 1447 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 1448 } 1449 } 1450 m_pcBitstream->readByteAlignment(); 1451 1452 if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) 1453 { 1454 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 1455 Int curEntryPointOffset = 0; 1456 Int prevEntryPointOffset = 0; 1457 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 1458 { 1459 curEntryPointOffset += entryPointOffset[ idx ]; 1460 1461 Int emulationPreventionByteCount = 0; 1462 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 1463 { 1464 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 1465 m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) 1466 { 1467 emulationPreventionByteCount++; 1468 } 1469 } 1470 1471 entryPointOffset[ idx ] -= emulationPreventionByteCount; 1472 prevEntryPointOffset = curEntryPointOffset; 1473 } 1461 1474 1462 1475 if ( pps->getTilesEnabledFlag() ) … … 1494 1507 } 1495 1508 } 1496 else 1497 { 1498 rpcSlice->setNumEntryPointOffsets ( 0 ); 1499 } 1500 1501 if(pps->getSliceHeaderExtensionPresentFlag()) 1502 { 1503 READ_UVLC(uiCode,"slice_header_extension_length"); 1504 for(Int i=0; i<uiCode; i++) 1505 { 1506 UInt ignore; 1507 READ_CODE(8,ignore,"slice_header_extension_data_byte"); 1508 } 1509 } 1510 m_pcBitstream->readByteAlignment(); 1509 1511 1510 return; 1512 1511 } … … 1759 1758 // ==================================================================================================================== 1760 1759 1761 1762 /** Parse PCM alignment zero bits.1763 * \returns Void1764 */1765 Void TDecCavlc::xReadPCMAlignZero( )1766 {1767 UInt uiNumberOfBits = m_pcBitstream->getNumBitsUntilByteAligned();1768 1769 if(uiNumberOfBits)1770 {1771 UInt uiBits;1772 UInt uiSymbol;1773 1774 for(uiBits = 0; uiBits < uiNumberOfBits; uiBits++)1775 {1776 xReadFlag( uiSymbol );1777 assert( uiSymbol == 0 );1778 }1779 }1780 }1781 1782 Void TDecCavlc::xReadUnaryMaxSymbol( UInt& ruiSymbol, UInt uiMaxSymbol )1783 {1784 if (uiMaxSymbol == 0)1785 {1786 ruiSymbol = 0;1787 return;1788 }1789 1790 xReadFlag( ruiSymbol );1791 1792 if (ruiSymbol == 0 || uiMaxSymbol == 1)1793 {1794 return;1795 }1796 1797 UInt uiSymbol = 0;1798 UInt uiCont;1799 1800 do1801 {1802 xReadFlag( uiCont );1803 uiSymbol++;1804 }1805 while( uiCont && (uiSymbol < uiMaxSymbol-1) );1806 1807 if( uiCont && (uiSymbol == uiMaxSymbol-1) )1808 {1809 uiSymbol++;1810 }1811 1812 ruiSymbol = uiSymbol;1813 }1814 1815 Void TDecCavlc::xReadExGolombLevel( UInt& ruiSymbol )1816 {1817 UInt uiSymbol ;1818 UInt uiCount = 0;1819 do1820 {1821 xReadFlag( uiSymbol );1822 uiCount++;1823 }1824 while( uiSymbol && (uiCount != 13));1825 1826 ruiSymbol = uiCount-1;1827 1828 if( uiSymbol )1829 {1830 xReadEpExGolomb( uiSymbol, 0 );1831 ruiSymbol += uiSymbol+1;1832 }1833 1834 return;1835 }1836 1837 Void TDecCavlc::xReadEpExGolomb( UInt& ruiSymbol, UInt uiCount )1838 {1839 UInt uiSymbol = 0;1840 UInt uiBit = 1;1841 1842 1843 while( uiBit )1844 {1845 xReadFlag( uiBit );1846 uiSymbol += uiBit << uiCount++;1847 }1848 1849 uiCount--;1850 while( uiCount-- )1851 {1852 xReadFlag( uiBit );1853 uiSymbol += uiBit << uiCount;1854 }1855 1856 ruiSymbol = uiSymbol;1857 1858 return;1859 }1860 1861 UInt TDecCavlc::xGetBit()1862 {1863 UInt ruiCode;1864 m_pcBitstream->read( 1, ruiCode );1865 return ruiCode;1866 }1867 1868 1869 1760 /** parse explicit wp tables 1870 1761 * \param TComSlice* pcSlice … … 1883 1774 // decode delta_luma_log2_weight_denom : 1884 1775 READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom 1776 assert( uiLog2WeightDenomLuma <= 7 ); 1885 1777 if( bChroma ) 1886 1778 { 1887 1779 READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom 1888 1780 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); 1781 assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7); 1889 1782 uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); 1890 1783 } … … 1925 1818 Int iDeltaWeight; 1926 1819 READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" ); // se(v): delta_luma_weight_l0[i] 1820 assert( iDeltaWeight >= -128 ); 1821 assert( iDeltaWeight <= 127 ); 1927 1822 wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom)); 1928 1823 READ_SVLC( wp[0].iOffset, "luma_offset_lX" ); // se(v): luma_offset_l0[i] 1824 assert( wp[0].iOffset >= -128 ); 1825 assert( wp[0].iOffset <= 127 ); 1929 1826 } 1930 1827 else … … 1941 1838 Int iDeltaWeight; 1942 1839 READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" ); // se(v): chroma_weight_l0[i][j] 1840 assert( iDeltaWeight >= -128 ); 1841 assert( iDeltaWeight <= 127 ); 1943 1842 wp[j].iWeight = (iDeltaWeight + (1<<wp[1].uiLog2WeightDenom)); 1944 1843 1945 1844 Int iDeltaChroma; 1946 1845 READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" ); // se(v): delta_chroma_offset_l0[i][j] 1846 assert( iDeltaChroma >= -512 ); 1847 assert( iDeltaChroma <= 511 ); 1947 1848 Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); 1948 1849 wp[j].iOffset = Clip3(-128, 127, (iDeltaChroma + pred) );
Note: See TracChangeset for help on using the changeset viewer.