Changeset 310 in SHVCSoftware for trunk/source/Lib/TLibDecoder
- Timestamp:
- 22 Jul 2013, 21:40:00 (12 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/SHM-2.1-dev (added) merged: 193-196,202,204,210-212,214-216,224,226-228,233-251,258,282-309
- Property svn:mergeinfo changed
-
trunk/source
- Property svn:mergeinfo changed
-
trunk/source/Lib/TLibDecoder/SEIread.cpp
r191 r310 90 90 fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n"); 91 91 break; 92 #if J0149_TONE_MAPPING_SEI93 92 case SEI::TONE_MAPPING_INFO: 94 93 fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n"); 95 94 break; 96 #endif 97 #if L0208_SOP_DESCRIPTION_SEI 95 #if M0043_LAYERS_PRESENT_SEI 96 case SEI::LAYERS_PRESENT: 97 fprintf( g_hTrace, "=========== Layers Present SEI message ===========\n"); 98 break; 99 #endif 98 100 case SEI::SOP_DESCRIPTION: 99 101 fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n"); 100 102 break; 101 #endif102 #if K0180_SCALABLE_NESTING_SEI103 103 case SEI::SCALABLE_NESTING: 104 104 fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n"); 105 105 break; 106 #endif107 106 default: 108 107 fprintf( g_hTrace, "=========== Unknown SEI message ===========\n"); … … 115 114 * unmarshal a single SEI message from bitstream bs 116 115 */ 116 #if M0043_LAYERS_PRESENT_SEI 117 void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps) 118 #else 117 119 void SEIReader::parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps) 120 #endif 118 121 { 119 122 setBitstream(bs); … … 122 125 do 123 126 { 127 #if M0043_LAYERS_PRESENT_SEI 128 xReadSEImessage(seis, nalUnitType, vps, sps); 129 #else 124 130 xReadSEImessage(seis, nalUnitType, sps); 131 #endif 125 132 /* SEI messages are an integer number of bytes, something has failed 126 133 * in the parsing if bitstream not byte-aligned */ … … 133 140 } 134 141 142 #if M0043_LAYERS_PRESENT_SEI 143 Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps) 144 #else 135 145 Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps) 146 #endif 136 147 { 137 148 #if ENC_DEC_TRACE … … 234 245 xParseSEIGradualDecodingRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize); 235 246 break; 236 #if J0149_TONE_MAPPING_SEI237 247 case SEI::TONE_MAPPING_INFO: 238 248 sei = new SEIToneMappingInfo; 239 249 xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize); 240 250 break; 241 #endif 242 #if L0208_SOP_DESCRIPTION_SEI 251 #if M0043_LAYERS_PRESENT_SEI 252 case SEI::LAYERS_PRESENT: 253 if (!vps) 254 { 255 printf ("Warning: Found Layers present SEI message, but no active VPS is available. Ignoring."); 256 } 257 else 258 { 259 sei = new SEILayersPresent; 260 xParseSEILayersPresent((SEILayersPresent&) *sei, payloadSize, vps); 261 } 262 break; 263 #endif 243 264 case SEI::SOP_DESCRIPTION: 244 265 sei = new SEISOPDescription; 245 266 xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize); 246 267 break; 247 #endif248 #if K0180_SCALABLE_NESTING_SEI249 268 case SEI::SCALABLE_NESTING: 250 269 sei = new SEIScalableNesting; 270 #if M0043_LAYERS_PRESENT_SEI 271 xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, vps, sps); 272 #else 251 273 xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps); 252 break; 253 #endif 274 #endif 275 break; 254 276 default: 255 277 for (UInt i = 0; i < payloadSize; i++) … … 265 287 switch (payloadType) 266 288 { 267 #if L0363_SEI_ALLOW_SUFFIX268 289 case SEI::USER_DATA_UNREGISTERED: 269 290 sei = new SEIuserDataUnregistered; 270 291 xParseSEIuserDataUnregistered((SEIuserDataUnregistered&) *sei, payloadSize); 271 292 break; 272 #endif273 293 case SEI::DECODED_PICTURE_HASH: 274 294 sei = new SEIDecodedPictureHash; … … 402 422 UInt val; 403 423 READ_CODE(4, val, "active_vps_id"); sei.activeVPSId = val; 404 #if L0047_APS_FLAGS405 424 READ_FLAG( val, "full_random_access_flag"); sei.m_fullRandomAccessFlag = val ? true : false; 406 425 READ_FLAG( val, "no_param_set_update_flag"); sei.m_noParamSetUpdateFlag = val ? true : false; 407 #endif408 426 READ_UVLC( val, "num_sps_ids_minus1"); sei.numSpsIdsMinus1 = val; 409 427 … … 438 456 sei.m_duSptCpbRemovalDelay = 0; 439 457 } 440 #if L0044_DU_DPB_OUTPUT_DELAY_HRD441 458 READ_FLAG( val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = val ? true : false; 442 459 if(sei.m_dpbOutputDuDelayPresentFlag) … … 445 462 sei.m_picSptDpbOutputDuDelay = val; 446 463 } 447 #endif448 464 xParseByteAlign(); 449 465 } … … 462 478 READ_FLAG( code, "rap_cpb_params_present_flag" ); sei.m_rapCpbParamsPresentFlag = code; 463 479 } 464 #if L0328_SPLICING465 480 //read splicing flag and cpb_removal_delay_delta 466 481 READ_FLAG( code, "concatenation_flag"); … … 468 483 READ_CODE( ( pHRD->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_delta_minus1" ); 469 484 sei.m_auCpbRemovalDelayDelta = code + 1; 470 #endif471 #if L0044_CPB_DPB_DELAY_OFFSET472 485 if( sei.m_rapCpbParamsPresentFlag ) 473 486 { … … 475 488 READ_CODE( pHRD->getDpbOutputDelayLengthMinus1() + 1, code, "dpb_delay_offset" ); sei.m_dpbDelayOffset = code; 476 489 } 477 #endif478 490 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 479 491 { … … 507 519 TComHRD *hrd = vui->getHrdParameters(); 508 520 509 #if !L0045_CONDITION_SIGNALLING510 // This condition was probably OK before the pic_struct, progressive_source_idc, duplicate_flag were added511 if( !hrd->getNalHrdParametersPresentFlag() && !hrd->getVclHrdParametersPresentFlag() )512 {513 return;514 }515 #endif516 517 521 if( vui->getFrameFieldInfoPresentFlag() ) 518 522 { 519 523 READ_CODE( 4, code, "pic_struct" ); sei.m_picStruct = code; 520 #if L0046_RENAME_PROG_SRC_IDC521 524 READ_CODE( 2, code, "source_scan_type" ); sei.m_sourceScanType = code; 522 #else523 READ_CODE( 2, code, "progressive_source_idc" ); sei.m_progressiveSourceIdc = code;524 #endif525 525 READ_FLAG( code, "duplicate_flag" ); sei.m_duplicateFlag = ( code == 1 ? true : false ); 526 526 } 527 527 528 #if L0045_CONDITION_SIGNALLING529 528 if( hrd->getCpbDpbDelaysPresentFlag()) 530 529 { 531 #endif532 530 READ_CODE( ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_minus1" ); 533 531 sei.m_auCpbRemovalDelay = code + 1; … … 535 533 sei.m_picDpbOutputDelay = code; 536 534 537 #if L0044_DU_DPB_OUTPUT_DELAY_HRD538 535 if(hrd->getSubPicCpbParamsPresentFlag()) 539 536 { … … 541 538 sei.m_picDpbOutputDuDelay = code; 542 539 } 543 #endif544 540 if( hrd->getSubPicCpbParamsPresentFlag() && hrd->getSubPicCpbParamsInPicTimingSEIFlag() ) 545 541 { … … 575 571 } 576 572 } 577 #if L0045_CONDITION_SIGNALLING 578 } 579 #endif 573 } 580 574 xParseByteAlign(); 581 575 } … … 598 592 { 599 593 READ_CODE( 7, val, "frame_packing_arrangement_type" ); sei.m_arrangementType = val; 600 #if L0444_FPA_TYPE601 594 assert((sei.m_arrangementType > 2) && (sei.m_arrangementType < 6) ); 602 #endif603 595 READ_FLAG( val, "quincunx_sampling_flag" ); sei.m_quincunxSamplingFlag = val; 604 596 … … 620 612 621 613 READ_CODE( 8, val, "frame_packing_arrangement_reserved_byte" ); sei.m_arrangementReservedByte = val; 622 #if L0045_PERSISTENCE_FLAGS623 614 READ_FLAG( val, "frame_packing_arrangement_persistence_flag" ); sei.m_arrangementPersistenceFlag = val ? true : false; 624 #else625 READ_UVLC( val, "frame_packing_arrangement_repetition_period" ); sei.m_arrangementRepetetionPeriod = val;626 #endif627 615 } 628 616 READ_FLAG( val, "upsampled_aspect_ratio" ); sei.m_upsampledAspectRatio = val; … … 640 628 READ_FLAG( val, "ver_flip" ); sei.verFlip = val; 641 629 READ_CODE( 16, val, "anticlockwise_rotation" ); sei.anticlockwiseRotation = val; 642 #if L0045_PERSISTENCE_FLAGS643 630 READ_FLAG( val, "display_orientation_persistence_flag" ); sei.persistenceFlag = val; 644 #else645 READ_UVLC( val, "display_orientation_repetition_period" ); sei.repetitionPeriod = val;646 #endif647 #if !REMOVE_SINGLE_SEI_EXTENSION_FLAGS648 READ_FLAG( val, "display_orientation_extension_flag" ); sei.extensionFlag = val;649 assert( !sei.extensionFlag );650 #endif651 631 } 652 632 xParseByteAlign(); … … 668 648 } 669 649 670 #if J0149_TONE_MAPPING_SEI671 650 Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt /*payloadSize*/) 672 651 { … … 749 728 xParseByteAlign(); 750 729 } 751 #endif 752 753 #if L0208_SOP_DESCRIPTION_SEI 730 731 #if M0043_LAYERS_PRESENT_SEI 732 Void SEIReader::xParseSEILayersPresent(SEILayersPresent &sei, UInt payloadSize, TComVPS *vps) 733 { 734 UInt uiCode; 735 UInt i = 0; 736 737 READ_UVLC( uiCode, "lp_sei_active_vps_id" ); sei.m_activeVpsId = uiCode; 738 assert(vps->getVPSId() == sei.m_activeVpsId); 739 sei.m_vpsMaxLayers = vps->getMaxLayers(); 740 for (; i < sei.m_vpsMaxLayers; i++) 741 { 742 READ_FLAG( uiCode, "layer_present_flag" ); sei.m_layerPresentFlag[i] = uiCode ? true : false; 743 } 744 for (; i < MAX_LAYERS; i++) 745 { 746 sei.m_layerPresentFlag[i] = false; 747 } 748 xParseByteAlign(); 749 } 750 #endif 751 754 752 Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize) 755 753 { … … 775 773 xParseByteAlign(); 776 774 } 777 #endif 778 779 #if K0180_SCALABLE_NESTING_SEI 775 776 #if M0043_LAYERS_PRESENT_SEI 777 Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComVPS *vps, TComSPS *sps) 778 #else 780 779 Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps) 780 #endif 781 781 { 782 782 UInt uiCode; … … 820 820 // read nested SEI messages 821 821 do { 822 #if M0043_LAYERS_PRESENT_SEI 823 xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps); 824 #else 822 825 xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps); 826 #endif 823 827 } while (m_pcBitstream->getNumBitsLeft() > 8); 824 828 825 829 } 826 #endif827 830 828 831 Void SEIReader::xParseByteAlign() -
trunk/source/Lib/TLibDecoder/SEIread.h
r191 r310 56 56 SEIReader() {}; 57 57 virtual ~SEIReader() {}; 58 #if M0043_LAYERS_PRESENT_SEI 59 Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps); 60 #else 58 61 Void parseSEImessage(TComInputBitstream* bs, SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps); 62 #endif 59 63 protected: 64 #if M0043_LAYERS_PRESENT_SEI 65 Void xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps); 66 #else 60 67 Void xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps); 68 #endif 61 69 Void xParseSEIuserDataUnregistered (SEIuserDataUnregistered &sei, UInt payloadSize); 62 70 Void xParseSEIActiveParameterSets (SEIActiveParameterSets &sei, UInt payloadSize); … … 70 78 Void xParseSEITemporalLevel0Index (SEITemporalLevel0Index &sei, UInt payloadSize); 71 79 Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize); 72 #if J0149_TONE_MAPPING_SEI73 80 Void xParseSEIToneMappingInfo (SEIToneMappingInfo& sei, UInt payloadSize); 74 #endif75 #if L0208_SOP_DESCRIPTION_SEI76 81 Void xParseSEISOPDescription (SEISOPDescription &sei, UInt payloadSize); 77 #endif 78 #if K0180_SCALABLE_NESTING_SEI 82 #if M0043_LAYERS_PRESENT_SEI 83 Void xParseSEILayersPresent (SEILayersPresent &sei, UInt payloadSize, TComVPS *vps); 84 Void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComVPS *vps, TComSPS *sps); 85 #else 79 86 Void xParseSEIScalableNesting (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps); 80 87 #endif -
trunk/source/Lib/TLibDecoder/TDecBinCoder.h
r191 r310 54 54 virtual Void start () = 0; 55 55 virtual Void finish () = 0; 56 virtual Void flush () = 0;57 56 58 57 virtual Void decodeBin ( UInt& ruiBin, ContextModel& rcCtxModel ) = 0; … … 61 60 virtual Void decodeBinTrm ( UInt& ruiBin ) = 0; 62 61 63 virtual Void resetBac () = 0;64 virtual Void decodePCMAlignBits() = 0;65 62 virtual Void xReadPCMCode ( UInt uiLength, UInt& ruiCode) = 0; 66 63 -
trunk/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp
r191 r310 75 75 TDecBinCABAC::finish() 76 76 { 77 } 78 79 Void 80 TDecBinCABAC::flush() 81 { 82 while (m_pcTComBitstream->getNumBitsLeft() > 0 && m_pcTComBitstream->getNumBitsUntilByteAligned() != 0) 83 { 84 UInt uiBits; 85 m_pcTComBitstream->read ( 1, uiBits ); 86 } 87 start(); 77 UInt lastByte; 78 79 m_pcTComBitstream->peekPreviousByte( lastByte ); 80 // Check for proper stop/alignment pattern 81 assert( ((lastByte << (8 + m_bitsNeeded)) & 0xff) == 0x80 ); 88 82 } 89 83 … … 241 235 } 242 236 243 /** Reset BAC register values.244 * \returns Void245 */246 Void TDecBinCABAC::resetBac()247 {248 m_uiRange = 510;249 m_bitsNeeded = -8;250 m_uiValue = m_pcTComBitstream->read( 16 );251 }252 253 /** Decode PCM alignment zero bits.254 * \returns Void255 */256 Void TDecBinCABAC::decodePCMAlignBits()257 {258 Int iNum = m_pcTComBitstream->getNumBitsUntilByteAligned();259 260 UInt uiBit = 0;261 m_pcTComBitstream->read( iNum, uiBit );262 }263 264 237 /** Read a PCM code. 265 238 * \param uiLength code bit-depth -
trunk/source/Lib/TLibDecoder/TDecBinCoderCABAC.h
r191 r310 56 56 Void start (); 57 57 Void finish (); 58 Void flush ();59 58 60 59 Void decodeBin ( UInt& ruiBin, ContextModel& rcCtxModel ); … … 63 62 Void decodeBinTrm ( UInt& ruiBin ); 64 63 65 Void resetBac ();66 Void decodePCMAlignBits();67 64 Void xReadPCMCode ( UInt uiLength, UInt& ruiCode ); 68 65 -
trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp
r191 r310 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 6 * Copyright (c) 2010-2013, ITU/ISO/IEC … … 93 93 } 94 94 95 if (interRPSPred) 95 if (interRPSPred) 96 96 { 97 97 UInt bit; … … 114 114 for(Int j=0 ; j <= rpsRef->getNumberOfPictures(); j++) 115 115 { 116 READ_CODE(1, bit, "used_by_curr_pic_flag" ); //first bit is "1" if Idc is 1 116 READ_CODE(1, bit, "used_by_curr_pic_flag" ); //first bit is "1" if Idc is 1 117 117 Int refIdc = bit; 118 if (refIdc == 0) 118 if (refIdc == 0) 119 119 { 120 120 READ_CODE(1, bit, "use_delta_flag" ); //second bit is "1" if Idc is 2, "0" otherwise. … … 131 131 k0++; 132 132 } 133 else 133 else 134 134 { 135 135 k1++; 136 136 } 137 137 k++; 138 } 139 rps->setRefIdc(j,refIdc); 140 } 141 rps->setNumRefIdc(rpsRef->getNumberOfPictures()+1); 138 } 139 rps->setRefIdc(j,refIdc); 140 } 141 rps->setNumRefIdc(rpsRef->getNumberOfPictures()+1); 142 142 rps->setNumberOfPictures(k); 143 143 rps->setNumberOfNegativePictures(k0); … … 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 { 207 #if ENC_DEC_TRACE 179 #if ENC_DEC_TRACE 208 180 xTracePPSHeader (pcPPS); 209 181 #endif … … 212 184 Int iCode; 213 185 214 READ_UVLC( uiCode, "pps_pic_parameter_set_id"); pcPPS->setPPSId (uiCode); 215 READ_UVLC( uiCode, "pps_seq_parameter_set_id"); pcPPS->setSPSId (uiCode); 186 READ_UVLC( uiCode, "pps_pic_parameter_set_id"); 187 assert(uiCode <= 63); 188 pcPPS->setPPSId (uiCode); 189 190 READ_UVLC( uiCode, "pps_seq_parameter_set_id"); 191 assert(uiCode <= 15); 192 pcPPS->setSPSId (uiCode); 193 216 194 READ_FLAG( uiCode, "dependent_slice_segments_enabled_flag" ); pcPPS->setDependentSliceSegmentsEnabledFlag ( uiCode == 1 ); 217 #if L0255_MOVE_PPS_FLAGS218 195 READ_FLAG( uiCode, "output_flag_present_flag" ); pcPPS->setOutputFlagPresentFlag( uiCode==1 ); 219 196 220 197 READ_CODE(3, uiCode, "num_extra_slice_header_bits"); pcPPS->setNumExtraSliceHeaderBits(uiCode); 221 #endif222 198 READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode ); 223 199 224 200 READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false ); 225 201 226 #if L0323_LIMIT_DEFAULT_LIST_SIZE227 202 READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1"); 228 203 assert(uiCode <= 14); 229 204 pcPPS->setNumRefIdxL0DefaultActive(uiCode+1); 230 205 231 206 READ_UVLC(uiCode, "num_ref_idx_l1_default_active_minus1"); 232 207 assert(uiCode <= 14); 233 208 pcPPS->setNumRefIdxL1DefaultActive(uiCode+1); 234 #else 235 READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1"); pcPPS->setNumRefIdxL0DefaultActive(uiCode+1); 236 READ_UVLC(uiCode, "num_ref_idx_l1_default_active_minus1"); pcPPS->setNumRefIdxL1DefaultActive(uiCode+1); 237 #endif 238 209 239 210 READ_SVLC(iCode, "init_qp_minus26" ); pcPPS->setPicInitQPMinus26(iCode); 240 211 READ_FLAG( uiCode, "constrained_intra_pred_flag" ); pcPPS->setConstrainedIntraPred( uiCode ? true : false ); 241 READ_FLAG( uiCode, "transform_skip_enabled_flag" ); 242 pcPPS->setUseTransformSkip ( uiCode ? true : false ); 212 READ_FLAG( uiCode, "transform_skip_enabled_flag" ); 213 pcPPS->setUseTransformSkip ( uiCode ? true : false ); 243 214 244 215 READ_FLAG( uiCode, "cu_qp_delta_enabled_flag" ); pcPPS->setUseDQP( uiCode ? true : false ); … … 270 241 pcPPS->setWPBiPred( uiCode==1 ); 271 242 272 #if !L0255_MOVE_PPS_FLAGS273 READ_FLAG( uiCode, "output_flag_present_flag" );274 pcPPS->setOutputFlagPresentFlag( uiCode==1 );275 #endif276 243 READ_FLAG( uiCode, "transquant_bypass_enable_flag"); 277 244 pcPPS->setTransquantBypassEnableFlag(uiCode ? true : false); 278 245 READ_FLAG( uiCode, "tiles_enabled_flag" ); pcPPS->setTilesEnabledFlag ( uiCode == 1 ); 279 246 READ_FLAG( uiCode, "entropy_coding_sync_enabled_flag" ); pcPPS->setEntropyCodingSyncEnabledFlag( uiCode == 1 ); 280 247 281 248 if( pcPPS->getTilesEnabledFlag() ) 282 249 { 283 READ_UVLC ( uiCode, "num_tile_columns_minus1" ); pcPPS->setNumColumnsMinus1( uiCode ); 284 READ_UVLC ( uiCode, "num_tile_rows_minus1" ); pcPPS->setNumRowsMinus1( uiCode ); 250 READ_UVLC ( uiCode, "num_tile_columns_minus1" ); pcPPS->setNumColumnsMinus1( uiCode ); 251 READ_UVLC ( uiCode, "num_tile_rows_minus1" ); pcPPS->setNumRowsMinus1( uiCode ); 285 252 READ_FLAG ( uiCode, "uniform_spacing_flag" ); pcPPS->setUniformSpacingFlag( uiCode ); 286 253 … … 289 256 UInt* columnWidth = (UInt*)malloc(pcPPS->getNumColumnsMinus1()*sizeof(UInt)); 290 257 for(UInt i=0; i<pcPPS->getNumColumnsMinus1(); i++) 291 { 292 READ_UVLC( uiCode, "column_width_minus1" ); 258 { 259 READ_UVLC( uiCode, "column_width_minus1" ); 293 260 columnWidth[i] = uiCode+1; 294 261 } … … 303 270 } 304 271 pcPPS->setRowHeight(rowHeight); 305 free(rowHeight); 272 free(rowHeight); 306 273 } 307 274 … … 335 302 pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode); 336 303 337 #if !L0255_MOVE_PPS_FLAGS338 READ_CODE(3, uiCode, "num_extra_slice_header_bits");339 pcPPS->setNumExtraSliceHeaderBits(uiCode);340 #endif341 304 READ_FLAG( uiCode, "slice_segment_header_extension_present_flag"); 342 305 pcPPS->setSliceHeaderExtensionPresentFlag(uiCode); … … 400 363 401 364 READ_FLAG( uiCode, "field_seq_flag"); pcVUI->setFieldSeqFlag(uiCode); 402 assert(pcVUI->getFieldSeqFlag() == false); // not supported yet403 365 404 366 READ_FLAG(uiCode, "frame_field_info_present_flag"); pcVUI->setFrameFieldInfoPresentFlag(uiCode); … … 413 375 READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); 414 376 } 415 #if L0043_TIMING_INFO416 377 TimingInfo *timingInfo = pcVUI->getTimingInfo(); 417 378 READ_FLAG( uiCode, "vui_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); … … 425 386 READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 426 387 } 427 #endif428 388 READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); 429 389 if( pcVUI->getHrdParametersPresentFlag() ) … … 431 391 parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); 432 392 } 433 #if L0043_TIMING_INFO 434 } 435 #endif 436 #if !L0043_TIMING_INFO 437 READ_FLAG( uiCode, "poc_proportional_to_timing_flag" ); pcVUI->setPocProportionalToTimingFlag(uiCode ? true : false); 438 if( pcVUI->getPocProportionalToTimingFlag() && pcVUI->getHrdParameters()->getTimingInfoPresentFlag() ) 439 { 440 READ_UVLC( uiCode, "num_ticks_poc_diff_one_minus1" ); pcVUI->setNumTicksPocDiffOneMinus1(uiCode); 441 } 442 #endif 393 } 443 394 READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode); 444 395 if (pcVUI->getBitstreamRestrictionFlag()) 445 396 { 446 397 READ_FLAG( uiCode, "tiles_fixed_structure_flag"); pcVUI->setTilesFixedStructureFlag(uiCode); 398 #if M0464_TILE_BOUNDARY_ALIGNED_FLAG 399 if ( pcSPS->getLayerId() > 0 ) 400 { 401 READ_FLAG( uiCode, "tile_boundaries_aligned_flag" ); pcVUI->setTileBoundariesAlignedFlag( uiCode == 1 ); 402 } 403 #endif 447 404 READ_FLAG( uiCode, "motion_vectors_over_pic_boundaries_flag"); pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode); 448 405 READ_FLAG( uiCode, "restricted_ref_pic_lists_flag"); pcVUI->setRestrictedRefPicListsFlag(uiCode); 449 #if L0043_MSS_IDC450 406 READ_UVLC( uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode); 451 407 assert(uiCode < 4096); 452 #else453 READ_CODE( 8, uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode);454 #endif455 408 READ_UVLC( uiCode, "max_bytes_per_pic_denom" ); pcVUI->setMaxBytesPerPicDenom(uiCode); 456 409 READ_UVLC( uiCode, "max_bits_per_mincu_denom" ); pcVUI->setMaxBitsPerMinCuDenom(uiCode); … … 465 418 if( commonInfPresentFlag ) 466 419 { 467 #if !L0043_TIMING_INFO468 READ_FLAG( uiCode, "timing_info_present_flag" ); hrd->setTimingInfoPresentFlag( uiCode == 1 ? true : false );469 if( hrd->getTimingInfoPresentFlag() )470 {471 READ_CODE( 32, uiCode, "num_units_in_tick" ); hrd->setNumUnitsInTick( uiCode );472 READ_CODE( 32, uiCode, "time_scale" ); hrd->setTimeScale( uiCode );473 }474 #endif475 420 READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false ); 476 421 READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false ); … … 483 428 READ_CODE( 5, uiCode, "du_cpb_removal_delay_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode ); 484 429 READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false ); 485 #if L0044_DU_DPB_OUTPUT_DELAY_HRD486 430 READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1" ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode ); 487 #endif488 431 } 489 432 READ_CODE( 4, uiCode, "bit_rate_scale" ); hrd->setBitRateScale( uiCode ); … … 510 453 hrd->setFixedPicRateWithinCvsFlag( i, true ); 511 454 } 512 #if L0372513 455 hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present 514 456 hrd->setCpbCntMinus1 ( i, 0 ); // Infered to be 0 when not present 515 #endif516 457 if( hrd->getFixedPicRateWithinCvsFlag( i ) ) 517 458 { 518 459 READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" ); hrd->setPicDurationInTcMinus1( i, uiCode ); 519 460 } 520 #if L0372521 461 else 522 { 462 { 523 463 READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false ); 524 464 } 525 465 if (!hrd->getLowDelayHrdFlag( i )) 526 466 { 527 READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); 528 } 529 #else 530 READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false ); 531 READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); 532 #endif 467 READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); 468 } 533 469 for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) 534 470 { … … 542 478 if( hrd->getSubPicCpbParamsPresentFlag() ) 543 479 { 544 #if L0363_DU_BIT_RATE 480 READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); 545 481 READ_UVLC( uiCode, "bit_rate_du_value_minus1" ); hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode ); 546 #endif547 READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );548 482 } 549 483 READ_FLAG( uiCode, "cbr_flag" ); hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false ); … … 554 488 } 555 489 490 #if SPS_SUB_LAYER_INFO 491 Void TDecCavlc::parseSPS(TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager) 492 #else 556 493 Void TDecCavlc::parseSPS(TComSPS* pcSPS) 557 { 558 #if ENC_DEC_TRACE 494 #endif 495 { 496 #if ENC_DEC_TRACE 559 497 xTraceSPSHeader (pcSPS); 560 498 #endif … … 562 500 UInt uiCode; 563 501 READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode ); 564 READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); 565 READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); 502 #if SPS_SUB_LAYER_INFO 503 if(pcSPS->getLayerId() == 0) 504 { 505 #endif 506 READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); 507 assert(uiCode <= 6); 508 509 READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); 510 #if SPS_SUB_LAYER_INFO 511 } 512 else 513 { 514 pcSPS->setMaxTLayers ( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId())->getMaxTLayers() ); 515 pcSPS->setTemporalIdNestingFlag( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId())->getTemporalNestingFlag() ); 516 } 517 #endif 566 518 if ( pcSPS->getMaxTLayers() == 1 ) 567 519 { 568 520 // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0 521 #if SPS_SUB_LAYER_INFO 522 assert( pcSPS->getTemporalIdNestingFlag() == true ); 523 #else 569 524 assert( uiCode == 1 ); 570 } 571 525 #endif 526 } 527 572 528 parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); 573 529 READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); 530 assert(uiCode <= 15); 531 574 532 READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( uiCode ); 533 assert(uiCode <= 3); 575 534 // in the first version we only support chroma_format_idc equal to 1 (4:2:0), so separate_colour_plane_flag cannot appear in the bitstream 576 535 assert (uiCode == 1); … … 593 552 594 553 READ_UVLC( uiCode, "bit_depth_luma_minus8" ); 554 assert(uiCode <= 6); 595 555 pcSPS->setBitDepthY( uiCode + 8 ); 596 556 pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); 597 557 598 558 READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); 559 assert(uiCode <= 6); 599 560 pcSPS->setBitDepthC( uiCode + 8 ); 600 561 pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); 601 562 602 563 READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); 564 assert(uiCode <= 12); 603 565 604 566 UInt subLayerOrderingInfoPresentFlag; 605 567 READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); 568 606 569 for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) 607 570 { 608 #if L0323_DPB609 571 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1"); 610 572 pcSPS->setMaxDecPicBuffering( uiCode + 1, i); 611 #else612 READ_UVLC ( uiCode, "sps_max_dec_pic_buffering");613 pcSPS->setMaxDecPicBuffering( uiCode, i);614 #endif615 573 READ_UVLC ( uiCode, "sps_num_reorder_pics" ); 616 574 pcSPS->setNumReorderPics(uiCode, i); 617 READ_UVLC ( uiCode, "sps_max_latency_increase ");575 READ_UVLC ( uiCode, "sps_max_latency_increase_plus1"); 618 576 pcSPS->setMaxLatencyIncrease( uiCode, i ); 619 577 … … 636 594 pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); 637 595 Int maxCUDepthDelta = uiCode; 638 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 596 pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 639 597 pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) ); 640 598 READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); … … 647 605 648 606 Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() ); 649 pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth ); 607 pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth ); 650 608 651 609 READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); … … 672 630 673 631 READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); 632 assert(uiCode <= 64); 674 633 pcSPS->createRPSList(uiCode); 675 634 … … 683 642 } 684 643 READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefsPresent(uiCode); 685 if (pcSPS->getLongTermRefsPresent()) 644 if (pcSPS->getLongTermRefsPresent()) 686 645 { 687 646 READ_UVLC( uiCode, "num_long_term_ref_pic_sps" ); … … 697 656 READ_FLAG( uiCode, "sps_temporal_mvp_enable_flag" ); pcSPS->setTMVPFlagsPresent(uiCode); 698 657 #if REF_IDX_MFM 658 #if !M0457_COL_PICTURE_SIGNALING 699 659 if(pcSPS->getLayerId() > 0) 700 660 { … … 703 663 } 704 664 #endif 665 #endif 705 666 READ_FLAG( uiCode, "sps_strong_intra_smoothing_enable_flag" ); pcSPS->setUseStrongIntraSmoothing(uiCode); 706 667 … … 711 672 parseVUI(pcSPS->getVuiParameters(), pcSPS); 712 673 } 713 714 #if SCALED_REF_LAYER_OFFSETS715 if( pcSPS->getLayerId() > 0 )716 {717 Int iCode;718 Window& scaledWindow = pcSPS->getScaledRefLayerWindow();719 READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1);720 READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1);721 READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1);722 READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1);723 }724 #endif725 674 726 675 READ_FLAG( uiCode, "sps_extension_flag"); 727 676 if (uiCode) 728 677 { 729 while ( xMoreRbspData() ) 730 { 731 READ_FLAG( uiCode, "sps_extension_data_flag"); 732 } 733 } 734 } 678 #if SPS_EXTENSION 679 parseSPSExtension( pcSPS ); 680 READ_FLAG( uiCode, "sps_extension2_flag"); 681 if(uiCode) 682 { 683 #endif 684 while ( xMoreRbspData() ) 685 { 686 READ_FLAG( uiCode, "sps_extension_data_flag"); 687 } 688 #if SPS_EXTENSION 689 } 690 #endif 691 } 692 } 693 694 #if SPS_EXTENSION 695 Void TDecCavlc::parseSPSExtension( TComSPS* pcSPS ) 696 { 697 UInt uiCode; 698 // more syntax elements to be parsed here 699 #if SCALED_REF_LAYER_OFFSETS 700 #if SCALED_REF_LAYER_OFFSET_FLAG 701 READ_FLAG( uiCode, "scaled_ref_layer_offset_present_flag" ); 702 if( uiCode ) 703 #else 704 if( pcSPS->getLayerId() > 0 ) 705 #endif 706 { 707 Int iCode; 708 READ_UVLC( uiCode, "num_scaled_ref_layer_offsets" ); pcSPS->setNumScaledRefLayerOffsets(uiCode); 709 for(Int i = 0; i < pcSPS->getNumScaledRefLayerOffsets(); i++) 710 { 711 Window& scaledWindow = pcSPS->getScaledRefLayerWindow(i); 712 READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); 713 READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); 714 READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); 715 READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); 716 } 717 } 718 #endif 719 #if M0463_VUI_EXT_ILP_REF 720 //// sps_extension_vui_parameters( ) 721 if( pcSPS->getVuiParameters()->getBitstreamRestrictionFlag() ) 722 { 723 READ_UVLC( uiCode, "num_ilp_restricted_ref_layers" ); pcSPS->setNumIlpRestrictedRefLayers( uiCode ); 724 for( Int i = 0; i < pcSPS->getNumIlpRestrictedRefLayers( ); i++ ) 725 { 726 READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); pcSPS->setMinSpatialSegmentOffsetPlus1( i, uiCode ); 727 if( pcSPS->getMinSpatialSegmentOffsetPlus1( i ) > 0 ) 728 { 729 READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[ i ]"); pcSPS->setCtuBasedOffsetEnabledFlag(i, uiCode == 1 ); 730 if( pcSPS->getCtuBasedOffsetEnabledFlag( i ) ) 731 { 732 READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[ i ]"); pcSPS->setMinHorizontalCtuOffsetPlus1( i, uiCode ); 733 } 734 } 735 } 736 } 737 //// sps_extension_vui_parameters( ) END 738 #endif 739 } 740 #endif 735 741 736 742 Void TDecCavlc::parseVPS(TComVPS* pcVPS) 737 743 { 738 744 UInt uiCode; 739 745 740 746 READ_CODE( 4, uiCode, "vps_video_parameter_set_id" ); pcVPS->setVPSId( uiCode ); 741 747 READ_CODE( 2, uiCode, "vps_reserved_three_2bits" ); assert(uiCode == 3); … … 750 756 READ_CODE( 16, uiCode, "vps_reserved_ffff_16bits" ); assert(uiCode == 0xffff); 751 757 parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1); 752 #if SIGNAL_BITRATE_PICRATE_IN_VPS753 parseBitratePicRateInfo( pcVPS->getBitratePicrateInfo(), 0, pcVPS->getMaxTLayers() - 1);754 #endif755 758 UInt subLayerOrderingInfoPresentFlag; 756 759 READ_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag"); 757 760 for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) 758 761 { 759 #if L0323_DPB760 762 READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); 761 #else762 READ_UVLC( uiCode, "vps_max_dec_pic_buffering[i]" ); pcVPS->setMaxDecPicBuffering( uiCode, i );763 #endif764 763 READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); 765 READ_UVLC( uiCode, "vps_max_latency_increase [i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i );764 READ_UVLC( uiCode, "vps_max_latency_increase_plus1[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); 766 765 767 766 if (!subLayerOrderingInfoPresentFlag) … … 803 802 pcVPS->deriveLayerIdListVariables(); 804 803 #endif 805 #if L0043_TIMING_INFO806 804 TimingInfo *timingInfo = pcVPS->getTimingInfo(); 807 805 READ_FLAG( uiCode, "vps_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); … … 815 813 READ_UVLC( uiCode, "vps_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); 816 814 } 817 #endif818 815 READ_UVLC( uiCode, "vps_num_hrd_parameters" ); pcVPS->setNumHrdParameters( uiCode ); 819 816 … … 831 828 parseHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); 832 829 } 833 #if L0043_TIMING_INFO 834 } 835 #endif 830 } 836 831 READ_FLAG( uiCode, "vps_extension_flag" ); 837 832 if (uiCode) … … 854 849 #endif 855 850 } 856 851 857 852 return; 858 853 } … … 860 855 #if VPS_EXTNS 861 856 Void TDecCavlc::parseVPSExtension(TComVPS *vps) 862 { 857 { 863 858 UInt uiCode; 864 859 // ... More syntax elements to be parsed here … … 873 868 READ_FLAG( uiCode, "scalability_mask[i]" ); vps->setScalabilityMask(i, uiCode ? true : false); 874 869 numScalabilityTypes += uiCode; 875 if( i != 1 )876 {877 // Multiview and reserved masks are not used in this version of software878 assert( uiCode == 0 );879 }880 870 } 881 871 vps->setNumScalabilityTypes(numScalabilityTypes); 882 872 873 #if VPS_SPLIT_FLAG 874 for(j = 0; j < numScalabilityTypes - vps->getSplittingFlag(); j++) 875 #else 883 876 for(j = 0; j < numScalabilityTypes; j++) 877 #endif 884 878 { 885 879 READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" ); vps->setDimensionIdLen(j, uiCode + 1); 886 880 } 881 #if VPS_SPLIT_FLAG 882 if(vps->getSplittingFlag()) 883 { 884 UInt numBits = 0; 885 for(j = 0; j < numScalabilityTypes - 1; j++) 886 { 887 numBits += vps->getDimensionIdLen(j); 888 } 889 assert( numBits < 6 ); 890 vps->setDimensionIdLen(numScalabilityTypes-1, 6 - numBits); 891 numBits = 6; 892 } 893 #else 887 894 if(vps->getSplittingFlag()) 888 895 { … … 894 901 assert( numBits <= 6 ); 895 902 } 903 #endif 896 904 897 905 READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" ); vps->setNuhLayerIdPresentFlag(uiCode ? true : false); … … 911 919 vps->setLayerIdInVps(vps->getLayerIdInNuh(i), i); 912 920 921 #if VPS_SPLIT_FLAG 922 if(!vps->getSplittingFlag()) 923 #endif 913 924 for(j = 0; j < numScalabilityTypes; j++) 914 925 { … … 939 950 #endif 940 951 #endif 941 952 #if JCTVC_M0203_INTERLAYER_PRED_IDC 953 for(i = 0; i < vps->getMaxLayers() - 1; i++) 954 { 955 READ_CODE( 3, uiCode, "max_sublayer_for_ilp_plus1[i]" ); vps->setMaxSublayerForIlpPlus1(i, uiCode); 956 assert( uiCode <= vps->getMaxTLayers() ); 957 } 958 #endif 942 959 #if VPS_EXTN_PROFILE_INFO 943 960 // Profile-tier-level signalling … … 961 978 #endif 962 979 assert( vps->getProfileLayerSetRef(idx) < idx ); 963 // Copy profile information as indicated 980 // Copy profile information as indicated 964 981 vps->getPTLForExtn(idx)->copyProfileInfo( vps->getPTLForExtn( vps->getProfileLayerSetRef(idx) ) ); 965 } 982 } 966 983 parsePTL( vps->getPTLForExtn(idx), vps->getProfilePresentFlag(idx), vps->getMaxTLayers() - 1 ); 967 984 } … … 1048 1065 } 1049 1066 } 1050 } 1067 } 1051 1068 #endif 1052 1069 #endif 1053 1070 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1054 1071 READ_FLAG(uiCode, "max_one_active_ref_layer_flag" ); 1055 vps->setMaxOneActiveRefLayerFlag(uiCode); 1056 #endif 1072 vps->setMaxOneActiveRefLayerFlag(uiCode); 1073 #endif 1057 1074 1058 1075 #if !VPS_MOVE_DIR_DEPENDENCY_FLAG … … 1077 1094 #endif 1078 1095 #endif 1096 #if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS 1097 READ_UVLC( uiCode, "direct_dep_type_len_minus2"); vps->setDirectDepTypeLen(uiCode+2); 1098 for(i = 1; i < vps->getMaxLayers(); i++) 1099 { 1100 for(j = 0; j < i; j++) 1101 { 1102 if (vps->getDirectDependencyFlag(i, j)) 1103 { 1104 READ_CODE( vps->getDirectDepTypeLen(), uiCode, "direct_dependency_type[i][j]" ); vps->setDirectDependencyType(i, j, uiCode); 1105 } 1106 } 1107 } 1108 #endif 1109 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 1110 READ_FLAG(uiCode, "single_layer_for_non_irap_flag" ); vps->setSingleLayerForNonIrapFlag(uiCode == 1 ? true : false); 1111 #endif 1079 1112 } 1080 1113 #endif … … 1094 1127 READ_FLAG( firstSliceSegmentInPic, "first_slice_segment_in_pic_flag" ); 1095 1128 if( rpcSlice->getRapPicFlag()) 1096 { 1129 { 1097 1130 READ_FLAG( uiCode, "no_output_of_prior_pics_flag" ); //ignored 1098 1131 } … … 1145 1178 rpcSlice->setSliceCurEndCUAddr(numCTUs*maxParts); 1146 1179 } 1147 1180 1148 1181 if(!rpcSlice->getDependentSliceSegmentFlag()) 1149 1182 { 1183 1184 #if SH_DISCARDABLE_FLAG 1185 if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits()>0) 1186 { 1187 READ_FLAG(uiCode, "discardable_flag"); // ignored 1188 } 1189 for (Int i = 1; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) 1190 { 1191 READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored 1192 } 1193 #else 1150 1194 for (Int i = 0; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) 1151 1195 { 1152 1196 READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored 1153 1197 } 1198 #endif 1154 1199 1155 1200 READ_UVLC ( uiCode, "slice_type" ); rpcSlice->setSliceType((SliceType)uiCode); … … 1179 1224 else 1180 1225 { 1181 READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb"); 1226 READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb"); 1182 1227 Int iPOClsb = uiCode; 1183 1228 Int iPrevPOC = rpcSlice->getPrevPOC(); … … 1190 1235 iPOCmsb = iPrevPOCmsb + iMaxPOClsb; 1191 1236 } 1192 else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) ) 1237 else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) ) 1193 1238 { 1194 1239 iPOCmsb = iPrevPOCmsb - iMaxPOClsb; … … 1230 1275 uiCode = 0; 1231 1276 } 1232 memcpy(rps,sps->getRPSList()->getReferencePictureSet(uiCode),sizeof(TComReferencePictureSet));1277 *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); 1233 1278 } 1234 1279 if(sps->getLongTermRefsPresent()) … … 1276 1321 READ_FLAG(uiCode,"delta_poc_msb_present_flag"); 1277 1322 Bool mSBPresentFlag = uiCode ? true : false; 1278 if(mSBPresentFlag) 1323 if(mSBPresentFlag) 1279 1324 { 1280 1325 READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); … … 1291 1336 else 1292 1337 { 1293 deltaPocMSBCycleLT = uiCode + prevDeltaMSB; 1338 deltaPocMSBCycleLT = uiCode + prevDeltaMSB; 1294 1339 } 1295 1340 1296 Int pocLTCurr = rpcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB 1341 Int pocLTCurr = rpcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB 1297 1342 - iPOClsb + pocLsbLt; 1298 rps->setPOC (j, pocLTCurr); 1343 rps->setPOC (j, pocLTCurr); 1299 1344 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLTCurr); 1300 rps->setCheckLTMSBPresent(j,true); 1345 rps->setCheckLTMSBPresent(j,true); 1301 1346 } 1302 1347 else … … 1304 1349 rps->setPOC (j, pocLsbLt); 1305 1350 rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt); 1306 rps->setCheckLTMSBPresent(j,false); 1351 rps->setCheckLTMSBPresent(j,false); 1307 1352 } 1308 1353 prevDeltaMSB = deltaPocMSBCycleLT; 1309 1354 } 1310 1355 offset += rps->getNumberOfLongtermPictures(); 1311 rps->setNumberOfPictures(offset); 1312 } 1356 rps->setNumberOfPictures(offset); 1357 } 1313 1358 if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP 1314 1359 || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL … … 1323 1368 rpcSlice->setRPS(rps); 1324 1369 } 1325 1326 1327 1370 if (rpcSlice->getSPS()->getTMVPFlagsPresent()) 1328 1371 { 1329 1372 READ_FLAG( uiCode, "slice_temporal_mvp_enable_flag" ); 1330 rpcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); 1373 rpcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); 1331 1374 } 1332 1375 else … … 1337 1380 1338 1381 #if REF_IDX_FRAMEWORK 1339 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1382 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1340 1383 rpcSlice->setActiveNumILRRefIdx(0); 1341 if((sps->getLayerId() > 0) && (rpcSlice->getNumILRRefIdx() > 0) ) 1342 { 1384 if((sps->getLayerId() > 0) && (rpcSlice->getNumILRRefIdx() > 0) ) 1385 { 1343 1386 READ_FLAG(uiCode,"inter_layer_pred_enabled_flag"); 1344 1387 rpcSlice->setInterLayerPredEnabledFlag(uiCode); 1345 1388 if( rpcSlice->getInterLayerPredEnabledFlag()) 1346 1389 { 1347 if(rpcSlice->getNumILRRefIdx() > 1) 1390 if(rpcSlice->getNumILRRefIdx() > 1) 1348 1391 { 1349 1392 Int numBits = 1; … … 1352 1395 numBits++; 1353 1396 } 1354 if( !rpcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) 1397 if( !rpcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) 1355 1398 { 1356 1399 READ_CODE( numBits, uiCode,"num_inter_layer_ref_pics_minus1" ); 1357 rpcSlice->setActiveNumILRRefIdx(uiCode + 1); 1400 rpcSlice->setActiveNumILRRefIdx(uiCode + 1); 1358 1401 } 1359 1402 else 1360 1403 { 1361 rpcSlice->setActiveNumILRRefIdx(1); 1404 rpcSlice->setActiveNumILRRefIdx(1); 1362 1405 } 1363 for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 1406 for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) 1364 1407 { 1365 READ_CODE( numBits,uiCode,"inter_layer_pred_layer_idc[i]" ); 1366 rpcSlice->setInterLayerPredLayerIdc(uiCode,i); 1408 READ_CODE( numBits,uiCode,"inter_layer_pred_layer_idc[i]" ); 1409 rpcSlice->setInterLayerPredLayerIdc(uiCode,i); 1367 1410 } 1368 1411 } 1369 1412 else 1370 1413 { 1371 rpcSlice->setActiveNumILRRefIdx(1); 1372 rpcSlice->setInterLayerPredLayerIdc(0,0); 1373 } 1374 } 1375 } 1414 rpcSlice->setActiveNumILRRefIdx(1); 1415 rpcSlice->setInterLayerPredLayerIdc(0,0); 1416 } 1417 } 1418 } 1419 #if M0457_IL_SAMPLE_PRED_ONLY_FLAG 1420 rpcSlice->setInterLayerSamplePredOnlyFlag( false ); 1421 if( rpcSlice->getNumSamplePredRefLayers() > 0 && rpcSlice->getActiveNumILRRefIdx() > 0 ) 1422 { 1423 READ_FLAG( uiCode, "inter_layer_sample_pred_only_flag" ); 1424 rpcSlice->setInterLayerSamplePredOnlyFlag( uiCode > 0 ); 1425 } 1426 #endif 1376 1427 #else 1377 1428 if( rpcSlice->getLayerId() > 0 ) … … 1443 1494 Int length = 1; 1444 1495 numRpsCurrTempList0 --; 1445 while ( numRpsCurrTempList0 >>= 1) 1496 while ( numRpsCurrTempList0 >>= 1) 1446 1497 { 1447 1498 length ++; … … 1485 1536 Int length = 1; 1486 1537 numRpsCurrTempList1 --; 1487 while ( numRpsCurrTempList1 >>= 1) 1538 while ( numRpsCurrTempList1 >>= 1) 1488 1539 { 1489 1540 length ++; … … 1503 1554 } 1504 1555 } 1505 } 1556 } 1506 1557 else 1507 1558 { … … 1522 1573 if ( rpcSlice->getEnableTMVPFlag() ) 1523 1574 { 1575 #if REF_IDX_FRAMEWORK && M0457_COL_PICTURE_SIGNALING 1576 rpcSlice->setMFMEnabledFlag( false ); 1577 rpcSlice->setColRefLayerIdx( 0 ); 1578 rpcSlice->setAltColIndicationFlag( false ); 1579 if ( sps->getLayerId() > 0 && rpcSlice->getActiveNumILRRefIdx() > 0 && rpcSlice->getNumMotionPredRefLayers() > 0 ) 1580 { 1581 READ_FLAG( uiCode, "alt_collocated_indication_flag" ); 1582 rpcSlice->setAltColIndicationFlag( uiCode == 1 ? true : false ); 1583 rpcSlice->setMFMEnabledFlag( uiCode == 1 ? true : false ); 1584 if ( rpcSlice->getNumMotionPredRefLayers() > 1 ) 1585 { 1586 READ_UVLC( uiCode, "collocated_ref_layer_idx" ); 1587 rpcSlice->setColRefLayerIdx( uiCode ); 1588 } 1589 } 1590 else 1591 { 1592 #endif 1524 1593 if ( rpcSlice->getSliceType() == B_SLICE ) 1525 1594 { … … 1543 1612 rpcSlice->setColRefIdx(0); 1544 1613 } 1614 #if REF_IDX_FRAMEWORK && M0457_COL_PICTURE_SIGNALING 1615 } 1616 #endif 1545 1617 } 1546 1618 if ( (pps->getUseWP() && rpcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && rpcSlice->getSliceType()==B_SLICE) ) … … 1585 1657 } 1586 1658 else 1587 { 1659 { 1588 1660 rpcSlice->setDeblockingFilterOverrideFlag(0); 1589 1661 } … … 1609 1681 } 1610 1682 else 1611 { 1683 { 1612 1684 rpcSlice->setDeblockingFilterDisable ( false ); 1613 1685 rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); … … 1629 1701 1630 1702 } 1631 1703 1632 1704 UInt *entryPointOffset = NULL; 1633 1705 UInt numEntryPointOffsets, offsetLenMinus1; … … 1642 1714 for (UInt idx=0; idx<numEntryPointOffsets; idx++) 1643 1715 { 1644 #if L0116_ENTRY_POINT1645 1716 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); 1646 1717 entryPointOffset[ idx ] = uiCode + 1; 1647 #else1648 READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset");1649 entryPointOffset[ idx ] = uiCode;1650 #endif1651 1718 } 1652 1719 } … … 1670 1737 { 1671 1738 Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); 1739 1740 // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header 1741 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 1742 { 1743 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation ) 1744 { 1745 endOfSliceHeaderLocation++; 1746 } 1747 } 1748 1672 1749 Int curEntryPointOffset = 0; 1673 1750 Int prevEntryPointOffset = 0; … … 1679 1756 for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) 1680 1757 { 1681 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 1758 if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && 1682 1759 m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) 1683 1760 { … … 1727 1804 return; 1728 1805 } 1729 1806 1730 1807 Void TDecCavlc::parsePTL( TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1 ) 1731 1808 { … … 1737 1814 READ_CODE( 8, uiCode, "general_level_idc" ); rpcPTL->getGeneralPTL()->setLevelIdc(uiCode); 1738 1815 1739 #if L0363_BYTE_ALIGN1740 1816 for (Int i = 0; i < maxNumSubLayersMinus1; i++) 1741 1817 { … … 1746 1822 READ_FLAG( uiCode, "sub_layer_level_present_flag[i]" ); rpcPTL->setSubLayerLevelPresentFlag (i, uiCode); 1747 1823 } 1748 1824 1749 1825 if (maxNumSubLayersMinus1 > 0) 1750 1826 { … … 1755 1831 } 1756 1832 } 1757 #endif 1758 1833 1759 1834 for(Int i = 0; i < maxNumSubLayersMinus1; i++) 1760 1835 { 1761 #if !L0363_BYTE_ALIGN1762 if(profilePresentFlag)1763 {1764 READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode);1765 }1766 READ_FLAG( uiCode, "sub_layer_level_present_flag[i]" ); rpcPTL->setSubLayerLevelPresentFlag (i, uiCode);1767 #endif1768 1836 if( profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) ) 1769 1837 { … … 1787 1855 READ_FLAG( uiCode, "XXX_profile_compatibility_flag[][j]"); ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0); 1788 1856 } 1789 #if L0046_CONSTRAINT_FLAGS1790 1857 READ_FLAG(uiCode, "general_progressive_source_flag"); 1791 1858 ptl->setProgressiveSourceFlag(uiCode ? true : false); … … 1793 1860 READ_FLAG(uiCode, "general_interlaced_source_flag"); 1794 1861 ptl->setInterlacedSourceFlag(uiCode ? true : false); 1795 1862 1796 1863 READ_FLAG(uiCode, "general_non_packed_constraint_flag"); 1797 1864 ptl->setNonPackedConstraintFlag(uiCode ? true : false); 1798 1865 1799 1866 READ_FLAG(uiCode, "general_frame_only_constraint_flag"); 1800 1867 ptl->setFrameOnlyConstraintFlag(uiCode ? true : false); 1801 1868 1802 1869 READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[0..15]"); 1803 1870 READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[16..31]"); 1804 1871 READ_CODE(12, uiCode, "XXX_reserved_zero_44bits[32..43]"); 1805 #elif L0363_MORE_BITS 1806 READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[0..15]"); 1807 READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[16..31]"); 1808 READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[32..47]"); 1809 #else 1810 READ_CODE(16, uiCode, "XXX_reserved_zero_16bits[]"); assert( uiCode == 0 ); 1811 #endif 1812 } 1813 #if SIGNAL_BITRATE_PICRATE_IN_VPS 1814 Void TDecCavlc::parseBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh) 1815 { 1816 UInt uiCode; 1817 for(Int i = tempLevelLow; i <= tempLevelHigh; i++) 1818 { 1819 READ_FLAG( uiCode, "bit_rate_info_present_flag[i]" ); info->setBitRateInfoPresentFlag(i, uiCode ? true : false); 1820 READ_FLAG( uiCode, "pic_rate_info_present_flag[i]" ); info->setPicRateInfoPresentFlag(i, uiCode ? true : false); 1821 if(info->getBitRateInfoPresentFlag(i)) 1822 { 1823 READ_CODE( 16, uiCode, "avg_bit_rate[i]" ); info->setAvgBitRate(i, uiCode); 1824 READ_CODE( 16, uiCode, "max_bit_rate[i]" ); info->setMaxBitRate(i, uiCode); 1825 } 1826 if(info->getPicRateInfoPresentFlag(i)) 1827 { 1828 READ_CODE( 2, uiCode, "constant_pic_rate_idc[i]" ); info->setConstantPicRateIdc(i, uiCode); 1829 READ_CODE( 16, uiCode, "avg_pic_rate[i]" ); info->setAvgPicRate(i, uiCode); 1830 } 1831 } 1832 } 1833 #endif 1872 } 1873 1834 1874 Void TDecCavlc::parseTerminatingBit( UInt& ruiBit ) 1835 1875 { … … 1876 1916 } 1877 1917 1878 /** Parse I_PCM information. 1918 /** Parse I_PCM information. 1879 1919 * \param pcCU pointer to CU 1880 1920 * \param uiAbsPartIdx CU index … … 1882 1922 * \returns Void 1883 1923 * 1884 * If I_PCM flag indicates that the CU is I_PCM, parse its PCM alignment bits and codes. 1924 * If I_PCM flag indicates that the CU is I_PCM, parse its PCM alignment bits and codes. 1885 1925 */ 1886 1926 Void TDecCavlc::parseIPCMInfo( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) … … 1890 1930 1891 1931 Void TDecCavlc::parseIntraDirLumaAng ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) 1892 { 1932 { 1893 1933 assert(0); 1894 1934 } … … 1981 2021 UInt uiLog2WeightDenomLuma, uiLog2WeightDenomChroma; 1982 2022 UInt uiTotalSignalledWeightFlags = 0; 1983 2023 1984 2024 Int iDeltaDenom; 1985 2025 // decode delta_luma_log2_weight_denom : 1986 2026 READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom 1987 2027 assert( uiLog2WeightDenomLuma <= 7 ); 1988 if( bChroma ) 2028 if( bChroma ) 1989 2029 { 1990 2030 READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom … … 1994 2034 } 1995 2035 1996 for ( Int iNumRef=0 ; iNumRef<iNbRef ; iNumRef++ ) 2036 for ( Int iNumRef=0 ; iNumRef<iNbRef ; iNumRef++ ) 1997 2037 { 1998 2038 RefPicList eRefPicList = ( iNumRef ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); 1999 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 2039 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 2000 2040 { 2001 2041 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); … … 2010 2050 uiTotalSignalledWeightFlags += wp[0].bPresentFlag; 2011 2051 } 2012 if ( bChroma ) 2052 if ( bChroma ) 2013 2053 { 2014 2054 UInt uiCode; 2015 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 2055 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 2016 2056 { 2017 2057 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); … … 2022 2062 } 2023 2063 } 2024 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 2064 for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) 2025 2065 { 2026 2066 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); 2027 if ( wp[0].bPresentFlag ) 2067 if ( wp[0].bPresentFlag ) 2028 2068 { 2029 2069 Int iDeltaWeight; … … 2036 2076 assert( wp[0].iOffset <= 127 ); 2037 2077 } 2038 else 2078 else 2039 2079 { 2040 2080 wp[0].iWeight = (1 << wp[0].uiLog2WeightDenom); 2041 2081 wp[0].iOffset = 0; 2042 2082 } 2043 if ( bChroma ) 2044 { 2045 if ( wp[1].bPresentFlag ) 2046 { 2047 for ( Int j=1 ; j<3 ; j++ ) 2083 if ( bChroma ) 2084 { 2085 if ( wp[1].bPresentFlag ) 2086 { 2087 for ( Int j=1 ; j<3 ; j++ ) 2048 2088 { 2049 2089 Int iDeltaWeight; … … 2061 2101 } 2062 2102 } 2063 else 2064 { 2065 for ( Int j=1 ; j<3 ; j++ ) 2103 else 2104 { 2105 for ( Int j=1 ; j<3 ; j++ ) 2066 2106 { 2067 2107 wp[j].iWeight = (1 << wp[j].uiLog2WeightDenom); … … 2072 2112 } 2073 2113 2074 for ( Int iRefIdx=pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 2114 for ( Int iRefIdx=pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 2075 2115 { 2076 2116 pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); … … 2148 2188 2149 2189 Bool TDecCavlc::xMoreRbspData() 2150 { 2190 { 2151 2191 Int bitsLeft = m_pcBitstream->getNumBitsLeft(); 2152 2192 -
trunk/source/Lib/TLibDecoder/TDecCAVLC.h
r191 r310 75 75 Void parseVPSExtension ( TComVPS* pcVPS ); 76 76 #endif 77 #if SPS_SUB_LAYER_INFO 78 Void parseSPS ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager ); 79 #else 77 80 Void parseSPS ( TComSPS* pcSPS ); 81 #endif 82 #if SPS_EXTENSION 83 Void parseSPSExtension ( TComSPS* pcSPS ); 84 #endif 78 85 Void parsePPS ( TComPPS* pcPPS); 79 86 Void parseVUI ( TComVUI* pcVUI, TComSPS* pcSPS ); … … 81 88 Void parsePTL ( TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1 ); 82 89 Void parseProfileTier (ProfileTierLevel *ptl); 83 #if SIGNAL_BITRATE_PICRATE_IN_VPS84 Void parseBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh);85 #endif86 90 Void parseHrdParameters (TComHRD *hrd, Bool cprms_present_flag, UInt tempLevelHigh); 87 91 Void parseSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager); -
trunk/source/Lib/TLibDecoder/TDecCu.cpp
r191 r310 935 935 TDecCu::xReconIntraBL( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) 936 936 { 937 m_ppcYuvReco[uiDepth]->copyFromPicLuma ( pcCU->getSlice()->getFullPelBaseRec( ), pcCU->getAddr(), pcCU->getZorderIdxInCU(), 0, pcCU->getWidth(0), pcCU->getHeight(0));938 m_ppcYuvReco[uiDepth]->copyFromPicChroma( pcCU->getSlice()->getFullPelBaseRec( ), pcCU->getAddr(), pcCU->getZorderIdxInCU(), 0, (pcCU->getWidth(0)>>1), (pcCU->getHeight(0)>>1), 0);939 m_ppcYuvReco[uiDepth]->copyFromPicChroma( pcCU->getSlice()->getFullPelBaseRec( ), pcCU->getAddr(), pcCU->getZorderIdxInCU(), 0, (pcCU->getWidth(0)>>1), (pcCU->getHeight(0)>>1), 1);937 m_ppcYuvReco[uiDepth]->copyFromPicLuma ( pcCU->getSlice()->getFullPelBaseRec(m_layerId - 1), pcCU->getAddr(), pcCU->getZorderIdxInCU(), 0, pcCU->getWidth(0), pcCU->getHeight(0)); 938 m_ppcYuvReco[uiDepth]->copyFromPicChroma( pcCU->getSlice()->getFullPelBaseRec(m_layerId - 1), pcCU->getAddr(), pcCU->getZorderIdxInCU(), 0, (pcCU->getWidth(0)>>1), (pcCU->getHeight(0)>>1), 0); 939 m_ppcYuvReco[uiDepth]->copyFromPicChroma( pcCU->getSlice()->getFullPelBaseRec(m_layerId - 1), pcCU->getAddr(), pcCU->getZorderIdxInCU(), 0, (pcCU->getWidth(0)>>1), (pcCU->getHeight(0)>>1), 1); 940 940 941 941 // inter recon -
trunk/source/Lib/TLibDecoder/TDecEntropy.cpp
r191 r310 188 188 decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth ); 189 189 UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); 190 #if 0 //REF_IDX_FRAMEWORK // HM bug fix191 if(uiPartIdx)192 {193 for(UInt ui=0; ui<uiMergeIndex+1; ui++)194 {195 cMvFieldNeighbours[(ui<<1)].setMvField(TComMv(), NOT_VALID);196 cMvFieldNeighbours[(ui<<1)+1].setMvField(TComMv(), NOT_VALID);197 }198 }199 #endif200 190 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) 201 191 { -
trunk/source/Lib/TLibDecoder/TDecEntropy.h
r191 r310 66 66 67 67 virtual Void parseVPS ( TComVPS* pcVPS ) = 0; 68 #if SPS_SUB_LAYER_INFO 69 virtual Void parseSPS ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager ) = 0; 70 #else 68 71 virtual Void parseSPS ( TComSPS* pcSPS ) = 0; 72 #endif 69 73 virtual Void parsePPS ( TComPPS* pcPPS ) = 0; 70 74 … … 134 138 Void resetEntropy ( TComSlice* p) { m_pcEntropyDecoderIf->resetEntropy(p); } 135 139 Void decodeVPS ( TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parseVPS(pcVPS); } 140 #if SPS_SUB_LAYER_INFO 141 Void decodeSPS ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager ) { m_pcEntropyDecoderIf->parseSPS(pcSPS, parameterSetManager); } 142 #else 136 143 Void decodeSPS ( TComSPS* pcSPS ) { m_pcEntropyDecoderIf->parseSPS(pcSPS); } 144 #endif 137 145 Void decodePPS ( TComPPS* pcPPS ) { m_pcEntropyDecoderIf->parsePPS(pcPPS); } 138 146 Void decodeSliceHeader ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager) { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager); } -
trunk/source/Lib/TLibDecoder/TDecGop.cpp
r191 r310 247 247 for (Int iRefIndex = 0; iRefIndex < pcSlice->getNumRefIdx(RefPicList(iRefList)); iRefIndex++) 248 248 { 249 #if REF_IDX_FRAMEWORK && VPS_EXTN_DIRECT_REF_LAYERS _CONTINUE249 #if REF_IDX_FRAMEWORK && VPS_EXTN_DIRECT_REF_LAYERS 250 250 if( pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->isILR( m_layerId ) ) 251 251 { -
trunk/source/Lib/TLibDecoder/TDecSbac.cpp
r191 r310 158 158 UInt uiBit; 159 159 m_pcTDecBinIf->decodeBinTrm(uiBit); 160 assert(uiBit); // end_of_sub_stream_one_bit must be equal to 1 160 161 m_pcTDecBinIf->finish(); 161 162 m_pcBitstream->readOutTrailingBits(); … … 196 197 { 197 198 m_pcTDecBinIf->decodeBinTrm( ruiBit ); 199 if ( ruiBit ) 200 { 201 m_pcTDecBinIf->finish(); 202 } 198 203 } 199 204 … … 318 323 { 319 324 UInt uiSymbol; 320 Bool readPCMSampleFlag = false;321 325 322 326 m_pcTDecBinIf->decodeBinTrm(uiSymbol); … … 324 328 if (uiSymbol) 325 329 { 326 readPCMSampleFlag = true;327 m_pcTDecBinIf->decodePCMAlignBits();328 }329 330 if (readPCMSampleFlag == true)331 {332 330 Bool bIpcmFlag = true; 333 331 … … 395 393 } 396 394 397 m_pcTDecBinIf->resetBac();395 m_pcTDecBinIf->start(); 398 396 } 399 397 } … … 681 679 else 682 680 { 683 intraPredMode = 0;684 681 m_pcTDecBinIf->decodeBinsEP( symbol, 5 ); 685 682 intraPredMode = symbol; … … 917 914 else 918 915 { 919 iDQp=0;920 916 qp = pcCU->getRefQP(uiAbsPartIdx); 921 917 } … … 1102 1098 1103 1099 //===== decode significance flags ===== 1104 UInt uiScanPosLast = uiBlkPosLast;1100 UInt uiScanPosLast; 1105 1101 const UInt *scan = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize-1 ]; 1106 1102 for( uiScanPosLast = 0; uiScanPosLast < uiMaxNumCoeffM1; uiScanPosLast++ ) -
trunk/source/Lib/TLibDecoder/TDecSbac.h
r191 r310 76 76 Void setBitstream ( TComInputBitstream* p ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); } 77 77 Void parseVPS ( TComVPS* /*pcVPS*/ ) {} 78 #if SPS_SUB_LAYER_INFO 79 Void parseSPS ( TComSPS* /*pcSPS*/, ParameterSetManagerDecoder * /*parameterSetManager*/ ) {} 80 #else 78 81 Void parseSPS ( TComSPS* /*pcSPS*/ ) {} 82 #endif 79 83 Void parsePPS ( TComPPS* /*pcPPS*/ ) {} 80 84 -
trunk/source/Lib/TLibDecoder/TDecSlice.cpp
r191 r310 198 198 Int iNumSubstreamsPerTile = 1; // if independent. 199 199 #if INTRA_BL 200 m_pcCuDecoder->setBaseRecPic( rpcPic->getLayerId() > 0 ? rpcPic->getFullPelBaseRec( ) : NULL);200 m_pcCuDecoder->setBaseRecPic( rpcPic->getLayerId() > 0 ? rpcPic->getFullPelBaseRec(rpcPic->getLayerId()-1) : NULL); 201 201 #endif 202 202 Bool depSliceSegmentsEnabled = rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getPPS()->getDependentSliceSegmentsEnabledFlag(); … … 384 384 pcSbacDecoders[uiSubStrm].load(pcSbacDecoder); 385 385 386 if ( uiCol == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getRightEdgePosInCU() 387 && pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag() 388 && !uiIsLast ) 389 { 390 // Parse end_of_substream_one_bit for WPP case 391 UInt binVal; 392 pcSbacDecoder->parseTerminatingBit( binVal ); 393 assert( binVal ); 394 } 395 386 396 //Store probabilities of second LCU in line into buffer 387 397 if ( (uiCol == uiTileLCUX+1)&& (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && (pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) ) -
trunk/source/Lib/TLibDecoder/TDecTop.cpp
r229 r310 160 160 if (m_cIlpPic[0] == NULL) 161 161 { 162 for (Int j=0; j < 1/*MAX_NUM_REF*/; j++) // to beset to NumDirectRefLayers[LayerIdInVps[nuh_layer_id]]162 for (Int j=0; j < MAX_LAYERS /*MAX_NUM_REF*/; j++) // consider to set to NumDirectRefLayers[LayerIdInVps[nuh_layer_id]] 163 163 { 164 164 … … 180 180 Void TDecTop::setILRPic(TComPic *pcPic) 181 181 { 182 if(m_cIlpPic[0]) 183 { 184 m_cIlpPic[0]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(), m_cIlpPic[0]->getPicYuvRec()); 185 m_cIlpPic[0]->getSlice(0)->setPOC(pcPic->getPOC()); 186 m_cIlpPic[0]->setLayerId(pcPic->getSlice(0)->getBaseColPic()->getLayerId()); //set reference layerId 187 m_cIlpPic[0]->getPicYuvRec()->setBorderExtension(false); 188 m_cIlpPic[0]->getPicYuvRec()->extendPicBorder(); 182 for( Int i = 0; i < pcPic->getSlice(0)->getActiveNumILRRefIdx(); i++ ) 183 { 184 Int refLayerIdc = pcPic->getSlice(0)->getInterLayerPredLayerIdc(i); 185 186 if(m_cIlpPic[refLayerIdc]) 187 { 188 m_cIlpPic[refLayerIdc]->copyUpsampledPictureYuv(pcPic->getFullPelBaseRec(refLayerIdc), m_cIlpPic[refLayerIdc]->getPicYuvRec()); 189 m_cIlpPic[refLayerIdc]->getSlice(0)->setPOC(pcPic->getPOC()); 190 m_cIlpPic[refLayerIdc]->setLayerId(pcPic->getSlice(0)->getBaseColPic(refLayerIdc)->getLayerId()); //set reference layerId 191 m_cIlpPic[refLayerIdc]->getPicYuvRec()->setBorderExtension(false); 192 m_cIlpPic[refLayerIdc]->getPicYuvRec()->extendPicBorder(); 193 } 189 194 } 190 195 } … … 236 241 } 237 242 238 #if L0323_DPB 239 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 240 #else 241 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded 242 #endif 243 m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer()); // m_uiMaxDecPicBuffering has the space for the picture currently being decoded 243 244 if (m_cListPic.size() < (UInt)m_iMaxRefPicNum) 244 245 { … … 248 249 if(m_layerId > 0) 249 250 { 250 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 251 TDecTop *pcTDecTopBase = (TDecTop *)getRefLayerDec( m_layerId ); 252 #else 253 TDecTop *pcTDecTopBase = (TDecTop *)getLayerDec( m_layerId-1 ); 254 #endif 255 //TComPic* pcPic = *(pcTDecTopBase->getListPic()->begin()); 256 TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec(); 257 if(pcPicYuvRecBase->getWidth() != pcSlice->getSPS()->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getSPS()->getPicHeightInLumaSamples() ) 258 { 259 rpcPic->setSpatialEnhLayerFlag( true ); 251 for(UInt i = 0; i < pcSlice->getVPS()->getNumDirectRefLayers( m_layerId ); i++ ) 252 { 253 const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(i); 254 Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 ); 255 256 #if VPS_EXTN_DIRECT_REF_LAYERS 257 TDecTop *pcTDecTopBase = (TDecTop *)getRefLayerDec( i ); 258 #else 259 TDecTop *pcTDecTopBase = (TDecTop *)getLayerDec( m_layerId-1 ); 260 #endif 261 //TComPic* pcPic = *(pcTDecTopBase->getListPic()->begin()); 262 TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec(); 263 if(pcPicYuvRecBase->getWidth() != pcSlice->getSPS()->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getSPS()->getPicHeightInLumaSamples() || !zeroOffsets ) 264 { 265 rpcPic->setSpatialEnhLayerFlag( i, true ); 266 267 //only for scalable extension 268 assert( pcSlice->getVPS()->getScalabilityMask(1) == true ); 269 } 270 #if MAX_ONE_RESAMPLING_DIRECT_LAYERS 271 if(pcSlice->getVPS()->getScalabilityMask(1)) 272 { 273 pcSlice->setPic(rpcPic); 274 } 275 #endif 260 276 } 261 277 } … … 456 472 m_apcSlicePilot->setPPS(pps); 457 473 m_apcSlicePilot->setSPS(sps); 458 459 474 pps->setSPS(sps); 460 475 pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1); … … 518 533 m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId); 519 534 520 #if SVC_EXTENSION 535 #if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS 536 setRefLayerParams(m_apcSlicePilot->getVPS()); 537 #endif 538 #if REF_IDX_FRAMEWORK && M0457_COL_PICTURE_SIGNALING 539 m_apcSlicePilot->setNumMotionPredRefLayers(m_numMotionPredRefLayers); 540 #endif 541 542 #if SVC_EXTENSION 543 #if M0457_IL_SAMPLE_PRED_ONLY_FLAG 544 m_apcSlicePilot->setNumSamplePredRefLayers( getNumSamplePredRefLayers() ); 545 #endif 521 546 m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder[m_layerId]); 522 547 #else … … 803 828 if(m_layerId > 0) 804 829 { 830 for( i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 831 { 832 UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i); 805 833 #if AVC_BASE 806 if(m_parameterSetManagerDecoder[0].getActiveVPS()->getAvcBaseLayerFlag() )807 {808 pcSlice->setBaseColPic (*m_ppcTDecTop[0]->getListPic()->begin() );834 if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder[0].getActiveVPS()->getAvcBaseLayerFlag() ) 835 { 836 pcSlice->setBaseColPic ( refLayerIdc, *m_ppcTDecTop[0]->getListPic()->begin() ); 809 837 #if AVC_SYNTAX 810 TComPic* pBLPic = pcSlice->getBaseColPic(); 811 if( pcSlice->getPOC() == 0 ) 838 TComPic* pBLPic = pcSlice->getBaseColPic(refLayerIdc); 839 if( pcSlice->getPOC() == 0 ) 840 { 841 // initialize partition order. 842 UInt* piTmp = &g_auiZscanToRaster[0]; 843 initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp ); 844 initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 ); 845 } 846 pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice ); 847 pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES ); 848 #endif 849 } 850 else 812 851 { 813 // initialize partition order. 814 UInt* piTmp = &g_auiZscanToRaster[0]; 815 initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp ); 816 initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 ); 817 } 818 pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice ); 819 pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES ); 820 #endif 821 } 822 else 823 { 824 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 825 TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( m_layerId ); 852 #if VPS_EXTN_DIRECT_REF_LAYERS 853 TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc ); 854 #else 855 TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); 856 #endif 857 TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); 858 pcSlice->setBaseColPic ( *cListPic, refLayerIdc ); 859 } 860 #else 861 #if VPS_EXTN_DIRECT_REF_LAYERS 862 TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc ); 826 863 #else 827 864 TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); 828 865 #endif 829 866 TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); 830 pcSlice->setBaseColPic ( *cListPic, m_layerId ); 831 } 832 #else 833 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 834 TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( m_layerId ); 835 #else 836 TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 ); 837 #endif 838 TComList<TComPic*> *cListPic = pcTDecTop->getListPic(); 839 pcSlice->setBaseColPic ( *cListPic, m_layerId ); 840 #endif 867 pcSlice->setBaseColPic ( *cListPic, refLayerIdc ); 868 #endif 869 870 #if SIMPLIFIED_MV_POS_SCALING 871 #if SCALED_REF_LAYER_OFFSETS 872 const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc); 873 874 Int widthBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth(); 875 Int heightBL = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight(); 876 877 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset(); 878 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset(); 879 #else 880 const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow(); 881 const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow(); 882 883 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset(); 884 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset(); 885 886 Int widthEL = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset(); 887 Int heightEL = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset(); 888 #endif 889 g_mvScalingFactor[refLayerIdc][0] = widthEL == widthBL ? 4096 : Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL); 890 g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL); 891 892 g_posScalingFactor[refLayerIdc][0] = ((widthBL << 16) + (widthEL >> 1)) / widthEL; 893 g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL; 894 #endif 895 841 896 #if SVC_UPSAMPLING 842 if ( pcPic->isSpatialEnhLayer())843 {897 if( pcPic->isSpatialEnhLayer(refLayerIdc) ) 898 { 844 899 #if SCALED_REF_LAYER_OFFSETS 845 m_cPrediction.upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow() ); 846 #else 847 m_cPrediction.upsampleBasePic( pcPic->getFullPelBaseRec(), pcSlice->getBaseColPic()->getPicYuvRec(), pcPic->getPicYuvRec() ); 848 #endif 849 } 850 else 851 { 852 pcPic->setFullPelBaseRec( pcSlice->getBaseColPic()->getPicYuvRec() ); 853 } 854 pcSlice->setFullPelBaseRec ( pcPic->getFullPelBaseRec() ); 855 #endif 900 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) ); 901 #else 902 m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec() ); 903 #endif 904 } 905 else 906 { 907 pcPic->setFullPelBaseRec( refLayerIdc, pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec() ); 908 } 909 pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) ); 910 #endif 911 } 856 912 } 857 913 858 914 #if REF_IDX_FRAMEWORK 915 #if ZERO_NUM_DIRECT_LAYERS 916 if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() ) 917 #else 859 918 if(m_layerId > 0) 919 #endif 860 920 { 861 921 setILRPic(pcPic); 862 922 #if REF_IDX_MFM 923 #if M0457_COL_PICTURE_SIGNALING 924 if( pcSlice->getMFMEnabledFlag() ) 925 #else 863 926 if( pcSlice->getSPS()->getMFMEnabledFlag() ) 927 #endif 864 928 { 865 929 pcSlice->setRefPOCListILP(m_ppcTDecTop[m_layerId]->m_cIlpPic, pcSlice->getBaseColPic()); 930 #if M0457_COL_PICTURE_SIGNALING 931 pcSlice->setMotionPredIlp(getMotionPredIlp(pcSlice)); 932 #endif 866 933 } 867 934 #endif 868 935 pcSlice->setRefPicList( m_cListPic, false, m_cIlpPic); 869 936 } 937 #if M0040_ADAPTIVE_RESOLUTION_CHANGE 938 else if ( m_layerId > 0 ) 939 { 940 pcSlice->setRefPicList( m_cListPic, false, NULL); 941 } 942 #endif 870 943 #endif 871 944 … … 913 986 //--------------- 914 987 pcSlice->setRefPOCList(); 915 #if !L0034_COMBINED_LIST_CLEANUP916 pcSlice->setNoBackPredFlag( false );917 if ( pcSlice->getSliceType() == B_SLICE )918 {919 if ( pcSlice->getNumRefIdx(RefPicList( 0 ) ) == pcSlice->getNumRefIdx(RefPicList( 1 ) ) )920 {921 pcSlice->setNoBackPredFlag( true );922 for ( i=0; i < pcSlice->getNumRefIdx(RefPicList( 1 ) ); i++ )923 {924 if ( pcSlice->getRefPOC(RefPicList(1), i) != pcSlice->getRefPOC(RefPicList(0), i) )925 {926 pcSlice->setNoBackPredFlag( false );927 break;928 }929 }930 }931 }932 #endif933 988 } 934 989 … … 955 1010 } 956 1011 957 #if SIMPLIFIED_MV_POS_SCALING958 if (m_layerId > 0)959 {960 #if SCALED_REF_LAYER_OFFSETS961 const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow();962 963 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth();964 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight();965 966 Int widthEL = pcPic->getPicYuvRec()->getWidth() - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();967 Int heightEL = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset() - scalEL.getWindowBottomOffset();968 #else969 const Window &confBL = pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow();970 const Window &confEL = pcPic->getPicYuvRec()->getConformanceWindow();971 972 Int widthBL = pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();973 Int heightBL = pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();974 975 Int widthEL = pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();976 Int heightEL = pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();977 #endif978 g_mvScalingFactor[m_layerId][0] = Clip3(-4096, 4095, ((widthEL << 8) + (widthBL >> 1)) / widthBL);979 g_mvScalingFactor[m_layerId][1] = Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);980 981 g_posScalingFactor[m_layerId][0] = ((widthBL << 16) + (widthEL >> 1)) / widthEL;982 g_posScalingFactor[m_layerId][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;983 }984 #endif985 986 1012 // Decode a picture 987 1013 m_cGopDecoder.decompressSlice(nalu.m_Bitstream, pcPic); … … 1011 1037 sps->setLayerId(m_layerId); 1012 1038 #endif 1039 #if SPS_SUB_LAYER_INFO 1040 m_cEntropyDecoder.decodeSPS( sps, &m_parameterSetManagerDecoder[0] ); 1041 #else 1013 1042 m_cEntropyDecoder.decodeSPS( sps ); 1043 #endif 1014 1044 #if SVC_EXTENSION 1015 1045 m_parameterSetManagerDecoder[m_layerId].storePrefetchedSPS(sps); … … 1054 1084 if(nalUnitType == NAL_UNIT_SUFFIX_SEI) 1055 1085 { 1086 #if M0043_LAYERS_PRESENT_SEI 1087 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveVPS(), m_parameterSetManagerDecoder[m_layerId].getActiveSPS() ); 1088 #else 1056 1089 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveSPS() ); 1090 #endif 1057 1091 } 1058 1092 else 1059 1093 { 1094 #if M0043_LAYERS_PRESENT_SEI 1095 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveVPS(), m_parameterSetManagerDecoder[m_layerId].getActiveSPS() ); 1096 #else 1060 1097 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveSPS() ); 1098 #endif 1061 1099 SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS); 1062 1100 if (activeParamSets.size()>0) … … 1074 1112 if(nalUnitType == NAL_UNIT_SUFFIX_SEI) 1075 1113 { 1114 #if M0043_LAYERS_PRESENT_SEI 1115 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() ); 1116 #else 1076 1117 m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); 1118 #endif 1077 1119 } 1078 1120 else 1079 1121 { 1122 #if M0043_LAYERS_PRESENT_SEI 1123 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() ); 1124 #else 1080 1125 m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() ); 1126 #endif 1081 1127 SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS); 1082 1128 if (activeParamSets.size()>0) … … 1269 1315 } 1270 1316 1271 #if VPS_EXTN_DIRECT_REF_LAYERS _CONTINUE1272 TDecTop* TDecTop::getRefLayerDec( UInt layerId)1317 #if VPS_EXTN_DIRECT_REF_LAYERS 1318 TDecTop* TDecTop::getRefLayerDec( UInt refLayerIdc ) 1273 1319 { 1274 1320 TComVPS* vps = m_parameterSetManagerDecoder[0].getActiveVPS(); … … 1281 1327 #endif 1282 1328 } 1283 1284 // currently only one reference layer is supported 1285 assert( vps->getNumDirectRefLayers( m_layerId ) == 1 ); 1286 #if JCTVC_M0458_INTERLAYER_RPS_SIG 1287 assert( vps->getMaxOneActiveRefLayerFlag() == 1 ); 1288 #endif 1289 1290 return (TDecTop *)getLayerDec( vps->getRefLayerId( m_layerId, 0 ) ); 1329 1330 return (TDecTop *)getLayerDec( vps->getRefLayerId( m_layerId, refLayerIdc ) ); 1331 } 1332 #endif 1333 1334 #if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS 1335 1336 Void TDecTop::setRefLayerParams( TComVPS* vps ) 1337 { 1338 for(UInt layer = 0; layer < m_numLayer; layer++) 1339 { 1340 TDecTop *decTop = (TDecTop *)getLayerDec(layer); 1341 decTop->setNumSamplePredRefLayers(0); 1342 decTop->setNumMotionPredRefLayers(0); 1343 decTop->setNumDirectRefLayers(0); 1344 for(Int i = 0; i < MAX_VPS_LAYER_ID_PLUS1; i++) 1345 { 1346 decTop->setSamplePredEnabledFlag(i, false); 1347 decTop->setMotionPredEnabledFlag(i, false); 1348 decTop->setSamplePredRefLayerId(i, 0); 1349 decTop->setMotionPredRefLayerId(i, 0); 1350 } 1351 for(Int j = 0; j < layer; j++) 1352 { 1353 if (vps->getDirectDependencyFlag(layer, j)) 1354 { 1355 decTop->setRefLayerId(decTop->getNumDirectRefLayers(), vps->getLayerIdInNuh(layer)); 1356 decTop->setNumDirectRefLayers(decTop->getNumDirectRefLayers() + 1); 1357 1358 Int samplePredEnabledFlag = (vps->getDirectDependencyType(layer, j) + 1) & 1; 1359 decTop->setSamplePredEnabledFlag(j, samplePredEnabledFlag == 1 ? true : false); 1360 decTop->setNumSamplePredRefLayers(decTop->getNumSamplePredRefLayers() + samplePredEnabledFlag); 1361 1362 Int motionPredEnabledFlag = ((vps->getDirectDependencyType(layer, j) + 1) & 2) >> 1; 1363 decTop->setMotionPredEnabledFlag(j, motionPredEnabledFlag == 1 ? true : false); 1364 decTop->setNumMotionPredRefLayers(decTop->getNumMotionPredRefLayers() + motionPredEnabledFlag); 1365 } 1366 } 1367 } 1368 for ( Int i = 1, mIdx = 0, sIdx = 0; i < m_numLayer; i++ ) 1369 { 1370 Int iNuhLId = vps->getLayerIdInNuh(i); 1371 TDecTop *decTop = (TDecTop *)getLayerDec(iNuhLId); 1372 for ( Int j = 0; j < i; j++ ) 1373 { 1374 if (decTop->getMotionPredEnabledFlag(j)) 1375 { 1376 decTop->setMotionPredRefLayerId(mIdx++, vps->getLayerIdInNuh(j)); 1377 } 1378 if (decTop->getSamplePredEnabledFlag(j)) 1379 { 1380 decTop->setSamplePredRefLayerId(sIdx++, vps->getLayerIdInNuh(j)); 1381 } 1382 } 1383 } 1384 } 1385 1386 #endif 1387 1388 #if M0457_COL_PICTURE_SIGNALING 1389 TComPic* TDecTop::getMotionPredIlp(TComSlice* pcSlice) 1390 { 1391 TComPic* ilpPic = NULL; 1392 Int activeMotionPredReflayerIdx = 0; 1393 1394 for( Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) 1395 { 1396 UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i); 1397 if( getMotionPredEnabledFlag( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) ) ) 1398 { 1399 if (activeMotionPredReflayerIdx == pcSlice->getColRefLayerIdx()) 1400 { 1401 ilpPic = m_cIlpPic[refLayerIdc]; 1402 break; 1403 } 1404 else 1405 { 1406 activeMotionPredReflayerIdx++; 1407 } 1408 } 1409 } 1410 1411 assert(ilpPic != NULL); 1412 1413 return ilpPic; 1291 1414 } 1292 1415 #endif -
trunk/source/Lib/TLibDecoder/TDecTop.h
r191 r310 120 120 Int m_iBLSourceHeight; 121 121 #endif 122 #if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS 123 Int m_numDirectRefLayers; 124 Int m_refLayerId[MAX_VPS_LAYER_ID_PLUS1]; 125 Int m_numSamplePredRefLayers; 126 Int m_samplePredRefLayerId[MAX_VPS_LAYER_ID_PLUS1]; 127 Int m_numMotionPredRefLayers; 128 Int m_motionPredRefLayerId[MAX_VPS_LAYER_ID_PLUS1]; 129 Bool m_samplePredEnabledFlag[MAX_VPS_LAYER_ID_PLUS1]; 130 Bool m_motionPredEnabledFlag[MAX_VPS_LAYER_ID_PLUS1]; 131 #endif 122 132 #endif 123 133 #if AVC_SYNTAX || SYNTAX_OUTPUT … … 156 166 Void setLayerDec(TDecTop **p) { m_ppcTDecTop = p; } 157 167 TDecTop* getLayerDec(UInt layer) { return m_ppcTDecTop[layer]; } 158 #if VPS_EXTN_DIRECT_REF_LAYERS_CONTINUE 159 TDecTop* getRefLayerDec(UInt layerId); 168 #if VPS_EXTN_DIRECT_REF_LAYERS 169 TDecTop* getRefLayerDec(UInt refLayerIdc); 170 #if M0457_PREDICTION_INDICATIONS 171 Int getNumDirectRefLayers () { return m_numDirectRefLayers; } 172 Void setNumDirectRefLayers (Int num) { m_numDirectRefLayers = num; } 173 174 Int getRefLayerId (Int i) { return m_refLayerId[i]; } 175 Void setRefLayerId (Int i, Int refLayerId) { m_refLayerId[i] = refLayerId; } 176 177 Int getNumSamplePredRefLayers () { return m_numSamplePredRefLayers; } 178 Void setNumSamplePredRefLayers (Int num) { m_numSamplePredRefLayers = num; } 179 180 Int getSamplePredRefLayerId (Int i) { return m_samplePredRefLayerId[i]; } 181 Void setSamplePredRefLayerId (Int i, Int refLayerId) { m_samplePredRefLayerId[i] = refLayerId; } 182 183 Int getNumMotionPredRefLayers () { return m_numMotionPredRefLayers; } 184 Void setNumMotionPredRefLayers (Int num) { m_numMotionPredRefLayers = num; } 185 186 Int getMotionPredRefLayerId (Int i) { return m_motionPredRefLayerId[i]; } 187 Void setMotionPredRefLayerId (Int i, Int refLayerId) { m_motionPredRefLayerId[i] = refLayerId; } 188 189 Bool getSamplePredEnabledFlag (Int i) { return m_samplePredEnabledFlag[i]; } 190 Void setSamplePredEnabledFlag (Int i,Bool flag) { m_samplePredEnabledFlag[i] = flag; } 191 192 Bool getMotionPredEnabledFlag (Int i) { return m_motionPredEnabledFlag[i]; } 193 Void setMotionPredEnabledFlag (Int i,Bool flag) { m_motionPredEnabledFlag[i] = flag; } 194 195 TDecTop* getSamplePredRefLayerDec ( UInt layerId ); 196 TDecTop* getMotionPredRefLayerDec ( UInt layerId ); 197 198 Void setRefLayerParams( TComVPS* vps ); 199 #endif 160 200 #endif 161 201 #if AVC_BASE … … 190 230 Void xDecodePPS(); 191 231 Void xDecodeSEI( TComInputBitstream* bs, const NalUnitType nalUnitType ); 232 #if M0457_COL_PICTURE_SIGNALING 233 TComPic* getMotionPredIlp(TComSlice* pcSlice); 234 #endif 192 235 193 236 };// END CLASS DEFINITION TDecTop
Note: See TracChangeset for help on using the changeset viewer.