[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 | } |
---|
[442] | 297 | |
---|
[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 | { |
---|
[540] | 307 | READ_UVLC( 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 |
---|
[442] | 317 | |
---|
[825] | 318 | READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" ); pcPPS->setScalingListPresentFlag( uiCode ? true : false ); |
---|
[442] | 319 | |
---|
[825] | 320 | if(pcPPS->getScalingListPresentFlag ()) |
---|
| 321 | { |
---|
| 322 | parseScalingList( pcPPS->getScalingList() ); |
---|
| 323 | } |
---|
[313] | 324 | |
---|
[540] | 325 | #if SCALINGLIST_INFERRING |
---|
| 326 | } |
---|
| 327 | #endif |
---|
| 328 | |
---|
[313] | 329 | READ_FLAG( uiCode, "lists_modification_present_flag"); |
---|
| 330 | pcPPS->setListsModificationPresentFlag(uiCode); |
---|
| 331 | |
---|
| 332 | READ_UVLC( uiCode, "log2_parallel_merge_level_minus2"); |
---|
| 333 | pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode); |
---|
| 334 | |
---|
| 335 | READ_FLAG( uiCode, "slice_segment_header_extension_present_flag"); |
---|
| 336 | pcPPS->setSliceHeaderExtensionPresentFlag(uiCode); |
---|
| 337 | |
---|
| 338 | READ_FLAG( uiCode, "pps_extension_flag"); |
---|
[815] | 339 | #if POC_RESET_INFO_INFERENCE |
---|
| 340 | pcPPS->setExtensionFlag( uiCode ? true : false ); |
---|
| 341 | |
---|
| 342 | if( pcPPS->getExtensionFlag() ) |
---|
| 343 | #else |
---|
[313] | 344 | if (uiCode) |
---|
[815] | 345 | #endif |
---|
[313] | 346 | { |
---|
[644] | 347 | #if P0166_MODIFIED_PPS_EXTENSION |
---|
| 348 | UInt ppsExtensionTypeFlag[8]; |
---|
| 349 | for (UInt i = 0; i < 8; i++) |
---|
| 350 | { |
---|
| 351 | READ_FLAG( ppsExtensionTypeFlag[i], "pps_extension_type_flag" ); |
---|
| 352 | } |
---|
| 353 | #if !POC_RESET_IDC |
---|
| 354 | if (ppsExtensionTypeFlag[1]) |
---|
| 355 | { |
---|
| 356 | #else |
---|
| 357 | if( ppsExtensionTypeFlag[0] ) |
---|
| 358 | { |
---|
| 359 | READ_FLAG( uiCode, "poc_reset_info_present_flag" ); |
---|
| 360 | pcPPS->setPocResetInfoPresentFlag(uiCode ? true : false); |
---|
[713] | 361 | #if Q0048_CGS_3D_ASYMLUT |
---|
| 362 | READ_FLAG( uiCode , "colour_mapping_enabled_flag" ); |
---|
| 363 | pcPPS->setCGSFlag( uiCode ); |
---|
| 364 | if( pcPPS->getCGSFlag() ) |
---|
| 365 | { |
---|
| 366 | xParse3DAsymLUT( pc3DAsymLUT ); |
---|
| 367 | pcPPS->setCGSOutputBitDepthY( pc3DAsymLUT->getOutputBitDepthY() ); |
---|
| 368 | pcPPS->setCGSOutputBitDepthC( pc3DAsymLUT->getOutputBitDepthC() ); |
---|
| 369 | } |
---|
[644] | 370 | #endif |
---|
[713] | 371 | #endif |
---|
[644] | 372 | } |
---|
[815] | 373 | #if POC_RESET_INFO_INFERENCE |
---|
| 374 | else // Extension type 0 absent |
---|
| 375 | { |
---|
| 376 | pcPPS->setPocResetInfoPresentFlag( false ); |
---|
| 377 | } |
---|
| 378 | #endif |
---|
[644] | 379 | if (ppsExtensionTypeFlag[7]) |
---|
| 380 | { |
---|
| 381 | #endif |
---|
| 382 | |
---|
[825] | 383 | while ( xMoreRbspData() ) |
---|
| 384 | { |
---|
| 385 | READ_FLAG( uiCode, "pps_extension_data_flag"); |
---|
| 386 | } |
---|
[644] | 387 | #if P0166_MODIFIED_PPS_EXTENSION |
---|
| 388 | } |
---|
| 389 | #endif |
---|
[313] | 390 | } |
---|
[815] | 391 | #if POC_RESET_INFO_INFERENCE |
---|
| 392 | if( !pcPPS->getExtensionFlag() ) |
---|
| 393 | { |
---|
| 394 | pcPPS->setPocResetInfoPresentFlag( false ); |
---|
| 395 | } |
---|
| 396 | #endif |
---|
[313] | 397 | } |
---|
| 398 | |
---|
| 399 | Void TDecCavlc::parseVUI(TComVUI* pcVUI, TComSPS *pcSPS) |
---|
| 400 | { |
---|
| 401 | #if ENC_DEC_TRACE |
---|
| 402 | fprintf( g_hTrace, "----------- vui_parameters -----------\n"); |
---|
| 403 | #endif |
---|
| 404 | UInt uiCode; |
---|
| 405 | |
---|
| 406 | READ_FLAG( uiCode, "aspect_ratio_info_present_flag"); pcVUI->setAspectRatioInfoPresentFlag(uiCode); |
---|
| 407 | if (pcVUI->getAspectRatioInfoPresentFlag()) |
---|
| 408 | { |
---|
| 409 | READ_CODE(8, uiCode, "aspect_ratio_idc"); pcVUI->setAspectRatioIdc(uiCode); |
---|
| 410 | if (pcVUI->getAspectRatioIdc() == 255) |
---|
| 411 | { |
---|
| 412 | READ_CODE(16, uiCode, "sar_width"); pcVUI->setSarWidth(uiCode); |
---|
| 413 | READ_CODE(16, uiCode, "sar_height"); pcVUI->setSarHeight(uiCode); |
---|
| 414 | } |
---|
| 415 | } |
---|
| 416 | |
---|
| 417 | READ_FLAG( uiCode, "overscan_info_present_flag"); pcVUI->setOverscanInfoPresentFlag(uiCode); |
---|
| 418 | if (pcVUI->getOverscanInfoPresentFlag()) |
---|
| 419 | { |
---|
| 420 | READ_FLAG( uiCode, "overscan_appropriate_flag"); pcVUI->setOverscanAppropriateFlag(uiCode); |
---|
| 421 | } |
---|
| 422 | |
---|
| 423 | READ_FLAG( uiCode, "video_signal_type_present_flag"); pcVUI->setVideoSignalTypePresentFlag(uiCode); |
---|
| 424 | if (pcVUI->getVideoSignalTypePresentFlag()) |
---|
| 425 | { |
---|
| 426 | READ_CODE(3, uiCode, "video_format"); pcVUI->setVideoFormat(uiCode); |
---|
| 427 | READ_FLAG( uiCode, "video_full_range_flag"); pcVUI->setVideoFullRangeFlag(uiCode); |
---|
| 428 | READ_FLAG( uiCode, "colour_description_present_flag"); pcVUI->setColourDescriptionPresentFlag(uiCode); |
---|
| 429 | if (pcVUI->getColourDescriptionPresentFlag()) |
---|
| 430 | { |
---|
| 431 | READ_CODE(8, uiCode, "colour_primaries"); pcVUI->setColourPrimaries(uiCode); |
---|
| 432 | READ_CODE(8, uiCode, "transfer_characteristics"); pcVUI->setTransferCharacteristics(uiCode); |
---|
| 433 | READ_CODE(8, uiCode, "matrix_coefficients"); pcVUI->setMatrixCoefficients(uiCode); |
---|
| 434 | } |
---|
| 435 | } |
---|
| 436 | |
---|
| 437 | READ_FLAG( uiCode, "chroma_loc_info_present_flag"); pcVUI->setChromaLocInfoPresentFlag(uiCode); |
---|
| 438 | if (pcVUI->getChromaLocInfoPresentFlag()) |
---|
| 439 | { |
---|
| 440 | READ_UVLC( uiCode, "chroma_sample_loc_type_top_field" ); pcVUI->setChromaSampleLocTypeTopField(uiCode); |
---|
| 441 | READ_UVLC( uiCode, "chroma_sample_loc_type_bottom_field" ); pcVUI->setChromaSampleLocTypeBottomField(uiCode); |
---|
| 442 | } |
---|
| 443 | |
---|
| 444 | READ_FLAG( uiCode, "neutral_chroma_indication_flag"); pcVUI->setNeutralChromaIndicationFlag(uiCode); |
---|
| 445 | |
---|
| 446 | READ_FLAG( uiCode, "field_seq_flag"); pcVUI->setFieldSeqFlag(uiCode); |
---|
| 447 | |
---|
| 448 | READ_FLAG(uiCode, "frame_field_info_present_flag"); pcVUI->setFrameFieldInfoPresentFlag(uiCode); |
---|
| 449 | |
---|
| 450 | READ_FLAG( uiCode, "default_display_window_flag"); |
---|
| 451 | if (uiCode != 0) |
---|
| 452 | { |
---|
| 453 | Window &defDisp = pcVUI->getDefaultDisplayWindow(); |
---|
| 454 | READ_UVLC( uiCode, "def_disp_win_left_offset" ); defDisp.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); |
---|
| 455 | READ_UVLC( uiCode, "def_disp_win_right_offset" ); defDisp.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); |
---|
| 456 | READ_UVLC( uiCode, "def_disp_win_top_offset" ); defDisp.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); |
---|
| 457 | READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); |
---|
| 458 | } |
---|
| 459 | TimingInfo *timingInfo = pcVUI->getTimingInfo(); |
---|
| 460 | READ_FLAG( uiCode, "vui_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); |
---|
[815] | 461 | #if SVC_EXTENSION |
---|
[442] | 462 | if( pcSPS->getLayerId() > 0 ) |
---|
| 463 | { |
---|
| 464 | assert( timingInfo->getTimingInfoPresentFlag() == false ); |
---|
| 465 | } |
---|
| 466 | #endif |
---|
[313] | 467 | if(timingInfo->getTimingInfoPresentFlag()) |
---|
| 468 | { |
---|
| 469 | READ_CODE( 32, uiCode, "vui_num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode); |
---|
| 470 | READ_CODE( 32, uiCode, "vui_time_scale"); timingInfo->setTimeScale (uiCode); |
---|
| 471 | READ_FLAG( uiCode, "vui_poc_proportional_to_timing_flag"); timingInfo->setPocProportionalToTimingFlag(uiCode ? true : false); |
---|
| 472 | if(timingInfo->getPocProportionalToTimingFlag()) |
---|
| 473 | { |
---|
| 474 | READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); |
---|
| 475 | } |
---|
[825] | 476 | READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); |
---|
| 477 | if( pcVUI->getHrdParametersPresentFlag() ) |
---|
| 478 | { |
---|
| 479 | parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); |
---|
| 480 | } |
---|
[313] | 481 | } |
---|
| 482 | READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode); |
---|
| 483 | if (pcVUI->getBitstreamRestrictionFlag()) |
---|
| 484 | { |
---|
| 485 | READ_FLAG( uiCode, "tiles_fixed_structure_flag"); pcVUI->setTilesFixedStructureFlag(uiCode); |
---|
| 486 | READ_FLAG( uiCode, "motion_vectors_over_pic_boundaries_flag"); pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode); |
---|
| 487 | READ_FLAG( uiCode, "restricted_ref_pic_lists_flag"); pcVUI->setRestrictedRefPicListsFlag(uiCode); |
---|
| 488 | READ_UVLC( uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode); |
---|
| 489 | assert(uiCode < 4096); |
---|
| 490 | READ_UVLC( uiCode, "max_bytes_per_pic_denom" ); pcVUI->setMaxBytesPerPicDenom(uiCode); |
---|
| 491 | READ_UVLC( uiCode, "max_bits_per_mincu_denom" ); pcVUI->setMaxBitsPerMinCuDenom(uiCode); |
---|
| 492 | READ_UVLC( uiCode, "log2_max_mv_length_horizontal" ); pcVUI->setLog2MaxMvLengthHorizontal(uiCode); |
---|
| 493 | READ_UVLC( uiCode, "log2_max_mv_length_vertical" ); pcVUI->setLog2MaxMvLengthVertical(uiCode); |
---|
| 494 | } |
---|
| 495 | } |
---|
| 496 | |
---|
| 497 | Void TDecCavlc::parseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1) |
---|
| 498 | { |
---|
| 499 | UInt uiCode; |
---|
| 500 | if( commonInfPresentFlag ) |
---|
| 501 | { |
---|
| 502 | READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false ); |
---|
| 503 | READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false ); |
---|
| 504 | if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) |
---|
| 505 | { |
---|
| 506 | READ_FLAG( uiCode, "sub_pic_cpb_params_present_flag" ); hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false ); |
---|
| 507 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
| 508 | { |
---|
| 509 | READ_CODE( 8, uiCode, "tick_divisor_minus2" ); hrd->setTickDivisorMinus2( uiCode ); |
---|
| 510 | READ_CODE( 5, uiCode, "du_cpb_removal_delay_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode ); |
---|
| 511 | READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false ); |
---|
| 512 | READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1" ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode ); |
---|
| 513 | } |
---|
| 514 | READ_CODE( 4, uiCode, "bit_rate_scale" ); hrd->setBitRateScale( uiCode ); |
---|
| 515 | READ_CODE( 4, uiCode, "cpb_size_scale" ); hrd->setCpbSizeScale( uiCode ); |
---|
| 516 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
| 517 | { |
---|
| 518 | READ_CODE( 4, uiCode, "cpb_size_du_scale" ); hrd->setDuCpbSizeScale( uiCode ); |
---|
| 519 | } |
---|
| 520 | READ_CODE( 5, uiCode, "initial_cpb_removal_delay_length_minus1" ); hrd->setInitialCpbRemovalDelayLengthMinus1( uiCode ); |
---|
| 521 | READ_CODE( 5, uiCode, "au_cpb_removal_delay_length_minus1" ); hrd->setCpbRemovalDelayLengthMinus1( uiCode ); |
---|
| 522 | READ_CODE( 5, uiCode, "dpb_output_delay_length_minus1" ); hrd->setDpbOutputDelayLengthMinus1( uiCode ); |
---|
| 523 | } |
---|
| 524 | } |
---|
| 525 | Int i, j, nalOrVcl; |
---|
| 526 | for( i = 0; i <= maxNumSubLayersMinus1; i ++ ) |
---|
| 527 | { |
---|
| 528 | READ_FLAG( uiCode, "fixed_pic_rate_general_flag" ); hrd->setFixedPicRateFlag( i, uiCode == 1 ? true : false ); |
---|
| 529 | if( !hrd->getFixedPicRateFlag( i ) ) |
---|
| 530 | { |
---|
| 531 | READ_FLAG( uiCode, "fixed_pic_rate_within_cvs_flag" ); hrd->setFixedPicRateWithinCvsFlag( i, uiCode == 1 ? true : false ); |
---|
| 532 | } |
---|
| 533 | else |
---|
| 534 | { |
---|
| 535 | hrd->setFixedPicRateWithinCvsFlag( i, true ); |
---|
| 536 | } |
---|
| 537 | hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present |
---|
| 538 | hrd->setCpbCntMinus1 ( i, 0 ); // Infered to be 0 when not present |
---|
| 539 | if( hrd->getFixedPicRateWithinCvsFlag( i ) ) |
---|
| 540 | { |
---|
| 541 | READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" ); hrd->setPicDurationInTcMinus1( i, uiCode ); |
---|
| 542 | } |
---|
| 543 | else |
---|
| 544 | { |
---|
| 545 | READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false ); |
---|
| 546 | } |
---|
| 547 | if (!hrd->getLowDelayHrdFlag( i )) |
---|
| 548 | { |
---|
| 549 | READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); |
---|
| 550 | } |
---|
| 551 | for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) |
---|
| 552 | { |
---|
| 553 | if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || |
---|
[825] | 554 | ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) |
---|
[313] | 555 | { |
---|
| 556 | for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) |
---|
| 557 | { |
---|
| 558 | READ_UVLC( uiCode, "bit_rate_value_minus1" ); hrd->setBitRateValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
| 559 | READ_UVLC( uiCode, "cpb_size_value_minus1" ); hrd->setCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
| 560 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
| 561 | { |
---|
| 562 | READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
| 563 | READ_UVLC( uiCode, "bit_rate_du_value_minus1" ); hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
| 564 | } |
---|
| 565 | READ_FLAG( uiCode, "cbr_flag" ); hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false ); |
---|
| 566 | } |
---|
| 567 | } |
---|
| 568 | } |
---|
| 569 | } |
---|
| 570 | } |
---|
| 571 | |
---|
[644] | 572 | #if SVC_EXTENSION && !SPS_DPB_PARAMS |
---|
[313] | 573 | Void TDecCavlc::parseSPS(TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager) |
---|
| 574 | #else |
---|
| 575 | Void TDecCavlc::parseSPS(TComSPS* pcSPS) |
---|
| 576 | #endif |
---|
| 577 | { |
---|
| 578 | #if ENC_DEC_TRACE |
---|
| 579 | xTraceSPSHeader (pcSPS); |
---|
| 580 | #endif |
---|
| 581 | |
---|
| 582 | UInt uiCode; |
---|
| 583 | READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode ); |
---|
[494] | 584 | #if SVC_EXTENSION |
---|
[313] | 585 | if(pcSPS->getLayerId() == 0) |
---|
| 586 | { |
---|
| 587 | #endif |
---|
| 588 | READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); |
---|
| 589 | assert(uiCode <= 6); |
---|
[494] | 590 | |
---|
[313] | 591 | READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); |
---|
[494] | 592 | #if SVC_EXTENSION |
---|
[313] | 593 | } |
---|
[644] | 594 | #if !SPS_DPB_PARAMS |
---|
[313] | 595 | else |
---|
| 596 | { |
---|
| 597 | pcSPS->setMaxTLayers ( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId())->getMaxTLayers() ); |
---|
| 598 | pcSPS->setTemporalIdNestingFlag( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId())->getTemporalNestingFlag() ); |
---|
| 599 | } |
---|
[442] | 600 | #endif |
---|
[644] | 601 | #endif |
---|
| 602 | |
---|
[815] | 603 | #if !Q0177_SPS_TEMP_NESTING_FIX //This part is not needed anymore as it is already covered by implementation in TDecTop::xActivateParameterSets() |
---|
[313] | 604 | if ( pcSPS->getMaxTLayers() == 1 ) |
---|
| 605 | { |
---|
| 606 | // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0 |
---|
[494] | 607 | #if SVC_EXTENSION |
---|
[644] | 608 | #if !SPS_DPB_PARAMS |
---|
[313] | 609 | assert( pcSPS->getTemporalIdNestingFlag() == true ); |
---|
[644] | 610 | #endif |
---|
[313] | 611 | #else |
---|
| 612 | assert( uiCode == 1 ); |
---|
| 613 | #endif |
---|
| 614 | } |
---|
[815] | 615 | #endif |
---|
| 616 | |
---|
[442] | 617 | #ifdef SPS_PTL_FIX |
---|
| 618 | if ( pcSPS->getLayerId() == 0) |
---|
| 619 | { |
---|
| 620 | parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); |
---|
| 621 | } |
---|
| 622 | #else |
---|
| 623 | parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); |
---|
| 624 | #endif |
---|
[313] | 625 | |
---|
| 626 | READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); |
---|
| 627 | assert(uiCode <= 15); |
---|
[442] | 628 | |
---|
| 629 | #if REPN_FORMAT_IN_VPS |
---|
| 630 | if( pcSPS->getLayerId() > 0 ) |
---|
[313] | 631 | { |
---|
[494] | 632 | READ_FLAG( uiCode, "update_rep_format_flag" ); |
---|
[442] | 633 | pcSPS->setUpdateRepFormatFlag( uiCode ? true : false ); |
---|
[313] | 634 | } |
---|
[442] | 635 | else |
---|
| 636 | { |
---|
[713] | 637 | #if REP_FORMAT_FIX |
---|
| 638 | pcSPS->setUpdateRepFormatFlag( false ); |
---|
| 639 | #else |
---|
[442] | 640 | pcSPS->setUpdateRepFormatFlag( true ); |
---|
[713] | 641 | #endif |
---|
[442] | 642 | } |
---|
[540] | 643 | #if O0096_REP_FORMAT_INDEX |
---|
| 644 | if( pcSPS->getLayerId() == 0 ) |
---|
| 645 | #else |
---|
[494] | 646 | if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) |
---|
[540] | 647 | #endif |
---|
[442] | 648 | { |
---|
| 649 | #endif |
---|
[494] | 650 | #if AUXILIARY_PICTURES |
---|
| 651 | READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) ); |
---|
| 652 | #else |
---|
[442] | 653 | READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( uiCode ); |
---|
[494] | 654 | #endif |
---|
[442] | 655 | assert(uiCode <= 3); |
---|
| 656 | // 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 |
---|
| 657 | assert (uiCode == 1); |
---|
| 658 | if( uiCode == 3 ) |
---|
| 659 | { |
---|
| 660 | READ_FLAG( uiCode, "separate_colour_plane_flag"); assert(uiCode == 0); |
---|
| 661 | } |
---|
[313] | 662 | |
---|
[442] | 663 | READ_UVLC ( uiCode, "pic_width_in_luma_samples" ); pcSPS->setPicWidthInLumaSamples ( uiCode ); |
---|
| 664 | READ_UVLC ( uiCode, "pic_height_in_luma_samples" ); pcSPS->setPicHeightInLumaSamples( uiCode ); |
---|
| 665 | #if REPN_FORMAT_IN_VPS |
---|
| 666 | } |
---|
[540] | 667 | #if O0096_REP_FORMAT_INDEX |
---|
| 668 | else if ( pcSPS->getUpdateRepFormatFlag() ) |
---|
| 669 | { |
---|
| 670 | READ_CODE(8, uiCode, "update_rep_format_index"); |
---|
| 671 | pcSPS->setUpdateRepFormatIndex(uiCode); |
---|
| 672 | } |
---|
[442] | 673 | #endif |
---|
[540] | 674 | #endif |
---|
[313] | 675 | READ_FLAG( uiCode, "conformance_window_flag"); |
---|
| 676 | if (uiCode != 0) |
---|
| 677 | { |
---|
| 678 | Window &conf = pcSPS->getConformanceWindow(); |
---|
[442] | 679 | #if REPN_FORMAT_IN_VPS |
---|
| 680 | READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode ); |
---|
| 681 | READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode ); |
---|
| 682 | READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode ); |
---|
| 683 | READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode ); |
---|
| 684 | #else |
---|
[313] | 685 | READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); |
---|
| 686 | READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); |
---|
| 687 | READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); |
---|
| 688 | READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); |
---|
[442] | 689 | #endif |
---|
[313] | 690 | } |
---|
[442] | 691 | #if REPN_FORMAT_IN_VPS |
---|
[540] | 692 | #if O0096_REP_FORMAT_INDEX |
---|
| 693 | if( pcSPS->getLayerId() == 0 ) |
---|
| 694 | #else |
---|
[494] | 695 | if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) |
---|
[540] | 696 | #endif |
---|
[442] | 697 | { |
---|
| 698 | #endif |
---|
| 699 | READ_UVLC( uiCode, "bit_depth_luma_minus8" ); |
---|
| 700 | assert(uiCode <= 6); |
---|
| 701 | pcSPS->setBitDepthY( uiCode + 8 ); |
---|
| 702 | pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); |
---|
[313] | 703 | |
---|
[442] | 704 | READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); |
---|
| 705 | assert(uiCode <= 6); |
---|
| 706 | pcSPS->setBitDepthC( uiCode + 8 ); |
---|
| 707 | pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); |
---|
| 708 | #if REPN_FORMAT_IN_VPS |
---|
| 709 | } |
---|
| 710 | #endif |
---|
[313] | 711 | READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); |
---|
| 712 | assert(uiCode <= 12); |
---|
| 713 | |
---|
[644] | 714 | #if SPS_DPB_PARAMS |
---|
| 715 | if( pcSPS->getLayerId() == 0 ) |
---|
[313] | 716 | { |
---|
[644] | 717 | #endif |
---|
| 718 | UInt subLayerOrderingInfoPresentFlag; |
---|
| 719 | READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); |
---|
[313] | 720 | |
---|
[644] | 721 | for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) |
---|
[313] | 722 | { |
---|
[713] | 723 | READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]"); |
---|
[644] | 724 | pcSPS->setMaxDecPicBuffering( uiCode + 1, i); |
---|
[713] | 725 | READ_UVLC ( uiCode, "sps_num_reorder_pics[i]" ); |
---|
[644] | 726 | pcSPS->setNumReorderPics(uiCode, i); |
---|
[713] | 727 | READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]"); |
---|
[644] | 728 | pcSPS->setMaxLatencyIncrease( uiCode, i ); |
---|
| 729 | |
---|
| 730 | if (!subLayerOrderingInfoPresentFlag) |
---|
[313] | 731 | { |
---|
[644] | 732 | for (i++; i <= pcSPS->getMaxTLayers()-1; i++) |
---|
| 733 | { |
---|
| 734 | pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i); |
---|
| 735 | pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i); |
---|
| 736 | pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i); |
---|
| 737 | } |
---|
| 738 | break; |
---|
[313] | 739 | } |
---|
| 740 | } |
---|
[644] | 741 | #if SPS_DPB_PARAMS |
---|
[313] | 742 | } |
---|
[644] | 743 | #endif |
---|
[313] | 744 | READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" ); |
---|
| 745 | Int log2MinCUSize = uiCode + 3; |
---|
| 746 | pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); |
---|
| 747 | READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" ); |
---|
| 748 | pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); |
---|
[825] | 749 | |
---|
[595] | 750 | if (pcSPS->getPTL()->getGeneralPTL()->getLevelIdc() >= Level::LEVEL5) |
---|
| 751 | { |
---|
| 752 | assert(log2MinCUSize + pcSPS->getLog2DiffMaxMinCodingBlockSize() >= 5); |
---|
| 753 | } |
---|
[825] | 754 | |
---|
[313] | 755 | Int maxCUDepthDelta = uiCode; |
---|
| 756 | pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); |
---|
| 757 | pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) ); |
---|
| 758 | READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); |
---|
| 759 | |
---|
| 760 | READ_UVLC( uiCode, "log2_diff_max_min_transform_block_size" ); pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() ); |
---|
| 761 | pcSPS->setMaxTrSize( 1<<(uiCode + pcSPS->getQuadtreeTULog2MinSize()) ); |
---|
| 762 | |
---|
| 763 | READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" ); pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 ); |
---|
| 764 | READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" ); pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 ); |
---|
| 765 | |
---|
| 766 | Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() ); |
---|
| 767 | pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth ); |
---|
[442] | 768 | READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); |
---|
[313] | 769 | |
---|
| 770 | if(pcSPS->getScalingListFlag()) |
---|
| 771 | { |
---|
[540] | 772 | #if SCALINGLIST_INFERRING |
---|
| 773 | if( pcSPS->getLayerId() > 0 ) |
---|
[313] | 774 | { |
---|
[540] | 775 | READ_FLAG( uiCode, "sps_infer_scaling_list_flag" ); pcSPS->setInferScalingListFlag( uiCode ); |
---|
| 776 | } |
---|
[442] | 777 | |
---|
[540] | 778 | if( pcSPS->getInferScalingListFlag() ) |
---|
| 779 | { |
---|
| 780 | READ_UVLC( uiCode, "sps_scaling_list_ref_layer_id" ); pcSPS->setScalingListRefLayerId( uiCode ); |
---|
[442] | 781 | |
---|
[540] | 782 | // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive |
---|
| 783 | assert( pcSPS->getScalingListRefLayerId() <= 62 ); |
---|
[442] | 784 | |
---|
[540] | 785 | pcSPS->setScalingListPresentFlag( false ); |
---|
| 786 | } |
---|
| 787 | else |
---|
| 788 | { |
---|
| 789 | #endif |
---|
[825] | 790 | READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode ); |
---|
| 791 | if(pcSPS->getScalingListPresentFlag ()) |
---|
| 792 | { |
---|
| 793 | parseScalingList( pcSPS->getScalingList() ); |
---|
| 794 | } |
---|
[540] | 795 | #if SCALINGLIST_INFERRING |
---|
| 796 | } |
---|
[442] | 797 | #endif |
---|
[313] | 798 | } |
---|
| 799 | READ_FLAG( uiCode, "amp_enabled_flag" ); pcSPS->setUseAMP( uiCode ); |
---|
| 800 | READ_FLAG( uiCode, "sample_adaptive_offset_enabled_flag" ); pcSPS->setUseSAO ( uiCode ? true : false ); |
---|
| 801 | |
---|
| 802 | READ_FLAG( uiCode, "pcm_enabled_flag" ); pcSPS->setUsePCM( uiCode ? true : false ); |
---|
| 803 | if( pcSPS->getUsePCM() ) |
---|
| 804 | { |
---|
| 805 | READ_CODE( 4, uiCode, "pcm_sample_bit_depth_luma_minus1" ); pcSPS->setPCMBitDepthLuma ( 1 + uiCode ); |
---|
| 806 | READ_CODE( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1" ); pcSPS->setPCMBitDepthChroma ( 1 + uiCode ); |
---|
| 807 | READ_UVLC( uiCode, "log2_min_pcm_luma_coding_block_size_minus3" ); pcSPS->setPCMLog2MinSize (uiCode+3); |
---|
| 808 | READ_UVLC( uiCode, "log2_diff_max_min_pcm_luma_coding_block_size" ); pcSPS->setPCMLog2MaxSize ( uiCode+pcSPS->getPCMLog2MinSize() ); |
---|
| 809 | READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" ); pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false ); |
---|
| 810 | } |
---|
| 811 | |
---|
| 812 | READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); |
---|
| 813 | assert(uiCode <= 64); |
---|
| 814 | pcSPS->createRPSList(uiCode); |
---|
| 815 | |
---|
| 816 | TComRPSList* rpsList = pcSPS->getRPSList(); |
---|
| 817 | TComReferencePictureSet* rps; |
---|
| 818 | |
---|
| 819 | for(UInt i=0; i< rpsList->getNumberOfReferencePictureSets(); i++) |
---|
| 820 | { |
---|
| 821 | rps = rpsList->getReferencePictureSet(i); |
---|
| 822 | parseShortTermRefPicSet(pcSPS,rps,i); |
---|
| 823 | } |
---|
| 824 | READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefsPresent(uiCode); |
---|
| 825 | if (pcSPS->getLongTermRefsPresent()) |
---|
| 826 | { |
---|
| 827 | READ_UVLC( uiCode, "num_long_term_ref_pic_sps" ); |
---|
| 828 | pcSPS->setNumLongTermRefPicSPS(uiCode); |
---|
| 829 | for (UInt k = 0; k < pcSPS->getNumLongTermRefPicSPS(); k++) |
---|
| 830 | { |
---|
| 831 | READ_CODE( pcSPS->getBitsForPOC(), uiCode, "lt_ref_pic_poc_lsb_sps" ); |
---|
| 832 | pcSPS->setLtRefPicPocLsbSps(k, uiCode); |
---|
| 833 | READ_FLAG( uiCode, "used_by_curr_pic_lt_sps_flag[i]"); |
---|
| 834 | pcSPS->setUsedByCurrPicLtSPSFlag(k, uiCode?1:0); |
---|
| 835 | } |
---|
| 836 | } |
---|
| 837 | READ_FLAG( uiCode, "sps_temporal_mvp_enable_flag" ); pcSPS->setTMVPFlagsPresent(uiCode); |
---|
| 838 | READ_FLAG( uiCode, "sps_strong_intra_smoothing_enable_flag" ); pcSPS->setUseStrongIntraSmoothing(uiCode); |
---|
| 839 | |
---|
| 840 | READ_FLAG( uiCode, "vui_parameters_present_flag" ); pcSPS->setVuiParametersPresentFlag(uiCode); |
---|
| 841 | |
---|
| 842 | if (pcSPS->getVuiParametersPresentFlag()) |
---|
| 843 | { |
---|
| 844 | parseVUI(pcSPS->getVuiParameters(), pcSPS); |
---|
| 845 | } |
---|
| 846 | |
---|
| 847 | READ_FLAG( uiCode, "sps_extension_flag"); |
---|
[815] | 848 | |
---|
| 849 | #if SVC_EXTENSION |
---|
| 850 | pcSPS->setExtensionFlag( uiCode ? true : false ); |
---|
| 851 | |
---|
| 852 | if( pcSPS->getExtensionFlag() ) |
---|
[313] | 853 | { |
---|
[540] | 854 | #if O0142_CONDITIONAL_SPS_EXTENSION |
---|
| 855 | UInt spsExtensionTypeFlag[8]; |
---|
| 856 | for (UInt i = 0; i < 8; i++) |
---|
| 857 | { |
---|
| 858 | READ_FLAG( spsExtensionTypeFlag[i], "sps_extension_type_flag" ); |
---|
| 859 | } |
---|
| 860 | if (spsExtensionTypeFlag[1]) |
---|
| 861 | { |
---|
| 862 | parseSPSExtension( pcSPS ); |
---|
| 863 | } |
---|
| 864 | if (spsExtensionTypeFlag[7]) |
---|
| 865 | { |
---|
| 866 | #else |
---|
[313] | 867 | parseSPSExtension( pcSPS ); |
---|
| 868 | READ_FLAG( uiCode, "sps_extension2_flag"); |
---|
| 869 | if(uiCode) |
---|
| 870 | { |
---|
| 871 | #endif |
---|
| 872 | while ( xMoreRbspData() ) |
---|
| 873 | { |
---|
| 874 | READ_FLAG( uiCode, "sps_extension_data_flag"); |
---|
| 875 | } |
---|
| 876 | } |
---|
[815] | 877 | } |
---|
| 878 | #else |
---|
| 879 | if (uiCode) |
---|
| 880 | { |
---|
| 881 | while ( xMoreRbspData() ) |
---|
| 882 | { |
---|
| 883 | READ_FLAG( uiCode, "sps_extension_data_flag"); |
---|
| 884 | } |
---|
| 885 | } |
---|
[313] | 886 | #endif |
---|
| 887 | } |
---|
| 888 | |
---|
[815] | 889 | #if SVC_EXTENSION |
---|
[313] | 890 | Void TDecCavlc::parseSPSExtension( TComSPS* pcSPS ) |
---|
| 891 | { |
---|
| 892 | UInt uiCode; |
---|
| 893 | // more syntax elements to be parsed here |
---|
[442] | 894 | |
---|
| 895 | READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" ); |
---|
| 896 | // Vertical MV component restriction is not used in SHVC CTC |
---|
| 897 | assert( uiCode == 0 ); |
---|
[588] | 898 | |
---|
[313] | 899 | if( pcSPS->getLayerId() > 0 ) |
---|
| 900 | { |
---|
[494] | 901 | Int iCode; |
---|
[313] | 902 | READ_UVLC( uiCode, "num_scaled_ref_layer_offsets" ); pcSPS->setNumScaledRefLayerOffsets(uiCode); |
---|
| 903 | for(Int i = 0; i < pcSPS->getNumScaledRefLayerOffsets(); i++) |
---|
| 904 | { |
---|
| 905 | Window& scaledWindow = pcSPS->getScaledRefLayerWindow(i); |
---|
[540] | 906 | #if O0098_SCALED_REF_LAYER_ID |
---|
[644] | 907 | READ_CODE( 6, uiCode, "scaled_ref_layer_id" ); pcSPS->setScaledRefLayerId( i, uiCode ); |
---|
[540] | 908 | #endif |
---|
[313] | 909 | READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); scaledWindow.setWindowLeftOffset (iCode << 1); |
---|
| 910 | READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); scaledWindow.setWindowTopOffset (iCode << 1); |
---|
| 911 | READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); scaledWindow.setWindowRightOffset (iCode << 1); |
---|
| 912 | READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); scaledWindow.setWindowBottomOffset(iCode << 1); |
---|
[644] | 913 | #if P0312_VERT_PHASE_ADJ |
---|
| 914 | READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode); pcSPS->setVertPhasePositionEnableFlag( pcSPS->getScaledRefLayerId(i), uiCode); |
---|
| 915 | #endif |
---|
[313] | 916 | } |
---|
| 917 | } |
---|
| 918 | } |
---|
| 919 | #endif |
---|
| 920 | |
---|
| 921 | Void TDecCavlc::parseVPS(TComVPS* pcVPS) |
---|
| 922 | { |
---|
| 923 | UInt uiCode; |
---|
| 924 | |
---|
| 925 | READ_CODE( 4, uiCode, "vps_video_parameter_set_id" ); pcVPS->setVPSId( uiCode ); |
---|
[836] | 926 | #if VPS_RESERVED_FLAGS |
---|
| 927 | READ_FLAG( uiCode, "vps_base_layer_internal_flag"); pcVPS->setBaseLayerInternalFlag( uiCode ? true : false ); |
---|
| 928 | READ_FLAG( uiCode, "vps_base_layer_available_flag"); pcVPS->setBaseLayerAvailableFlag( uiCode ? true : false ); |
---|
| 929 | #else |
---|
[313] | 930 | READ_CODE( 2, uiCode, "vps_reserved_three_2bits" ); assert(uiCode == 3); |
---|
[836] | 931 | #endif |
---|
[815] | 932 | #if SVC_EXTENSION |
---|
[547] | 933 | #if O0137_MAX_LAYERID |
---|
| 934 | READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); pcVPS->setMaxLayers( min( 62u, uiCode) + 1 ); |
---|
[313] | 935 | #else |
---|
[547] | 936 | READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); pcVPS->setMaxLayers( uiCode + 1 ); |
---|
| 937 | #endif |
---|
| 938 | #else |
---|
[313] | 939 | READ_CODE( 6, uiCode, "vps_reserved_zero_6bits" ); assert(uiCode == 0); |
---|
| 940 | #endif |
---|
[713] | 941 | READ_CODE( 3, uiCode, "vps_max_sub_layers_minus1" ); pcVPS->setMaxTLayers( uiCode + 1 ); assert(uiCode+1 <= MAX_TLAYER); |
---|
[313] | 942 | READ_FLAG( uiCode, "vps_temporal_id_nesting_flag" ); pcVPS->setTemporalNestingFlag( uiCode ? true:false ); |
---|
| 943 | assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag()); |
---|
[588] | 944 | #if !P0125_REVERT_VPS_EXTN_OFFSET_TO_RESERVED |
---|
[442] | 945 | #if VPS_EXTN_OFFSET |
---|
| 946 | READ_CODE( 16, uiCode, "vps_extension_offset" ); pcVPS->setExtensionOffset( uiCode ); |
---|
| 947 | #else |
---|
[313] | 948 | READ_CODE( 16, uiCode, "vps_reserved_ffff_16bits" ); assert(uiCode == 0xffff); |
---|
[442] | 949 | #endif |
---|
[588] | 950 | #else |
---|
| 951 | READ_CODE( 16, uiCode, "vps_reserved_ffff_16bits" ); assert(uiCode == 0xffff); |
---|
| 952 | #endif |
---|
[313] | 953 | parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1); |
---|
| 954 | UInt subLayerOrderingInfoPresentFlag; |
---|
| 955 | READ_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag"); |
---|
| 956 | for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) |
---|
| 957 | { |
---|
| 958 | READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); |
---|
| 959 | READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); |
---|
| 960 | READ_UVLC( uiCode, "vps_max_latency_increase_plus1[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); |
---|
| 961 | |
---|
| 962 | if (!subLayerOrderingInfoPresentFlag) |
---|
| 963 | { |
---|
| 964 | for (i++; i <= pcVPS->getMaxTLayers()-1; i++) |
---|
| 965 | { |
---|
| 966 | pcVPS->setMaxDecPicBuffering(pcVPS->getMaxDecPicBuffering(0), i); |
---|
| 967 | pcVPS->setNumReorderPics(pcVPS->getNumReorderPics(0), i); |
---|
| 968 | pcVPS->setMaxLatencyIncrease(pcVPS->getMaxLatencyIncrease(0), i); |
---|
| 969 | } |
---|
| 970 | break; |
---|
| 971 | } |
---|
| 972 | } |
---|
| 973 | |
---|
[815] | 974 | #if SVC_EXTENSION |
---|
[313] | 975 | assert( pcVPS->getNumHrdParameters() < MAX_VPS_LAYER_SETS_PLUS1 ); |
---|
| 976 | assert( pcVPS->getMaxLayerId() < MAX_VPS_LAYER_ID_PLUS1 ); |
---|
| 977 | READ_CODE( 6, uiCode, "vps_max_layer_id" ); pcVPS->setMaxLayerId( uiCode ); |
---|
[815] | 978 | #if Q0078_ADD_LAYER_SETS |
---|
| 979 | READ_UVLC(uiCode, "vps_num_layer_sets_minus1"); pcVPS->setVpsNumLayerSetsMinus1(uiCode); |
---|
| 980 | pcVPS->setNumLayerSets(pcVPS->getVpsNumLayerSetsMinus1() + 1); |
---|
| 981 | for (UInt opsIdx = 1; opsIdx <= pcVPS->getVpsNumLayerSetsMinus1(); opsIdx++) |
---|
| 982 | #else |
---|
[313] | 983 | READ_UVLC( uiCode, "vps_num_layer_sets_minus1" ); pcVPS->setNumLayerSets( uiCode + 1 ); |
---|
| 984 | for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getNumLayerSets() - 1 ); opsIdx ++ ) |
---|
[815] | 985 | #endif |
---|
[313] | 986 | { |
---|
| 987 | // Operation point set |
---|
| 988 | for( UInt i = 0; i <= pcVPS->getMaxLayerId(); i ++ ) |
---|
| 989 | #else |
---|
| 990 | assert( pcVPS->getNumHrdParameters() < MAX_VPS_OP_SETS_PLUS1 ); |
---|
| 991 | assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 ); |
---|
| 992 | READ_CODE( 6, uiCode, "vps_max_nuh_reserved_zero_layer_id" ); pcVPS->setMaxNuhReservedZeroLayerId( uiCode ); |
---|
| 993 | READ_UVLC( uiCode, "vps_max_op_sets_minus1" ); pcVPS->setMaxOpSets( uiCode + 1 ); |
---|
| 994 | for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getMaxOpSets() - 1 ); opsIdx ++ ) |
---|
| 995 | { |
---|
| 996 | // Operation point set |
---|
| 997 | for( UInt i = 0; i <= pcVPS->getMaxNuhReservedZeroLayerId(); i ++ ) |
---|
| 998 | #endif |
---|
| 999 | { |
---|
| 1000 | READ_FLAG( uiCode, "layer_id_included_flag[opsIdx][i]" ); pcVPS->setLayerIdIncludedFlag( uiCode == 1 ? true : false, opsIdx, i ); |
---|
| 1001 | } |
---|
| 1002 | } |
---|
| 1003 | #if DERIVE_LAYER_ID_LIST_VARIABLES |
---|
| 1004 | pcVPS->deriveLayerIdListVariables(); |
---|
| 1005 | #endif |
---|
| 1006 | TimingInfo *timingInfo = pcVPS->getTimingInfo(); |
---|
| 1007 | READ_FLAG( uiCode, "vps_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); |
---|
| 1008 | if(timingInfo->getTimingInfoPresentFlag()) |
---|
| 1009 | { |
---|
| 1010 | READ_CODE( 32, uiCode, "vps_num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode); |
---|
| 1011 | READ_CODE( 32, uiCode, "vps_time_scale"); timingInfo->setTimeScale (uiCode); |
---|
| 1012 | READ_FLAG( uiCode, "vps_poc_proportional_to_timing_flag"); timingInfo->setPocProportionalToTimingFlag(uiCode ? true : false); |
---|
| 1013 | if(timingInfo->getPocProportionalToTimingFlag()) |
---|
| 1014 | { |
---|
| 1015 | READ_UVLC( uiCode, "vps_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); |
---|
| 1016 | } |
---|
| 1017 | READ_UVLC( uiCode, "vps_num_hrd_parameters" ); pcVPS->setNumHrdParameters( uiCode ); |
---|
| 1018 | |
---|
| 1019 | if( pcVPS->getNumHrdParameters() > 0 ) |
---|
| 1020 | { |
---|
| 1021 | pcVPS->createHrdParamBuffer(); |
---|
| 1022 | } |
---|
| 1023 | for( UInt i = 0; i < pcVPS->getNumHrdParameters(); i ++ ) |
---|
| 1024 | { |
---|
| 1025 | READ_UVLC( uiCode, "hrd_op_set_idx" ); pcVPS->setHrdOpSetIdx( uiCode, i ); |
---|
| 1026 | if( i > 0 ) |
---|
| 1027 | { |
---|
| 1028 | READ_FLAG( uiCode, "cprms_present_flag[i]" ); pcVPS->setCprmsPresentFlag( uiCode == 1 ? true : false, i ); |
---|
| 1029 | } |
---|
[823] | 1030 | else |
---|
| 1031 | { |
---|
| 1032 | pcVPS->setCprmsPresentFlag( true, i ); |
---|
| 1033 | } |
---|
| 1034 | |
---|
[313] | 1035 | parseHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); |
---|
| 1036 | } |
---|
| 1037 | } |
---|
[713] | 1038 | |
---|
[815] | 1039 | #if SVC_EXTENSION |
---|
[713] | 1040 | READ_FLAG( uiCode, "vps_extension_flag" ); pcVPS->setVpsExtensionFlag( uiCode ? true : false ); |
---|
| 1041 | |
---|
| 1042 | // When MaxLayersMinus1 is greater than 0, vps_extension_flag shall be equal to 1. |
---|
| 1043 | if( pcVPS->getMaxLayers() > 1 ) |
---|
[313] | 1044 | { |
---|
[713] | 1045 | assert( pcVPS->getVpsExtensionFlag() == true ); |
---|
| 1046 | } |
---|
| 1047 | |
---|
| 1048 | if( pcVPS->getVpsExtensionFlag() ) |
---|
| 1049 | { |
---|
[442] | 1050 | while ( m_pcBitstream->getNumBitsRead() % 8 != 0 ) |
---|
| 1051 | { |
---|
| 1052 | READ_FLAG( uiCode, "vps_extension_alignment_bit_equal_to_one"); assert(uiCode == 1); |
---|
| 1053 | } |
---|
[313] | 1054 | parseVPSExtension(pcVPS); |
---|
| 1055 | READ_FLAG( uiCode, "vps_entension2_flag" ); |
---|
| 1056 | if(uiCode) |
---|
| 1057 | { |
---|
| 1058 | while ( xMoreRbspData() ) |
---|
| 1059 | { |
---|
| 1060 | READ_FLAG( uiCode, "vps_extension_data_flag"); |
---|
| 1061 | } |
---|
| 1062 | } |
---|
[713] | 1063 | } |
---|
| 1064 | else |
---|
| 1065 | { |
---|
| 1066 | // set default parameters when syntax elements are not present |
---|
| 1067 | defaultVPSExtension(pcVPS); |
---|
| 1068 | } |
---|
[313] | 1069 | #else |
---|
[713] | 1070 | READ_FLAG( uiCode, "vps_extension_flag" ); |
---|
| 1071 | if (uiCode) |
---|
| 1072 | { |
---|
[313] | 1073 | while ( xMoreRbspData() ) |
---|
| 1074 | { |
---|
| 1075 | READ_FLAG( uiCode, "vps_extension_data_flag"); |
---|
| 1076 | } |
---|
[713] | 1077 | } |
---|
[313] | 1078 | #endif |
---|
| 1079 | |
---|
| 1080 | return; |
---|
| 1081 | } |
---|
| 1082 | |
---|
[494] | 1083 | #if SVC_EXTENSION |
---|
[313] | 1084 | Void TDecCavlc::parseVPSExtension(TComVPS *vps) |
---|
| 1085 | { |
---|
| 1086 | UInt uiCode; |
---|
| 1087 | // ... More syntax elements to be parsed here |
---|
[644] | 1088 | #if P0300_ALT_OUTPUT_LAYER_FLAG |
---|
| 1089 | Int NumOutputLayersInOutputLayerSet[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
| 1090 | Int OlsHighestOutputLayerId[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
| 1091 | #endif |
---|
[313] | 1092 | #if VPS_EXTN_MASK_AND_DIM_INFO |
---|
| 1093 | UInt numScalabilityTypes = 0, i = 0, j = 0; |
---|
| 1094 | |
---|
| 1095 | READ_FLAG( uiCode, "avc_base_layer_flag" ); vps->setAvcBaseLayerFlag(uiCode ? true : false); |
---|
[547] | 1096 | |
---|
[588] | 1097 | #if !P0307_REMOVE_VPS_VUI_OFFSET |
---|
[547] | 1098 | #if O0109_MOVE_VPS_VUI_FLAG |
---|
| 1099 | READ_FLAG( uiCode, "vps_vui_present_flag"); vps->setVpsVuiPresentFlag(uiCode ? true : false); |
---|
| 1100 | if ( uiCode ) |
---|
| 1101 | { |
---|
| 1102 | #endif |
---|
| 1103 | #if VPS_VUI_OFFSET |
---|
[825] | 1104 | READ_CODE( 16, uiCode, "vps_vui_offset" ); vps->setVpsVuiOffset( uiCode ); |
---|
[547] | 1105 | #endif |
---|
| 1106 | #if O0109_MOVE_VPS_VUI_FLAG |
---|
| 1107 | } |
---|
| 1108 | #endif |
---|
[588] | 1109 | #endif |
---|
[313] | 1110 | READ_FLAG( uiCode, "splitting_flag" ); vps->setSplittingFlag(uiCode ? true : false); |
---|
| 1111 | |
---|
| 1112 | for(i = 0; i < MAX_VPS_NUM_SCALABILITY_TYPES; i++) |
---|
| 1113 | { |
---|
| 1114 | READ_FLAG( uiCode, "scalability_mask[i]" ); vps->setScalabilityMask(i, uiCode ? true : false); |
---|
| 1115 | numScalabilityTypes += uiCode; |
---|
| 1116 | } |
---|
| 1117 | vps->setNumScalabilityTypes(numScalabilityTypes); |
---|
| 1118 | |
---|
| 1119 | for(j = 0; j < numScalabilityTypes - vps->getSplittingFlag(); j++) |
---|
| 1120 | { |
---|
| 1121 | READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" ); vps->setDimensionIdLen(j, uiCode + 1); |
---|
| 1122 | } |
---|
[494] | 1123 | |
---|
[815] | 1124 | // The value of dimBitOffset[ NumScalabilityTypes ] is set equal to 6. |
---|
[313] | 1125 | if(vps->getSplittingFlag()) |
---|
| 1126 | { |
---|
| 1127 | UInt numBits = 0; |
---|
| 1128 | for(j = 0; j < numScalabilityTypes - 1; j++) |
---|
| 1129 | { |
---|
| 1130 | numBits += vps->getDimensionIdLen(j); |
---|
| 1131 | } |
---|
| 1132 | assert( numBits < 6 ); |
---|
| 1133 | vps->setDimensionIdLen(numScalabilityTypes-1, 6 - numBits); |
---|
| 1134 | numBits = 6; |
---|
| 1135 | } |
---|
| 1136 | |
---|
| 1137 | READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" ); vps->setNuhLayerIdPresentFlag(uiCode ? true : false); |
---|
| 1138 | vps->setLayerIdInNuh(0, 0); |
---|
| 1139 | vps->setLayerIdInVps(0, 0); |
---|
| 1140 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 1141 | { |
---|
| 1142 | if( vps->getNuhLayerIdPresentFlag() ) |
---|
| 1143 | { |
---|
| 1144 | READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" ); vps->setLayerIdInNuh(i, uiCode); |
---|
| 1145 | assert( uiCode > vps->getLayerIdInNuh(i-1) ); |
---|
| 1146 | } |
---|
| 1147 | else |
---|
| 1148 | { |
---|
| 1149 | vps->setLayerIdInNuh(i, i); |
---|
| 1150 | } |
---|
| 1151 | vps->setLayerIdInVps(vps->getLayerIdInNuh(i), i); |
---|
| 1152 | |
---|
[494] | 1153 | if( !vps->getSplittingFlag() ) |
---|
| 1154 | { |
---|
[825] | 1155 | for(j = 0; j < numScalabilityTypes; j++) |
---|
| 1156 | { |
---|
| 1157 | READ_CODE( vps->getDimensionIdLen(j), uiCode, "dimension_id[i][j]" ); vps->setDimensionId(i, j, uiCode); |
---|
[494] | 1158 | #if !AUXILIARY_PICTURES |
---|
[825] | 1159 | assert( uiCode <= vps->getMaxLayerId() ); |
---|
[494] | 1160 | #endif |
---|
[825] | 1161 | } |
---|
[313] | 1162 | } |
---|
| 1163 | } |
---|
| 1164 | #endif |
---|
[494] | 1165 | #if VIEW_ID_RELATED_SIGNALING |
---|
| 1166 | // if ( pcVPS->getNumViews() > 1 ) |
---|
| 1167 | // However, this is a bug in the text since, view_id_len_minus1 is needed to parse view_id_val. |
---|
[442] | 1168 | { |
---|
[547] | 1169 | #if O0109_VIEW_ID_LEN |
---|
| 1170 | READ_CODE( 4, uiCode, "view_id_len" ); vps->setViewIdLen( uiCode ); |
---|
| 1171 | #else |
---|
[442] | 1172 | READ_CODE( 4, uiCode, "view_id_len_minus1" ); vps->setViewIdLenMinus1( uiCode ); |
---|
[547] | 1173 | #endif |
---|
[442] | 1174 | } |
---|
| 1175 | |
---|
[547] | 1176 | #if O0109_VIEW_ID_LEN |
---|
| 1177 | if ( vps->getViewIdLen() > 0 ) |
---|
| 1178 | { |
---|
| 1179 | for( i = 0; i < vps->getNumViews(); i++ ) |
---|
| 1180 | { |
---|
| 1181 | READ_CODE( vps->getViewIdLen( ), uiCode, "view_id_val[i]" ); vps->setViewIdVal( i, uiCode ); |
---|
| 1182 | } |
---|
| 1183 | } |
---|
| 1184 | #else |
---|
[442] | 1185 | for( i = 0; i < vps->getNumViews(); i++ ) |
---|
| 1186 | { |
---|
| 1187 | READ_CODE( vps->getViewIdLenMinus1( ) + 1, uiCode, "view_id_val[i]" ); vps->setViewIdVal( i, uiCode ); |
---|
| 1188 | } |
---|
| 1189 | #endif |
---|
[547] | 1190 | #endif // view id related signaling |
---|
[313] | 1191 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
| 1192 | // For layer 0 |
---|
| 1193 | vps->setNumDirectRefLayers(0, 0); |
---|
| 1194 | // For other layers |
---|
| 1195 | for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++) |
---|
| 1196 | { |
---|
| 1197 | UInt numDirectRefLayers = 0; |
---|
| 1198 | for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++) |
---|
| 1199 | { |
---|
| 1200 | READ_FLAG(uiCode, "direct_dependency_flag[i][j]" ); vps->setDirectDependencyFlag(layerCtr, refLayerCtr, uiCode? true : false); |
---|
| 1201 | if(uiCode) |
---|
| 1202 | { |
---|
| 1203 | vps->setRefLayerId(layerCtr, numDirectRefLayers, refLayerCtr); |
---|
| 1204 | numDirectRefLayers++; |
---|
| 1205 | } |
---|
| 1206 | } |
---|
| 1207 | vps->setNumDirectRefLayers(layerCtr, numDirectRefLayers); |
---|
| 1208 | } |
---|
| 1209 | #endif |
---|
[815] | 1210 | #if Q0078_ADD_LAYER_SETS |
---|
| 1211 | #if O0092_0094_DEPENDENCY_CONSTRAINT // Moved here |
---|
| 1212 | vps->setNumRefLayers(); |
---|
| 1213 | |
---|
| 1214 | if (vps->getMaxLayers() > MAX_REF_LAYERS) |
---|
| 1215 | { |
---|
| 1216 | for (i = 1; i < vps->getMaxLayers(); i++) |
---|
| 1217 | { |
---|
| 1218 | assert(vps->getNumRefLayers(vps->getLayerIdInNuh(i)) <= MAX_REF_LAYERS); |
---|
| 1219 | } |
---|
| 1220 | } |
---|
| 1221 | #endif |
---|
| 1222 | vps->setPredictedLayerIds(); |
---|
| 1223 | vps->setTreePartitionLayerIdList(); |
---|
| 1224 | #endif |
---|
[540] | 1225 | #if VPS_TSLAYERS |
---|
[713] | 1226 | READ_FLAG( uiCode, "vps_sub_layers_max_minus1_present_flag"); vps->setMaxTSLayersPresentFlag(uiCode ? true : false); |
---|
| 1227 | |
---|
| 1228 | if (vps->getMaxTSLayersPresentFlag()) |
---|
| 1229 | { |
---|
| 1230 | for(i = 0; i < vps->getMaxLayers(); i++) |
---|
[540] | 1231 | { |
---|
[713] | 1232 | READ_CODE( 3, uiCode, "sub_layers_vps_max_minus1[i]" ); vps->setMaxTSLayersMinus1(i, uiCode); |
---|
[540] | 1233 | } |
---|
[713] | 1234 | } |
---|
| 1235 | else |
---|
| 1236 | { |
---|
| 1237 | for( i = 0; i < vps->getMaxLayers(); i++) |
---|
[540] | 1238 | { |
---|
[713] | 1239 | vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1); |
---|
[540] | 1240 | } |
---|
[713] | 1241 | } |
---|
[540] | 1242 | #endif |
---|
[442] | 1243 | READ_FLAG( uiCode, "max_tid_ref_present_flag"); vps->setMaxTidRefPresentFlag(uiCode ? true : false); |
---|
| 1244 | if (vps->getMaxTidRefPresentFlag()) |
---|
[345] | 1245 | { |
---|
| 1246 | for(i = 0; i < vps->getMaxLayers() - 1; i++) |
---|
| 1247 | { |
---|
[494] | 1248 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
[825] | 1249 | for( j = i+1; j <= vps->getMaxLayers() - 1; j++) |
---|
| 1250 | { |
---|
| 1251 | if(vps->getDirectDependencyFlag(j, i)) |
---|
| 1252 | { |
---|
| 1253 | READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i][j]" ); vps->setMaxTidIlRefPicsPlus1(i, j, uiCode); |
---|
| 1254 | assert( uiCode <= vps->getMaxTLayers()); |
---|
| 1255 | } |
---|
| 1256 | } |
---|
[494] | 1257 | #else |
---|
[442] | 1258 | READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1[i]" ); vps->setMaxTidIlRefPicsPlus1(i, uiCode); |
---|
| 1259 | assert( uiCode <= vps->getMaxTLayers()); |
---|
| 1260 | #endif |
---|
[345] | 1261 | } |
---|
| 1262 | } |
---|
[494] | 1263 | else |
---|
[345] | 1264 | { |
---|
| 1265 | for(i = 0; i < vps->getMaxLayers() - 1; i++) |
---|
| 1266 | { |
---|
[494] | 1267 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
[825] | 1268 | for( j = i+1; j <= vps->getMaxLayers() - 1; j++) |
---|
| 1269 | { |
---|
| 1270 | vps->setMaxTidIlRefPicsPlus1(i, j, 7); |
---|
| 1271 | } |
---|
[494] | 1272 | #else |
---|
[442] | 1273 | vps->setMaxTidIlRefPicsPlus1(i, 7); |
---|
[494] | 1274 | #endif |
---|
[345] | 1275 | } |
---|
| 1276 | } |
---|
[815] | 1277 | READ_FLAG( uiCode, "all_ref_layers_active_flag" ); vps->setIlpSshSignalingEnabledFlag(uiCode ? true : false); |
---|
[313] | 1278 | #if VPS_EXTN_PROFILE_INFO |
---|
| 1279 | // Profile-tier-level signalling |
---|
[588] | 1280 | #if !VPS_EXTN_UEV_CODING |
---|
[313] | 1281 | READ_CODE( 10, uiCode, "vps_number_layer_sets_minus1" ); assert( uiCode == (vps->getNumLayerSets() - 1) ); |
---|
| 1282 | READ_CODE( 6, uiCode, "vps_num_profile_tier_level_minus1"); vps->setNumProfileTierLevel( uiCode + 1 ); |
---|
[588] | 1283 | #else |
---|
| 1284 | READ_UVLC( uiCode, "vps_num_profile_tier_level_minus1"); vps->setNumProfileTierLevel( uiCode + 1 ); |
---|
| 1285 | #endif |
---|
[313] | 1286 | vps->getPTLForExtnPtr()->resize(vps->getNumProfileTierLevel()); |
---|
| 1287 | for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++) |
---|
| 1288 | { |
---|
| 1289 | READ_FLAG( uiCode, "vps_profile_present_flag[i]" ); vps->setProfilePresentFlag(idx, uiCode ? true : false); |
---|
| 1290 | if( !vps->getProfilePresentFlag(idx) ) |
---|
| 1291 | { |
---|
[588] | 1292 | #if P0048_REMOVE_PROFILE_REF |
---|
| 1293 | // Copy profile information from previous one |
---|
| 1294 | vps->getPTLForExtn(idx)->copyProfileInfo( (idx==1) ? vps->getPTL() : vps->getPTLForExtn( idx - 1 ) ); |
---|
| 1295 | #else |
---|
[313] | 1296 | READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); vps->setProfileLayerSetRef(idx, uiCode + 1); |
---|
[547] | 1297 | #if O0109_PROF_REF_MINUS1 |
---|
| 1298 | assert( vps->getProfileLayerSetRef(idx) <= idx ); |
---|
| 1299 | #else |
---|
[313] | 1300 | assert( vps->getProfileLayerSetRef(idx) < idx ); |
---|
[547] | 1301 | #endif |
---|
[313] | 1302 | // Copy profile information as indicated |
---|
| 1303 | vps->getPTLForExtn(idx)->copyProfileInfo( vps->getPTLForExtn( vps->getProfileLayerSetRef(idx) ) ); |
---|
[588] | 1304 | #endif |
---|
[313] | 1305 | } |
---|
| 1306 | parsePTL( vps->getPTLForExtn(idx), vps->getProfilePresentFlag(idx), vps->getMaxTLayers() - 1 ); |
---|
| 1307 | } |
---|
| 1308 | #endif |
---|
| 1309 | |
---|
[815] | 1310 | #if Q0078_ADD_LAYER_SETS |
---|
| 1311 | if (vps->getNumIndependentLayers() > 1) |
---|
| 1312 | { |
---|
| 1313 | READ_UVLC(uiCode, "num_add_layer_sets"); vps->setNumAddLayerSets(uiCode); |
---|
| 1314 | for (i = 0; i < vps->getNumAddLayerSets(); i++) |
---|
| 1315 | { |
---|
| 1316 | for (j = 1; j < vps->getNumIndependentLayers(); j++) |
---|
| 1317 | { |
---|
| 1318 | int len = 1; |
---|
| 1319 | while ((1 << len) < (vps->getNumLayersInTreePartition(j) + 1)) |
---|
| 1320 | { |
---|
| 1321 | len++; |
---|
| 1322 | } |
---|
| 1323 | READ_CODE(len, uiCode, "highest_layer_idx_plus1[i][j]"); vps->setHighestLayerIdxPlus1(i, j, uiCode); |
---|
| 1324 | } |
---|
| 1325 | } |
---|
| 1326 | vps->setNumLayerSets(vps->getNumLayerSets() + vps->getNumAddLayerSets()); |
---|
| 1327 | vps->setLayerIdIncludedFlagsForAddLayerSets(); |
---|
| 1328 | } |
---|
| 1329 | #endif |
---|
| 1330 | |
---|
[588] | 1331 | #if !VPS_EXTN_UEV_CODING |
---|
[313] | 1332 | READ_FLAG( uiCode, "more_output_layer_sets_than_default_flag" ); vps->setMoreOutputLayerSetsThanDefaultFlag( uiCode ? true : false ); |
---|
| 1333 | Int numOutputLayerSets = 0; |
---|
| 1334 | if(! vps->getMoreOutputLayerSetsThanDefaultFlag() ) |
---|
| 1335 | { |
---|
| 1336 | numOutputLayerSets = vps->getNumLayerSets(); |
---|
| 1337 | } |
---|
| 1338 | else |
---|
| 1339 | { |
---|
| 1340 | READ_CODE( 10, uiCode, "num_add_output_layer_sets" ); vps->setNumAddOutputLayerSets( uiCode ); |
---|
| 1341 | numOutputLayerSets = vps->getNumLayerSets() + vps->getNumAddOutputLayerSets(); |
---|
| 1342 | } |
---|
[588] | 1343 | #else |
---|
[713] | 1344 | |
---|
| 1345 | #if Q0165_NUM_ADD_OUTPUT_LAYER_SETS |
---|
| 1346 | if( vps->getNumLayerSets() > 1 ) |
---|
| 1347 | { |
---|
[815] | 1348 | READ_UVLC( uiCode, "num_add_olss" ); vps->setNumAddOutputLayerSets( uiCode ); |
---|
| 1349 | READ_CODE( 2, uiCode, "default_output_layer_idc" ); vps->setDefaultTargetOutputLayerIdc( uiCode ); |
---|
[713] | 1350 | } |
---|
| 1351 | else |
---|
| 1352 | { |
---|
| 1353 | vps->setNumAddOutputLayerSets( 0 ); |
---|
| 1354 | } |
---|
| 1355 | #else |
---|
[588] | 1356 | READ_UVLC( uiCode, "num_add_output_layer_sets" ); vps->setNumAddOutputLayerSets( uiCode ); |
---|
[713] | 1357 | #endif |
---|
| 1358 | |
---|
[815] | 1359 | // The value of num_add_olss shall be in the range of 0 to 1023, inclusive. |
---|
[713] | 1360 | assert( vps->getNumAddOutputLayerSets() >= 0 && vps->getNumAddOutputLayerSets() < 1024 ); |
---|
| 1361 | |
---|
[588] | 1362 | Int numOutputLayerSets = vps->getNumLayerSets() + vps->getNumAddOutputLayerSets(); |
---|
| 1363 | #endif |
---|
| 1364 | |
---|
| 1365 | #if P0295_DEFAULT_OUT_LAYER_IDC |
---|
[713] | 1366 | #if !Q0165_NUM_ADD_OUTPUT_LAYER_SETS |
---|
[313] | 1367 | if( numOutputLayerSets > 1 ) |
---|
| 1368 | { |
---|
[588] | 1369 | READ_CODE( 2, uiCode, "default_target_output_layer_idc" ); vps->setDefaultTargetOutputLayerIdc( uiCode ); |
---|
| 1370 | } |
---|
[713] | 1371 | #endif |
---|
[588] | 1372 | vps->setNumOutputLayerSets( numOutputLayerSets ); |
---|
| 1373 | |
---|
| 1374 | for(i = 1; i < numOutputLayerSets; i++) |
---|
| 1375 | { |
---|
| 1376 | if( i > (vps->getNumLayerSets() - 1) ) |
---|
| 1377 | { |
---|
| 1378 | Int numBits = 1; |
---|
| 1379 | while ((1 << numBits) < (vps->getNumLayerSets() - 1)) |
---|
| 1380 | { |
---|
| 1381 | numBits++; |
---|
| 1382 | } |
---|
[815] | 1383 | READ_CODE( numBits, uiCode, "layer_set_idx_for_ols_minus1"); vps->setOutputLayerSetIdx( i, uiCode + 1); |
---|
[588] | 1384 | } |
---|
| 1385 | else |
---|
| 1386 | { |
---|
| 1387 | vps->setOutputLayerSetIdx( i, i ); |
---|
| 1388 | } |
---|
[815] | 1389 | #if Q0078_ADD_LAYER_SETS |
---|
| 1390 | if ( i > vps->getVpsNumLayerSetsMinus1() || vps->getDefaultTargetOutputLayerIdc() >= 2 ) |
---|
| 1391 | #else |
---|
[588] | 1392 | if ( i > (vps->getNumLayerSets() - 1) || vps->getDefaultTargetOutputLayerIdc() >= 2 ) |
---|
[815] | 1393 | #endif |
---|
[588] | 1394 | { |
---|
| 1395 | Int lsIdx = vps->getOutputLayerSetIdx(i); |
---|
[644] | 1396 | #if NUM_OL_FLAGS |
---|
[649] | 1397 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) |
---|
[644] | 1398 | #else |
---|
[588] | 1399 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++) |
---|
[644] | 1400 | #endif |
---|
[588] | 1401 | { |
---|
| 1402 | READ_FLAG( uiCode, "output_layer_flag[i][j]"); vps->setOutputLayerFlag(i, j, uiCode); |
---|
| 1403 | } |
---|
| 1404 | } |
---|
| 1405 | else |
---|
| 1406 | { |
---|
| 1407 | // i <= (vps->getNumLayerSets() - 1) |
---|
| 1408 | // Assign OutputLayerFlag depending on default_one_target_output_layer_flag |
---|
| 1409 | Int lsIdx = i; |
---|
| 1410 | if( vps->getDefaultTargetOutputLayerIdc() == 1 ) |
---|
| 1411 | { |
---|
| 1412 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) |
---|
| 1413 | { |
---|
| 1414 | vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1)) && (vps->getDimensionId(j,1) == 0) ); |
---|
| 1415 | } |
---|
| 1416 | } |
---|
| 1417 | else if ( vps->getDefaultTargetOutputLayerIdc() == 0 ) |
---|
| 1418 | { |
---|
| 1419 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) |
---|
| 1420 | { |
---|
| 1421 | vps->setOutputLayerFlag(i, j, 1); |
---|
| 1422 | } |
---|
| 1423 | } |
---|
| 1424 | } |
---|
| 1425 | Int numBits = 1; |
---|
| 1426 | while ((1 << numBits) < (vps->getNumProfileTierLevel())) |
---|
| 1427 | { |
---|
| 1428 | numBits++; |
---|
| 1429 | } |
---|
| 1430 | READ_CODE( numBits, uiCode, "profile_level_tier_idx[i]" ); vps->setProfileLevelTierIdx(i, uiCode); |
---|
[644] | 1431 | #if P0300_ALT_OUTPUT_LAYER_FLAG |
---|
| 1432 | NumOutputLayersInOutputLayerSet[i] = 0; |
---|
| 1433 | Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx(i); |
---|
| 1434 | for (j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++) |
---|
| 1435 | { |
---|
| 1436 | NumOutputLayersInOutputLayerSet[i] += vps->getOutputLayerFlag(i, j); |
---|
| 1437 | if (vps->getOutputLayerFlag(i, j)) |
---|
| 1438 | { |
---|
| 1439 | OlsHighestOutputLayerId[i] = vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j); |
---|
| 1440 | } |
---|
| 1441 | } |
---|
| 1442 | if (NumOutputLayersInOutputLayerSet[i] == 1 && vps->getNumDirectRefLayers(OlsHighestOutputLayerId[i]) > 0) |
---|
| 1443 | { |
---|
| 1444 | READ_FLAG(uiCode, "alt_output_layer_flag[i]"); |
---|
| 1445 | vps->setAltOuputLayerFlag(i, uiCode ? true : false); |
---|
| 1446 | } |
---|
[713] | 1447 | #if Q0165_OUTPUT_LAYER_SET |
---|
| 1448 | assert( NumOutputLayersInOutputLayerSet[i]>0 ); |
---|
[644] | 1449 | #endif |
---|
[713] | 1450 | |
---|
| 1451 | #endif |
---|
[588] | 1452 | } |
---|
| 1453 | #else |
---|
| 1454 | if( numOutputLayerSets > 1 ) |
---|
| 1455 | { |
---|
[547] | 1456 | #if O0109_DEFAULT_ONE_OUT_LAYER_IDC |
---|
| 1457 | READ_CODE( 2, uiCode, "default_one_target_output_layer_idc" ); vps->setDefaultOneTargetOutputLayerIdc( uiCode ); |
---|
| 1458 | #else |
---|
[313] | 1459 | READ_FLAG( uiCode, "default_one_target_output_layer_flag" ); vps->setDefaultOneTargetOutputLayerFlag( uiCode ? true : false ); |
---|
[547] | 1460 | #endif |
---|
[313] | 1461 | } |
---|
| 1462 | vps->setNumOutputLayerSets( numOutputLayerSets ); |
---|
| 1463 | |
---|
| 1464 | for(i = 1; i < numOutputLayerSets; i++) |
---|
| 1465 | { |
---|
| 1466 | if( i > (vps->getNumLayerSets() - 1) ) |
---|
| 1467 | { |
---|
| 1468 | Int numBits = 1; |
---|
| 1469 | while ((1 << numBits) < (vps->getNumLayerSets() - 1)) |
---|
| 1470 | { |
---|
| 1471 | numBits++; |
---|
| 1472 | } |
---|
| 1473 | READ_CODE( numBits, uiCode, "output_layer_set_idx_minus1"); vps->setOutputLayerSetIdx( i, uiCode + 1); |
---|
| 1474 | Int lsIdx = vps->getOutputLayerSetIdx(i); |
---|
[644] | 1475 | #if NUM_OL_FLAGS |
---|
| 1476 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx) ; j++) |
---|
| 1477 | #else |
---|
[313] | 1478 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++) |
---|
[644] | 1479 | #endif |
---|
[313] | 1480 | { |
---|
| 1481 | READ_FLAG( uiCode, "output_layer_flag[i][j]"); vps->setOutputLayerFlag(i, j, uiCode); |
---|
| 1482 | } |
---|
| 1483 | } |
---|
| 1484 | else |
---|
| 1485 | { |
---|
[540] | 1486 | #if VPS_DPB_SIZE_TABLE |
---|
| 1487 | vps->setOutputLayerSetIdx( i, i ); |
---|
| 1488 | #endif |
---|
[313] | 1489 | // i <= (vps->getNumLayerSets() - 1) |
---|
| 1490 | // Assign OutputLayerFlag depending on default_one_target_output_layer_flag |
---|
| 1491 | Int lsIdx = i; |
---|
[547] | 1492 | #if O0109_DEFAULT_ONE_OUT_LAYER_IDC |
---|
| 1493 | if( vps->getDefaultOneTargetOutputLayerIdc() == 1 ) |
---|
| 1494 | { |
---|
| 1495 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) |
---|
| 1496 | { |
---|
| 1497 | #if O0135_DEFAULT_ONE_OUT_SEMANTIC |
---|
| 1498 | vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1)) && (vps->getDimensionId(j,1)==0) ); |
---|
| 1499 | #else |
---|
| 1500 | vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1))); |
---|
| 1501 | #endif |
---|
| 1502 | } |
---|
| 1503 | } |
---|
| 1504 | else if ( vps->getDefaultOneTargetOutputLayerIdc() == 0 ) |
---|
| 1505 | { |
---|
| 1506 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) |
---|
| 1507 | { |
---|
| 1508 | vps->setOutputLayerFlag(i, j, 1); |
---|
| 1509 | } |
---|
| 1510 | } |
---|
| 1511 | else |
---|
| 1512 | { |
---|
| 1513 | // Other values of default_one_target_output_layer_idc than 0 and 1 are reserved for future use. |
---|
| 1514 | } |
---|
| 1515 | #else |
---|
[313] | 1516 | if( vps->getDefaultOneTargetOutputLayerFlag() ) |
---|
| 1517 | { |
---|
| 1518 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) |
---|
| 1519 | { |
---|
| 1520 | vps->setOutputLayerFlag(i, j, (j == (vps->getNumLayersInIdList(lsIdx)-1))); |
---|
| 1521 | } |
---|
| 1522 | } |
---|
| 1523 | else |
---|
| 1524 | { |
---|
| 1525 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx); j++) |
---|
| 1526 | { |
---|
| 1527 | vps->setOutputLayerFlag(i, j, 1); |
---|
| 1528 | } |
---|
| 1529 | } |
---|
[547] | 1530 | #endif |
---|
[313] | 1531 | } |
---|
| 1532 | Int numBits = 1; |
---|
| 1533 | while ((1 << numBits) < (vps->getNumProfileTierLevel())) |
---|
| 1534 | { |
---|
| 1535 | numBits++; |
---|
| 1536 | } |
---|
| 1537 | READ_CODE( numBits, uiCode, "profile_level_tier_idx[i]" ); vps->setProfileLevelTierIdx(i, uiCode); |
---|
| 1538 | } |
---|
[588] | 1539 | #endif |
---|
[494] | 1540 | |
---|
[644] | 1541 | #if !P0300_ALT_OUTPUT_LAYER_FLAG |
---|
[540] | 1542 | #if O0153_ALT_OUTPUT_LAYER_FLAG |
---|
| 1543 | if( vps->getMaxLayers() > 1 ) |
---|
| 1544 | { |
---|
| 1545 | READ_FLAG( uiCode, "alt_output_layer_flag"); |
---|
| 1546 | vps->setAltOuputLayerFlag( uiCode ? true : false ); |
---|
| 1547 | } |
---|
| 1548 | #endif |
---|
[644] | 1549 | #endif |
---|
[540] | 1550 | |
---|
[442] | 1551 | #if REPN_FORMAT_IN_VPS |
---|
[713] | 1552 | #if Q0195_REP_FORMAT_CLEANUP |
---|
| 1553 | READ_UVLC( uiCode, "vps_num_rep_formats_minus1" ); |
---|
| 1554 | vps->setVpsNumRepFormats( uiCode + 1 ); |
---|
| 1555 | |
---|
| 1556 | // The value of vps_num_rep_formats_minus1 shall be in the range of 0 to 255, inclusive. |
---|
| 1557 | assert( vps->getVpsNumRepFormats() > 0 && vps->getVpsNumRepFormats() <= 256 ); |
---|
| 1558 | |
---|
| 1559 | for(i = 0; i < vps->getVpsNumRepFormats(); i++) |
---|
| 1560 | { |
---|
| 1561 | // Read rep_format_structures |
---|
| 1562 | parseRepFormat( vps->getVpsRepFormat(i), i > 0 ? vps->getVpsRepFormat(i-1) : 0 ); |
---|
| 1563 | } |
---|
| 1564 | |
---|
| 1565 | // Default assignment for layer 0 |
---|
| 1566 | vps->setVpsRepFormatIdx( 0, 0 ); |
---|
| 1567 | |
---|
| 1568 | if( vps->getVpsNumRepFormats() > 1 ) |
---|
| 1569 | { |
---|
| 1570 | READ_FLAG( uiCode, "rep_format_idx_present_flag"); |
---|
| 1571 | vps->setRepFormatIdxPresentFlag( uiCode ? true : false ); |
---|
| 1572 | } |
---|
| 1573 | else |
---|
| 1574 | { |
---|
| 1575 | // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0 |
---|
| 1576 | vps->setRepFormatIdxPresentFlag( false ); |
---|
| 1577 | } |
---|
| 1578 | |
---|
| 1579 | if( vps->getRepFormatIdxPresentFlag() ) |
---|
| 1580 | { |
---|
| 1581 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 1582 | { |
---|
| 1583 | Int numBits = 1; |
---|
| 1584 | while ((1 << numBits) < (vps->getVpsNumRepFormats())) |
---|
| 1585 | { |
---|
| 1586 | numBits++; |
---|
| 1587 | } |
---|
| 1588 | READ_CODE( numBits, uiCode, "vps_rep_format_idx[i]" ); |
---|
| 1589 | vps->setVpsRepFormatIdx( i, uiCode ); |
---|
| 1590 | } |
---|
| 1591 | } |
---|
| 1592 | else |
---|
| 1593 | { |
---|
| 1594 | // When not present, the value of vps_rep_format_idx[ i ] is inferred to be equal to Min (i, vps_num_rep_formats_minus1) |
---|
| 1595 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 1596 | { |
---|
| 1597 | vps->setVpsRepFormatIdx( i, min( (Int)i, vps->getVpsNumRepFormats()-1 ) ); |
---|
| 1598 | } |
---|
| 1599 | } |
---|
| 1600 | #else |
---|
[494] | 1601 | READ_FLAG( uiCode, "rep_format_idx_present_flag"); |
---|
[442] | 1602 | vps->setRepFormatIdxPresentFlag( uiCode ? true : false ); |
---|
| 1603 | |
---|
| 1604 | if( vps->getRepFormatIdxPresentFlag() ) |
---|
| 1605 | { |
---|
[540] | 1606 | #if O0096_REP_FORMAT_INDEX |
---|
[588] | 1607 | #if !VPS_EXTN_UEV_CODING |
---|
[540] | 1608 | READ_CODE( 8, uiCode, "vps_num_rep_formats_minus1" ); |
---|
| 1609 | #else |
---|
[588] | 1610 | READ_UVLC( uiCode, "vps_num_rep_formats_minus1" ); |
---|
| 1611 | #endif |
---|
| 1612 | #else |
---|
[442] | 1613 | READ_CODE( 4, uiCode, "vps_num_rep_formats_minus1" ); |
---|
[540] | 1614 | #endif |
---|
[442] | 1615 | vps->setVpsNumRepFormats( uiCode + 1 ); |
---|
| 1616 | } |
---|
| 1617 | else |
---|
| 1618 | { |
---|
| 1619 | // default assignment |
---|
| 1620 | assert (vps->getMaxLayers() <= 16); // If max_layers_is more than 15, num_rep_formats has to be signaled |
---|
| 1621 | vps->setVpsNumRepFormats( vps->getMaxLayers() ); |
---|
| 1622 | } |
---|
[713] | 1623 | |
---|
| 1624 | // The value of vps_num_rep_formats_minus1 shall be in the range of 0 to 255, inclusive. |
---|
| 1625 | assert( vps->getVpsNumRepFormats() > 0 && vps->getVpsNumRepFormats() <= 256 ); |
---|
| 1626 | |
---|
[442] | 1627 | for(i = 0; i < vps->getVpsNumRepFormats(); i++) |
---|
| 1628 | { |
---|
| 1629 | // Read rep_format_structures |
---|
[713] | 1630 | parseRepFormat( vps->getVpsRepFormat(i), i > 0 ? vps->getVpsRepFormat(i-1) : 0 ); |
---|
[442] | 1631 | } |
---|
[494] | 1632 | |
---|
[442] | 1633 | // Default assignment for layer 0 |
---|
| 1634 | vps->setVpsRepFormatIdx( 0, 0 ); |
---|
| 1635 | if( vps->getRepFormatIdxPresentFlag() ) |
---|
| 1636 | { |
---|
| 1637 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 1638 | { |
---|
| 1639 | if( vps->getVpsNumRepFormats() > 1 ) |
---|
| 1640 | { |
---|
[540] | 1641 | #if O0096_REP_FORMAT_INDEX |
---|
[588] | 1642 | #if !VPS_EXTN_UEV_CODING |
---|
[540] | 1643 | READ_CODE( 8, uiCode, "vps_rep_format_idx[i]" ); |
---|
| 1644 | #else |
---|
[588] | 1645 | Int numBits = 1; |
---|
| 1646 | while ((1 << numBits) < (vps->getVpsNumRepFormats())) |
---|
| 1647 | { |
---|
| 1648 | numBits++; |
---|
| 1649 | } |
---|
| 1650 | READ_CODE( numBits, uiCode, "vps_rep_format_idx[i]" ); |
---|
| 1651 | #endif |
---|
| 1652 | #else |
---|
[442] | 1653 | READ_CODE( 4, uiCode, "vps_rep_format_idx[i]" ); |
---|
[540] | 1654 | #endif |
---|
[442] | 1655 | vps->setVpsRepFormatIdx( i, uiCode ); |
---|
| 1656 | } |
---|
| 1657 | else |
---|
| 1658 | { |
---|
| 1659 | // default assignment - only one rep_format() structure |
---|
| 1660 | vps->setVpsRepFormatIdx( i, 0 ); |
---|
| 1661 | } |
---|
| 1662 | } |
---|
| 1663 | } |
---|
| 1664 | else |
---|
| 1665 | { |
---|
| 1666 | // default assignment - each layer assigned each rep_format() structure in the order signaled |
---|
| 1667 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 1668 | { |
---|
| 1669 | vps->setVpsRepFormatIdx( i, i ); |
---|
| 1670 | } |
---|
| 1671 | } |
---|
| 1672 | #endif |
---|
[713] | 1673 | #endif |
---|
[588] | 1674 | #if RESOLUTION_BASED_DPB |
---|
| 1675 | vps->assignSubDpbIndices(); |
---|
| 1676 | #endif |
---|
[442] | 1677 | READ_FLAG(uiCode, "max_one_active_ref_layer_flag" ); |
---|
| 1678 | vps->setMaxOneActiveRefLayerFlag(uiCode); |
---|
[494] | 1679 | #if O0062_POC_LSB_NOT_PRESENT_FLAG |
---|
| 1680 | for(i = 1; i< vps->getMaxLayers(); i++) |
---|
[313] | 1681 | { |
---|
[494] | 1682 | if( vps->getNumDirectRefLayers( vps->getLayerIdInNuh(i) ) == 0 ) |
---|
[313] | 1683 | { |
---|
[494] | 1684 | READ_FLAG(uiCode, "poc_lsb_not_present_flag[i]"); |
---|
| 1685 | vps->setPocLsbNotPresentFlag(i, uiCode); |
---|
[313] | 1686 | } |
---|
| 1687 | } |
---|
| 1688 | #endif |
---|
[494] | 1689 | #if O0215_PHASE_ALIGNMENT |
---|
| 1690 | READ_FLAG( uiCode, "cross_layer_phase_alignment_flag"); vps->setPhaseAlignFlag( uiCode == 1 ? true : false ); |
---|
[313] | 1691 | #endif |
---|
[494] | 1692 | |
---|
[815] | 1693 | #if !IRAP_ALIGN_FLAG_IN_VPS_VUI |
---|
[494] | 1694 | READ_FLAG(uiCode, "cross_layer_irap_aligned_flag" ); |
---|
| 1695 | vps->setCrossLayerIrapAlignFlag(uiCode); |
---|
| 1696 | #endif |
---|
| 1697 | |
---|
[540] | 1698 | #if VPS_DPB_SIZE_TABLE |
---|
[588] | 1699 | parseVpsDpbSizeTable(vps); |
---|
[540] | 1700 | #endif |
---|
[588] | 1701 | |
---|
| 1702 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
[313] | 1703 | READ_UVLC( uiCode, "direct_dep_type_len_minus2"); vps->setDirectDepTypeLen(uiCode+2); |
---|
[540] | 1704 | #if O0096_DEFAULT_DEPENDENCY_TYPE |
---|
| 1705 | READ_FLAG(uiCode, "default_direct_dependency_type_flag"); |
---|
| 1706 | vps->setDefaultDirectDependecyTypeFlag(uiCode == 1? true : false); |
---|
| 1707 | if (vps->getDefaultDirectDependencyTypeFlag()) |
---|
| 1708 | { |
---|
| 1709 | READ_CODE( vps->getDirectDepTypeLen(), uiCode, "default_direct_dependency_type" ); |
---|
| 1710 | vps->setDefaultDirectDependecyType(uiCode); |
---|
| 1711 | } |
---|
| 1712 | #endif |
---|
[313] | 1713 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 1714 | { |
---|
| 1715 | for(j = 0; j < i; j++) |
---|
| 1716 | { |
---|
| 1717 | if (vps->getDirectDependencyFlag(i, j)) |
---|
| 1718 | { |
---|
[540] | 1719 | #if O0096_DEFAULT_DEPENDENCY_TYPE |
---|
| 1720 | if (vps->getDefaultDirectDependencyTypeFlag()) |
---|
| 1721 | { |
---|
| 1722 | vps->setDirectDependencyType(i, j, vps->getDefaultDirectDependencyType()); |
---|
| 1723 | } |
---|
| 1724 | else |
---|
| 1725 | { |
---|
| 1726 | READ_CODE( vps->getDirectDepTypeLen(), uiCode, "direct_dependency_type[i][j]" ); |
---|
| 1727 | vps->setDirectDependencyType(i, j, uiCode); |
---|
| 1728 | } |
---|
| 1729 | #else |
---|
| 1730 | READ_CODE( vps->getDirectDepTypeLen(), uiCode, "direct_dependency_type[i][j]" ); |
---|
| 1731 | vps->setDirectDependencyType(i, j, uiCode); |
---|
| 1732 | #endif |
---|
[313] | 1733 | } |
---|
| 1734 | } |
---|
| 1735 | } |
---|
| 1736 | #endif |
---|
[815] | 1737 | #if !Q0078_ADD_LAYER_SETS |
---|
| 1738 | #if O0092_0094_DEPENDENCY_CONSTRAINT // Moved up |
---|
| 1739 | vps->setNumRefLayers(); |
---|
| 1740 | |
---|
[540] | 1741 | if(vps->getMaxLayers() > MAX_REF_LAYERS) |
---|
| 1742 | { |
---|
| 1743 | for(i = 1;i < vps->getMaxLayers(); i++) |
---|
[442] | 1744 | { |
---|
[540] | 1745 | assert( vps->getNumRefLayers(vps->getLayerIdInNuh(i)) <= MAX_REF_LAYERS); |
---|
[442] | 1746 | } |
---|
[540] | 1747 | } |
---|
[442] | 1748 | #endif |
---|
[815] | 1749 | #endif |
---|
[442] | 1750 | |
---|
[588] | 1751 | #if P0307_VPS_NON_VUI_EXTENSION |
---|
| 1752 | READ_UVLC( uiCode, "vps_non_vui_extension_length"); vps->setVpsNonVuiExtLength((Int)uiCode); |
---|
[713] | 1753 | |
---|
| 1754 | // The value of vps_non_vui_extension_length shall be in the range of 0 to 4096, inclusive. |
---|
| 1755 | assert( vps->getVpsNonVuiExtLength() >= 0 && vps->getVpsNonVuiExtLength() <= 4096 ); |
---|
| 1756 | |
---|
[644] | 1757 | #if P0307_VPS_NON_VUI_EXT_UPDATE |
---|
| 1758 | Int nonVuiExtByte = uiCode; |
---|
| 1759 | for (i = 1; i <= nonVuiExtByte; i++) |
---|
| 1760 | { |
---|
| 1761 | READ_CODE( 8, uiCode, "vps_non_vui_extension_data_byte" ); //just parse and discard for now. |
---|
| 1762 | } |
---|
| 1763 | #else |
---|
[588] | 1764 | if ( vps->getVpsNonVuiExtLength() > 0 ) |
---|
| 1765 | { |
---|
| 1766 | printf("\n\nUp to the current spec, the value of vps_non_vui_extension_length is supposed to be 0\n"); |
---|
| 1767 | } |
---|
| 1768 | #endif |
---|
[644] | 1769 | #endif |
---|
[588] | 1770 | |
---|
[547] | 1771 | #if !O0109_O0199_FLAGS_TO_VUI |
---|
[313] | 1772 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
| 1773 | READ_FLAG(uiCode, "single_layer_for_non_irap_flag" ); vps->setSingleLayerForNonIrapFlag(uiCode == 1 ? true : false); |
---|
| 1774 | #endif |
---|
[540] | 1775 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
| 1776 | READ_FLAG(uiCode, "higher_layer_irap_skip_flag" ); vps->setHigherLayerIrapSkipFlag(uiCode == 1 ? true : false); |
---|
| 1777 | #endif |
---|
[547] | 1778 | #endif |
---|
[442] | 1779 | |
---|
[588] | 1780 | #if P0307_REMOVE_VPS_VUI_OFFSET |
---|
| 1781 | READ_FLAG( uiCode, "vps_vui_present_flag"); vps->setVpsVuiPresentFlag(uiCode ? true : false); |
---|
| 1782 | #endif |
---|
| 1783 | |
---|
[547] | 1784 | #if O0109_MOVE_VPS_VUI_FLAG |
---|
| 1785 | if ( vps->getVpsVuiPresentFlag() ) |
---|
| 1786 | #else |
---|
[442] | 1787 | READ_FLAG( uiCode, "vps_vui_present_flag" ); |
---|
| 1788 | if (uiCode) |
---|
[547] | 1789 | #endif |
---|
[442] | 1790 | { |
---|
| 1791 | while ( m_pcBitstream->getNumBitsRead() % 8 != 0 ) |
---|
| 1792 | { |
---|
| 1793 | READ_FLAG( uiCode, "vps_vui_alignment_bit_equal_to_one"); assert(uiCode == 1); |
---|
| 1794 | } |
---|
| 1795 | parseVPSVUI(vps); |
---|
| 1796 | } |
---|
[713] | 1797 | else |
---|
| 1798 | { |
---|
| 1799 | // set default values for VPS VUI |
---|
| 1800 | defaultVPSVUI( vps ); |
---|
| 1801 | } |
---|
[313] | 1802 | } |
---|
[713] | 1803 | |
---|
| 1804 | Void TDecCavlc::defaultVPSExtension( TComVPS* vps ) |
---|
| 1805 | { |
---|
| 1806 | // set default parameters when they are not present |
---|
| 1807 | Int i, j; |
---|
| 1808 | |
---|
| 1809 | // When layer_id_in_nuh[ i ] is not present, the value is inferred to be equal to i. |
---|
| 1810 | for(i = 0; i < vps->getMaxLayers(); i++) |
---|
| 1811 | { |
---|
| 1812 | vps->setLayerIdInNuh(i, i); |
---|
| 1813 | vps->setLayerIdInVps(vps->getLayerIdInNuh(i), i); |
---|
| 1814 | } |
---|
| 1815 | |
---|
| 1816 | // When not present, sub_layers_vps_max_minus1[ i ] is inferred to be equal to vps_max_sub_layers_minus1. |
---|
| 1817 | for( i = 0; i < vps->getMaxLayers(); i++) |
---|
| 1818 | { |
---|
| 1819 | vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1); |
---|
| 1820 | } |
---|
| 1821 | |
---|
| 1822 | // When not present, max_tid_il_ref_pics_plus1[ i ][ j ] is inferred to be equal to 7. |
---|
| 1823 | for( i = 0; i < vps->getMaxLayers() - 1; i++ ) |
---|
| 1824 | { |
---|
| 1825 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
| 1826 | for( j = i + 1; j < vps->getMaxLayers(); j++ ) |
---|
| 1827 | { |
---|
| 1828 | vps->setMaxTidIlRefPicsPlus1(i, j, 7); |
---|
| 1829 | } |
---|
| 1830 | #else |
---|
| 1831 | vps->setMaxTidIlRefPicsPlus1(i, 7); |
---|
[313] | 1832 | #endif |
---|
[713] | 1833 | } |
---|
[825] | 1834 | |
---|
[815] | 1835 | // When not present, the value of num_add_olss is inferred to be equal to 0. |
---|
| 1836 | // NumOutputLayerSets = num_add_olss + NumLayerSets |
---|
[713] | 1837 | vps->setNumOutputLayerSets( vps->getNumLayerSets() ); |
---|
| 1838 | |
---|
| 1839 | // For i in the range of 0 to NumOutputLayerSets-1, inclusive, the variable LayerSetIdxForOutputLayerSet[ i ] is derived as specified in the following: |
---|
[815] | 1840 | // LayerSetIdxForOutputLayerSet[ i ] = ( i <= vps_number_layer_sets_minus1 ) ? i : layer_set_idx_for_ols_minus1[ i ] + 1 |
---|
[713] | 1841 | for( i = 1; i < vps->getNumOutputLayerSets(); i++ ) |
---|
| 1842 | { |
---|
| 1843 | vps->setOutputLayerSetIdx( i, i ); |
---|
| 1844 | Int lsIdx = vps->getOutputLayerSetIdx(i); |
---|
| 1845 | |
---|
| 1846 | for( j = 0; j < vps->getNumLayersInIdList(lsIdx); j++ ) |
---|
| 1847 | { |
---|
[825] | 1848 | vps->setOutputLayerFlag(i, j, 1); |
---|
[713] | 1849 | } |
---|
| 1850 | } |
---|
| 1851 | |
---|
| 1852 | // The value of sub_layer_dpb_info_present_flag[ i ][ 0 ] for any possible value of i is inferred to be equal to 1 |
---|
| 1853 | // 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. |
---|
| 1854 | for( i = 1; i < vps->getNumOutputLayerSets(); i++ ) |
---|
| 1855 | { |
---|
| 1856 | vps->setSubLayerDpbInfoPresentFlag( i, 0, true ); |
---|
| 1857 | } |
---|
[825] | 1858 | |
---|
[713] | 1859 | // When not present, the value of vps_num_rep_formats_minus1 is inferred to be equal to MaxLayersMinus1. |
---|
| 1860 | vps->setVpsNumRepFormats( vps->getMaxLayers() ); |
---|
| 1861 | |
---|
| 1862 | // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0 |
---|
| 1863 | vps->setRepFormatIdxPresentFlag( false ); |
---|
| 1864 | |
---|
| 1865 | if( !vps->getRepFormatIdxPresentFlag() ) |
---|
| 1866 | { |
---|
| 1867 | // When not present, the value of vps_rep_format_idx[ i ] is inferred to be equal to Min(i, vps_num_rep_formats_minus1). |
---|
| 1868 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 1869 | { |
---|
| 1870 | vps->setVpsRepFormatIdx( i, min( (Int)i, vps->getVpsNumRepFormats() - 1 ) ); |
---|
| 1871 | } |
---|
| 1872 | } |
---|
| 1873 | |
---|
| 1874 | // vps_poc_lsb_aligned_flag |
---|
| 1875 | // When not present, vps_poc_lsb_aligned_flag is inferred to be equal to 0. |
---|
[825] | 1876 | |
---|
[713] | 1877 | #if O0062_POC_LSB_NOT_PRESENT_FLAG |
---|
| 1878 | // When not present, poc_lsb_not_present_flag[ i ] is inferred to be equal to 0. |
---|
| 1879 | for(i = 1; i< vps->getMaxLayers(); i++) |
---|
| 1880 | { |
---|
| 1881 | vps->setPocLsbNotPresentFlag(i, 0); |
---|
| 1882 | } |
---|
| 1883 | #endif |
---|
| 1884 | |
---|
| 1885 | // set default values for VPS VUI |
---|
| 1886 | defaultVPSVUI( vps ); |
---|
| 1887 | } |
---|
| 1888 | |
---|
| 1889 | Void TDecCavlc::defaultVPSVUI( TComVPS* vps ) |
---|
| 1890 | { |
---|
| 1891 | // When not present, the value of all_layers_idr_aligned_flag is inferred to be equal to 0. |
---|
| 1892 | vps->setCrossLayerIrapAlignFlag( false ); |
---|
| 1893 | |
---|
| 1894 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
| 1895 | // When single_layer_for_non_irap_flag is not present, it is inferred to be equal to 0. |
---|
| 1896 | vps->setSingleLayerForNonIrapFlag( false ); |
---|
| 1897 | #endif |
---|
| 1898 | |
---|
| 1899 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
| 1900 | // When higher_layer_irap_skip_flag is not present it is inferred to be equal to 0 |
---|
| 1901 | vps->setHigherLayerIrapSkipFlag( false ); |
---|
| 1902 | #endif |
---|
| 1903 | } |
---|
| 1904 | |
---|
[442] | 1905 | #if REPN_FORMAT_IN_VPS |
---|
[713] | 1906 | Void TDecCavlc::parseRepFormat( RepFormat *repFormat, RepFormat *repFormatPrev ) |
---|
[442] | 1907 | { |
---|
| 1908 | UInt uiCode; |
---|
[713] | 1909 | #if REPN_FORMAT_CONTROL_FLAG |
---|
| 1910 | READ_CODE( 16, uiCode, "pic_width_vps_in_luma_samples" ); repFormat->setPicWidthVpsInLumaSamples ( uiCode ); |
---|
| 1911 | READ_CODE( 16, uiCode, "pic_height_vps_in_luma_samples" ); repFormat->setPicHeightVpsInLumaSamples( uiCode ); |
---|
| 1912 | READ_FLAG( uiCode, "chroma_and_bit_depth_vps_present_flag" ); repFormat->setChromaAndBitDepthVpsPresentFlag( uiCode ? true : false ); |
---|
[540] | 1913 | |
---|
[713] | 1914 | if( !repFormatPrev ) |
---|
| 1915 | { |
---|
| 1916 | // 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 |
---|
| 1917 | assert( repFormat->getChromaAndBitDepthVpsPresentFlag() ); |
---|
| 1918 | } |
---|
| 1919 | |
---|
[540] | 1920 | if( repFormat->getChromaAndBitDepthVpsPresentFlag() ) |
---|
| 1921 | { |
---|
[713] | 1922 | READ_CODE( 2, uiCode, "chroma_format_vps_idc" ); |
---|
[494] | 1923 | #if AUXILIARY_PICTURES |
---|
[713] | 1924 | repFormat->setChromaFormatVpsIdc( ChromaFormat(uiCode) ); |
---|
[540] | 1925 | #else |
---|
[713] | 1926 | repFormat->setChromaFormatVpsIdc( uiCode ); |
---|
[540] | 1927 | #endif |
---|
| 1928 | |
---|
| 1929 | if( repFormat->getChromaFormatVpsIdc() == 3 ) |
---|
| 1930 | { |
---|
[713] | 1931 | READ_FLAG( uiCode, "separate_colour_plane_vps_flag" ); repFormat->setSeparateColourPlaneVpsFlag( uiCode ? true : false ); |
---|
[540] | 1932 | } |
---|
| 1933 | |
---|
[713] | 1934 | READ_CODE( 4, uiCode, "bit_depth_vps_luma_minus8" ); repFormat->setBitDepthVpsLuma ( uiCode + 8 ); |
---|
| 1935 | READ_CODE( 4, uiCode, "bit_depth_vps_chroma_minus8" ); repFormat->setBitDepthVpsChroma( uiCode + 8 ); |
---|
| 1936 | } |
---|
| 1937 | else if( repFormatPrev ) |
---|
| 1938 | { |
---|
| 1939 | // 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 |
---|
| 1940 | // bit_depth_vps_chroma_minus8 are not present and inferred from the previous rep_format( ) syntax structure in the VPS. |
---|
[540] | 1941 | |
---|
[713] | 1942 | repFormat->setChromaFormatVpsIdc ( repFormatPrev->getChromaFormatVpsIdc() ); |
---|
| 1943 | repFormat->setSeparateColourPlaneVpsFlag( repFormatPrev->getSeparateColourPlaneVpsFlag() ); |
---|
| 1944 | repFormat->setBitDepthVpsLuma ( repFormatPrev->getBitDepthVpsLuma() ); |
---|
| 1945 | repFormat->setBitDepthVpsChroma ( repFormatPrev->getBitDepthVpsChroma() ); |
---|
[540] | 1946 | } |
---|
| 1947 | #else |
---|
| 1948 | #if AUXILIARY_PICTURES |
---|
[494] | 1949 | READ_CODE( 2, uiCode, "chroma_format_idc" ); repFormat->setChromaFormatVpsIdc( ChromaFormat(uiCode) ); |
---|
| 1950 | #else |
---|
[442] | 1951 | READ_CODE( 2, uiCode, "chroma_format_idc" ); repFormat->setChromaFormatVpsIdc( uiCode ); |
---|
[494] | 1952 | #endif |
---|
[825] | 1953 | |
---|
[442] | 1954 | if( repFormat->getChromaFormatVpsIdc() == 3 ) |
---|
| 1955 | { |
---|
| 1956 | READ_FLAG( uiCode, "separate_colour_plane_flag"); repFormat->setSeparateColourPlaneVpsFlag(uiCode ? true : false); |
---|
| 1957 | } |
---|
[313] | 1958 | |
---|
[442] | 1959 | READ_CODE ( 16, uiCode, "pic_width_in_luma_samples" ); repFormat->setPicWidthVpsInLumaSamples ( uiCode ); |
---|
| 1960 | READ_CODE ( 16, uiCode, "pic_height_in_luma_samples" ); repFormat->setPicHeightVpsInLumaSamples( uiCode ); |
---|
[494] | 1961 | |
---|
[442] | 1962 | READ_CODE( 4, uiCode, "bit_depth_luma_minus8" ); repFormat->setBitDepthVpsLuma ( uiCode + 8 ); |
---|
| 1963 | READ_CODE( 4, uiCode, "bit_depth_chroma_minus8" ); repFormat->setBitDepthVpsChroma( uiCode + 8 ); |
---|
[540] | 1964 | #endif |
---|
[442] | 1965 | } |
---|
| 1966 | #endif |
---|
[588] | 1967 | #if VPS_DPB_SIZE_TABLE |
---|
| 1968 | Void TDecCavlc::parseVpsDpbSizeTable( TComVPS *vps ) |
---|
| 1969 | { |
---|
| 1970 | UInt uiCode; |
---|
[644] | 1971 | #if DPB_PARAMS_MAXTLAYERS |
---|
[815] | 1972 | #if BITRATE_PICRATE_SIGNALLING |
---|
[825] | 1973 | Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumLayerSets()]; |
---|
| 1974 | for(Int i = 0; i < vps->getNumLayerSets(); i++) |
---|
[815] | 1975 | #else |
---|
[825] | 1976 | Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumOutputLayerSets()]; |
---|
| 1977 | for(Int i = 1; i < vps->getNumOutputLayerSets(); i++) |
---|
[815] | 1978 | #endif |
---|
[825] | 1979 | { |
---|
| 1980 | UInt maxSLMinus1 = 0; |
---|
[644] | 1981 | #if CHANGE_NUMSUBDPB_IDX |
---|
[825] | 1982 | Int optLsIdx = vps->getOutputLayerSetIdx( i ); |
---|
[644] | 1983 | #else |
---|
[825] | 1984 | Int optLsIdx = i; |
---|
[644] | 1985 | #endif |
---|
[815] | 1986 | #if BITRATE_PICRATE_SIGNALLING |
---|
[825] | 1987 | optLsIdx = i; |
---|
[815] | 1988 | #endif |
---|
[825] | 1989 | for(Int k = 0; k < vps->getNumLayersInIdList(optLsIdx); k++ ) { |
---|
| 1990 | Int lId = vps->getLayerSetLayerIdList(optLsIdx, k); |
---|
| 1991 | maxSLMinus1 = max(maxSLMinus1, vps->getMaxTSLayersMinus1(vps->getLayerIdInVps(lId))); |
---|
| 1992 | } |
---|
| 1993 | MaxSubLayersInLayerSetMinus1[ i ] = maxSLMinus1; |
---|
[815] | 1994 | #if BITRATE_PICRATE_SIGNALLING |
---|
[825] | 1995 | vps->setMaxSLayersInLayerSetMinus1(i,MaxSubLayersInLayerSetMinus1[ i ]); |
---|
[815] | 1996 | #endif |
---|
[825] | 1997 | } |
---|
[644] | 1998 | #endif |
---|
[825] | 1999 | |
---|
[588] | 2000 | #if !RESOLUTION_BASED_DPB |
---|
| 2001 | vps->deriveNumberOfSubDpbs(); |
---|
| 2002 | #endif |
---|
| 2003 | for(Int i = 1; i < vps->getNumOutputLayerSets(); i++) |
---|
| 2004 | { |
---|
| 2005 | #if CHANGE_NUMSUBDPB_IDX |
---|
| 2006 | Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx( i ); |
---|
| 2007 | #endif |
---|
| 2008 | READ_FLAG( uiCode, "sub_layer_flag_info_present_flag[i]"); vps->setSubLayerFlagInfoPresentFlag( i, uiCode ? true : false ); |
---|
[644] | 2009 | #if DPB_PARAMS_MAXTLAYERS |
---|
[815] | 2010 | #if BITRATE_PICRATE_SIGNALLING |
---|
| 2011 | for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ vps->getOutputLayerSetIdx( i ) ]; j++) |
---|
| 2012 | #else |
---|
[713] | 2013 | for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ i ]; j++) |
---|
[815] | 2014 | #endif |
---|
[644] | 2015 | #else |
---|
| 2016 | for(Int j = 0; j <= vps->getMaxTLayers(); j++) |
---|
| 2017 | #endif |
---|
[588] | 2018 | { |
---|
| 2019 | if( j > 0 && vps->getSubLayerFlagInfoPresentFlag(i) ) |
---|
| 2020 | { |
---|
| 2021 | READ_FLAG( uiCode, "sub_layer_dpb_info_present_flag[i]"); vps->setSubLayerDpbInfoPresentFlag( i, j, uiCode ? true : false); |
---|
| 2022 | } |
---|
| 2023 | else |
---|
| 2024 | { |
---|
| 2025 | if( j == 0 ) // Always signal for the first sub-layer |
---|
| 2026 | { |
---|
| 2027 | vps->setSubLayerDpbInfoPresentFlag( i, j, true ); |
---|
| 2028 | } |
---|
| 2029 | else // if (j != 0) && !vps->getSubLayerFlagInfoPresentFlag(i) |
---|
| 2030 | { |
---|
| 2031 | vps->setSubLayerDpbInfoPresentFlag( i, j, false ); |
---|
| 2032 | } |
---|
| 2033 | } |
---|
| 2034 | if( vps->getSubLayerDpbInfoPresentFlag(i, j) ) // If sub-layer DPB information is present |
---|
| 2035 | { |
---|
| 2036 | #if CHANGE_NUMSUBDPB_IDX |
---|
| 2037 | for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet); k++) |
---|
| 2038 | #else |
---|
| 2039 | for(Int k = 0; k < vps->getNumSubDpbs(i); k++) |
---|
| 2040 | #endif |
---|
| 2041 | { |
---|
| 2042 | READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1[i][k][j]" ); vps->setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode ); |
---|
| 2043 | } |
---|
| 2044 | READ_UVLC( uiCode, "max_vps_num_reorder_pics[i][j]" ); vps->setMaxVpsNumReorderPics( i, j, uiCode); |
---|
| 2045 | #if RESOLUTION_BASED_DPB |
---|
| 2046 | if( vps->getNumSubDpbs(layerSetIdxForOutputLayerSet) != vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ) ) |
---|
| 2047 | { |
---|
| 2048 | for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++) |
---|
| 2049 | { |
---|
| 2050 | READ_UVLC( uiCode, "max_vps_layer_dec_pic_buff_minus1[i][k][j]" ); vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, uiCode); |
---|
| 2051 | } |
---|
| 2052 | } |
---|
| 2053 | else // vps->getNumSubDpbs(layerSetIdxForOutputLayerSet) == vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ) |
---|
| 2054 | { |
---|
| 2055 | for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++) |
---|
| 2056 | { |
---|
| 2057 | vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, vps->getMaxVpsDecPicBufferingMinus1( i, k, j)); |
---|
| 2058 | } |
---|
| 2059 | } |
---|
| 2060 | #endif |
---|
| 2061 | READ_UVLC( uiCode, "max_vps_latency_increase_plus1[i][j]" ); vps->setMaxVpsLatencyIncreasePlus1( i, j, uiCode); |
---|
| 2062 | } |
---|
| 2063 | } |
---|
[644] | 2064 | for(Int j = vps->getMaxTLayers(); j < MAX_TLAYER; j++) |
---|
| 2065 | { |
---|
| 2066 | vps->setSubLayerDpbInfoPresentFlag( i, j, false ); |
---|
| 2067 | } |
---|
[588] | 2068 | } |
---|
[644] | 2069 | |
---|
[824] | 2070 | #if BITRATE_PICRATE_SIGNALLING |
---|
| 2071 | if( MaxSubLayersInLayerSetMinus1 ) |
---|
| 2072 | { |
---|
| 2073 | delete [] MaxSubLayersInLayerSetMinus1; |
---|
| 2074 | } |
---|
| 2075 | #endif |
---|
| 2076 | |
---|
[644] | 2077 | // Infer values when not signalled |
---|
| 2078 | for(Int i = 1; i < vps->getNumOutputLayerSets(); i++) |
---|
| 2079 | { |
---|
| 2080 | Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx( i ); |
---|
| 2081 | for(Int j = 0; j < MAX_TLAYER; j++) |
---|
| 2082 | { |
---|
| 2083 | if( !vps->getSubLayerDpbInfoPresentFlag(i, j) ) // If sub-layer DPB information is NOT present |
---|
| 2084 | { |
---|
[815] | 2085 | #if RESOLUTION_BASED_DPB |
---|
[644] | 2086 | for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet); k++) |
---|
[815] | 2087 | #else |
---|
| 2088 | for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++) |
---|
| 2089 | #endif |
---|
[644] | 2090 | { |
---|
| 2091 | vps->setMaxVpsDecPicBufferingMinus1( i, k, j, vps->getMaxVpsDecPicBufferingMinus1( i, k, j - 1 ) ); |
---|
| 2092 | } |
---|
| 2093 | vps->setMaxVpsNumReorderPics( i, j, vps->getMaxVpsNumReorderPics( i, j - 1) ); |
---|
[815] | 2094 | #if RESOLUTION_BASED_DPB |
---|
[644] | 2095 | for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++) |
---|
| 2096 | { |
---|
| 2097 | vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j - 1)); |
---|
| 2098 | } |
---|
[815] | 2099 | #endif |
---|
[644] | 2100 | vps->setMaxVpsLatencyIncreasePlus1( i, j, vps->getMaxVpsLatencyIncreasePlus1( i, j - 1 ) ); |
---|
| 2101 | } |
---|
| 2102 | } |
---|
| 2103 | } |
---|
[588] | 2104 | } |
---|
| 2105 | #endif |
---|
[815] | 2106 | |
---|
[442] | 2107 | Void TDecCavlc::parseVPSVUI(TComVPS *vps) |
---|
| 2108 | { |
---|
| 2109 | UInt i,j; |
---|
| 2110 | UInt uiCode; |
---|
[540] | 2111 | #if O0223_PICTURE_TYPES_ALIGN_FLAG |
---|
| 2112 | READ_FLAG(uiCode, "cross_layer_pic_type_aligned_flag" ); |
---|
| 2113 | vps->setCrossLayerPictureTypeAlignFlag(uiCode); |
---|
| 2114 | if (!uiCode) |
---|
| 2115 | { |
---|
| 2116 | #endif |
---|
[494] | 2117 | #if IRAP_ALIGN_FLAG_IN_VPS_VUI |
---|
[540] | 2118 | READ_FLAG(uiCode, "cross_layer_irap_aligned_flag" ); |
---|
| 2119 | vps->setCrossLayerIrapAlignFlag(uiCode); |
---|
[644] | 2120 | #if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG |
---|
[815] | 2121 | if( uiCode ) |
---|
[644] | 2122 | { |
---|
[815] | 2123 | READ_FLAG( uiCode, "all_layers_idr_aligned_flag" ); |
---|
| 2124 | vps->setCrossLayerAlignedIdrOnlyFlag(uiCode); |
---|
[644] | 2125 | } |
---|
[494] | 2126 | #endif |
---|
[644] | 2127 | #endif |
---|
[540] | 2128 | #if O0223_PICTURE_TYPES_ALIGN_FLAG |
---|
| 2129 | } |
---|
| 2130 | else |
---|
| 2131 | { |
---|
| 2132 | vps->setCrossLayerIrapAlignFlag(true); |
---|
| 2133 | } |
---|
| 2134 | #endif |
---|
[815] | 2135 | |
---|
[442] | 2136 | READ_FLAG( uiCode, "bit_rate_present_vps_flag" ); vps->setBitRatePresentVpsFlag( uiCode ? true : false ); |
---|
| 2137 | READ_FLAG( uiCode, "pic_rate_present_vps_flag" ); vps->setPicRatePresentVpsFlag( uiCode ? true : false ); |
---|
| 2138 | |
---|
| 2139 | Bool parseFlag = vps->getBitRatePresentVpsFlag() || vps->getPicRatePresentVpsFlag(); |
---|
[815] | 2140 | |
---|
| 2141 | #if Q0078_ADD_LAYER_SETS |
---|
[837] | 2142 | #if R0227_BR_PR_ADD_LAYER_SET |
---|
| 2143 | for( i = 0; i < vps->getNumLayerSets(); i++ ) |
---|
| 2144 | #else |
---|
[815] | 2145 | for( i = 0; i <= vps->getVpsNumLayerSetsMinus1(); i++ ) |
---|
[837] | 2146 | #endif |
---|
[815] | 2147 | #else |
---|
| 2148 | for( i = 0; i < vps->getNumLayerSets(); i++ ) |
---|
| 2149 | #endif |
---|
[442] | 2150 | { |
---|
[815] | 2151 | #if BITRATE_PICRATE_SIGNALLING |
---|
| 2152 | for( j = 0; j <= vps->getMaxSLayersInLayerSetMinus1(i); j++ ) |
---|
| 2153 | #else |
---|
| 2154 | for( j = 0; j < vps->getMaxTLayers(); j++ ) |
---|
| 2155 | #endif |
---|
[442] | 2156 | { |
---|
[815] | 2157 | if( parseFlag && vps->getBitRatePresentVpsFlag() ) |
---|
[442] | 2158 | { |
---|
[815] | 2159 | READ_FLAG( uiCode, "bit_rate_present_flag[i][j]" ); vps->setBitRatePresentFlag( i, j, uiCode ? true : false ); |
---|
[442] | 2160 | } |
---|
[815] | 2161 | else |
---|
| 2162 | { |
---|
| 2163 | vps->setBitRatePresentFlag( i, j, false ); |
---|
| 2164 | } |
---|
| 2165 | if( parseFlag && vps->getPicRatePresentVpsFlag() ) |
---|
| 2166 | { |
---|
| 2167 | READ_FLAG( uiCode, "pic_rate_present_flag[i][j]" ); vps->setPicRatePresentFlag( i, j, uiCode ? true : false ); |
---|
| 2168 | } |
---|
| 2169 | else |
---|
| 2170 | { |
---|
| 2171 | vps->setPicRatePresentFlag( i, j, false ); |
---|
| 2172 | } |
---|
| 2173 | if( parseFlag && vps->getBitRatePresentFlag(i, j) ) |
---|
| 2174 | { |
---|
| 2175 | READ_CODE( 16, uiCode, "avg_bit_rate[i][j]" ); vps->setAvgBitRate( i, j, uiCode ); |
---|
| 2176 | READ_CODE( 16, uiCode, "max_bit_rate[i][j]" ); vps->setMaxBitRate( i, j, uiCode ); |
---|
| 2177 | } |
---|
| 2178 | else |
---|
| 2179 | { |
---|
| 2180 | vps->setAvgBitRate( i, j, 0 ); |
---|
| 2181 | vps->setMaxBitRate( i, j, 0 ); |
---|
| 2182 | } |
---|
| 2183 | if( parseFlag && vps->getPicRatePresentFlag(i, j) ) |
---|
| 2184 | { |
---|
| 2185 | READ_CODE( 2 , uiCode, "constant_pic_rate_idc[i][j]" ); vps->setConstPicRateIdc( i, j, uiCode ); |
---|
| 2186 | READ_CODE( 16, uiCode, "avg_pic_rate[i][j]" ); vps->setAvgPicRate( i, j, uiCode ); |
---|
| 2187 | } |
---|
| 2188 | else |
---|
| 2189 | { |
---|
| 2190 | vps->setConstPicRateIdc( i, j, 0 ); |
---|
| 2191 | vps->setAvgPicRate ( i, j, 0 ); |
---|
| 2192 | } |
---|
[442] | 2193 | } |
---|
| 2194 | } |
---|
[588] | 2195 | #if VPS_VUI_VIDEO_SIGNAL_MOVE |
---|
| 2196 | READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); vps->setVideoSigPresentVpsFlag( uiCode == 1 ); |
---|
| 2197 | if (vps->getVideoSigPresentVpsFlag()) |
---|
| 2198 | { |
---|
| 2199 | READ_CODE(4, uiCode, "vps_num_video_signal_info_minus1" ); vps->setNumVideoSignalInfo(uiCode + 1); |
---|
| 2200 | } |
---|
| 2201 | else |
---|
| 2202 | { |
---|
[839] | 2203 | #if VPS_VUI_VST_PARAMS |
---|
| 2204 | vps->setNumVideoSignalInfo(vps->getMaxLayers() - vps->getBaseLayerInternalFlag() ? 0 : 1); |
---|
| 2205 | #else |
---|
[588] | 2206 | vps->setNumVideoSignalInfo(vps->getMaxLayers()); |
---|
[839] | 2207 | #endif |
---|
[588] | 2208 | } |
---|
| 2209 | |
---|
| 2210 | for(i = 0; i < vps->getNumVideoSignalInfo(); i++) |
---|
| 2211 | { |
---|
| 2212 | READ_CODE(3, uiCode, "video_vps_format" ); vps->setVideoVPSFormat(i,uiCode); |
---|
| 2213 | READ_FLAG(uiCode, "video_full_range_vps_flag" ); vps->setVideoFullRangeVpsFlag(i,uiCode); |
---|
| 2214 | READ_CODE(8, uiCode, "color_primaries_vps" ); vps->setColorPrimaries(i,uiCode); |
---|
| 2215 | READ_CODE(8, uiCode, "transfer_characteristics_vps" ); vps->setTransCharacter(i,uiCode); |
---|
| 2216 | READ_CODE(8, uiCode, "matrix_coeffs_vps" );vps->setMaxtrixCoeff(i,uiCode); |
---|
| 2217 | } |
---|
[839] | 2218 | #if VPS_VUI_VST_PARAMS |
---|
| 2219 | if( vps->getVideoSigPresentVpsFlag() && vps->getNumVideoSignalInfo() > 1 ) |
---|
| 2220 | { |
---|
| 2221 | for(i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++) |
---|
| 2222 | { |
---|
| 2223 | READ_CODE(4, uiCode, "vps_video_signal_info_idx" ); vps->setVideoSignalInfoIdx(i, uiCode); |
---|
| 2224 | } |
---|
| 2225 | } |
---|
| 2226 | else if ( !vps->getVideoSigPresentVpsFlag() ) |
---|
| 2227 | { |
---|
| 2228 | for(i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++) |
---|
| 2229 | { |
---|
| 2230 | vps->setVideoSignalInfoIdx( i, i ); |
---|
| 2231 | } |
---|
| 2232 | } |
---|
| 2233 | else // ( vps->getNumVideoSignalInfo() = 0 ) |
---|
| 2234 | { |
---|
| 2235 | for(i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++) |
---|
| 2236 | { |
---|
| 2237 | vps->setVideoSignalInfoIdx( i, 0 ); |
---|
| 2238 | } |
---|
| 2239 | } |
---|
| 2240 | #else |
---|
[588] | 2241 | if(!vps->getVideoSigPresentVpsFlag()) |
---|
| 2242 | { |
---|
| 2243 | for (i=0; i < vps->getMaxLayers(); i++) |
---|
| 2244 | { |
---|
| 2245 | vps->setVideoSignalInfoIdx(i,i); |
---|
| 2246 | } |
---|
| 2247 | } |
---|
| 2248 | else { |
---|
| 2249 | vps->setVideoSignalInfoIdx(0,0); |
---|
| 2250 | if (vps->getNumVideoSignalInfo() > 1 ) |
---|
| 2251 | { |
---|
| 2252 | for (i=1; i < vps->getMaxLayers(); i++) |
---|
| 2253 | READ_CODE(4, uiCode, "vps_video_signal_info_idx" ); vps->setVideoSignalInfoIdx(i, uiCode); |
---|
| 2254 | } |
---|
| 2255 | else { |
---|
| 2256 | for (i=1; i < vps->getMaxLayers(); i++) |
---|
| 2257 | { |
---|
| 2258 | vps->setVideoSignalInfoIdx(i,0); |
---|
| 2259 | } |
---|
| 2260 | } |
---|
| 2261 | } |
---|
[839] | 2262 | #endif |
---|
[588] | 2263 | #endif |
---|
[540] | 2264 | #if VPS_VUI_TILES_NOT_IN_USE__FLAG |
---|
| 2265 | UInt layerIdx; |
---|
| 2266 | READ_FLAG( uiCode, "tiles_not_in_use_flag" ); vps->setTilesNotInUseFlag(uiCode == 1); |
---|
| 2267 | if (!uiCode) |
---|
| 2268 | { |
---|
| 2269 | for(i = 0; i < vps->getMaxLayers(); i++) |
---|
| 2270 | { |
---|
| 2271 | READ_FLAG( uiCode, "tiles_in_use_flag[ i ]" ); vps->setTilesInUseFlag(i, (uiCode == 1)); |
---|
| 2272 | if (uiCode) |
---|
| 2273 | { |
---|
| 2274 | READ_FLAG( uiCode, "loop_filter_not_across_tiles_flag[ i ]" ); vps->setLoopFilterNotAcrossTilesFlag(i, (uiCode == 1)); |
---|
| 2275 | } |
---|
| 2276 | else |
---|
| 2277 | { |
---|
| 2278 | vps->setLoopFilterNotAcrossTilesFlag(i, false); |
---|
| 2279 | } |
---|
| 2280 | } |
---|
| 2281 | #endif |
---|
[815] | 2282 | |
---|
[540] | 2283 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 2284 | { |
---|
| 2285 | for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++) |
---|
| 2286 | { |
---|
| 2287 | #if VPS_VUI_TILES_NOT_IN_USE__FLAG |
---|
| 2288 | layerIdx = vps->getLayerIdInVps(vps->getRefLayerId(vps->getLayerIdInNuh(i), j)); |
---|
| 2289 | if (vps->getTilesInUseFlag(i) && vps->getTilesInUseFlag(layerIdx)) { |
---|
| 2290 | READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vps->setTileBoundariesAlignedFlag(i,j,(uiCode == 1)); |
---|
| 2291 | } |
---|
| 2292 | #else |
---|
| 2293 | READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vps->setTileBoundariesAlignedFlag(i,j,(uiCode == 1)); |
---|
| 2294 | #endif |
---|
| 2295 | } |
---|
| 2296 | } |
---|
| 2297 | #if VPS_VUI_TILES_NOT_IN_USE__FLAG |
---|
| 2298 | } |
---|
| 2299 | #endif |
---|
| 2300 | #if VPS_VUI_WPP_NOT_IN_USE__FLAG |
---|
| 2301 | READ_FLAG( uiCode, "wpp_not_in_use_flag" ); vps->setWppNotInUseFlag(uiCode == 1); |
---|
| 2302 | if (!uiCode) |
---|
[442] | 2303 | { |
---|
[540] | 2304 | for(i = 0; i < vps->getMaxLayers(); i++) |
---|
[442] | 2305 | { |
---|
[540] | 2306 | READ_FLAG( uiCode, "wpp_in_use_flag[ i ]" ); vps->setWppInUseFlag(i, (uiCode == 1)); |
---|
[442] | 2307 | } |
---|
[494] | 2308 | } |
---|
| 2309 | #endif |
---|
[547] | 2310 | |
---|
| 2311 | #if O0109_O0199_FLAGS_TO_VUI |
---|
| 2312 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
| 2313 | READ_FLAG(uiCode, "single_layer_for_non_irap_flag" ); vps->setSingleLayerForNonIrapFlag(uiCode == 1 ? true : false); |
---|
| 2314 | #endif |
---|
| 2315 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
| 2316 | READ_FLAG(uiCode, "higher_layer_irap_skip_flag" ); vps->setHigherLayerIrapSkipFlag(uiCode == 1 ? true : false); |
---|
[713] | 2317 | |
---|
| 2318 | // When single_layer_for_non_irap_flag is equal to 0, higher_layer_irap_skip_flag shall be equal to 0 |
---|
| 2319 | if( !vps->getSingleLayerForNonIrapFlag() ) |
---|
| 2320 | { |
---|
| 2321 | assert( !vps->getHigherLayerIrapSkipFlag() ); |
---|
| 2322 | } |
---|
[547] | 2323 | #endif |
---|
| 2324 | #endif |
---|
[644] | 2325 | #if P0312_VERT_PHASE_ADJ |
---|
| 2326 | READ_FLAG( uiCode, "vps_vui_vert_phase_in_use_flag" ); vps->setVpsVuiVertPhaseInUseFlag(uiCode); |
---|
| 2327 | #endif |
---|
[442] | 2328 | #if N0160_VUI_EXT_ILP_REF |
---|
[588] | 2329 | READ_FLAG( uiCode, "ilp_restricted_ref_layers_flag" ); vps->setIlpRestrictedRefLayersFlag( uiCode == 1 ); |
---|
| 2330 | if( vps->getIlpRestrictedRefLayersFlag()) |
---|
[442] | 2331 | { |
---|
| 2332 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 2333 | { |
---|
| 2334 | for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++) |
---|
| 2335 | { |
---|
[494] | 2336 | READ_UVLC( uiCode, "min_spatial_segment_offset_plus1[i][j]" ); vps->setMinSpatialSegmentOffsetPlus1( i, j, uiCode ); |
---|
| 2337 | if( vps->getMinSpatialSegmentOffsetPlus1(i,j ) > 0 ) |
---|
| 2338 | { |
---|
| 2339 | READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[i][j]"); vps->setCtuBasedOffsetEnabledFlag(i, j, uiCode == 1 ); |
---|
| 2340 | if(vps->getCtuBasedOffsetEnabledFlag(i,j)) |
---|
[442] | 2341 | { |
---|
[494] | 2342 | READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[i][j]"); vps->setMinHorizontalCtuOffsetPlus1( i,j, uiCode ); |
---|
[442] | 2343 | } |
---|
[494] | 2344 | } |
---|
| 2345 | } |
---|
[442] | 2346 | } |
---|
| 2347 | } |
---|
[494] | 2348 | #endif |
---|
[540] | 2349 | #if VPS_VUI_VIDEO_SIGNAL |
---|
[588] | 2350 | #if VPS_VUI_VIDEO_SIGNAL_MOVE |
---|
| 2351 | #else |
---|
[825] | 2352 | READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); vps->setVideoSigPresentVpsFlag( uiCode == 1 ); |
---|
| 2353 | if (vps->getVideoSigPresentVpsFlag()) |
---|
| 2354 | { |
---|
| 2355 | READ_CODE(4, uiCode, "vps_num_video_signal_info_minus1" ); vps->setNumVideoSignalInfo(uiCode + 1); |
---|
| 2356 | } |
---|
| 2357 | else |
---|
| 2358 | { |
---|
| 2359 | vps->setNumVideoSignalInfo(vps->getMaxLayers()); |
---|
| 2360 | } |
---|
| 2361 | |
---|
| 2362 | |
---|
| 2363 | for(i = 0; i < vps->getNumVideoSignalInfo(); i++) |
---|
| 2364 | { |
---|
| 2365 | READ_CODE(3, uiCode, "video_vps_format" ); vps->setVideoVPSFormat(i,uiCode); |
---|
| 2366 | READ_FLAG(uiCode, "video_full_range_vps_flag" ); vps->setVideoFullRangeVpsFlag(i,uiCode); |
---|
| 2367 | READ_CODE(8, uiCode, "color_primaries_vps" ); vps->setColorPrimaries(i,uiCode); |
---|
| 2368 | READ_CODE(8, uiCode, "transfer_characteristics_vps" ); vps->setTransCharacter(i,uiCode); |
---|
| 2369 | READ_CODE(8, uiCode, "matrix_coeffs_vps" );vps->setMaxtrixCoeff(i,uiCode); |
---|
| 2370 | } |
---|
| 2371 | if(!vps->getVideoSigPresentVpsFlag()) |
---|
| 2372 | { |
---|
| 2373 | for (i=0; i < vps->getMaxLayers(); i++) |
---|
[540] | 2374 | { |
---|
[825] | 2375 | vps->setVideoSignalInfoIdx(i,i); |
---|
[540] | 2376 | } |
---|
[825] | 2377 | } |
---|
| 2378 | else { |
---|
| 2379 | vps->setVideoSignalInfoIdx(0,0); |
---|
| 2380 | if (vps->getNumVideoSignalInfo() > 1 ) |
---|
[540] | 2381 | { |
---|
[825] | 2382 | for (i=1; i < vps->getMaxLayers(); i++) |
---|
| 2383 | READ_CODE(4, uiCode, "vps_video_signal_info_idx" ); vps->setVideoSignalInfoIdx(i, uiCode); |
---|
[540] | 2384 | } |
---|
| 2385 | else { |
---|
[825] | 2386 | for (i=1; i < vps->getMaxLayers(); i++) |
---|
| 2387 | { |
---|
| 2388 | vps->setVideoSignalInfoIdx(i,0); |
---|
| 2389 | } |
---|
[540] | 2390 | } |
---|
[825] | 2391 | } |
---|
[588] | 2392 | #endif |
---|
[540] | 2393 | #endif |
---|
[644] | 2394 | |
---|
| 2395 | #if O0164_MULTI_LAYER_HRD |
---|
[825] | 2396 | READ_FLAG(uiCode, "vps_vui_bsp_hrd_present_flag" ); vps->setVpsVuiBspHrdPresentFlag(uiCode); |
---|
| 2397 | if (vps->getVpsVuiBspHrdPresentFlag()) |
---|
| 2398 | { |
---|
[843] | 2399 | #if R0227_VUI_BSP_HRD_FLAG |
---|
| 2400 | assert (vps->getTimingInfo()->getTimingInfoPresentFlag() == 1); |
---|
| 2401 | #endif |
---|
[825] | 2402 | READ_UVLC( uiCode, "vps_num_bsp_hrd_parameters_minus1" ); vps->setVpsNumBspHrdParametersMinus1(uiCode); |
---|
| 2403 | vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1); |
---|
| 2404 | for( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ ) |
---|
[644] | 2405 | { |
---|
[825] | 2406 | if( i > 0 ) |
---|
[644] | 2407 | { |
---|
[825] | 2408 | READ_FLAG( uiCode, "bsp_cprms_present_flag[i]" ); vps->setBspCprmsPresentFlag(i, uiCode); |
---|
[644] | 2409 | } |
---|
[825] | 2410 | parseHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1); |
---|
| 2411 | } |
---|
[815] | 2412 | #if Q0078_ADD_LAYER_SETS |
---|
[825] | 2413 | for (UInt h = 1; h <= vps->getVpsNumLayerSetsMinus1(); h++) |
---|
[815] | 2414 | #else |
---|
[825] | 2415 | for( UInt h = 1; h <= (vps->getNumLayerSets()-1); h++ ) |
---|
[815] | 2416 | #endif |
---|
[825] | 2417 | { |
---|
| 2418 | READ_UVLC( uiCode, "num_bitstream_partitions[i]"); vps->setNumBitstreamPartitions(h, uiCode); |
---|
[815] | 2419 | #if HRD_BPB |
---|
[825] | 2420 | Int chkPart=0; |
---|
[815] | 2421 | #endif |
---|
[825] | 2422 | for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ ) |
---|
| 2423 | { |
---|
| 2424 | for( j = 0; j <= (vps->getMaxLayers()-1); j++ ) |
---|
[644] | 2425 | { |
---|
[825] | 2426 | if( vps->getLayerIdIncludedFlag(h, j) ) |
---|
[644] | 2427 | { |
---|
[825] | 2428 | READ_FLAG( uiCode, "layer_in_bsp_flag[h][i][j]" ); vps->setLayerInBspFlag(h, i, j, uiCode); |
---|
[644] | 2429 | } |
---|
[825] | 2430 | } |
---|
[815] | 2431 | #if HRD_BPB |
---|
[825] | 2432 | chkPart+=vps->getLayerInBspFlag(h, i, j); |
---|
[815] | 2433 | #endif |
---|
[825] | 2434 | } |
---|
[815] | 2435 | #if HRD_BPB |
---|
[825] | 2436 | assert(chkPart<=1); |
---|
[815] | 2437 | #endif |
---|
| 2438 | #if HRD_BPB |
---|
[825] | 2439 | if(vps->getNumBitstreamPartitions(h)==1) |
---|
| 2440 | { |
---|
| 2441 | Int chkPartition1=0; Int chkPartition2=0; |
---|
| 2442 | for( j = 0; j <= (vps->getMaxLayers()-1); j++ ) |
---|
[815] | 2443 | { |
---|
[825] | 2444 | if( vps->getLayerIdIncludedFlag(h, j) ) |
---|
[815] | 2445 | { |
---|
[825] | 2446 | chkPartition1+=vps->getLayerInBspFlag(h, 0, j); |
---|
| 2447 | chkPartition2++; |
---|
[815] | 2448 | } |
---|
| 2449 | } |
---|
[825] | 2450 | assert(chkPartition1!=chkPartition2); |
---|
| 2451 | } |
---|
[815] | 2452 | #endif |
---|
[825] | 2453 | if (vps->getNumBitstreamPartitions(h)) |
---|
| 2454 | { |
---|
[815] | 2455 | #if Q0182_MULTI_LAYER_HRD_UPDATE |
---|
[825] | 2456 | READ_UVLC( uiCode, "num_bsp_sched_combinations_minus1[h]"); vps->setNumBspSchedCombinations(h, uiCode + 1); |
---|
[815] | 2457 | #else |
---|
[825] | 2458 | READ_UVLC( uiCode, "num_bsp_sched_combinations[h]"); vps->setNumBspSchedCombinations(h, uiCode); |
---|
[815] | 2459 | #endif |
---|
[825] | 2460 | for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ ) |
---|
| 2461 | { |
---|
| 2462 | for( j = 0; j < vps->getNumBitstreamPartitions(h); j++ ) |
---|
[644] | 2463 | { |
---|
[825] | 2464 | READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][j]"); vps->setBspCombHrdIdx(h, i, j, uiCode); |
---|
[815] | 2465 | #if HRD_BPB |
---|
[825] | 2466 | assert(uiCode <= vps->getVpsNumBspHrdParametersMinus1()); |
---|
[815] | 2467 | #endif |
---|
[825] | 2468 | |
---|
| 2469 | READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][j]"); vps->setBspCombSchedIdx(h, i, j, uiCode); |
---|
[815] | 2470 | #if HRD_BPB |
---|
[825] | 2471 | assert(uiCode <= vps->getBspHrdParamBufferCpbCntMinus1(uiCode,vps->getMaxTLayers()-1)); |
---|
[815] | 2472 | #endif |
---|
[644] | 2473 | } |
---|
| 2474 | } |
---|
| 2475 | } |
---|
| 2476 | } |
---|
[825] | 2477 | } |
---|
[644] | 2478 | #endif |
---|
| 2479 | |
---|
| 2480 | #if P0182_VPS_VUI_PS_FLAG |
---|
[825] | 2481 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
| 2482 | { |
---|
| 2483 | if (vps->getNumRefLayers(vps->getLayerIdInNuh(i)) == 0) |
---|
[644] | 2484 | { |
---|
[825] | 2485 | READ_FLAG( uiCode, "base_layer_parameter_set_compatibility_flag" ); |
---|
| 2486 | vps->setBaseLayerPSCompatibilityFlag( i, uiCode ); |
---|
[644] | 2487 | } |
---|
[825] | 2488 | else |
---|
| 2489 | { |
---|
| 2490 | vps->setBaseLayerPSCompatibilityFlag( i, 0 ); |
---|
| 2491 | } |
---|
| 2492 | } |
---|
[644] | 2493 | #endif |
---|
[442] | 2494 | } |
---|
[494] | 2495 | #endif //SVC_EXTENSION |
---|
| 2496 | |
---|
[313] | 2497 | Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager) |
---|
| 2498 | { |
---|
| 2499 | UInt uiCode; |
---|
| 2500 | Int iCode; |
---|
| 2501 | |
---|
| 2502 | #if ENC_DEC_TRACE |
---|
| 2503 | xTraceSliceHeader(rpcSlice); |
---|
| 2504 | #endif |
---|
| 2505 | TComPPS* pps = NULL; |
---|
| 2506 | TComSPS* sps = NULL; |
---|
| 2507 | |
---|
| 2508 | UInt firstSliceSegmentInPic; |
---|
| 2509 | READ_FLAG( firstSliceSegmentInPic, "first_slice_segment_in_pic_flag" ); |
---|
| 2510 | if( rpcSlice->getRapPicFlag()) |
---|
| 2511 | { |
---|
[713] | 2512 | READ_FLAG( uiCode, "no_output_of_prior_pics_flag" ); //ignored -- updated already |
---|
| 2513 | #if SETTING_NO_OUT_PIC_PRIOR |
---|
| 2514 | rpcSlice->setNoOutputPriorPicsFlag(uiCode ? true : false); |
---|
[644] | 2515 | #else |
---|
[713] | 2516 | rpcSlice->setNoOutputPicPrior( false ); |
---|
[644] | 2517 | #endif |
---|
[313] | 2518 | } |
---|
| 2519 | READ_UVLC ( uiCode, "slice_pic_parameter_set_id" ); rpcSlice->setPPSId(uiCode); |
---|
| 2520 | pps = parameterSetManager->getPrefetchedPPS(uiCode); |
---|
| 2521 | //!KS: need to add error handling code here, if PPS is not available |
---|
| 2522 | assert(pps!=0); |
---|
| 2523 | sps = parameterSetManager->getPrefetchedSPS(pps->getSPSId()); |
---|
| 2524 | //!KS: need to add error handling code here, if SPS is not available |
---|
| 2525 | assert(sps!=0); |
---|
| 2526 | rpcSlice->setSPS(sps); |
---|
| 2527 | rpcSlice->setPPS(pps); |
---|
[838] | 2528 | |
---|
| 2529 | #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 |
---|
| 2530 | TComVPS* vps = NULL; |
---|
| 2531 | vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId()); |
---|
[848] | 2532 | #if R0279_REP_FORMAT_INBL |
---|
| 2533 | if ( vps->getVpsExtensionFlag() == 1 && (rpcSlice->getLayerId() == 0 || sps->getV1CompatibleSPSFlag() == 1) ) |
---|
| 2534 | { |
---|
| 2535 | assert( sps->getPicWidthInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getPicWidthVpsInLumaSamples() ); |
---|
| 2536 | assert( sps->getPicHeightInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getPicHeightVpsInLumaSamples() ); |
---|
| 2537 | assert( sps->getChromaFormatIdc() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getChromaFormatVpsIdc() ); |
---|
| 2538 | assert( sps->getBitDepthY() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getBitDepthVpsLuma() ); |
---|
| 2539 | assert( sps->getBitDepthC() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()) )->getBitDepthVpsChroma() ); |
---|
| 2540 | #else |
---|
[844] | 2541 | if ( rpcSlice->getLayerId() == 0 && vps->getVpsExtensionFlag() == 1 ) |
---|
[838] | 2542 | { |
---|
| 2543 | assert( sps->getPicWidthInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getPicWidthVpsInLumaSamples() ); |
---|
| 2544 | assert( sps->getPicHeightInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getPicHeightVpsInLumaSamples() ); |
---|
| 2545 | assert( sps->getChromaFormatIdc() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getChromaFormatVpsIdc() ); |
---|
| 2546 | assert( sps->getBitDepthY() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getBitDepthVpsLuma() ); |
---|
| 2547 | assert( sps->getBitDepthC() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(0) )->getBitDepthVpsChroma() ); |
---|
[848] | 2548 | #endif |
---|
[838] | 2549 | } |
---|
[844] | 2550 | else if ( vps->getVpsExtensionFlag() == 1 ) |
---|
[838] | 2551 | { |
---|
| 2552 | assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getPicWidthVpsInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getPicWidthVpsInLumaSamples()); |
---|
| 2553 | assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getPicHeightVpsInLumaSamples() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getPicHeightVpsInLumaSamples()); |
---|
| 2554 | assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getChromaFormatVpsIdc() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getChromaFormatVpsIdc()); |
---|
| 2555 | assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getBitDepthVpsLuma() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getBitDepthVpsLuma()); |
---|
| 2556 | assert(vps->getVpsRepFormat( vps->getVpsRepFormatIdx(sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getLayerId()))->getBitDepthVpsChroma() <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(rpcSlice->getLayerId()))->getBitDepthVpsChroma()); |
---|
| 2557 | } |
---|
| 2558 | #endif |
---|
| 2559 | |
---|
[313] | 2560 | if( pps->getDependentSliceSegmentsEnabledFlag() && ( !firstSliceSegmentInPic )) |
---|
| 2561 | { |
---|
| 2562 | READ_FLAG( uiCode, "dependent_slice_segment_flag" ); rpcSlice->setDependentSliceSegmentFlag(uiCode ? true : false); |
---|
| 2563 | } |
---|
| 2564 | else |
---|
| 2565 | { |
---|
| 2566 | rpcSlice->setDependentSliceSegmentFlag(false); |
---|
| 2567 | } |
---|
[442] | 2568 | #if REPN_FORMAT_IN_VPS |
---|
| 2569 | Int numCTUs = ((rpcSlice->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((rpcSlice->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight()); |
---|
| 2570 | #else |
---|
[313] | 2571 | Int numCTUs = ((sps->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((sps->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight()); |
---|
[442] | 2572 | #endif |
---|
[313] | 2573 | Int maxParts = (1<<(sps->getMaxCUDepth()<<1)); |
---|
| 2574 | UInt sliceSegmentAddress = 0; |
---|
| 2575 | Int bitsSliceSegmentAddress = 0; |
---|
| 2576 | while(numCTUs>(1<<bitsSliceSegmentAddress)) |
---|
| 2577 | { |
---|
| 2578 | bitsSliceSegmentAddress++; |
---|
| 2579 | } |
---|
| 2580 | |
---|
| 2581 | if(!firstSliceSegmentInPic) |
---|
| 2582 | { |
---|
| 2583 | READ_CODE( bitsSliceSegmentAddress, sliceSegmentAddress, "slice_segment_address" ); |
---|
| 2584 | } |
---|
| 2585 | //set uiCode to equal slice start address (or dependent slice start address) |
---|
| 2586 | Int startCuAddress = maxParts*sliceSegmentAddress; |
---|
| 2587 | rpcSlice->setSliceSegmentCurStartCUAddr( startCuAddress ); |
---|
| 2588 | rpcSlice->setSliceSegmentCurEndCUAddr(numCTUs*maxParts); |
---|
| 2589 | |
---|
| 2590 | if (rpcSlice->getDependentSliceSegmentFlag()) |
---|
| 2591 | { |
---|
| 2592 | rpcSlice->setNextSlice ( false ); |
---|
| 2593 | rpcSlice->setNextSliceSegment ( true ); |
---|
| 2594 | } |
---|
| 2595 | else |
---|
| 2596 | { |
---|
| 2597 | rpcSlice->setNextSlice ( true ); |
---|
| 2598 | rpcSlice->setNextSliceSegment ( false ); |
---|
| 2599 | |
---|
| 2600 | rpcSlice->setSliceCurStartCUAddr(startCuAddress); |
---|
| 2601 | rpcSlice->setSliceCurEndCUAddr(numCTUs*maxParts); |
---|
| 2602 | } |
---|
| 2603 | |
---|
[815] | 2604 | #if Q0142_POC_LSB_NOT_PRESENT |
---|
| 2605 | #if SHM_FIX7 |
---|
[825] | 2606 | Int iPOClsb = 0; |
---|
[815] | 2607 | #endif |
---|
| 2608 | #endif |
---|
| 2609 | |
---|
[313] | 2610 | if(!rpcSlice->getDependentSliceSegmentFlag()) |
---|
| 2611 | { |
---|
[494] | 2612 | #if SVC_EXTENSION |
---|
[442] | 2613 | #if POC_RESET_FLAG |
---|
[494] | 2614 | Int iBits = 0; |
---|
[442] | 2615 | if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits) |
---|
| 2616 | { |
---|
| 2617 | READ_FLAG(uiCode, "poc_reset_flag"); rpcSlice->setPocResetFlag( uiCode ? true : false ); |
---|
| 2618 | iBits++; |
---|
| 2619 | } |
---|
| 2620 | if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits) |
---|
| 2621 | { |
---|
[588] | 2622 | #if DISCARDABLE_PIC_RPS |
---|
| 2623 | READ_FLAG(uiCode, "discardable_flag"); rpcSlice->setDiscardableFlag( uiCode ? true : false ); |
---|
| 2624 | #else |
---|
[442] | 2625 | READ_FLAG(uiCode, "discardable_flag"); // ignored |
---|
[588] | 2626 | #endif |
---|
[442] | 2627 | iBits++; |
---|
| 2628 | } |
---|
[540] | 2629 | #if O0149_CROSS_LAYER_BLA_FLAG |
---|
| 2630 | if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits) |
---|
| 2631 | { |
---|
| 2632 | READ_FLAG(uiCode, "cross_layer_bla_flag"); rpcSlice->setCrossLayerBLAFlag( uiCode ? true : false ); |
---|
| 2633 | iBits++; |
---|
| 2634 | } |
---|
| 2635 | #endif |
---|
[442] | 2636 | for (; iBits < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); iBits++) |
---|
| 2637 | { |
---|
| 2638 | READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored |
---|
| 2639 | } |
---|
| 2640 | #else |
---|
[313] | 2641 | if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits()>0) |
---|
| 2642 | { |
---|
| 2643 | READ_FLAG(uiCode, "discardable_flag"); // ignored |
---|
| 2644 | } |
---|
| 2645 | for (Int i = 1; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) |
---|
| 2646 | { |
---|
| 2647 | READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored |
---|
| 2648 | } |
---|
[494] | 2649 | #endif |
---|
| 2650 | #else //SVC_EXTENSION |
---|
[313] | 2651 | for (Int i = 0; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) |
---|
| 2652 | { |
---|
| 2653 | READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored |
---|
| 2654 | } |
---|
[494] | 2655 | #endif //SVC_EXTENSION |
---|
[313] | 2656 | |
---|
| 2657 | READ_UVLC ( uiCode, "slice_type" ); rpcSlice->setSliceType((SliceType)uiCode); |
---|
| 2658 | if( pps->getOutputFlagPresentFlag() ) |
---|
| 2659 | { |
---|
| 2660 | READ_FLAG( uiCode, "pic_output_flag" ); rpcSlice->setPicOutputFlag( uiCode ? true : false ); |
---|
| 2661 | } |
---|
| 2662 | else |
---|
| 2663 | { |
---|
| 2664 | rpcSlice->setPicOutputFlag( true ); |
---|
| 2665 | } |
---|
| 2666 | // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present |
---|
| 2667 | assert (sps->getChromaFormatIdc() == 1 ); |
---|
| 2668 | // if( separate_colour_plane_flag == 1 ) |
---|
| 2669 | // colour_plane_id u(2) |
---|
| 2670 | |
---|
| 2671 | if( rpcSlice->getIdrPicFlag() ) |
---|
| 2672 | { |
---|
| 2673 | rpcSlice->setPOC(0); |
---|
| 2674 | TComReferencePictureSet* rps = rpcSlice->getLocalRPS(); |
---|
| 2675 | rps->setNumberOfNegativePictures(0); |
---|
| 2676 | rps->setNumberOfPositivePictures(0); |
---|
| 2677 | rps->setNumberOfLongtermPictures(0); |
---|
| 2678 | rps->setNumberOfPictures(0); |
---|
| 2679 | rpcSlice->setRPS(rps); |
---|
| 2680 | } |
---|
[442] | 2681 | #if N0065_LAYER_POC_ALIGNMENT |
---|
[815] | 2682 | #if !Q0142_POC_LSB_NOT_PRESENT |
---|
[494] | 2683 | #if SHM_FIX7 |
---|
| 2684 | Int iPOClsb = 0; |
---|
| 2685 | #endif |
---|
[815] | 2686 | #endif |
---|
[494] | 2687 | #if O0062_POC_LSB_NOT_PRESENT_FLAG |
---|
| 2688 | if( ( rpcSlice->getLayerId() > 0 && !rpcSlice->getVPS()->getPocLsbNotPresentFlag( rpcSlice->getVPS()->getLayerIdInVps(rpcSlice->getLayerId())) ) || !rpcSlice->getIdrPicFlag()) |
---|
| 2689 | #else |
---|
[442] | 2690 | if( rpcSlice->getLayerId() > 0 || !rpcSlice->getIdrPicFlag() ) |
---|
[494] | 2691 | #endif |
---|
[442] | 2692 | #else |
---|
[313] | 2693 | else |
---|
[442] | 2694 | #endif |
---|
[313] | 2695 | { |
---|
| 2696 | READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb"); |
---|
[815] | 2697 | #if POC_RESET_IDC_DECODER |
---|
| 2698 | rpcSlice->setPicOrderCntLsb( uiCode ); |
---|
| 2699 | #endif |
---|
[494] | 2700 | #if SHM_FIX7 |
---|
| 2701 | iPOClsb = uiCode; |
---|
| 2702 | #else |
---|
[313] | 2703 | Int iPOClsb = uiCode; |
---|
[494] | 2704 | #endif |
---|
[442] | 2705 | Int iPrevPOC = rpcSlice->getPrevTid0POC(); |
---|
[313] | 2706 | Int iMaxPOClsb = 1<< sps->getBitsForPOC(); |
---|
[442] | 2707 | Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1); |
---|
[313] | 2708 | Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb; |
---|
| 2709 | Int iPOCmsb; |
---|
| 2710 | if( ( iPOClsb < iPrevPOClsb ) && ( ( iPrevPOClsb - iPOClsb ) >= ( iMaxPOClsb / 2 ) ) ) |
---|
| 2711 | { |
---|
| 2712 | iPOCmsb = iPrevPOCmsb + iMaxPOClsb; |
---|
| 2713 | } |
---|
| 2714 | else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) ) |
---|
| 2715 | { |
---|
| 2716 | iPOCmsb = iPrevPOCmsb - iMaxPOClsb; |
---|
| 2717 | } |
---|
| 2718 | else |
---|
| 2719 | { |
---|
| 2720 | iPOCmsb = iPrevPOCmsb; |
---|
| 2721 | } |
---|
| 2722 | if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 2723 | || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 2724 | || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) |
---|
| 2725 | { |
---|
| 2726 | // For BLA picture types, POCmsb is set to 0. |
---|
| 2727 | iPOCmsb = 0; |
---|
| 2728 | } |
---|
| 2729 | rpcSlice->setPOC (iPOCmsb+iPOClsb); |
---|
| 2730 | |
---|
[442] | 2731 | #if N0065_LAYER_POC_ALIGNMENT |
---|
[494] | 2732 | #if SHM_FIX7 |
---|
[825] | 2733 | } |
---|
[494] | 2734 | #endif |
---|
[815] | 2735 | #if POC_RESET_IDC_DECODER |
---|
[825] | 2736 | else |
---|
| 2737 | { |
---|
| 2738 | rpcSlice->setPicOrderCntLsb( 0 ); |
---|
| 2739 | } |
---|
| 2740 | #endif |
---|
| 2741 | if( !rpcSlice->getIdrPicFlag() ) |
---|
| 2742 | { |
---|
| 2743 | #endif |
---|
| 2744 | TComReferencePictureSet* rps; |
---|
| 2745 | rps = rpcSlice->getLocalRPS(); |
---|
| 2746 | rpcSlice->setRPS(rps); |
---|
| 2747 | READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); |
---|
| 2748 | if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header |
---|
[815] | 2749 | { |
---|
[825] | 2750 | parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); |
---|
[815] | 2751 | } |
---|
[825] | 2752 | else // use reference to short-term reference picture set in PPS |
---|
| 2753 | { |
---|
| 2754 | Int numBits = 0; |
---|
| 2755 | while ((1 << numBits) < rpcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets()) |
---|
[442] | 2756 | { |
---|
[825] | 2757 | numBits++; |
---|
| 2758 | } |
---|
| 2759 | if (numBits > 0) |
---|
[313] | 2760 | { |
---|
[825] | 2761 | READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); |
---|
[313] | 2762 | } |
---|
[825] | 2763 | else |
---|
[313] | 2764 | { |
---|
[825] | 2765 | uiCode = 0; |
---|
[313] | 2766 | } |
---|
[825] | 2767 | *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); |
---|
| 2768 | } |
---|
| 2769 | if(sps->getLongTermRefsPresent()) |
---|
| 2770 | { |
---|
| 2771 | Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); |
---|
| 2772 | UInt numOfLtrp = 0; |
---|
| 2773 | UInt numLtrpInSPS = 0; |
---|
| 2774 | if (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > 0) |
---|
[313] | 2775 | { |
---|
[825] | 2776 | READ_UVLC( uiCode, "num_long_term_sps"); |
---|
| 2777 | numLtrpInSPS = uiCode; |
---|
| 2778 | numOfLtrp += numLtrpInSPS; |
---|
| 2779 | rps->setNumberOfLongtermPictures(numOfLtrp); |
---|
| 2780 | } |
---|
| 2781 | Int bitsForLtrpInSPS = 0; |
---|
| 2782 | while (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) |
---|
| 2783 | { |
---|
| 2784 | bitsForLtrpInSPS++; |
---|
| 2785 | } |
---|
| 2786 | READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); |
---|
| 2787 | numOfLtrp += uiCode; |
---|
| 2788 | rps->setNumberOfLongtermPictures(numOfLtrp); |
---|
| 2789 | Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); |
---|
| 2790 | Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; |
---|
| 2791 | for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) |
---|
| 2792 | { |
---|
| 2793 | Int pocLsbLt; |
---|
| 2794 | if (k < numLtrpInSPS) |
---|
[313] | 2795 | { |
---|
[825] | 2796 | uiCode = 0; |
---|
| 2797 | if (bitsForLtrpInSPS > 0) |
---|
| 2798 | { |
---|
| 2799 | READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]"); |
---|
| 2800 | } |
---|
| 2801 | Int usedByCurrFromSPS=rpcSlice->getSPS()->getUsedByCurrPicLtSPSFlag(uiCode); |
---|
| 2802 | |
---|
| 2803 | pocLsbLt = rpcSlice->getSPS()->getLtRefPicPocLsbSps(uiCode); |
---|
| 2804 | rps->setUsed(j,usedByCurrFromSPS); |
---|
[313] | 2805 | } |
---|
[825] | 2806 | else |
---|
[313] | 2807 | { |
---|
[825] | 2808 | READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode; |
---|
| 2809 | READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); |
---|
[313] | 2810 | } |
---|
[825] | 2811 | READ_FLAG(uiCode,"delta_poc_msb_present_flag"); |
---|
| 2812 | Bool mSBPresentFlag = uiCode ? true : false; |
---|
| 2813 | if(mSBPresentFlag) |
---|
[313] | 2814 | { |
---|
[825] | 2815 | READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); |
---|
| 2816 | Bool deltaFlag = false; |
---|
| 2817 | // First LTRP || First LTRP from SH |
---|
| 2818 | if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) |
---|
[313] | 2819 | { |
---|
[825] | 2820 | deltaFlag = true; |
---|
[313] | 2821 | } |
---|
[825] | 2822 | if(deltaFlag) |
---|
| 2823 | { |
---|
| 2824 | deltaPocMSBCycleLT = uiCode; |
---|
| 2825 | } |
---|
[313] | 2826 | else |
---|
| 2827 | { |
---|
[825] | 2828 | deltaPocMSBCycleLT = uiCode + prevDeltaMSB; |
---|
[313] | 2829 | } |
---|
| 2830 | |
---|
[825] | 2831 | Int pocLTCurr = rpcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB |
---|
| 2832 | - iPOClsb + pocLsbLt; |
---|
| 2833 | rps->setPOC (j, pocLTCurr); |
---|
| 2834 | rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLTCurr); |
---|
| 2835 | rps->setCheckLTMSBPresent(j,true); |
---|
| 2836 | } |
---|
| 2837 | else |
---|
| 2838 | { |
---|
| 2839 | rps->setPOC (j, pocLsbLt); |
---|
| 2840 | rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt); |
---|
| 2841 | rps->setCheckLTMSBPresent(j,false); |
---|
| 2842 | |
---|
| 2843 | // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present |
---|
| 2844 | if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) |
---|
[313] | 2845 | { |
---|
[825] | 2846 | deltaPocMSBCycleLT = 0; |
---|
[313] | 2847 | } |
---|
| 2848 | } |
---|
[825] | 2849 | prevDeltaMSB = deltaPocMSBCycleLT; |
---|
[313] | 2850 | } |
---|
[825] | 2851 | offset += rps->getNumberOfLongtermPictures(); |
---|
| 2852 | rps->setNumberOfPictures(offset); |
---|
| 2853 | } |
---|
[815] | 2854 | #if DPB_CONSTRAINTS |
---|
[825] | 2855 | if(rpcSlice->getVPS()->getVpsExtensionFlag()==1) |
---|
| 2856 | { |
---|
[815] | 2857 | #if Q0078_ADD_LAYER_SETS |
---|
[825] | 2858 | for (Int ii = 1; ii < (rpcSlice->getVPS()->getVpsNumLayerSetsMinus1() + 1); ii++) // prevent assert error when num_add_layer_sets > 0 |
---|
[815] | 2859 | #else |
---|
[825] | 2860 | for (Int ii=1; ii< rpcSlice->getVPS()->getNumOutputLayerSets(); ii++ ) |
---|
[815] | 2861 | #endif |
---|
[825] | 2862 | { |
---|
| 2863 | Int layerSetIdxForOutputLayerSet = rpcSlice->getVPS()->getOutputLayerSetIdx( ii ); |
---|
| 2864 | Int chkAssert=0; |
---|
| 2865 | for(Int kk = 0; kk < rpcSlice->getVPS()->getNumLayersInIdList(layerSetIdxForOutputLayerSet); kk++) |
---|
| 2866 | { |
---|
| 2867 | if(rpcSlice->getLayerId()==rpcSlice->getVPS()->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, kk)) |
---|
[815] | 2868 | { |
---|
[825] | 2869 | chkAssert=1; |
---|
[815] | 2870 | } |
---|
[825] | 2871 | } |
---|
| 2872 | if(chkAssert) |
---|
| 2873 | { |
---|
| 2874 | // There may be something wrong here (layer id assumed to be layer idx?) |
---|
| 2875 | assert(rps->getNumberOfNegativePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii))); |
---|
| 2876 | assert(rps->getNumberOfPositivePictures() <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii)) - rps->getNumberOfNegativePictures()); |
---|
| 2877 | assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1(ii , rpcSlice->getLayerId() , rpcSlice->getVPS()->getMaxSLayersInLayerSetMinus1(ii))); |
---|
| 2878 | } |
---|
[313] | 2879 | } |
---|
[825] | 2880 | |
---|
| 2881 | |
---|
[313] | 2882 | } |
---|
[825] | 2883 | if(rpcSlice->getLayerId() == 0) |
---|
| 2884 | { |
---|
| 2885 | assert(rps->getNumberOfNegativePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) ); |
---|
| 2886 | assert(rps->getNumberOfPositivePictures() <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1) -rps->getNumberOfNegativePictures()); |
---|
| 2887 | assert((rps->getNumberOfPositivePictures() + rps->getNumberOfNegativePictures() + rps->getNumberOfLongtermPictures()) <= rpcSlice->getSPS()->getMaxDecPicBuffering(rpcSlice->getSPS()->getMaxTLayers()-1)); |
---|
| 2888 | } |
---|
[442] | 2889 | #endif |
---|
[825] | 2890 | if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 2891 | || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 2892 | || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) |
---|
| 2893 | { |
---|
| 2894 | // In the case of BLA picture types, rps data is read from slice header but ignored |
---|
| 2895 | rps = rpcSlice->getLocalRPS(); |
---|
| 2896 | rps->setNumberOfNegativePictures(0); |
---|
| 2897 | rps->setNumberOfPositivePictures(0); |
---|
| 2898 | rps->setNumberOfLongtermPictures(0); |
---|
| 2899 | rps->setNumberOfPictures(0); |
---|
| 2900 | rpcSlice->setRPS(rps); |
---|
[442] | 2901 | } |
---|
[825] | 2902 | if (rpcSlice->getSPS()->getTMVPFlagsPresent()) |
---|
| 2903 | { |
---|
| 2904 | READ_FLAG( uiCode, "slice_temporal_mvp_enable_flag" ); |
---|
| 2905 | rpcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); |
---|
| 2906 | } |
---|
| 2907 | else |
---|
| 2908 | { |
---|
| 2909 | rpcSlice->setEnableTMVPFlag(false); |
---|
| 2910 | } |
---|
| 2911 | #if N0065_LAYER_POC_ALIGNMENT && !SHM_FIX7 |
---|
| 2912 | } |
---|
| 2913 | #endif |
---|
| 2914 | } |
---|
[313] | 2915 | |
---|
[442] | 2916 | #if SVC_EXTENSION |
---|
[825] | 2917 | rpcSlice->setActiveNumILRRefIdx(0); |
---|
| 2918 | if((rpcSlice->getLayerId() > 0) && !(rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (rpcSlice->getNumILRRefIdx() > 0) ) |
---|
| 2919 | { |
---|
| 2920 | READ_FLAG(uiCode,"inter_layer_pred_enabled_flag"); |
---|
| 2921 | rpcSlice->setInterLayerPredEnabledFlag(uiCode); |
---|
| 2922 | if( rpcSlice->getInterLayerPredEnabledFlag()) |
---|
[313] | 2923 | { |
---|
[825] | 2924 | if(rpcSlice->getNumILRRefIdx() > 1) |
---|
[313] | 2925 | { |
---|
[825] | 2926 | Int numBits = 1; |
---|
| 2927 | while ((1 << numBits) < rpcSlice->getNumILRRefIdx()) |
---|
[313] | 2928 | { |
---|
[825] | 2929 | numBits++; |
---|
| 2930 | } |
---|
| 2931 | if( !rpcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) |
---|
| 2932 | { |
---|
| 2933 | READ_CODE( numBits, uiCode,"num_inter_layer_ref_pics_minus1" ); |
---|
| 2934 | rpcSlice->setActiveNumILRRefIdx(uiCode + 1); |
---|
| 2935 | } |
---|
| 2936 | else |
---|
| 2937 | { |
---|
| 2938 | #if P0079_DERIVE_NUMACTIVE_REF_PICS |
---|
| 2939 | for( Int i = 0; i < rpcSlice->getNumILRRefIdx(); i++ ) |
---|
[313] | 2940 | { |
---|
[713] | 2941 | #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO |
---|
[825] | 2942 | if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) && |
---|
| 2943 | (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) |
---|
[713] | 2944 | #else |
---|
[825] | 2945 | if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() && |
---|
| 2946 | (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) |
---|
[713] | 2947 | #endif |
---|
[825] | 2948 | { |
---|
| 2949 | rpcSlice->setActiveNumILRRefIdx(1); |
---|
| 2950 | break; |
---|
[588] | 2951 | } |
---|
[825] | 2952 | } |
---|
[588] | 2953 | #else |
---|
[825] | 2954 | rpcSlice->setActiveNumILRRefIdx(1); |
---|
[588] | 2955 | #endif |
---|
[825] | 2956 | } |
---|
[815] | 2957 | |
---|
[825] | 2958 | if( rpcSlice->getActiveNumILRRefIdx() == rpcSlice->getNumILRRefIdx() ) |
---|
| 2959 | { |
---|
| 2960 | for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) |
---|
[345] | 2961 | { |
---|
[825] | 2962 | rpcSlice->setInterLayerPredLayerIdc(i,i); |
---|
[345] | 2963 | } |
---|
[825] | 2964 | } |
---|
| 2965 | else |
---|
| 2966 | { |
---|
| 2967 | for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) |
---|
[345] | 2968 | { |
---|
[825] | 2969 | READ_CODE( numBits,uiCode,"inter_layer_pred_layer_idc[i]" ); |
---|
| 2970 | rpcSlice->setInterLayerPredLayerIdc(uiCode,i); |
---|
[313] | 2971 | } |
---|
| 2972 | } |
---|
[825] | 2973 | } |
---|
| 2974 | else |
---|
| 2975 | { |
---|
[540] | 2976 | #if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS |
---|
[713] | 2977 | #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO |
---|
[825] | 2978 | if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(0,rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) && |
---|
| 2979 | (rpcSlice->getVPS()->getMaxTSLayersMinus1(0) >= rpcSlice->getTLayer()) ) |
---|
[713] | 2980 | #else |
---|
[825] | 2981 | if( (rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(0,rpcSlice->getLayerId()) > rpcSlice->getTLayer()) && |
---|
| 2982 | (rpcSlice->getVPS()->getMaxTSLayersMinus1(0) >= rpcSlice->getTLayer()) ) |
---|
[713] | 2983 | #endif |
---|
[540] | 2984 | { |
---|
| 2985 | #endif |
---|
[313] | 2986 | rpcSlice->setActiveNumILRRefIdx(1); |
---|
| 2987 | rpcSlice->setInterLayerPredLayerIdc(0,0); |
---|
[540] | 2988 | #if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS |
---|
[313] | 2989 | } |
---|
[540] | 2990 | #endif |
---|
[313] | 2991 | } |
---|
| 2992 | } |
---|
[825] | 2993 | } |
---|
| 2994 | else if( rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() == true && (rpcSlice->getLayerId() > 0 )) |
---|
| 2995 | { |
---|
| 2996 | rpcSlice->setInterLayerPredEnabledFlag(true); |
---|
[540] | 2997 | |
---|
| 2998 | #if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS |
---|
[825] | 2999 | Int numRefLayerPics = 0; |
---|
| 3000 | Int i = 0; |
---|
| 3001 | Int refLayerPicIdc [MAX_VPS_LAYER_ID_PLUS1]; |
---|
| 3002 | for(i = 0, numRefLayerPics = 0; i < rpcSlice->getNumILRRefIdx(); i++ ) |
---|
| 3003 | { |
---|
[713] | 3004 | #if Q0060_MAX_TID_REF_EQUAL_TO_ZERO |
---|
[825] | 3005 | if((rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() || rpcSlice->getTLayer()==0) && |
---|
| 3006 | (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) |
---|
[713] | 3007 | #else |
---|
[825] | 3008 | if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) > rpcSlice->getTLayer() && |
---|
| 3009 | (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >= rpcSlice->getTLayer()) ) |
---|
[713] | 3010 | #endif |
---|
[825] | 3011 | { |
---|
| 3012 | refLayerPicIdc[ numRefLayerPics++ ] = i; |
---|
[540] | 3013 | } |
---|
[825] | 3014 | } |
---|
| 3015 | rpcSlice->setActiveNumILRRefIdx(numRefLayerPics); |
---|
| 3016 | for( i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) |
---|
| 3017 | { |
---|
| 3018 | rpcSlice->setInterLayerPredLayerIdc(refLayerPicIdc[i],i); |
---|
| 3019 | } |
---|
[540] | 3020 | #else |
---|
[825] | 3021 | rpcSlice->setActiveNumILRRefIdx(rpcSlice->getNumILRRefIdx()); |
---|
| 3022 | for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) |
---|
| 3023 | { |
---|
| 3024 | rpcSlice->setInterLayerPredLayerIdc(i,i); |
---|
| 3025 | } |
---|
[540] | 3026 | #endif |
---|
[825] | 3027 | } |
---|
[644] | 3028 | #if P0312_VERT_PHASE_ADJ |
---|
[825] | 3029 | for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ ) |
---|
| 3030 | { |
---|
| 3031 | UInt refLayerIdc = rpcSlice->getInterLayerPredLayerIdc(i); |
---|
| 3032 | if( rpcSlice->getSPS()->getVertPhasePositionEnableFlag(refLayerIdc) ) |
---|
[644] | 3033 | { |
---|
[825] | 3034 | READ_FLAG( uiCode, "vert_phase_position_flag" ); rpcSlice->setVertPhasePositionFlag( uiCode? true : false, refLayerIdc ); |
---|
[644] | 3035 | } |
---|
[825] | 3036 | } |
---|
[644] | 3037 | #endif |
---|
[815] | 3038 | #endif //SVC_EXTENSION |
---|
[313] | 3039 | |
---|
[825] | 3040 | if(sps->getUseSAO()) |
---|
| 3041 | { |
---|
| 3042 | READ_FLAG(uiCode, "slice_sao_luma_flag"); rpcSlice->setSaoEnabledFlag((Bool)uiCode); |
---|
[494] | 3043 | #if AUXILIARY_PICTURES |
---|
[825] | 3044 | ChromaFormat format; |
---|
[494] | 3045 | #if REPN_FORMAT_IN_VPS |
---|
[540] | 3046 | #if O0096_REP_FORMAT_INDEX |
---|
[825] | 3047 | if( sps->getLayerId() == 0 ) |
---|
| 3048 | { |
---|
| 3049 | format = sps->getChromaFormatIdc(); |
---|
| 3050 | } |
---|
| 3051 | else |
---|
| 3052 | { |
---|
| 3053 | format = rpcSlice->getVPS()->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc(); |
---|
[713] | 3054 | #if Q0195_REP_FORMAT_CLEANUP |
---|
[825] | 3055 | assert( (sps->getUpdateRepFormatFlag()==false && rpcSlice->getVPS()->getVpsNumRepFormats()==1) || rpcSlice->getVPS()->getVpsNumRepFormats() > 1 ); //conformance check |
---|
[713] | 3056 | #endif |
---|
[825] | 3057 | } |
---|
[540] | 3058 | #else |
---|
[825] | 3059 | if( ( sps->getLayerId() == 0 ) || sps->getUpdateRepFormatFlag() ) |
---|
| 3060 | { |
---|
| 3061 | format = sps->getChromaFormatIdc(); |
---|
| 3062 | } |
---|
| 3063 | else |
---|
| 3064 | { |
---|
| 3065 | format = rpcSlice->getVPS()->getVpsRepFormat( rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc(); |
---|
| 3066 | } |
---|
[540] | 3067 | #endif |
---|
[494] | 3068 | #else |
---|
[825] | 3069 | format = sps->getChromaFormatIdc(); |
---|
[494] | 3070 | #endif |
---|
[825] | 3071 | if (format != CHROMA_400) |
---|
| 3072 | { |
---|
[494] | 3073 | #endif |
---|
[313] | 3074 | READ_FLAG(uiCode, "slice_sao_chroma_flag"); rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode); |
---|
[494] | 3075 | #if AUXILIARY_PICTURES |
---|
[313] | 3076 | } |
---|
[825] | 3077 | else |
---|
[313] | 3078 | { |
---|
[825] | 3079 | rpcSlice->setSaoEnabledFlagChroma(false); |
---|
[313] | 3080 | } |
---|
[825] | 3081 | #endif |
---|
| 3082 | } |
---|
| 3083 | |
---|
| 3084 | if (rpcSlice->getIdrPicFlag()) |
---|
| 3085 | { |
---|
| 3086 | rpcSlice->setEnableTMVPFlag(false); |
---|
| 3087 | } |
---|
| 3088 | if (!rpcSlice->isIntra()) |
---|
| 3089 | { |
---|
| 3090 | |
---|
| 3091 | READ_FLAG( uiCode, "num_ref_idx_active_override_flag"); |
---|
| 3092 | if (uiCode) |
---|
[313] | 3093 | { |
---|
[825] | 3094 | READ_UVLC (uiCode, "num_ref_idx_l0_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 ); |
---|
| 3095 | if (rpcSlice->isInterB()) |
---|
[313] | 3096 | { |
---|
[825] | 3097 | READ_UVLC (uiCode, "num_ref_idx_l1_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 ); |
---|
[313] | 3098 | } |
---|
| 3099 | else |
---|
| 3100 | { |
---|
[825] | 3101 | rpcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); |
---|
[313] | 3102 | } |
---|
| 3103 | } |
---|
[825] | 3104 | else |
---|
[313] | 3105 | { |
---|
[825] | 3106 | rpcSlice->setNumRefIdx(REF_PIC_LIST_0, rpcSlice->getPPS()->getNumRefIdxL0DefaultActive()); |
---|
| 3107 | if (rpcSlice->isInterB()) |
---|
[313] | 3108 | { |
---|
[825] | 3109 | rpcSlice->setNumRefIdx(REF_PIC_LIST_1, rpcSlice->getPPS()->getNumRefIdxL1DefaultActive()); |
---|
[313] | 3110 | } |
---|
| 3111 | else |
---|
| 3112 | { |
---|
[825] | 3113 | rpcSlice->setNumRefIdx(REF_PIC_LIST_1,0); |
---|
[313] | 3114 | } |
---|
[825] | 3115 | } |
---|
| 3116 | } |
---|
| 3117 | // } |
---|
| 3118 | TComRefPicListModification* refPicListModification = rpcSlice->getRefPicListModification(); |
---|
| 3119 | if(!rpcSlice->isIntra()) |
---|
| 3120 | { |
---|
| 3121 | if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) |
---|
| 3122 | { |
---|
| 3123 | refPicListModification->setRefPicListModificationFlagL0( 0 ); |
---|
| 3124 | } |
---|
| 3125 | else |
---|
| 3126 | { |
---|
| 3127 | READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); refPicListModification->setRefPicListModificationFlagL0( uiCode ? 1 : 0 ); |
---|
| 3128 | } |
---|
[313] | 3129 | |
---|
[825] | 3130 | if(refPicListModification->getRefPicListModificationFlagL0()) |
---|
| 3131 | { |
---|
| 3132 | uiCode = 0; |
---|
| 3133 | Int i = 0; |
---|
| 3134 | Int numRpsCurrTempList0 = rpcSlice->getNumRpsCurrTempList(); |
---|
| 3135 | if ( numRpsCurrTempList0 > 1 ) |
---|
[313] | 3136 | { |
---|
[825] | 3137 | Int length = 1; |
---|
| 3138 | numRpsCurrTempList0 --; |
---|
| 3139 | while ( numRpsCurrTempList0 >>= 1) |
---|
[313] | 3140 | { |
---|
[825] | 3141 | length ++; |
---|
[313] | 3142 | } |
---|
[825] | 3143 | for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) |
---|
[313] | 3144 | { |
---|
[825] | 3145 | READ_CODE( length, uiCode, "list_entry_l0" ); |
---|
| 3146 | refPicListModification->setRefPicSetIdxL0(i, uiCode ); |
---|
[313] | 3147 | } |
---|
| 3148 | } |
---|
[825] | 3149 | else |
---|
| 3150 | { |
---|
| 3151 | for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) |
---|
| 3152 | { |
---|
| 3153 | refPicListModification->setRefPicSetIdxL0(i, 0 ); |
---|
| 3154 | } |
---|
| 3155 | } |
---|
[313] | 3156 | } |
---|
[825] | 3157 | } |
---|
| 3158 | else |
---|
| 3159 | { |
---|
| 3160 | refPicListModification->setRefPicListModificationFlagL0(0); |
---|
| 3161 | } |
---|
| 3162 | if(rpcSlice->isInterB()) |
---|
| 3163 | { |
---|
| 3164 | if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) |
---|
| 3165 | { |
---|
| 3166 | refPicListModification->setRefPicListModificationFlagL1( 0 ); |
---|
| 3167 | } |
---|
[313] | 3168 | else |
---|
| 3169 | { |
---|
[825] | 3170 | READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); refPicListModification->setRefPicListModificationFlagL1( uiCode ? 1 : 0 ); |
---|
[313] | 3171 | } |
---|
[825] | 3172 | if(refPicListModification->getRefPicListModificationFlagL1()) |
---|
[313] | 3173 | { |
---|
[825] | 3174 | uiCode = 0; |
---|
| 3175 | Int i = 0; |
---|
| 3176 | Int numRpsCurrTempList1 = rpcSlice->getNumRpsCurrTempList(); |
---|
| 3177 | if ( numRpsCurrTempList1 > 1 ) |
---|
[313] | 3178 | { |
---|
[825] | 3179 | Int length = 1; |
---|
| 3180 | numRpsCurrTempList1 --; |
---|
| 3181 | while ( numRpsCurrTempList1 >>= 1) |
---|
| 3182 | { |
---|
| 3183 | length ++; |
---|
| 3184 | } |
---|
| 3185 | for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) |
---|
| 3186 | { |
---|
| 3187 | READ_CODE( length, uiCode, "list_entry_l1" ); |
---|
| 3188 | refPicListModification->setRefPicSetIdxL1(i, uiCode ); |
---|
| 3189 | } |
---|
[313] | 3190 | } |
---|
| 3191 | else |
---|
| 3192 | { |
---|
[825] | 3193 | for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) |
---|
[313] | 3194 | { |
---|
[825] | 3195 | refPicListModification->setRefPicSetIdxL1(i, 0 ); |
---|
[313] | 3196 | } |
---|
| 3197 | } |
---|
| 3198 | } |
---|
[825] | 3199 | } |
---|
| 3200 | else |
---|
| 3201 | { |
---|
| 3202 | refPicListModification->setRefPicListModificationFlagL1(0); |
---|
| 3203 | } |
---|
| 3204 | if (rpcSlice->isInterB()) |
---|
| 3205 | { |
---|
| 3206 | READ_FLAG( uiCode, "mvd_l1_zero_flag" ); rpcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) ); |
---|
| 3207 | } |
---|
| 3208 | |
---|
| 3209 | rpcSlice->setCabacInitFlag( false ); // default |
---|
| 3210 | if(pps->getCabacInitPresentFlag() && !rpcSlice->isIntra()) |
---|
| 3211 | { |
---|
| 3212 | READ_FLAG(uiCode, "cabac_init_flag"); |
---|
| 3213 | rpcSlice->setCabacInitFlag( uiCode ? true : false ); |
---|
| 3214 | } |
---|
| 3215 | |
---|
| 3216 | if ( rpcSlice->getEnableTMVPFlag() ) |
---|
| 3217 | { |
---|
| 3218 | #if SVC_EXTENSION && REF_IDX_MFM |
---|
| 3219 | // set motion mapping flag |
---|
| 3220 | rpcSlice->setMFMEnabledFlag( ( rpcSlice->getNumMotionPredRefLayers() > 0 && rpcSlice->getActiveNumILRRefIdx() && !rpcSlice->isIntra() ) ? true : false ); |
---|
| 3221 | #endif |
---|
| 3222 | if ( rpcSlice->getSliceType() == B_SLICE ) |
---|
[313] | 3223 | { |
---|
[825] | 3224 | READ_FLAG( uiCode, "collocated_from_l0_flag" ); |
---|
| 3225 | rpcSlice->setColFromL0Flag(uiCode); |
---|
[313] | 3226 | } |
---|
[825] | 3227 | else |
---|
[313] | 3228 | { |
---|
[825] | 3229 | rpcSlice->setColFromL0Flag( 1 ); |
---|
[313] | 3230 | } |
---|
| 3231 | |
---|
[825] | 3232 | if ( rpcSlice->getSliceType() != I_SLICE && |
---|
| 3233 | ((rpcSlice->getColFromL0Flag() == 1 && rpcSlice->getNumRefIdx(REF_PIC_LIST_0) > 1)|| |
---|
| 3234 | (rpcSlice->getColFromL0Flag() == 0 && rpcSlice->getNumRefIdx(REF_PIC_LIST_1) > 1))) |
---|
[313] | 3235 | { |
---|
[825] | 3236 | READ_UVLC( uiCode, "collocated_ref_idx" ); |
---|
| 3237 | rpcSlice->setColRefIdx(uiCode); |
---|
[313] | 3238 | } |
---|
[825] | 3239 | else |
---|
[313] | 3240 | { |
---|
[825] | 3241 | rpcSlice->setColRefIdx(0); |
---|
[313] | 3242 | } |
---|
[825] | 3243 | } |
---|
| 3244 | if ( (pps->getUseWP() && rpcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && rpcSlice->getSliceType()==B_SLICE) ) |
---|
| 3245 | { |
---|
| 3246 | xParsePredWeightTable(rpcSlice); |
---|
| 3247 | rpcSlice->initWpScaling(); |
---|
| 3248 | } |
---|
| 3249 | if (!rpcSlice->isIntra()) |
---|
| 3250 | { |
---|
| 3251 | READ_UVLC( uiCode, "five_minus_max_num_merge_cand"); |
---|
| 3252 | rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); |
---|
| 3253 | } |
---|
[313] | 3254 | |
---|
[825] | 3255 | READ_SVLC( iCode, "slice_qp_delta" ); |
---|
| 3256 | rpcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); |
---|
[313] | 3257 | |
---|
[442] | 3258 | #if REPN_FORMAT_IN_VPS |
---|
[494] | 3259 | #if O0194_DIFFERENT_BITDEPTH_EL_BL |
---|
[825] | 3260 | g_bitDepthYLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthY(); |
---|
| 3261 | g_bitDepthCLayer[rpcSlice->getLayerId()] = rpcSlice->getBitDepthC(); |
---|
[494] | 3262 | #endif |
---|
[825] | 3263 | assert( rpcSlice->getSliceQp() >= -rpcSlice->getQpBDOffsetY() ); |
---|
[442] | 3264 | #else |
---|
[825] | 3265 | assert( rpcSlice->getSliceQp() >= -sps->getQpBDOffsetY() ); |
---|
[442] | 3266 | #endif |
---|
[825] | 3267 | assert( rpcSlice->getSliceQp() <= 51 ); |
---|
[313] | 3268 | |
---|
[825] | 3269 | if (rpcSlice->getPPS()->getSliceChromaQpFlag()) |
---|
| 3270 | { |
---|
| 3271 | READ_SVLC( iCode, "slice_qp_delta_cb" ); |
---|
| 3272 | rpcSlice->setSliceQpDeltaCb( iCode ); |
---|
| 3273 | assert( rpcSlice->getSliceQpDeltaCb() >= -12 ); |
---|
| 3274 | assert( rpcSlice->getSliceQpDeltaCb() <= 12 ); |
---|
| 3275 | assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) >= -12 ); |
---|
| 3276 | assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) <= 12 ); |
---|
[313] | 3277 | |
---|
[825] | 3278 | READ_SVLC( iCode, "slice_qp_delta_cr" ); |
---|
| 3279 | rpcSlice->setSliceQpDeltaCr( iCode ); |
---|
| 3280 | assert( rpcSlice->getSliceQpDeltaCr() >= -12 ); |
---|
| 3281 | assert( rpcSlice->getSliceQpDeltaCr() <= 12 ); |
---|
| 3282 | assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) >= -12 ); |
---|
| 3283 | assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) <= 12 ); |
---|
| 3284 | } |
---|
[313] | 3285 | |
---|
[825] | 3286 | if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) |
---|
| 3287 | { |
---|
| 3288 | if(rpcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag()) |
---|
[313] | 3289 | { |
---|
[825] | 3290 | READ_FLAG ( uiCode, "deblocking_filter_override_flag" ); rpcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false); |
---|
[313] | 3291 | } |
---|
| 3292 | else |
---|
| 3293 | { |
---|
[825] | 3294 | rpcSlice->setDeblockingFilterOverrideFlag(0); |
---|
[313] | 3295 | } |
---|
[825] | 3296 | if(rpcSlice->getDeblockingFilterOverrideFlag()) |
---|
[313] | 3297 | { |
---|
[825] | 3298 | READ_FLAG ( uiCode, "slice_disable_deblocking_filter_flag" ); rpcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0); |
---|
| 3299 | if(!rpcSlice->getDeblockingFilterDisable()) |
---|
| 3300 | { |
---|
| 3301 | READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); |
---|
| 3302 | assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && |
---|
| 3303 | rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); |
---|
| 3304 | READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); |
---|
| 3305 | assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && |
---|
| 3306 | rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); |
---|
| 3307 | } |
---|
[313] | 3308 | } |
---|
| 3309 | else |
---|
| 3310 | { |
---|
[825] | 3311 | rpcSlice->setDeblockingFilterDisable ( rpcSlice->getPPS()->getPicDisableDeblockingFilterFlag() ); |
---|
| 3312 | rpcSlice->setDeblockingFilterBetaOffsetDiv2( rpcSlice->getPPS()->getDeblockingFilterBetaOffsetDiv2() ); |
---|
| 3313 | rpcSlice->setDeblockingFilterTcOffsetDiv2 ( rpcSlice->getPPS()->getDeblockingFilterTcOffsetDiv2() ); |
---|
[313] | 3314 | } |
---|
| 3315 | } |
---|
[825] | 3316 | else |
---|
| 3317 | { |
---|
| 3318 | rpcSlice->setDeblockingFilterDisable ( false ); |
---|
| 3319 | rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); |
---|
| 3320 | rpcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 ); |
---|
| 3321 | } |
---|
[313] | 3322 | |
---|
[825] | 3323 | Bool isSAOEnabled = (!rpcSlice->getSPS()->getUseSAO())?(false):(rpcSlice->getSaoEnabledFlag()||rpcSlice->getSaoEnabledFlagChroma()); |
---|
| 3324 | Bool isDBFEnabled = (!rpcSlice->getDeblockingFilterDisable()); |
---|
| 3325 | |
---|
| 3326 | if(rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) |
---|
[313] | 3327 | { |
---|
[825] | 3328 | READ_FLAG( uiCode, "slice_loop_filter_across_slices_enabled_flag"); |
---|
[313] | 3329 | } |
---|
| 3330 | else |
---|
| 3331 | { |
---|
[825] | 3332 | uiCode = rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()?1:0; |
---|
[313] | 3333 | } |
---|
[825] | 3334 | rpcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false); |
---|
[313] | 3335 | |
---|
[825] | 3336 | } |
---|
| 3337 | |
---|
| 3338 | UInt *entryPointOffset = NULL; |
---|
| 3339 | UInt numEntryPointOffsets, offsetLenMinus1; |
---|
| 3340 | if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) |
---|
| 3341 | { |
---|
| 3342 | READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); |
---|
| 3343 | if (numEntryPointOffsets>0) |
---|
| 3344 | { |
---|
| 3345 | READ_UVLC(offsetLenMinus1, "offset_len_minus1"); |
---|
| 3346 | } |
---|
| 3347 | entryPointOffset = new UInt[numEntryPointOffsets]; |
---|
| 3348 | for (UInt idx=0; idx<numEntryPointOffsets; idx++) |
---|
| 3349 | { |
---|
| 3350 | READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); |
---|
| 3351 | entryPointOffset[ idx ] = uiCode + 1; |
---|
| 3352 | } |
---|
| 3353 | } |
---|
| 3354 | else |
---|
| 3355 | { |
---|
| 3356 | rpcSlice->setNumEntryPointOffsets ( 0 ); |
---|
| 3357 | } |
---|
| 3358 | |
---|
[644] | 3359 | #if POC_RESET_IDC_SIGNALLING |
---|
[825] | 3360 | Int sliceHeaderExtensionLength = 0; |
---|
| 3361 | if(pps->getSliceHeaderExtensionPresentFlag()) |
---|
| 3362 | { |
---|
| 3363 | READ_UVLC( uiCode, "slice_header_extension_length"); sliceHeaderExtensionLength = uiCode; |
---|
| 3364 | } |
---|
| 3365 | else |
---|
| 3366 | { |
---|
| 3367 | sliceHeaderExtensionLength = 0; |
---|
| 3368 | } |
---|
| 3369 | UInt startBits = m_pcBitstream->getNumBitsRead(); // Start counter of # SH Extn bits |
---|
| 3370 | if( sliceHeaderExtensionLength > 0 ) |
---|
| 3371 | { |
---|
| 3372 | if( rpcSlice->getPPS()->getPocResetInfoPresentFlag() ) |
---|
[313] | 3373 | { |
---|
[825] | 3374 | READ_CODE( 2, uiCode, "poc_reset_idc"); rpcSlice->setPocResetIdc(uiCode); |
---|
[644] | 3375 | } |
---|
| 3376 | else |
---|
| 3377 | { |
---|
[825] | 3378 | rpcSlice->setPocResetIdc( 0 ); |
---|
[644] | 3379 | } |
---|
[825] | 3380 | #if Q0142_POC_LSB_NOT_PRESENT |
---|
| 3381 | if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && iPOClsb > 0 ) |
---|
[644] | 3382 | { |
---|
[825] | 3383 | assert( rpcSlice->getPocResetIdc() != 2 ); |
---|
| 3384 | } |
---|
| 3385 | #endif |
---|
| 3386 | if( rpcSlice->getPocResetIdc() > 0 ) |
---|
| 3387 | { |
---|
| 3388 | READ_CODE(6, uiCode, "poc_reset_period_id"); rpcSlice->setPocResetPeriodId(uiCode); |
---|
| 3389 | } |
---|
| 3390 | else |
---|
| 3391 | { |
---|
| 3392 | |
---|
| 3393 | rpcSlice->setPocResetPeriodId( 0 ); |
---|
| 3394 | } |
---|
| 3395 | |
---|
| 3396 | if (rpcSlice->getPocResetIdc() == 3) |
---|
| 3397 | { |
---|
| 3398 | READ_FLAG( uiCode, "full_poc_reset_flag"); rpcSlice->setFullPocResetFlag((uiCode == 1) ? true : false); |
---|
| 3399 | READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode,"poc_lsb_val"); rpcSlice->setPocLsbVal(uiCode); |
---|
[815] | 3400 | #if Q0142_POC_LSB_NOT_PRESENT |
---|
[825] | 3401 | if ( rpcSlice->getVPS()->getPocLsbNotPresentFlag(rpcSlice->getLayerId()) && rpcSlice->getFullPocResetFlag() ) |
---|
[815] | 3402 | { |
---|
[825] | 3403 | assert( rpcSlice->getPocLsbVal() == 0 ); |
---|
[815] | 3404 | } |
---|
| 3405 | #endif |
---|
[825] | 3406 | } |
---|
| 3407 | |
---|
| 3408 | // Derive the value of PocMsbValRequiredFlag |
---|
| 3409 | rpcSlice->setPocMsbValRequiredFlag( rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag() |
---|
| 3410 | /* || related to vps_poc_lsb_aligned_flag */ |
---|
| 3411 | ); |
---|
| 3412 | |
---|
| 3413 | if( !rpcSlice->getPocMsbValRequiredFlag() /* vps_poc_lsb_aligned_flag */ ) |
---|
| 3414 | { |
---|
| 3415 | READ_FLAG( uiCode, "poc_msb_val_present_flag"); rpcSlice->setPocMsbValPresentFlag( uiCode ? true : false ); |
---|
| 3416 | } |
---|
| 3417 | else |
---|
| 3418 | { |
---|
| 3419 | #if POC_MSB_VAL_PRESENT_FLAG_SEM |
---|
| 3420 | if( sliceHeaderExtensionLength == 0 ) |
---|
[644] | 3421 | { |
---|
[825] | 3422 | rpcSlice->setPocMsbValPresentFlag( false ); |
---|
[644] | 3423 | } |
---|
[825] | 3424 | else if( rpcSlice->getPocMsbValRequiredFlag() ) |
---|
| 3425 | #else |
---|
| 3426 | if( rpcSlice->getPocMsbValRequiredFlag() ) |
---|
[815] | 3427 | #endif |
---|
[644] | 3428 | { |
---|
[825] | 3429 | rpcSlice->setPocMsbValPresentFlag( true ); |
---|
[644] | 3430 | } |
---|
| 3431 | else |
---|
| 3432 | { |
---|
[825] | 3433 | rpcSlice->setPocMsbValPresentFlag( false ); |
---|
[644] | 3434 | } |
---|
[825] | 3435 | } |
---|
[644] | 3436 | |
---|
[815] | 3437 | #if !POC_RESET_IDC_DECODER |
---|
[825] | 3438 | Int maxPocLsb = 1 << rpcSlice->getSPS()->getBitsForPOC(); |
---|
[815] | 3439 | #endif |
---|
[825] | 3440 | if( rpcSlice->getPocMsbValPresentFlag() ) |
---|
| 3441 | { |
---|
| 3442 | READ_UVLC( uiCode, "poc_msb_val"); rpcSlice->setPocMsbVal( uiCode ); |
---|
[815] | 3443 | |
---|
| 3444 | #if !POC_RESET_IDC_DECODER |
---|
[825] | 3445 | // Update POC of the slice based on this MSB val |
---|
| 3446 | Int pocLsb = rpcSlice->getPOC() % maxPocLsb; |
---|
| 3447 | rpcSlice->setPOC((rpcSlice->getPocMsbVal() * maxPocLsb) + pocLsb); |
---|
| 3448 | } |
---|
| 3449 | else |
---|
| 3450 | { |
---|
| 3451 | rpcSlice->setPocMsbVal( rpcSlice->getPOC() / maxPocLsb ); |
---|
[815] | 3452 | #endif |
---|
[825] | 3453 | } |
---|
[644] | 3454 | |
---|
[825] | 3455 | // Read remaining bits in the slice header extension. |
---|
| 3456 | UInt endBits = m_pcBitstream->getNumBitsRead(); |
---|
| 3457 | Int counter = (endBits - startBits) % 8; |
---|
| 3458 | if( counter ) |
---|
| 3459 | { |
---|
| 3460 | counter = 8 - counter; |
---|
| 3461 | } |
---|
[644] | 3462 | |
---|
[825] | 3463 | while( counter ) |
---|
| 3464 | { |
---|
[815] | 3465 | #if Q0146_SSH_EXT_DATA_BIT |
---|
[825] | 3466 | READ_FLAG( uiCode, "slice_segment_header_extension_data_bit" ); |
---|
[815] | 3467 | #else |
---|
[825] | 3468 | READ_FLAG( uiCode, "slice_segment_header_extension_reserved_bit" ); assert( uiCode == 1 ); |
---|
[815] | 3469 | #endif |
---|
[825] | 3470 | counter--; |
---|
[644] | 3471 | } |
---|
[825] | 3472 | } |
---|
[644] | 3473 | #else |
---|
[825] | 3474 | if(pps->getSliceHeaderExtensionPresentFlag()) |
---|
| 3475 | { |
---|
| 3476 | READ_UVLC(uiCode,"slice_header_extension_length"); |
---|
| 3477 | for(Int i=0; i<uiCode; i++) |
---|
[644] | 3478 | { |
---|
[825] | 3479 | UInt ignore; |
---|
| 3480 | READ_CODE(8,ignore,"slice_header_extension_data_byte"); |
---|
| 3481 | } |
---|
| 3482 | } |
---|
| 3483 | #endif |
---|
| 3484 | m_pcBitstream->readByteAlignment(); |
---|
| 3485 | |
---|
| 3486 | if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) |
---|
| 3487 | { |
---|
| 3488 | Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); |
---|
| 3489 | |
---|
| 3490 | // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header |
---|
| 3491 | for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) |
---|
| 3492 | { |
---|
| 3493 | if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation ) |
---|
[313] | 3494 | { |
---|
[825] | 3495 | endOfSliceHeaderLocation++; |
---|
[313] | 3496 | } |
---|
| 3497 | } |
---|
| 3498 | |
---|
[825] | 3499 | Int curEntryPointOffset = 0; |
---|
| 3500 | Int prevEntryPointOffset = 0; |
---|
| 3501 | for (UInt idx=0; idx<numEntryPointOffsets; idx++) |
---|
[313] | 3502 | { |
---|
[825] | 3503 | curEntryPointOffset += entryPointOffset[ idx ]; |
---|
[494] | 3504 | |
---|
[825] | 3505 | Int emulationPreventionByteCount = 0; |
---|
[313] | 3506 | for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) |
---|
| 3507 | { |
---|
[825] | 3508 | if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && |
---|
| 3509 | m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) |
---|
[313] | 3510 | { |
---|
[825] | 3511 | emulationPreventionByteCount++; |
---|
[313] | 3512 | } |
---|
| 3513 | } |
---|
| 3514 | |
---|
[825] | 3515 | entryPointOffset[ idx ] -= emulationPreventionByteCount; |
---|
| 3516 | prevEntryPointOffset = curEntryPointOffset; |
---|
| 3517 | } |
---|
[313] | 3518 | |
---|
[825] | 3519 | if ( pps->getTilesEnabledFlag() ) |
---|
| 3520 | { |
---|
| 3521 | rpcSlice->setTileLocationCount( numEntryPointOffsets ); |
---|
[313] | 3522 | |
---|
[825] | 3523 | UInt prevPos = 0; |
---|
| 3524 | for (Int idx=0; idx<rpcSlice->getTileLocationCount(); idx++) |
---|
| 3525 | { |
---|
| 3526 | rpcSlice->setTileLocation( idx, prevPos + entryPointOffset [ idx ] ); |
---|
| 3527 | prevPos += entryPointOffset[ idx ]; |
---|
[313] | 3528 | } |
---|
[825] | 3529 | } |
---|
| 3530 | else if ( pps->getEntropyCodingSyncEnabledFlag() ) |
---|
| 3531 | { |
---|
| 3532 | Int numSubstreams = rpcSlice->getNumEntryPointOffsets()+1; |
---|
| 3533 | rpcSlice->allocSubstreamSizes(numSubstreams); |
---|
| 3534 | UInt *pSubstreamSizes = rpcSlice->getSubstreamSizes(); |
---|
| 3535 | for (Int idx=0; idx<numSubstreams-1; idx++) |
---|
[313] | 3536 | { |
---|
[825] | 3537 | if ( idx < numEntryPointOffsets ) |
---|
[313] | 3538 | { |
---|
[825] | 3539 | pSubstreamSizes[ idx ] = ( entryPointOffset[ idx ] << 3 ) ; |
---|
[313] | 3540 | } |
---|
[825] | 3541 | else |
---|
[313] | 3542 | { |
---|
[825] | 3543 | pSubstreamSizes[ idx ] = 0; |
---|
[313] | 3544 | } |
---|
| 3545 | } |
---|
[825] | 3546 | } |
---|
[313] | 3547 | |
---|
[825] | 3548 | if (entryPointOffset) |
---|
| 3549 | { |
---|
| 3550 | delete [] entryPointOffset; |
---|
[313] | 3551 | } |
---|
[825] | 3552 | } |
---|
[313] | 3553 | |
---|
[825] | 3554 | return; |
---|
[313] | 3555 | } |
---|
| 3556 | |
---|
| 3557 | Void TDecCavlc::parsePTL( TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1 ) |
---|
| 3558 | { |
---|
| 3559 | UInt uiCode; |
---|
| 3560 | if(profilePresentFlag) |
---|
| 3561 | { |
---|
| 3562 | parseProfileTier(rpcPTL->getGeneralPTL()); |
---|
| 3563 | } |
---|
| 3564 | READ_CODE( 8, uiCode, "general_level_idc" ); rpcPTL->getGeneralPTL()->setLevelIdc(uiCode); |
---|
| 3565 | |
---|
| 3566 | for (Int i = 0; i < maxNumSubLayersMinus1; i++) |
---|
| 3567 | { |
---|
| 3568 | if(profilePresentFlag) |
---|
| 3569 | { |
---|
| 3570 | READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode); |
---|
| 3571 | } |
---|
| 3572 | READ_FLAG( uiCode, "sub_layer_level_present_flag[i]" ); rpcPTL->setSubLayerLevelPresentFlag (i, uiCode); |
---|
| 3573 | } |
---|
| 3574 | |
---|
| 3575 | if (maxNumSubLayersMinus1 > 0) |
---|
| 3576 | { |
---|
| 3577 | for (Int i = maxNumSubLayersMinus1; i < 8; i++) |
---|
| 3578 | { |
---|
| 3579 | READ_CODE(2, uiCode, "reserved_zero_2bits"); |
---|
| 3580 | assert(uiCode == 0); |
---|
| 3581 | } |
---|
| 3582 | } |
---|
| 3583 | |
---|
| 3584 | for(Int i = 0; i < maxNumSubLayersMinus1; i++) |
---|
| 3585 | { |
---|
| 3586 | if( profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) ) |
---|
| 3587 | { |
---|
| 3588 | parseProfileTier(rpcPTL->getSubLayerPTL(i)); |
---|
| 3589 | } |
---|
| 3590 | if(rpcPTL->getSubLayerLevelPresentFlag(i)) |
---|
| 3591 | { |
---|
| 3592 | READ_CODE( 8, uiCode, "sub_layer_level_idc[i]" ); rpcPTL->getSubLayerPTL(i)->setLevelIdc(uiCode); |
---|
| 3593 | } |
---|
| 3594 | } |
---|
| 3595 | } |
---|
| 3596 | |
---|
| 3597 | Void TDecCavlc::parseProfileTier(ProfileTierLevel *ptl) |
---|
| 3598 | { |
---|
| 3599 | UInt uiCode; |
---|
| 3600 | READ_CODE(2 , uiCode, "XXX_profile_space[]"); ptl->setProfileSpace(uiCode); |
---|
| 3601 | READ_FLAG( uiCode, "XXX_tier_flag[]" ); ptl->setTierFlag (uiCode ? 1 : 0); |
---|
| 3602 | READ_CODE(5 , uiCode, "XXX_profile_idc[]" ); ptl->setProfileIdc (uiCode); |
---|
| 3603 | for(Int j = 0; j < 32; j++) |
---|
| 3604 | { |
---|
| 3605 | READ_FLAG( uiCode, "XXX_profile_compatibility_flag[][j]"); ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0); |
---|
| 3606 | } |
---|
| 3607 | READ_FLAG(uiCode, "general_progressive_source_flag"); |
---|
| 3608 | ptl->setProgressiveSourceFlag(uiCode ? true : false); |
---|
| 3609 | |
---|
| 3610 | READ_FLAG(uiCode, "general_interlaced_source_flag"); |
---|
| 3611 | ptl->setInterlacedSourceFlag(uiCode ? true : false); |
---|
| 3612 | |
---|
| 3613 | READ_FLAG(uiCode, "general_non_packed_constraint_flag"); |
---|
| 3614 | ptl->setNonPackedConstraintFlag(uiCode ? true : false); |
---|
| 3615 | |
---|
| 3616 | READ_FLAG(uiCode, "general_frame_only_constraint_flag"); |
---|
| 3617 | ptl->setFrameOnlyConstraintFlag(uiCode ? true : false); |
---|
| 3618 | |
---|
| 3619 | READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[0..15]"); |
---|
| 3620 | READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[16..31]"); |
---|
| 3621 | READ_CODE(12, uiCode, "XXX_reserved_zero_44bits[32..43]"); |
---|
| 3622 | } |
---|
| 3623 | |
---|
| 3624 | Void TDecCavlc::parseTerminatingBit( UInt& ruiBit ) |
---|
| 3625 | { |
---|
| 3626 | ruiBit = false; |
---|
| 3627 | Int iBitsLeft = m_pcBitstream->getNumBitsLeft(); |
---|
| 3628 | if(iBitsLeft <= 8) |
---|
| 3629 | { |
---|
| 3630 | UInt uiPeekValue = m_pcBitstream->peekBits(iBitsLeft); |
---|
| 3631 | if (uiPeekValue == (1<<(iBitsLeft-1))) |
---|
| 3632 | { |
---|
| 3633 | ruiBit = true; |
---|
| 3634 | } |
---|
| 3635 | } |
---|
| 3636 | } |
---|
| 3637 | |
---|
| 3638 | Void TDecCavlc::parseSkipFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 3639 | { |
---|
| 3640 | assert(0); |
---|
| 3641 | } |
---|
| 3642 | |
---|
| 3643 | Void TDecCavlc::parseCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 3644 | { |
---|
| 3645 | assert(0); |
---|
| 3646 | } |
---|
| 3647 | |
---|
| 3648 | Void TDecCavlc::parseMVPIdx( Int& /*riMVPIdx*/ ) |
---|
| 3649 | { |
---|
| 3650 | assert(0); |
---|
| 3651 | } |
---|
| 3652 | |
---|
| 3653 | Void TDecCavlc::parseSplitFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 3654 | { |
---|
| 3655 | assert(0); |
---|
| 3656 | } |
---|
| 3657 | |
---|
| 3658 | Void TDecCavlc::parsePartSize( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 3659 | { |
---|
| 3660 | assert(0); |
---|
| 3661 | } |
---|
| 3662 | |
---|
| 3663 | Void TDecCavlc::parsePredMode( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 3664 | { |
---|
| 3665 | assert(0); |
---|
| 3666 | } |
---|
| 3667 | |
---|
| 3668 | /** Parse I_PCM information. |
---|
| 3669 | * \param pcCU pointer to CU |
---|
| 3670 | * \param uiAbsPartIdx CU index |
---|
| 3671 | * \param uiDepth CU depth |
---|
| 3672 | * \returns Void |
---|
| 3673 | * |
---|
| 3674 | * If I_PCM flag indicates that the CU is I_PCM, parse its PCM alignment bits and codes. |
---|
| 3675 | */ |
---|
| 3676 | Void TDecCavlc::parseIPCMInfo( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 3677 | { |
---|
| 3678 | assert(0); |
---|
| 3679 | } |
---|
| 3680 | |
---|
| 3681 | Void TDecCavlc::parseIntraDirLumaAng ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 3682 | { |
---|
| 3683 | assert(0); |
---|
| 3684 | } |
---|
| 3685 | |
---|
| 3686 | Void TDecCavlc::parseIntraDirChroma( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 3687 | { |
---|
| 3688 | assert(0); |
---|
| 3689 | } |
---|
| 3690 | |
---|
| 3691 | Void TDecCavlc::parseInterDir( TComDataCU* /*pcCU*/, UInt& /*ruiInterDir*/, UInt /*uiAbsPartIdx*/ ) |
---|
| 3692 | { |
---|
| 3693 | assert(0); |
---|
| 3694 | } |
---|
| 3695 | |
---|
| 3696 | Void TDecCavlc::parseRefFrmIdx( TComDataCU* /*pcCU*/, Int& /*riRefFrmIdx*/, RefPicList /*eRefList*/ ) |
---|
| 3697 | { |
---|
| 3698 | assert(0); |
---|
| 3699 | } |
---|
| 3700 | |
---|
| 3701 | Void TDecCavlc::parseMvd( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiPartIdx*/, UInt /*uiDepth*/, RefPicList /*eRefList*/ ) |
---|
| 3702 | { |
---|
| 3703 | assert(0); |
---|
| 3704 | } |
---|
| 3705 | |
---|
| 3706 | Void TDecCavlc::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 3707 | { |
---|
| 3708 | Int qp; |
---|
| 3709 | Int iDQp; |
---|
| 3710 | |
---|
| 3711 | xReadSvlc( iDQp ); |
---|
| 3712 | |
---|
[442] | 3713 | #if REPN_FORMAT_IN_VPS |
---|
| 3714 | Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffsetY(); |
---|
| 3715 | #else |
---|
[313] | 3716 | Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); |
---|
[442] | 3717 | #endif |
---|
[313] | 3718 | qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) - qpBdOffsetY; |
---|
| 3719 | |
---|
| 3720 | UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>((g_uiMaxCUDepth - pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())<<1))<<((g_uiMaxCUDepth - pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())<<1) ; |
---|
| 3721 | UInt uiQpCUDepth = min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ; |
---|
| 3722 | |
---|
| 3723 | pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth ); |
---|
| 3724 | } |
---|
| 3725 | |
---|
| 3726 | Void TDecCavlc::parseCoeffNxN( TComDataCU* /*pcCU*/, TCoeff* /*pcCoef*/, UInt /*uiAbsPartIdx*/, UInt /*uiWidth*/, UInt /*uiHeight*/, UInt /*uiDepth*/, TextType /*eTType*/ ) |
---|
| 3727 | { |
---|
| 3728 | assert(0); |
---|
| 3729 | } |
---|
| 3730 | |
---|
| 3731 | Void TDecCavlc::parseTransformSubdivFlag( UInt& /*ruiSubdivFlag*/, UInt /*uiLog2TransformBlockSize*/ ) |
---|
| 3732 | { |
---|
| 3733 | assert(0); |
---|
| 3734 | } |
---|
| 3735 | |
---|
| 3736 | Void TDecCavlc::parseQtCbf( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, TextType /*eType*/, UInt /*uiTrDepth*/, UInt /*uiDepth*/ ) |
---|
| 3737 | { |
---|
| 3738 | assert(0); |
---|
| 3739 | } |
---|
| 3740 | |
---|
| 3741 | Void TDecCavlc::parseQtRootCbf( UInt /*uiAbsPartIdx*/, UInt& /*uiQtRootCbf*/ ) |
---|
| 3742 | { |
---|
| 3743 | assert(0); |
---|
| 3744 | } |
---|
| 3745 | |
---|
| 3746 | Void TDecCavlc::parseTransformSkipFlags (TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*width*/, UInt /*height*/, UInt /*uiDepth*/, TextType /*eTType*/) |
---|
| 3747 | { |
---|
| 3748 | assert(0); |
---|
| 3749 | } |
---|
| 3750 | |
---|
| 3751 | Void TDecCavlc::parseMergeFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/, UInt /*uiPUIdx*/ ) |
---|
| 3752 | { |
---|
| 3753 | assert(0); |
---|
| 3754 | } |
---|
| 3755 | |
---|
| 3756 | Void TDecCavlc::parseMergeIndex ( TComDataCU* /*pcCU*/, UInt& /*ruiMergeIndex*/ ) |
---|
| 3757 | { |
---|
| 3758 | assert(0); |
---|
| 3759 | } |
---|
| 3760 | |
---|
| 3761 | // ==================================================================================================================== |
---|
| 3762 | // Protected member functions |
---|
| 3763 | // ==================================================================================================================== |
---|
| 3764 | |
---|
| 3765 | /** parse explicit wp tables |
---|
| 3766 | * \param TComSlice* pcSlice |
---|
| 3767 | * \returns Void |
---|
| 3768 | */ |
---|
| 3769 | Void TDecCavlc::xParsePredWeightTable( TComSlice* pcSlice ) |
---|
| 3770 | { |
---|
| 3771 | wpScalingParam *wp; |
---|
| 3772 | Bool bChroma = true; // color always present in HEVC ? |
---|
| 3773 | SliceType eSliceType = pcSlice->getSliceType(); |
---|
| 3774 | Int iNbRef = (eSliceType == B_SLICE ) ? (2) : (1); |
---|
[494] | 3775 | #if SVC_EXTENSION |
---|
| 3776 | UInt uiLog2WeightDenomLuma = 0, uiLog2WeightDenomChroma = 0; |
---|
| 3777 | #else |
---|
[313] | 3778 | UInt uiLog2WeightDenomLuma, uiLog2WeightDenomChroma; |
---|
[494] | 3779 | #endif |
---|
[313] | 3780 | UInt uiTotalSignalledWeightFlags = 0; |
---|
| 3781 | |
---|
| 3782 | Int iDeltaDenom; |
---|
[494] | 3783 | #if AUXILIARY_PICTURES |
---|
| 3784 | if (pcSlice->getChromaFormatIdc() == CHROMA_400) |
---|
| 3785 | { |
---|
| 3786 | bChroma = false; |
---|
| 3787 | } |
---|
| 3788 | #endif |
---|
[313] | 3789 | // decode delta_luma_log2_weight_denom : |
---|
| 3790 | READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom |
---|
| 3791 | assert( uiLog2WeightDenomLuma <= 7 ); |
---|
| 3792 | if( bChroma ) |
---|
| 3793 | { |
---|
| 3794 | READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom |
---|
| 3795 | assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); |
---|
| 3796 | assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7); |
---|
| 3797 | uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); |
---|
| 3798 | } |
---|
| 3799 | |
---|
| 3800 | for ( Int iNumRef=0 ; iNumRef<iNbRef ; iNumRef++ ) |
---|
| 3801 | { |
---|
| 3802 | RefPicList eRefPicList = ( iNumRef ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); |
---|
| 3803 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
| 3804 | { |
---|
| 3805 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
| 3806 | |
---|
| 3807 | wp[0].uiLog2WeightDenom = uiLog2WeightDenomLuma; |
---|
[494] | 3808 | #if AUXILIARY_PICTURES |
---|
| 3809 | if (!bChroma) |
---|
| 3810 | { |
---|
| 3811 | wp[1].uiLog2WeightDenom = 0; |
---|
| 3812 | wp[2].uiLog2WeightDenom = 0; |
---|
| 3813 | } |
---|
| 3814 | else |
---|
| 3815 | { |
---|
| 3816 | #endif |
---|
[825] | 3817 | wp[1].uiLog2WeightDenom = uiLog2WeightDenomChroma; |
---|
| 3818 | wp[2].uiLog2WeightDenom = uiLog2WeightDenomChroma; |
---|
[494] | 3819 | #if AUXILIARY_PICTURES |
---|
| 3820 | } |
---|
| 3821 | #endif |
---|
[313] | 3822 | |
---|
| 3823 | UInt uiCode; |
---|
| 3824 | READ_FLAG( uiCode, "luma_weight_lX_flag" ); // u(1): luma_weight_l0_flag |
---|
| 3825 | wp[0].bPresentFlag = ( uiCode == 1 ); |
---|
| 3826 | uiTotalSignalledWeightFlags += wp[0].bPresentFlag; |
---|
| 3827 | } |
---|
| 3828 | if ( bChroma ) |
---|
| 3829 | { |
---|
| 3830 | UInt uiCode; |
---|
| 3831 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
| 3832 | { |
---|
| 3833 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
| 3834 | READ_FLAG( uiCode, "chroma_weight_lX_flag" ); // u(1): chroma_weight_l0_flag |
---|
| 3835 | wp[1].bPresentFlag = ( uiCode == 1 ); |
---|
| 3836 | wp[2].bPresentFlag = ( uiCode == 1 ); |
---|
| 3837 | uiTotalSignalledWeightFlags += 2*wp[1].bPresentFlag; |
---|
| 3838 | } |
---|
| 3839 | } |
---|
| 3840 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
| 3841 | { |
---|
| 3842 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
| 3843 | if ( wp[0].bPresentFlag ) |
---|
| 3844 | { |
---|
| 3845 | Int iDeltaWeight; |
---|
| 3846 | READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" ); // se(v): delta_luma_weight_l0[i] |
---|
| 3847 | assert( iDeltaWeight >= -128 ); |
---|
| 3848 | assert( iDeltaWeight <= 127 ); |
---|
| 3849 | wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom)); |
---|
| 3850 | READ_SVLC( wp[0].iOffset, "luma_offset_lX" ); // se(v): luma_offset_l0[i] |
---|
| 3851 | assert( wp[0].iOffset >= -128 ); |
---|
| 3852 | assert( wp[0].iOffset <= 127 ); |
---|
| 3853 | } |
---|
| 3854 | else |
---|
| 3855 | { |
---|
| 3856 | wp[0].iWeight = (1 << wp[0].uiLog2WeightDenom); |
---|
| 3857 | wp[0].iOffset = 0; |
---|
| 3858 | } |
---|
| 3859 | if ( bChroma ) |
---|
| 3860 | { |
---|
| 3861 | if ( wp[1].bPresentFlag ) |
---|
| 3862 | { |
---|
| 3863 | for ( Int j=1 ; j<3 ; j++ ) |
---|
| 3864 | { |
---|
| 3865 | Int iDeltaWeight; |
---|
| 3866 | READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" ); // se(v): chroma_weight_l0[i][j] |
---|
| 3867 | assert( iDeltaWeight >= -128 ); |
---|
| 3868 | assert( iDeltaWeight <= 127 ); |
---|
| 3869 | wp[j].iWeight = (iDeltaWeight + (1<<wp[1].uiLog2WeightDenom)); |
---|
| 3870 | |
---|
| 3871 | Int iDeltaChroma; |
---|
| 3872 | READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" ); // se(v): delta_chroma_offset_l0[i][j] |
---|
| 3873 | assert( iDeltaChroma >= -512 ); |
---|
| 3874 | assert( iDeltaChroma <= 511 ); |
---|
| 3875 | Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); |
---|
| 3876 | wp[j].iOffset = Clip3(-128, 127, (iDeltaChroma + pred) ); |
---|
| 3877 | } |
---|
| 3878 | } |
---|
| 3879 | else |
---|
| 3880 | { |
---|
| 3881 | for ( Int j=1 ; j<3 ; j++ ) |
---|
| 3882 | { |
---|
| 3883 | wp[j].iWeight = (1 << wp[j].uiLog2WeightDenom); |
---|
| 3884 | wp[j].iOffset = 0; |
---|
| 3885 | } |
---|
| 3886 | } |
---|
| 3887 | } |
---|
| 3888 | } |
---|
| 3889 | |
---|
| 3890 | for ( Int iRefIdx=pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) |
---|
| 3891 | { |
---|
| 3892 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
| 3893 | |
---|
| 3894 | wp[0].bPresentFlag = false; |
---|
| 3895 | wp[1].bPresentFlag = false; |
---|
| 3896 | wp[2].bPresentFlag = false; |
---|
| 3897 | } |
---|
| 3898 | } |
---|
| 3899 | assert(uiTotalSignalledWeightFlags<=24); |
---|
| 3900 | } |
---|
| 3901 | |
---|
| 3902 | /** decode quantization matrix |
---|
| 3903 | * \param scalingList quantization matrix information |
---|
| 3904 | */ |
---|
| 3905 | Void TDecCavlc::parseScalingList(TComScalingList* scalingList) |
---|
| 3906 | { |
---|
| 3907 | UInt code, sizeId, listId; |
---|
| 3908 | Bool scalingListPredModeFlag; |
---|
| 3909 | //for each size |
---|
| 3910 | for(sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
| 3911 | { |
---|
| 3912 | for(listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
| 3913 | { |
---|
| 3914 | READ_FLAG( code, "scaling_list_pred_mode_flag"); |
---|
| 3915 | scalingListPredModeFlag = (code) ? true : false; |
---|
| 3916 | if(!scalingListPredModeFlag) //Copy Mode |
---|
| 3917 | { |
---|
| 3918 | READ_UVLC( code, "scaling_list_pred_matrix_id_delta"); |
---|
| 3919 | scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code))); |
---|
| 3920 | if( sizeId > SCALING_LIST_8x8 ) |
---|
| 3921 | { |
---|
| 3922 | scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId)))); |
---|
| 3923 | } |
---|
| 3924 | scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId)); |
---|
| 3925 | |
---|
| 3926 | } |
---|
| 3927 | else //DPCM Mode |
---|
| 3928 | { |
---|
| 3929 | xDecodeScalingList(scalingList, sizeId, listId); |
---|
| 3930 | } |
---|
| 3931 | } |
---|
| 3932 | } |
---|
| 3933 | |
---|
| 3934 | return; |
---|
| 3935 | } |
---|
| 3936 | /** decode DPCM |
---|
| 3937 | * \param scalingList quantization matrix information |
---|
| 3938 | * \param sizeId size index |
---|
| 3939 | * \param listId list index |
---|
| 3940 | */ |
---|
| 3941 | Void TDecCavlc::xDecodeScalingList(TComScalingList *scalingList, UInt sizeId, UInt listId) |
---|
| 3942 | { |
---|
| 3943 | Int i,coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]); |
---|
| 3944 | Int data; |
---|
| 3945 | Int scalingListDcCoefMinus8 = 0; |
---|
| 3946 | Int nextCoef = SCALING_LIST_START_VALUE; |
---|
| 3947 | UInt* scan = (sizeId == 0) ? g_auiSigLastScan [ SCAN_DIAG ] [ 1 ] : g_sigLastScanCG32x32; |
---|
| 3948 | Int *dst = scalingList->getScalingListAddress(sizeId, listId); |
---|
| 3949 | |
---|
| 3950 | if( sizeId > SCALING_LIST_8x8 ) |
---|
| 3951 | { |
---|
| 3952 | READ_SVLC( scalingListDcCoefMinus8, "scaling_list_dc_coef_minus8"); |
---|
| 3953 | scalingList->setScalingListDC(sizeId,listId,scalingListDcCoefMinus8 + 8); |
---|
| 3954 | nextCoef = scalingList->getScalingListDC(sizeId,listId); |
---|
| 3955 | } |
---|
| 3956 | |
---|
| 3957 | for(i = 0; i < coefNum; i++) |
---|
| 3958 | { |
---|
| 3959 | READ_SVLC( data, "scaling_list_delta_coef"); |
---|
| 3960 | nextCoef = (nextCoef + data + 256 ) % 256; |
---|
| 3961 | dst[scan[i]] = nextCoef; |
---|
| 3962 | } |
---|
| 3963 | } |
---|
| 3964 | |
---|
| 3965 | Bool TDecCavlc::xMoreRbspData() |
---|
| 3966 | { |
---|
| 3967 | Int bitsLeft = m_pcBitstream->getNumBitsLeft(); |
---|
| 3968 | |
---|
| 3969 | // if there are more than 8 bits, it cannot be rbsp_trailing_bits |
---|
| 3970 | if (bitsLeft > 8) |
---|
| 3971 | { |
---|
| 3972 | return true; |
---|
| 3973 | } |
---|
| 3974 | |
---|
| 3975 | UChar lastByte = m_pcBitstream->peekBits(bitsLeft); |
---|
| 3976 | Int cnt = bitsLeft; |
---|
| 3977 | |
---|
| 3978 | // remove trailing bits equal to zero |
---|
| 3979 | while ((cnt>0) && ((lastByte & 1) == 0)) |
---|
| 3980 | { |
---|
| 3981 | lastByte >>= 1; |
---|
| 3982 | cnt--; |
---|
| 3983 | } |
---|
| 3984 | // remove bit equal to one |
---|
| 3985 | cnt--; |
---|
| 3986 | |
---|
| 3987 | // we should not have a negative number of bits |
---|
| 3988 | assert (cnt>=0); |
---|
| 3989 | |
---|
| 3990 | // we have more data, if cnt is not zero |
---|
| 3991 | return (cnt>0); |
---|
| 3992 | } |
---|
[540] | 3993 | |
---|
[713] | 3994 | #if Q0048_CGS_3D_ASYMLUT |
---|
| 3995 | Void TDecCavlc::xParse3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ) |
---|
| 3996 | { |
---|
[825] | 3997 | #if R0150_CGS_SIGNAL_CONSTRAINTS |
---|
| 3998 | UInt uiNumRefLayersM1; |
---|
| 3999 | READ_UVLC( uiNumRefLayersM1 , "num_cm_ref_layers_minus1" ); |
---|
| 4000 | assert( uiNumRefLayersM1 <= 61 ); |
---|
| 4001 | for( UInt i = 0 ; i <= uiNumRefLayersM1 ; i++ ) |
---|
| 4002 | { |
---|
| 4003 | UInt uiRefLayerId; |
---|
| 4004 | READ_CODE( 6 , uiRefLayerId , "cm_ref_layer_id" ); |
---|
| 4005 | pc3DAsymLUT->addRefLayerId( uiRefLayerId ); |
---|
| 4006 | } |
---|
| 4007 | #endif |
---|
[713] | 4008 | UInt uiCurOctantDepth , uiCurPartNumLog2 , uiInputBitDepthM8 , uiOutputBitDepthM8 , uiResQaunBit; |
---|
[826] | 4009 | #if R0300_CGS_RES_COEFF_CODING |
---|
| 4010 | UInt uiDeltaBits; |
---|
| 4011 | #endif |
---|
[713] | 4012 | READ_CODE( 2 , uiCurOctantDepth , "cm_octant_depth" ); |
---|
| 4013 | READ_CODE( 2 , uiCurPartNumLog2 , "cm_y_part_num_log2" ); |
---|
[825] | 4014 | #if R0150_CGS_SIGNAL_CONSTRAINTS |
---|
| 4015 | UInt uiChromaInputBitDepthM8 , uiChromaOutputBitDepthM8; |
---|
| 4016 | READ_CODE( 3 , uiInputBitDepthM8 , "cm_input_luma_bit_depth_minus8" ); |
---|
| 4017 | READ_CODE( 3 , uiChromaInputBitDepthM8 , "cm_input_chroma_bit_depth_minus8" ); |
---|
| 4018 | READ_CODE( 3 , uiOutputBitDepthM8 , "cm_output_luma_bit_depth_minus8" ); |
---|
| 4019 | READ_CODE( 3 , uiChromaOutputBitDepthM8 , "cm_output_chroma_bit_depth_minus8" ); |
---|
| 4020 | #else |
---|
[713] | 4021 | READ_CODE( 3 , uiInputBitDepthM8 , "cm_input_bit_depth_minus8" ); |
---|
| 4022 | Int iInputBitDepthCDelta; |
---|
| 4023 | READ_SVLC(iInputBitDepthCDelta, "cm_input_bit_depth_chroma delta"); |
---|
| 4024 | READ_CODE( 3 , uiOutputBitDepthM8 , "cm_output_bit_depth_minus8" ); |
---|
| 4025 | Int iOutputBitDepthCDelta; |
---|
| 4026 | READ_SVLC(iOutputBitDepthCDelta, "cm_output_bit_depth_chroma_delta"); |
---|
[825] | 4027 | #endif |
---|
[713] | 4028 | READ_CODE( 2 , uiResQaunBit , "cm_res_quant_bit" ); |
---|
[826] | 4029 | #if R0300_CGS_RES_COEFF_CODING |
---|
| 4030 | READ_CODE( 2 , uiDeltaBits , "cm_flc_bits" ); |
---|
| 4031 | pc3DAsymLUT->setDeltaBits(uiDeltaBits + 1); |
---|
| 4032 | #endif |
---|
| 4033 | |
---|
[825] | 4034 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
| 4035 | #if R0150_CGS_SIGNAL_CONSTRAINTS |
---|
| 4036 | Int nAdaptCThresholdU = 1 << ( uiChromaInputBitDepthM8 + 8 - 1 ); |
---|
| 4037 | Int nAdaptCThresholdV = 1 << ( uiChromaInputBitDepthM8 + 8 - 1 ); |
---|
| 4038 | #else |
---|
| 4039 | Int nAdaptCThresholdU = 1 << ( uiInputBitDepthM8 + 8 + iInputBitDepthCDelta - 1 ); |
---|
| 4040 | Int nAdaptCThresholdV = 1 << ( uiInputBitDepthM8 + 8 + iInputBitDepthCDelta - 1 ); |
---|
| 4041 | #endif |
---|
| 4042 | if( uiCurOctantDepth == 1 ) |
---|
| 4043 | { |
---|
| 4044 | Int delta = 0; |
---|
| 4045 | READ_SVLC( delta , "cm_adapt_threshold_u_delta" ); |
---|
| 4046 | nAdaptCThresholdU += delta; |
---|
| 4047 | READ_SVLC( delta , "cm_adapt_threshold_v_delta" ); |
---|
| 4048 | nAdaptCThresholdV += delta; |
---|
| 4049 | } |
---|
| 4050 | #endif |
---|
[713] | 4051 | pc3DAsymLUT->destroy(); |
---|
[825] | 4052 | pc3DAsymLUT->create( uiCurOctantDepth , uiInputBitDepthM8 + 8 , |
---|
| 4053 | #if R0150_CGS_SIGNAL_CONSTRAINTS |
---|
| 4054 | uiChromaInputBitDepthM8 + 8 , |
---|
| 4055 | #else |
---|
| 4056 | uiInputBitDepthM8 + 8 + iInputBitDepthCDelta, |
---|
| 4057 | #endif |
---|
| 4058 | uiOutputBitDepthM8 + 8 , |
---|
| 4059 | #if R0150_CGS_SIGNAL_CONSTRAINTS |
---|
| 4060 | uiChromaOutputBitDepthM8 + 8 , |
---|
| 4061 | #else |
---|
| 4062 | uiOutputBitDepthM8 + 8 + iOutputBitDepthCDelta , |
---|
| 4063 | #endif |
---|
| 4064 | uiCurPartNumLog2 |
---|
| 4065 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
| 4066 | , nAdaptCThresholdU , nAdaptCThresholdV |
---|
| 4067 | #endif |
---|
| 4068 | ); |
---|
[713] | 4069 | pc3DAsymLUT->setResQuantBit( uiResQaunBit ); |
---|
| 4070 | |
---|
[825] | 4071 | #if R0164_CGS_LUT_BUGFIX |
---|
| 4072 | pc3DAsymLUT->xInitCuboids(); |
---|
| 4073 | #endif |
---|
[713] | 4074 | xParse3DAsymLUTOctant( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth() ); |
---|
[825] | 4075 | #if R0164_CGS_LUT_BUGFIX |
---|
| 4076 | pc3DAsymLUT->xCuboidsExplicitCheck( true ); |
---|
| 4077 | #endif |
---|
[713] | 4078 | } |
---|
| 4079 | |
---|
| 4080 | Void TDecCavlc::xParse3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ) |
---|
| 4081 | { |
---|
| 4082 | UInt uiOctantSplit = nDepth < pc3DAsymLUT->getCurOctantDepth(); |
---|
| 4083 | if( nDepth < pc3DAsymLUT->getCurOctantDepth() ) |
---|
| 4084 | READ_FLAG( uiOctantSplit , "split_octant_flag" ); |
---|
| 4085 | Int nYPartNum = 1 << pc3DAsymLUT->getCurYPartNumLog2(); |
---|
| 4086 | if( uiOctantSplit ) |
---|
| 4087 | { |
---|
| 4088 | Int nHalfLength = nLength >> 1; |
---|
| 4089 | for( Int l = 0 ; l < 2 ; l++ ) |
---|
| 4090 | { |
---|
| 4091 | for( Int m = 0 ; m < 2 ; m++ ) |
---|
| 4092 | { |
---|
| 4093 | for( Int n = 0 ; n < 2 ; n++ ) |
---|
| 4094 | { |
---|
| 4095 | xParse3DAsymLUTOctant( pc3DAsymLUT , nDepth + 1 , yIdx + l * nHalfLength * nYPartNum , uIdx + m * nHalfLength , vIdx + n * nHalfLength , nHalfLength ); |
---|
| 4096 | } |
---|
| 4097 | } |
---|
| 4098 | } |
---|
| 4099 | } |
---|
| 4100 | else |
---|
| 4101 | { |
---|
[826] | 4102 | #if R0300_CGS_RES_COEFF_CODING |
---|
| 4103 | Int nFLCbits = pc3DAsymLUT->getMappingShift()-pc3DAsymLUT->getResQuantBit()-pc3DAsymLUT->getDeltaBits() ; |
---|
| 4104 | nFLCbits = nFLCbits >= 0 ? nFLCbits:0; |
---|
| 4105 | #endif |
---|
[713] | 4106 | for( Int l = 0 ; l < nYPartNum ; l++ ) |
---|
| 4107 | { |
---|
[825] | 4108 | #if R0164_CGS_LUT_BUGFIX |
---|
| 4109 | Int shift = pc3DAsymLUT->getMaxOctantDepth() - nDepth ; |
---|
| 4110 | #endif |
---|
[713] | 4111 | for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) |
---|
| 4112 | { |
---|
| 4113 | UInt uiCodeVertex = 0; |
---|
| 4114 | Int deltaY = 0 , deltaU = 0 , deltaV = 0; |
---|
| 4115 | READ_FLAG( uiCodeVertex , "coded_vertex_flag" ); |
---|
| 4116 | if( uiCodeVertex ) |
---|
| 4117 | { |
---|
[825] | 4118 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
[826] | 4119 | #if R0300_CGS_RES_COEFF_CODING |
---|
| 4120 | xReadParam( deltaY, nFLCbits ); |
---|
| 4121 | xReadParam( deltaU, nFLCbits ); |
---|
| 4122 | xReadParam( deltaV, nFLCbits ); |
---|
| 4123 | #else |
---|
[825] | 4124 | xReadParam( deltaY ); |
---|
| 4125 | xReadParam( deltaU ); |
---|
| 4126 | xReadParam( deltaV ); |
---|
[826] | 4127 | #endif |
---|
[825] | 4128 | #else |
---|
[713] | 4129 | READ_SVLC( deltaY , "resY" ); |
---|
| 4130 | READ_SVLC( deltaU , "resU" ); |
---|
| 4131 | READ_SVLC( deltaV , "resV" ); |
---|
[825] | 4132 | #endif |
---|
[713] | 4133 | } |
---|
[825] | 4134 | #if R0164_CGS_LUT_BUGFIX |
---|
| 4135 | pc3DAsymLUT->setCuboidVertexResTree( yIdx + (l<<shift) , uIdx , vIdx , nVertexIdx , deltaY , deltaU , deltaV ); |
---|
| 4136 | #else |
---|
[713] | 4137 | pc3DAsymLUT->setCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx , deltaY , deltaU , deltaV ); |
---|
[825] | 4138 | #endif |
---|
[713] | 4139 | } |
---|
[825] | 4140 | #if R0164_CGS_LUT_BUGFIX |
---|
| 4141 | pc3DAsymLUT->xSetExplicit( yIdx + (l<<shift) , uIdx , vIdx ); |
---|
| 4142 | #endif |
---|
[713] | 4143 | } |
---|
| 4144 | } |
---|
| 4145 | } |
---|
[825] | 4146 | |
---|
| 4147 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
[826] | 4148 | #if R0300_CGS_RES_COEFF_CODING |
---|
| 4149 | Void TDecCavlc::xReadParam( Int& param, Int rParam ) |
---|
| 4150 | #else |
---|
[825] | 4151 | Void TDecCavlc::xReadParam( Int& param ) |
---|
[826] | 4152 | #endif |
---|
[825] | 4153 | { |
---|
[826] | 4154 | #if !R0300_CGS_RES_COEFF_CODING |
---|
[825] | 4155 | const UInt rParam = 7; |
---|
[826] | 4156 | #endif |
---|
[825] | 4157 | UInt prefix; |
---|
| 4158 | UInt codeWord ; |
---|
| 4159 | UInt rSymbol; |
---|
| 4160 | UInt sign; |
---|
| 4161 | |
---|
| 4162 | READ_UVLC( prefix, "quotient") ; |
---|
| 4163 | READ_CODE (rParam, codeWord, "remainder"); |
---|
| 4164 | rSymbol = (prefix<<rParam) + codeWord; |
---|
| 4165 | |
---|
| 4166 | if(rSymbol) |
---|
| 4167 | { |
---|
| 4168 | READ_FLAG(sign, "sign"); |
---|
| 4169 | param = sign ? -(Int)(rSymbol) : (Int)(rSymbol); |
---|
| 4170 | } |
---|
| 4171 | else param = 0; |
---|
| 4172 | } |
---|
[713] | 4173 | #endif |
---|
[825] | 4174 | #endif |
---|
[313] | 4175 | //! \} |
---|
| 4176 | |
---|