[313] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
| 4 | * granted under this license. |
---|
| 5 | * |
---|
[595] | 6 | * Copyright (c) 2010-2014, ITU/ISO/IEC |
---|
[313] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
| 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
| 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | /** \file TDecCAVLC.cpp |
---|
| 35 | \brief CAVLC decoder class |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include "TDecCAVLC.h" |
---|
| 39 | #include "SEIread.h" |
---|
| 40 | #include "TDecSlice.h" |
---|
[713] | 41 | #if Q0048_CGS_3D_ASYMLUT |
---|
| 42 | #include "../TLibCommon/TCom3DAsymLUT.h" |
---|
| 43 | #endif |
---|
[313] | 44 | |
---|
| 45 | //! \ingroup TLibDecoder |
---|
| 46 | //! \{ |
---|
| 47 | |
---|
| 48 | #if ENC_DEC_TRACE |
---|
| 49 | |
---|
| 50 | Void xTraceSPSHeader (TComSPS *pSPS) |
---|
| 51 | { |
---|
| 52 | fprintf( g_hTrace, "=========== Sequence Parameter Set ID: %d ===========\n", pSPS->getSPSId() ); |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | Void xTracePPSHeader (TComPPS *pPPS) |
---|
| 56 | { |
---|
| 57 | fprintf( g_hTrace, "=========== Picture Parameter Set ID: %d ===========\n", pPPS->getPPSId() ); |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | Void xTraceSliceHeader (TComSlice *pSlice) |
---|
| 61 | { |
---|
| 62 | fprintf( g_hTrace, "=========== Slice ===========\n"); |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | #endif |
---|
| 66 | |
---|
| 67 | // ==================================================================================================================== |
---|
| 68 | // Constructor / destructor / create / destroy |
---|
| 69 | // ==================================================================================================================== |
---|
| 70 | |
---|
| 71 | TDecCavlc::TDecCavlc() |
---|
| 72 | { |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | TDecCavlc::~TDecCavlc() |
---|
| 76 | { |
---|
| 77 | |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | // ==================================================================================================================== |
---|
| 81 | // Public member functions |
---|
| 82 | // ==================================================================================================================== |
---|
| 83 | |
---|
| 84 | void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComReferencePictureSet* rps, Int idx ) |
---|
| 85 | { |
---|
| 86 | UInt code; |
---|
| 87 | UInt interRPSPred; |
---|
| 88 | if (idx > 0) |
---|
| 89 | { |
---|
| 90 | READ_FLAG(interRPSPred, "inter_ref_pic_set_prediction_flag"); rps->setInterRPSPrediction(interRPSPred); |
---|
| 91 | } |
---|
| 92 | else |
---|
| 93 | { |
---|
| 94 | interRPSPred = false; |
---|
| 95 | rps->setInterRPSPrediction(false); |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | if (interRPSPred) |
---|
| 99 | { |
---|
| 100 | UInt bit; |
---|
| 101 | if(idx == sps->getRPSList()->getNumberOfReferencePictureSets()) |
---|
| 102 | { |
---|
| 103 | READ_UVLC(code, "delta_idx_minus1" ); // delta index of the Reference Picture Set used for prediction minus 1 |
---|
| 104 | } |
---|
| 105 | else |
---|
| 106 | { |
---|
| 107 | code = 0; |
---|
| 108 | } |
---|
| 109 | assert(code <= idx-1); // delta_idx_minus1 shall not be larger than idx-1, otherwise we will predict from a negative row position that does not exist. When idx equals 0 there is no legal value and interRPSPred must be zero. See J0185-r2 |
---|
| 110 | Int rIdx = idx - 1 - code; |
---|
| 111 | assert (rIdx <= idx-1 && rIdx >= 0); // Made assert tighter; if rIdx = idx then prediction is done from itself. rIdx must belong to range 0, idx-1, inclusive, see J0185-r2 |
---|
| 112 | TComReferencePictureSet* rpsRef = sps->getRPSList()->getReferencePictureSet(rIdx); |
---|
| 113 | Int k = 0, k0 = 0, k1 = 0; |
---|
| 114 | READ_CODE(1, bit, "delta_rps_sign"); // delta_RPS_sign |
---|
| 115 | READ_UVLC(code, "abs_delta_rps_minus1"); // absolute delta RPS minus 1 |
---|
| 116 | Int deltaRPS = (1 - 2 * bit) * (code + 1); // delta_RPS |
---|
| 117 | for(Int j=0 ; j <= rpsRef->getNumberOfPictures(); j++) |
---|
| 118 | { |
---|
| 119 | READ_CODE(1, bit, "used_by_curr_pic_flag" ); //first bit is "1" if Idc is 1 |
---|
| 120 | Int refIdc = bit; |
---|
| 121 | if (refIdc == 0) |
---|
| 122 | { |
---|
| 123 | READ_CODE(1, bit, "use_delta_flag" ); //second bit is "1" if Idc is 2, "0" otherwise. |
---|
| 124 | refIdc = bit<<1; //second bit is "1" if refIdc is 2, "0" if refIdc = 0. |
---|
| 125 | } |
---|
| 126 | if (refIdc == 1 || refIdc == 2) |
---|
| 127 | { |
---|
| 128 | Int deltaPOC = deltaRPS + ((j < rpsRef->getNumberOfPictures())? rpsRef->getDeltaPOC(j) : 0); |
---|
| 129 | rps->setDeltaPOC(k, deltaPOC); |
---|
| 130 | rps->setUsed(k, (refIdc == 1)); |
---|
| 131 | |
---|
| 132 | if (deltaPOC < 0) |
---|
| 133 | { |
---|
| 134 | k0++; |
---|
| 135 | } |
---|
| 136 | else |
---|
| 137 | { |
---|
| 138 | k1++; |
---|
| 139 | } |
---|
| 140 | k++; |
---|
| 141 | } |
---|
| 142 | rps->setRefIdc(j,refIdc); |
---|
| 143 | } |
---|
| 144 | rps->setNumRefIdc(rpsRef->getNumberOfPictures()+1); |
---|
| 145 | rps->setNumberOfPictures(k); |
---|
| 146 | rps->setNumberOfNegativePictures(k0); |
---|
| 147 | rps->setNumberOfPositivePictures(k1); |
---|
| 148 | rps->sortDeltaPOC(); |
---|
| 149 | } |
---|
| 150 | else |
---|
| 151 | { |
---|
| 152 | READ_UVLC(code, "num_negative_pics"); rps->setNumberOfNegativePictures(code); |
---|
| 153 | READ_UVLC(code, "num_positive_pics"); rps->setNumberOfPositivePictures(code); |
---|
| 154 | Int prev = 0; |
---|
| 155 | Int poc; |
---|
| 156 | for(Int j=0 ; j < rps->getNumberOfNegativePictures(); j++) |
---|
| 157 | { |
---|
| 158 | READ_UVLC(code, "delta_poc_s0_minus1"); |
---|
| 159 | poc = prev-code-1; |
---|
| 160 | prev = poc; |
---|
| 161 | rps->setDeltaPOC(j,poc); |
---|
| 162 | READ_FLAG(code, "used_by_curr_pic_s0_flag"); rps->setUsed(j,code); |
---|
| 163 | } |
---|
| 164 | prev = 0; |
---|
| 165 | for(Int j=rps->getNumberOfNegativePictures(); j < rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); j++) |
---|
| 166 | { |
---|
| 167 | READ_UVLC(code, "delta_poc_s1_minus1"); |
---|
| 168 | poc = prev+code+1; |
---|
| 169 | prev = poc; |
---|
| 170 | rps->setDeltaPOC(j,poc); |
---|
| 171 | READ_FLAG(code, "used_by_curr_pic_s1_flag"); rps->setUsed(j,code); |
---|
| 172 | } |
---|
| 173 | rps->setNumberOfPictures(rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures()); |
---|
| 174 | } |
---|
| 175 | #if PRINT_RPS_INFO |
---|
| 176 | rps->printDeltaPOC(); |
---|
| 177 | #endif |
---|
| 178 | } |
---|
| 179 | |
---|
[713] | 180 | Void TDecCavlc::parsePPS(TComPPS* pcPPS |
---|
| 181 | #if Q0048_CGS_3D_ASYMLUT |
---|
| 182 | , TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID |
---|
| 183 | #endif |
---|
| 184 | ) |
---|
[313] | 185 | { |
---|
| 186 | #if ENC_DEC_TRACE |
---|
| 187 | xTracePPSHeader (pcPPS); |
---|
| 188 | #endif |
---|
| 189 | UInt uiCode; |
---|
| 190 | |
---|
| 191 | Int iCode; |
---|
| 192 | |
---|
| 193 | READ_UVLC( uiCode, "pps_pic_parameter_set_id"); |
---|
| 194 | assert(uiCode <= 63); |
---|
| 195 | pcPPS->setPPSId (uiCode); |
---|
[494] | 196 | |
---|
[313] | 197 | READ_UVLC( uiCode, "pps_seq_parameter_set_id"); |
---|
| 198 | assert(uiCode <= 15); |
---|
| 199 | pcPPS->setSPSId (uiCode); |
---|
[494] | 200 | |
---|
[313] | 201 | READ_FLAG( uiCode, "dependent_slice_segments_enabled_flag" ); pcPPS->setDependentSliceSegmentsEnabledFlag ( uiCode == 1 ); |
---|
| 202 | READ_FLAG( uiCode, "output_flag_present_flag" ); pcPPS->setOutputFlagPresentFlag( uiCode==1 ); |
---|
| 203 | |
---|
| 204 | READ_CODE(3, uiCode, "num_extra_slice_header_bits"); pcPPS->setNumExtraSliceHeaderBits(uiCode); |
---|
| 205 | READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode ); |
---|
| 206 | |
---|
| 207 | READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false ); |
---|
| 208 | |
---|
| 209 | READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1"); |
---|
| 210 | assert(uiCode <= 14); |
---|
| 211 | pcPPS->setNumRefIdxL0DefaultActive(uiCode+1); |
---|
| 212 | |
---|
| 213 | READ_UVLC(uiCode, "num_ref_idx_l1_default_active_minus1"); |
---|
| 214 | assert(uiCode <= 14); |
---|
| 215 | pcPPS->setNumRefIdxL1DefaultActive(uiCode+1); |
---|
| 216 | |
---|
| 217 | READ_SVLC(iCode, "init_qp_minus26" ); pcPPS->setPicInitQPMinus26(iCode); |
---|
| 218 | READ_FLAG( uiCode, "constrained_intra_pred_flag" ); pcPPS->setConstrainedIntraPred( uiCode ? true : false ); |
---|
| 219 | READ_FLAG( uiCode, "transform_skip_enabled_flag" ); |
---|
| 220 | pcPPS->setUseTransformSkip ( uiCode ? true : false ); |
---|
| 221 | |
---|
| 222 | READ_FLAG( uiCode, "cu_qp_delta_enabled_flag" ); pcPPS->setUseDQP( uiCode ? true : false ); |
---|
| 223 | if( pcPPS->getUseDQP() ) |
---|
| 224 | { |
---|
| 225 | READ_UVLC( uiCode, "diff_cu_qp_delta_depth" ); |
---|
| 226 | pcPPS->setMaxCuDQPDepth( uiCode ); |
---|
| 227 | } |
---|
| 228 | else |
---|
| 229 | { |
---|
| 230 | pcPPS->setMaxCuDQPDepth( 0 ); |
---|
| 231 | } |
---|
| 232 | READ_SVLC( iCode, "pps_cb_qp_offset"); |
---|
| 233 | pcPPS->setChromaCbQpOffset(iCode); |
---|
| 234 | assert( pcPPS->getChromaCbQpOffset() >= -12 ); |
---|
| 235 | assert( pcPPS->getChromaCbQpOffset() <= 12 ); |
---|
| 236 | |
---|
| 237 | READ_SVLC( iCode, "pps_cr_qp_offset"); |
---|
| 238 | pcPPS->setChromaCrQpOffset(iCode); |
---|
| 239 | assert( pcPPS->getChromaCrQpOffset() >= -12 ); |
---|
| 240 | assert( pcPPS->getChromaCrQpOffset() <= 12 ); |
---|
| 241 | |
---|
| 242 | READ_FLAG( uiCode, "pps_slice_chroma_qp_offsets_present_flag" ); |
---|
| 243 | pcPPS->setSliceChromaQpFlag( uiCode ? true : false ); |
---|
| 244 | |
---|
| 245 | READ_FLAG( uiCode, "weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) |
---|
| 246 | pcPPS->setUseWP( uiCode==1 ); |
---|
| 247 | READ_FLAG( uiCode, "weighted_bipred_flag" ); // Use of Bi-Directional Weighting Prediction (B_SLICE) |
---|
| 248 | pcPPS->setWPBiPred( uiCode==1 ); |
---|
| 249 | |
---|
| 250 | READ_FLAG( uiCode, "transquant_bypass_enable_flag"); |
---|
| 251 | pcPPS->setTransquantBypassEnableFlag(uiCode ? true : false); |
---|
| 252 | READ_FLAG( uiCode, "tiles_enabled_flag" ); pcPPS->setTilesEnabledFlag ( uiCode == 1 ); |
---|
| 253 | READ_FLAG( uiCode, "entropy_coding_sync_enabled_flag" ); pcPPS->setEntropyCodingSyncEnabledFlag( uiCode == 1 ); |
---|
| 254 | |
---|
| 255 | if( pcPPS->getTilesEnabledFlag() ) |
---|
| 256 | { |
---|
[823] | 257 | READ_UVLC ( uiCode, "num_tile_columns_minus1" ); pcPPS->setNumTileColumnsMinus1( uiCode ); |
---|
| 258 | READ_UVLC ( uiCode, "num_tile_rows_minus1" ); pcPPS->setNumTileRowsMinus1( uiCode ); |
---|
| 259 | READ_FLAG ( uiCode, "uniform_spacing_flag" ); pcPPS->setTileUniformSpacingFlag( uiCode == 1 ); |
---|
[313] | 260 | |
---|
[823] | 261 | if( !pcPPS->getTileUniformSpacingFlag()) |
---|
[313] | 262 | { |
---|
[823] | 263 | std::vector<Int> columnWidth(pcPPS->getNumTileColumnsMinus1()); |
---|
| 264 | for(UInt i=0; i<pcPPS->getNumTileColumnsMinus1(); i++) |
---|
[313] | 265 | { |
---|
| 266 | READ_UVLC( uiCode, "column_width_minus1" ); |
---|
| 267 | columnWidth[i] = uiCode+1; |
---|
| 268 | } |
---|
[823] | 269 | pcPPS->setTileColumnWidth(columnWidth); |
---|
[313] | 270 | |
---|
[823] | 271 | std::vector<Int> rowHeight (pcPPS->getTileNumRowsMinus1()); |
---|
| 272 | for(UInt i=0; i<pcPPS->getTileNumRowsMinus1(); i++) |
---|
[313] | 273 | { |
---|
| 274 | READ_UVLC( uiCode, "row_height_minus1" ); |
---|
| 275 | rowHeight[i] = uiCode + 1; |
---|
| 276 | } |
---|
[823] | 277 | pcPPS->setTileRowHeight(rowHeight); |
---|
[313] | 278 | } |
---|
| 279 | |
---|
[823] | 280 | if(pcPPS->getNumTileColumnsMinus1() !=0 || pcPPS->getTileNumRowsMinus1() !=0) |
---|
[313] | 281 | { |
---|
| 282 | READ_FLAG ( uiCode, "loop_filter_across_tiles_enabled_flag" ); pcPPS->setLoopFilterAcrossTilesEnabledFlag( uiCode ? true : false ); |
---|
| 283 | } |
---|
| 284 | } |
---|
| 285 | READ_FLAG( uiCode, "loop_filter_across_slices_enabled_flag" ); pcPPS->setLoopFilterAcrossSlicesEnabledFlag( uiCode ? true : false ); |
---|
| 286 | READ_FLAG( uiCode, "deblocking_filter_control_present_flag" ); pcPPS->setDeblockingFilterControlPresentFlag( uiCode ? true : false ); |
---|
| 287 | if(pcPPS->getDeblockingFilterControlPresentFlag()) |
---|
| 288 | { |
---|
| 289 | READ_FLAG( uiCode, "deblocking_filter_override_enabled_flag" ); pcPPS->setDeblockingFilterOverrideEnabledFlag( uiCode ? true : false ); |
---|
| 290 | READ_FLAG( uiCode, "pps_disable_deblocking_filter_flag" ); pcPPS->setPicDisableDeblockingFilterFlag(uiCode ? true : false ); |
---|
| 291 | if(!pcPPS->getPicDisableDeblockingFilterFlag()) |
---|
| 292 | { |
---|
| 293 | READ_SVLC ( iCode, "pps_beta_offset_div2" ); pcPPS->setDeblockingFilterBetaOffsetDiv2( iCode ); |
---|
| 294 | READ_SVLC ( iCode, "pps_tc_offset_div2" ); pcPPS->setDeblockingFilterTcOffsetDiv2( iCode ); |
---|
| 295 | } |
---|
| 296 | } |
---|
[898] | 297 | #if !R0042_PROFILE_INDICATION |
---|
[540] | 298 | #if SCALINGLIST_INFERRING |
---|
| 299 | if( pcPPS->getLayerId() > 0 ) |
---|
| 300 | { |
---|
| 301 | READ_FLAG( uiCode, "pps_infer_scaling_list_flag" ); |
---|
| 302 | pcPPS->setInferScalingListFlag( uiCode ); |
---|
| 303 | } |
---|
[442] | 304 | |
---|
[540] | 305 | if( pcPPS->getInferScalingListFlag() ) |
---|
[313] | 306 | { |
---|
[937] | 307 | READ_CODE( 6, uiCode, "pps_scaling_list_ref_layer_id" ); pcPPS->setScalingListRefLayerId( uiCode ); |
---|
[442] | 308 | |
---|
[540] | 309 | // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive |
---|
| 310 | assert( pcPPS->getScalingListRefLayerId() <= 62 ); |
---|
[494] | 311 | |
---|
[540] | 312 | pcPPS->setScalingListPresentFlag( false ); |
---|
| 313 | } |
---|
| 314 | else |
---|
| 315 | { |
---|
| 316 | #endif |
---|
[898] | 317 | #endif |
---|
[442] | 318 | |
---|
[825] | 319 | READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" ); pcPPS->setScalingListPresentFlag( uiCode ? true : false ); |
---|
[442] | 320 | |
---|
[825] | 321 | if(pcPPS->getScalingListPresentFlag ()) |
---|
| 322 | { |
---|
| 323 | parseScalingList( pcPPS->getScalingList() ); |
---|
| 324 | } |
---|
[898] | 325 | #if !R0042_PROFILE_INDICATION |
---|
[540] | 326 | #if SCALINGLIST_INFERRING |
---|
| 327 | } |
---|
| 328 | #endif |
---|
[898] | 329 | #endif |
---|
[540] | 330 | |
---|
[313] | 331 | READ_FLAG( uiCode, "lists_modification_present_flag"); |
---|
| 332 | pcPPS->setListsModificationPresentFlag(uiCode); |
---|
| 333 | |
---|
| 334 | READ_UVLC( uiCode, "log2_parallel_merge_level_minus2"); |
---|
| 335 | pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode); |
---|
| 336 | |
---|
| 337 | READ_FLAG( uiCode, "slice_segment_header_extension_present_flag"); |
---|
| 338 | pcPPS->setSliceHeaderExtensionPresentFlag(uiCode); |
---|
| 339 | |
---|
[898] | 340 | #if !R0042_PROFILE_INDICATION |
---|
[313] | 341 | READ_FLAG( uiCode, "pps_extension_flag"); |
---|
[898] | 342 | #else |
---|
| 343 | READ_FLAG( uiCode, "pps_extension_present_flag"); |
---|
| 344 | #endif |
---|
| 345 | |
---|
| 346 | #if !R0042_PROFILE_INDICATION |
---|
[815] | 347 | #if POC_RESET_INFO_INFERENCE |
---|
| 348 | pcPPS->setExtensionFlag( uiCode ? true : false ); |
---|
| 349 | |
---|
| 350 | if( pcPPS->getExtensionFlag() ) |
---|
| 351 | #else |
---|
[313] | 352 | if (uiCode) |
---|
[815] | 353 | #endif |
---|
[313] | 354 | { |
---|
[644] | 355 | #if P0166_MODIFIED_PPS_EXTENSION |
---|
| 356 | UInt ppsExtensionTypeFlag[8]; |
---|
| 357 | for (UInt i = 0; i < 8; i++) |
---|
| 358 | { |
---|
| 359 | READ_FLAG( ppsExtensionTypeFlag[i], "pps_extension_type_flag" ); |
---|
| 360 | } |
---|
| 361 | #if !POC_RESET_IDC |
---|
| 362 | if (ppsExtensionTypeFlag[1]) |
---|
| 363 | { |
---|
| 364 | #else |
---|
| 365 | if( ppsExtensionTypeFlag[0] ) |
---|
| 366 | { |
---|
| 367 | READ_FLAG( uiCode, "poc_reset_info_present_flag" ); |
---|
| 368 | pcPPS->setPocResetInfoPresentFlag(uiCode ? true : false); |
---|
[849] | 369 | #if REF_REGION_OFFSET |
---|
| 370 | READ_UVLC( uiCode, "num_scaled_ref_layer_offsets" ); pcPPS->setNumScaledRefLayerOffsets(uiCode); |
---|
| 371 | for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++) |
---|
| 372 | { |
---|
| 373 | READ_CODE( 6, uiCode, "scaled_ref_layer_id" ); pcPPS->setScaledRefLayerId( i, uiCode ); |
---|
| 374 | READ_FLAG( uiCode, "scaled_ref_layer_offset_present_flag" ); pcPPS->setScaledRefLayerOffsetPresentFlag( i, uiCode ); |
---|
| 375 | if (uiCode) |
---|
| 376 | { |
---|
| 377 | Window& scaledWindow = pcPPS->getScaledRefLayerWindow(i); |
---|
| 378 | READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); |
---|
| 379 | READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); |
---|
| 380 | READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); |
---|
| 381 | READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); |
---|
| 382 | #if P0312_VERT_PHASE_ADJ |
---|
| 383 | READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode); pcPPS->setVertPhasePositionEnableFlag( pcPPS->getScaledRefLayerId(i), uiCode); |
---|
| 384 | #endif |
---|
| 385 | } |
---|
| 386 | READ_FLAG( uiCode, "ref_region_offset_present_flag" ); pcPPS->setRefRegionOffsetPresentFlag( i, uiCode ); |
---|
| 387 | if (uiCode) |
---|
| 388 | { |
---|
| 389 | Window& refWindow = pcPPS->getRefLayerWindow(i); |
---|
| 390 | READ_SVLC( iCode, "ref_region_left_offset" ); refWindow.setWindowLeftOffset (iCode << 1); |
---|
| 391 | READ_SVLC( iCode, "ref_region_top_offset" ); refWindow.setWindowTopOffset (iCode << 1); |
---|
| 392 | READ_SVLC( iCode, "ref_region_right_offset" ); refWindow.setWindowRightOffset (iCode << 1); |
---|
| 393 | READ_SVLC( iCode, "ref_region_bottom_offset" ); refWindow.setWindowBottomOffset(iCode << 1); |
---|
| 394 | } |
---|
| 395 | #if R0209_GENERIC_PHASE |
---|
| 396 | READ_FLAG( uiCode, "resample_phase_set_present_flag" ); pcPPS->setResamplePhaseSetPresentFlag( i, uiCode ); |
---|
| 397 | if (uiCode) |
---|
| 398 | { |
---|
| 399 | READ_UVLC( uiCode, "phase_hor_luma" ); pcPPS->setPhaseHorLuma ( i, uiCode ); |
---|
| 400 | READ_UVLC( uiCode, "phase_ver_luma" ); pcPPS->setPhaseVerLuma ( i, uiCode ); |
---|
| 401 | READ_UVLC( uiCode, "phase_hor_chroma_plus8" ); pcPPS->setPhaseHorChroma (i, uiCode - 8); |
---|
| 402 | READ_UVLC( uiCode, "phase_ver_chroma_plus8" ); pcPPS->setPhaseVerChroma (i, uiCode - 8); |
---|
| 403 | } |
---|
| 404 | #endif |
---|
| 405 | } |
---|
| 406 | #else |
---|
| 407 | #if MOVE_SCALED_OFFSET_TO_PPS |
---|
| 408 | READ_UVLC( uiCode, "num_scaled_ref_layer_offsets" ); pcPPS->setNumScaledRefLayerOffsets(uiCode); |
---|
| 409 | for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++) |
---|
| 410 | { |
---|
| 411 | Window& scaledWindow = pcPPS->getScaledRefLayerWindow(i); |
---|
| 412 | #if O0098_SCALED_REF_LAYER_ID |
---|
| 413 | READ_CODE( 6, uiCode, "scaled_ref_layer_id" ); pcPPS->setScaledRefLayerId( i, uiCode ); |
---|
| 414 | #endif |
---|
| 415 | READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); |
---|
| 416 | READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); |
---|
| 417 | READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); |
---|
| 418 | READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); |
---|
| 419 | #if P0312_VERT_PHASE_ADJ |
---|
| 420 | READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode); pcPPS->setVertPhasePositionEnableFlag( pcPPS->getScaledRefLayerId(i), uiCode); |
---|
| 421 | #endif |
---|
| 422 | } |
---|
| 423 | #endif |
---|
| 424 | #endif |
---|
[713] | 425 | #if Q0048_CGS_3D_ASYMLUT |
---|
| 426 | READ_FLAG( uiCode , "colour_mapping_enabled_flag" ); |
---|
| 427 | pcPPS->setCGSFlag( uiCode ); |
---|
| 428 | if( pcPPS->getCGSFlag() ) |
---|
| 429 | { |
---|
| 430 | xParse3DAsymLUT( pc3DAsymLUT ); |
---|
| 431 | pcPPS->setCGSOutputBitDepthY( pc3DAsymLUT->getOutputBitDepthY() ); |
---|
| 432 | pcPPS->setCGSOutputBitDepthC( pc3DAsymLUT->getOutputBitDepthC() ); |
---|
| 433 | } |
---|
[644] | 434 | #endif |
---|
[713] | 435 | #endif |
---|
[644] | 436 | } |
---|
[815] | 437 | #if POC_RESET_INFO_INFERENCE |
---|
| 438 | else // Extension type 0 absent |
---|
| 439 | { |
---|
| 440 | pcPPS->setPocResetInfoPresentFlag( false ); |
---|
| 441 | } |
---|
| 442 | #endif |
---|
[644] | 443 | if (ppsExtensionTypeFlag[7]) |
---|
| 444 | { |
---|
| 445 | #endif |
---|
| 446 | |
---|
[825] | 447 | while ( xMoreRbspData() ) |
---|
| 448 | { |
---|
| 449 | READ_FLAG( uiCode, "pps_extension_data_flag"); |
---|
| 450 | } |
---|
[644] | 451 | #if P0166_MODIFIED_PPS_EXTENSION |
---|
| 452 | } |
---|
| 453 | #endif |
---|
[313] | 454 | } |
---|
[815] | 455 | #if POC_RESET_INFO_INFERENCE |
---|
| 456 | if( !pcPPS->getExtensionFlag() ) |
---|
| 457 | { |
---|
| 458 | pcPPS->setPocResetInfoPresentFlag( false ); |
---|
| 459 | } |
---|
| 460 | #endif |
---|
[898] | 461 | #else |
---|
| 462 | pcPPS->setExtensionFlag( uiCode ? true : false ); |
---|
| 463 | if( pcPPS->getExtensionFlag() ) |
---|
| 464 | { |
---|
| 465 | READ_FLAG( uiCode, "pps_range_extension_flag" ); |
---|
| 466 | assert(uiCode == 0); |
---|
| 467 | READ_FLAG( uiCode, "pps_multilayer_extension_flag" ); |
---|
| 468 | assert(uiCode == 1); |
---|
| 469 | READ_CODE(6, uiCode, "pps_extension_6bits"); |
---|
| 470 | assert(uiCode == 0); |
---|
| 471 | |
---|
| 472 | READ_FLAG( uiCode, "poc_reset_info_present_flag" ); |
---|
| 473 | pcPPS->setPocResetInfoPresentFlag(uiCode ? true : false); |
---|
| 474 | |
---|
| 475 | #if SCALINGLIST_INFERRING |
---|
| 476 | READ_FLAG( uiCode, "pps_infer_scaling_list_flag" ); |
---|
| 477 | pcPPS->setInferScalingListFlag( uiCode ); |
---|
| 478 | |
---|
| 479 | if( pcPPS->getInferScalingListFlag() ) |
---|
| 480 | { |
---|
[937] | 481 | READ_CODE( 6, uiCode, "pps_scaling_list_ref_layer_id" ); |
---|
[898] | 482 | pcPPS->setScalingListRefLayerId( uiCode ); |
---|
| 483 | // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive |
---|
| 484 | assert( pcPPS->getScalingListRefLayerId() <= 62 ); |
---|
| 485 | pcPPS->setScalingListPresentFlag( false ); |
---|
| 486 | } |
---|
| 487 | #endif |
---|
| 488 | |
---|
| 489 | #if REF_REGION_OFFSET |
---|
| 490 | READ_UVLC( uiCode, "num_ref_loc_offsets" ); pcPPS->setNumScaledRefLayerOffsets(uiCode); |
---|
| 491 | for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++) |
---|
| 492 | { |
---|
| 493 | READ_CODE( 6, uiCode, "ref_loc_offset_layer_id" ); pcPPS->setScaledRefLayerId( i, uiCode ); |
---|
| 494 | READ_FLAG( uiCode, "scaled_ref_layer_offset_present_flag" ); pcPPS->setScaledRefLayerOffsetPresentFlag( i, uiCode ); |
---|
| 495 | if (uiCode) |
---|
| 496 | { |
---|
| 497 | Window& scaledWindow = pcPPS->getScaledRefLayerWindow(i); |
---|
| 498 | READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); |
---|
| 499 | READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); |
---|
| 500 | READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); |
---|
| 501 | READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); |
---|
| 502 | #if P0312_VERT_PHASE_ADJ |
---|
| 503 | READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode); pcPPS->setVertPhasePositionEnableFlag( pcPPS->getScaledRefLayerId(i), uiCode); |
---|
| 504 | #endif |
---|
| 505 | } |
---|
| 506 | READ_FLAG( uiCode, "ref_region_offset_present_flag" ); pcPPS->setRefRegionOffsetPresentFlag( i, uiCode ); |
---|
| 507 | if (uiCode) |
---|
| 508 | { |
---|
| 509 | Window& refWindow = pcPPS->getRefLayerWindow(i); |
---|
| 510 | READ_SVLC( iCode, "ref_region_left_offset" ); refWindow.setWindowLeftOffset (iCode << 1); |
---|
| 511 | READ_SVLC( iCode, "ref_region_top_offset" ); refWindow.setWindowTopOffset (iCode << 1); |
---|
| 512 | READ_SVLC( iCode, "ref_region_right_offset" ); refWindow.setWindowRightOffset (iCode << 1); |
---|
| 513 | READ_SVLC( iCode, "ref_region_bottom_offset" ); refWindow.setWindowBottomOffset(iCode << 1); |
---|
| 514 | } |
---|
| 515 | #if R0209_GENERIC_PHASE |
---|
| 516 | READ_FLAG( uiCode, "resample_phase_set_present_flag" ); pcPPS->setResamplePhaseSetPresentFlag( i, uiCode ); |
---|
| 517 | if (uiCode) |
---|
| 518 | { |
---|
| 519 | READ_UVLC( uiCode, "phase_hor_luma" ); pcPPS->setPhaseHorLuma ( i, uiCode ); |
---|
| 520 | READ_UVLC( uiCode, "phase_ver_luma" ); pcPPS->setPhaseVerLuma ( i, uiCode ); |
---|
| 521 | READ_UVLC( uiCode, "phase_hor_chroma_plus8" ); pcPPS->setPhaseHorChroma (i, uiCode - 8); |
---|
| 522 | READ_UVLC( uiCode, "phase_ver_chroma_plus8" ); pcPPS->setPhaseVerChroma (i, uiCode - 8); |
---|
| 523 | } |
---|
| 524 | #endif |
---|
| 525 | } |
---|
| 526 | #else |
---|
| 527 | #if MOVE_SCALED_OFFSET_TO_PPS |
---|
| 528 | READ_UVLC( uiCode, "num_scaled_ref_layer_offsets" ); pcPPS->setNumScaledRefLayerOffsets(uiCode); |
---|
| 529 | for(Int i = 0; i < pcPPS->getNumScaledRefLayerOffsets(); i++) |
---|
| 530 | { |
---|
| 531 | Window& scaledWindow = pcPPS->getScaledRefLayerWindow(i); |
---|
| 532 | #if O0098_SCALED_REF_LAYER_ID |
---|
| 533 | READ_CODE( 6, uiCode, "scaled_ref_layer_id" ); pcPPS->setScaledRefLayerId( i, uiCode ); |
---|
| 534 | #endif |
---|
| 535 | READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); |
---|
| 536 | READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); |
---|
| 537 | READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); |
---|
| 538 | READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); |
---|
| 539 | #if P0312_VERT_PHASE_ADJ |
---|
| 540 | READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode); pcPPS->setVertPhasePositionEnableFlag( pcPPS->getScaledRefLayerId(i), uiCode); |
---|
| 541 | #endif |
---|
| 542 | } |
---|
| 543 | #endif |
---|
| 544 | #endif |
---|
| 545 | #if Q0048_CGS_3D_ASYMLUT |
---|
| 546 | READ_FLAG( uiCode , "colour_mapping_enabled_flag" ); |
---|
| 547 | pcPPS->setCGSFlag( uiCode ); |
---|
| 548 | if( pcPPS->getCGSFlag() ) |
---|
| 549 | { |
---|
[914] | 550 | #if R0157_RESTRICT_PPSID_FOR_CGS_LUT |
---|
| 551 | // when pps_pic_parameter_set_id greater than or equal to 8, colour_mapping_enabled_flag shall be equal to 0 |
---|
| 552 | assert( pcPPS->getPPSId() < 8 ); |
---|
| 553 | #endif |
---|
[898] | 554 | xParse3DAsymLUT( pc3DAsymLUT ); |
---|
| 555 | pcPPS->setCGSOutputBitDepthY( pc3DAsymLUT->getOutputBitDepthY() ); |
---|
| 556 | pcPPS->setCGSOutputBitDepthC( pc3DAsymLUT->getOutputBitDepthC() ); |
---|
| 557 | } |
---|
| 558 | #endif |
---|
| 559 | } |
---|
| 560 | #endif |
---|
| 561 | |
---|
[313] | 562 | } |
---|
| 563 | |
---|
| 564 | Void TDecCavlc::parseVUI(TComVUI* pcVUI, TComSPS *pcSPS) |
---|
| 565 | { |
---|
| 566 | #if ENC_DEC_TRACE |
---|
| 567 | fprintf( g_hTrace, "----------- vui_parameters -----------\n"); |
---|
| 568 | #endif |
---|
| 569 | UInt uiCode; |
---|
| 570 | |
---|
| 571 | READ_FLAG( uiCode, "aspect_ratio_info_present_flag"); pcVUI->setAspectRatioInfoPresentFlag(uiCode); |
---|
| 572 | if (pcVUI->getAspectRatioInfoPresentFlag()) |
---|
| 573 | { |
---|
| 574 | READ_CODE(8, uiCode, "aspect_ratio_idc"); pcVUI->setAspectRatioIdc(uiCode); |
---|
| 575 | if (pcVUI->getAspectRatioIdc() == 255) |
---|
| 576 | { |
---|
| 577 | READ_CODE(16, uiCode, "sar_width"); pcVUI->setSarWidth(uiCode); |
---|
| 578 | READ_CODE(16, uiCode, "sar_height"); pcVUI->setSarHeight(uiCode); |
---|
| 579 | } |
---|
| 580 | } |
---|
| 581 | |
---|
| 582 | READ_FLAG( uiCode, "overscan_info_present_flag"); pcVUI->setOverscanInfoPresentFlag(uiCode); |
---|
| 583 | if (pcVUI->getOverscanInfoPresentFlag()) |
---|
| 584 | { |
---|
| 585 | READ_FLAG( uiCode, "overscan_appropriate_flag"); pcVUI->setOverscanAppropriateFlag(uiCode); |
---|
| 586 | } |
---|
| 587 | |
---|
| 588 | READ_FLAG( uiCode, "video_signal_type_present_flag"); pcVUI->setVideoSignalTypePresentFlag(uiCode); |
---|
| 589 | if (pcVUI->getVideoSignalTypePresentFlag()) |
---|
| 590 | { |
---|
| 591 | READ_CODE(3, uiCode, "video_format"); pcVUI->setVideoFormat(uiCode); |
---|
| 592 | READ_FLAG( uiCode, "video_full_range_flag"); pcVUI->setVideoFullRangeFlag(uiCode); |
---|
| 593 | READ_FLAG( uiCode, "colour_description_present_flag"); pcVUI->setColourDescriptionPresentFlag(uiCode); |
---|
| 594 | if (pcVUI->getColourDescriptionPresentFlag()) |
---|
| 595 | { |
---|
| 596 | READ_CODE(8, uiCode, "colour_primaries"); pcVUI->setColourPrimaries(uiCode); |
---|
| 597 | READ_CODE(8, uiCode, "transfer_characteristics"); pcVUI->setTransferCharacteristics(uiCode); |
---|
| 598 | READ_CODE(8, uiCode, "matrix_coefficients"); pcVUI->setMatrixCoefficients(uiCode); |
---|
| 599 | } |
---|
| 600 | } |
---|
| 601 | |
---|
| 602 | READ_FLAG( uiCode, "chroma_loc_info_present_flag"); pcVUI->setChromaLocInfoPresentFlag(uiCode); |
---|
| 603 | if (pcVUI->getChromaLocInfoPresentFlag()) |
---|
| 604 | { |
---|
| 605 | READ_UVLC( uiCode, "chroma_sample_loc_type_top_field" ); pcVUI->setChromaSampleLocTypeTopField(uiCode); |
---|
| 606 | READ_UVLC( uiCode, "chroma_sample_loc_type_bottom_field" ); pcVUI->setChromaSampleLocTypeBottomField(uiCode); |
---|
| 607 | } |
---|
| 608 | |
---|
| 609 | READ_FLAG( uiCode, "neutral_chroma_indication_flag"); pcVUI->setNeutralChromaIndicationFlag(uiCode); |
---|
| 610 | |
---|
| 611 | READ_FLAG( uiCode, "field_seq_flag"); pcVUI->setFieldSeqFlag(uiCode); |
---|
| 612 | |
---|
| 613 | READ_FLAG(uiCode, "frame_field_info_present_flag"); pcVUI->setFrameFieldInfoPresentFlag(uiCode); |
---|
| 614 | |
---|
| 615 | READ_FLAG( uiCode, "default_display_window_flag"); |
---|
| 616 | if (uiCode != 0) |
---|
| 617 | { |
---|
| 618 | Window &defDisp = pcVUI->getDefaultDisplayWindow(); |
---|
| 619 | READ_UVLC( uiCode, "def_disp_win_left_offset" ); defDisp.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); |
---|
| 620 | READ_UVLC( uiCode, "def_disp_win_right_offset" ); defDisp.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); |
---|
| 621 | READ_UVLC( uiCode, "def_disp_win_top_offset" ); defDisp.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); |
---|
| 622 | READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); |
---|
| 623 | } |
---|
| 624 | TimingInfo *timingInfo = pcVUI->getTimingInfo(); |
---|
| 625 | READ_FLAG( uiCode, "vui_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); |
---|
[815] | 626 | #if SVC_EXTENSION |
---|
[442] | 627 | if( pcSPS->getLayerId() > 0 ) |
---|
| 628 | { |
---|
| 629 | assert( timingInfo->getTimingInfoPresentFlag() == false ); |
---|
| 630 | } |
---|
| 631 | #endif |
---|
[313] | 632 | if(timingInfo->getTimingInfoPresentFlag()) |
---|
| 633 | { |
---|
| 634 | READ_CODE( 32, uiCode, "vui_num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode); |
---|
| 635 | READ_CODE( 32, uiCode, "vui_time_scale"); timingInfo->setTimeScale (uiCode); |
---|
| 636 | READ_FLAG( uiCode, "vui_poc_proportional_to_timing_flag"); timingInfo->setPocProportionalToTimingFlag(uiCode ? true : false); |
---|
| 637 | if(timingInfo->getPocProportionalToTimingFlag()) |
---|
| 638 | { |
---|
| 639 | READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); |
---|
| 640 | } |
---|
[825] | 641 | READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); |
---|
| 642 | if( pcVUI->getHrdParametersPresentFlag() ) |
---|
| 643 | { |
---|
| 644 | parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); |
---|
| 645 | } |
---|
[313] | 646 | } |
---|
| 647 | READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode); |
---|
| 648 | if (pcVUI->getBitstreamRestrictionFlag()) |
---|
| 649 | { |
---|
| 650 | READ_FLAG( uiCode, "tiles_fixed_structure_flag"); pcVUI->setTilesFixedStructureFlag(uiCode); |
---|
| 651 | READ_FLAG( uiCode, "motion_vectors_over_pic_boundaries_flag"); pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode); |
---|
| 652 | READ_FLAG( uiCode, "restricted_ref_pic_lists_flag"); pcVUI->setRestrictedRefPicListsFlag(uiCode); |
---|
| 653 | READ_UVLC( uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode); |
---|
| 654 | assert(uiCode < 4096); |
---|
| 655 | READ_UVLC( uiCode, "max_bytes_per_pic_denom" ); pcVUI->setMaxBytesPerPicDenom(uiCode); |
---|
| 656 | READ_UVLC( uiCode, "max_bits_per_mincu_denom" ); pcVUI->setMaxBitsPerMinCuDenom(uiCode); |
---|
| 657 | READ_UVLC( uiCode, "log2_max_mv_length_horizontal" ); pcVUI->setLog2MaxMvLengthHorizontal(uiCode); |
---|
| 658 | READ_UVLC( uiCode, "log2_max_mv_length_vertical" ); pcVUI->setLog2MaxMvLengthVertical(uiCode); |
---|
| 659 | } |
---|
| 660 | } |
---|
| 661 | |
---|
| 662 | Void TDecCavlc::parseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1) |
---|
| 663 | { |
---|
| 664 | UInt uiCode; |
---|
| 665 | if( commonInfPresentFlag ) |
---|
| 666 | { |
---|
| 667 | READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false ); |
---|
| 668 | READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false ); |
---|
| 669 | if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) |
---|
| 670 | { |
---|
| 671 | READ_FLAG( uiCode, "sub_pic_cpb_params_present_flag" ); hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false ); |
---|
| 672 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
| 673 | { |
---|
| 674 | READ_CODE( 8, uiCode, "tick_divisor_minus2" ); hrd->setTickDivisorMinus2( uiCode ); |
---|
| 675 | READ_CODE( 5, uiCode, "du_cpb_removal_delay_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode ); |
---|
| 676 | READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false ); |
---|
| 677 | READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1" ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode ); |
---|
| 678 | } |
---|
| 679 | READ_CODE( 4, uiCode, "bit_rate_scale" ); hrd->setBitRateScale( uiCode ); |
---|
| 680 | READ_CODE( 4, uiCode, "cpb_size_scale" ); hrd->setCpbSizeScale( uiCode ); |
---|
| 681 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
| 682 | { |
---|
| 683 | READ_CODE( 4, uiCode, "cpb_size_du_scale" ); hrd->setDuCpbSizeScale( uiCode ); |
---|
| 684 | } |
---|
| 685 | READ_CODE( 5, uiCode, "initial_cpb_removal_delay_length_minus1" ); hrd->setInitialCpbRemovalDelayLengthMinus1( uiCode ); |
---|
| 686 | READ_CODE( 5, uiCode, "au_cpb_removal_delay_length_minus1" ); hrd->setCpbRemovalDelayLengthMinus1( uiCode ); |
---|
| 687 | READ_CODE( 5, uiCode, "dpb_output_delay_length_minus1" ); hrd->setDpbOutputDelayLengthMinus1( uiCode ); |
---|
| 688 | } |
---|
[894] | 689 | #if VPS_VUI_BSP_HRD_PARAMS |
---|
| 690 | else |
---|
| 691 | { |
---|
| 692 | hrd->setInitialCpbRemovalDelayLengthMinus1( 23 ); |
---|
| 693 | // Add inferred values for other syntax elements here. |
---|
| 694 | } |
---|
| 695 | #endif |
---|
[313] | 696 | } |
---|
| 697 | Int i, j, nalOrVcl; |
---|
| 698 | for( i = 0; i <= maxNumSubLayersMinus1; i ++ ) |
---|
| 699 | { |
---|
| 700 | READ_FLAG( uiCode, "fixed_pic_rate_general_flag" ); hrd->setFixedPicRateFlag( i, uiCode == 1 ? true : false ); |
---|
| 701 | if( !hrd->getFixedPicRateFlag( i ) ) |
---|
| 702 | { |
---|
| 703 | READ_FLAG( uiCode, "fixed_pic_rate_within_cvs_flag" ); hrd->setFixedPicRateWithinCvsFlag( i, uiCode == 1 ? true : false ); |
---|
| 704 | } |
---|
| 705 | else |
---|
| 706 | { |
---|
| 707 | hrd->setFixedPicRateWithinCvsFlag( i, true ); |
---|
| 708 | } |
---|
| 709 | hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present |
---|
| 710 | hrd->setCpbCntMinus1 ( i, 0 ); // Infered to be 0 when not present |
---|
| 711 | if( hrd->getFixedPicRateWithinCvsFlag( i ) ) |
---|
| 712 | { |
---|
| 713 | READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" ); hrd->setPicDurationInTcMinus1( i, uiCode ); |
---|
| 714 | } |
---|
| 715 | else |
---|
| 716 | { |
---|
| 717 | READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false ); |
---|
| 718 | } |
---|
| 719 | if (!hrd->getLowDelayHrdFlag( i )) |
---|
| 720 | { |
---|
| 721 | READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); |
---|
| 722 | } |
---|
| 723 | for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) |
---|
| 724 | { |
---|
| 725 | if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || |
---|
[825] | 726 | ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) |
---|
[313] | 727 | { |
---|
| 728 | for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) |
---|
| 729 | { |
---|
| 730 | READ_UVLC( uiCode, "bit_rate_value_minus1" ); hrd->setBitRateValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
| 731 | READ_UVLC( uiCode, "cpb_size_value_minus1" ); hrd->setCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
| 732 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
| 733 | { |
---|
| 734 | READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
| 735 | READ_UVLC( uiCode, "bit_rate_du_value_minus1" ); hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
| 736 | } |
---|
| 737 | READ_FLAG( uiCode, "cbr_flag" ); hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false ); |
---|
| 738 | } |
---|
| 739 | } |
---|
| 740 | } |
---|
| 741 | } |
---|
| 742 | } |
---|
| 743 | |
---|
[644] | 744 | #if SVC_EXTENSION && !SPS_DPB_PARAMS |
---|
[313] | 745 | Void TDecCavlc::parseSPS(TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager) |
---|
| 746 | #else |
---|
| 747 | Void TDecCavlc::parseSPS(TComSPS* pcSPS) |
---|
| 748 | #endif |
---|
| 749 | { |
---|
| 750 | #if ENC_DEC_TRACE |
---|
| 751 | xTraceSPSHeader (pcSPS); |
---|
| 752 | #endif |
---|
| 753 | |
---|
[898] | 754 | #if R0042_PROFILE_INDICATION |
---|
[902] | 755 | UInt uiTmp = 0; |
---|
| 756 | Bool bMultiLayerExtSpsFlag; |
---|
[898] | 757 | #endif |
---|
[313] | 758 | UInt uiCode; |
---|
| 759 | READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode ); |
---|
[494] | 760 | #if SVC_EXTENSION |
---|
[313] | 761 | if(pcSPS->getLayerId() == 0) |
---|
| 762 | { |
---|
| 763 | #endif |
---|
| 764 | READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); |
---|
| 765 | assert(uiCode <= 6); |
---|
[898] | 766 | #if SVC_EXTENSION |
---|
| 767 | } |
---|
| 768 | #if R0042_PROFILE_INDICATION |
---|
| 769 | else |
---|
| 770 | { |
---|
| 771 | READ_CODE( 3, uiCode, "sps_ext_or_max_sub_layers_minus1" ); uiTmp = uiCode; |
---|
[923] | 772 | if(!( pcSPS->getLayerId() != 0 && uiTmp == 7 )) |
---|
| 773 | { |
---|
| 774 | pcSPS->setMaxTLayers(uiTmp+1); |
---|
| 775 | } |
---|
[898] | 776 | } |
---|
| 777 | #endif |
---|
| 778 | #if !SPS_DPB_PARAMS |
---|
| 779 | if(pcSPS->getLayerId() != 0) |
---|
| 780 | { |
---|
| 781 | pcSPS->setMaxTLayers ( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId())->getMaxTLayers() ); |
---|
| 782 | } |
---|
| 783 | #endif |
---|
| 784 | #endif |
---|
[494] | 785 | |
---|
[898] | 786 | #if SVC_EXTENSION |
---|
| 787 | #if R0042_PROFILE_INDICATION |
---|
| 788 | bMultiLayerExtSpsFlag = ( pcSPS->getLayerId() != 0 && uiTmp == 7 ); |
---|
| 789 | #endif |
---|
| 790 | #endif |
---|
| 791 | |
---|
| 792 | #if SVC_EXTENSION |
---|
| 793 | #if !R0042_PROFILE_INDICATION |
---|
| 794 | if(pcSPS->getLayerId() == 0) |
---|
| 795 | #else |
---|
| 796 | if(!bMultiLayerExtSpsFlag) |
---|
| 797 | #endif |
---|
| 798 | { |
---|
| 799 | #endif |
---|
[313] | 800 | READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); |
---|
[494] | 801 | #if SVC_EXTENSION |
---|
[313] | 802 | } |
---|
[644] | 803 | #if !SPS_DPB_PARAMS |
---|
[313] | 804 | else |
---|
| 805 | { |
---|
| 806 | pcSPS->setTemporalIdNestingFlag( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId())->getTemporalNestingFlag() ); |
---|
| 807 | } |
---|
[442] | 808 | #endif |
---|
[644] | 809 | #endif |
---|
| 810 | |
---|
[815] | 811 | #if !Q0177_SPS_TEMP_NESTING_FIX //This part is not needed anymore as it is already covered by implementation in TDecTop::xActivateParameterSets() |
---|
[313] | 812 | if ( pcSPS->getMaxTLayers() == 1 ) |
---|
| 813 | { |
---|
| 814 | // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0 |
---|
[494] | 815 | #if SVC_EXTENSION |
---|
[644] | 816 | #if !SPS_DPB_PARAMS |
---|
[313] | 817 | assert( pcSPS->getTemporalIdNestingFlag() == true ); |
---|
[644] | 818 | #endif |
---|
[313] | 819 | #else |
---|
| 820 | assert( uiCode == 1 ); |
---|
| 821 | #endif |
---|
| 822 | } |
---|
[815] | 823 | #endif |
---|
| 824 | |
---|
[442] | 825 | #ifdef SPS_PTL_FIX |
---|
[898] | 826 | #if !R0042_PROFILE_INDICATION |
---|
[442] | 827 | if ( pcSPS->getLayerId() == 0) |
---|
[898] | 828 | #else |
---|
| 829 | if(!bMultiLayerExtSpsFlag) |
---|
| 830 | #endif |
---|
[442] | 831 | { |
---|
| 832 | parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); |
---|
| 833 | } |
---|
| 834 | #else |
---|
| 835 | parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); |
---|
| 836 | #endif |
---|
[313] | 837 | |
---|
| 838 | READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); |
---|
| 839 | assert(uiCode <= 15); |
---|
[442] | 840 | |
---|
| 841 | #if REPN_FORMAT_IN_VPS |
---|
[898] | 842 | #if !R0042_PROFILE_INDICATION |
---|
[442] | 843 | if( pcSPS->getLayerId() > 0 ) |
---|
[898] | 844 | #else |
---|
| 845 | if( bMultiLayerExtSpsFlag) |
---|
| 846 | #endif |
---|
[313] | 847 | { |
---|
[494] | 848 | READ_FLAG( uiCode, "update_rep_format_flag" ); |
---|
[442] | 849 | pcSPS->setUpdateRepFormatFlag( uiCode ? true : false ); |
---|
[898] | 850 | #if R0042_PROFILE_INDICATION |
---|
| 851 | if( bMultiLayerExtSpsFlag && uiCode) |
---|
| 852 | { |
---|
| 853 | READ_CODE(8, uiCode, "sps_rep_format_idx"); |
---|
| 854 | pcSPS->setUpdateRepFormatIndex(uiCode); |
---|
| 855 | } |
---|
| 856 | #endif |
---|
[313] | 857 | } |
---|
[442] | 858 | else |
---|
| 859 | { |
---|
[713] | 860 | #if REP_FORMAT_FIX |
---|
| 861 | pcSPS->setUpdateRepFormatFlag( false ); |
---|
| 862 | #else |
---|
[442] | 863 | pcSPS->setUpdateRepFormatFlag( true ); |
---|
[713] | 864 | #endif |
---|
[442] | 865 | } |
---|
[898] | 866 | |
---|
| 867 | #if R0042_PROFILE_INDICATION |
---|
| 868 | if( !bMultiLayerExtSpsFlag ) |
---|
| 869 | { |
---|
| 870 | #else |
---|
[540] | 871 | #if O0096_REP_FORMAT_INDEX |
---|
| 872 | if( pcSPS->getLayerId() == 0 ) |
---|
| 873 | #else |
---|
[494] | 874 | if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) |
---|
[540] | 875 | #endif |
---|
[898] | 876 | #endif |
---|
[442] | 877 | { |
---|
| 878 | #endif |
---|
[494] | 879 | #if AUXILIARY_PICTURES |
---|
| 880 | READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) ); |
---|
| 881 | #else |
---|
[442] | 882 | READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( uiCode ); |
---|
[494] | 883 | #endif |
---|
[442] | 884 | assert(uiCode <= 3); |
---|
| 885 | // 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 |
---|
| 886 | assert (uiCode == 1); |
---|
| 887 | if( uiCode == 3 ) |
---|
| 888 | { |
---|
| 889 | READ_FLAG( uiCode, "separate_colour_plane_flag"); assert(uiCode == 0); |
---|
| 890 | } |
---|
[313] | 891 | |
---|
[442] | 892 | READ_UVLC ( uiCode, "pic_width_in_luma_samples" ); pcSPS->setPicWidthInLumaSamples ( uiCode ); |
---|
| 893 | READ_UVLC ( uiCode, "pic_height_in_luma_samples" ); pcSPS->setPicHeightInLumaSamples( uiCode ); |
---|
| 894 | #if REPN_FORMAT_IN_VPS |
---|
| 895 | } |
---|
[540] | 896 | #if O0096_REP_FORMAT_INDEX |
---|
[898] | 897 | #if !R0042_PROFILE_INDICATION |
---|
[540] | 898 | else if ( pcSPS->getUpdateRepFormatFlag() ) |
---|
| 899 | { |
---|
| 900 | READ_CODE(8, uiCode, "update_rep_format_index"); |
---|
| 901 | pcSPS->setUpdateRepFormatIndex(uiCode); |
---|
| 902 | } |
---|
[442] | 903 | #endif |
---|
[540] | 904 | #endif |
---|
[898] | 905 | #endif |
---|
[869] | 906 | |
---|
| 907 | #if R0156_CONF_WINDOW_IN_REP_FORMAT |
---|
| 908 | #if REPN_FORMAT_IN_VPS |
---|
[898] | 909 | #if !R0042_PROFILE_INDICATION |
---|
[869] | 910 | #if O0096_REP_FORMAT_INDEX |
---|
| 911 | if( pcSPS->getLayerId() == 0 ) |
---|
| 912 | #else |
---|
| 913 | if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) |
---|
| 914 | #endif |
---|
[898] | 915 | #endif |
---|
[313] | 916 | { |
---|
[869] | 917 | #endif |
---|
| 918 | #endif |
---|
| 919 | READ_FLAG( uiCode, "conformance_window_flag"); |
---|
| 920 | if (uiCode != 0) |
---|
| 921 | { |
---|
| 922 | Window &conf = pcSPS->getConformanceWindow(); |
---|
[442] | 923 | #if REPN_FORMAT_IN_VPS |
---|
[869] | 924 | READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode ); |
---|
| 925 | READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode ); |
---|
| 926 | READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode ); |
---|
| 927 | READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode ); |
---|
[442] | 928 | #else |
---|
[869] | 929 | READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); |
---|
| 930 | READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); |
---|
| 931 | READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); |
---|
| 932 | READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); |
---|
[442] | 933 | #endif |
---|
[869] | 934 | } |
---|
| 935 | #if R0156_CONF_WINDOW_IN_REP_FORMAT |
---|
| 936 | #if REPN_FORMAT_IN_VPS |
---|
[313] | 937 | } |
---|
[869] | 938 | #endif |
---|
| 939 | #endif |
---|
| 940 | |
---|
[442] | 941 | #if REPN_FORMAT_IN_VPS |
---|
[898] | 942 | #if !R0042_PROFILE_INDICATION |
---|
[540] | 943 | #if O0096_REP_FORMAT_INDEX |
---|
| 944 | if( pcSPS->getLayerId() == 0 ) |
---|
| 945 | #else |
---|
[494] | 946 | if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) |
---|
[540] | 947 | #endif |
---|
[898] | 948 | #endif |
---|
[442] | 949 | { |
---|
| 950 | #endif |
---|
| 951 | READ_UVLC( uiCode, "bit_depth_luma_minus8" ); |
---|
| 952 | assert(uiCode <= 6); |
---|
| 953 | pcSPS->setBitDepthY( uiCode + 8 ); |
---|
| 954 | pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); |
---|
[313] | 955 | |
---|
[442] | 956 | READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); |
---|
| 957 | assert(uiCode <= 6); |
---|
| 958 | pcSPS->setBitDepthC( uiCode + 8 ); |
---|
| 959 | pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); |
---|
| 960 | #if REPN_FORMAT_IN_VPS |
---|
| 961 | } |
---|
| 962 | #endif |
---|
[898] | 963 | #if R0042_PROFILE_INDICATION |
---|
| 964 | } |
---|
| 965 | #endif |
---|
| 966 | |
---|
[313] | 967 | READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); |
---|
| 968 | assert(uiCode <= 12); |
---|
| 969 | |
---|
[644] | 970 | #if SPS_DPB_PARAMS |
---|
[898] | 971 | #if !R0042_PROFILE_INDICATION |
---|
[644] | 972 | if( pcSPS->getLayerId() == 0 ) |
---|
[313] | 973 | { |
---|
[898] | 974 | #else |
---|
| 975 | if( !bMultiLayerExtSpsFlag ) |
---|
| 976 | { |
---|
[644] | 977 | #endif |
---|
[898] | 978 | #endif |
---|
[644] | 979 | UInt subLayerOrderingInfoPresentFlag; |
---|
| 980 | READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); |
---|
[313] | 981 | |
---|
[644] | 982 | for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) |
---|
[313] | 983 | { |
---|
[713] | 984 | READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]"); |
---|
[644] | 985 | pcSPS->setMaxDecPicBuffering( uiCode + 1, i); |
---|
[713] | 986 | READ_UVLC ( uiCode, "sps_num_reorder_pics[i]" ); |
---|
[644] | 987 | pcSPS->setNumReorderPics(uiCode, i); |
---|
[713] | 988 | READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]"); |
---|
[644] | 989 | pcSPS->setMaxLatencyIncrease( uiCode, i ); |
---|
| 990 | |
---|
| 991 | if (!subLayerOrderingInfoPresentFlag) |
---|
[313] | 992 | { |
---|
[644] | 993 | for (i++; i <= pcSPS->getMaxTLayers()-1; i++) |
---|
| 994 | { |
---|
| 995 | pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i); |
---|
| 996 | pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i); |
---|
| 997 | pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i); |
---|
| 998 | } |
---|
| 999 | break; |
---|
[313] | 1000 | } |
---|
| 1001 | } |
---|
[644] | 1002 | #if SPS_DPB_PARAMS |
---|
[313] | 1003 | } |
---|
[644] | 1004 | #endif |
---|
[313] | 1005 | READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" ); |
---|
| 1006 | Int log2MinCUSize = uiCode + 3; |
---|
| 1007 | pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); |
---|
| 1008 | READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" ); |
---|
| 1009 | pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); |
---|
[825] | 1010 | |
---|
[595] | 1011 | if (pcSPS->getPTL()->getGeneralPTL()->getLevelIdc() >= Level::LEVEL5) |
---|
| 1012 | { |
---|
| 1013 | assert(log2MinCUSize + pcSPS->getLog2DiffMaxMinCodingBlockSize() >= 5); |
---|
| 1014 | } |
---|
[825] | 1015 | |
---|
[313] | 1016 | Int maxCUDepthDelta = uiCode; |
---|
| 1017 | pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); |
---|
| 1018 | pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) ); |
---|
| 1019 | READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); |
---|
| 1020 | |
---|
| 1021 | READ_UVLC( uiCode, "log2_diff_max_min_transform_block_size" ); pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() ); |
---|
| 1022 | pcSPS->setMaxTrSize( 1<<(uiCode + pcSPS->getQuadtreeTULog2MinSize()) ); |
---|
| 1023 | |
---|
| 1024 | READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" ); pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 ); |
---|
| 1025 | READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" ); pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 ); |
---|
| 1026 | |
---|
| 1027 | Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() ); |
---|
| 1028 | pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth ); |
---|
[442] | 1029 | READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); |
---|
[313] | 1030 | |
---|
| 1031 | if(pcSPS->getScalingListFlag()) |
---|
| 1032 | { |
---|
[540] | 1033 | #if SCALINGLIST_INFERRING |
---|
[898] | 1034 | #if !R0042_PROFILE_INDICATION |
---|
[540] | 1035 | if( pcSPS->getLayerId() > 0 ) |
---|
[898] | 1036 | #else |
---|
| 1037 | if( bMultiLayerExtSpsFlag ) |
---|
| 1038 | #endif |
---|
[313] | 1039 | { |
---|
[540] | 1040 | READ_FLAG( uiCode, "sps_infer_scaling_list_flag" ); pcSPS->setInferScalingListFlag( uiCode ); |
---|
| 1041 | } |
---|
[442] | 1042 | |
---|
[540] | 1043 | if( pcSPS->getInferScalingListFlag() ) |
---|
| 1044 | { |
---|
[937] | 1045 | READ_CODE( 6, uiCode, "sps_scaling_list_ref_layer_id" ); pcSPS->setScalingListRefLayerId( uiCode ); |
---|
[442] | 1046 | |
---|
[937] | 1047 | // The value of sps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive |
---|
[540] | 1048 | assert( pcSPS->getScalingListRefLayerId() <= 62 ); |
---|
[442] | 1049 | |
---|
[540] | 1050 | pcSPS->setScalingListPresentFlag( false ); |
---|
| 1051 | } |
---|
| 1052 | else |
---|
| 1053 | { |
---|
| 1054 | #endif |
---|
[825] | 1055 | READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode ); |
---|
| 1056 | if(pcSPS->getScalingListPresentFlag ()) |
---|
| 1057 | { |
---|
| 1058 | parseScalingList( pcSPS->getScalingList() ); |
---|
| 1059 | } |
---|
[540] | 1060 | #if SCALINGLIST_INFERRING |
---|
| 1061 | } |
---|
[442] | 1062 | #endif |
---|
[313] | 1063 | } |
---|
| 1064 | READ_FLAG( uiCode, "amp_enabled_flag" ); pcSPS->setUseAMP( uiCode ); |
---|
| 1065 | READ_FLAG( uiCode, "sample_adaptive_offset_enabled_flag" ); pcSPS->setUseSAO ( uiCode ? true : false ); |
---|
| 1066 | |
---|
| 1067 | READ_FLAG( uiCode, "pcm_enabled_flag" ); pcSPS->setUsePCM( uiCode ? true : false ); |
---|
| 1068 | if( pcSPS->getUsePCM() ) |
---|
| 1069 | { |
---|
| 1070 | READ_CODE( 4, uiCode, "pcm_sample_bit_depth_luma_minus1" ); pcSPS->setPCMBitDepthLuma ( 1 + uiCode ); |
---|
| 1071 | READ_CODE( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1" ); pcSPS->setPCMBitDepthChroma ( 1 + uiCode ); |
---|
| 1072 | READ_UVLC( uiCode, "log2_min_pcm_luma_coding_block_size_minus3" ); pcSPS->setPCMLog2MinSize (uiCode+3); |
---|
| 1073 | READ_UVLC( uiCode, "log2_diff_max_min_pcm_luma_coding_block_size" ); pcSPS->setPCMLog2MaxSize ( uiCode+pcSPS->getPCMLog2MinSize() ); |
---|
| 1074 | READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" ); pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false ); |
---|
| 1075 | } |
---|
| 1076 | |
---|
| 1077 | READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); |
---|
| 1078 | assert(uiCode <= 64); |
---|
| 1079 | pcSPS->createRPSList(uiCode); |
---|
| 1080 | |
---|
| 1081 | TComRPSList* rpsList = pcSPS->getRPSList(); |
---|
| 1082 | TComReferencePictureSet* rps; |
---|
| 1083 | |
---|
| 1084 | for(UInt i=0; i< rpsList->getNumberOfReferencePictureSets(); i++) |
---|
| 1085 | { |
---|
| 1086 | rps = rpsList->getReferencePictureSet(i); |
---|
| 1087 | parseShortTermRefPicSet(pcSPS,rps,i); |
---|
| 1088 | } |
---|
| 1089 | READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefsPresent(uiCode); |
---|
| 1090 | if (pcSPS->getLongTermRefsPresent()) |
---|
| 1091 | { |
---|
| 1092 | READ_UVLC( uiCode, "num_long_term_ref_pic_sps" ); |
---|
| 1093 | pcSPS->setNumLongTermRefPicSPS(uiCode); |
---|
| 1094 | for (UInt k = 0; k < pcSPS->getNumLongTermRefPicSPS(); k++) |
---|
| 1095 | { |
---|
| 1096 | READ_CODE( pcSPS->getBitsForPOC(), uiCode, "lt_ref_pic_poc_lsb_sps" ); |
---|
| 1097 | pcSPS->setLtRefPicPocLsbSps(k, uiCode); |
---|
| 1098 | READ_FLAG( uiCode, "used_by_curr_pic_lt_sps_flag[i]"); |
---|
| 1099 | pcSPS->setUsedByCurrPicLtSPSFlag(k, uiCode?1:0); |
---|
| 1100 | } |
---|
| 1101 | } |
---|
| 1102 | READ_FLAG( uiCode, "sps_temporal_mvp_enable_flag" ); pcSPS->setTMVPFlagsPresent(uiCode); |
---|
| 1103 | READ_FLAG( uiCode, "sps_strong_intra_smoothing_enable_flag" ); pcSPS->setUseStrongIntraSmoothing(uiCode); |
---|
| 1104 | |
---|
| 1105 | READ_FLAG( uiCode, "vui_parameters_present_flag" ); pcSPS->setVuiParametersPresentFlag(uiCode); |
---|
| 1106 | |
---|
| 1107 | if (pcSPS->getVuiParametersPresentFlag()) |
---|
| 1108 | { |
---|
| 1109 | parseVUI(pcSPS->getVuiParameters(), pcSPS); |
---|
| 1110 | } |
---|
| 1111 | |
---|
| 1112 | READ_FLAG( uiCode, "sps_extension_flag"); |
---|
[815] | 1113 | |
---|
| 1114 | #if SVC_EXTENSION |
---|
| 1115 | pcSPS->setExtensionFlag( uiCode ? true : false ); |
---|
| 1116 | |
---|
| 1117 | if( pcSPS->getExtensionFlag() ) |
---|
[313] | 1118 | { |
---|
[898] | 1119 | #if !R0042_PROFILE_INDICATION |
---|
[540] | 1120 | #if O0142_CONDITIONAL_SPS_EXTENSION |
---|
| 1121 | UInt spsExtensionTypeFlag[8]; |
---|
| 1122 | for (UInt i = 0; i < 8; i++) |
---|
| 1123 | { |
---|
| 1124 | READ_FLAG( spsExtensionTypeFlag[i], "sps_extension_type_flag" ); |
---|
| 1125 | } |
---|
| 1126 | if (spsExtensionTypeFlag[1]) |
---|
| 1127 | { |
---|
| 1128 | parseSPSExtension( pcSPS ); |
---|
| 1129 | } |
---|
| 1130 | if (spsExtensionTypeFlag[7]) |
---|
| 1131 | { |
---|
| 1132 | #else |
---|
[313] | 1133 | parseSPSExtension( pcSPS ); |
---|
| 1134 | READ_FLAG( uiCode, "sps_extension2_flag"); |
---|
| 1135 | if(uiCode) |
---|
| 1136 | { |
---|
| 1137 | #endif |
---|
| 1138 | while ( xMoreRbspData() ) |
---|
| 1139 | { |
---|
| 1140 | READ_FLAG( uiCode, "sps_extension_data_flag"); |
---|
| 1141 | } |
---|
| 1142 | } |
---|
[898] | 1143 | } |
---|
| 1144 | #else |
---|
| 1145 | READ_FLAG( uiCode, "sps_range_extension_flag" ); |
---|
| 1146 | assert(uiCode == 0); |
---|
| 1147 | READ_FLAG( uiCode, "sps_multilayer_extension_flag" ); |
---|
| 1148 | assert(uiCode == 1); |
---|
| 1149 | READ_CODE(6, uiCode, "sps_extension_6bits"); |
---|
| 1150 | assert(uiCode == 0); |
---|
| 1151 | parseSPSExtension( pcSPS ); |
---|
[815] | 1152 | } |
---|
[898] | 1153 | #endif |
---|
[815] | 1154 | #else |
---|
| 1155 | if (uiCode) |
---|
| 1156 | { |
---|
| 1157 | while ( xMoreRbspData() ) |
---|
| 1158 | { |
---|
| 1159 | READ_FLAG( uiCode, "sps_extension_data_flag"); |
---|
| 1160 | } |
---|
| 1161 | } |
---|
[313] | 1162 | #endif |
---|
| 1163 | } |
---|
| 1164 | |
---|
[815] | 1165 | #if SVC_EXTENSION |
---|
[313] | 1166 | Void TDecCavlc::parseSPSExtension( TComSPS* pcSPS ) |
---|
| 1167 | { |
---|
| 1168 | UInt uiCode; |
---|
| 1169 | // more syntax elements to be parsed here |
---|
[442] | 1170 | |
---|
| 1171 | READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" ); |
---|
| 1172 | // Vertical MV component restriction is not used in SHVC CTC |
---|
| 1173 | assert( uiCode == 0 ); |
---|
[588] | 1174 | |
---|
[849] | 1175 | #if !MOVE_SCALED_OFFSET_TO_PPS |
---|
[313] | 1176 | if( pcSPS->getLayerId() > 0 ) |
---|
| 1177 | { |
---|
[494] | 1178 | Int iCode; |
---|
[313] | 1179 | READ_UVLC( uiCode, "num_scaled_ref_layer_offsets" ); pcSPS->setNumScaledRefLayerOffsets(uiCode); |
---|
| 1180 | for(Int i = 0; i < pcSPS->getNumScaledRefLayerOffsets(); i++) |
---|
| 1181 | { |
---|
| 1182 | Window& scaledWindow = pcSPS->getScaledRefLayerWindow(i); |
---|
[540] | 1183 | #if O0098_SCALED_REF_LAYER_ID |
---|
[644] | 1184 | READ_CODE( 6, uiCode, "scaled_ref_layer_id" ); pcSPS->setScaledRefLayerId( i, uiCode ); |
---|
[540] | 1185 | #endif |
---|
[313] | 1186 | READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); |
---|
| 1187 | READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); |
---|
| 1188 | READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); |
---|
| 1189 | READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); |
---|
[644] | 1190 | #if P0312_VERT_PHASE_ADJ |
---|
| 1191 | READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode); pcSPS->setVertPhasePositionEnableFlag( pcSPS->getScaledRefLayerId(i), uiCode); |
---|
| 1192 | #endif |
---|
[313] | 1193 | } |
---|
| 1194 | } |
---|
[849] | 1195 | #endif |
---|
[313] | 1196 | } |
---|
| 1197 | #endif |
---|
| 1198 | |
---|
| 1199 | Void TDecCavlc::parseVPS(TComVPS* pcVPS) |
---|
| 1200 | { |
---|
| 1201 | UInt uiCode; |
---|
| 1202 | |
---|
| 1203 | READ_CODE( 4, uiCode, "vps_video_parameter_set_id" ); pcVPS->setVPSId( uiCode ); |
---|
[836] | 1204 | #if VPS_RESERVED_FLAGS |
---|
| 1205 | READ_FLAG( uiCode, "vps_base_layer_internal_flag"); pcVPS->setBaseLayerInternalFlag( uiCode ? true : false ); |
---|
| 1206 | READ_FLAG( uiCode, "vps_base_layer_available_flag"); pcVPS->setBaseLayerAvailableFlag( uiCode ? true : false ); |
---|
[874] | 1207 | #if VPS_AVC_BL_FLAG_REMOVAL |
---|
| 1208 | pcVPS->setNonHEVCBaseLayerFlag( (pcVPS->getBaseLayerAvailableFlag() && !pcVPS->getBaseLayerInternalFlag()) ? true : false); |
---|
| 1209 | #endif |
---|
[836] | 1210 | #else |
---|
[313] | 1211 | READ_CODE( 2, uiCode, "vps_reserved_three_2bits" ); assert(uiCode == 3); |
---|
[836] | 1212 | #endif |
---|
[815] | 1213 | #if SVC_EXTENSION |
---|
[547] | 1214 | #if O0137_MAX_LAYERID |
---|
| 1215 | READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); pcVPS->setMaxLayers( min( 62u, uiCode) + 1 ); |
---|
[313] | 1216 | #else |
---|
[547] | 1217 | READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); pcVPS->setMaxLayers( uiCode + 1 ); |
---|
| 1218 | #endif |
---|
[954] | 1219 | assert(pcVPS->getBaseLayerInternalFlag() || pcVPS->getMaxLayers() > 1); |
---|
[547] | 1220 | #else |
---|
[313] | 1221 | READ_CODE( 6, uiCode, "vps_reserved_zero_6bits" ); assert(uiCode == 0); |
---|
| 1222 | #endif |
---|
[713] | 1223 | READ_CODE( 3, uiCode, "vps_max_sub_layers_minus1" ); pcVPS->setMaxTLayers( uiCode + 1 ); assert(uiCode+1 <= MAX_TLAYER); |
---|
[313] | 1224 | READ_FLAG( uiCode, "vps_temporal_id_nesting_flag" ); pcVPS->setTemporalNestingFlag( uiCode ? true:false ); |
---|
| 1225 | assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag()); |
---|
[588] | 1226 | #if !P0125_REVERT_VPS_EXTN_OFFSET_TO_RESERVED |
---|
[442] | 1227 | #if VPS_EXTN_OFFSET |
---|
| 1228 | READ_CODE( 16, uiCode, "vps_extension_offset" ); pcVPS->setExtensionOffset( uiCode ); |
---|
| 1229 | #else |
---|
[313] | 1230 | READ_CODE( 16, uiCode, "vps_reserved_ffff_16bits" ); assert(uiCode == 0xffff); |
---|
[442] | 1231 | #endif |
---|
[588] | 1232 | #else |
---|
| 1233 | READ_CODE( 16, uiCode, "vps_reserved_ffff_16bits" ); assert(uiCode == 0xffff); |
---|
| 1234 | #endif |
---|
[313] | 1235 | parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1); |
---|
| 1236 | UInt subLayerOrderingInfoPresentFlag; |
---|
| 1237 | READ_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag"); |
---|
| 1238 | for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) |
---|
| 1239 | { |
---|
| 1240 | READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); |
---|
| 1241 | READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); |
---|
| 1242 | READ_UVLC( uiCode, "vps_max_latency_increase_plus1[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); |
---|
| 1243 | |
---|
| 1244 | if (!subLayerOrderingInfoPresentFlag) |
---|
| 1245 | { |
---|
| 1246 | for (i++; i <= pcVPS->getMaxTLayers()-1; i++) |
---|
| 1247 | { |
---|
| 1248 | pcVPS->setMaxDecPicBuffering(pcVPS->getMaxDecPicBuffering(0), i); |
---|
| 1249 | pcVPS->setNumReorderPics(pcVPS->getNumReorderPics(0), i); |
---|
| 1250 | pcVPS->setMaxLatencyIncrease(pcVPS->getMaxLatencyIncrease(0), i); |
---|
| 1251 | } |
---|
| 1252 | break; |
---|
| 1253 | } |
---|
| 1254 | } |
---|
| 1255 | |
---|
[815] | 1256 | #if SVC_EXTENSION |
---|
[313] | 1257 | assert( pcVPS->getNumHrdParameters() < MAX_VPS_LAYER_SETS_PLUS1 ); |
---|
| 1258 | assert( pcVPS->getMaxLayerId() < MAX_VPS_LAYER_ID_PLUS1 ); |
---|
| 1259 | READ_CODE( 6, uiCode, "vps_max_layer_id" ); pcVPS->setMaxLayerId( uiCode ); |
---|
[815] | 1260 | #if Q0078_ADD_LAYER_SETS |
---|
| 1261 | READ_UVLC(uiCode, "vps_num_layer_sets_minus1"); pcVPS->setVpsNumLayerSetsMinus1(uiCode); |
---|
| 1262 | pcVPS->setNumLayerSets(pcVPS->getVpsNumLayerSetsMinus1() + 1); |
---|
| 1263 | for (UInt opsIdx = 1; opsIdx <= pcVPS->getVpsNumLayerSetsMinus1(); opsIdx++) |
---|
| 1264 | #else |
---|
[313] | 1265 | READ_UVLC( uiCode, "vps_num_layer_sets_minus1" ); pcVPS->setNumLayerSets( uiCode + 1 ); |
---|
| 1266 | for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getNumLayerSets() - 1 ); opsIdx ++ ) |
---|
[815] | 1267 | #endif |
---|
[313] | 1268 | { |
---|
| 1269 | // Operation point set |
---|
| 1270 | for( UInt i = 0; i <= pcVPS->getMaxLayerId(); i ++ ) |
---|
| 1271 | #else |
---|
| 1272 | assert( pcVPS->getNumHrdParameters() < MAX_VPS_OP_SETS_PLUS1 ); |
---|
| 1273 | assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 ); |
---|
| 1274 | READ_CODE( 6, uiCode, "vps_max_nuh_reserved_zero_layer_id" ); pcVPS->setMaxNuhReservedZeroLayerId( uiCode ); |
---|
| 1275 | READ_UVLC( uiCode, "vps_max_op_sets_minus1" ); pcVPS->setMaxOpSets( uiCode + 1 ); |
---|
| 1276 | for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getMaxOpSets() - 1 ); opsIdx ++ ) |
---|
| 1277 | { |
---|
| 1278 | // Operation point set |
---|
| 1279 | for( UInt i = 0; i <= pcVPS->getMaxNuhReservedZeroLayerId(); i ++ ) |
---|
| 1280 | #endif |
---|
| 1281 | { |
---|
| 1282 | READ_FLAG( uiCode, "layer_id_included_flag[opsIdx][i]" ); pcVPS->setLayerIdIncludedFlag( uiCode == 1 ? true : false, opsIdx, i ); |
---|
| 1283 | } |
---|
| 1284 | } |
---|
| 1285 | #if DERIVE_LAYER_ID_LIST_VARIABLES |
---|
| 1286 | pcVPS->deriveLayerIdListVariables(); |
---|
| 1287 | #endif |
---|
| 1288 | TimingInfo *timingInfo = pcVPS->getTimingInfo(); |
---|
| 1289 | READ_FLAG( uiCode, "vps_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); |
---|
| 1290 | if(timingInfo->getTimingInfoPresentFlag()) |
---|
| 1291 | { |
---|
| 1292 | READ_CODE( 32, uiCode, "vps_num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode); |
---|
| 1293 | READ_CODE( 32, uiCode, "vps_time_scale"); timingInfo->setTimeScale (uiCode); |
---|
| 1294 | READ_FLAG( uiCode, "vps_poc_proportional_to_timing_flag"); timingInfo->setPocProportionalToTimingFlag(uiCode ? true : false); |
---|
| 1295 | if(timingInfo->getPocProportionalToTimingFlag()) |
---|
| 1296 | { |
---|
| 1297 | READ_UVLC( uiCode, "vps_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); |
---|
| 1298 | } |
---|
| 1299 | READ_UVLC( uiCode, "vps_num_hrd_parameters" ); pcVPS->setNumHrdParameters( uiCode ); |
---|
| 1300 | |
---|
| 1301 | if( pcVPS->getNumHrdParameters() > 0 ) |
---|
| 1302 | { |
---|
| 1303 | pcVPS->createHrdParamBuffer(); |
---|
| 1304 | } |
---|
| 1305 | for( UInt i = 0; i < pcVPS->getNumHrdParameters(); i ++ ) |
---|
| 1306 | { |
---|
| 1307 | READ_UVLC( uiCode, "hrd_op_set_idx" ); pcVPS->setHrdOpSetIdx( uiCode, i ); |
---|
| 1308 | if( i > 0 ) |
---|
| 1309 | { |
---|
| 1310 | READ_FLAG( uiCode, "cprms_present_flag[i]" ); pcVPS->setCprmsPresentFlag( uiCode == 1 ? true : false, i ); |
---|
| 1311 | } |
---|
[823] | 1312 | else |
---|
| 1313 | { |
---|
| 1314 | pcVPS->setCprmsPresentFlag( true, i ); |
---|
| 1315 | } |
---|
| 1316 | |
---|
[313] | 1317 | parseHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); |
---|
| 1318 | } |
---|
| 1319 | } |
---|
[713] | 1320 | |
---|
[815] | 1321 | #if SVC_EXTENSION |
---|
[713] | 1322 | READ_FLAG( uiCode, "vps_extension_flag" ); pcVPS->setVpsExtensionFlag( uiCode ? true : false ); |
---|
| 1323 | |
---|
| 1324 | // When MaxLayersMinus1 is greater than 0, vps_extension_flag shall be equal to 1. |
---|
| 1325 | if( pcVPS->getMaxLayers() > 1 ) |
---|
[313] | 1326 | { |
---|
[713] | 1327 | assert( pcVPS->getVpsExtensionFlag() == true ); |
---|
| 1328 | } |
---|
| 1329 | |
---|
| 1330 | if( pcVPS->getVpsExtensionFlag() ) |
---|
| 1331 | { |
---|
[442] | 1332 | while ( m_pcBitstream->getNumBitsRead() % 8 != 0 ) |
---|
| 1333 | { |
---|
| 1334 | READ_FLAG( uiCode, "vps_extension_alignment_bit_equal_to_one"); assert(uiCode == 1); |
---|
| 1335 | } |
---|
[313] | 1336 | parseVPSExtension(pcVPS); |
---|
| 1337 | READ_FLAG( uiCode, "vps_entension2_flag" ); |
---|
| 1338 | if(uiCode) |
---|
| 1339 | { |
---|
| 1340 | while ( xMoreRbspData() ) |
---|
| 1341 | { |
---|
| 1342 | READ_FLAG( uiCode, "vps_extension_data_flag"); |
---|
| 1343 | } |
---|
| 1344 | } |
---|
[713] | 1345 | } |
---|
| 1346 | else |
---|
| 1347 | { |
---|
| 1348 | // set default parameters when syntax elements are not present |
---|
| 1349 | defaultVPSExtension(pcVPS); |
---|
| 1350 | } |
---|
[313] | 1351 | #else |
---|
[713] | 1352 | READ_FLAG( uiCode, "vps_extension_flag" ); |
---|
| 1353 | if (uiCode) |
---|
| 1354 | { |
---|
[313] | 1355 | while ( xMoreRbspData() ) |
---|
| 1356 | { |
---|
| 1357 | READ_FLAG( uiCode, "vps_extension_data_flag"); |
---|
| 1358 | } |
---|
[713] | 1359 | } |
---|
[313] | 1360 | #endif |
---|
| 1361 | |
---|
| 1362 | return; |
---|
| 1363 | } |
---|
| 1364 | |
---|
[494] | 1365 | #if SVC_EXTENSION |
---|
[313] | 1366 | Void TDecCavlc::parseVPSExtension(TComVPS *vps) |
---|
| 1367 | { |
---|
| 1368 | UInt uiCode; |
---|
| 1369 | // ... More syntax elements to be parsed here |
---|
[644] | 1370 | #if P0300_ALT_OUTPUT_LAYER_FLAG |
---|
| 1371 | Int NumOutputLayersInOutputLayerSet[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
| 1372 | Int OlsHighestOutputLayerId[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
| 1373 | #endif |
---|
[864] | 1374 | #if LIST_OF_PTL |
---|
| 1375 | if( vps->getMaxLayers() > 1 && vps->getBaseLayerInternalFlag() ) |
---|
| 1376 | { |
---|
| 1377 | vps->setProfilePresentFlag(1, false); |
---|
[942] | 1378 | #if MULTIPLE_PTL_SUPPORT |
---|
| 1379 | parsePTL( vps->getPTL(1), vps->getProfilePresentFlag(1), vps->getMaxTLayers() - 1 ); |
---|
| 1380 | #else |
---|
[864] | 1381 | vps->getPTLForExtnPtr()->empty(); |
---|
| 1382 | vps->getPTLForExtnPtr()->resize(2); |
---|
| 1383 | vps->getPTLForExtn(1)->copyProfileInfo( vps->getPTL() ); |
---|
| 1384 | parsePTL( vps->getPTLForExtn(1), vps->getProfilePresentFlag(1), vps->getMaxTLayers() - 1 ); |
---|
[941] | 1385 | #endif |
---|
[864] | 1386 | } |
---|
| 1387 | #endif |
---|
[313] | 1388 | #if VPS_EXTN_MASK_AND_DIM_INFO |
---|
| 1389 | UInt numScalabilityTypes = 0, i = 0, j = 0; |
---|
| 1390 | |
---|
[874] | 1391 | #if !VPS_AVC_BL_FLAG_REMOVAL |
---|
[313] | 1392 | READ_FLAG( uiCode, "avc_base_layer_flag" ); vps->setAvcBaseLayerFlag(uiCode ? true : false); |
---|
[874] | 1393 | #endif |
---|
[547] | 1394 | |
---|
[588] | 1395 | #if !P0307_REMOVE_VPS_VUI_OFFSET |
---|
[547] | 1396 | #if O0109_MOVE_VPS_VUI_FLAG |
---|
| 1397 | READ_FLAG( uiCode, "vps_vui_present_flag"); vps->setVpsVuiPresentFlag(uiCode ? true : false); |
---|
| 1398 | if ( uiCode ) |
---|
| 1399 | { |
---|
| 1400 | #endif |
---|
| 1401 | #if VPS_VUI_OFFSET |
---|
[825] | 1402 | READ_CODE( 16, uiCode, "vps_vui_offset" ); vps->setVpsVuiOffset( uiCode ); |
---|
[547] | 1403 | #endif |
---|
| 1404 | #if O0109_MOVE_VPS_VUI_FLAG |
---|
| 1405 | } |
---|
| 1406 | #endif |
---|
[588] | 1407 | #endif |
---|
[313] | 1408 | READ_FLAG( uiCode, "splitting_flag" ); vps->setSplittingFlag(uiCode ? true : false); |
---|
| 1409 | |
---|
| 1410 | for(i = 0; i < MAX_VPS_NUM_SCALABILITY_TYPES; i++) |
---|
| 1411 | { |
---|
| 1412 | READ_FLAG( uiCode, "scalability_mask[i]" ); vps->setScalabilityMask(i, uiCode ? true : false); |
---|
| 1413 | numScalabilityTypes += uiCode; |
---|
| 1414 | } |
---|
| 1415 | vps->setNumScalabilityTypes(numScalabilityTypes); |
---|
| 1416 | |
---|
| 1417 | for(j = 0; j < numScalabilityTypes - vps->getSplittingFlag(); j++) |
---|
| 1418 | { |
---|
| 1419 | READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" ); vps->setDimensionIdLen(j, uiCode + 1); |
---|
| 1420 | } |
---|
[494] | 1421 | |
---|
[815] | 1422 | // The value of dimBitOffset[ NumScalabilityTypes ] is set equal to 6. |
---|
[313] | 1423 | if(vps->getSplittingFlag()) |
---|
| 1424 | { |
---|
| 1425 | UInt numBits = 0; |
---|
| 1426 | for(j = 0; j < numScalabilityTypes - 1; j++) |
---|
| 1427 | { |
---|
| 1428 | numBits += vps->getDimensionIdLen(j); |
---|
| 1429 | } |
---|
| 1430 | assert( numBits < 6 ); |
---|
| 1431 | vps->setDimensionIdLen(numScalabilityTypes-1, 6 - numBits); |
---|
| 1432 | numBits = 6; |
---|
| 1433 | } |
---|
| 1434 | |
---|
| 1435 | READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" ); vps->setNuhLayerIdPresentFlag(uiCode ? true : false); |
---|
| 1436 | vps->setLayerIdInNuh(0, 0); |
---|
| 1437 | vps->setLayerIdInVps(0, 0); |
---|
| 1438 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 1439 | { |
---|
| 1440 | if( vps->getNuhLayerIdPresentFlag() ) |
---|
| 1441 | { |
---|
| 1442 | READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" ); vps->setLayerIdInNuh(i, uiCode); |
---|
| 1443 | assert( uiCode > vps->getLayerIdInNuh(i-1) ); |
---|
| 1444 | } |
---|
| 1445 | else |
---|
| 1446 | { |
---|
| 1447 | vps->setLayerIdInNuh(i, i); |
---|
| 1448 | } |
---|
| 1449 | vps->setLayerIdInVps(vps->getLayerIdInNuh(i), i); |
---|
| 1450 | |
---|
[494] | 1451 | if( !vps->getSplittingFlag() ) |
---|
| 1452 | { |
---|
[825] | 1453 | for(j = 0; j < numScalabilityTypes; j++) |
---|
| 1454 | { |
---|
| 1455 | READ_CODE( vps->getDimensionIdLen(j), uiCode, "dimension_id[i][j]" ); vps->setDimensionId(i, j, uiCode); |
---|
[494] | 1456 | #if !AUXILIARY_PICTURES |
---|
[825] | 1457 | assert( uiCode <= vps->getMaxLayerId() ); |
---|
[494] | 1458 | #endif |
---|
[825] | 1459 | } |
---|
[313] | 1460 | } |
---|
| 1461 | } |
---|
| 1462 | #endif |
---|
[494] | 1463 | #if VIEW_ID_RELATED_SIGNALING |
---|
| 1464 | // if ( pcVPS->getNumViews() > 1 ) |
---|
| 1465 | // However, this is a bug in the text since, view_id_len_minus1 is needed to parse view_id_val. |
---|
[442] | 1466 | { |
---|
[547] | 1467 | #if O0109_VIEW_ID_LEN |
---|
| 1468 | READ_CODE( 4, uiCode, "view_id_len" ); vps->setViewIdLen( uiCode ); |
---|
| 1469 | #else |
---|
[442] | 1470 | READ_CODE( 4, uiCode, "view_id_len_minus1" ); vps->setViewIdLenMinus1( uiCode ); |
---|
[547] | 1471 | #endif |
---|
[442] | 1472 | } |
---|
| 1473 | |
---|
[547] | 1474 | #if O0109_VIEW_ID_LEN |
---|
| 1475 | if ( vps->getViewIdLen() > 0 ) |
---|
| 1476 | { |
---|
| 1477 | for( i = 0; i < vps->getNumViews(); i++ ) |
---|
| 1478 | { |
---|
| 1479 | READ_CODE( vps->getViewIdLen( ), uiCode, "view_id_val[i]" ); vps->setViewIdVal( i, uiCode ); |
---|
| 1480 | } |
---|
| 1481 | } |
---|
| 1482 | #else |
---|
[442] | 1483 | for( i = 0; i < vps->getNumViews(); i++ ) |
---|
| 1484 | { |
---|
| 1485 | READ_CODE( vps->getViewIdLenMinus1( ) + 1, uiCode, "view_id_val[i]" ); vps->setViewIdVal( i, uiCode ); |
---|
| 1486 | } |
---|
| 1487 | #endif |
---|
[547] | 1488 | #endif // view id related signaling |
---|
[313] | 1489 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 1490 | // For layer 0 |
---|
| 1491 | vps->setNumDirectRefLayers(0, 0); |
---|
| 1492 | // For other layers |
---|
| 1493 | for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++) |
---|
| 1494 | { |
---|
| 1495 | UInt numDirectRefLayers = 0; |
---|
| 1496 | for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++) |
---|
| 1497 | { |
---|
| 1498 | READ_FLAG(uiCode, "direct_dependency_flag[i][j]" ); vps->setDirectDependencyFlag(layerCtr, refLayerCtr, uiCode? true : false); |
---|
| 1499 | if(uiCode) |
---|
| 1500 | { |
---|
| 1501 | vps->setRefLayerId(layerCtr, numDirectRefLayers, refLayerCtr); |
---|
| 1502 | numDirectRefLayers++; |
---|
| 1503 | } |
---|
| 1504 | } |
---|
| 1505 | vps->setNumDirectRefLayers(layerCtr, numDirectRefLayers); |
---|
| 1506 | } |
---|
| 1507 | #endif |
---|
[815] | 1508 | #if Q0078_ADD_LAYER_SETS |
---|
| 1509 | #if O0092_0094_DEPENDENCY_CONSTRAINT // Moved here |
---|
| 1510 | vps->setNumRefLayers(); |
---|
| 1511 | |
---|
| 1512 | if (vps->getMaxLayers() > MAX_REF_LAYERS) |
---|
| 1513 | { |
---|
| 1514 | for (i = 1; i < vps->getMaxLayers(); i++) |
---|
| 1515 | { |
---|
| 1516 | assert(vps->getNumRefLayers(vps->getLayerIdInNuh(i)) <= MAX_REF_LAYERS); |
---|
| 1517 | } |
---|
| 1518 | } |
---|
| 1519 | #endif |
---|
| 1520 | vps->setPredictedLayerIds(); |
---|
| 1521 | vps->setTreePartitionLayerIdList(); |
---|
| 1522 | #endif |
---|
[862] | 1523 | #if MOVE_ADDN_LS_SIGNALLING |
---|
| 1524 | #if Q0078_ADD_LAYER_SETS |
---|
| 1525 | if (vps->getNumIndependentLayers() > 1) |
---|
| 1526 | { |
---|
| 1527 | READ_UVLC(uiCode, "num_add_layer_sets"); vps->setNumAddLayerSets(uiCode); |
---|
| 1528 | for (i = 0; i < vps->getNumAddLayerSets(); i++) |
---|
| 1529 | { |
---|
| 1530 | for (j = 1; j < vps->getNumIndependentLayers(); j++) |
---|
| 1531 | { |
---|
| 1532 | int len = 1; |
---|
| 1533 | while ((1 << len) < (vps->getNumLayersInTreePartition(j) + 1)) |
---|
| 1534 | { |
---|
| 1535 | len++; |
---|
| 1536 | } |
---|
| 1537 | READ_CODE(len, uiCode, "highest_layer_idx_plus1[i][j]"); vps->setHighestLayerIdxPlus1(i, j, uiCode); |
---|
| 1538 | } |
---|
| 1539 | } |
---|
| 1540 | vps->setNumLayerSets(vps->getNumLayerSets() + vps->getNumAddLayerSets()); |
---|
[908] | 1541 | #if FIX_LAYER_ID_INIT |
---|
| 1542 | vps->deriveLayerIdListVariablesForAddLayerSets(); |
---|
| 1543 | #else |
---|
[862] | 1544 | vps->setLayerIdIncludedFlagsForAddLayerSets(); |
---|
[908] | 1545 | #endif |
---|
[862] | 1546 | } |
---|
| 1547 | #endif |
---|
| 1548 | #endif |
---|
[540] | 1549 | #if VPS_TSLAYERS |
---|
[713] | 1550 | READ_FLAG( uiCode, "vps_sub_layers_max_minus1_present_flag"); vps->setMaxTSLayersPresentFlag(uiCode ? true : false); |
---|
| 1551 | |
---|
| 1552 | if (vps->getMaxTSLayersPresentFlag()) |
---|
| 1553 | { |
---|
| 1554 | for(i = 0; i < vps->getMaxLayers(); i++) |
---|
[540] | 1555 | { |
---|
[713] | 1556 | READ_CODE( 3, uiCode, "sub_layers_vps_max_minus1[i]" ); vps->setMaxTSLayersMinus1(i, uiCode); |
---|
[540] | 1557 | } |
---|
[713] | 1558 | } |
---|
| 1559 | else |
---|
| 1560 | { |
---|
| 1561 | for( i = 0; i < vps->getMaxLayers(); i++) |
---|
[540] | 1562 | { |
---|
[713] | 1563 | vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1); |
---|
[540] | 1564 | } |
---|
[713] | 1565 | } |
---|
[540] | 1566 | #endif |
---|
[442] | 1567 | READ_FLAG( uiCode, "max_tid_ref_present_flag"); vps->setMaxTidRefPresentFlag(uiCode ? true : false); |
---|
| 1568 | if (vps->getMaxTidRefPresentFlag()) |
---|
[345] | 1569 | { |
---|
| 1570 | for(i = 0; i < vps->getMaxLayers() - 1; i++) |
---|
| 1571 | { |
---|
[494] | 1572 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
[825] | 1573 | for( j = i+1; j <= vps->getMaxLayers() - 1; j++) |
---|
| 1574 | { |
---|
| 1575 | if(vps->getDirectDependencyFlag(j, i)) |
---|
| 1576 | { |
---|
[885] | 1577 | READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i][j]" ); vps->setMaxTidIlRefPicsPlus1(i, j, uiCode); |
---|
[825] | 1578 | } |
---|
| 1579 | } |
---|
[494] | 1580 | #else |
---|
[442] | 1581 | READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i]" ); vps->setMaxTidIlRefPicsPlus1(i, uiCode); |
---|
| 1582 | assert( uiCode <= vps->getMaxTLayers()); |
---|
| 1583 | #endif |
---|
[345] | 1584 | } |
---|
| 1585 | } |
---|
[494] | 1586 | else |
---|
[345] | 1587 | { |
---|
| 1588 | for(i = 0; i < vps->getMaxLayers() - 1; i++) |
---|
| 1589 | { |
---|
[494] | 1590 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
[825] | 1591 | for( j = i+1; j <= vps->getMaxLayers() - 1; j++) |
---|
| 1592 | { |
---|
| 1593 | vps->setMaxTidIlRefPicsPlus1(i, j, 7); |
---|
| 1594 | } |
---|
[494] | 1595 | #else |
---|
[442] | 1596 | vps->setMaxTidIlRefPicsPlus1(i, 7); |
---|
[494] | 1597 | #endif |
---|
[345] | 1598 | } |
---|
| 1599 | } |
---|
[815] | 1600 | READ_FLAG( uiCode, "all_ref_layers_active_flag" ); vps->setIlpSshSignalingEnabledFlag(uiCode ? true : false); |
---|
[313] | 1601 | #if VPS_EXTN_PROFILE_INFO |
---|
| 1602 | // Profile-tier-level signalling |
---|
[588] | 1603 | #if !VPS_EXTN_UEV_CODING |
---|
[313] | 1604 | READ_CODE( 10, uiCode, "vps_number_layer_sets_minus1" ); assert( uiCode == (vps->getNumLayerSets() - 1) ); |
---|
| 1605 | READ_CODE( 6, uiCode, "vps_num_profile_tier_level_minus1"); vps->setNumProfileTierLevel( uiCode + 1 ); |
---|
[588] | 1606 | #else |
---|
[942] | 1607 | READ_UVLC( uiCode, "vps_num_profile_tier_level_minus1"); vps->setNumProfileTierLevel( uiCode + 1 ); |
---|
[588] | 1608 | #endif |
---|
[866] | 1609 | #if PER_LAYER_PTL |
---|
| 1610 | Int const numBitsForPtlIdx = vps->calculateLenOfSyntaxElement( vps->getNumProfileTierLevel() ); |
---|
| 1611 | #endif |
---|
[941] | 1612 | #if !MULTIPLE_PTL_SUPPORT |
---|
[313] | 1613 | vps->getPTLForExtnPtr()->resize(vps->getNumProfileTierLevel()); |
---|
[941] | 1614 | #endif |
---|
[864] | 1615 | #if LIST_OF_PTL |
---|
| 1616 | for(Int idx = vps->getBaseLayerInternalFlag() ? 2 : 1; idx <= vps->getNumProfileTierLevel() - 1; idx++) |
---|
| 1617 | #else |
---|
[313] | 1618 | for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++) |
---|
[864] | 1619 | #endif |
---|
[313] | 1620 | { |
---|
[941] | 1621 | READ_FLAG( uiCode, "vps_profile_present_flag[i]" ); |
---|
| 1622 | vps->setProfilePresentFlag(idx, uiCode ? true : false); |
---|
[313] | 1623 | if( !vps->getProfilePresentFlag(idx) ) |
---|
| 1624 | { |
---|
[588] | 1625 | #if P0048_REMOVE_PROFILE_REF |
---|
| 1626 | // Copy profile information from previous one |
---|
[942] | 1627 | #if MULTIPLE_PTL_SUPPORT |
---|
| 1628 | vps->getPTL(idx)->copyProfileInfo( vps->getPTL( idx - 1 ) ); |
---|
| 1629 | #else |
---|
[588] | 1630 | vps->getPTLForExtn(idx)->copyProfileInfo( (idx==1) ? vps->getPTL() : vps->getPTLForExtn( idx - 1 ) ); |
---|
[941] | 1631 | #endif |
---|
| 1632 | #else |
---|
[313] | 1633 | READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); vps->setProfileLayerSetRef(idx, uiCode + 1); |
---|
[547] | 1634 | #if O0109_PROF_REF_MINUS1 |
---|
| 1635 | assert( vps->getProfileLayerSetRef(idx) <= idx ); |
---|
| 1636 | #else |
---|
[313] | 1637 | assert( vps->getProfileLayerSetRef(idx) < idx ); |
---|
[547] | 1638 | #endif |
---|
[313] | 1639 | // Copy profile information as indicated |
---|
| 1640 | vps->getPTLForExtn(idx)->copyProfileInfo( vps->getPTLForExtn( vps->getProfileLayerSetRef(idx) ) ); |
---|
[588] | 1641 | #endif |
---|
[313] | 1642 | } |
---|
[942] | 1643 | #if MULTIPLE_PTL_SUPPORT |
---|
| 1644 | parsePTL( vps->getPTL(idx), vps->getProfilePresentFlag(idx), vps->getMaxTLayers() - 1 ); |
---|
| 1645 | #else |
---|
[313] | 1646 | parsePTL( vps->getPTLForExtn(idx), vps->getProfilePresentFlag(idx), vps->getMaxTLayers() - 1 ); |
---|
[941] | 1647 | #endif |
---|
[313] | 1648 | } |
---|
| 1649 | #endif |
---|
| 1650 | |
---|
[862] | 1651 | #if !MOVE_ADDN_LS_SIGNALLING |
---|
[815] | 1652 | #if Q0078_ADD_LAYER_SETS |
---|
| 1653 | if (vps->getNumIndependentLayers() > 1) |
---|
| 1654 | { |
---|
| 1655 | READ_UVLC(uiCode, "num_add_layer_sets"); vps->setNumAddLayerSets(uiCode); |
---|
| 1656 | for (i = 0; i < vps->getNumAddLayerSets(); i++) |
---|
| 1657 | { |
---|
| 1658 | for (j = 1; j < vps->getNumIndependentLayers(); j++) |
---|
| 1659 | { |
---|
| 1660 | int len = 1; |
---|
| 1661 | while ((1 << len) < (vps->getNumLayersInTreePartition(j) + 1)) |
---|
| 1662 | { |
---|
| 1663 | len++; |
---|
| 1664 | } |
---|
| 1665 | READ_CODE(len, uiCode, "highest_layer_idx_plus1[i][j]"); vps->setHighestLayerIdxPlus1(i, j, uiCode); |
---|
| 1666 | } |
---|
| 1667 | } |
---|
| 1668 | vps->setNumLayerSets(vps->getNumLayerSets() + vps->getNumAddLayerSets()); |
---|
| 1669 | vps->setLayerIdIncludedFlagsForAddLayerSets(); |
---|
| 1670 | } |
---|
| 1671 | #endif |
---|
[862] | 1672 | #endif |
---|
[815] | 1673 | |
---|
[588] | 1674 | #if !VPS_EXTN_UEV_CODING |
---|
[313] | 1675 | READ_FLAG( uiCode, "more_output_layer_sets_than_default_flag" ); vps->setMoreOutputLayerSetsThanDefaultFlag( uiCode ? true : false ); |
---|
| 1676 | Int numOutputLayerSets = 0; |
---|
| 1677 | if(! vps->getMoreOutputLayerSetsThanDefaultFlag() ) |
---|
| 1678 | { |
---|
| 1679 | numOutputLayerSets = vps->getNumLayerSets(); |
---|
| 1680 | } |
---|
| 1681 | else |
---|
| 1682 | { |
---|
| 1683 | READ_CODE( 10, uiCode, "num_add_output_layer_sets" ); vps->setNumAddOutputLayerSets( uiCode ); |
---|
| 1684 | numOutputLayerSets = vps->getNumLayerSets() + vps->getNumAddOutputLayerSets(); |
---|
| 1685 | } |
---|
[588] | 1686 | #else |
---|
[713] | 1687 | |
---|
| 1688 | #if Q0165_NUM_ADD_OUTPUT_LAYER_SETS |
---|
| 1689 | if( vps->getNumLayerSets() > 1 ) |
---|
| 1690 | { |
---|
[942] | 1691 | READ_UVLC( uiCode, "num_add_olss" ); vps->setNumAddOutputLayerSets( uiCode ); |
---|
[815] | 1692 | READ_CODE( 2, uiCode, "default_output_layer_idc" ); vps->setDefaultTargetOutputLayerIdc( uiCode ); |
---|
[713] | 1693 | } |
---|
| 1694 | else |
---|
| 1695 | { |
---|
| 1696 | vps->setNumAddOutputLayerSets( 0 ); |
---|
| 1697 | } |
---|
| 1698 | #else |
---|
[588] | 1699 | READ_UVLC( uiCode, "num_add_output_layer_sets" ); vps->setNumAddOutputLayerSets( uiCode ); |
---|
[713] | 1700 | #endif |
---|
| 1701 | |
---|
[815] | 1702 | // The value of num_add_olss shall be in the range of 0 to 1023, inclusive. |
---|
[713] | 1703 | assert( vps->getNumAddOutputLayerSets() >= 0 && vps->getNumAddOutputLayerSets() < 1024 ); |
---|
| 1704 | |
---|
[588] | 1705 | Int numOutputLayerSets = vps->getNumLayerSets() + vps->getNumAddOutputLayerSets(); |
---|
| 1706 | #endif |
---|
| 1707 | |
---|
| 1708 | #if P0295_DEFAULT_OUT_LAYER_IDC |
---|
[713] | 1709 | #if !Q0165_NUM_ADD_OUTPUT_LAYER_SETS |
---|
[313] | 1710 | if( numOutputLayerSets > 1 ) |
---|
| 1711 | { |
---|
[588] | 1712 | READ_CODE( 2, uiCode, "default_target_output_layer_idc" ); vps->setDefaultTargetOutputLayerIdc( uiCode ); |
---|
| 1713 | } |
---|
[713] | 1714 | #endif |
---|
[588] | 1715 | vps->setNumOutputLayerSets( numOutputLayerSets ); |
---|
[865] | 1716 | #if NECESSARY_LAYER_FLAG |
---|
| 1717 | // Default output layer set |
---|
| 1718 | vps->setOutputLayerSetIdx(0, 0); |
---|
| 1719 | vps->setOutputLayerFlag(0, 0, true); |
---|
| 1720 | vps->deriveNecessaryLayerFlag(0); |
---|
[866] | 1721 | #if PER_LAYER_PTL |
---|
| 1722 | vps->getProfileLevelTierIdx()->resize(numOutputLayerSets); |
---|
| 1723 | vps->getProfileLevelTierIdx(0)->push_back( vps->getBaseLayerInternalFlag() && vps->getMaxLayers() > 1 ? 1 : 0); |
---|
[865] | 1724 | #endif |
---|
[866] | 1725 | #endif |
---|
[588] | 1726 | for(i = 1; i < numOutputLayerSets; i++) |
---|
| 1727 | { |
---|
| 1728 | if( i > (vps->getNumLayerSets() - 1) ) |
---|
| 1729 | { |
---|
| 1730 | Int numBits = 1; |
---|
| 1731 | while ((1 << numBits) < (vps->getNumLayerSets() - 1)) |
---|
| 1732 | { |
---|
| 1733 | numBits++; |
---|
| 1734 | } |
---|
[815] | 1735 | READ_CODE( numBits, uiCode, "layer_set_idx_for_ols_minus1"); vps->setOutputLayerSetIdx( i, uiCode + 1); |
---|
[588] | 1736 | } |
---|
| 1737 | else |
---|
| 1738 | { |
---|
| 1739 | vps->setOutputLayerSetIdx( i, i ); |
---|
| 1740 | } |
---|
[866] | 1741 | Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx(i); |
---|
[815] | 1742 | #if Q0078_ADD_LAYER_SETS |
---|
| 1743 | if ( i > vps->getVpsNumLayerSetsMinus1() || vps->getDefaultTargetOutputLayerIdc() >= 2 ) |
---|
| 1744 | #else |
---|
[588] | 1745 | if ( i > (vps->getNumLayerSets() - 1) || vps->getDefaultTargetOutputLayerIdc() >= 2 ) |
---|
[815] | 1746 | #endif |
---|
[588] | 1747 | { |
---|
[644] | 1748 | #if NUM_OL_FLAGS |
---|
[866] | 1749 | for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++) |
---|
[644] | 1750 | #else |
---|
[588] | 1751 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++) |
---|
[644] | 1752 | #endif |
---|
[588] | 1753 | { |
---|
| 1754 | READ_FLAG( uiCode, "output_layer_flag[i][j]"); vps->setOutputLayerFlag(i, j, uiCode); |
---|
| 1755 | } |
---|
| 1756 | } |
---|
| 1757 | else |
---|
| 1758 | { |
---|
| 1759 | // i <= (vps->getNumLayerSets() - 1) |
---|
| 1760 | // Assign OutputLayerFlag depending on default_one_target_output_layer_flag |
---|
| 1761 | if( vps->getDefaultTargetOutputLayerIdc() == 1 ) |
---|
| 1762 | { |
---|
[866] | 1763 | for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++) |
---|
[588] | 1764 | { |
---|
[893] | 1765 | #if DEF_OPT_LAYER_IDC |
---|
| 1766 | vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet)-1)) ); |
---|
| 1767 | |
---|
| 1768 | #else |
---|
[866] | 1769 | vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet)-1)) && (vps->getDimensionId(j,1) == 0) ); |
---|
[893] | 1770 | #endif |
---|
[588] | 1771 | } |
---|
| 1772 | } |
---|
| 1773 | else if ( vps->getDefaultTargetOutputLayerIdc() == 0 ) |
---|
| 1774 | { |
---|
[866] | 1775 | for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++) |
---|
[588] | 1776 | { |
---|
| 1777 | vps->setOutputLayerFlag(i, j, 1); |
---|
| 1778 | } |
---|
| 1779 | } |
---|
| 1780 | } |
---|
[865] | 1781 | #if NECESSARY_LAYER_FLAG |
---|
| 1782 | vps->deriveNecessaryLayerFlag(i); |
---|
| 1783 | #endif |
---|
[866] | 1784 | #if PER_LAYER_PTL |
---|
| 1785 | vps->getProfileLevelTierIdx(i)->assign(vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet), -1); |
---|
| 1786 | for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet) ; j++) |
---|
| 1787 | { |
---|
| 1788 | if( vps->getNecessaryLayerFlag(i, j) ) |
---|
| 1789 | { |
---|
| 1790 | READ_CODE( numBitsForPtlIdx, uiCode, "profile_level_tier_idx[i]" ); |
---|
| 1791 | vps->setProfileLevelTierIdx(i, j, uiCode ); |
---|
[951] | 1792 | #if MULTIPLE_PTL_SUPPORT |
---|
| 1793 | //For conformance checking |
---|
| 1794 | //Conformance of a layer in an output operation point associated with an OLS in a bitstream to the Scalable Main profile is indicated as follows: |
---|
| 1795 | //If OpTid of the output operation point is equal to vps_max_sub_layer_minus1, the conformance is indicated by general_profile_idc being equal to 7 or general_profile_compatibility_flag[ 7 ] being equal to 1 |
---|
| 1796 | //Conformance of a layer in an output operation point associated with an OLS in a bitstream to the Scalable Main 10 profile is indicated as follows: |
---|
| 1797 | //If OpTid of the output operation point is equal to vps_max_sub_layer_minus1, the conformance is indicated by general_profile_idc being equal to 7 or general_profile_compatibility_flag[ 7 ] being equal to 1 |
---|
| 1798 | //The following assert may be updated / upgraded to take care of general_profile_compatibility_flag. |
---|
| 1799 | if (j > 0 && vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j) != 0 && vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j - 1) != 0) |
---|
| 1800 | { |
---|
| 1801 | assert(vps->getPTL(vps->getProfileLevelTierIdx(i, j))->getGeneralPTL()->getProfileIdc() == vps->getPTL(vps->getProfileLevelTierIdx(i, j - 1))->getGeneralPTL()->getProfileIdc() || |
---|
| 1802 | vps->getPTL(vps->getProfileLevelTierIdx(i, j - 1))->getGeneralPTL()->getProfileCompatibilityFlag(vps->getPTL(vps->getProfileLevelTierIdx(i, j))->getGeneralPTL()->getProfileIdc()) || |
---|
| 1803 | vps->getPTL(vps->getProfileLevelTierIdx(i, j))->getGeneralPTL()->getProfileCompatibilityFlag(vps->getPTL(vps->getProfileLevelTierIdx(i, j - 1))->getGeneralPTL()->getProfileIdc()) ); |
---|
| 1804 | } |
---|
| 1805 | #endif |
---|
[866] | 1806 | } |
---|
| 1807 | } |
---|
| 1808 | #else |
---|
[588] | 1809 | Int numBits = 1; |
---|
| 1810 | while ((1 << numBits) < (vps->getNumProfileTierLevel())) |
---|
| 1811 | { |
---|
| 1812 | numBits++; |
---|
| 1813 | } |
---|
| 1814 | READ_CODE( numBits, uiCode, "profile_level_tier_idx[i]" ); vps->setProfileLevelTierIdx(i, uiCode); |
---|
[866] | 1815 | #endif |
---|
[644] | 1816 | #if P0300_ALT_OUTPUT_LAYER_FLAG |
---|
| 1817 | NumOutputLayersInOutputLayerSet[i] = 0; |
---|
| 1818 | for (j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++) |
---|
| 1819 | { |
---|
| 1820 | NumOutputLayersInOutputLayerSet[i] += vps->getOutputLayerFlag(i, j); |
---|
| 1821 | if (vps->getOutputLayerFlag(i, j)) |
---|
| 1822 | { |
---|
| 1823 | OlsHighestOutputLayerId[i] = vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j); |
---|
| 1824 | } |
---|
| 1825 | } |
---|
| 1826 | if (NumOutputLayersInOutputLayerSet[i] == 1 && vps->getNumDirectRefLayers(OlsHighestOutputLayerId[i]) > 0) |
---|
| 1827 | { |
---|
| 1828 | READ_FLAG(uiCode, "alt_output_layer_flag[i]"); |
---|
| 1829 | vps->setAltOuputLayerFlag(i, uiCode ? true : false); |
---|
| 1830 | } |
---|
[892] | 1831 | #if ALT_OPT_LAYER_FLAG |
---|
| 1832 | else |
---|
| 1833 | { |
---|
| 1834 | uiCode=0; |
---|
| 1835 | vps->setAltOuputLayerFlag(i, uiCode ? true : false); |
---|
| 1836 | } |
---|
| 1837 | #endif |
---|
[713] | 1838 | #if Q0165_OUTPUT_LAYER_SET |
---|
| 1839 | assert( NumOutputLayersInOutputLayerSet[i]>0 ); |
---|
[644] | 1840 | #endif |
---|
[713] | 1841 | |
---|
| 1842 | #endif |
---|
[588] | 1843 | } |
---|
[865] | 1844 | #if NECESSARY_LAYER_FLAG |
---|
| 1845 | vps->checkNecessaryLayerFlagCondition(); |
---|
| 1846 | #endif |
---|
[588] | 1847 | #else |
---|
| 1848 | if( numOutputLayerSets > 1 ) |
---|
| 1849 | { |
---|
[547] | 1850 | #if O0109_DEFAULT_ONE_OUT_LAYER_IDC |
---|
| 1851 | READ_CODE( 2, uiCode, "default_one_target_output_layer_idc" ); vps->setDefaultOneTargetOutputLayerIdc( uiCode ); |
---|
| 1852 | #else |
---|
[313] | 1853 | READ_FLAG( uiCode, "default_one_target_output_layer_flag" ); vps->setDefaultOneTargetOutputLayerFlag( uiCode ? true : false ); |
---|
[547] | 1854 | #endif |
---|
[313] | 1855 | } |
---|
| 1856 | vps->setNumOutputLayerSets( numOutputLayerSets ); |
---|
| 1857 | |
---|
| 1858 | for(i = 1; i < numOutputLayerSets; i++) |
---|
| 1859 | { |
---|
| 1860 | if( i > (vps->getNumLayerSets() - 1) ) |
---|
| 1861 | { |
---|
| 1862 | Int numBits = 1; |
---|
| 1863 | while ((1 << numBits) < (vps->getNumLayerSets() - 1)) |
---|
| 1864 | { |
---|
| 1865 | numBits++; |
---|
| 1866 | } |
---|
| 1867 | READ_CODE( numBits, uiCode, "output_layer_set_idx_minus1"); vps->setOutputLayerSetIdx( i, uiCode + 1); |
---|
| 1868 | Int lsIdx = vps->getOutputLayerSetIdx(i); |
---|
[644] | 1869 | #if NUM_OL_FLAGS |
---|
| 1870 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx) ; j++) |
---|
| 1871 | #else |
---|
[313] | 1872 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++) |
---|
[644] | 1873 | #endif |
---|
[313] | 1874 | { |
---|
| 1875 | READ_FLAG( uiCode, "output_layer_flag[i][j]"); vps->setOutputLayerFlag(i, j, uiCode); |
---|
| 1876 | } |
---|
| 1877 | } |
---|
| 1878 | else |
---|
| 1879 | { |
---|
[540] | 1880 | #if VPS_DPB_SIZE_TABLE |
---|
| 1881 | vps->setOutputLayerSetIdx( i, i ); |
---|
| 1882 | #endif |
---|
[313] | 1883 | // i <= (vps->getNumLayerSets() - 1) |
---|
| 1884 | // Assign OutputLayerFlag depending on default_one_target_output_layer_flag |
---|
| 1885 | Int lsIdx = i; |
---|
[547] | 1886 | #if O0109_DEFAULT_ONE_OUT_LAYER_IDC |
---|
| 1887 | if( vps->getDefaultOneTargetOutputLayerIdc() == 1 ) |
---|
| 1888 | { |
---|
| 1889 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) |
---|
| 1890 | { |
---|
| 1891 | #if O0135_DEFAULT_ONE_OUT_SEMANTIC |
---|
[893] | 1892 | #if DEF_OPT_LAYER_IDC |
---|
| 1893 | vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1)) ); |
---|
| 1894 | #else |
---|
[547] | 1895 | vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1)) && (vps->getDimensionId(j,1)==0) ); |
---|
[893] | 1896 | #endif |
---|
[547] | 1897 | #else |
---|
| 1898 | vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1))); |
---|
| 1899 | #endif |
---|
| 1900 | } |
---|
| 1901 | } |
---|
| 1902 | else if ( vps->getDefaultOneTargetOutputLayerIdc() == 0 ) |
---|
| 1903 | { |
---|
| 1904 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) |
---|
| 1905 | { |
---|
| 1906 | vps->setOutputLayerFlag(i, j, 1); |
---|
| 1907 | } |
---|
| 1908 | } |
---|
| 1909 | else |
---|
| 1910 | { |
---|
| 1911 | // Other values of default_one_target_output_layer_idc than 0 and 1 are reserved for future use. |
---|
| 1912 | } |
---|
| 1913 | #else |
---|
[313] | 1914 | if( vps->getDefaultOneTargetOutputLayerFlag() ) |
---|
| 1915 | { |
---|
| 1916 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) |
---|
| 1917 | { |
---|
| 1918 | vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1))); |
---|
| 1919 | } |
---|
| 1920 | } |
---|
| 1921 | else |
---|
| 1922 | { |
---|
| 1923 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) |
---|
| 1924 | { |
---|
| 1925 | vps->setOutputLayerFlag(i, j, 1); |
---|
| 1926 | } |
---|
| 1927 | } |
---|
[547] | 1928 | #endif |
---|
[313] | 1929 | } |
---|
| 1930 | Int numBits = 1; |
---|
| 1931 | while ((1 << numBits) < (vps->getNumProfileTierLevel())) |
---|
| 1932 | { |
---|
| 1933 | numBits++; |
---|
| 1934 | } |
---|
| 1935 | READ_CODE( numBits, uiCode, "profile_level_tier_idx[i]" ); vps->setProfileLevelTierIdx(i, uiCode); |
---|
| 1936 | } |
---|
[588] | 1937 | #endif |
---|
[494] | 1938 | |
---|
[644] | 1939 | #if !P0300_ALT_OUTPUT_LAYER_FLAG |
---|
[540] | 1940 | #if O0153_ALT_OUTPUT_LAYER_FLAG |
---|
| 1941 | if( vps->getMaxLayers() > 1 ) |
---|
| 1942 | { |
---|
| 1943 | READ_FLAG( uiCode, "alt_output_layer_flag"); |
---|
| 1944 | vps->setAltOuputLayerFlag( uiCode ? true : false ); |
---|
| 1945 | } |
---|
| 1946 | #endif |
---|
[644] | 1947 | #endif |
---|
[540] | 1948 | |
---|
[442] | 1949 | #if REPN_FORMAT_IN_VPS |
---|
[713] | 1950 | #if Q0195_REP_FORMAT_CLEANUP |
---|
| 1951 | READ_UVLC( uiCode, "vps_num_rep_formats_minus1" ); |
---|
| 1952 | vps->setVpsNumRepFormats( uiCode + 1 ); |
---|
| 1953 | |
---|
| 1954 | // The value of vps_num_rep_formats_minus1 shall be in the range of 0 to 255, inclusive. |
---|
| 1955 | assert( vps->getVpsNumRepFormats() > 0 && vps->getVpsNumRepFormats() <= 256 ); |
---|
| 1956 | |
---|
| 1957 | for(i = 0; i < vps->getVpsNumRepFormats(); i++) |
---|
| 1958 | { |
---|
| 1959 | // Read rep_format_structures |
---|
| 1960 | parseRepFormat( vps->getVpsRepFormat(i), i > 0 ? vps->getVpsRepFormat(i-1) : 0 ); |
---|
| 1961 | } |
---|
| 1962 | |
---|
| 1963 | // Default assignment for layer 0 |
---|
| 1964 | vps->setVpsRepFormatIdx( 0, 0 ); |
---|
| 1965 | |
---|
| 1966 | if( vps->getVpsNumRepFormats() > 1 ) |
---|
| 1967 | { |
---|
| 1968 | READ_FLAG( uiCode, "rep_format_idx_present_flag"); |
---|
| 1969 | vps->setRepFormatIdxPresentFlag( uiCode ? true : false ); |
---|
| 1970 | } |
---|
| 1971 | else |
---|
| 1972 | { |
---|
| 1973 | // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0 |
---|
| 1974 | vps->setRepFormatIdxPresentFlag( false ); |
---|
| 1975 | } |
---|
| 1976 | |
---|
| 1977 | if( vps->getRepFormatIdxPresentFlag() ) |
---|
| 1978 | { |
---|
| 1979 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 1980 | { |
---|
| 1981 | Int numBits = 1; |
---|
| 1982 | while ((1 << numBits) < (vps->getVpsNumRepFormats())) |
---|
| 1983 | { |
---|
| 1984 | numBits++; |
---|
| 1985 | } |
---|
| 1986 | READ_CODE( numBits, uiCode, "vps_rep_format_idx[i]" ); |
---|
| 1987 | vps->setVpsRepFormatIdx( i, uiCode ); |
---|
| 1988 | } |
---|
| 1989 | } |
---|
| 1990 | else |
---|
| 1991 | { |
---|
| 1992 | // When not present, the value of vps_rep_format_idx[ i ] is inferred to be equal to Min (i, vps_num_rep_formats_minus1) |
---|
| 1993 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 1994 | { |
---|
| 1995 | vps->setVpsRepFormatIdx( i, min( (Int)i, vps->getVpsNumRepFormats()-1 ) ); |
---|
| 1996 | } |
---|
| 1997 | } |
---|
| 1998 | #else |
---|
[494] | 1999 | READ_FLAG( uiCode, "rep_format_idx_present_flag"); |
---|
[442] | 2000 | vps->setRepFormatIdxPresentFlag( uiCode ? true : false ); |
---|
| 2001 | |
---|
| 2002 | if( vps->getRepFormatIdxPresentFlag() ) |
---|
| 2003 | { |
---|
[540] | 2004 | #if O0096_REP_FORMAT_INDEX |
---|
[588] | 2005 | #if !VPS_EXTN_UEV_CODING |
---|
[540] | 2006 | READ_CODE( 8, uiCode, "vps_num_rep_formats_minus1" ); |
---|
| 2007 | #else |
---|
[588] | 2008 | READ_UVLC( uiCode, "vps_num_rep_formats_minus1" ); |
---|
| 2009 | #endif |
---|
| 2010 | #else |
---|
[442] | 2011 | READ_CODE( 4, uiCode, "vps_num_rep_formats_minus1" ); |
---|
[540] | 2012 | #endif |
---|
[442] | 2013 | vps->setVpsNumRepFormats( uiCode + 1 ); |
---|
| 2014 | } |
---|
| 2015 | else |
---|
| 2016 | { |
---|
| 2017 | // default assignment |
---|
| 2018 | assert (vps->getMaxLayers() <= 16); // If max_layers_is more than 15, num_rep_formats has to be signaled |
---|
| 2019 | vps->setVpsNumRepFormats( vps->getMaxLayers() ); |
---|
| 2020 | } |
---|
[713] | 2021 | |
---|
| 2022 | // The value of vps_num_rep_formats_minus1 shall be in the range of 0 to 255, inclusive. |
---|
| 2023 | assert( vps->getVpsNumRepFormats() > 0 && vps->getVpsNumRepFormats() <= 256 ); |
---|
| 2024 | |
---|
[442] | 2025 | for(i = 0; i < vps->getVpsNumRepFormats(); i++) |
---|
| 2026 | { |
---|
| 2027 | // Read rep_format_structures |
---|
[713] | 2028 | parseRepFormat( vps->getVpsRepFormat(i), i > 0 ? vps->getVpsRepFormat(i-1) : 0 ); |
---|
[442] | 2029 | } |
---|
[494] | 2030 | |
---|
[442] | 2031 | // Default assignment for layer 0 |
---|
| 2032 | vps->setVpsRepFormatIdx( 0, 0 ); |
---|
| 2033 | if( vps->getRepFormatIdxPresentFlag() ) |
---|
| 2034 | { |
---|
| 2035 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 2036 | { |
---|
| 2037 | if( vps->getVpsNumRepFormats() > 1 ) |
---|
| 2038 | { |
---|
[540] | 2039 | #if O0096_REP_FORMAT_INDEX |
---|
[588] | 2040 | #if !VPS_EXTN_UEV_CODING |
---|
[540] | 2041 | READ_CODE( 8, uiCode, "vps_rep_format_idx[i]" ); |
---|
| 2042 | #else |
---|
[588] | 2043 | Int numBits = 1; |
---|
| 2044 | while ((1 << numBits) < (vps->getVpsNumRepFormats())) |
---|
| 2045 | { |
---|
| 2046 | numBits++; |
---|
| 2047 | } |
---|
| 2048 | READ_CODE( numBits, uiCode, "vps_rep_format_idx[i]" ); |
---|
| 2049 | #endif |
---|
| 2050 | #else |
---|
[442] | 2051 | READ_CODE( 4, uiCode, "vps_rep_format_idx[i]" ); |
---|
[540] | 2052 | #endif |
---|
[442] | 2053 | vps->setVpsRepFormatIdx( i, uiCode ); |
---|
| 2054 | } |
---|
| 2055 | else |
---|
| 2056 | { |
---|
| 2057 | // default assignment - only one rep_format() structure |
---|
| 2058 | vps->setVpsRepFormatIdx( i, 0 ); |
---|
| 2059 | } |
---|
| 2060 | } |
---|
| 2061 | } |
---|
| 2062 | else |
---|
| 2063 | { |
---|
| 2064 | // default assignment - each layer assigned each rep_format() structure in the order signaled |
---|
| 2065 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 2066 | { |
---|
| 2067 | vps->setVpsRepFormatIdx( i, i ); |
---|
| 2068 | } |
---|
| 2069 | } |
---|
| 2070 | #endif |
---|
[713] | 2071 | #endif |
---|
[588] | 2072 | #if RESOLUTION_BASED_DPB |
---|
| 2073 | vps->assignSubDpbIndices(); |
---|
| 2074 | #endif |
---|
[442] | 2075 | READ_FLAG(uiCode, "max_one_active_ref_layer_flag" ); |
---|
| 2076 | vps->setMaxOneActiveRefLayerFlag(uiCode); |
---|
[903] | 2077 | #if P0297_VPS_POC_LSB_ALIGNED_FLAG |
---|
| 2078 | READ_FLAG(uiCode, "vps_poc_lsb_aligned_flag"); |
---|
| 2079 | vps->setVpsPocLsbAlignedFlag(uiCode); |
---|
| 2080 | #endif |
---|
[494] | 2081 | #if O0062_POC_LSB_NOT_PRESENT_FLAG |
---|
| 2082 | for(i = 1; i< vps->getMaxLayers(); i++) |
---|
[313] | 2083 | { |
---|
[494] | 2084 | if( vps->getNumDirectRefLayers( vps->getLayerIdInNuh(i) ) == 0 ) |
---|
[313] | 2085 | { |
---|
[494] | 2086 | READ_FLAG(uiCode, "poc_lsb_not_present_flag[i]"); |
---|
| 2087 | vps->setPocLsbNotPresentFlag(i, uiCode); |
---|
[313] | 2088 | } |
---|
| 2089 | } |
---|
| 2090 | #endif |
---|
[494] | 2091 | #if O0215_PHASE_ALIGNMENT |
---|
| 2092 | READ_FLAG( uiCode, "cross_layer_phase_alignment_flag"); vps->setPhaseAlignFlag( uiCode == 1 ? true : false ); |
---|
[313] | 2093 | #endif |
---|
[494] | 2094 | |
---|
[815] | 2095 | #if !IRAP_ALIGN_FLAG_IN_VPS_VUI |
---|
[494] | 2096 | READ_FLAG(uiCode, "cross_layer_irap_aligned_flag" ); |
---|
| 2097 | vps->setCrossLayerIrapAlignFlag(uiCode); |
---|
| 2098 | #endif |
---|
| 2099 | |
---|
[540] | 2100 | #if VPS_DPB_SIZE_TABLE |
---|
[588] | 2101 | parseVpsDpbSizeTable(vps); |
---|
[540] | 2102 | #endif |
---|
[588] | 2103 | |
---|
| 2104 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
[313] | 2105 | READ_UVLC( uiCode, "direct_dep_type_len_minus2"); vps->setDirectDepTypeLen(uiCode+2); |
---|
[540] | 2106 | #if O0096_DEFAULT_DEPENDENCY_TYPE |
---|
| 2107 | READ_FLAG(uiCode, "default_direct_dependency_type_flag"); |
---|
| 2108 | vps->setDefaultDirectDependecyTypeFlag(uiCode == 1? true : false); |
---|
| 2109 | if (vps->getDefaultDirectDependencyTypeFlag()) |
---|
| 2110 | { |
---|
| 2111 | READ_CODE( vps->getDirectDepTypeLen(), uiCode, "default_direct_dependency_type" ); |
---|
| 2112 | vps->setDefaultDirectDependecyType(uiCode); |
---|
| 2113 | } |
---|
| 2114 | #endif |
---|
[313] | 2115 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 2116 | { |
---|
| 2117 | for(j = 0; j < i; j++) |
---|
| 2118 | { |
---|
| 2119 | if (vps->getDirectDependencyFlag(i, j)) |
---|
| 2120 | { |
---|
[540] | 2121 | #if O0096_DEFAULT_DEPENDENCY_TYPE |
---|
| 2122 | if (vps->getDefaultDirectDependencyTypeFlag()) |
---|
| 2123 | { |
---|
| 2124 | vps->setDirectDependencyType(i, j, vps->getDefaultDirectDependencyType()); |
---|
| 2125 | } |
---|
| 2126 | else |
---|
| 2127 | { |
---|
| 2128 | READ_CODE( vps->getDirectDepTypeLen(), uiCode, "direct_dependency_type[i][j]" ); |
---|
| 2129 | vps->setDirectDependencyType(i, j, uiCode); |
---|
| 2130 | } |
---|
| 2131 | #else |
---|
| 2132 | READ_CODE( vps->getDirectDepTypeLen(), uiCode, "direct_dependency_type[i][j]" ); |
---|
| 2133 | vps->setDirectDependencyType(i, j, uiCode); |
---|
| 2134 | #endif |
---|
[313] | 2135 | } |
---|
| 2136 | } |
---|
| 2137 | } |
---|
| 2138 | #endif |
---|
[815] | 2139 | #if !Q0078_ADD_LAYER_SETS |
---|
| 2140 | #if O0092_0094_DEPENDENCY_CONSTRAINT // Moved up |
---|
| 2141 | vps->setNumRefLayers(); |
---|
| 2142 | |
---|
[540] | 2143 | if(vps->getMaxLayers() > MAX_REF_LAYERS) |
---|
| 2144 | { |
---|
| 2145 | for(i = 1;i < vps->getMaxLayers(); i++) |
---|
[442] | 2146 | { |
---|
[540] | 2147 | assert( vps->getNumRefLayers(vps->getLayerIdInNuh(i)) <= MAX_REF_LAYERS); |
---|
[442] | 2148 | } |
---|
[540] | 2149 | } |
---|
[442] | 2150 | #endif |
---|
[815] | 2151 | #endif |
---|
[442] | 2152 | |
---|
[588] | 2153 | #if P0307_VPS_NON_VUI_EXTENSION |
---|
| 2154 | READ_UVLC( uiCode, "vps_non_vui_extension_length"); vps->setVpsNonVuiExtLength((Int)uiCode); |
---|
[713] | 2155 | |
---|
| 2156 | // The value of vps_non_vui_extension_length shall be in the range of 0 to 4096, inclusive. |
---|
| 2157 | assert( vps->getVpsNonVuiExtLength() >= 0 && vps->getVpsNonVuiExtLength() <= 4096 ); |
---|
| 2158 | |
---|
[644] | 2159 | #if P0307_VPS_NON_VUI_EXT_UPDATE |
---|
| 2160 | Int nonVuiExtByte = uiCode; |
---|
| 2161 | for (i = 1; i <= nonVuiExtByte; i++) |
---|
| 2162 | { |
---|
| 2163 | READ_CODE( 8, uiCode, "vps_non_vui_extension_data_byte" ); //just parse and discard for now. |
---|
| 2164 | } |
---|
| 2165 | #else |
---|
[588] | 2166 | if ( vps->getVpsNonVuiExtLength() > 0 ) |
---|
| 2167 | { |
---|
| 2168 | printf("\n\nUp to the current spec, the value of vps_non_vui_extension_length is supposed to be 0\n"); |
---|
| 2169 | } |
---|
| 2170 | #endif |
---|
[644] | 2171 | #endif |
---|
[588] | 2172 | |
---|
[547] | 2173 | #if !O0109_O0199_FLAGS_TO_VUI |
---|
[313] | 2174 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
| 2175 | READ_FLAG(uiCode, "single_layer_for_non_irap_flag" ); vps->setSingleLayerForNonIrapFlag(uiCode == 1 ? true : false); |
---|
| 2176 | #endif |
---|
[540] | 2177 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
| 2178 | READ_FLAG(uiCode, "higher_layer_irap_skip_flag" ); vps->setHigherLayerIrapSkipFlag(uiCode == 1 ? true : false); |
---|
| 2179 | #endif |
---|
[547] | 2180 | #endif |
---|
[442] | 2181 | |
---|
[588] | 2182 | #if P0307_REMOVE_VPS_VUI_OFFSET |
---|
| 2183 | READ_FLAG( uiCode, "vps_vui_present_flag"); vps->setVpsVuiPresentFlag(uiCode ? true : false); |
---|
| 2184 | #endif |
---|
| 2185 | |
---|
[547] | 2186 | #if O0109_MOVE_VPS_VUI_FLAG |
---|
| 2187 | if ( vps->getVpsVuiPresentFlag() ) |
---|
| 2188 | #else |
---|
[442] | 2189 | READ_FLAG( uiCode, "vps_vui_present_flag" ); |
---|
| 2190 | if (uiCode) |
---|
[547] | 2191 | #endif |
---|
[442] | 2192 | { |
---|
| 2193 | while ( m_pcBitstream->getNumBitsRead() % 8 != 0 ) |
---|
| 2194 | { |
---|
| 2195 | READ_FLAG( uiCode, "vps_vui_alignment_bit_equal_to_one"); assert(uiCode == 1); |
---|
| 2196 | } |
---|
| 2197 | parseVPSVUI(vps); |
---|
| 2198 | } |
---|
[713] | 2199 | else |
---|
| 2200 | { |
---|
| 2201 | // set default values for VPS VUI |
---|
| 2202 | defaultVPSVUI( vps ); |
---|
| 2203 | } |
---|
[313] | 2204 | } |
---|
[713] | 2205 | |
---|
| 2206 | Void TDecCavlc::defaultVPSExtension( TComVPS* vps ) |
---|
| 2207 | { |
---|
| 2208 | // set default parameters when they are not present |
---|
| 2209 | Int i, j; |
---|
| 2210 | |
---|
| 2211 | // When layer_id_in_nuh[ i ] is not present, the value is inferred to be equal to i. |
---|
| 2212 | for(i = 0; i < vps->getMaxLayers(); i++) |
---|
| 2213 | { |
---|
| 2214 | vps->setLayerIdInNuh(i, i); |
---|
| 2215 | vps->setLayerIdInVps(vps->getLayerIdInNuh(i), i); |
---|
| 2216 | } |
---|
| 2217 | |
---|
| 2218 | // When not present, sub_layers_vps_max_minus1[ i ] is inferred to be equal to vps_max_sub_layers_minus1. |
---|
| 2219 | for( i = 0; i < vps->getMaxLayers(); i++) |
---|
| 2220 | { |
---|
| 2221 | vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1); |
---|
| 2222 | } |
---|
| 2223 | |
---|
| 2224 | // When not present, max_tid_il_ref_pics_plus1[ i ][ j ] is inferred to be equal to 7. |
---|
| 2225 | for( i = 0; i < vps->getMaxLayers() - 1; i++ ) |
---|
| 2226 | { |
---|
| 2227 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
| 2228 | for( j = i + 1; j < vps->getMaxLayers(); j++ ) |
---|
| 2229 | { |
---|
| 2230 | vps->setMaxTidIlRefPicsPlus1(i, j, 7); |
---|
| 2231 | } |
---|
| 2232 | #else |
---|
| 2233 | vps->setMaxTidIlRefPicsPlus1(i, 7); |
---|
[313] | 2234 | #endif |
---|
[713] | 2235 | } |
---|
[825] | 2236 | |
---|
[815] | 2237 | // When not present, the value of num_add_olss is inferred to be equal to 0. |
---|
| 2238 | // NumOutputLayerSets = num_add_olss + NumLayerSets |
---|
[713] | 2239 | vps->setNumOutputLayerSets( vps->getNumLayerSets() ); |
---|
| 2240 | |
---|
| 2241 | // For i in the range of 0 to NumOutputLayerSets-1, inclusive, the variable LayerSetIdxForOutputLayerSet[ i ] is derived as specified in the following: |
---|
[815] | 2242 | // LayerSetIdxForOutputLayerSet[ i ] = ( i <= vps_number_layer_sets_minus1 ) ? i : layer_set_idx_for_ols_minus1[ i ] + 1 |
---|
[713] | 2243 | for( i = 1; i < vps->getNumOutputLayerSets(); i++ ) |
---|
| 2244 | { |
---|
| 2245 | vps->setOutputLayerSetIdx( i, i ); |
---|
| 2246 | Int lsIdx = vps->getOutputLayerSetIdx(i); |
---|
| 2247 | |
---|
| 2248 | for( j = 0; j < vps->getNumLayersInIdList(lsIdx); j++ ) |
---|
| 2249 | { |
---|
[825] | 2250 | vps->setOutputLayerFlag(i, j, 1); |
---|
[713] | 2251 | } |
---|
| 2252 | } |
---|
| 2253 | |
---|
| 2254 | // The value of sub_layer_dpb_info_present_flag[ i ][ 0 ] for any possible value of i is inferred to be equal to 1 |
---|
| 2255 | // When not present, the value of sub_layer_dpb_info_present_flag[ i ][ j ] for j greater than 0 and any possible value of i, is inferred to be equal to be equal to 0. |
---|
| 2256 | for( i = 1; i < vps->getNumOutputLayerSets(); i++ ) |
---|
| 2257 | { |
---|
| 2258 | vps->setSubLayerDpbInfoPresentFlag( i, 0, true ); |
---|
| 2259 | } |
---|
[825] | 2260 | |
---|
[713] | 2261 | // When not present, the value of vps_num_rep_formats_minus1 is inferred to be equal to MaxLayersMinus1. |
---|
| 2262 | vps->setVpsNumRepFormats( vps->getMaxLayers() ); |
---|
| 2263 | |
---|
| 2264 | // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0 |
---|
| 2265 | vps->setRepFormatIdxPresentFlag( false ); |
---|
| 2266 | |
---|
| 2267 | if( !vps->getRepFormatIdxPresentFlag() ) |
---|
| 2268 | { |
---|
| 2269 | // When not present, the value of vps_rep_format_idx[ i ] is inferred to be equal to Min(i, vps_num_rep_formats_minus1). |
---|
| 2270 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 2271 | { |
---|
| 2272 | vps->setVpsRepFormatIdx( i, min( (Int)i, vps->getVpsNumRepFormats() - 1 ) ); |
---|
| 2273 | } |
---|
| 2274 | } |
---|
| 2275 | |
---|
[903] | 2276 | #if P0297_VPS_POC_LSB_ALIGNED_FLAG |
---|
| 2277 | vps->setVpsPocLsbAlignedFlag(false); |
---|
| 2278 | #endif |
---|
[825] | 2279 | |
---|
[713] | 2280 | #if O0062_POC_LSB_NOT_PRESENT_FLAG |
---|
| 2281 | // When not present, poc_lsb_not_present_flag[ i ] is inferred to be equal to 0. |
---|
| 2282 | for(i = 1; i< vps->getMaxLayers(); i++) |
---|
| 2283 | { |
---|
| 2284 | vps->setPocLsbNotPresentFlag(i, 0); |
---|
| 2285 | } |
---|
| 2286 | #endif |
---|
| 2287 | |
---|
| 2288 | // set default values for VPS VUI |
---|
| 2289 | defaultVPSVUI( vps ); |
---|
| 2290 | } |
---|
| 2291 | |
---|
| 2292 | Void TDecCavlc::defaultVPSVUI( TComVPS* vps ) |
---|
| 2293 | { |
---|
| 2294 | // When not present, the value of all_layers_idr_aligned_flag is inferred to be equal to 0. |
---|
| 2295 | vps->setCrossLayerIrapAlignFlag( false ); |
---|
| 2296 | |
---|
| 2297 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
| 2298 | // When single_layer_for_non_irap_flag is not present, it is inferred to be equal to 0. |
---|
| 2299 | vps->setSingleLayerForNonIrapFlag( false ); |
---|
| 2300 | #endif |
---|
| 2301 | |
---|
| 2302 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
| 2303 | // When higher_layer_irap_skip_flag is not present it is inferred to be equal to 0 |
---|
| 2304 | vps->setHigherLayerIrapSkipFlag( false ); |
---|
| 2305 | #endif |
---|
| 2306 | } |
---|
| 2307 | |
---|
[442] | 2308 | #if REPN_FORMAT_IN_VPS |
---|
[713] | 2309 | Void TDecCavlc::parseRepFormat( RepFormat *repFormat, RepFormat *repFormatPrev ) |
---|
[442] | 2310 | { |
---|
| 2311 | UInt uiCode; |
---|
[713] | 2312 | #if REPN_FORMAT_CONTROL_FLAG |
---|
| 2313 | READ_CODE( 16, uiCode, "pic_width_vps_in_luma_samples" ); repFormat->setPicWidthVpsInLumaSamples ( uiCode ); |
---|
| 2314 | READ_CODE( 16, uiCode, "pic_height_vps_in_luma_samples" ); repFormat->setPicHeightVpsInLumaSamples( uiCode ); |
---|
| 2315 | READ_FLAG( uiCode, "chroma_and_bit_depth_vps_present_flag" ); repFormat->setChromaAndBitDepthVpsPresentFlag( uiCode ? true : false ); |
---|
[540] | 2316 | |
---|
[713] | 2317 | if( !repFormatPrev ) |
---|
| 2318 | { |
---|
| 2319 | // The value of chroma_and_bit_depth_vps_present_flag of the first rep_format( ) syntax structure in the VPS shall be equal to 1 |
---|
| 2320 | assert( repFormat->getChromaAndBitDepthVpsPresentFlag() ); |
---|
| 2321 | } |
---|
| 2322 | |
---|
[540] | 2323 | if( repFormat->getChromaAndBitDepthVpsPresentFlag() ) |
---|
| 2324 | { |
---|
[713] | 2325 | READ_CODE( 2, uiCode, "chroma_format_vps_idc" ); |
---|
[494] | 2326 | #if AUXILIARY_PICTURES |
---|
[713] | 2327 | repFormat->setChromaFormatVpsIdc( ChromaFormat(uiCode) ); |
---|
[540] | 2328 | #else |
---|
[713] | 2329 | repFormat->setChromaFormatVpsIdc( uiCode ); |
---|
[540] | 2330 | #endif |
---|
| 2331 | |
---|
| 2332 | if( repFormat->getChromaFormatVpsIdc() == 3 ) |
---|
| 2333 | { |
---|
[713] | 2334 | READ_FLAG( uiCode, "separate_colour_plane_vps_flag" ); repFormat->setSeparateColourPlaneVpsFlag( uiCode ? true : false ); |
---|
[540] | 2335 | } |
---|
| 2336 | |
---|
[713] | 2337 | READ_CODE( 4, uiCode, "bit_depth_vps_luma_minus8" ); repFormat->setBitDepthVpsLuma ( uiCode + 8 ); |
---|
| 2338 | READ_CODE( 4, uiCode, "bit_depth_vps_chroma_minus8" ); repFormat->setBitDepthVpsChroma( uiCode + 8 ); |
---|
| 2339 | } |
---|
| 2340 | else if( repFormatPrev ) |
---|
| 2341 | { |
---|
| 2342 | // chroma_and_bit_depth_vps_present_flag equal to 0 specifies that the syntax elements, chroma_format_vps_idc, separate_colour_plane_vps_flag, bit_depth_vps_luma_minus8, and |
---|
| 2343 | // bit_depth_vps_chroma_minus8 are not present and inferred from the previous rep_format( ) syntax structure in the VPS. |
---|
[540] | 2344 | |
---|
[713] | 2345 | repFormat->setChromaFormatVpsIdc ( repFormatPrev->getChromaFormatVpsIdc() ); |
---|
| 2346 | repFormat->setSeparateColourPlaneVpsFlag( repFormatPrev->getSeparateColourPlaneVpsFlag() ); |
---|
| 2347 | repFormat->setBitDepthVpsLuma ( repFormatPrev->getBitDepthVpsLuma() ); |
---|
| 2348 | repFormat->setBitDepthVpsChroma ( repFormatPrev->getBitDepthVpsChroma() ); |
---|
[540] | 2349 | } |
---|
[869] | 2350 | |
---|
[540] | 2351 | #else |
---|
| 2352 | #if AUXILIARY_PICTURES |
---|
[494] | 2353 | READ_CODE( 2, uiCode, "chroma_format_idc" ); repFormat->setChromaFormatVpsIdc( ChromaFormat(uiCode) ); |
---|
| 2354 | #else |
---|
[442] | 2355 | READ_CODE( 2, uiCode, "chroma_format_idc" ); repFormat->setChromaFormatVpsIdc( uiCode ); |
---|
[494] | 2356 | #endif |
---|
[825] | 2357 | |
---|
[442] | 2358 | if( repFormat->getChromaFormatVpsIdc() == 3 ) |
---|
| 2359 | { |
---|
| 2360 | READ_FLAG( uiCode, "separate_colour_plane_flag"); repFormat->setSeparateColourPlaneVpsFlag(uiCode ? true : false); |
---|
| 2361 | } |
---|
[313] | 2362 | |
---|
[442] | 2363 | READ_CODE ( 16, uiCode, "pic_width_in_luma_samples" ); repFormat->setPicWidthVpsInLumaSamples ( uiCode ); |
---|
| 2364 | READ_CODE ( 16, uiCode, "pic_height_in_luma_samples" ); repFormat->setPicHeightVpsInLumaSamples( uiCode ); |
---|
[494] | 2365 | |
---|
[442] | 2366 | READ_CODE( 4, uiCode, "bit_depth_luma_minus8" ); repFormat->setBitDepthVpsLuma ( uiCode + 8 ); |
---|
| 2367 | READ_CODE( 4, uiCode, "bit_depth_chroma_minus8" ); repFormat->setBitDepthVpsChroma( uiCode + 8 ); |
---|
[540] | 2368 | #endif |
---|
[869] | 2369 | |
---|
| 2370 | #if R0156_CONF_WINDOW_IN_REP_FORMAT |
---|
| 2371 | READ_FLAG( uiCode, "conformance_window_vps_flag" ); |
---|
| 2372 | if( uiCode != 0) |
---|
| 2373 | { |
---|
| 2374 | Window &conf = repFormat->getConformanceWindowVps(); |
---|
| 2375 | READ_UVLC( uiCode, "conf_win_vps_left_offset" ); conf.setWindowLeftOffset ( uiCode ); |
---|
| 2376 | READ_UVLC( uiCode, "conf_win_vps_right_offset" ); conf.setWindowRightOffset ( uiCode ); |
---|
| 2377 | READ_UVLC( uiCode, "conf_win_vps_top_offset" ); conf.setWindowTopOffset ( uiCode ); |
---|
| 2378 | READ_UVLC( uiCode, "conf_win_vps_bottom_offset" ); conf.setWindowBottomOffset( uiCode ); |
---|
| 2379 | } |
---|
| 2380 | #endif |
---|
[442] | 2381 | } |
---|
| 2382 | #endif |
---|
[588] | 2383 | #if VPS_DPB_SIZE_TABLE |
---|
| 2384 | Void TDecCavlc::parseVpsDpbSizeTable( TComVPS *vps ) |
---|
| 2385 | { |
---|
| 2386 | UInt uiCode; |
---|
[872] | 2387 | #if SUB_LAYERS_IN_LAYER_SET |
---|
| 2388 | vps->calculateMaxSLInLayerSets(); |
---|
| 2389 | #else |
---|
[644] | 2390 | #if DPB_PARAMS_MAXTLAYERS |
---|
[815] | 2391 | #if BITRATE_PICRATE_SIGNALLING |
---|
[825] | 2392 | Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumLayerSets()]; |
---|
| 2393 | for(Int i = 0; i < vps->getNumLayerSets(); i++) |
---|
[815] | 2394 | #else |
---|
[825] | 2395 | Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumOutputLayerSets()]; |
---|
| 2396 | for(Int i = 1; i < vps->getNumOutputLayerSets(); i++) |
---|
[815] | 2397 | #endif |
---|
[825] | 2398 | { |
---|
| 2399 | UInt maxSLMinus1 = 0; |
---|
[644] | 2400 | #if CHANGE_NUMSUBDPB_IDX |
---|
[825] | 2401 | Int optLsIdx = vps->getOutputLayerSetIdx( i ); |
---|
[644] | 2402 | #else |
---|
[825] | 2403 | Int optLsIdx = i; |
---|
[644] | 2404 | #endif |
---|
[815] | 2405 | #if BITRATE_PICRATE_SIGNALLING |
---|
[825] | 2406 | optLsIdx = i; |
---|
[815] | 2407 | #endif |
---|
[825] | 2408 | for(Int k = 0; k < vps->getNumLayersInIdList(optLsIdx); k++ ) { |
---|
| 2409 | Int lId = vps->getLayerSetLayerIdList(optLsIdx, k); |
---|
| 2410 | maxSLMinus1 = max(maxSLMinus1, vps->getMaxTSLayersMinus1(vps->getLayerIdInVps(lId))); |
---|
| 2411 | } |
---|
| 2412 | MaxSubLayersInLayerSetMinus1[ i ] = maxSLMinus1; |
---|
[815] | 2413 | #if BITRATE_PICRATE_SIGNALLING |
---|
[825] | 2414 | vps->setMaxSLayersInLayerSetMinus1(i,MaxSubLayersInLayerSetMinus1[ i ]); |
---|
[815] | 2415 | #endif |
---|
[825] | 2416 | } |
---|
[644] | 2417 | #endif |
---|
[872] | 2418 | #endif |
---|
[825] | 2419 | |
---|
[588] | 2420 | #if !RESOLUTION_BASED_DPB |
---|
| 2421 | vps->deriveNumberOfSubDpbs(); |
---|
| 2422 | #endif |
---|
| 2423 | for(Int i = 1; i < vps->getNumOutputLayerSets(); i++) |
---|
| 2424 | { |
---|
| 2425 | #if CHANGE_NUMSUBDPB_IDX |
---|
| 2426 | Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx( i ); |
---|
| 2427 | #endif |
---|
| 2428 | READ_FLAG( uiCode, "sub_layer_flag_info_present_flag[i]"); vps->setSubLayerFlagInfoPresentFlag( i, uiCode ? true : false ); |
---|
[872] | 2429 | #if SUB_LAYERS_IN_LAYER_SET |
---|
| 2430 | for(Int j = 0; j <= vps->getMaxSLayersInLayerSetMinus1( layerSetIdxForOutputLayerSet ); j++) |
---|
| 2431 | #else |
---|
[644] | 2432 | #if DPB_PARAMS_MAXTLAYERS |
---|
[815] | 2433 | #if BITRATE_PICRATE_SIGNALLING |
---|
| 2434 | for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ vps->getOutputLayerSetIdx( i ) ]; j++) |
---|
| 2435 | #else |
---|
[713] | 2436 | for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ i ]; j++) |
---|
[815] | 2437 | #endif |
---|
[644] | 2438 | #else |
---|
| 2439 | for(Int j = 0; j <= vps->getMaxTLayers(); j++) |
---|
| 2440 | #endif |
---|
[872] | 2441 | #endif |
---|
[588] | 2442 | { |
---|
| 2443 | if( j > 0 && vps->getSubLayerFlagInfoPresentFlag(i) ) |
---|
| 2444 | { |
---|
| 2445 | READ_FLAG( uiCode, "sub_layer_dpb_info_present_flag[i]"); vps->setSubLayerDpbInfoPresentFlag( i, j, uiCode ? true : false); |
---|
| 2446 | } |
---|
| 2447 | else |
---|
| 2448 | { |
---|
| 2449 | if( j == 0 ) // Always signal for the first sub-layer |
---|
| 2450 | { |
---|
| 2451 | vps->setSubLayerDpbInfoPresentFlag( i, j, true ); |
---|
| 2452 | } |
---|
| 2453 | else // if (j != 0) && !vps->getSubLayerFlagInfoPresentFlag(i) |
---|
| 2454 | { |
---|
| 2455 | vps->setSubLayerDpbInfoPresentFlag( i, j, false ); |
---|
| 2456 | } |
---|
| 2457 | } |
---|
| 2458 | if( vps->getSubLayerDpbInfoPresentFlag(i, j) ) // If sub-layer DPB information is present |
---|
| 2459 | { |
---|
| 2460 | #if CHANGE_NUMSUBDPB_IDX |
---|
| 2461 | for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet); k++) |
---|
| 2462 | #else |
---|
| 2463 | for(Int k = 0; k < vps->getNumSubDpbs(i); k++) |
---|
| 2464 | #endif |
---|
| 2465 | { |
---|
[891] | 2466 | #if DPB_INTERNAL_BL_SIG |
---|
| 2467 | uiCode=0; |
---|
| 2468 | if(vps->getBaseLayerInternalFlag() || ( vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, k) != 0 ) ) |
---|
| 2469 | #endif |
---|
[588] | 2470 | READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1[i][k][j]" ); vps->setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode ); |
---|
| 2471 | } |
---|
| 2472 | READ_UVLC( uiCode, "max_vps_num_reorder_pics[i][j]" ); vps->setMaxVpsNumReorderPics( i, j, uiCode); |
---|
| 2473 | #if RESOLUTION_BASED_DPB |
---|
| 2474 | if( vps->getNumSubDpbs(layerSetIdxForOutputLayerSet) != vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ) ) |
---|
| 2475 | { |
---|
| 2476 | for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++) |
---|
| 2477 | { |
---|
| 2478 | READ_UVLC( uiCode, "max_vps_layer_dec_pic_buff_minus1[i][k][j]" ); vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, uiCode); |
---|
| 2479 | } |
---|
| 2480 | } |
---|
| 2481 | else // vps->getNumSubDpbs(layerSetIdxForOutputLayerSet) == vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ) |
---|
| 2482 | { |
---|
| 2483 | for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++) |
---|
| 2484 | { |
---|
| 2485 | vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, vps->getMaxVpsDecPicBufferingMinus1( i, k, j)); |
---|
| 2486 | } |
---|
| 2487 | } |
---|
| 2488 | #endif |
---|
| 2489 | READ_UVLC( uiCode, "max_vps_latency_increase_plus1[i][j]" ); vps->setMaxVpsLatencyIncreasePlus1( i, j, uiCode); |
---|
| 2490 | } |
---|
| 2491 | } |
---|
[644] | 2492 | for(Int j = vps->getMaxTLayers(); j < MAX_TLAYER; j++) |
---|
| 2493 | { |
---|
| 2494 | vps->setSubLayerDpbInfoPresentFlag( i, j, false ); |
---|
| 2495 | } |
---|
[588] | 2496 | } |
---|
[644] | 2497 | |
---|
[872] | 2498 | #if !SUB_LAYERS_IN_LAYER_SET |
---|
[824] | 2499 | #if BITRATE_PICRATE_SIGNALLING |
---|
| 2500 | if( MaxSubLayersInLayerSetMinus1 ) |
---|
| 2501 | { |
---|
| 2502 | delete [] MaxSubLayersInLayerSetMinus1; |
---|
| 2503 | } |
---|
| 2504 | #endif |
---|
[872] | 2505 | #endif |
---|
[824] | 2506 | |
---|
[644] | 2507 | // Infer values when not signalled |
---|
| 2508 | for(Int i = 1; i < vps->getNumOutputLayerSets(); i++) |
---|
| 2509 | { |
---|
| 2510 | Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx( i ); |
---|
| 2511 | for(Int j = 0; j < MAX_TLAYER; j++) |
---|
| 2512 | { |
---|
| 2513 | if( !vps->getSubLayerDpbInfoPresentFlag(i, j) ) // If sub-layer DPB information is NOT present |
---|
| 2514 | { |
---|
[815] | 2515 | #if RESOLUTION_BASED_DPB |
---|
[644] | 2516 | for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet); k++) |
---|
[815] | 2517 | #else |
---|
| 2518 | for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++) |
---|
| 2519 | #endif |
---|
[644] | 2520 | { |
---|
| 2521 | vps->setMaxVpsDecPicBufferingMinus1( i, k, j, vps->getMaxVpsDecPicBufferingMinus1( i, k, j - 1 ) ); |
---|
| 2522 | } |
---|
| 2523 | vps->setMaxVpsNumReorderPics( i, j, vps->getMaxVpsNumReorderPics( i, j - 1) ); |
---|
[815] | 2524 | #if RESOLUTION_BASED_DPB |
---|
[644] | 2525 | for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++) |
---|
| 2526 | { |
---|
| 2527 | vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j - 1)); |
---|
| 2528 | } |
---|
[815] | 2529 | #endif |
---|
[644] | 2530 | vps->setMaxVpsLatencyIncreasePlus1( i, j, vps->getMaxVpsLatencyIncreasePlus1( i, j - 1 ) ); |
---|
| 2531 | } |
---|
| 2532 | } |
---|
| 2533 | } |
---|
[588] | 2534 | } |
---|
| 2535 | #endif |
---|
[815] | 2536 | |
---|
[442] | 2537 | Void TDecCavlc::parseVPSVUI(TComVPS *vps) |
---|
| 2538 | { |
---|
| 2539 | UInt i,j; |
---|
| 2540 | UInt uiCode; |
---|
[540] | 2541 | #if O0223_PICTURE_TYPES_ALIGN_FLAG |
---|
| 2542 | READ_FLAG(uiCode, "cross_layer_pic_type_aligned_flag" ); |
---|
| 2543 | vps->setCrossLayerPictureTypeAlignFlag(uiCode); |
---|
| 2544 | if (!uiCode) |
---|
| 2545 | { |
---|
| 2546 | #endif |
---|
[494] | 2547 | #if IRAP_ALIGN_FLAG_IN_VPS_VUI |
---|
[540] | 2548 | READ_FLAG(uiCode, "cross_layer_irap_aligned_flag" ); |
---|
| 2549 | vps->setCrossLayerIrapAlignFlag(uiCode); |
---|
[644] | 2550 | #if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG |
---|
[815] | 2551 | if( uiCode ) |
---|
[644] | 2552 | { |
---|
[815] | 2553 | READ_FLAG( uiCode, "all_layers_idr_aligned_flag" ); |
---|
| 2554 | vps->setCrossLayerAlignedIdrOnlyFlag(uiCode); |
---|
[644] | 2555 | } |
---|
[494] | 2556 | #endif |
---|
[644] | 2557 | #endif |
---|
[540] | 2558 | #if O0223_PICTURE_TYPES_ALIGN_FLAG |
---|
| 2559 | } |
---|
| 2560 | else |
---|
| 2561 | { |
---|
| 2562 | vps->setCrossLayerIrapAlignFlag(true); |
---|
| 2563 | } |
---|
| 2564 | #endif |
---|
[815] | 2565 | |
---|
[442] | 2566 | READ_FLAG( uiCode, "bit_rate_present_vps_flag" ); vps->setBitRatePresentVpsFlag( uiCode ? true : false ); |
---|
| 2567 | READ_FLAG( uiCode, "pic_rate_present_vps_flag" ); vps->setPicRatePresentVpsFlag( uiCode ? true : false ); |
---|
| 2568 | |
---|
[889] | 2569 | #if SIGNALLING_BITRATE_PICRATE_FIX |
---|
| 2570 | if ( vps->getBitRatePresentVpsFlag() || vps->getPicRatePresentVpsFlag() ) |
---|
| 2571 | { |
---|
| 2572 | for( i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getNumLayerSets(); i++ ) |
---|
| 2573 | { |
---|
[895] | 2574 | for( j = 0; j <= vps->getMaxSLayersInLayerSetMinus1( i ); j++ ) |
---|
[889] | 2575 | { |
---|
| 2576 | if( vps->getBitRatePresentVpsFlag() ) |
---|
| 2577 | { |
---|
| 2578 | READ_FLAG( uiCode, "bit_rate_present_flag[i][j]" ); vps->setBitRatePresentFlag( i, j, uiCode ? true : false ); |
---|
| 2579 | } |
---|
| 2580 | if( vps->getPicRatePresentVpsFlag( ) ) |
---|
| 2581 | { |
---|
| 2582 | READ_FLAG( uiCode, "pic_rate_present_flag[i][j]" ); vps->setPicRatePresentFlag( i, j, uiCode ? true : false ); |
---|
| 2583 | } |
---|
| 2584 | if( vps->getBitRatePresentFlag( i, j ) ) |
---|
| 2585 | { |
---|
| 2586 | READ_CODE( 16, uiCode, "avg_bit_rate" ); vps->setAvgBitRate( i, j, uiCode ); |
---|
| 2587 | READ_CODE( 16, uiCode, "max_bit_rate" ); vps->setMaxBitRate( i, j, uiCode ); |
---|
| 2588 | } |
---|
| 2589 | else |
---|
| 2590 | { |
---|
| 2591 | vps->setAvgBitRate( i, j, 0 ); |
---|
| 2592 | vps->setMaxBitRate( i, j, 0 ); |
---|
| 2593 | } |
---|
| 2594 | if( vps->getPicRatePresentFlag( i, j ) ) |
---|
| 2595 | { |
---|
| 2596 | READ_CODE( 2, uiCode, "constant_pic_rate_idc" ); vps->setConstPicRateIdc( i, j, uiCode ); |
---|
| 2597 | READ_CODE( 16, uiCode, "avg_pic_rate" ); vps->setAvgPicRate( i, j, uiCode ); |
---|
| 2598 | } |
---|
| 2599 | else |
---|
| 2600 | { |
---|
| 2601 | vps->setConstPicRateIdc( i, j, 0 ); |
---|
| 2602 | vps->setAvgPicRate( i, j, 0 ); |
---|
| 2603 | } |
---|
| 2604 | } |
---|
| 2605 | } |
---|
| 2606 | } |
---|
| 2607 | #else |
---|
[442] | 2608 | Bool parseFlag = vps->getBitRatePresentVpsFlag() || vps->getPicRatePresentVpsFlag(); |
---|
[815] | 2609 | |
---|
| 2610 | #if Q0078_ADD_LAYER_SETS |
---|
[837] | 2611 | #if R0227_BR_PR_ADD_LAYER_SET |
---|
| 2612 | for( i = 0; i < vps->getNumLayerSets(); i++ ) |
---|
| 2613 | #else |
---|
[815] | 2614 | for( i = 0; i <= vps->getVpsNumLayerSetsMinus1(); i++ ) |
---|
[837] | 2615 | #endif |
---|
[815] | 2616 | #else |
---|
| 2617 | for( i = 0; i < vps->getNumLayerSets(); i++ ) |
---|
| 2618 | #endif |
---|
[442] | 2619 | { |
---|
[815] | 2620 | #if BITRATE_PICRATE_SIGNALLING |
---|
| 2621 | for( j = 0; j <= vps->getMaxSLayersInLayerSetMinus1(i); j++ ) |
---|
| 2622 | #else |
---|
| 2623 | for( j = 0; j < vps->getMaxTLayers(); j++ ) |
---|
| 2624 | #endif |
---|
[442] | 2625 | { |
---|
[815] | 2626 | if( parseFlag && vps->getBitRatePresentVpsFlag() ) |
---|
[442] | 2627 | { |
---|
[815] | 2628 | READ_FLAG( uiCode, "bit_rate_present_flag[i][j]" ); vps->setBitRatePresentFlag( i, j, uiCode ? true : false ); |
---|
[442] | 2629 | } |
---|
[815] | 2630 | else |
---|
| 2631 | { |
---|
| 2632 | vps->setBitRatePresentFlag( i, j, false ); |
---|
| 2633 | } |
---|
| 2634 | if( parseFlag && vps->getPicRatePresentVpsFlag() ) |
---|
| 2635 | { |
---|
| 2636 | READ_FLAG( uiCode, "pic_rate_present_flag[i][j]" ); vps->setPicRatePresentFlag( i, j, uiCode ? true : false ); |
---|
| 2637 | } |
---|
| 2638 | else |
---|
| 2639 | { |
---|
| 2640 | vps->setPicRatePresentFlag( i, j, false ); |
---|
| 2641 | } |
---|
| 2642 | if( parseFlag && vps->getBitRatePresentFlag(i, j) ) |
---|
| 2643 | { |
---|
| 2644 | READ_CODE( 16, uiCode, "avg_bit_rate[i][j]" ); vps->setAvgBitRate( i, j, uiCode ); |
---|
| 2645 | READ_CODE( 16, uiCode, "max_bit_rate[i][j]" ); vps->setMaxBitRate( i, j, uiCode ); |
---|
| 2646 | } |
---|
| 2647 | else |
---|
| 2648 | { |
---|
| 2649 | vps->setAvgBitRate( i, j, 0 ); |
---|
| 2650 | vps->setMaxBitRate( i, j, 0 ); |
---|
| 2651 | } |
---|
| 2652 | if( parseFlag && vps->getPicRatePresentFlag(i, j) ) |
---|
| 2653 | { |
---|
| 2654 | READ_CODE( 2 , uiCode, "constant_pic_rate_idc[i][j]" ); vps->setConstPicRateIdc( i, j, uiCode ); |
---|
| 2655 | READ_CODE( 16, uiCode, "avg_pic_rate[i][j]" ); vps->setAvgPicRate( i, j, uiCode ); |
---|
| 2656 | } |
---|
| 2657 | else |
---|
| 2658 | { |
---|
| 2659 | vps->setConstPicRateIdc( i, j, 0 ); |
---|
| 2660 | vps->setAvgPicRate ( i, j, 0 ); |
---|
| 2661 | } |
---|
[442] | 2662 | } |
---|
| 2663 | } |
---|
[889] | 2664 | #endif |
---|
[588] | 2665 | #if VPS_VUI_VIDEO_SIGNAL_MOVE |
---|
| 2666 | READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); vps->setVideoSigPresentVpsFlag( uiCode == 1 ); |
---|
| 2667 | if (vps->getVideoSigPresentVpsFlag()) |
---|
| 2668 | { |
---|
| 2669 | READ_CODE(4, uiCode, "vps_num_video_signal_info_minus1" ); vps->setNumVideoSignalInfo(uiCode + 1); |
---|
| 2670 | } |
---|
| 2671 | else |
---|
| 2672 | { |
---|
[839] | 2673 | #if VPS_VUI_VST_PARAMS |
---|
| 2674 | vps->setNumVideoSignalInfo(vps->getMaxLayers() - vps->getBaseLayerInternalFlag() ? 0 : 1); |
---|
| 2675 | #else |
---|
[588] | 2676 | vps->setNumVideoSignalInfo(vps->getMaxLayers()); |
---|
[839] | 2677 | #endif |
---|
[588] | 2678 | } |
---|
| 2679 | |
---|
| 2680 | for(i = 0; i < vps->getNumVideoSignalInfo(); i++) |
---|
| 2681 | { |
---|
| 2682 | READ_CODE(3, uiCode, "video_vps_format" ); vps->setVideoVPSFormat(i,uiCode); |
---|
| 2683 | READ_FLAG(uiCode, "video_full_range_vps_flag" ); vps->setVideoFullRangeVpsFlag(i,uiCode); |
---|
| 2684 | READ_CODE(8, uiCode, "color_primaries_vps" ); vps->setColorPrimaries(i,uiCode); |
---|
| 2685 | READ_CODE(8, uiCode, "transfer_characteristics_vps" ); vps->setTransCharacter(i,uiCode); |
---|
| 2686 | READ_CODE(8, uiCode, "matrix_coeffs_vps" );vps->setMaxtrixCoeff(i,uiCode); |
---|
| 2687 | } |
---|
[839] | 2688 | #if VPS_VUI_VST_PARAMS |
---|
| 2689 | if( vps->getVideoSigPresentVpsFlag() && vps->getNumVideoSignalInfo() > 1 ) |
---|
| 2690 | { |
---|
| 2691 | for(i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++) |
---|
| 2692 | { |
---|
| 2693 | READ_CODE(4, uiCode, "vps_video_signal_info_idx" ); vps->setVideoSignalInfoIdx(i, uiCode); |
---|
| 2694 | } |
---|
| 2695 | } |
---|
| 2696 | else if ( !vps->getVideoSigPresentVpsFlag() ) |
---|
| 2697 | { |
---|
| 2698 | for(i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++) |
---|
| 2699 | { |
---|
| 2700 | vps->setVideoSignalInfoIdx( i, i ); |
---|
| 2701 | } |
---|
| 2702 | } |
---|
| 2703 | else // ( vps->getNumVideoSignalInfo() = 0 ) |
---|
| 2704 | { |
---|
| 2705 | for(i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++) |
---|
| 2706 | { |
---|
| 2707 | vps->setVideoSignalInfoIdx( i, 0 ); |
---|
| 2708 | } |
---|
| 2709 | } |
---|
| 2710 | #else |
---|
[588] | 2711 | if(!vps->getVideoSigPresentVpsFlag()) |
---|
| 2712 | { |
---|
| 2713 | for (i=0; i < vps->getMaxLayers(); i++) |
---|
| 2714 | { |
---|
| 2715 | vps->setVideoSignalInfoIdx(i,i); |
---|
| 2716 | } |
---|
| 2717 | } |
---|
| 2718 | else { |
---|
| 2719 | vps->setVideoSignalInfoIdx(0,0); |
---|
| 2720 | if (vps->getNumVideoSignalInfo() > 1 ) |
---|
| 2721 | { |
---|
| 2722 | for (i=1; i < vps->getMaxLayers(); i++) |
---|
| 2723 | READ_CODE(4, uiCode, "vps_video_signal_info_idx" ); vps->setVideoSignalInfoIdx(i, uiCode); |
---|
| 2724 | } |
---|
| 2725 | else { |
---|
| 2726 | for (i=1; i < vps->getMaxLayers(); i++) |
---|
| 2727 | { |
---|
| 2728 | vps->setVideoSignalInfoIdx(i,0); |
---|
| 2729 | } |
---|
| 2730 | } |
---|
| 2731 | } |
---|
[839] | 2732 | #endif |
---|
[588] | 2733 | #endif |
---|
[540] | 2734 | #if VPS_VUI_TILES_NOT_IN_USE__FLAG |
---|
| 2735 | UInt layerIdx; |
---|
| 2736 | READ_FLAG( uiCode, "tiles_not_in_use_flag" ); vps->setTilesNotInUseFlag(uiCode == 1); |
---|
| 2737 | if (!uiCode) |
---|
| 2738 | { |
---|
| 2739 | for(i = 0; i < vps->getMaxLayers(); i++) |
---|
| 2740 | { |
---|
| 2741 | READ_FLAG( uiCode, "tiles_in_use_flag[ i ]" ); vps->setTilesInUseFlag(i, (uiCode == 1)); |
---|
| 2742 | if (uiCode) |
---|
| 2743 | { |
---|
| 2744 | READ_FLAG( uiCode, "loop_filter_not_across_tiles_flag[ i ]" ); vps->setLoopFilterNotAcrossTilesFlag(i, (uiCode == 1)); |
---|
| 2745 | } |
---|
| 2746 | else |
---|
| 2747 | { |
---|
| 2748 | vps->setLoopFilterNotAcrossTilesFlag(i, false); |
---|
| 2749 | } |
---|
| 2750 | } |
---|
| 2751 | #endif |
---|
[815] | 2752 | |
---|
[540] | 2753 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 2754 | { |
---|
| 2755 | for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++) |
---|
| 2756 | { |
---|
| 2757 | #if VPS_VUI_TILES_NOT_IN_USE__FLAG |
---|
| 2758 | layerIdx = vps->getLayerIdInVps(vps->getRefLayerId(vps->getLayerIdInNuh(i), j)); |
---|
| 2759 | if (vps->getTilesInUseFlag(i) && vps->getTilesInUseFlag(layerIdx)) { |
---|
| 2760 | READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vps->setTileBoundariesAlignedFlag(i,j,(uiCode == 1)); |
---|
| 2761 | } |
---|
| 2762 | #else |
---|
| 2763 | READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vps->setTileBoundariesAlignedFlag(i,j,(uiCode == 1)); |
---|
| 2764 | #endif |
---|
| 2765 | } |
---|
| 2766 | } |
---|
| 2767 | #if VPS_VUI_TILES_NOT_IN_USE__FLAG |
---|
| 2768 | } |
---|
| 2769 | #endif |
---|
| 2770 | #if VPS_VUI_WPP_NOT_IN_USE__FLAG |
---|
| 2771 | READ_FLAG( uiCode, "wpp_not_in_use_flag" ); vps->setWppNotInUseFlag(uiCode == 1); |
---|
| 2772 | if (!uiCode) |
---|
[442] | 2773 | { |
---|
[540] | 2774 | for(i = 0; i < vps->getMaxLayers(); i++) |
---|
[442] | 2775 | { |
---|
[540] | 2776 | READ_FLAG( uiCode, "wpp_in_use_flag[ i ]" ); vps->setWppInUseFlag(i, (uiCode == 1)); |
---|
[442] | 2777 | } |
---|
[494] | 2778 | } |
---|
| 2779 | #endif |
---|
[547] | 2780 | |
---|
| 2781 | #if O0109_O0199_FLAGS_TO_VUI |
---|
| 2782 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
| 2783 | READ_FLAG(uiCode, "single_layer_for_non_irap_flag" ); vps->setSingleLayerForNonIrapFlag(uiCode == 1 ? true : false); |
---|
| 2784 | #endif |
---|
| 2785 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
| 2786 | READ_FLAG(uiCode, "higher_layer_irap_skip_flag" ); vps->setHigherLayerIrapSkipFlag(uiCode == 1 ? true : false); |
---|
[713] | 2787 | |
---|
| 2788 | // When single_layer_for_non_irap_flag is equal to 0, higher_layer_irap_skip_flag shall be equal to 0 |
---|
| 2789 | if( !vps->getSingleLayerForNonIrapFlag() ) |
---|
| 2790 | { |
---|
| 2791 | assert( !vps->getHigherLayerIrapSkipFlag() ); |
---|
| 2792 | } |
---|
[547] | 2793 | #endif |
---|
| 2794 | #endif |
---|
[644] | 2795 | #if P0312_VERT_PHASE_ADJ |
---|
| 2796 | READ_FLAG( uiCode, "vps_vui_vert_phase_in_use_flag" ); vps->setVpsVuiVertPhaseInUseFlag(uiCode); |
---|
| 2797 | #endif |
---|
[442] | 2798 | #if N0160_VUI_EXT_ILP_REF |
---|
[588] | 2799 | READ_FLAG( uiCode, "ilp_restricted_ref_layers_flag" ); vps->setIlpRestrictedRefLayersFlag( uiCode == 1 ); |
---|
| 2800 | if( vps->getIlpRestrictedRefLayersFlag()) |
---|
[442] | 2801 | { |
---|
| 2802 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 2803 | { |
---|
| 2804 | for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++) |
---|
| 2805 | { |
---|
[494] | 2806 | READ_UVLC( uiCode, "min_spatial_segment_offset_plus1[i][j]" ); vps->setMinSpatialSegmentOffsetPlus1( i, j, uiCode ); |
---|
| 2807 | if( vps->getMinSpatialSegmentOffsetPlus1(i,j ) > 0 ) |
---|
| 2808 | { |
---|
| 2809 | READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[i][j]"); vps->setCtuBasedOffsetEnabledFlag(i, j, uiCode == 1 ); |
---|
| 2810 | if(vps->getCtuBasedOffsetEnabledFlag(i,j)) |
---|
[442] | 2811 | { |
---|
[494] | 2812 | READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[i][j]"); vps->setMinHorizontalCtuOffsetPlus1( i,j, uiCode ); |
---|
[442] | 2813 | } |
---|
[494] | 2814 | } |
---|
| 2815 | } |
---|
[442] | 2816 | } |
---|
| 2817 | } |
---|
[494] | 2818 | #endif |
---|
[540] | 2819 | #if VPS_VUI_VIDEO_SIGNAL |
---|
[588] | 2820 | #if VPS_VUI_VIDEO_SIGNAL_MOVE |
---|
| 2821 | #else |
---|
[825] | 2822 | READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); vps->setVideoSigPresentVpsFlag( uiCode == 1 ); |
---|
| 2823 | if (vps->getVideoSigPresentVpsFlag()) |
---|
| 2824 | { |
---|
| 2825 | READ_CODE(4, uiCode, "vps_num_video_signal_info_minus1" ); vps->setNumVideoSignalInfo(uiCode + 1); |
---|
| 2826 | } |
---|
| 2827 | else |
---|
| 2828 | { |
---|
| 2829 | vps->setNumVideoSignalInfo(vps->getMaxLayers()); |
---|
| 2830 | } |
---|
| 2831 | |
---|
| 2832 | |
---|
| 2833 | for(i = 0; i < vps->getNumVideoSignalInfo(); i++) |
---|
| 2834 | { |
---|
| 2835 | READ_CODE(3, uiCode, "video_vps_format" ); vps->setVideoVPSFormat(i,uiCode); |
---|
| 2836 | READ_FLAG(uiCode, "video_full_range_vps_flag" ); vps->setVideoFullRangeVpsFlag(i,uiCode); |
---|
| 2837 | READ_CODE(8, uiCode, "color_primaries_vps" ); vps->setColorPrimaries(i,uiCode); |
---|
| 2838 | READ_CODE(8, uiCode, "transfer_characteristics_vps" ); vps->setTransCharacter(i,uiCode); |
---|
| 2839 | READ_CODE(8, uiCode, "matrix_coeffs_vps" );vps->setMaxtrixCoeff(i,uiCode); |
---|
| 2840 | } |
---|
| 2841 | if(!vps->getVideoSigPresentVpsFlag()) |
---|
| 2842 | { |
---|
| 2843 | for (i=0; i < vps->getMaxLayers(); i++) |
---|
[540] | 2844 | { |
---|
[825] | 2845 | vps->setVideoSignalInfoIdx(i,i); |
---|
[540] | 2846 | } |
---|
[825] | 2847 | } |
---|
| 2848 | else { |
---|
| 2849 | vps->setVideoSignalInfoIdx(0,0); |
---|
| 2850 | if (vps->getNumVideoSignalInfo() > 1 ) |
---|
[540] | 2851 | { |
---|
[825] | 2852 | for (i=1; i < vps->getMaxLayers(); i++) |
---|
| 2853 | READ_CODE(4, uiCode, "vps_video_signal_info_idx" ); vps->setVideoSignalInfoIdx(i, uiCode); |
---|
[540] | 2854 | } |
---|
| 2855 | else { |
---|
[825] | 2856 | for (i=1; i < vps->getMaxLayers(); i++) |
---|
| 2857 | { |
---|
| 2858 | vps->setVideoSignalInfoIdx(i,0); |
---|
| 2859 | } |
---|
[540] | 2860 | } |
---|
[825] | 2861 | } |
---|
[588] | 2862 | #endif |
---|
[540] | 2863 | #endif |
---|
[644] | 2864 | |
---|
| 2865 | #if O0164_MULTI_LAYER_HRD |
---|
[825] | 2866 | READ_FLAG(uiCode, "vps_vui_bsp_hrd_present_flag" ); vps->setVpsVuiBspHrdPresentFlag(uiCode); |
---|
| 2867 | if (vps->getVpsVuiBspHrdPresentFlag()) |
---|
| 2868 | { |
---|
[894] | 2869 | #if VPS_VUI_BSP_HRD_PARAMS |
---|
| 2870 | parseVpsVuiBspHrdParams(vps); |
---|
| 2871 | #else |
---|
[843] | 2872 | #if R0227_VUI_BSP_HRD_FLAG |
---|
| 2873 | assert (vps->getTimingInfo()->getTimingInfoPresentFlag() == 1); |
---|
| 2874 | #endif |
---|
[825] | 2875 | READ_UVLC( uiCode, "vps_num_bsp_hrd_parameters_minus1" ); vps->setVpsNumBspHrdParametersMinus1(uiCode); |
---|
| 2876 | vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1); |
---|
| 2877 | for( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ ) |
---|
[644] | 2878 | { |
---|
[825] | 2879 | if( i > 0 ) |
---|
[644] | 2880 | { |
---|
[825] | 2881 | READ_FLAG( uiCode, "bsp_cprms_present_flag[i]" ); vps->setBspCprmsPresentFlag(i, uiCode); |
---|
[644] | 2882 | } |
---|
[825] | 2883 | parseHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1); |
---|
| 2884 | } |
---|
[815] | 2885 | #if Q0078_ADD_LAYER_SETS |
---|
[825] | 2886 | for (UInt h = 1; h <= vps->getVpsNumLayerSetsMinus1(); h++) |
---|
[815] | 2887 | #else |
---|
[825] | 2888 | for( UInt h = 1; h <= (vps->getNumLayerSets()-1); h++ ) |
---|
[815] | 2889 | #endif |
---|
[825] | 2890 | { |
---|
| 2891 | READ_UVLC( uiCode, "num_bitstream_partitions[i]"); vps->setNumBitstreamPartitions(h, uiCode); |
---|
[815] | 2892 | #if HRD_BPB |
---|
[825] | 2893 | Int chkPart=0; |
---|
[815] | 2894 | #endif |
---|
[825] | 2895 | for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ ) |
---|
| 2896 | { |
---|
| 2897 | for( j = 0; j <= (vps->getMaxLayers()-1); j++ ) |
---|
[644] | 2898 | { |
---|
[825] | 2899 | if( vps->getLayerIdIncludedFlag(h, j) ) |
---|
[644] | 2900 | { |
---|
[825] | 2901 | READ_FLAG( uiCode, "layer_in_bsp_flag[h][i][j]" ); vps->setLayerInBspFlag(h, i, j, uiCode); |
---|
[644] | 2902 | } |
---|
[825] | 2903 | } |
---|
[815] | 2904 | #if HRD_BPB |
---|
[825] | 2905 | chkPart+=vps->getLayerInBspFlag(h, i, j); |
---|
[815] | 2906 | #endif |
---|
[825] | 2907 | } |
---|
[815] | 2908 | #if HRD_BPB |
---|
[825] | 2909 | assert(chkPart<=1); |
---|
[815] | 2910 | #endif |
---|
| 2911 | #if HRD_BPB |
---|
[825] | 2912 | if(vps->getNumBitstreamPartitions(h)==1) |
---|
| 2913 | { |
---|
| 2914 | Int chkPartition1=0; Int chkPartition2=0; |
---|
| 2915 | for( j = 0; j <= (vps->getMaxLayers()-1); j++ ) |
---|
[815] | 2916 | { |
---|
[825] | 2917 | if( vps->getLayerIdIncludedFlag(h, j) ) |
---|
[815] | 2918 | { |
---|
[825] | 2919 | chkPartition1+=vps->getLayerInBspFlag(h, 0, j); |
---|
| 2920 | chkPartition2++; |
---|
[815] | 2921 | } |
---|
| 2922 | } |
---|
[825] | 2923 | assert(chkPartition1!=chkPartition2); |
---|
| 2924 | } |
---|
[815] | 2925 | #endif |
---|
[825] | 2926 | if (vps->getNumBitstreamPartitions(h)) |
---|
| 2927 | { |
---|
[815] | 2928 | #if Q0182_MULTI_LAYER_HRD_UPDATE |
---|
[825] | 2929 | READ_UVLC( uiCode, "num_bsp_sched_combinations_minus1[h]"); vps->setNumBspSchedCombinations(h, uiCode + 1); |
---|
[815] | 2930 | #else |
---|
[825] | 2931 | READ_UVLC( uiCode, "num_bsp_sched_combinations[h]"); vps->setNumBspSchedCombinations(h, uiCode); |
---|
[815] | 2932 | #endif |
---|
[825] | 2933 | for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ ) |
---|
| 2934 | { |
---|
| 2935 | for( j = 0; j < vps->getNumBitstreamPartitions(h); j++ ) |
---|
[644] | 2936 | { |
---|
[825] | 2937 | READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][j]"); vps->setBspCombHrdIdx(h, i, j, uiCode); |
---|
[815] | 2938 | #if HRD_BPB |
---|
[825] | 2939 | assert(uiCode <= vps->getVpsNumBspHrdParametersMinus1()); |
---|
[815] | 2940 | #endif |
---|
[825] | 2941 | |
---|
| 2942 | READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][j]"); vps->setBspCombSchedIdx(h, i, j, uiCode); |
---|
[815] | 2943 | #if HRD_BPB |
---|
[825] | 2944 | assert(uiCode <= vps->getBspHrdParamBufferCpbCntMinus1(uiCode,vps->getMaxTLayers()-1)); |
---|
[815] | 2945 | #endif |
---|
[644] | 2946 | } |
---|
| 2947 | } |
---|
| 2948 | } |
---|
| 2949 | } |
---|
[894] | 2950 | #endif |
---|
[825] | 2951 | } |
---|
[644] | 2952 | #endif |
---|
| 2953 | #if P0182_VPS_VUI_PS_FLAG |
---|
[825] | 2954 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 2955 | { |
---|
| 2956 | if (vps->getNumRefLayers(vps->getLayerIdInNuh(i)) == 0) |
---|
[644] | 2957 | { |
---|
[825] | 2958 | READ_FLAG( uiCode, "base_layer_parameter_set_compatibility_flag" ); |
---|
| 2959 | vps->setBaseLayerPSCompatibilityFlag( i, uiCode ); |
---|
[644] | 2960 | } |
---|
[825] | 2961 | else |
---|
| 2962 | { |
---|
| 2963 | vps->setBaseLayerPSCompatibilityFlag( i, 0 ); |
---|
| 2964 | } |
---|
| 2965 | } |
---|
[644] | 2966 | #endif |
---|
[442] | 2967 | } |
---|
[894] | 2968 | |
---|
[494] | 2969 | #endif //SVC_EXTENSION |
---|
| 2970 | |
---|
[313] | 2971 | Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager) |
---|
| 2972 | { |
---|
| 2973 | UInt uiCode; |
---|
| 2974 | Int iCode; |
---|
| 2975 | |
---|
| 2976 | #if ENC_DEC_TRACE |
---|
| 2977 | xTraceSliceHeader(rpcSlice); |
---|
| 2978 | #endif |
---|
| 2979 | TComPPS* pps = NULL; |
---|
| 2980 | TComSPS* sps = NULL; |
---|
| 2981 | |
---|
| 2982 | UInt firstSliceSegmentInPic; |
---|
| 2983 | READ_FLAG( firstSliceSegmentInPic, "first_slice_segment_in_pic_flag" ); |
---|
| 2984 | if( rpcSlice->getRapPicFlag()) |
---|
| 2985 | { |
---|
[713] | 2986 | READ_FLAG( uiCode, "no_output_of_prior_pics_flag" ); //ignored -- updated already |
---|
| 2987 | #if SETTING_NO_OUT_PIC_PRIOR |
---|
| 2988 | rpcSlice->setNoOutputPriorPicsFlag(uiCode ? true : false); |
---|
[644] | 2989 | #else |
---|
[713] | 2990 | rpcSlice->setNoOutputPicPrior( false ); |
---|
[644] | 2991 | #endif |
---|
[313] | 2992 | } |
---|
| 2993 | READ_UVLC ( uiCode, "slice_pic_parameter_set_id" ); rpcSlice->setPPSId(uiCode); |
---|
| 2994 | pps = parameterSetManager->getPrefetchedPPS(uiCode); |
---|
| 2995 | //!KS: need to add error handling code here, if PPS is not available |
---|
| 2996 | assert(pps!=0); |
---|
| 2997 | sps = parameterSetManager->getPrefetchedSPS(pps->getSPSId()); |
---|
| 2998 | //!KS: need to add error handling code here, if SPS is not available |
---|
| 2999 | assert(sps!=0); |
---|
| 3000 | rpcSlice->setSPS(sps); |
---|
| 3001 | rpcSlice->setPPS(pps); |
---|
[838] | 3002 | |
---|
| 3003 | #if R0227_REP_FORMAT_CONSTRAINT //Conformance checking for rep format -- rep format of current picture of current layer shall never be greater rep format defined in VPS for the current layer |
---|
| 3004 | TComVPS* vps = NULL; |
---|
| 3005 | vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId()); |
---|
[848] | 3006 | #if R0279_REP_FORMAT_INBL |
---|
| 3007 | if ( vps->getVpsExtensionFlag() == 1 && (rpcSlice->getLayerId() == 0 || sps->getV1CompatibleSPSFlag() == 1) ) |
---|
| 3008 | { |
---|
| 3009 | assert( sps->getPicWidthInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getPicWidthVpsInLumaSamples() ); |
---|
| 3010 | assert( sps->getPicHeightInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getPicHeightVpsInLumaSamples() ); |
---|
| 3011 | assert( sps->getChromaFormatIdc() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getChromaFormatVpsIdc() ); |
---|
| 3012 | assert( sps->getBitDepthY() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getBitDepthVpsLuma() ); |
---|
| 3013 | assert( sps->getBitDepthC() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getBitDepthVpsChroma() ); |
---|
| 3014 | #else |
---|
[844] | 3015 | if ( rpcSlice->getLayerId() == 0 && vps->getVpsExtensionFlag() == 1 ) |
---|
[838] | 3016 | { |
---|
| 3017 | assert( sps->getPicWidthInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getPicWidthVpsInLumaSamples() ); |
---|
| 3018 | assert( sps->getPicHeightInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getPicHeightVpsInLumaSamples() ); |
---|
| 3019 | assert( sps->getChromaFormatIdc() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getChromaFormatVpsIdc() ); |
---|
| 3020 | assert( sps->getBitDepthY() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getBitDepthVpsLuma() ); |
---|
| 3021 | assert( sps->getBitDepthC() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getBitDepthVpsChroma() ); |
---|
[848] | 3022 | #endif |
---|
[838] | 3023 | } |
---|
[844] | 3024 | else if ( vps->getVpsExtensionFlag() == 1 ) |
---|
[838] | 3025 | { |
---|
| 3026 | assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getPicWidthVpsInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getPicWidthVpsInLumaSamples()); |
---|
| 3027 | assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getPicHeightVpsInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getPicHeightVpsInLumaSamples()); |
---|
| 3028 | assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getChromaFormatVpsIdc() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getChromaFormatVpsIdc()); |
---|
| 3029 | assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getBitDepthVpsLuma() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getBitDepthVpsLuma()); |
---|
| 3030 | assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getBitDepthVpsChroma() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getBitDepthVpsChroma()); |
---|
| 3031 | } |
---|
| 3032 | #endif |
---|
| 3033 | |
---|
[313] | 3034 | if( pps->getDependentSliceSegmentsEnabledFlag() && ( !firstSliceSegmentInPic )) |
---|
| 3035 | { |
---|
| 3036 | READ_FLAG( uiCode, "dependent_slice_segment_flag" ); rpcSlice->setDependentSliceSegmentFlag(uiCode ? true : false); |
---|
| 3037 | } |
---|
| 3038 | else |
---|
| 3039 | { |
---|
| 3040 | rpcSlice->setDependentSliceSegmentFlag(false); |
---|
| 3041 | } |
---|
[442] | 3042 | #if REPN_FORMAT_IN_VPS |
---|
| 3043 | Int numCTUs = ((rpcSlice->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((rpcSlice->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight()); |
---|
| 3044 | #else |
---|
[313] | 3045 | Int numCTUs = ((sps->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((sps->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight()); |
---|
[442] | 3046 | #endif |
---|
[313] | 3047 | Int maxParts = (1<<(sps->getMaxCUDepth()<<1)); |
---|
| 3048 | UInt sliceSegmentAddress = 0; |
---|
| 3049 | Int bitsSliceSegmentAddress = 0; |
---|
| 3050 | while(numCTUs>(1<<bitsSliceSegmentAddress)) |
---|
| 3051 | { |
---|
| 3052 | bitsSliceSegmentAddress++; |
---|
| 3053 | } |
---|
| 3054 | |
---|
| 3055 | if(!firstSliceSegmentInPic) |
---|
| 3056 | { |
---|
| 3057 | READ_CODE( bitsSliceSegmentAddress, sliceSegmentAddress, "slice_segment_address" ); |
---|
| 3058 | } |
---|
| 3059 | //set uiCode to equal slice start address (or dependent slice start address) |
---|
| 3060 | Int startCuAddress = maxParts*sliceSegmentAddress; |
---|
| 3061 | rpcSlice->setSliceSegmentCurStartCUAddr( startCuAddress ); |
---|
| 3062 | rpcSlice->setSliceSegmentCurEndCUAddr(numCTUs*maxParts); |
---|
| 3063 | |
---|
| 3064 | if (rpcSlice->getDependentSliceSegmentFlag()) |
---|
| 3065 | { |
---|
| 3066 | rpcSlice->setNextSlice ( false ); |
---|
| 3067 | rpcSlice->setNextSliceSegment ( true ); |
---|
| 3068 | } |
---|
| 3069 | else |
---|
| 3070 | { |
---|
| 3071 | rpcSlice->setNextSlice ( true ); |
---|
| 3072 | rpcSlice->setNextSliceSegment ( false ); |
---|
| 3073 | |
---|
| 3074 | rpcSlice->setSliceCurStartCUAddr(startCuAddress); |
---|
| 3075 | rpcSlice->setSliceCurEndCUAddr(numCTUs*maxParts); |
---|
| 3076 | } |
---|
| 3077 | |
---|
[815] | 3078 | #if Q0142_POC_LSB_NOT_PRESENT |
---|
| 3079 | #if SHM_FIX7 |
---|
[825] | 3080 | Int iPOClsb = 0; |
---|
[815] | 3081 | #endif |
---|
| 3082 | #endif |
---|
| 3083 | |
---|
[313] | 3084 | if(!rpcSlice->getDependentSliceSegmentFlag()) |
---|
| 3085 | { |
---|
[494] | 3086 | #if SVC_EXTENSION |
---|
[442] | 3087 | #if POC_RESET_FLAG |
---|
[494] | 3088 | Int iBits = 0; |
---|
[442] | 3089 | if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits) |
---|
| 3090 | { |
---|
| 3091 | READ_FLAG(uiCode, "poc_reset_flag"); rpcSlice->setPocResetFlag( uiCode ? true : false ); |
---|
| 3092 | iBits++; |
---|
| 3093 | } |
---|
| 3094 | if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits) |
---|
| 3095 | { |
---|
[588] | 3096 | #if DISCARDABLE_PIC_RPS |
---|
| 3097 | READ_FLAG(uiCode, "discardable_flag"); rpcSlice->setDiscardableFlag( uiCode ? true : false ); |
---|
| 3098 | #else |
---|
[442] | 3099 | READ_FLAG(uiCode, "discardable_flag"); // ignored |
---|
[588] | 3100 | #endif |
---|
[442] | 3101 | iBits++; |
---|
| 3102 | } |
---|
[540] | 3103 | #if O0149_CROSS_LAYER_BLA_FLAG |
---|
| 3104 | if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits) |
---|
| 3105 | { |
---|
| 3106 | READ_FLAG(uiCode, "cross_layer_bla_flag"); rpcSlice->setCrossLayerBLAFlag( uiCode ? true : false ); |
---|
| 3107 | iBits++; |
---|
| 3108 | } |
---|
| 3109 | #endif |
---|
[442] | 3110 | for (; iBits < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); iBits++) |
---|
| 3111 | { |
---|
| 3112 | READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored |
---|
| 3113 | } |
---|
| 3114 | #else |
---|
[887] | 3115 | #if CROSS_LAYER_BLA_FLAG_FIX |
---|
| 3116 | Int iBits = 0; |
---|
| 3117 | if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits) |
---|
| 3118 | #else |
---|
[313] | 3119 | if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits()>0) |
---|
[887] | 3120 | #endif |
---|
[313] | 3121 | { |
---|
| 3122 | READ_FLAG(uiCode, "discardable_flag"); // ignored |
---|
[886] | 3123 | #if NON_REF_NAL_TYPE_DISCARDABLE |
---|
| 3124 | rpcSlice->setDiscardableFlag( uiCode ? true : false ); |
---|
| 3125 | if (uiCode) |
---|
| 3126 | { |
---|
| 3127 | assert(rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_TRAIL_R && |
---|
| 3128 | rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_TSA_R && |
---|
| 3129 | rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_STSA_R && |
---|
| 3130 | rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RADL_R && |
---|
| 3131 | rpcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RASL_R); |
---|
| 3132 | } |
---|
| 3133 | #endif |
---|
[887] | 3134 | #if CROSS_LAYER_BLA_FLAG_FIX |
---|
| 3135 | iBits++; |
---|
| 3136 | #endif |
---|
[313] | 3137 | } |
---|
[887] | 3138 | #if CROSS_LAYER_BLA_FLAG_FIX |
---|
| 3139 | if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits) |
---|
| 3140 | { |
---|
| 3141 | READ_FLAG(uiCode, "cross_layer_bla_flag"); rpcSlice->setCrossLayerBLAFlag( uiCode ? true : false ); |
---|
| 3142 | iBits++; |
---|
| 3143 | } |
---|
| 3144 | for ( ; iBits < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); iBits++) |
---|
| 3145 | #else |
---|
[313] | 3146 | for (Int i = 1; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) |
---|
[887] | 3147 | #endif |
---|
[313] | 3148 | { |
---|
| 3149 | READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored |
---|
| 3150 | } |
---|
[494] | 3151 | #endif |
---|
| 3152 | #else //SVC_EXTENSION |
---|
[313] | 3153 | for (Int i = 0; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) |
---|
| 3154 | { |
---|
| 3155 | READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored |
---|
| 3156 | } |
---|
[494] | 3157 | #endif //SVC_EXTENSION |
---|
[313] | 3158 | |
---|
| 3159 | READ_UVLC ( uiCode, "slice_type" ); rpcSlice->setSliceType((SliceType)uiCode); |
---|
| 3160 | if( pps->getOutputFlagPresentFlag() ) |
---|
| 3161 | { |
---|
| 3162 | READ_FLAG( uiCode, "pic_output_flag" ); rpcSlice->setPicOutputFlag( uiCode ? true : false ); |
---|
| 3163 | } |
---|
| 3164 | else |
---|
| 3165 | { |
---|
| 3166 | rpcSlice->setPicOutputFlag( true ); |
---|
| 3167 | } |
---|
| 3168 | // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present |
---|
| 3169 | assert (sps->getChromaFormatIdc() == 1 ); |
---|
| 3170 | // if( separate_colour_plane_flag == 1 ) |
---|
| 3171 | // colour_plane_id u(2) |
---|
| 3172 | |
---|
| 3173 | if( rpcSlice->getIdrPicFlag() ) |
---|
| 3174 | { |
---|
| 3175 | rpcSlice->setPOC(0); |
---|
| 3176 | TComReferencePictureSet* rps = rpcSlice->getLocalRPS(); |
---|
| 3177 | rps->setNumberOfNegativePictures(0); |
---|
| 3178 | rps->setNumberOfPositivePictures(0); |
---|
| 3179 | rps->setNumberOfLongtermPictures(0); |
---|
| 3180 | rps->setNumberOfPictures(0); |
---|
| 3181 | rpcSlice->setRPS(rps); |
---|
| 3182 | } |
---|
[442] | 3183 | #if N0065_LAYER_POC_ALIGNMENT |
---|
[815] | 3184 | #if !Q0142_POC_LSB_NOT_PRESENT |
---|
[494] | 3185 | #if SHM_FIX7 |
---|
| 3186 | Int iPOClsb = 0; |
---|
| 3187 | #endif |
---|
[815] | 3188 | #endif |
---|
[494] | 3189 | #if O0062_POC_LSB_NOT_PRESENT_FLAG |
---|
| 3190 | if( ( rpcSlice->getLayerId() > 0 && !rpcSlice->getVPS()->getPocLsbNotPresentFlag( rpcSlice->getVPS()->getLayerIdInVps(rpcSlice->getLayerId())) ) || !rpcSlice->getIdrPicFlag()) |
---|
| 3191 | #else |
---|
[442] | 3192 | if( rpcSlice->getLayerId() > 0 || !rpcSlice->getIdrPicFlag() ) |
---|
[494] | 3193 | #endif |
---|
[442] | 3194 | #else |
---|
[313] | 3195 | else |
---|
[442] | 3196 | #endif |
---|
[313] | 3197 | { |
---|
| 3198 | READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb"); |
---|
[815] | 3199 | #if POC_RESET_IDC_DECODER |
---|
| 3200 | rpcSlice->setPicOrderCntLsb( uiCode ); |
---|
| 3201 | #endif |
---|
[494] | 3202 | #if SHM_FIX7 |
---|
| 3203 | iPOClsb = uiCode; |
---|
| 3204 | #else |
---|
[313] | 3205 | Int iPOClsb = uiCode; |
---|
[494] | 3206 | #endif |
---|
[442] | 3207 | Int iPrevPOC = rpcSlice->getPrevTid0POC(); |
---|
[313] | 3208 | Int iMaxPOClsb = 1<< sps->getBitsForPOC(); |
---|
[442] | 3209 | Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1); |
---|
[313] | 3210 | Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb; |
---|
| 3211 | Int iPOCmsb; |
---|
| 3212 | if( ( iPOClsb < iPrevPOClsb ) && ( ( iPrevPOClsb - iPOClsb ) >= ( iMaxPOClsb / 2 ) ) ) |
---|
| 3213 | { |
---|
| 3214 | iPOCmsb = iPrevPOCmsb + iMaxPOClsb; |
---|
| 3215 | } |
---|
| 3216 | else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) ) |
---|
| 3217 | { |
---|
| 3218 | iPOCmsb = iPrevPOCmsb - iMaxPOClsb; |
---|
| 3219 | } |
---|
| 3220 | else |
---|
| 3221 | { |
---|
| 3222 | iPOCmsb = iPrevPOCmsb; |
---|
| 3223 | } |
---|
| 3224 | if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 3225 | || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 3226 | || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) |
---|
| 3227 | { |
---|
| 3228 | // For BLA picture types, POCmsb is set to 0. |
---|
| 3229 | iPOCmsb = 0; |
---|
| 3230 | } |
---|
| 3231 | rpcSlice->setPOC (iPOCmsb+iPOClsb); |
---|
| 3232 | |
---|
[442] | 3233 | #if N0065_LAYER_POC_ALIGNMENT |
---|
[494] | 3234 | #if SHM_FIX7 |
---|
[825] | 3235 | } |
---|
[494] | 3236 | #endif |
---|
[815] | 3237 | #if POC_RESET_IDC_DECODER |
---|
[825] | 3238 | else |
---|
| 3239 | { |
---|
| 3240 | rpcSlice->setPicOrderCntLsb( 0 ); |
---|
| 3241 | } |
---|
| 3242 | #endif |
---|
| 3243 | if( !rpcSlice->getIdrPicFlag() ) |
---|
| 3244 | { |
---|
| 3245 | #endif |
---|
| 3246 | TComReferencePictureSet* rps; |
---|
| 3247 | rps = rpcSlice->getLocalRPS(); |
---|
| 3248 | rpcSlice->setRPS(rps); |
---|
| 3249 | READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); |
---|
| 3250 | if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header |
---|
[815] | 3251 | { |
---|
[825] | 3252 | parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); |
---|
[815] | 3253 | } |
---|
[825] | 3254 | else // use reference to short-term reference picture set in PPS |
---|
| 3255 | { |
---|
| 3256 | Int numBits = 0; |
---|
| 3257 | while ((1 << numBits) < rpcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets()) |
---|
[442] | 3258 | { |
---|
[825] | 3259 | numBits++; |
---|
| 3260 | } |
---|
| 3261 | if (numBits > 0) |
---|
[313] | 3262 | { |
---|
[825] | 3263 | READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); |
---|
[313] | 3264 | } |
---|
[825] | 3265 | else |
---|
[313] | 3266 | { |
---|
[825] | 3267 | uiCode = 0; |
---|
[313] | 3268 | } |
---|
[825] | 3269 | *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); |
---|
| 3270 | } |
---|
| 3271 | if(sps->getLongTermRefsPresent()) |
---|
| 3272 | { |
---|
| 3273 | Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); |
---|
| 3274 | UInt numOfLtrp = 0; |
---|
| 3275 | UInt numLtrpInSPS = 0; |
---|
| 3276 | if (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > 0) |
---|
[313] | 3277 | { |
---|
[825] | 3278 | READ_UVLC( uiCode, "num_long_term_sps"); |
---|
| 3279 | numLtrpInSPS = uiCode; |
---|
| 3280 | numOfLtrp += numLtrpInSPS; |
---|
| 3281 | rps->setNumberOfLongtermPictures(numOfLtrp); |
---|
| 3282 | } |
---|
| 3283 | Int bitsForLtrpInSPS = 0; |
---|
| 3284 | while (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) |
---|
| 3285 | { |
---|
| 3286 | bitsForLtrpInSPS++; |
---|
| 3287 | } |
---|
| 3288 | READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); |
---|
| 3289 | numOfLtrp += uiCode; |
---|
| 3290 | rps->setNumberOfLongtermPictures(numOfLtrp); |
---|
| 3291 | Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); |
---|
| 3292 | Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; |
---|
| 3293 | for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) |
---|
| 3294 | { |
---|
| 3295 | Int pocLsbLt; |
---|
| 3296 | if (k < numLtrpInSPS) |
---|
[313] | 3297 | { |
---|
[825] | 3298 | uiCode = 0; |
---|
| 3299 | if (bitsForLtrpInSPS > 0) |
---|
| 3300 | { |
---|
| 3301 | READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]"); |
---|
| 3302 | } |
---|
| 3303 | Int usedByCurrFromSPS=rpcSlice->getSPS()->getUsedByCurrPicLtSPSFlag(uiCode); |
---|
| 3304 | |
---|
| 3305 | pocLsbLt = rpcSlice->getSPS()->getLtRefPicPocLsbSps(uiCode); |
---|
| 3306 | rps->setUsed(j,usedByCurrFromSPS); |
---|
[313] | 3307 | } |
---|
[825] | 3308 | else |
---|
[313] | 3309 | { |
---|
[825] | 3310 | READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode; |
---|
| 3311 | READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); |
---|
[313] | 3312 | } |
---|
[825] | 3313 | READ_FLAG(uiCode,"delta_poc_msb_present_flag"); |
---|
| 3314 | Bool mSBPresentFlag = uiCode ? true : false; |
---|
| 3315 | if(mSBPresentFlag) |
---|
[313] | 3316 | { |
---|
[825] | 3317 | READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); |
---|
| 3318 | Bool deltaFlag = false; |
---|
| 3319 | // First LTRP || First LTRP from SH |
---|
| 3320 | if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) |
---|
[313] | 3321 | { |
---|
[825] | 3322 | deltaFlag = true; |
---|
[313] | 3323 | } |
---|
[825] | 3324 | if(deltaFlag) |
---|
| 3325 | { |
---|
| 3326 | deltaPocMSBCycleLT = uiCode; |
---|
| 3327 | } |
---|
[313] | 3328 | else |
---|
| 3329 | { |
---|
[825] | 3330 | deltaPocMSBCycleLT = uiCode + prevDeltaMSB; |
---|
[313] | 3331 | } |
---|
| 3332 | |
---|
[825] | 3333 | Int pocLTCurr = rpcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB |
---|
| 3334 | - iPOClsb + pocLsbLt; |
---|
| 3335 | rps->setPOC (j, pocLTCurr); |
---|
| 3336 | rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLTCurr); |
---|
| 3337 | rps->setCheckLTMSBPresent(j,true); |
---|
| 3338 | } |
---|
| 3339 | else |
---|
| 3340 | { |
---|
| 3341 | rps->setPOC (j, pocLsbLt); |
---|
| 3342 | rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt); |
---|
| 3343 | rps->setCheckLTMSBPresent(j,false); |
---|
| 3344 | |
---|
| 3345 | // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present |
---|
| 3346 | if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) |
---|
[313] | 3347 | { |
---|
[825] | 3348 | deltaPocMSBCycleLT = 0; |
---|
[313] | 3349 | } |
---|
| 3350 | } |
---|
[825] | 3351 | prevDeltaMSB = deltaPocMSBCycleLT; |
---|
[313] | 3352 | } |
---|
[825] | 3353 | offset += rps->getNumberOfLongtermPictures(); |
---|
| 3354 | rps->setNumberOfPictures(offset); |
---|
| 3355 | } |
---|
[815] | 3356 | #if DPB_CONSTRAINTS |
---|
[825] | 3357 | if(rpcSlice->getVPS()->getVpsExtensionFlag()==1) |
---|
| 3358 | { |
---|
[815] | 3359 | #if Q0078_ADD_LAYER_SETS |
---|
[825] | 3360 | for (Int ii = 1; ii < (rpcSlice->getVPS()->getVpsNumLayerSetsMinus1() + 1); ii++) // prevent assert error when num_add_layer_sets > 0 |
---|
[815] | 3361 | #else |
---|
[825] | 3362 | for (Int ii=1; ii< rpcSlice->getVPS()->getNumOutputLayerSets(); ii++ ) |
---|
[815] | 3363 | #endif |
---|
[825] | 3364 | { |
---|
| 3365 | Int layerSetIdxForOutputLayerSet = rpcSlice->getVPS()->getOutputLayerSetIdx( ii ); |
---|
| 3366 | Int chkAssert=0; |
---|
| 3367 | for(Int kk = 0; kk < rpcSlice->getVPS()->getNumLayersInIdList(layerSetIdxForOutputLayerSet); kk++) |
---|
| 3368 | { |
---|
| 3369 | if(rpcSlice->getLayerId()==rpcSlice->getVPS()->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, kk)) |
---|
[815] | 3370 | { |
---|
[825] | 3371 | chkAssert=1; |
---|
[815] | 3372 | } |
---|
[825] | 3373 | } |
---|
| 3374 | if(chkAssert) |
---|
| 3375 | { |
---|
| 3376 | // There may be something wrong here (layer id assumed to be layer idx?) |
---|
| 3377 | assert(rps->getNumberOfNegativePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii))); |
---|
| 3378 | assert(rps->getNumberOfPositivePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)) - rps->getNumberOfNegativePictures()); |
---|
| 3379 | assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii))); |
---|
| 3380 | } |
---|
[313] | 3381 | } |
---|
[825] | 3382 | |
---|
| 3383 | |
---|
[313] | 3384 | } |
---|
[825] | 3385 | if(rpcSlice->getLayerId() == 0) |
---|
| 3386 | { |
---|
| 3387 | assert(rps->getNumberOfNegativePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) ); |
---|
| 3388 | assert(rps->getNumberOfPositivePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) -rps->getNumberOfNegativePictures()); |
---|
| 3389 | assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1)); |
---|
| 3390 | } |
---|
[442] | 3391 | #endif |
---|
[825] | 3392 | if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 3393 | || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 3394 | || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) |
---|
| 3395 | { |
---|
| 3396 | // In the case of BLA picture types, rps data is read from slice header but ignored |
---|
| 3397 | rps = rpcSlice->getLocalRPS(); |
---|
| 3398 | rps->setNumberOfNegativePictures(0); |
---|
| 3399 | rps->setNumberOfPositivePictures(0); |
---|
| 3400 | rps->setNumberOfLongtermPictures(0); |
---|
| 3401 | rps->setNumberOfPictures(0); |
---|
| 3402 | rpcSlice->setRPS(rps); |
---|
[442] | 3403 | } |
---|
[825] | 3404 | if (rpcSlice->getSPS()->getTMVPFlagsPresent()) |
---|
| 3405 | { |
---|
[850] | 3406 | #if R0226_SLICE_TMVP |
---|
| 3407 | READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); |
---|
| 3408 | #else |
---|
[825] | 3409 | READ_FLAG( uiCode, "slice_temporal_mvp_enable_flag" ); |
---|
[850] | 3410 | #endif |
---|
[825] | 3411 | rpcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); |
---|
| 3412 | } |
---|
| 3413 | else |
---|
| 3414 | { |
---|
| 3415 | rpcSlice->setEnableTMVPFlag(false); |
---|
| 3416 | } |
---|
| 3417 | #if N0065_LAYER_POC_ALIGNMENT && !SHM_FIX7 |
---|
| 3418 | } |
---|
| 3419 | #endif |
---|
| 3420 | } |
---|
[313] | 3421 | |
---|
[442] | 3422 | #if SVC_EXTENSION |
---|
[825] | 3423 | rpcSlice->setActiveNumILRRefIdx(0); |
---|
| 3424 | if((rpcSlice->getLayerId() > 0) && !(rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (rpcSlice->getNumILRRefIdx() > 0) ) |
---|
| 3425 | { |
---|
| 3426 | READ_FLAG(uiCode,"inter_layer_pred_enabled_flag"); |
---|
| 3427 | rpcSlice->setInterLayerPredEnabledFlag(uiCode); |
---|
| 3428 | if( rpcSlice->getInterLayerPredEnabledFlag()) |
---|
[313] | 3429 | { |
---|
[825] | 3430 | if(rpcSlice->getNumILRRefIdx() > 1) |
---|
[313] | 3431 | { |
---|
[825] | 3432 | Int numBits = 1; |
---|
| 3433 | while ((1 << numBits) < rpcSlice->getNumILRRefIdx()) |
---|
[313] | 3434 | { |
---|
[825] | 3435 | numBits++; |
---|
| 3436 | } |
---|
| 3437 | if( !rpcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) |
---|
| 3438 | { |
---|
| 3439 | READ_CODE( numBits, uiCode,"num_inter_layer_ref_pics_minus1" ); |
---|
| 3440 | rpcSlice->setActiveNumILRRefIdx(uiCode + 1); |
---|
| 3441 | } |
---|
| 3442 | else |
---|
| 3443 | { |
---|
| 3444 | #if P0079_DERIVE_NUMACTIVE_REF_PICS |
---|
| 3445 | for( Int i = 0; i < rpcSlice->getNumILRRefIdx(); i++ ) |
---|
[313] | 3446 | { |
---|
[713] | 3447 | #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO |
---|
[825] | 3448 | if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) && |
---|
| 3449 | (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) |
---|
[713] | 3450 | #else |
---|
[825] | 3451 | if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() && |
---|
| 3452 | (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) |
---|
[713] | 3453 | #endif |
---|
[825] | 3454 | { |
---|
| 3455 | rpcSlice->setActiveNumILRRefIdx(1); |
---|
| 3456 | break; |
---|
[588] | 3457 | } |
---|
[825] | 3458 | } |
---|
[588] | 3459 | #else |
---|
[825] | 3460 | rpcSlice->setActiveNumILRRefIdx(1); |
---|
[588] | 3461 | #endif |
---|
[825] | 3462 | } |
---|
[815] | 3463 | |
---|
[825] | 3464 | if( rpcSlice->getActiveNumILRRefIdx() == rpcSlice->getNumILRRefIdx() ) |
---|
| 3465 | { |
---|
| 3466 | for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) |
---|
[345] | 3467 | { |
---|
[825] | 3468 | rpcSlice->setInterLayerPredLayerIdc(i,i); |
---|
[345] | 3469 | } |
---|
[825] | 3470 | } |
---|
| 3471 | else |
---|
| 3472 | { |
---|
| 3473 | for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) |
---|
[345] | 3474 | { |
---|
[825] | 3475 | READ_CODE( numBits,uiCode,"inter_layer_pred_layer_idc[i]" ); |
---|
| 3476 | rpcSlice->setInterLayerPredLayerIdc(uiCode,i); |
---|
[313] | 3477 | } |
---|
| 3478 | } |
---|
[825] | 3479 | } |
---|
| 3480 | else |
---|
| 3481 | { |
---|
[540] | 3482 | #if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS |
---|
[713] | 3483 | #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO |
---|
[825] | 3484 | if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(0,rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) && |
---|
| 3485 | (rpcSlice->getVPS()->getMaxTSLayersMinus1(0) >= rpcSlice->getTLayer()) ) |
---|
[713] | 3486 | #else |
---|
[825] | 3487 | if( (rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(0,rpcSlice->getLayerId()) > rpcSlice->getTLayer()) && |
---|
| 3488 | (rpcSlice->getVPS()->getMaxTSLayersMinus1(0) >= rpcSlice->getTLayer()) ) |
---|
[713] | 3489 | #endif |
---|
[540] | 3490 | { |
---|
| 3491 | #endif |
---|
[313] | 3492 | rpcSlice->setActiveNumILRRefIdx(1); |
---|
| 3493 | rpcSlice->setInterLayerPredLayerIdc(0,0); |
---|
[540] | 3494 | #if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS |
---|
[313] | 3495 | } |
---|
[540] | 3496 | #endif |
---|
[313] | 3497 | } |
---|
| 3498 | } |
---|
[825] | 3499 | } |
---|
| 3500 | else if( rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() == true && (rpcSlice->getLayerId() > 0 )) |
---|
| 3501 | { |
---|
| 3502 | rpcSlice->setInterLayerPredEnabledFlag(true); |
---|
[540] | 3503 | |
---|
| 3504 | #if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS |
---|
[825] | 3505 | Int numRefLayerPics = 0; |
---|
| 3506 | Int i = 0; |
---|
| 3507 | Int refLayerPicIdc [MAX_VPS_LAYER_ID_PLUS1]; |
---|
| 3508 | for(i = 0, numRefLayerPics = 0; i < rpcSlice->getNumILRRefIdx(); i++ ) |
---|
| 3509 | { |
---|
[713] | 3510 | #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO |
---|
[825] | 3511 | if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) && |
---|
| 3512 | (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) |
---|
[713] | 3513 | #else |
---|
[825] | 3514 | if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() && |
---|
| 3515 | (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) |
---|
[713] | 3516 | #endif |
---|
[825] | 3517 | { |
---|
| 3518 | refLayerPicIdc[ numRefLayerPics++ ] = i; |
---|
[540] | 3519 | } |
---|
[825] | 3520 | } |
---|
| 3521 | rpcSlice->setActiveNumILRRefIdx(numRefLayerPics); |
---|
| 3522 | for( i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) |
---|
| 3523 | { |
---|
| 3524 | rpcSlice->setInterLayerPredLayerIdc(refLayerPicIdc[i],i); |
---|
| 3525 | } |
---|
[540] | 3526 | #else |
---|
[825] | 3527 | rpcSlice->setActiveNumILRRefIdx(rpcSlice->getNumILRRefIdx()); |
---|
| 3528 | for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) |
---|
| 3529 | { |
---|
| 3530 | rpcSlice->setInterLayerPredLayerIdc(i,i); |
---|
| 3531 | } |
---|
[540] | 3532 | #endif |
---|
[825] | 3533 | } |
---|
[644] | 3534 | #if P0312_VERT_PHASE_ADJ |
---|
[849] | 3535 | for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) |
---|
[644] | 3536 | { |
---|
[849] | 3537 | UInt refLayerIdc = rpcSlice->getInterLayerPredLayerIdc(i); |
---|
| 3538 | #if !MOVE_SCALED_OFFSET_TO_PPS |
---|
| 3539 | if( rpcSlice->getSPS()->getVertPhasePositionEnableFlag(refLayerIdc) ) |
---|
| 3540 | #else |
---|
| 3541 | if( rpcSlice->getPPS()->getVertPhasePositionEnableFlag(refLayerIdc) ) |
---|
| 3542 | #endif |
---|
| 3543 | { |
---|
| 3544 | READ_FLAG( uiCode, "vert_phase_position_flag" ); rpcSlice->setVertPhasePositionFlag( uiCode? true : false, refLayerIdc ); |
---|
| 3545 | } |
---|
[825] | 3546 | } |
---|
[644] | 3547 | #endif |
---|
[815] | 3548 | #endif //SVC_EXTENSION |
---|
[313] | 3549 | |
---|
[825] | 3550 | if(sps->getUseSAO()) |
---|
| 3551 | { |
---|
| 3552 | READ_FLAG(uiCode, "slice_sao_luma_flag"); rpcSlice->setSaoEnabledFlag((Bool)uiCode); |
---|
[494] | 3553 | #if AUXILIARY_PICTURES |
---|
[825] | 3554 | ChromaFormat format; |
---|
[494] | 3555 | #if REPN_FORMAT_IN_VPS |
---|
[540] | 3556 | #if O0096_REP_FORMAT_INDEX |
---|
[825] | 3557 | if( sps->getLayerId() == 0 ) |
---|
| 3558 | { |
---|
| 3559 | format = sps->getChromaFormatIdc(); |
---|
| 3560 | } |
---|
| 3561 | else |
---|
| 3562 | { |
---|
| 3563 | format = rpcSlice->getVPS()->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc(); |
---|
[713] | 3564 | #if Q0195_REP_FORMAT_CLEANUP |
---|
[825] | 3565 | assert( (sps->getUpdateRepFormatFlag()==false && rpcSlice->getVPS()->getVpsNumRepFormats()==1) || rpcSlice->getVPS()->getVpsNumRepFormats() > 1 ); //conformance check |
---|
[713] | 3566 | #endif |
---|
[825] | 3567 | } |
---|
[540] | 3568 | #else |
---|
[825] | 3569 | if( ( sps->getLayerId() == 0 ) || sps->getUpdateRepFormatFlag() ) |
---|
| 3570 | { |
---|
| 3571 | format = sps->getChromaFormatIdc(); |
---|
| 3572 | } |
---|
| 3573 | else |
---|
| 3574 | { |
---|
| 3575 | format = rpcSlice->getVPS()->getVpsRepFormat( rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc(); |
---|
| 3576 | } |
---|
[540] | 3577 | #endif |
---|
[494] | 3578 | #else |
---|
[825] | 3579 | format = sps->getChromaFormatIdc(); |
---|
[494] | 3580 | #endif |
---|
[825] | 3581 | if (format != CHROMA_400) |
---|
| 3582 | { |
---|
[494] | 3583 | #endif |
---|
[313] | 3584 | READ_FLAG(uiCode, "slice_sao_chroma_flag"); rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode); |
---|
[494] | 3585 | #if AUXILIARY_PICTURES |
---|
[313] | 3586 | } |
---|
[825] | 3587 | else |
---|
[313] | 3588 | { |
---|
[825] | 3589 | rpcSlice->setSaoEnabledFlagChroma(false); |
---|
[313] | 3590 | } |
---|
[825] | 3591 | #endif |
---|
| 3592 | } |
---|
| 3593 | |
---|
| 3594 | if (rpcSlice->getIdrPicFlag()) |
---|
| 3595 | { |
---|
| 3596 | rpcSlice->setEnableTMVPFlag(false); |
---|
| 3597 | } |
---|
| 3598 | if (!rpcSlice->isIntra()) |
---|
| 3599 | { |
---|
| 3600 | |
---|
| 3601 | READ_FLAG( uiCode, "num_ref_idx_active_override_flag"); |
---|
| 3602 | if (uiCode) |
---|
[313] | 3603 | { |
---|
[825] | 3604 | READ_UVLC (uiCode, "num_ref_idx_l0_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 ); |
---|
| 3605 | if (rpcSlice->isInterB()) |
---|
[313] | 3606 | { |
---|
[825] | 3607 | READ_UVLC (uiCode, "num_ref_idx_l1_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 ); |
---|
[313] | 3608 | } |
---|
| 3609 | else |
---|
| 3610 | { |
---|
[825] | 3611 | rpcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); |
---|
[313] | 3612 | } |
---|
| 3613 | } |
---|
[825] | 3614 | else |
---|
[313] | 3615 | { |
---|
[825] | 3616 | rpcSlice->setNumRefIdx(REF_PIC_LIST_0, rpcSlice->getPPS()->getNumRefIdxL0DefaultActive()); |
---|
| 3617 | if (rpcSlice->isInterB()) |
---|
[313] | 3618 | { |
---|
[825] | 3619 | rpcSlice->setNumRefIdx(REF_PIC_LIST_1, rpcSlice->getPPS()->getNumRefIdxL1DefaultActive()); |
---|
[313] | 3620 | } |
---|
| 3621 | else |
---|
| 3622 | { |
---|
[825] | 3623 | rpcSlice->setNumRefIdx(REF_PIC_LIST_1,0); |
---|
[313] | 3624 | } |
---|
[825] | 3625 | } |
---|
| 3626 | } |
---|
| 3627 | // } |
---|
| 3628 | TComRefPicListModification* refPicListModification = rpcSlice->getRefPicListModification(); |
---|
| 3629 | if(!rpcSlice->isIntra()) |
---|
| 3630 | { |
---|
| 3631 | if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) |
---|
| 3632 | { |
---|
| 3633 | refPicListModification->setRefPicListModificationFlagL0( 0 ); |
---|
| 3634 | } |
---|
| 3635 | else |
---|
| 3636 | { |
---|
| 3637 | READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); refPicListModification->setRefPicListModificationFlagL0( uiCode ? 1 : 0 ); |
---|
| 3638 | } |
---|
[313] | 3639 | |
---|
[825] | 3640 | if(refPicListModification->getRefPicListModificationFlagL0()) |
---|
| 3641 | { |
---|
| 3642 | uiCode = 0; |
---|
| 3643 | Int i = 0; |
---|
| 3644 | Int numRpsCurrTempList0 = rpcSlice->getNumRpsCurrTempList(); |
---|
| 3645 | if ( numRpsCurrTempList0 > 1 ) |
---|
[313] | 3646 | { |
---|
[825] | 3647 | Int length = 1; |
---|
| 3648 | numRpsCurrTempList0 --; |
---|
| 3649 | while ( numRpsCurrTempList0 >>= 1) |
---|
[313] | 3650 | { |
---|
[825] | 3651 | length ++; |
---|
[313] | 3652 | } |
---|
[825] | 3653 | for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) |
---|
[313] | 3654 | { |
---|
[825] | 3655 | READ_CODE( length, uiCode, "list_entry_l0" ); |
---|
| 3656 | refPicListModification->setRefPicSetIdxL0(i, uiCode ); |
---|
[313] | 3657 | } |
---|
| 3658 | } |
---|
[825] | 3659 | else |
---|
| 3660 | { |
---|
| 3661 | for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) |
---|
| 3662 | { |
---|
| 3663 | refPicListModification->setRefPicSetIdxL0(i, 0 ); |
---|
| 3664 | } |
---|
| 3665 | } |
---|
[313] | 3666 | } |
---|
[825] | 3667 | } |
---|
| 3668 | else |
---|
| 3669 | { |
---|
| 3670 | refPicListModification->setRefPicListModificationFlagL0(0); |
---|
| 3671 | } |
---|
| 3672 | if(rpcSlice->isInterB()) |
---|
| 3673 | { |
---|
| 3674 | if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) |
---|
| 3675 | { |
---|
| 3676 | refPicListModification->setRefPicListModificationFlagL1( 0 ); |
---|
| 3677 | } |
---|
[313] | 3678 | else |
---|
| 3679 | { |
---|
[825] | 3680 | READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); refPicListModification->setRefPicListModificationFlagL1( uiCode ? 1 : 0 ); |
---|
[313] | 3681 | } |
---|
[825] | 3682 | if(refPicListModification->getRefPicListModificationFlagL1()) |
---|
[313] | 3683 | { |
---|
[825] | 3684 | uiCode = 0; |
---|
| 3685 | Int i = 0; |
---|
| 3686 | Int numRpsCurrTempList1 = rpcSlice->getNumRpsCurrTempList(); |
---|
| 3687 | if ( numRpsCurrTempList1 > 1 ) |
---|
[313] | 3688 | { |
---|
[825] | 3689 | Int length = 1; |
---|
| 3690 | numRpsCurrTempList1 --; |
---|
| 3691 | while ( numRpsCurrTempList1 >>= 1) |
---|
| 3692 | { |
---|
| 3693 | length ++; |
---|
| 3694 | } |
---|
| 3695 | for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) |
---|
| 3696 | { |
---|
| 3697 | READ_CODE( length, uiCode, "list_entry_l1" ); |
---|
| 3698 | refPicListModification->setRefPicSetIdxL1(i, uiCode ); |
---|
| 3699 | } |
---|
[313] | 3700 | } |
---|
| 3701 | else |
---|
| 3702 | { |
---|
[825] | 3703 | for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) |
---|
[313] | 3704 | { |
---|
[825] | 3705 | refPicListModification->setRefPicSetIdxL1(i, 0 ); |
---|
[313] | 3706 | } |
---|
| 3707 | } |
---|
| 3708 | } |
---|
[825] | 3709 | } |
---|
| 3710 | else |
---|
| 3711 | { |
---|
| 3712 | refPicListModification->setRefPicListModificationFlagL1(0); |
---|
| 3713 | } |
---|
| 3714 | if (rpcSlice->isInterB()) |
---|
| 3715 | { |
---|
| 3716 | READ_FLAG( uiCode, "mvd_l1_zero_flag" ); rpcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) ); |
---|
| 3717 | } |
---|
| 3718 | |
---|
| 3719 | rpcSlice->setCabacInitFlag( false ); // default |
---|
| 3720 | if(pps->getCabacInitPresentFlag() && !rpcSlice->isIntra()) |
---|
| 3721 | { |
---|
| 3722 | READ_FLAG(uiCode, "cabac_init_flag"); |
---|
| 3723 | rpcSlice->setCabacInitFlag( uiCode ? true : false ); |
---|
| 3724 | } |
---|
| 3725 | |
---|
| 3726 | if ( rpcSlice->getEnableTMVPFlag() ) |
---|
| 3727 | { |
---|
| 3728 | #if SVC_EXTENSION && REF_IDX_MFM |
---|
| 3729 | // set motion mapping flag |
---|
| 3730 | rpcSlice->setMFMEnabledFlag( ( rpcSlice->getNumMotionPredRefLayers() > 0 && rpcSlice->getActiveNumILRRefIdx() && !rpcSlice->isIntra() ) ? true : false ); |
---|
| 3731 | #endif |
---|
| 3732 | if ( rpcSlice->getSliceType() == B_SLICE ) |
---|
[313] | 3733 | { |
---|
[825] | 3734 | READ_FLAG( uiCode, "collocated_from_l0_flag" ); |
---|
| 3735 | rpcSlice->setColFromL0Flag(uiCode); |
---|
[313] | 3736 | } |
---|
[825] | 3737 | else |
---|
[313] | 3738 | { |
---|
[825] | 3739 | rpcSlice->setColFromL0Flag( 1 ); |
---|
[313] | 3740 | } |
---|
| 3741 | |
---|
[825] | 3742 | if ( rpcSlice->getSliceType() != I_SLICE && |
---|
| 3743 | ((rpcSlice->getColFromL0Flag() == 1 && rpcSlice->getNumRefIdx(REF_PIC_LIST_0) > 1)|| |
---|
| 3744 | (rpcSlice->getColFromL0Flag() == 0 && rpcSlice->getNumRefIdx(REF_PIC_LIST_1) > 1))) |
---|
[313] | 3745 | { |
---|
[825] | 3746 | READ_UVLC( uiCode, "collocated_ref_idx" ); |
---|
| 3747 | rpcSlice->setColRefIdx(uiCode); |
---|
[313] | 3748 | } |
---|
[825] | 3749 | else |
---|
[313] | 3750 | { |
---|
[825] | 3751 | rpcSlice->setColRefIdx(0); |
---|
[313] | 3752 | } |
---|
[825] | 3753 | } |
---|
| 3754 | if ( (pps->getUseWP() && rpcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && rpcSlice->getSliceType()==B_SLICE) ) |
---|
| 3755 | { |
---|
| 3756 | xParsePredWeightTable(rpcSlice); |
---|
| 3757 | rpcSlice->initWpScaling(); |
---|
| 3758 | } |
---|
| 3759 | if (!rpcSlice->isIntra()) |
---|
| 3760 | { |
---|
| 3761 | READ_UVLC( uiCode, "five_minus_max_num_merge_cand"); |
---|
| 3762 | rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); |
---|
| 3763 | } |
---|
[313] | 3764 | |
---|
[825] | 3765 | READ_SVLC( iCode, "slice_qp_delta" ); |
---|
| 3766 | rpcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); |
---|
[313] | 3767 | |
---|
[442] | 3768 | #if REPN_FORMAT_IN_VPS |
---|
[494] | 3769 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
[825] | 3770 | g_bitDepthYLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthY(); |
---|
| 3771 | g_bitDepthCLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthC(); |
---|
[494] | 3772 | #endif |
---|
[825] | 3773 | assert( rpcSlice->getSliceQp() >= -rpcSlice->getQpBDOffsetY() ); |
---|
[442] | 3774 | #else |
---|
[825] | 3775 | assert( rpcSlice->getSliceQp() >= -sps->getQpBDOffsetY() ); |
---|
[442] | 3776 | #endif |
---|
[825] | 3777 | assert( rpcSlice->getSliceQp() <= 51 ); |
---|
[313] | 3778 | |
---|
[825] | 3779 | if (rpcSlice->getPPS()->getSliceChromaQpFlag()) |
---|
| 3780 | { |
---|
| 3781 | READ_SVLC( iCode, "slice_qp_delta_cb" ); |
---|
| 3782 | rpcSlice->setSliceQpDeltaCb( iCode ); |
---|
| 3783 | assert( rpcSlice->getSliceQpDeltaCb() >= -12 ); |
---|
| 3784 | assert( rpcSlice->getSliceQpDeltaCb() <= 12 ); |
---|
| 3785 | assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) >= -12 ); |
---|
| 3786 | assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) <= 12 ); |
---|
[313] | 3787 | |
---|
[825] | 3788 | READ_SVLC( iCode, "slice_qp_delta_cr" ); |
---|
| 3789 | rpcSlice->setSliceQpDeltaCr( iCode ); |
---|
| 3790 | assert( rpcSlice->getSliceQpDeltaCr() >= -12 ); |
---|
| 3791 | assert( rpcSlice->getSliceQpDeltaCr() <= 12 ); |
---|
| 3792 | assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) >= -12 ); |
---|
| 3793 | assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) <= 12 ); |
---|
| 3794 | } |
---|
[313] | 3795 | |
---|
[825] | 3796 | if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) |
---|
| 3797 | { |
---|
| 3798 | if(rpcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag()) |
---|
[313] | 3799 | { |
---|
[825] | 3800 | READ_FLAG ( uiCode, "deblocking_filter_override_flag" ); rpcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false); |
---|
[313] | 3801 | } |
---|
| 3802 | else |
---|
| 3803 | { |
---|
[825] | 3804 | rpcSlice->setDeblockingFilterOverrideFlag(0); |
---|
[313] | 3805 | } |
---|
[825] | 3806 | if(rpcSlice->getDeblockingFilterOverrideFlag()) |
---|
[313] | 3807 | { |
---|
[825] | 3808 | READ_FLAG ( uiCode, "slice_disable_deblocking_filter_flag" ); rpcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0); |
---|
| 3809 | if(!rpcSlice->getDeblockingFilterDisable()) |
---|
| 3810 | { |
---|
| 3811 | READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); |
---|
| 3812 | assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && |
---|
| 3813 | rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); |
---|
| 3814 | READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); |
---|
| 3815 | assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && |
---|
| 3816 | rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); |
---|
| 3817 | } |
---|
[313] | 3818 | } |
---|
| 3819 | else |
---|
| 3820 | { |
---|
[825] | 3821 | rpcSlice->setDeblockingFilterDisable ( rpcSlice->getPPS()->getPicDisableDeblockingFilterFlag() ); |
---|
| 3822 | rpcSlice->setDeblockingFilterBetaOffsetDiv2( rpcSlice->getPPS()->getDeblockingFilterBetaOffsetDiv2() ); |
---|
| 3823 | rpcSlice->setDeblockingFilterTcOffsetDiv2 ( rpcSlice->getPPS()->getDeblockingFilterTcOffsetDiv2() ); |
---|
[313] | 3824 | } |
---|
| 3825 | } |
---|
[825] | 3826 | else |
---|
| 3827 | { |
---|
| 3828 | rpcSlice->setDeblockingFilterDisable ( false ); |
---|
| 3829 | rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); |
---|
| 3830 | rpcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 ); |
---|
| 3831 | } |
---|
[313] | 3832 | |
---|
[825] | 3833 | Bool isSAOEnabled = (!rpcSlice->getSPS()->getUseSAO())?(false):(rpcSlice->getSaoEnabledFlag()||rpcSlice->getSaoEnabledFlagChroma()); |
---|
| 3834 | Bool isDBFEnabled = (!rpcSlice->getDeblockingFilterDisable()); |
---|
| 3835 | |
---|
| 3836 | if(rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) |
---|
[313] | 3837 | { |
---|
[825] | 3838 | READ_FLAG( uiCode, "slice_loop_filter_across_slices_enabled_flag"); |
---|
[313] | 3839 | } |
---|
| 3840 | else |
---|
| 3841 | { |
---|
[825] | 3842 | uiCode = rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()?1:0; |
---|
[313] | 3843 | } |
---|
[825] | 3844 | rpcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false); |
---|
[313] | 3845 | |
---|
[825] | 3846 | } |
---|
| 3847 | |
---|
| 3848 | UInt *entryPointOffset = NULL; |
---|
| 3849 | UInt numEntryPointOffsets, offsetLenMinus1; |
---|
| 3850 | if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) |
---|
| 3851 | { |
---|
| 3852 | READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); |
---|
| 3853 | if (numEntryPointOffsets>0) |
---|
| 3854 | { |
---|
| 3855 | READ_UVLC(offsetLenMinus1, "offset_len_minus1"); |
---|
| 3856 | } |
---|
| 3857 | entryPointOffset = new UInt[numEntryPointOffsets]; |
---|
| 3858 | for (UInt idx=0; idx<numEntryPointOffsets; idx++) |
---|
| 3859 | { |
---|
| 3860 | READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); |
---|
| 3861 | entryPointOffset[ idx ] = uiCode + 1; |
---|
| 3862 | } |
---|
| 3863 | } |
---|
| 3864 | else |
---|
| 3865 | { |
---|
| 3866 | rpcSlice->setNumEntryPointOffsets ( 0 ); |
---|
| 3867 | } |
---|
| 3868 | |
---|
[644] | 3869 | #if POC_RESET_IDC_SIGNALLING |
---|
[825] | 3870 | Int sliceHeaderExtensionLength = 0; |
---|
| 3871 | if(pps->getSliceHeaderExtensionPresentFlag()) |
---|
| 3872 | { |
---|
| 3873 | READ_UVLC( uiCode, "slice_header_extension_length"); sliceHeaderExtensionLength = uiCode; |
---|
| 3874 | } |
---|
| 3875 | else |
---|
| 3876 | { |
---|
| 3877 | sliceHeaderExtensionLength = 0; |
---|
[888] | 3878 | #if INFERENCE_POC_MSB_VAL_PRESENT |
---|
| 3879 | rpcSlice->setPocMsbValPresentFlag( false ); |
---|
| 3880 | #endif |
---|
[825] | 3881 | } |
---|
| 3882 | UInt startBits = m_pcBitstream->getNumBitsRead(); // Start counter of # SH Extn bits |
---|
| 3883 | if( sliceHeaderExtensionLength > 0 ) |
---|
| 3884 | { |
---|
| 3885 | if( rpcSlice->getPPS()->getPocResetInfoPresentFlag() ) |
---|
[313] | 3886 | { |
---|
[825] | 3887 | READ_CODE( 2, uiCode, "poc_reset_idc"); rpcSlice->setPocResetIdc(uiCode); |
---|
[851] | 3888 | #if POC_RESET_RESTRICTIONS |
---|
| 3889 | /* The value of poc_reset_idc shall not be equal to 1 or 2 for a RASL picture, a RADL picture, |
---|
| 3890 | a sub-layer non-reference picture, or a picture that has TemporalId greater than 0, |
---|
| 3891 | or a picture that has discardable_flag equal to 1. */ |
---|
| 3892 | if( rpcSlice->getPocResetIdc() == 1 || rpcSlice->getPocResetIdc() == 2 ) |
---|
| 3893 | { |
---|
| 3894 | assert( !rpcSlice->isRASL() ); |
---|
| 3895 | assert( !rpcSlice->isRADL() ); |
---|
| 3896 | assert( !rpcSlice->isSLNR() ); |
---|
| 3897 | assert( rpcSlice->getTLayer() == 0 ); |
---|
| 3898 | assert( rpcSlice->getDiscardableFlag() == 0 ); |
---|
| 3899 | } |
---|
| 3900 | |
---|
| 3901 | // The value of poc_reset_idc of a CRA or BLA picture shall be less than 3. |
---|
| 3902 | if( rpcSlice->getPocResetIdc() == 3) |
---|
| 3903 | { |
---|
| 3904 | assert( ! ( rpcSlice->isCRA() || rpcSlice->isBLA() ) ); |
---|
| 3905 | } |
---|
| 3906 | #endif |
---|
[644] | 3907 | } |
---|
| 3908 | else |
---|
| 3909 | { |
---|
[825] | 3910 | rpcSlice->setPocResetIdc( 0 ); |
---|
[644] | 3911 | } |
---|
[825] | 3912 | #if Q0142_POC_LSB_NOT_PRESENT |
---|
| 3913 | if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && iPOClsb > 0 ) |
---|
[644] | 3914 | { |
---|
[825] | 3915 | assert( rpcSlice->getPocResetIdc() != 2 ); |
---|
| 3916 | } |
---|
| 3917 | #endif |
---|
| 3918 | if( rpcSlice->getPocResetIdc() > 0 ) |
---|
| 3919 | { |
---|
| 3920 | READ_CODE(6, uiCode, "poc_reset_period_id"); rpcSlice->setPocResetPeriodId(uiCode); |
---|
| 3921 | } |
---|
| 3922 | else |
---|
| 3923 | { |
---|
| 3924 | |
---|
| 3925 | rpcSlice->setPocResetPeriodId( 0 ); |
---|
| 3926 | } |
---|
| 3927 | |
---|
| 3928 | if (rpcSlice->getPocResetIdc() == 3) |
---|
| 3929 | { |
---|
| 3930 | READ_FLAG( uiCode, "full_poc_reset_flag"); rpcSlice->setFullPocResetFlag((uiCode == 1) ? true : false); |
---|
| 3931 | READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode,"poc_lsb_val"); rpcSlice->setPocLsbVal(uiCode); |
---|
[815] | 3932 | #if Q0142_POC_LSB_NOT_PRESENT |
---|
[825] | 3933 | if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && rpcSlice->getFullPocResetFlag() ) |
---|
[815] | 3934 | { |
---|
[825] | 3935 | assert( rpcSlice->getPocLsbVal() == 0 ); |
---|
[815] | 3936 | } |
---|
| 3937 | #endif |
---|
[825] | 3938 | } |
---|
| 3939 | |
---|
| 3940 | // Derive the value of PocMsbValRequiredFlag |
---|
[903] | 3941 | #if P0297_VPS_POC_LSB_ALIGNED_FLAG |
---|
| 3942 | rpcSlice->setPocMsbValRequiredFlag( (rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag()) |
---|
| 3943 | && (!rpcSlice->getVPS()->getVpsPocLsbAlignedFlag() || |
---|
| 3944 | (rpcSlice->getVPS()->getVpsPocLsbAlignedFlag() && rpcSlice->getVPS()->getNumDirectRefLayers(rpcSlice->getLayerId()) == 0)) |
---|
| 3945 | ); |
---|
| 3946 | #else |
---|
| 3947 | rpcSlice->setPocMsbValRequiredFlag( rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag() ); |
---|
| 3948 | #endif |
---|
[825] | 3949 | |
---|
[903] | 3950 | #if P0297_VPS_POC_LSB_ALIGNED_FLAG |
---|
| 3951 | if (!rpcSlice->getPocMsbValRequiredFlag() && rpcSlice->getVPS()->getVpsPocLsbAlignedFlag()) |
---|
| 3952 | #else |
---|
| 3953 | if (!rpcSlice->getPocMsbValRequiredFlag() /* vps_poc_lsb_aligned_flag */) |
---|
| 3954 | #endif |
---|
[825] | 3955 | { |
---|
[903] | 3956 | #if P0297_VPS_POC_LSB_ALIGNED_FLAG |
---|
| 3957 | READ_FLAG(uiCode, "poc_msb_cycle_val_present_flag"); rpcSlice->setPocMsbValPresentFlag(uiCode ? true : false); |
---|
| 3958 | #else |
---|
| 3959 | READ_FLAG(uiCode, "poc_msb_val_present_flag"); rpcSlice->setPocMsbValPresentFlag(uiCode ? true : false); |
---|
| 3960 | #endif |
---|
[825] | 3961 | } |
---|
| 3962 | else |
---|
| 3963 | { |
---|
| 3964 | #if POC_MSB_VAL_PRESENT_FLAG_SEM |
---|
| 3965 | if( sliceHeaderExtensionLength == 0 ) |
---|
[644] | 3966 | { |
---|
[825] | 3967 | rpcSlice->setPocMsbValPresentFlag( false ); |
---|
[644] | 3968 | } |
---|
[825] | 3969 | else if( rpcSlice->getPocMsbValRequiredFlag() ) |
---|
| 3970 | #else |
---|
| 3971 | if( rpcSlice->getPocMsbValRequiredFlag() ) |
---|
[815] | 3972 | #endif |
---|
[644] | 3973 | { |
---|
[825] | 3974 | rpcSlice->setPocMsbValPresentFlag( true ); |
---|
[644] | 3975 | } |
---|
| 3976 | else |
---|
| 3977 | { |
---|
[825] | 3978 | rpcSlice->setPocMsbValPresentFlag( false ); |
---|
[644] | 3979 | } |
---|
[825] | 3980 | } |
---|
[644] | 3981 | |
---|
[815] | 3982 | #if !POC_RESET_IDC_DECODER |
---|
[825] | 3983 | Int maxPocLsb = 1 << rpcSlice->getSPS()->getBitsForPOC(); |
---|
[815] | 3984 | #endif |
---|
[825] | 3985 | if( rpcSlice->getPocMsbValPresentFlag() ) |
---|
| 3986 | { |
---|
[903] | 3987 | #if P0297_VPS_POC_LSB_ALIGNED_FLAG |
---|
| 3988 | READ_UVLC( uiCode, "poc_msb_cycle_val"); rpcSlice->setPocMsbVal( uiCode ); |
---|
| 3989 | #else |
---|
[825] | 3990 | READ_UVLC( uiCode, "poc_msb_val"); rpcSlice->setPocMsbVal( uiCode ); |
---|
[903] | 3991 | #endif |
---|
[815] | 3992 | |
---|
| 3993 | #if !POC_RESET_IDC_DECODER |
---|
[825] | 3994 | // Update POC of the slice based on this MSB val |
---|
| 3995 | Int pocLsb = rpcSlice->getPOC() % maxPocLsb; |
---|
| 3996 | rpcSlice->setPOC((rpcSlice->getPocMsbVal() * maxPocLsb) + pocLsb); |
---|
| 3997 | } |
---|
| 3998 | else |
---|
| 3999 | { |
---|
| 4000 | rpcSlice->setPocMsbVal( rpcSlice->getPOC() / maxPocLsb ); |
---|
[815] | 4001 | #endif |
---|
[825] | 4002 | } |
---|
[644] | 4003 | |
---|
[825] | 4004 | // Read remaining bits in the slice header extension. |
---|
| 4005 | UInt endBits = m_pcBitstream->getNumBitsRead(); |
---|
| 4006 | Int counter = (endBits - startBits) % 8; |
---|
| 4007 | if( counter ) |
---|
| 4008 | { |
---|
| 4009 | counter = 8 - counter; |
---|
| 4010 | } |
---|
[644] | 4011 | |
---|
[825] | 4012 | while( counter ) |
---|
| 4013 | { |
---|
[815] | 4014 | #if Q0146_SSH_EXT_DATA_BIT |
---|
[825] | 4015 | READ_FLAG( uiCode, "slice_segment_header_extension_data_bit" ); |
---|
[815] | 4016 | #else |
---|
[825] | 4017 | READ_FLAG( uiCode, "slice_segment_header_extension_reserved_bit" ); assert( uiCode == 1 ); |
---|
[815] | 4018 | #endif |
---|
[825] | 4019 | counter--; |
---|
[644] | 4020 | } |
---|
[825] | 4021 | } |
---|
[644] | 4022 | #else |
---|
[825] | 4023 | if(pps->getSliceHeaderExtensionPresentFlag()) |
---|
| 4024 | { |
---|
| 4025 | READ_UVLC(uiCode,"slice_header_extension_length"); |
---|
| 4026 | for(Int i=0; i<uiCode; i++) |
---|
[644] | 4027 | { |
---|
[825] | 4028 | UInt ignore; |
---|
| 4029 | READ_CODE(8,ignore,"slice_header_extension_data_byte"); |
---|
| 4030 | } |
---|
| 4031 | } |
---|
| 4032 | #endif |
---|
| 4033 | m_pcBitstream->readByteAlignment(); |
---|
| 4034 | |
---|
| 4035 | if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) |
---|
| 4036 | { |
---|
| 4037 | Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); |
---|
| 4038 | |
---|
| 4039 | // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header |
---|
| 4040 | for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) |
---|
| 4041 | { |
---|
| 4042 | if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation ) |
---|
[313] | 4043 | { |
---|
[825] | 4044 | endOfSliceHeaderLocation++; |
---|
[313] | 4045 | } |
---|
| 4046 | } |
---|
| 4047 | |
---|
[825] | 4048 | Int curEntryPointOffset = 0; |
---|
| 4049 | Int prevEntryPointOffset = 0; |
---|
| 4050 | for (UInt idx=0; idx<numEntryPointOffsets; idx++) |
---|
[313] | 4051 | { |
---|
[825] | 4052 | curEntryPointOffset += entryPointOffset[ idx ]; |
---|
[494] | 4053 | |
---|
[825] | 4054 | Int emulationPreventionByteCount = 0; |
---|
[313] | 4055 | for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) |
---|
| 4056 | { |
---|
[825] | 4057 | if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && |
---|
| 4058 | m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) |
---|
[313] | 4059 | { |
---|
[825] | 4060 | emulationPreventionByteCount++; |
---|
[313] | 4061 | } |
---|
| 4062 | } |
---|
| 4063 | |
---|
[825] | 4064 | entryPointOffset[ idx ] -= emulationPreventionByteCount; |
---|
| 4065 | prevEntryPointOffset = curEntryPointOffset; |
---|
| 4066 | } |
---|
[313] | 4067 | |
---|
[825] | 4068 | if ( pps->getTilesEnabledFlag() ) |
---|
| 4069 | { |
---|
| 4070 | rpcSlice->setTileLocationCount( numEntryPointOffsets ); |
---|
[313] | 4071 | |
---|
[825] | 4072 | UInt prevPos = 0; |
---|
| 4073 | for (Int idx=0; idx<rpcSlice->getTileLocationCount(); idx++) |
---|
| 4074 | { |
---|
| 4075 | rpcSlice->setTileLocation( idx, prevPos + entryPointOffset [ idx ] ); |
---|
| 4076 | prevPos += entryPointOffset[ idx ]; |
---|
[313] | 4077 | } |
---|
[825] | 4078 | } |
---|
| 4079 | else if ( pps->getEntropyCodingSyncEnabledFlag() ) |
---|
| 4080 | { |
---|
| 4081 | Int numSubstreams = rpcSlice->getNumEntryPointOffsets()+1; |
---|
| 4082 | rpcSlice->allocSubstreamSizes(numSubstreams); |
---|
| 4083 | UInt *pSubstreamSizes = rpcSlice->getSubstreamSizes(); |
---|
| 4084 | for (Int idx=0; idx<numSubstreams-1; idx++) |
---|
[313] | 4085 | { |
---|
[825] | 4086 | if ( idx < numEntryPointOffsets ) |
---|
[313] | 4087 | { |
---|
[825] | 4088 | pSubstreamSizes[ idx ] = ( entryPointOffset[ idx ] << 3 ) ; |
---|
[313] | 4089 | } |
---|
[825] | 4090 | else |
---|
[313] | 4091 | { |
---|
[825] | 4092 | pSubstreamSizes[ idx ] = 0; |
---|
[313] | 4093 | } |
---|
| 4094 | } |
---|
[825] | 4095 | } |
---|
[313] | 4096 | |
---|
[825] | 4097 | if (entryPointOffset) |
---|
| 4098 | { |
---|
| 4099 | delete [] entryPointOffset; |
---|
[313] | 4100 | } |
---|
[825] | 4101 | } |
---|
[313] | 4102 | |
---|
[825] | 4103 | return; |
---|
[313] | 4104 | } |
---|
| 4105 | |
---|
| 4106 | Void TDecCavlc::parsePTL( TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1 ) |
---|
| 4107 | { |
---|
| 4108 | UInt uiCode; |
---|
| 4109 | if(profilePresentFlag) |
---|
| 4110 | { |
---|
| 4111 | parseProfileTier(rpcPTL->getGeneralPTL()); |
---|
| 4112 | } |
---|
| 4113 | READ_CODE( 8, uiCode, "general_level_idc" ); rpcPTL->getGeneralPTL()->setLevelIdc(uiCode); |
---|
| 4114 | |
---|
| 4115 | for (Int i = 0; i < maxNumSubLayersMinus1; i++) |
---|
| 4116 | { |
---|
[943] | 4117 | #if MULTIPLE_PTL_SUPPORT |
---|
| 4118 | READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode); |
---|
| 4119 | #else |
---|
[313] | 4120 | if(profilePresentFlag) |
---|
| 4121 | { |
---|
| 4122 | READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode); |
---|
| 4123 | } |
---|
[943] | 4124 | #endif |
---|
[313] | 4125 | READ_FLAG( uiCode, "sub_layer_level_present_flag[i]" ); rpcPTL->setSubLayerLevelPresentFlag (i, uiCode); |
---|
| 4126 | } |
---|
| 4127 | |
---|
| 4128 | if (maxNumSubLayersMinus1 > 0) |
---|
| 4129 | { |
---|
| 4130 | for (Int i = maxNumSubLayersMinus1; i < 8; i++) |
---|
| 4131 | { |
---|
| 4132 | READ_CODE(2, uiCode, "reserved_zero_2bits"); |
---|
| 4133 | assert(uiCode == 0); |
---|
| 4134 | } |
---|
| 4135 | } |
---|
| 4136 | |
---|
| 4137 | for(Int i = 0; i < maxNumSubLayersMinus1; i++) |
---|
| 4138 | { |
---|
[943] | 4139 | #if MULTIPLE_PTL_SUPPORT |
---|
| 4140 | if( rpcPTL->getSubLayerProfilePresentFlag(i) ) |
---|
| 4141 | #else |
---|
[313] | 4142 | if( profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) ) |
---|
[943] | 4143 | #endif |
---|
[313] | 4144 | { |
---|
| 4145 | parseProfileTier(rpcPTL->getSubLayerPTL(i)); |
---|
| 4146 | } |
---|
| 4147 | if(rpcPTL->getSubLayerLevelPresentFlag(i)) |
---|
| 4148 | { |
---|
| 4149 | READ_CODE( 8, uiCode, "sub_layer_level_idc[i]" ); rpcPTL->getSubLayerPTL(i)->setLevelIdc(uiCode); |
---|
| 4150 | } |
---|
| 4151 | } |
---|
| 4152 | } |
---|
| 4153 | |
---|
| 4154 | Void TDecCavlc::parseProfileTier(ProfileTierLevel *ptl) |
---|
| 4155 | { |
---|
| 4156 | UInt uiCode; |
---|
| 4157 | READ_CODE(2 , uiCode, "XXX_profile_space[]"); ptl->setProfileSpace(uiCode); |
---|
| 4158 | READ_FLAG( uiCode, "XXX_tier_flag[]" ); ptl->setTierFlag (uiCode ? 1 : 0); |
---|
| 4159 | READ_CODE(5 , uiCode, "XXX_profile_idc[]" ); ptl->setProfileIdc (uiCode); |
---|
| 4160 | for(Int j = 0; j < 32; j++) |
---|
| 4161 | { |
---|
| 4162 | READ_FLAG( uiCode, "XXX_profile_compatibility_flag[][j]"); ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0); |
---|
| 4163 | } |
---|
| 4164 | READ_FLAG(uiCode, "general_progressive_source_flag"); |
---|
| 4165 | ptl->setProgressiveSourceFlag(uiCode ? true : false); |
---|
| 4166 | |
---|
| 4167 | READ_FLAG(uiCode, "general_interlaced_source_flag"); |
---|
| 4168 | ptl->setInterlacedSourceFlag(uiCode ? true : false); |
---|
| 4169 | |
---|
| 4170 | READ_FLAG(uiCode, "general_non_packed_constraint_flag"); |
---|
| 4171 | ptl->setNonPackedConstraintFlag(uiCode ? true : false); |
---|
| 4172 | |
---|
| 4173 | READ_FLAG(uiCode, "general_frame_only_constraint_flag"); |
---|
| 4174 | ptl->setFrameOnlyConstraintFlag(uiCode ? true : false); |
---|
| 4175 | |
---|
| 4176 | READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[0..15]"); |
---|
| 4177 | READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[16..31]"); |
---|
| 4178 | READ_CODE(12, uiCode, "XXX_reserved_zero_44bits[32..43]"); |
---|
| 4179 | } |
---|
| 4180 | |
---|
| 4181 | Void TDecCavlc::parseTerminatingBit( UInt& ruiBit ) |
---|
| 4182 | { |
---|
| 4183 | ruiBit = false; |
---|
| 4184 | Int iBitsLeft = m_pcBitstream->getNumBitsLeft(); |
---|
| 4185 | if(iBitsLeft <= 8) |
---|
| 4186 | { |
---|
| 4187 | UInt uiPeekValue = m_pcBitstream->peekBits(iBitsLeft); |
---|
| 4188 | if (uiPeekValue == (1<<(iBitsLeft-1))) |
---|
| 4189 | { |
---|
| 4190 | ruiBit = true; |
---|
| 4191 | } |
---|
| 4192 | } |
---|
| 4193 | } |
---|
| 4194 | |
---|
| 4195 | Void TDecCavlc::parseSkipFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 4196 | { |
---|
| 4197 | assert(0); |
---|
| 4198 | } |
---|
| 4199 | |
---|
| 4200 | Void TDecCavlc::parseCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 4201 | { |
---|
| 4202 | assert(0); |
---|
| 4203 | } |
---|
| 4204 | |
---|
| 4205 | Void TDecCavlc::parseMVPIdx( Int& /*riMVPIdx*/ ) |
---|
| 4206 | { |
---|
| 4207 | assert(0); |
---|
| 4208 | } |
---|
| 4209 | |
---|
| 4210 | Void TDecCavlc::parseSplitFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 4211 | { |
---|
| 4212 | assert(0); |
---|
| 4213 | } |
---|
| 4214 | |
---|
| 4215 | Void TDecCavlc::parsePartSize( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 4216 | { |
---|
| 4217 | assert(0); |
---|
| 4218 | } |
---|
| 4219 | |
---|
| 4220 | Void TDecCavlc::parsePredMode( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 4221 | { |
---|
| 4222 | assert(0); |
---|
| 4223 | } |
---|
| 4224 | |
---|
| 4225 | /** Parse I_PCM information. |
---|
| 4226 | * \param pcCU pointer to CU |
---|
| 4227 | * \param uiAbsPartIdx CU index |
---|
| 4228 | * \param uiDepth CU depth |
---|
| 4229 | * \returns Void |
---|
| 4230 | * |
---|
| 4231 | * If I_PCM flag indicates that the CU is I_PCM, parse its PCM alignment bits and codes. |
---|
| 4232 | */ |
---|
| 4233 | Void TDecCavlc::parseIPCMInfo( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 4234 | { |
---|
| 4235 | assert(0); |
---|
| 4236 | } |
---|
| 4237 | |
---|
| 4238 | Void TDecCavlc::parseIntraDirLumaAng ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 4239 | { |
---|
| 4240 | assert(0); |
---|
| 4241 | } |
---|
| 4242 | |
---|
| 4243 | Void TDecCavlc::parseIntraDirChroma( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 4244 | { |
---|
| 4245 | assert(0); |
---|
| 4246 | } |
---|
| 4247 | |
---|
| 4248 | Void TDecCavlc::parseInterDir( TComDataCU* /*pcCU*/, UInt& /*ruiInterDir*/, UInt /*uiAbsPartIdx*/ ) |
---|
| 4249 | { |
---|
| 4250 | assert(0); |
---|
| 4251 | } |
---|
| 4252 | |
---|
| 4253 | Void TDecCavlc::parseRefFrmIdx( TComDataCU* /*pcCU*/, Int& /*riRefFrmIdx*/, RefPicList /*eRefList*/ ) |
---|
| 4254 | { |
---|
| 4255 | assert(0); |
---|
| 4256 | } |
---|
| 4257 | |
---|
| 4258 | Void TDecCavlc::parseMvd( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiPartIdx*/, UInt /*uiDepth*/, RefPicList /*eRefList*/ ) |
---|
| 4259 | { |
---|
| 4260 | assert(0); |
---|
| 4261 | } |
---|
| 4262 | |
---|
| 4263 | Void TDecCavlc::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 4264 | { |
---|
| 4265 | Int qp; |
---|
| 4266 | Int iDQp; |
---|
| 4267 | |
---|
| 4268 | xReadSvlc( iDQp ); |
---|
| 4269 | |
---|
[442] | 4270 | #if REPN_FORMAT_IN_VPS |
---|
| 4271 | Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffsetY(); |
---|
| 4272 | #else |
---|
[313] | 4273 | Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); |
---|
[442] | 4274 | #endif |
---|
[313] | 4275 | qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) - qpBdOffsetY; |
---|
| 4276 | |
---|
| 4277 | UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>((g_uiMaxCUDepth - pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())<<1))<<((g_uiMaxCUDepth - pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())<<1) ; |
---|
| 4278 | UInt uiQpCUDepth = min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ; |
---|
| 4279 | |
---|
| 4280 | pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth ); |
---|
| 4281 | } |
---|
| 4282 | |
---|
| 4283 | Void TDecCavlc::parseCoeffNxN( TComDataCU* /*pcCU*/, TCoeff* /*pcCoef*/, UInt /*uiAbsPartIdx*/, UInt /*uiWidth*/, UInt /*uiHeight*/, UInt /*uiDepth*/, TextType /*eTType*/ ) |
---|
| 4284 | { |
---|
| 4285 | assert(0); |
---|
| 4286 | } |
---|
| 4287 | |
---|
| 4288 | Void TDecCavlc::parseTransformSubdivFlag( UInt& /*ruiSubdivFlag*/, UInt /*uiLog2TransformBlockSize*/ ) |
---|
| 4289 | { |
---|
| 4290 | assert(0); |
---|
| 4291 | } |
---|
| 4292 | |
---|
| 4293 | Void TDecCavlc::parseQtCbf( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, TextType /*eType*/, UInt /*uiTrDepth*/, UInt /*uiDepth*/ ) |
---|
| 4294 | { |
---|
| 4295 | assert(0); |
---|
| 4296 | } |
---|
| 4297 | |
---|
| 4298 | Void TDecCavlc::parseQtRootCbf( UInt /*uiAbsPartIdx*/, UInt& /*uiQtRootCbf*/ ) |
---|
| 4299 | { |
---|
| 4300 | assert(0); |
---|
| 4301 | } |
---|
| 4302 | |
---|
| 4303 | Void TDecCavlc::parseTransformSkipFlags (TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*width*/, UInt /*height*/, UInt /*uiDepth*/, TextType /*eTType*/) |
---|
| 4304 | { |
---|
| 4305 | assert(0); |
---|
| 4306 | } |
---|
| 4307 | |
---|
| 4308 | Void TDecCavlc::parseMergeFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/, UInt /*uiPUIdx*/ ) |
---|
| 4309 | { |
---|
| 4310 | assert(0); |
---|
| 4311 | } |
---|
| 4312 | |
---|
| 4313 | Void TDecCavlc::parseMergeIndex ( TComDataCU* /*pcCU*/, UInt& /*ruiMergeIndex*/ ) |
---|
| 4314 | { |
---|
| 4315 | assert(0); |
---|
| 4316 | } |
---|
| 4317 | |
---|
| 4318 | // ==================================================================================================================== |
---|
| 4319 | // Protected member functions |
---|
| 4320 | // ==================================================================================================================== |
---|
| 4321 | |
---|
| 4322 | /** parse explicit wp tables |
---|
| 4323 | * \param TComSlice* pcSlice |
---|
| 4324 | * \returns Void |
---|
| 4325 | */ |
---|
| 4326 | Void TDecCavlc::xParsePredWeightTable( TComSlice* pcSlice ) |
---|
| 4327 | { |
---|
| 4328 | wpScalingParam *wp; |
---|
| 4329 | Bool bChroma = true; // color always present in HEVC ? |
---|
| 4330 | SliceType eSliceType = pcSlice->getSliceType(); |
---|
| 4331 | Int iNbRef = (eSliceType == B_SLICE ) ? (2) : (1); |
---|
[494] | 4332 | #if SVC_EXTENSION |
---|
| 4333 | UInt uiLog2WeightDenomLuma = 0, uiLog2WeightDenomChroma = 0; |
---|
| 4334 | #else |
---|
[313] | 4335 | UInt uiLog2WeightDenomLuma, uiLog2WeightDenomChroma; |
---|
[494] | 4336 | #endif |
---|
[313] | 4337 | UInt uiTotalSignalledWeightFlags = 0; |
---|
| 4338 | |
---|
| 4339 | Int iDeltaDenom; |
---|
[494] | 4340 | #if AUXILIARY_PICTURES |
---|
| 4341 | if (pcSlice->getChromaFormatIdc() == CHROMA_400) |
---|
| 4342 | { |
---|
| 4343 | bChroma = false; |
---|
| 4344 | } |
---|
| 4345 | #endif |
---|
[313] | 4346 | // decode delta_luma_log2_weight_denom : |
---|
| 4347 | READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom |
---|
| 4348 | assert( uiLog2WeightDenomLuma <= 7 ); |
---|
| 4349 | if( bChroma ) |
---|
| 4350 | { |
---|
| 4351 | READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom |
---|
| 4352 | assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); |
---|
| 4353 | assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7); |
---|
| 4354 | uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); |
---|
| 4355 | } |
---|
| 4356 | |
---|
| 4357 | for ( Int iNumRef=0 ; iNumRef<iNbRef ; iNumRef++ ) |
---|
| 4358 | { |
---|
| 4359 | RefPicList eRefPicList = ( iNumRef ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); |
---|
| 4360 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
| 4361 | { |
---|
| 4362 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
| 4363 | |
---|
| 4364 | wp[0].uiLog2WeightDenom = uiLog2WeightDenomLuma; |
---|
[494] | 4365 | #if AUXILIARY_PICTURES |
---|
| 4366 | if (!bChroma) |
---|
| 4367 | { |
---|
| 4368 | wp[1].uiLog2WeightDenom = 0; |
---|
| 4369 | wp[2].uiLog2WeightDenom = 0; |
---|
| 4370 | } |
---|
| 4371 | else |
---|
| 4372 | { |
---|
| 4373 | #endif |
---|
[825] | 4374 | wp[1].uiLog2WeightDenom = uiLog2WeightDenomChroma; |
---|
| 4375 | wp[2].uiLog2WeightDenom = uiLog2WeightDenomChroma; |
---|
[494] | 4376 | #if AUXILIARY_PICTURES |
---|
| 4377 | } |
---|
| 4378 | #endif |
---|
[313] | 4379 | |
---|
| 4380 | UInt uiCode; |
---|
| 4381 | READ_FLAG( uiCode, "luma_weight_lX_flag" ); // u(1): luma_weight_l0_flag |
---|
| 4382 | wp[0].bPresentFlag = ( uiCode == 1 ); |
---|
| 4383 | uiTotalSignalledWeightFlags += wp[0].bPresentFlag; |
---|
| 4384 | } |
---|
| 4385 | if ( bChroma ) |
---|
| 4386 | { |
---|
| 4387 | UInt uiCode; |
---|
| 4388 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
| 4389 | { |
---|
| 4390 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
| 4391 | READ_FLAG( uiCode, "chroma_weight_lX_flag" ); // u(1): chroma_weight_l0_flag |
---|
| 4392 | wp[1].bPresentFlag = ( uiCode == 1 ); |
---|
| 4393 | wp[2].bPresentFlag = ( uiCode == 1 ); |
---|
| 4394 | uiTotalSignalledWeightFlags += 2*wp[1].bPresentFlag; |
---|
| 4395 | } |
---|
| 4396 | } |
---|
| 4397 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
| 4398 | { |
---|
| 4399 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
| 4400 | if ( wp[0].bPresentFlag ) |
---|
| 4401 | { |
---|
| 4402 | Int iDeltaWeight; |
---|
| 4403 | READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" ); // se(v): delta_luma_weight_l0[i] |
---|
| 4404 | assert( iDeltaWeight >= -128 ); |
---|
| 4405 | assert( iDeltaWeight <= 127 ); |
---|
| 4406 | wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom)); |
---|
| 4407 | READ_SVLC( wp[0].iOffset, "luma_offset_lX" ); // se(v): luma_offset_l0[i] |
---|
| 4408 | assert( wp[0].iOffset >= -128 ); |
---|
| 4409 | assert( wp[0].iOffset <= 127 ); |
---|
| 4410 | } |
---|
| 4411 | else |
---|
| 4412 | { |
---|
| 4413 | wp[0].iWeight = (1 << wp[0].uiLog2WeightDenom); |
---|
| 4414 | wp[0].iOffset = 0; |
---|
| 4415 | } |
---|
| 4416 | if ( bChroma ) |
---|
| 4417 | { |
---|
| 4418 | if ( wp[1].bPresentFlag ) |
---|
| 4419 | { |
---|
| 4420 | for ( Int j=1 ; j<3 ; j++ ) |
---|
| 4421 | { |
---|
| 4422 | Int iDeltaWeight; |
---|
| 4423 | READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" ); // se(v): chroma_weight_l0[i][j] |
---|
| 4424 | assert( iDeltaWeight >= -128 ); |
---|
| 4425 | assert( iDeltaWeight <= 127 ); |
---|
| 4426 | wp[j].iWeight = (iDeltaWeight + (1<<wp[1].uiLog2WeightDenom)); |
---|
| 4427 | |
---|
| 4428 | Int iDeltaChroma; |
---|
| 4429 | READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" ); // se(v): delta_chroma_offset_l0[i][j] |
---|
| 4430 | assert( iDeltaChroma >= -512 ); |
---|
| 4431 | assert( iDeltaChroma <= 511 ); |
---|
| 4432 | Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); |
---|
| 4433 | wp[j].iOffset = Clip3(-128, 127, (iDeltaChroma + pred) ); |
---|
| 4434 | } |
---|
| 4435 | } |
---|
| 4436 | else |
---|
| 4437 | { |
---|
| 4438 | for ( Int j=1 ; j<3 ; j++ ) |
---|
| 4439 | { |
---|
| 4440 | wp[j].iWeight = (1 << wp[j].uiLog2WeightDenom); |
---|
| 4441 | wp[j].iOffset = 0; |
---|
| 4442 | } |
---|
| 4443 | } |
---|
| 4444 | } |
---|
| 4445 | } |
---|
| 4446 | |
---|
| 4447 | for ( Int iRefIdx=pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) |
---|
| 4448 | { |
---|
| 4449 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
| 4450 | |
---|
| 4451 | wp[0].bPresentFlag = false; |
---|
| 4452 | wp[1].bPresentFlag = false; |
---|
| 4453 | wp[2].bPresentFlag = false; |
---|
| 4454 | } |
---|
| 4455 | } |
---|
| 4456 | assert(uiTotalSignalledWeightFlags<=24); |
---|
| 4457 | } |
---|
| 4458 | |
---|
| 4459 | /** decode quantization matrix |
---|
| 4460 | * \param scalingList quantization matrix information |
---|
| 4461 | */ |
---|
| 4462 | Void TDecCavlc::parseScalingList(TComScalingList* scalingList) |
---|
| 4463 | { |
---|
| 4464 | UInt code, sizeId, listId; |
---|
| 4465 | Bool scalingListPredModeFlag; |
---|
| 4466 | //for each size |
---|
| 4467 | for(sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 4468 | { |
---|
| 4469 | for(listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
| 4470 | { |
---|
| 4471 | READ_FLAG( code, "scaling_list_pred_mode_flag"); |
---|
| 4472 | scalingListPredModeFlag = (code) ? true : false; |
---|
| 4473 | if(!scalingListPredModeFlag) //Copy Mode |
---|
| 4474 | { |
---|
| 4475 | READ_UVLC( code, "scaling_list_pred_matrix_id_delta"); |
---|
| 4476 | scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code))); |
---|
| 4477 | if( sizeId > SCALING_LIST_8x8 ) |
---|
| 4478 | { |
---|
| 4479 | scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId)))); |
---|
| 4480 | } |
---|
| 4481 | scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId)); |
---|
| 4482 | |
---|
| 4483 | } |
---|
| 4484 | else //DPCM Mode |
---|
| 4485 | { |
---|
| 4486 | xDecodeScalingList(scalingList, sizeId, listId); |
---|
| 4487 | } |
---|
| 4488 | } |
---|
| 4489 | } |
---|
| 4490 | |
---|
| 4491 | return; |
---|
| 4492 | } |
---|
| 4493 | /** decode DPCM |
---|
| 4494 | * \param scalingList quantization matrix information |
---|
| 4495 | * \param sizeId size index |
---|
| 4496 | * \param listId list index |
---|
| 4497 | */ |
---|
| 4498 | Void TDecCavlc::xDecodeScalingList(TComScalingList *scalingList, UInt sizeId, UInt listId) |
---|
| 4499 | { |
---|
| 4500 | Int i,coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]); |
---|
| 4501 | Int data; |
---|
| 4502 | Int scalingListDcCoefMinus8 = 0; |
---|
| 4503 | Int nextCoef = SCALING_LIST_START_VALUE; |
---|
| 4504 | UInt* scan = (sizeId == 0) ? g_auiSigLastScan [ SCAN_DIAG ] [ 1 ] : g_sigLastScanCG32x32; |
---|
| 4505 | Int *dst = scalingList->getScalingListAddress(sizeId, listId); |
---|
| 4506 | |
---|
| 4507 | if( sizeId > SCALING_LIST_8x8 ) |
---|
| 4508 | { |
---|
| 4509 | READ_SVLC( scalingListDcCoefMinus8, "scaling_list_dc_coef_minus8"); |
---|
| 4510 | scalingList->setScalingListDC(sizeId,listId,scalingListDcCoefMinus8 + 8); |
---|
| 4511 | nextCoef = scalingList->getScalingListDC(sizeId,listId); |
---|
| 4512 | } |
---|
| 4513 | |
---|
| 4514 | for(i = 0; i < coefNum; i++) |
---|
| 4515 | { |
---|
| 4516 | READ_SVLC( data, "scaling_list_delta_coef"); |
---|
| 4517 | nextCoef = (nextCoef + data + 256 ) % 256; |
---|
| 4518 | dst[scan[i]] = nextCoef; |
---|
| 4519 | } |
---|
| 4520 | } |
---|
| 4521 | |
---|
| 4522 | Bool TDecCavlc::xMoreRbspData() |
---|
| 4523 | { |
---|
| 4524 | Int bitsLeft = m_pcBitstream->getNumBitsLeft(); |
---|
| 4525 | |
---|
| 4526 | // if there are more than 8 bits, it cannot be rbsp_trailing_bits |
---|
| 4527 | if (bitsLeft > 8) |
---|
| 4528 | { |
---|
| 4529 | return true; |
---|
| 4530 | } |
---|
| 4531 | |
---|
| 4532 | UChar lastByte = m_pcBitstream->peekBits(bitsLeft); |
---|
| 4533 | Int cnt = bitsLeft; |
---|
| 4534 | |
---|
| 4535 | // remove trailing bits equal to zero |
---|
| 4536 | while ((cnt>0) && ((lastByte & 1) == 0)) |
---|
| 4537 | { |
---|
| 4538 | lastByte >>= 1; |
---|
| 4539 | cnt--; |
---|
| 4540 | } |
---|
| 4541 | // remove bit equal to one |
---|
| 4542 | cnt--; |
---|
| 4543 | |
---|
| 4544 | // we should not have a negative number of bits |
---|
| 4545 | assert (cnt>=0); |
---|
| 4546 | |
---|
| 4547 | // we have more data, if cnt is not zero |
---|
| 4548 | return (cnt>0); |
---|
| 4549 | } |
---|
[540] | 4550 | |
---|
[713] | 4551 | #if Q0048_CGS_3D_ASYMLUT |
---|
| 4552 | Void TDecCavlc::xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ) |
---|
| 4553 | { |
---|
[825] | 4554 | #if R0150_CGS_SIGNAL_CONSTRAINTS |
---|
| 4555 | UInt uiNumRefLayersM1; |
---|
| 4556 | READ_UVLC( uiNumRefLayersM1 , "num_cm_ref_layers_minus1" ); |
---|
| 4557 | assert( uiNumRefLayersM1 <= 61 ); |
---|
| 4558 | for( UInt i = 0 ; i <= uiNumRefLayersM1 ; i++ ) |
---|
| 4559 | { |
---|
| 4560 | UInt uiRefLayerId; |
---|
| 4561 | READ_CODE( 6 , uiRefLayerId , "cm_ref_layer_id" ); |
---|
| 4562 | pc3DAsymLUT->addRefLayerId( uiRefLayerId ); |
---|
| 4563 | } |
---|
| 4564 | #endif |
---|
[713] | 4565 | UInt uiCurOctantDepth , uiCurPartNumLog2 , uiInputBitDepthM8 , uiOutputBitDepthM8 , uiResQaunBit; |
---|
[826] | 4566 | #if R0300_CGS_RES_COEFF_CODING |
---|
| 4567 | UInt uiDeltaBits; |
---|
| 4568 | #endif |
---|
[713] | 4569 | READ_CODE( 2 , uiCurOctantDepth , "cm_octant_depth" ); |
---|
| 4570 | READ_CODE( 2 , uiCurPartNumLog2 , "cm_y_part_num_log2" ); |
---|
[825] | 4571 | #if R0150_CGS_SIGNAL_CONSTRAINTS |
---|
| 4572 | UInt uiChromaInputBitDepthM8 , uiChromaOutputBitDepthM8; |
---|
[882] | 4573 | READ_UVLC( uiInputBitDepthM8 , "cm_input_luma_bit_depth_minus8" ); |
---|
| 4574 | READ_UVLC( uiChromaInputBitDepthM8 , "cm_input_chroma_bit_depth_minus8" ); |
---|
| 4575 | READ_UVLC( uiOutputBitDepthM8 , "cm_output_luma_bit_depth_minus8" ); |
---|
| 4576 | READ_UVLC( uiChromaOutputBitDepthM8 , "cm_output_chroma_bit_depth_minus8" ); |
---|
[825] | 4577 | #else |
---|
[713] | 4578 | READ_CODE( 3 , uiInputBitDepthM8 , "cm_input_bit_depth_minus8" ); |
---|
| 4579 | Int iInputBitDepthCDelta; |
---|
| 4580 | READ_SVLC(iInputBitDepthCDelta, "cm_input_bit_depth_chroma delta"); |
---|
| 4581 | READ_CODE( 3 , uiOutputBitDepthM8 , "cm_output_bit_depth_minus8" ); |
---|
| 4582 | Int iOutputBitDepthCDelta; |
---|
| 4583 | READ_SVLC(iOutputBitDepthCDelta, "cm_output_bit_depth_chroma_delta"); |
---|
[825] | 4584 | #endif |
---|
[713] | 4585 | READ_CODE( 2 , uiResQaunBit , "cm_res_quant_bit" ); |
---|
[826] | 4586 | #if R0300_CGS_RES_COEFF_CODING |
---|
| 4587 | READ_CODE( 2 , uiDeltaBits , "cm_flc_bits" ); |
---|
| 4588 | pc3DAsymLUT->setDeltaBits(uiDeltaBits + 1); |
---|
| 4589 | #endif |
---|
| 4590 | |
---|
[825] | 4591 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
| 4592 | #if R0150_CGS_SIGNAL_CONSTRAINTS |
---|
| 4593 | Int nAdaptCThresholdU = 1 << ( uiChromaInputBitDepthM8 + 8 - 1 ); |
---|
| 4594 | Int nAdaptCThresholdV = 1 << ( uiChromaInputBitDepthM8 + 8 - 1 ); |
---|
| 4595 | #else |
---|
| 4596 | Int nAdaptCThresholdU = 1 << ( uiInputBitDepthM8 + 8 + iInputBitDepthCDelta - 1 ); |
---|
| 4597 | Int nAdaptCThresholdV = 1 << ( uiInputBitDepthM8 + 8 + iInputBitDepthCDelta - 1 ); |
---|
| 4598 | #endif |
---|
| 4599 | if( uiCurOctantDepth == 1 ) |
---|
| 4600 | { |
---|
| 4601 | Int delta = 0; |
---|
| 4602 | READ_SVLC( delta , "cm_adapt_threshold_u_delta" ); |
---|
| 4603 | nAdaptCThresholdU += delta; |
---|
| 4604 | READ_SVLC( delta , "cm_adapt_threshold_v_delta" ); |
---|
| 4605 | nAdaptCThresholdV += delta; |
---|
| 4606 | } |
---|
| 4607 | #endif |
---|
[713] | 4608 | pc3DAsymLUT->destroy(); |
---|
[825] | 4609 | pc3DAsymLUT->create( uiCurOctantDepth , uiInputBitDepthM8 + 8 , |
---|
| 4610 | #if R0150_CGS_SIGNAL_CONSTRAINTS |
---|
| 4611 | uiChromaInputBitDepthM8 + 8 , |
---|
| 4612 | #else |
---|
| 4613 | uiInputBitDepthM8 + 8 + iInputBitDepthCDelta, |
---|
| 4614 | #endif |
---|
| 4615 | uiOutputBitDepthM8 + 8 , |
---|
| 4616 | #if R0150_CGS_SIGNAL_CONSTRAINTS |
---|
| 4617 | uiChromaOutputBitDepthM8 + 8 , |
---|
| 4618 | #else |
---|
| 4619 | uiOutputBitDepthM8 + 8 + iOutputBitDepthCDelta , |
---|
| 4620 | #endif |
---|
| 4621 | uiCurPartNumLog2 |
---|
| 4622 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
| 4623 | , nAdaptCThresholdU , nAdaptCThresholdV |
---|
| 4624 | #endif |
---|
| 4625 | ); |
---|
[713] | 4626 | pc3DAsymLUT->setResQuantBit( uiResQaunBit ); |
---|
| 4627 | |
---|
[852] | 4628 | #if R0164_CGS_LUT_BUGFIX_CHECK |
---|
[825] | 4629 | pc3DAsymLUT->xInitCuboids(); |
---|
| 4630 | #endif |
---|
[713] | 4631 | xParse3DAsymLUTOctant( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth() ); |
---|
[825] | 4632 | #if R0164_CGS_LUT_BUGFIX |
---|
[852] | 4633 | #if R0164_CGS_LUT_BUGFIX_CHECK |
---|
| 4634 | printf("============= Before 'xCuboidsFilledCheck()': ================\n"); |
---|
| 4635 | pc3DAsymLUT->display(); |
---|
| 4636 | pc3DAsymLUT->xCuboidsFilledCheck( false ); |
---|
| 4637 | printf("============= After 'xCuboidsFilledCheck()': =================\n"); |
---|
| 4638 | pc3DAsymLUT->display(); |
---|
[825] | 4639 | #endif |
---|
[852] | 4640 | #endif |
---|
[713] | 4641 | } |
---|
| 4642 | |
---|
| 4643 | Void TDecCavlc::xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ) |
---|
| 4644 | { |
---|
| 4645 | UInt uiOctantSplit = nDepth < pc3DAsymLUT->getCurOctantDepth(); |
---|
| 4646 | if( nDepth < pc3DAsymLUT->getCurOctantDepth() ) |
---|
| 4647 | READ_FLAG( uiOctantSplit , "split_octant_flag" ); |
---|
| 4648 | Int nYPartNum = 1 << pc3DAsymLUT->getCurYPartNumLog2(); |
---|
| 4649 | if( uiOctantSplit ) |
---|
| 4650 | { |
---|
| 4651 | Int nHalfLength = nLength >> 1; |
---|
| 4652 | for( Int l = 0 ; l < 2 ; l++ ) |
---|
| 4653 | { |
---|
| 4654 | for( Int m = 0 ; m < 2 ; m++ ) |
---|
| 4655 | { |
---|
| 4656 | for( Int n = 0 ; n < 2 ; n++ ) |
---|
| 4657 | { |
---|
| 4658 | xParse3DAsymLUTOctant( pc3DAsymLUT , nDepth + 1 , yIdx + l * nHalfLength * nYPartNum , uIdx + m * nHalfLength , vIdx + n * nHalfLength , nHalfLength ); |
---|
| 4659 | } |
---|
| 4660 | } |
---|
| 4661 | } |
---|
| 4662 | } |
---|
| 4663 | else |
---|
| 4664 | { |
---|
[826] | 4665 | #if R0300_CGS_RES_COEFF_CODING |
---|
| 4666 | Int nFLCbits = pc3DAsymLUT->getMappingShift()-pc3DAsymLUT->getResQuantBit()-pc3DAsymLUT->getDeltaBits() ; |
---|
| 4667 | nFLCbits = nFLCbits >= 0 ? nFLCbits:0; |
---|
| 4668 | #endif |
---|
[713] | 4669 | for( Int l = 0 ; l < nYPartNum ; l++ ) |
---|
| 4670 | { |
---|
[825] | 4671 | #if R0164_CGS_LUT_BUGFIX |
---|
[878] | 4672 | Int shift = pc3DAsymLUT->getCurOctantDepth() - nDepth ; |
---|
[825] | 4673 | #endif |
---|
[713] | 4674 | for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) |
---|
| 4675 | { |
---|
| 4676 | UInt uiCodeVertex = 0; |
---|
| 4677 | Int deltaY = 0 , deltaU = 0 , deltaV = 0; |
---|
| 4678 | READ_FLAG( uiCodeVertex , "coded_vertex_flag" ); |
---|
| 4679 | if( uiCodeVertex ) |
---|
| 4680 | { |
---|
[825] | 4681 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
[826] | 4682 | #if R0300_CGS_RES_COEFF_CODING |
---|
| 4683 | xReadParam( deltaY, nFLCbits ); |
---|
| 4684 | xReadParam( deltaU, nFLCbits ); |
---|
| 4685 | xReadParam( deltaV, nFLCbits ); |
---|
| 4686 | #else |
---|
[825] | 4687 | xReadParam( deltaY ); |
---|
| 4688 | xReadParam( deltaU ); |
---|
| 4689 | xReadParam( deltaV ); |
---|
[826] | 4690 | #endif |
---|
[825] | 4691 | #else |
---|
[713] | 4692 | READ_SVLC( deltaY , "resY" ); |
---|
| 4693 | READ_SVLC( deltaU , "resU" ); |
---|
| 4694 | READ_SVLC( deltaV , "resV" ); |
---|
[825] | 4695 | #endif |
---|
[713] | 4696 | } |
---|
[825] | 4697 | #if R0164_CGS_LUT_BUGFIX |
---|
| 4698 | pc3DAsymLUT->setCuboidVertexResTree( yIdx + (l<<shift) , uIdx , vIdx , nVertexIdx , deltaY , deltaU , deltaV ); |
---|
[852] | 4699 | for (Int m = 1; m < (1<<shift); m++) { |
---|
| 4700 | pc3DAsymLUT->setCuboidVertexResTree( yIdx + (l<<shift) + m , uIdx , vIdx , nVertexIdx , 0 , 0 , 0 ); |
---|
| 4701 | #if R0164_CGS_LUT_BUGFIX_CHECK |
---|
| 4702 | pc3DAsymLUT->xSetFilled( yIdx + (l<<shift) + m , uIdx , vIdx ); |
---|
| 4703 | #endif |
---|
| 4704 | } |
---|
[825] | 4705 | #else |
---|
[713] | 4706 | pc3DAsymLUT->setCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx , deltaY , deltaU , deltaV ); |
---|
[825] | 4707 | #endif |
---|
[713] | 4708 | } |
---|
[852] | 4709 | #if R0164_CGS_LUT_BUGFIX_CHECK |
---|
[825] | 4710 | pc3DAsymLUT->xSetExplicit( yIdx + (l<<shift) , uIdx , vIdx ); |
---|
| 4711 | #endif |
---|
[713] | 4712 | } |
---|
[852] | 4713 | #if R0164_CGS_LUT_BUGFIX |
---|
| 4714 | for ( Int u=0 ; u<nLength ; u++ ) { |
---|
| 4715 | for ( Int v=0 ; v<nLength ; v++ ) { |
---|
| 4716 | if ( u!=0 || v!=0 ) { |
---|
| 4717 | for ( Int y=0 ; y<nLength*nYPartNum ; y++ ) { |
---|
| 4718 | for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) |
---|
| 4719 | { |
---|
| 4720 | pc3DAsymLUT->setCuboidVertexResTree( yIdx + y , uIdx + u , vIdx + v , nVertexIdx , 0 , 0 , 0 ); |
---|
| 4721 | #if R0164_CGS_LUT_BUGFIX_CHECK |
---|
| 4722 | pc3DAsymLUT->xSetFilled( yIdx + y , uIdx + u , vIdx + v ); |
---|
| 4723 | #endif |
---|
| 4724 | } |
---|
| 4725 | } |
---|
| 4726 | } |
---|
| 4727 | } |
---|
| 4728 | } |
---|
| 4729 | #endif |
---|
[713] | 4730 | } |
---|
| 4731 | } |
---|
[825] | 4732 | |
---|
| 4733 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
[826] | 4734 | #if R0300_CGS_RES_COEFF_CODING |
---|
| 4735 | Void TDecCavlc::xReadParam( Int& param, Int rParam ) |
---|
| 4736 | #else |
---|
[825] | 4737 | Void TDecCavlc::xReadParam( Int& param ) |
---|
[826] | 4738 | #endif |
---|
[825] | 4739 | { |
---|
[826] | 4740 | #if !R0300_CGS_RES_COEFF_CODING |
---|
[825] | 4741 | const UInt rParam = 7; |
---|
[826] | 4742 | #endif |
---|
[825] | 4743 | UInt prefix; |
---|
| 4744 | UInt codeWord ; |
---|
| 4745 | UInt rSymbol; |
---|
| 4746 | UInt sign; |
---|
| 4747 | |
---|
| 4748 | READ_UVLC( prefix, "quotient") ; |
---|
| 4749 | READ_CODE (rParam, codeWord, "remainder"); |
---|
| 4750 | rSymbol = (prefix<<rParam) + codeWord; |
---|
| 4751 | |
---|
| 4752 | if(rSymbol) |
---|
| 4753 | { |
---|
| 4754 | READ_FLAG(sign, "sign"); |
---|
| 4755 | param = sign ? -(Int)(rSymbol) : (Int)(rSymbol); |
---|
| 4756 | } |
---|
| 4757 | else param = 0; |
---|
| 4758 | } |
---|
[713] | 4759 | #endif |
---|
[894] | 4760 | #if VPS_VUI_BSP_HRD_PARAMS |
---|
| 4761 | Void TDecCavlc::parseVpsVuiBspHrdParams( TComVPS *vps ) |
---|
| 4762 | { |
---|
| 4763 | UInt uiCode; |
---|
| 4764 | assert (vps->getTimingInfo()->getTimingInfoPresentFlag() == 1); |
---|
| 4765 | READ_UVLC( uiCode, "vps_num_add_hrd_params" ); vps->setVpsNumAddHrdParams(uiCode); |
---|
| 4766 | vps->createBspHrdParamBuffer(vps->getVpsNumAddHrdParams()); // Also allocates m_cprmsAddPresentFlag and m_numSubLayerHrdMinus |
---|
| 4767 | |
---|
| 4768 | for( Int i = vps->getNumHrdParameters(), j = 0; i < vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams(); i++, j++ ) // j = i - vps->getNumHrdParameters() |
---|
| 4769 | { |
---|
| 4770 | if( i > 0 ) |
---|
| 4771 | { |
---|
| 4772 | READ_FLAG( uiCode, "cprms_add_present_flag[i]" ); vps->setCprmsAddPresentFlag(j, uiCode ? true : false); |
---|
| 4773 | } |
---|
| 4774 | else |
---|
| 4775 | { |
---|
| 4776 | // i == 0 |
---|
| 4777 | if( vps->getNumHrdParameters() == 0 ) |
---|
| 4778 | { |
---|
| 4779 | vps->setCprmsAddPresentFlag(0, true); |
---|
| 4780 | } |
---|
| 4781 | } |
---|
| 4782 | READ_UVLC( uiCode, "num_sub_layer_hrd_minus1[i]" ); vps->setNumSubLayerHrdMinus1(j, uiCode ); |
---|
| 4783 | assert( uiCode <= vps->getMaxTLayers() - 1 ); |
---|
| 4784 | |
---|
| 4785 | parseHrdParameters( vps->getBspHrd(j), vps->getCprmsAddPresentFlag(j), vps->getNumSubLayerHrdMinus1(j) ); |
---|
| 4786 | if( i > 0 && !vps->getCprmsAddPresentFlag(i) ) |
---|
| 4787 | { |
---|
| 4788 | // Copy common information parameters |
---|
| 4789 | if( i == vps->getNumHrdParameters() ) |
---|
| 4790 | { |
---|
| 4791 | vps->getBspHrd(j)->copyCommonInformation( vps->getHrdParameters( vps->getNumHrdParameters() - 1 ) ); |
---|
| 4792 | } |
---|
| 4793 | else |
---|
| 4794 | { |
---|
| 4795 | vps->getBspHrd(j)->copyCommonInformation( vps->getBspHrd( j - 1 ) ); |
---|
| 4796 | } |
---|
| 4797 | } |
---|
| 4798 | } |
---|
| 4799 | for (Int h = 1; h < vps->getNumOutputLayerSets(); h++) |
---|
| 4800 | { |
---|
| 4801 | Int lsIdx = vps->getOutputLayerSetIdx( h ); |
---|
| 4802 | READ_UVLC( uiCode, "num_signalled_partitioning_schemes[h]"); vps->setNumSignalledPartitioningSchemes(h, uiCode); |
---|
| 4803 | for( Int j = 0; j < vps->getNumSignalledPartitioningSchemes(h); j++ ) |
---|
| 4804 | { |
---|
| 4805 | READ_UVLC( uiCode, "num_partitions_in_scheme_minus1[h][j]" ); vps->setNumPartitionsInSchemeMinus1(h, j, uiCode); |
---|
| 4806 | for( Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, j); k++ ) |
---|
| 4807 | { |
---|
| 4808 | for( Int r = 0; r < vps->getNumLayersInIdList( lsIdx ); r++ ) |
---|
| 4809 | { |
---|
| 4810 | READ_FLAG( uiCode, "layer_included_in_partition_flag[h][j][k][r]" ); vps->setLayerIncludedInPartitionFlag(h, j, k, r, uiCode ? true : false); |
---|
| 4811 | } |
---|
| 4812 | } |
---|
| 4813 | } |
---|
| 4814 | for( Int i = 0; i < vps->getNumSignalledPartitioningSchemes(h) + 1; i++ ) |
---|
| 4815 | { |
---|
| 4816 | for( Int t = 0; t <= vps->getMaxSLayersInLayerSetMinus1(lsIdx); t++ ) |
---|
| 4817 | { |
---|
| 4818 | READ_UVLC( uiCode, "num_bsp_schedules_minus1[h][i][t]"); vps->setNumBspSchedulesMinus1(h, i, t, uiCode); |
---|
| 4819 | for( Int j = 0; j <= vps->getNumBspSchedulesMinus1(h, i, t); j++ ) |
---|
| 4820 | { |
---|
| 4821 | for( Int k = 0; k < vps->getNumPartitionsInSchemeMinus1(h, i); k++ ) |
---|
| 4822 | { |
---|
| 4823 | READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][t][j][k]"); vps->setBspHrdIdx(h, i, t, j, k, uiCode); |
---|
| 4824 | READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][t][j][k]"); vps->setBspSchedIdx(h, i, t, j, k, uiCode); |
---|
| 4825 | } |
---|
| 4826 | } |
---|
| 4827 | } |
---|
| 4828 | } |
---|
| 4829 | |
---|
| 4830 | // To be done: Check each layer included in not more than one BSP in every partitioning scheme, |
---|
| 4831 | // and other related checks associated with layers in bitstream partitions. |
---|
| 4832 | |
---|
| 4833 | } |
---|
| 4834 | } |
---|
[825] | 4835 | #endif |
---|
[894] | 4836 | #endif |
---|
[313] | 4837 | //! \} |
---|
| 4838 | |
---|