[5] | 1 | /* The copyright in this software is being made available under the BSD |
---|
[608] | 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 | * |
---|
| 6 | * Copyright (c) 2010-2013, ITU/ISO/IEC |
---|
| 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 | */ |
---|
[2] | 33 | |
---|
| 34 | /** \file TDecCAVLC.cpp |
---|
[608] | 35 | \brief CAVLC decoder class |
---|
[2] | 36 | */ |
---|
| 37 | |
---|
| 38 | #include "TDecCAVLC.h" |
---|
| 39 | #include "SEIread.h" |
---|
[56] | 40 | #include "TDecSlice.h" |
---|
[2] | 41 | |
---|
[56] | 42 | //! \ingroup TLibDecoder |
---|
| 43 | //! \{ |
---|
| 44 | |
---|
| 45 | #if ENC_DEC_TRACE |
---|
| 46 | |
---|
| 47 | Void xTraceSPSHeader (TComSPS *pSPS) |
---|
| 48 | { |
---|
[608] | 49 | #if H_MV_ENC_DEC_TRAC |
---|
| 50 | if ( g_disableHLSTrace ) |
---|
| 51 | { |
---|
| 52 | return; |
---|
| 53 | } |
---|
| 54 | // To avoid mismatches |
---|
| 55 | fprintf( g_hTrace, "=========== Sequence Parameter Set ===========\n" ); |
---|
| 56 | #else |
---|
[56] | 57 | fprintf( g_hTrace, "=========== Sequence Parameter Set ID: %d ===========\n", pSPS->getSPSId() ); |
---|
[608] | 58 | #endif |
---|
[56] | 59 | } |
---|
| 60 | |
---|
| 61 | Void xTracePPSHeader (TComPPS *pPPS) |
---|
| 62 | { |
---|
[608] | 63 | #if H_MV_ENC_DEC_TRAC |
---|
| 64 | if ( g_disableHLSTrace ) |
---|
| 65 | { |
---|
| 66 | return; |
---|
| 67 | } |
---|
| 68 | fprintf( g_hTrace, "=========== Picture Parameter Set ===========\n" ); |
---|
| 69 | #else |
---|
[56] | 70 | fprintf( g_hTrace, "=========== Picture Parameter Set ID: %d ===========\n", pPPS->getPPSId() ); |
---|
[608] | 71 | #endif |
---|
[56] | 72 | } |
---|
| 73 | |
---|
| 74 | Void xTraceSliceHeader (TComSlice *pSlice) |
---|
| 75 | { |
---|
[608] | 76 | #if H_MV_ENC_DEC_TRAC |
---|
| 77 | if ( g_disableHLSTrace ) |
---|
| 78 | { |
---|
| 79 | return; |
---|
| 80 | } |
---|
| 81 | #endif |
---|
[56] | 82 | fprintf( g_hTrace, "=========== Slice ===========\n"); |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | #endif |
---|
| 86 | |
---|
[2] | 87 | // ==================================================================================================================== |
---|
| 88 | // Constructor / destructor / create / destroy |
---|
| 89 | // ==================================================================================================================== |
---|
| 90 | |
---|
| 91 | TDecCavlc::TDecCavlc() |
---|
| 92 | { |
---|
[608] | 93 | #if H_3D |
---|
| 94 | m_aaiTempScale = new Int* [ MAX_NUM_LAYERS ]; |
---|
| 95 | m_aaiTempOffset = new Int* [ MAX_NUM_LAYERS ]; |
---|
| 96 | for( UInt uiVId = 0; uiVId < MAX_NUM_LAYERS; uiVId++ ) |
---|
[2] | 97 | { |
---|
[608] | 98 | m_aaiTempScale [ uiVId ] = new Int [ MAX_NUM_LAYERS ]; |
---|
| 99 | m_aaiTempOffset [ uiVId ] = new Int [ MAX_NUM_LAYERS ]; |
---|
[2] | 100 | } |
---|
[608] | 101 | #endif |
---|
[2] | 102 | } |
---|
| 103 | |
---|
| 104 | TDecCavlc::~TDecCavlc() |
---|
| 105 | { |
---|
[608] | 106 | #if H_3D |
---|
| 107 | for( UInt uiVId = 0; uiVId < MAX_NUM_LAYERS; uiVId++ ) |
---|
[2] | 108 | { |
---|
| 109 | delete [] m_aaiTempScale [ uiVId ]; |
---|
| 110 | delete [] m_aaiTempOffset [ uiVId ]; |
---|
| 111 | } |
---|
| 112 | delete [] m_aaiTempScale; |
---|
| 113 | delete [] m_aaiTempOffset; |
---|
[608] | 114 | #endif |
---|
[2] | 115 | } |
---|
| 116 | |
---|
| 117 | // ==================================================================================================================== |
---|
| 118 | // Public member functions |
---|
| 119 | // ==================================================================================================================== |
---|
| 120 | |
---|
[56] | 121 | void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComReferencePictureSet* rps, Int idx ) |
---|
[2] | 122 | { |
---|
[56] | 123 | UInt code; |
---|
| 124 | UInt interRPSPred; |
---|
[608] | 125 | if (idx > 0) |
---|
| 126 | { |
---|
| 127 | READ_FLAG(interRPSPred, "inter_ref_pic_set_prediction_flag"); rps->setInterRPSPrediction(interRPSPred); |
---|
| 128 | } |
---|
| 129 | else |
---|
| 130 | { |
---|
| 131 | interRPSPred = false; |
---|
| 132 | rps->setInterRPSPrediction(false); |
---|
| 133 | } |
---|
| 134 | |
---|
[56] | 135 | if (interRPSPred) |
---|
| 136 | { |
---|
| 137 | UInt bit; |
---|
[608] | 138 | if(idx == sps->getRPSList()->getNumberOfReferencePictureSets()) |
---|
| 139 | { |
---|
| 140 | READ_UVLC(code, "delta_idx_minus1" ); // delta index of the Reference Picture Set used for prediction minus 1 |
---|
| 141 | } |
---|
| 142 | else |
---|
| 143 | { |
---|
| 144 | code = 0; |
---|
| 145 | } |
---|
| 146 | 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 |
---|
[56] | 147 | Int rIdx = idx - 1 - code; |
---|
[608] | 148 | 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 |
---|
[56] | 149 | TComReferencePictureSet* rpsRef = sps->getRPSList()->getReferencePictureSet(rIdx); |
---|
| 150 | Int k = 0, k0 = 0, k1 = 0; |
---|
| 151 | READ_CODE(1, bit, "delta_rps_sign"); // delta_RPS_sign |
---|
| 152 | READ_UVLC(code, "abs_delta_rps_minus1"); // absolute delta RPS minus 1 |
---|
[608] | 153 | Int deltaRPS = (1 - 2 * bit) * (code + 1); // delta_RPS |
---|
[56] | 154 | for(Int j=0 ; j <= rpsRef->getNumberOfPictures(); j++) |
---|
| 155 | { |
---|
| 156 | READ_CODE(1, bit, "used_by_curr_pic_flag" ); //first bit is "1" if Idc is 1 |
---|
| 157 | Int refIdc = bit; |
---|
| 158 | if (refIdc == 0) |
---|
| 159 | { |
---|
| 160 | READ_CODE(1, bit, "use_delta_flag" ); //second bit is "1" if Idc is 2, "0" otherwise. |
---|
| 161 | refIdc = bit<<1; //second bit is "1" if refIdc is 2, "0" if refIdc = 0. |
---|
| 162 | } |
---|
| 163 | if (refIdc == 1 || refIdc == 2) |
---|
| 164 | { |
---|
| 165 | Int deltaPOC = deltaRPS + ((j < rpsRef->getNumberOfPictures())? rpsRef->getDeltaPOC(j) : 0); |
---|
| 166 | rps->setDeltaPOC(k, deltaPOC); |
---|
| 167 | rps->setUsed(k, (refIdc == 1)); |
---|
[2] | 168 | |
---|
[608] | 169 | if (deltaPOC < 0) |
---|
| 170 | { |
---|
[56] | 171 | k0++; |
---|
| 172 | } |
---|
| 173 | else |
---|
| 174 | { |
---|
| 175 | k1++; |
---|
| 176 | } |
---|
| 177 | k++; |
---|
| 178 | } |
---|
| 179 | rps->setRefIdc(j,refIdc); |
---|
| 180 | } |
---|
| 181 | rps->setNumRefIdc(rpsRef->getNumberOfPictures()+1); |
---|
| 182 | rps->setNumberOfPictures(k); |
---|
| 183 | rps->setNumberOfNegativePictures(k0); |
---|
| 184 | rps->setNumberOfPositivePictures(k1); |
---|
| 185 | rps->sortDeltaPOC(); |
---|
| 186 | } |
---|
| 187 | else |
---|
| 188 | { |
---|
| 189 | READ_UVLC(code, "num_negative_pics"); rps->setNumberOfNegativePictures(code); |
---|
| 190 | READ_UVLC(code, "num_positive_pics"); rps->setNumberOfPositivePictures(code); |
---|
| 191 | Int prev = 0; |
---|
| 192 | Int poc; |
---|
| 193 | for(Int j=0 ; j < rps->getNumberOfNegativePictures(); j++) |
---|
| 194 | { |
---|
| 195 | READ_UVLC(code, "delta_poc_s0_minus1"); |
---|
| 196 | poc = prev-code-1; |
---|
| 197 | prev = poc; |
---|
| 198 | rps->setDeltaPOC(j,poc); |
---|
| 199 | READ_FLAG(code, "used_by_curr_pic_s0_flag"); rps->setUsed(j,code); |
---|
| 200 | } |
---|
| 201 | prev = 0; |
---|
| 202 | for(Int j=rps->getNumberOfNegativePictures(); j < rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); j++) |
---|
| 203 | { |
---|
| 204 | READ_UVLC(code, "delta_poc_s1_minus1"); |
---|
| 205 | poc = prev+code+1; |
---|
| 206 | prev = poc; |
---|
| 207 | rps->setDeltaPOC(j,poc); |
---|
| 208 | READ_FLAG(code, "used_by_curr_pic_s1_flag"); rps->setUsed(j,code); |
---|
| 209 | } |
---|
| 210 | rps->setNumberOfPictures(rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures()); |
---|
| 211 | } |
---|
| 212 | #if PRINT_RPS_INFO |
---|
| 213 | rps->printDeltaPOC(); |
---|
[2] | 214 | #endif |
---|
| 215 | } |
---|
| 216 | |
---|
[773] | 217 | #if H_3D |
---|
[758] | 218 | Void TDecCavlc::parsePPS(TComPPS* pcPPS, TComVPS* pcVPS ) |
---|
| 219 | #else |
---|
[608] | 220 | Void TDecCavlc::parsePPS(TComPPS* pcPPS) |
---|
[758] | 221 | #endif |
---|
[2] | 222 | { |
---|
[56] | 223 | #if ENC_DEC_TRACE |
---|
[608] | 224 | xTracePPSHeader (pcPPS); |
---|
[2] | 225 | #endif |
---|
[608] | 226 | UInt uiCode; |
---|
[2] | 227 | |
---|
[608] | 228 | Int iCode; |
---|
[2] | 229 | |
---|
[608] | 230 | READ_UVLC( uiCode, "pps_pic_parameter_set_id"); |
---|
| 231 | assert(uiCode <= 63); |
---|
| 232 | pcPPS->setPPSId (uiCode); |
---|
| 233 | |
---|
| 234 | READ_UVLC( uiCode, "pps_seq_parameter_set_id"); |
---|
| 235 | assert(uiCode <= 15); |
---|
| 236 | pcPPS->setSPSId (uiCode); |
---|
| 237 | |
---|
| 238 | READ_FLAG( uiCode, "dependent_slice_segments_enabled_flag" ); pcPPS->setDependentSliceSegmentsEnabledFlag ( uiCode == 1 ); |
---|
| 239 | READ_FLAG( uiCode, "output_flag_present_flag" ); pcPPS->setOutputFlagPresentFlag( uiCode==1 ); |
---|
[2] | 240 | |
---|
[608] | 241 | READ_CODE(3, uiCode, "num_extra_slice_header_bits"); pcPPS->setNumExtraSliceHeaderBits(uiCode); |
---|
| 242 | READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode ); |
---|
[2] | 243 | |
---|
[608] | 244 | READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false ); |
---|
[56] | 245 | |
---|
[608] | 246 | READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1"); |
---|
| 247 | assert(uiCode <= 14); |
---|
| 248 | pcPPS->setNumRefIdxL0DefaultActive(uiCode+1); |
---|
| 249 | |
---|
| 250 | READ_UVLC(uiCode, "num_ref_idx_l1_default_active_minus1"); |
---|
| 251 | assert(uiCode <= 14); |
---|
| 252 | pcPPS->setNumRefIdxL1DefaultActive(uiCode+1); |
---|
| 253 | |
---|
| 254 | READ_SVLC(iCode, "init_qp_minus26" ); pcPPS->setPicInitQPMinus26(iCode); |
---|
| 255 | READ_FLAG( uiCode, "constrained_intra_pred_flag" ); pcPPS->setConstrainedIntraPred( uiCode ? true : false ); |
---|
| 256 | READ_FLAG( uiCode, "transform_skip_enabled_flag" ); |
---|
| 257 | pcPPS->setUseTransformSkip ( uiCode ? true : false ); |
---|
[2] | 258 | |
---|
[608] | 259 | READ_FLAG( uiCode, "cu_qp_delta_enabled_flag" ); pcPPS->setUseDQP( uiCode ? true : false ); |
---|
| 260 | if( pcPPS->getUseDQP() ) |
---|
[56] | 261 | { |
---|
[608] | 262 | READ_UVLC( uiCode, "diff_cu_qp_delta_depth" ); |
---|
| 263 | pcPPS->setMaxCuDQPDepth( uiCode ); |
---|
[56] | 264 | } |
---|
| 265 | else |
---|
| 266 | { |
---|
[608] | 267 | pcPPS->setMaxCuDQPDepth( 0 ); |
---|
[56] | 268 | } |
---|
[608] | 269 | READ_SVLC( iCode, "pps_cb_qp_offset"); |
---|
| 270 | pcPPS->setChromaCbQpOffset(iCode); |
---|
| 271 | assert( pcPPS->getChromaCbQpOffset() >= -12 ); |
---|
| 272 | assert( pcPPS->getChromaCbQpOffset() <= 12 ); |
---|
[2] | 273 | |
---|
[608] | 274 | READ_SVLC( iCode, "pps_cr_qp_offset"); |
---|
| 275 | pcPPS->setChromaCrQpOffset(iCode); |
---|
| 276 | assert( pcPPS->getChromaCrQpOffset() >= -12 ); |
---|
| 277 | assert( pcPPS->getChromaCrQpOffset() <= 12 ); |
---|
[56] | 278 | |
---|
[608] | 279 | READ_FLAG( uiCode, "pps_slice_chroma_qp_offsets_present_flag" ); |
---|
| 280 | pcPPS->setSliceChromaQpFlag( uiCode ? true : false ); |
---|
[56] | 281 | |
---|
[608] | 282 | READ_FLAG( uiCode, "weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) |
---|
| 283 | pcPPS->setUseWP( uiCode==1 ); |
---|
| 284 | READ_FLAG( uiCode, "weighted_bipred_flag" ); // Use of Bi-Directional Weighting Prediction (B_SLICE) |
---|
| 285 | pcPPS->setWPBiPred( uiCode==1 ); |
---|
[56] | 286 | |
---|
[608] | 287 | READ_FLAG( uiCode, "transquant_bypass_enable_flag"); |
---|
| 288 | pcPPS->setTransquantBypassEnableFlag(uiCode ? true : false); |
---|
| 289 | READ_FLAG( uiCode, "tiles_enabled_flag" ); pcPPS->setTilesEnabledFlag ( uiCode == 1 ); |
---|
| 290 | READ_FLAG( uiCode, "entropy_coding_sync_enabled_flag" ); pcPPS->setEntropyCodingSyncEnabledFlag( uiCode == 1 ); |
---|
| 291 | |
---|
| 292 | if( pcPPS->getTilesEnabledFlag() ) |
---|
[56] | 293 | { |
---|
[608] | 294 | READ_UVLC ( uiCode, "num_tile_columns_minus1" ); pcPPS->setNumColumnsMinus1( uiCode ); |
---|
| 295 | READ_UVLC ( uiCode, "num_tile_rows_minus1" ); pcPPS->setNumRowsMinus1( uiCode ); |
---|
| 296 | READ_FLAG ( uiCode, "uniform_spacing_flag" ); pcPPS->setUniformSpacingFlag( uiCode ); |
---|
| 297 | |
---|
| 298 | if( !pcPPS->getUniformSpacingFlag()) |
---|
[2] | 299 | { |
---|
[608] | 300 | UInt* columnWidth = (UInt*)malloc(pcPPS->getNumColumnsMinus1()*sizeof(UInt)); |
---|
| 301 | for(UInt i=0; i<pcPPS->getNumColumnsMinus1(); i++) |
---|
| 302 | { |
---|
| 303 | READ_UVLC( uiCode, "column_width_minus1" ); |
---|
| 304 | columnWidth[i] = uiCode+1; |
---|
[56] | 305 | } |
---|
[608] | 306 | pcPPS->setColumnWidth(columnWidth); |
---|
| 307 | free(columnWidth); |
---|
| 308 | |
---|
| 309 | UInt* rowHeight = (UInt*)malloc(pcPPS->getNumRowsMinus1()*sizeof(UInt)); |
---|
| 310 | for(UInt i=0; i<pcPPS->getNumRowsMinus1(); i++) |
---|
[56] | 311 | { |
---|
[608] | 312 | READ_UVLC( uiCode, "row_height_minus1" ); |
---|
| 313 | rowHeight[i] = uiCode + 1; |
---|
[2] | 314 | } |
---|
[608] | 315 | pcPPS->setRowHeight(rowHeight); |
---|
| 316 | free(rowHeight); |
---|
[2] | 317 | } |
---|
[608] | 318 | |
---|
| 319 | if(pcPPS->getNumColumnsMinus1() !=0 || pcPPS->getNumRowsMinus1() !=0) |
---|
[2] | 320 | { |
---|
[608] | 321 | READ_FLAG ( uiCode, "loop_filter_across_tiles_enabled_flag" ); pcPPS->setLoopFilterAcrossTilesEnabledFlag( uiCode ? true : false ); |
---|
[2] | 322 | } |
---|
[56] | 323 | } |
---|
[608] | 324 | READ_FLAG( uiCode, "loop_filter_across_slices_enabled_flag" ); pcPPS->setLoopFilterAcrossSlicesEnabledFlag( uiCode ? true : false ); |
---|
| 325 | READ_FLAG( uiCode, "deblocking_filter_control_present_flag" ); pcPPS->setDeblockingFilterControlPresentFlag( uiCode ? true : false ); |
---|
| 326 | if(pcPPS->getDeblockingFilterControlPresentFlag()) |
---|
[56] | 327 | { |
---|
[608] | 328 | READ_FLAG( uiCode, "deblocking_filter_override_enabled_flag" ); pcPPS->setDeblockingFilterOverrideEnabledFlag( uiCode ? true : false ); |
---|
| 329 | READ_FLAG( uiCode, "pps_disable_deblocking_filter_flag" ); pcPPS->setPicDisableDeblockingFilterFlag(uiCode ? true : false ); |
---|
| 330 | if(!pcPPS->getPicDisableDeblockingFilterFlag()) |
---|
[56] | 331 | { |
---|
[608] | 332 | READ_SVLC ( iCode, "pps_beta_offset_div2" ); pcPPS->setDeblockingFilterBetaOffsetDiv2( iCode ); |
---|
| 333 | READ_SVLC ( iCode, "pps_tc_offset_div2" ); pcPPS->setDeblockingFilterTcOffsetDiv2( iCode ); |
---|
[56] | 334 | } |
---|
| 335 | } |
---|
[622] | 336 | #if H_MV |
---|
| 337 | if ( pcPPS->getLayerId() > 0 ) |
---|
| 338 | { |
---|
| 339 | READ_FLAG( uiCode, "pps_infer_scaling_list_flag" ); pcPPS->setPpsInferScalingListFlag( uiCode == 1 ); |
---|
| 340 | } |
---|
| 341 | |
---|
| 342 | if( pcPPS->getPpsInferScalingListFlag( ) ) |
---|
| 343 | { |
---|
| 344 | READ_CODE( 6, uiCode, "pps_scaling_list_ref_layer_id" ); pcPPS->setPpsScalingListRefLayerId( uiCode ); |
---|
| 345 | } |
---|
| 346 | else |
---|
| 347 | { |
---|
| 348 | #endif |
---|
[608] | 349 | READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" ); pcPPS->setScalingListPresentFlag( uiCode ? true : false ); |
---|
| 350 | if(pcPPS->getScalingListPresentFlag ()) |
---|
[2] | 351 | { |
---|
[608] | 352 | parseScalingList( pcPPS->getScalingList() ); |
---|
[2] | 353 | } |
---|
[622] | 354 | #if H_MV |
---|
| 355 | } |
---|
| 356 | #endif |
---|
[2] | 357 | |
---|
[608] | 358 | READ_FLAG( uiCode, "lists_modification_present_flag"); |
---|
| 359 | pcPPS->setListsModificationPresentFlag(uiCode); |
---|
[2] | 360 | |
---|
[608] | 361 | READ_UVLC( uiCode, "log2_parallel_merge_level_minus2"); |
---|
| 362 | pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode); |
---|
[2] | 363 | |
---|
[608] | 364 | READ_FLAG( uiCode, "slice_segment_header_extension_present_flag"); |
---|
| 365 | pcPPS->setSliceHeaderExtensionPresentFlag(uiCode); |
---|
[56] | 366 | |
---|
[608] | 367 | READ_FLAG( uiCode, "pps_extension_flag"); |
---|
| 368 | if (uiCode) |
---|
[2] | 369 | { |
---|
[773] | 370 | #if H_3D |
---|
[758] | 371 | parsePPSExtension( pcPPS, pcVPS ); |
---|
| 372 | READ_FLAG( uiCode, "pps_extension2_flag"); |
---|
| 373 | if ( uiCode ) |
---|
[56] | 374 | { |
---|
[758] | 375 | #endif |
---|
| 376 | while ( xMoreRbspData() ) |
---|
| 377 | { |
---|
| 378 | READ_FLAG( uiCode, "pps_extension_data_flag"); |
---|
| 379 | } |
---|
[773] | 380 | #if H_3D |
---|
[56] | 381 | } |
---|
[758] | 382 | #endif |
---|
[2] | 383 | } |
---|
[56] | 384 | } |
---|
[2] | 385 | |
---|
[773] | 386 | #if H_3D |
---|
[758] | 387 | Void TDecCavlc::parsePPSExtension( TComPPS* pcPPS, TComVPS* pcVPS ) |
---|
| 388 | { |
---|
[773] | 389 | //Ed.(GT): pcVPS should not be used here. Needs to be fixed. |
---|
[758] | 390 | UInt uiCode = 0; |
---|
| 391 | TComDLT* pcDLT = new TComDLT; |
---|
| 392 | |
---|
| 393 | READ_FLAG(uiCode, "dlt_present_flag"); |
---|
| 394 | pcDLT->setDltPresentFlag( (uiCode == 1) ? true : false ); |
---|
| 395 | |
---|
| 396 | if ( pcDLT->getDltPresentFlag() ) |
---|
| 397 | { |
---|
| 398 | READ_CODE(6, uiCode, "pps_depth_layers_minus1"); |
---|
| 399 | pcDLT->setNumDepthViews( uiCode ); |
---|
| 400 | |
---|
| 401 | READ_CODE(4, uiCode, "pps_bit_depth_for_depth_views_minus8"); |
---|
| 402 | pcDLT->setDepthViewBitDepth( (uiCode+8) ); |
---|
| 403 | |
---|
| 404 | for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 405 | { |
---|
| 406 | if ( i != 0 ) |
---|
| 407 | { |
---|
| 408 | if( pcVPS->getDepthId( i ) == 1 ) |
---|
| 409 | { |
---|
| 410 | READ_FLAG(uiCode, "dlt_flag[i]"); |
---|
| 411 | pcDLT->setUseDLTFlag(i, (uiCode == 1) ? true : false); |
---|
| 412 | |
---|
| 413 | if ( pcDLT->getUseDLTFlag( i ) ) |
---|
| 414 | { |
---|
| 415 | Bool bDltBitMapRepFlag = false; |
---|
| 416 | UInt uiMaxDiff = 0xffffffff; |
---|
| 417 | UInt uiMinDiff = 0; |
---|
| 418 | UInt uiCodeLength = 0; |
---|
| 419 | |
---|
| 420 | READ_FLAG(uiCode, "inter_view_dlt_pred_enable_flag[ i ]"); |
---|
| 421 | pcDLT->setInterViewDltPredEnableFlag( i, (uiCode == 1) ? true : false ); |
---|
| 422 | |
---|
| 423 | if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false ) |
---|
| 424 | { |
---|
| 425 | READ_FLAG(uiCode, "dlt_bit_map_rep_flag[ layerId ]"); |
---|
| 426 | bDltBitMapRepFlag = (uiCode == 1) ? true : false; |
---|
| 427 | } |
---|
| 428 | else |
---|
| 429 | { |
---|
| 430 | bDltBitMapRepFlag = false; |
---|
| 431 | } |
---|
| 432 | |
---|
| 433 | UInt uiNumDepthValues = 0; |
---|
| 434 | Int aiIdx2DepthValue[256]; |
---|
| 435 | |
---|
| 436 | // Bit map |
---|
| 437 | if ( bDltBitMapRepFlag ) |
---|
| 438 | { |
---|
| 439 | for (UInt d=0; d<256; d++) |
---|
| 440 | { |
---|
| 441 | READ_FLAG(uiCode, "dlt_bit_map_flag[ layerId ][ j ]"); |
---|
| 442 | if (uiCode == 1) |
---|
| 443 | { |
---|
| 444 | aiIdx2DepthValue[uiNumDepthValues] = d; |
---|
| 445 | uiNumDepthValues++; |
---|
| 446 | } |
---|
| 447 | } |
---|
| 448 | } |
---|
| 449 | // Diff Coding |
---|
| 450 | else |
---|
| 451 | { |
---|
| 452 | READ_CODE(8, uiNumDepthValues, "num_depth_values_in_dlt[i]"); // num_entry |
---|
| 453 | |
---|
| 454 | #if !H_3D_DELTA_DLT |
---|
| 455 | if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false ) // Single-view DLT Diff Coding |
---|
| 456 | #endif |
---|
| 457 | { |
---|
| 458 | // The condition if( pcVPS->getNumDepthValues(i) > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component. |
---|
| 459 | |
---|
| 460 | if (uiNumDepthValues > 1) |
---|
| 461 | { |
---|
| 462 | READ_CODE(8, uiCode, "max_diff[ layerId ]"); |
---|
| 463 | uiMaxDiff = uiCode; |
---|
| 464 | } |
---|
| 465 | else |
---|
| 466 | { |
---|
| 467 | uiMaxDiff = 0; // when there is only one value in DLT |
---|
| 468 | } |
---|
| 469 | |
---|
| 470 | if (uiNumDepthValues > 2) |
---|
| 471 | { |
---|
| 472 | uiCodeLength = (UInt) ceil(Log2(uiMaxDiff + 1)); |
---|
| 473 | READ_CODE(uiCodeLength, uiCode, "min_diff_minus1[ layerId ]"); |
---|
| 474 | uiMinDiff = uiCode + 1; |
---|
| 475 | } |
---|
| 476 | else |
---|
| 477 | { |
---|
| 478 | uiMinDiff = uiMaxDiff; // when there are only one or two values in DLT |
---|
| 479 | } |
---|
| 480 | |
---|
| 481 | READ_CODE(8, uiCode, "dlt_depth_value0[layerId]"); // entry0 |
---|
| 482 | aiIdx2DepthValue[0] = uiCode; |
---|
| 483 | |
---|
| 484 | if (uiMaxDiff == uiMinDiff) |
---|
| 485 | { |
---|
| 486 | for (UInt d=1; d<uiNumDepthValues; d++) |
---|
| 487 | { |
---|
| 488 | aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + 0; |
---|
| 489 | } |
---|
| 490 | } |
---|
| 491 | else |
---|
| 492 | { |
---|
| 493 | uiCodeLength = (UInt) ceil(Log2(uiMaxDiff - uiMinDiff + 1)); |
---|
| 494 | for (UInt d=1; d<uiNumDepthValues; d++) |
---|
| 495 | { |
---|
| 496 | READ_CODE(uiCodeLength, uiCode, "dlt_depth_value_diff_minus_min[ layerId ][ j ]"); |
---|
| 497 | aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + uiCode; |
---|
| 498 | } |
---|
| 499 | } |
---|
| 500 | |
---|
| 501 | } |
---|
| 502 | } |
---|
| 503 | |
---|
| 504 | #if H_3D_DELTA_DLT |
---|
| 505 | if( pcDLT->getInterViewDltPredEnableFlag( i ) ) |
---|
| 506 | { |
---|
| 507 | // interpret decoded values as delta DLT |
---|
| 508 | AOF( pcVPS->getDepthId( 1 ) == 1 ); |
---|
| 509 | AOF( i > 1 ); |
---|
| 510 | // assumes ref layer id to be 1 |
---|
| 511 | Int* piRefDLT = pcDLT->idx2DepthValue( 1 ); |
---|
| 512 | UInt uiRefNum = pcDLT->getNumDepthValues( 1 ); |
---|
| 513 | pcDLT->setDeltaDLT(i, piRefDLT, uiRefNum, aiIdx2DepthValue, uiNumDepthValues); |
---|
| 514 | } |
---|
| 515 | else |
---|
| 516 | { |
---|
| 517 | // store final DLT |
---|
| 518 | pcDLT->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues); |
---|
| 519 | } |
---|
| 520 | #else |
---|
| 521 | // store final DLT |
---|
| 522 | pcDLT->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues); |
---|
| 523 | #endif |
---|
| 524 | } |
---|
| 525 | } |
---|
| 526 | } |
---|
| 527 | } |
---|
| 528 | } |
---|
| 529 | |
---|
| 530 | pcPPS->setDLT( pcDLT ); |
---|
| 531 | } |
---|
| 532 | #endif |
---|
| 533 | |
---|
[608] | 534 | Void TDecCavlc::parseVUI(TComVUI* pcVUI, TComSPS *pcSPS) |
---|
| 535 | { |
---|
| 536 | #if ENC_DEC_TRACE |
---|
| 537 | fprintf( g_hTrace, "----------- vui_parameters -----------\n"); |
---|
| 538 | #endif |
---|
| 539 | UInt uiCode; |
---|
[2] | 540 | |
---|
[608] | 541 | READ_FLAG( uiCode, "aspect_ratio_info_present_flag"); pcVUI->setAspectRatioInfoPresentFlag(uiCode); |
---|
| 542 | if (pcVUI->getAspectRatioInfoPresentFlag()) |
---|
[2] | 543 | { |
---|
[608] | 544 | READ_CODE(8, uiCode, "aspect_ratio_idc"); pcVUI->setAspectRatioIdc(uiCode); |
---|
| 545 | if (pcVUI->getAspectRatioIdc() == 255) |
---|
[2] | 546 | { |
---|
[608] | 547 | READ_CODE(16, uiCode, "sar_width"); pcVUI->setSarWidth(uiCode); |
---|
| 548 | READ_CODE(16, uiCode, "sar_height"); pcVUI->setSarHeight(uiCode); |
---|
[2] | 549 | } |
---|
| 550 | } |
---|
[608] | 551 | |
---|
| 552 | READ_FLAG( uiCode, "overscan_info_present_flag"); pcVUI->setOverscanInfoPresentFlag(uiCode); |
---|
| 553 | if (pcVUI->getOverscanInfoPresentFlag()) |
---|
[56] | 554 | { |
---|
[608] | 555 | READ_FLAG( uiCode, "overscan_appropriate_flag"); pcVUI->setOverscanAppropriateFlag(uiCode); |
---|
[56] | 556 | } |
---|
[2] | 557 | |
---|
[608] | 558 | READ_FLAG( uiCode, "video_signal_type_present_flag"); pcVUI->setVideoSignalTypePresentFlag(uiCode); |
---|
[773] | 559 | #if H_MV |
---|
[738] | 560 | assert( pcSPS->getLayerId() == 0 || !pcVUI->getVideoSignalTypePresentFlag() ); |
---|
| 561 | #endif |
---|
[608] | 562 | if (pcVUI->getVideoSignalTypePresentFlag()) |
---|
[2] | 563 | { |
---|
[608] | 564 | READ_CODE(3, uiCode, "video_format"); pcVUI->setVideoFormat(uiCode); |
---|
| 565 | READ_FLAG( uiCode, "video_full_range_flag"); pcVUI->setVideoFullRangeFlag(uiCode); |
---|
| 566 | READ_FLAG( uiCode, "colour_description_present_flag"); pcVUI->setColourDescriptionPresentFlag(uiCode); |
---|
| 567 | if (pcVUI->getColourDescriptionPresentFlag()) |
---|
[2] | 568 | { |
---|
[608] | 569 | READ_CODE(8, uiCode, "colour_primaries"); pcVUI->setColourPrimaries(uiCode); |
---|
| 570 | READ_CODE(8, uiCode, "transfer_characteristics"); pcVUI->setTransferCharacteristics(uiCode); |
---|
| 571 | READ_CODE(8, uiCode, "matrix_coefficients"); pcVUI->setMatrixCoefficients(uiCode); |
---|
[2] | 572 | } |
---|
| 573 | } |
---|
[56] | 574 | |
---|
[608] | 575 | READ_FLAG( uiCode, "chroma_loc_info_present_flag"); pcVUI->setChromaLocInfoPresentFlag(uiCode); |
---|
| 576 | if (pcVUI->getChromaLocInfoPresentFlag()) |
---|
[2] | 577 | { |
---|
[608] | 578 | READ_UVLC( uiCode, "chroma_sample_loc_type_top_field" ); pcVUI->setChromaSampleLocTypeTopField(uiCode); |
---|
| 579 | READ_UVLC( uiCode, "chroma_sample_loc_type_bottom_field" ); pcVUI->setChromaSampleLocTypeBottomField(uiCode); |
---|
[2] | 580 | } |
---|
| 581 | |
---|
[608] | 582 | READ_FLAG( uiCode, "neutral_chroma_indication_flag"); pcVUI->setNeutralChromaIndicationFlag(uiCode); |
---|
[2] | 583 | |
---|
[608] | 584 | READ_FLAG( uiCode, "field_seq_flag"); pcVUI->setFieldSeqFlag(uiCode); |
---|
[2] | 585 | |
---|
[608] | 586 | READ_FLAG(uiCode, "frame_field_info_present_flag"); pcVUI->setFrameFieldInfoPresentFlag(uiCode); |
---|
[56] | 587 | |
---|
[608] | 588 | READ_FLAG( uiCode, "default_display_window_flag"); |
---|
| 589 | if (uiCode != 0) |
---|
[56] | 590 | { |
---|
[608] | 591 | Window &defDisp = pcVUI->getDefaultDisplayWindow(); |
---|
[622] | 592 | #if H_MV |
---|
| 593 | defDisp.setScaledFlag( false ); |
---|
| 594 | READ_UVLC( uiCode, "def_disp_win_left_offset" ); defDisp.setWindowLeftOffset ( uiCode ); |
---|
| 595 | READ_UVLC( uiCode, "def_disp_win_right_offset" ); defDisp.setWindowRightOffset ( uiCode ); |
---|
| 596 | READ_UVLC( uiCode, "def_disp_win_top_offset" ); defDisp.setWindowTopOffset ( uiCode ); |
---|
| 597 | READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode ); |
---|
| 598 | #else |
---|
| 599 | READ_UVLC( uiCode, "def_disp_win_left_offset" ); defDisp.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); |
---|
| 600 | READ_UVLC( uiCode, "def_disp_win_right_offset" ); defDisp.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); |
---|
| 601 | READ_UVLC( uiCode, "def_disp_win_top_offset" ); defDisp.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); |
---|
| 602 | READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); |
---|
| 603 | #endif |
---|
[56] | 604 | } |
---|
[608] | 605 | TimingInfo *timingInfo = pcVUI->getTimingInfo(); |
---|
| 606 | READ_FLAG( uiCode, "vui_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); |
---|
| 607 | if(timingInfo->getTimingInfoPresentFlag()) |
---|
[56] | 608 | { |
---|
[608] | 609 | READ_CODE( 32, uiCode, "vui_num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode); |
---|
| 610 | READ_CODE( 32, uiCode, "vui_time_scale"); timingInfo->setTimeScale (uiCode); |
---|
| 611 | READ_FLAG( uiCode, "vui_poc_proportional_to_timing_flag"); timingInfo->setPocProportionalToTimingFlag(uiCode ? true : false); |
---|
| 612 | if(timingInfo->getPocProportionalToTimingFlag()) |
---|
[2] | 613 | { |
---|
[608] | 614 | READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); |
---|
[2] | 615 | } |
---|
[608] | 616 | READ_FLAG( uiCode, "hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); |
---|
| 617 | if( pcVUI->getHrdParametersPresentFlag() ) |
---|
[56] | 618 | { |
---|
[608] | 619 | parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); |
---|
[56] | 620 | } |
---|
| 621 | } |
---|
[608] | 622 | READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode); |
---|
| 623 | if (pcVUI->getBitstreamRestrictionFlag()) |
---|
[56] | 624 | { |
---|
[608] | 625 | READ_FLAG( uiCode, "tiles_fixed_structure_flag"); pcVUI->setTilesFixedStructureFlag(uiCode); |
---|
| 626 | READ_FLAG( uiCode, "motion_vectors_over_pic_boundaries_flag"); pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode); |
---|
| 627 | READ_FLAG( uiCode, "restricted_ref_pic_lists_flag"); pcVUI->setRestrictedRefPicListsFlag(uiCode); |
---|
| 628 | READ_UVLC( uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode); |
---|
| 629 | assert(uiCode < 4096); |
---|
| 630 | READ_UVLC( uiCode, "max_bytes_per_pic_denom" ); pcVUI->setMaxBytesPerPicDenom(uiCode); |
---|
| 631 | READ_UVLC( uiCode, "max_bits_per_mincu_denom" ); pcVUI->setMaxBitsPerMinCuDenom(uiCode); |
---|
| 632 | READ_UVLC( uiCode, "log2_max_mv_length_horizontal" ); pcVUI->setLog2MaxMvLengthHorizontal(uiCode); |
---|
| 633 | READ_UVLC( uiCode, "log2_max_mv_length_vertical" ); pcVUI->setLog2MaxMvLengthVertical(uiCode); |
---|
[56] | 634 | } |
---|
[2] | 635 | } |
---|
[56] | 636 | |
---|
[608] | 637 | Void TDecCavlc::parseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1) |
---|
[56] | 638 | { |
---|
| 639 | UInt uiCode; |
---|
[608] | 640 | if( commonInfPresentFlag ) |
---|
[2] | 641 | { |
---|
[608] | 642 | READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false ); |
---|
| 643 | READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false ); |
---|
| 644 | if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) |
---|
[2] | 645 | { |
---|
[608] | 646 | READ_FLAG( uiCode, "sub_pic_cpb_params_present_flag" ); hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false ); |
---|
| 647 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
[2] | 648 | { |
---|
[608] | 649 | READ_CODE( 8, uiCode, "tick_divisor_minus2" ); hrd->setTickDivisorMinus2( uiCode ); |
---|
| 650 | READ_CODE( 5, uiCode, "du_cpb_removal_delay_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode ); |
---|
| 651 | READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false ); |
---|
| 652 | READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1" ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode ); |
---|
[2] | 653 | } |
---|
[608] | 654 | READ_CODE( 4, uiCode, "bit_rate_scale" ); hrd->setBitRateScale( uiCode ); |
---|
| 655 | READ_CODE( 4, uiCode, "cpb_size_scale" ); hrd->setCpbSizeScale( uiCode ); |
---|
| 656 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
[2] | 657 | { |
---|
[608] | 658 | READ_CODE( 4, uiCode, "cpb_size_du_scale" ); hrd->setDuCpbSizeScale( uiCode ); |
---|
[2] | 659 | } |
---|
[608] | 660 | READ_CODE( 5, uiCode, "initial_cpb_removal_delay_length_minus1" ); hrd->setInitialCpbRemovalDelayLengthMinus1( uiCode ); |
---|
| 661 | READ_CODE( 5, uiCode, "au_cpb_removal_delay_length_minus1" ); hrd->setCpbRemovalDelayLengthMinus1( uiCode ); |
---|
| 662 | READ_CODE( 5, uiCode, "dpb_output_delay_length_minus1" ); hrd->setDpbOutputDelayLengthMinus1( uiCode ); |
---|
[2] | 663 | } |
---|
| 664 | } |
---|
[608] | 665 | Int i, j, nalOrVcl; |
---|
| 666 | for( i = 0; i <= maxNumSubLayersMinus1; i ++ ) |
---|
[56] | 667 | { |
---|
[608] | 668 | READ_FLAG( uiCode, "fixed_pic_rate_general_flag" ); hrd->setFixedPicRateFlag( i, uiCode == 1 ? true : false ); |
---|
| 669 | if( !hrd->getFixedPicRateFlag( i ) ) |
---|
[2] | 670 | { |
---|
[608] | 671 | READ_FLAG( uiCode, "fixed_pic_rate_within_cvs_flag" ); hrd->setFixedPicRateWithinCvsFlag( i, uiCode == 1 ? true : false ); |
---|
[2] | 672 | } |
---|
[608] | 673 | else |
---|
[210] | 674 | { |
---|
[608] | 675 | hrd->setFixedPicRateWithinCvsFlag( i, true ); |
---|
[210] | 676 | } |
---|
[608] | 677 | hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present |
---|
| 678 | hrd->setCpbCntMinus1 ( i, 0 ); // Infered to be 0 when not present |
---|
| 679 | if( hrd->getFixedPicRateWithinCvsFlag( i ) ) |
---|
[210] | 680 | { |
---|
[608] | 681 | READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" ); hrd->setPicDurationInTcMinus1( i, uiCode ); |
---|
[210] | 682 | } |
---|
[608] | 683 | else |
---|
| 684 | { |
---|
| 685 | READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false ); |
---|
[210] | 686 | } |
---|
[608] | 687 | if (!hrd->getLowDelayHrdFlag( i )) |
---|
[210] | 688 | { |
---|
[608] | 689 | READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); |
---|
[210] | 690 | } |
---|
[608] | 691 | for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) |
---|
[210] | 692 | { |
---|
[608] | 693 | if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || |
---|
| 694 | ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) |
---|
[77] | 695 | { |
---|
[608] | 696 | for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) |
---|
[77] | 697 | { |
---|
[608] | 698 | READ_UVLC( uiCode, "bit_rate_value_minus1" ); hrd->setBitRateValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
| 699 | READ_UVLC( uiCode, "cpb_size_value_minus1" ); hrd->setCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
| 700 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
| 701 | { |
---|
| 702 | READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
| 703 | READ_UVLC( uiCode, "bit_rate_du_value_minus1" ); hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
| 704 | } |
---|
| 705 | READ_FLAG( uiCode, "cbr_flag" ); hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false ); |
---|
[77] | 706 | } |
---|
| 707 | } |
---|
| 708 | } |
---|
| 709 | } |
---|
| 710 | } |
---|
| 711 | |
---|
[608] | 712 | #if H_3D |
---|
| 713 | Void TDecCavlc::parseSPS(TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) |
---|
[56] | 714 | #else |
---|
| 715 | Void TDecCavlc::parseSPS(TComSPS* pcSPS) |
---|
[2] | 716 | #endif |
---|
| 717 | { |
---|
[56] | 718 | #if ENC_DEC_TRACE |
---|
| 719 | xTraceSPSHeader (pcSPS); |
---|
| 720 | #endif |
---|
[608] | 721 | |
---|
[56] | 722 | UInt uiCode; |
---|
[608] | 723 | READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode ); |
---|
| 724 | #if H_MV |
---|
| 725 | if ( pcSPS->getLayerId() == 0 ) |
---|
| 726 | { |
---|
[210] | 727 | #endif |
---|
[608] | 728 | READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); |
---|
| 729 | assert(uiCode <= 6); |
---|
| 730 | |
---|
| 731 | READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); |
---|
| 732 | if ( pcSPS->getMaxTLayers() == 1 ) |
---|
| 733 | { |
---|
| 734 | // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0 |
---|
| 735 | assert( uiCode == 1 ); |
---|
| 736 | } |
---|
| 737 | |
---|
| 738 | parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); |
---|
| 739 | #if H_MV |
---|
| 740 | } |
---|
[77] | 741 | #endif |
---|
[608] | 742 | READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); |
---|
| 743 | assert(uiCode <= 15); |
---|
[622] | 744 | #if H_MV |
---|
| 745 | if ( pcSPS->getLayerId() > 0 ) |
---|
| 746 | { |
---|
| 747 | READ_FLAG( uiCode, "update_rep_format_flag" ); pcSPS->setUpdateRepFormatFlag( uiCode == 1 ); |
---|
[738] | 748 | if ( pcSPS->getUpdateRepFormatFlag() ) |
---|
| 749 | { |
---|
| 750 | READ_CODE( 8, uiCode, "sps_rep_format_idx" ); pcSPS->setSpsRepFormatIdx( uiCode ); |
---|
| 751 | } |
---|
[622] | 752 | } |
---|
[738] | 753 | else |
---|
| 754 | { |
---|
[622] | 755 | #endif |
---|
[56] | 756 | READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( uiCode ); |
---|
[608] | 757 | assert(uiCode <= 3); |
---|
| 758 | // 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 |
---|
| 759 | assert (uiCode == 1); |
---|
| 760 | if( uiCode == 3 ) |
---|
| 761 | { |
---|
| 762 | READ_FLAG( uiCode, "separate_colour_plane_flag"); assert(uiCode == 0); |
---|
| 763 | } |
---|
| 764 | |
---|
[56] | 765 | READ_UVLC ( uiCode, "pic_width_in_luma_samples" ); pcSPS->setPicWidthInLumaSamples ( uiCode ); |
---|
| 766 | READ_UVLC ( uiCode, "pic_height_in_luma_samples" ); pcSPS->setPicHeightInLumaSamples( uiCode ); |
---|
[622] | 767 | #if H_MV |
---|
| 768 | } |
---|
| 769 | #endif |
---|
[608] | 770 | READ_FLAG( uiCode, "conformance_window_flag"); |
---|
[56] | 771 | if (uiCode != 0) |
---|
[2] | 772 | { |
---|
[608] | 773 | Window &conf = pcSPS->getConformanceWindow(); |
---|
[622] | 774 | #if H_MV |
---|
| 775 | // Needs to be scaled later, when ChromaFormatIdc is known. |
---|
| 776 | conf.setScaledFlag( false ); |
---|
| 777 | READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode ); |
---|
| 778 | READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode ); |
---|
| 779 | READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode ); |
---|
| 780 | READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode ); |
---|
| 781 | #else |
---|
[608] | 782 | READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); |
---|
| 783 | READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); |
---|
| 784 | READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); |
---|
| 785 | READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); |
---|
[622] | 786 | #endif |
---|
[2] | 787 | } |
---|
| 788 | |
---|
[622] | 789 | #if H_MV |
---|
[738] | 790 | if ( pcSPS->getLayerId() == 0 ) |
---|
[622] | 791 | { |
---|
| 792 | #endif |
---|
[56] | 793 | READ_UVLC( uiCode, "bit_depth_luma_minus8" ); |
---|
[608] | 794 | assert(uiCode <= 6); |
---|
| 795 | pcSPS->setBitDepthY( uiCode + 8 ); |
---|
[56] | 796 | pcSPS->setQpBDOffsetY( (Int) (6*uiCode) ); |
---|
[2] | 797 | |
---|
[56] | 798 | READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); |
---|
[608] | 799 | assert(uiCode <= 6); |
---|
| 800 | pcSPS->setBitDepthC( uiCode + 8 ); |
---|
[56] | 801 | pcSPS->setQpBDOffsetC( (Int) (6*uiCode) ); |
---|
[622] | 802 | #if H_MV |
---|
| 803 | } |
---|
| 804 | #endif |
---|
[2] | 805 | |
---|
[608] | 806 | READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); |
---|
| 807 | assert(uiCode <= 12); |
---|
[56] | 808 | |
---|
[608] | 809 | UInt subLayerOrderingInfoPresentFlag; |
---|
| 810 | READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); |
---|
| 811 | |
---|
| 812 | for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) |
---|
[2] | 813 | { |
---|
[608] | 814 | #if H_MV |
---|
| 815 | READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]"); |
---|
| 816 | #else |
---|
| 817 | READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1"); |
---|
[56] | 818 | #endif |
---|
[608] | 819 | pcSPS->setMaxDecPicBuffering( uiCode + 1, i); |
---|
| 820 | #if H_MV |
---|
| 821 | READ_UVLC ( uiCode, "sps_num_reorder_pics[i]" ); |
---|
| 822 | #else |
---|
| 823 | READ_UVLC ( uiCode, "sps_num_reorder_pics" ); |
---|
| 824 | #endif |
---|
[56] | 825 | pcSPS->setNumReorderPics(uiCode, i); |
---|
[608] | 826 | #if H_MV |
---|
[622] | 827 | READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]"); |
---|
| 828 | #else |
---|
| 829 | READ_UVLC ( uiCode, "sps_max_latency_increase_plus1"); |
---|
[608] | 830 | #endif |
---|
[56] | 831 | pcSPS->setMaxLatencyIncrease( uiCode, i ); |
---|
[608] | 832 | |
---|
| 833 | if (!subLayerOrderingInfoPresentFlag) |
---|
| 834 | { |
---|
| 835 | for (i++; i <= pcSPS->getMaxTLayers()-1; i++) |
---|
| 836 | { |
---|
| 837 | pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i); |
---|
| 838 | pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i); |
---|
| 839 | pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i); |
---|
| 840 | } |
---|
| 841 | break; |
---|
| 842 | } |
---|
[2] | 843 | } |
---|
| 844 | |
---|
[56] | 845 | READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" ); |
---|
[608] | 846 | Int log2MinCUSize = uiCode + 3; |
---|
| 847 | pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); |
---|
[56] | 848 | READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" ); |
---|
[608] | 849 | pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); |
---|
| 850 | Int maxCUDepthDelta = uiCode; |
---|
| 851 | pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); |
---|
| 852 | pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) ); |
---|
[56] | 853 | READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); |
---|
[2] | 854 | |
---|
[56] | 855 | READ_UVLC( uiCode, "log2_diff_max_min_transform_block_size" ); pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() ); |
---|
| 856 | pcSPS->setMaxTrSize( 1<<(uiCode + pcSPS->getQuadtreeTULog2MinSize()) ); |
---|
[2] | 857 | |
---|
[608] | 858 | READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" ); pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 ); |
---|
| 859 | READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" ); pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 ); |
---|
[2] | 860 | |
---|
[608] | 861 | Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() ); |
---|
| 862 | pcSPS->setMaxCUDepth( maxCUDepthDelta + addCuDepth ); |
---|
[2] | 863 | |
---|
[56] | 864 | READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); |
---|
[608] | 865 | if(pcSPS->getScalingListFlag()) |
---|
[2] | 866 | { |
---|
[622] | 867 | #if H_MV |
---|
| 868 | if ( pcSPS->getLayerId() > 0 ) |
---|
| 869 | { |
---|
| 870 | READ_FLAG( uiCode, "sps_infer_scaling_list_flag" ); pcSPS->setSpsInferScalingListFlag( uiCode == 1 ); |
---|
| 871 | } |
---|
| 872 | |
---|
| 873 | if ( pcSPS->getSpsInferScalingListFlag() ) |
---|
| 874 | { |
---|
| 875 | READ_CODE( 6, uiCode, "sps_scaling_list_ref_layer_id" ); pcSPS->setSpsScalingListRefLayerId( uiCode ); |
---|
| 876 | } |
---|
| 877 | else |
---|
| 878 | { |
---|
| 879 | #endif |
---|
[608] | 880 | READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode ); |
---|
| 881 | if(pcSPS->getScalingListPresentFlag ()) |
---|
| 882 | { |
---|
| 883 | parseScalingList( pcSPS->getScalingList() ); |
---|
| 884 | } |
---|
[622] | 885 | #if H_MV |
---|
| 886 | } |
---|
| 887 | #endif |
---|
[56] | 888 | } |
---|
[608] | 889 | READ_FLAG( uiCode, "amp_enabled_flag" ); pcSPS->setUseAMP( uiCode ); |
---|
| 890 | READ_FLAG( uiCode, "sample_adaptive_offset_enabled_flag" ); pcSPS->setUseSAO ( uiCode ? true : false ); |
---|
| 891 | |
---|
| 892 | READ_FLAG( uiCode, "pcm_enabled_flag" ); pcSPS->setUsePCM( uiCode ? true : false ); |
---|
[56] | 893 | if( pcSPS->getUsePCM() ) |
---|
| 894 | { |
---|
[608] | 895 | READ_CODE( 4, uiCode, "pcm_sample_bit_depth_luma_minus1" ); pcSPS->setPCMBitDepthLuma ( 1 + uiCode ); |
---|
| 896 | READ_CODE( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1" ); pcSPS->setPCMBitDepthChroma ( 1 + uiCode ); |
---|
| 897 | READ_UVLC( uiCode, "log2_min_pcm_luma_coding_block_size_minus3" ); pcSPS->setPCMLog2MinSize (uiCode+3); |
---|
| 898 | READ_UVLC( uiCode, "log2_diff_max_min_pcm_luma_coding_block_size" ); pcSPS->setPCMLog2MaxSize ( uiCode+pcSPS->getPCMLog2MinSize() ); |
---|
| 899 | READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" ); pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false ); |
---|
[56] | 900 | } |
---|
[2] | 901 | |
---|
[608] | 902 | READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); |
---|
| 903 | assert(uiCode <= 64); |
---|
| 904 | pcSPS->createRPSList(uiCode); |
---|
[2] | 905 | |
---|
[56] | 906 | TComRPSList* rpsList = pcSPS->getRPSList(); |
---|
| 907 | TComReferencePictureSet* rps; |
---|
[2] | 908 | |
---|
[56] | 909 | for(UInt i=0; i< rpsList->getNumberOfReferencePictureSets(); i++) |
---|
[2] | 910 | { |
---|
[56] | 911 | rps = rpsList->getReferencePictureSet(i); |
---|
| 912 | parseShortTermRefPicSet(pcSPS,rps,i); |
---|
[2] | 913 | } |
---|
[56] | 914 | READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefsPresent(uiCode); |
---|
[608] | 915 | if (pcSPS->getLongTermRefsPresent()) |
---|
[56] | 916 | { |
---|
[608] | 917 | READ_UVLC( uiCode, "num_long_term_ref_pic_sps" ); |
---|
| 918 | pcSPS->setNumLongTermRefPicSPS(uiCode); |
---|
| 919 | for (UInt k = 0; k < pcSPS->getNumLongTermRefPicSPS(); k++) |
---|
| 920 | { |
---|
| 921 | READ_CODE( pcSPS->getBitsForPOC(), uiCode, "lt_ref_pic_poc_lsb_sps" ); |
---|
| 922 | pcSPS->setLtRefPicPocLsbSps(k, uiCode); |
---|
| 923 | READ_FLAG( uiCode, "used_by_curr_pic_lt_sps_flag[i]"); |
---|
| 924 | pcSPS->setUsedByCurrPicLtSPSFlag(k, uiCode?1:0); |
---|
| 925 | } |
---|
[56] | 926 | } |
---|
[608] | 927 | READ_FLAG( uiCode, "sps_temporal_mvp_enable_flag" ); pcSPS->setTMVPFlagsPresent(uiCode); |
---|
[2] | 928 | |
---|
[608] | 929 | READ_FLAG( uiCode, "sps_strong_intra_smoothing_enable_flag" ); pcSPS->setUseStrongIntraSmoothing(uiCode); |
---|
[2] | 930 | |
---|
[608] | 931 | READ_FLAG( uiCode, "vui_parameters_present_flag" ); pcSPS->setVuiParametersPresentFlag(uiCode); |
---|
| 932 | |
---|
| 933 | if (pcSPS->getVuiParametersPresentFlag()) |
---|
[2] | 934 | { |
---|
[608] | 935 | parseVUI(pcSPS->getVuiParameters(), pcSPS); |
---|
| 936 | } |
---|
| 937 | |
---|
| 938 | READ_FLAG( uiCode, "sps_extension_flag"); |
---|
[773] | 939 | #if H_MV |
---|
[738] | 940 | pcSPS->setSpsExtensionFlag( uiCode ); |
---|
[773] | 941 | if (pcSPS->getSpsExtensionFlag( ) ) |
---|
| 942 | #else |
---|
| 943 | if (uiCode) |
---|
[738] | 944 | #endif |
---|
[608] | 945 | { |
---|
[622] | 946 | #if H_MV |
---|
[738] | 947 | for (Int i = 0; i < PS_EX_T_MAX_NUM; i++) |
---|
| 948 | { |
---|
| 949 | READ_FLAG( uiCode, "sps_extension_type_flag" ); pcSPS->setSpsExtensionTypeFlag( i, uiCode ); |
---|
| 950 | #if H_3D |
---|
| 951 | assert( !pcSPS->getSpsExtensionTypeFlag( i ) || i == PS_EX_T_MV || i == PS_EX_T_3D || i == PS_EX_T_ESC ); |
---|
| 952 | #else |
---|
| 953 | assert( !pcSPS->getSpsExtensionTypeFlag( i ) || i == PS_EX_T_MV || i == PS_EX_T_ESC ); |
---|
| 954 | #endif |
---|
| 955 | } |
---|
| 956 | |
---|
| 957 | if( pcSPS->getSpsExtensionTypeFlag( PS_EX_T_MV )) |
---|
| 958 | { |
---|
| 959 | parseSPSExtension( pcSPS ); |
---|
| 960 | } |
---|
| 961 | |
---|
| 962 | #if H_3D |
---|
| 963 | if( pcSPS->getSpsExtensionTypeFlag( PS_EX_T_3D )) |
---|
| 964 | { |
---|
| 965 | parseSPSExtension2( pcSPS, viewIndex, depthFlag ); |
---|
| 966 | } |
---|
| 967 | #endif |
---|
| 968 | |
---|
| 969 | if ( pcSPS->getSpsExtensionTypeFlag( PS_EX_T_ESC )) |
---|
| 970 | { |
---|
| 971 | #endif |
---|
[622] | 972 | while ( xMoreRbspData() ) |
---|
| 973 | { |
---|
| 974 | READ_FLAG( uiCode, "sps_extension_data_flag"); |
---|
| 975 | } |
---|
[773] | 976 | #if H_MV |
---|
[738] | 977 | } |
---|
[622] | 978 | #endif |
---|
| 979 | } |
---|
| 980 | } |
---|
[655] | 981 | |
---|
| 982 | #if H_MV |
---|
[622] | 983 | Void TDecCavlc::parseSPSExtension( TComSPS* pcSPS ) |
---|
| 984 | { |
---|
| 985 | UInt uiCode; |
---|
| 986 | READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" ); pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false); |
---|
[738] | 987 | |
---|
| 988 | READ_UVLC( uiCode, "num_scaled_ref_layer_offsets" ); pcSPS->setNumScaledRefLayerOffsets( uiCode ); |
---|
| 989 | |
---|
| 990 | for( Int i = 0; i < pcSPS->getNumScaledRefLayerOffsets( ); i++) |
---|
| 991 | { |
---|
| 992 | READ_CODE( 6, uiCode, "scaled_ref_layer_id" ); pcSPS->setScaledRefLayerId( i, uiCode ); |
---|
| 993 | |
---|
| 994 | Int j = pcSPS->getScaledRefLayerId( i ); |
---|
| 995 | Int iCode; |
---|
| 996 | READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); pcSPS->setScaledRefLayerLeftOffset( j, iCode ); |
---|
| 997 | READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); pcSPS->setScaledRefLayerTopOffset( j, iCode ); |
---|
| 998 | READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); pcSPS->setScaledRefLayerRightOffset( j, iCode ); |
---|
| 999 | READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); pcSPS->setScaledRefLayerBottomOffset( j, iCode ); |
---|
| 1000 | } |
---|
[622] | 1001 | } |
---|
[56] | 1002 | |
---|
[622] | 1003 | #if H_3D |
---|
| 1004 | Void TDecCavlc::parseSPSExtension2( TComSPS* pcSPS, Int viewIndex, Bool depthFlag ) |
---|
| 1005 | { |
---|
| 1006 | UInt uiCode; |
---|
| 1007 | #if H_3D_QTLPC |
---|
| 1008 | //GT: This has to go to VPS |
---|
| 1009 | if( depthFlag ) |
---|
| 1010 | { |
---|
| 1011 | READ_FLAG( uiCode, "use_qtl_flag" ); |
---|
| 1012 | pcSPS->setUseQTL( uiCode ); |
---|
| 1013 | READ_FLAG( uiCode, "use_pc_flag" ); |
---|
| 1014 | pcSPS->setUsePC( uiCode ); |
---|
| 1015 | } |
---|
| 1016 | #endif |
---|
| 1017 | } |
---|
| 1018 | #endif |
---|
| 1019 | #endif |
---|
| 1020 | |
---|
[608] | 1021 | Void TDecCavlc::parseVPS(TComVPS* pcVPS) |
---|
| 1022 | { |
---|
| 1023 | UInt uiCode; |
---|
| 1024 | |
---|
| 1025 | READ_CODE( 4, uiCode, "vps_video_parameter_set_id" ); pcVPS->setVPSId( uiCode ); |
---|
| 1026 | READ_CODE( 2, uiCode, "vps_reserved_three_2bits" ); assert(uiCode == 3); |
---|
| 1027 | #if H_MV |
---|
[738] | 1028 | READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); pcVPS->setMaxLayersMinus1( std::min( uiCode, (UInt) ( MAX_NUM_LAYER_IDS-1) ) ); |
---|
| 1029 | #else |
---|
[608] | 1030 | READ_CODE( 6, uiCode, "vps_reserved_zero_6bits" ); assert(uiCode == 0); |
---|
| 1031 | #endif |
---|
| 1032 | READ_CODE( 3, uiCode, "vps_max_sub_layers_minus1" ); pcVPS->setMaxTLayers( uiCode + 1 ); |
---|
| 1033 | READ_FLAG( uiCode, "vps_temporal_id_nesting_flag" ); pcVPS->setTemporalNestingFlag( uiCode ? true:false ); |
---|
| 1034 | assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag()); |
---|
| 1035 | #if H_MV |
---|
| 1036 | READ_CODE( 16, uiCode, "vps_extension_offset" ); |
---|
| 1037 | #else |
---|
| 1038 | READ_CODE( 16, uiCode, "vps_reserved_ffff_16bits" ); assert(uiCode == 0xffff); |
---|
| 1039 | #endif |
---|
| 1040 | parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1); |
---|
| 1041 | UInt subLayerOrderingInfoPresentFlag; |
---|
| 1042 | READ_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag"); |
---|
| 1043 | for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) |
---|
| 1044 | { |
---|
| 1045 | READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); |
---|
| 1046 | READ_UVLC( uiCode, "vps_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); |
---|
| 1047 | READ_UVLC( uiCode, "vps_max_latency_increase_plus1[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); |
---|
| 1048 | |
---|
| 1049 | if (!subLayerOrderingInfoPresentFlag) |
---|
| 1050 | { |
---|
| 1051 | for (i++; i <= pcVPS->getMaxTLayers()-1; i++) |
---|
[56] | 1052 | { |
---|
[608] | 1053 | pcVPS->setMaxDecPicBuffering(pcVPS->getMaxDecPicBuffering(0), i); |
---|
| 1054 | pcVPS->setNumReorderPics(pcVPS->getNumReorderPics(0), i); |
---|
| 1055 | pcVPS->setMaxLatencyIncrease(pcVPS->getMaxLatencyIncrease(0), i); |
---|
[56] | 1056 | } |
---|
[608] | 1057 | break; |
---|
[2] | 1058 | } |
---|
[608] | 1059 | } |
---|
[56] | 1060 | |
---|
[608] | 1061 | assert( pcVPS->getNumHrdParameters() < MAX_VPS_OP_SETS_PLUS1 ); |
---|
| 1062 | #if H_MV |
---|
| 1063 | assert( pcVPS->getVpsMaxLayerId() < MAX_VPS_NUH_LAYER_ID_PLUS1 ); |
---|
| 1064 | READ_CODE( 6, uiCode, "vps_max_layer_id" ); pcVPS->setVpsMaxLayerId( uiCode ); |
---|
| 1065 | |
---|
| 1066 | READ_UVLC( uiCode, "vps_max_num_layer_sets_minus1" ); pcVPS->setVpsNumLayerSetsMinus1( uiCode ); |
---|
| 1067 | for( UInt opsIdx = 1; opsIdx <= pcVPS->getVpsNumLayerSetsMinus1(); opsIdx ++ ) |
---|
| 1068 | { |
---|
| 1069 | for( UInt i = 0; i <= pcVPS->getVpsMaxLayerId(); i ++ ) |
---|
| 1070 | #else |
---|
| 1071 | assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 ); |
---|
| 1072 | READ_CODE( 6, uiCode, "vps_max_nuh_reserved_zero_layer_id" ); pcVPS->setMaxNuhReservedZeroLayerId( uiCode ); |
---|
| 1073 | READ_UVLC( uiCode, "vps_max_op_sets_minus1" ); pcVPS->setMaxOpSets( uiCode + 1 ); |
---|
| 1074 | for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getMaxOpSets() - 1 ); opsIdx ++ ) |
---|
| 1075 | { |
---|
| 1076 | // Operation point set |
---|
| 1077 | for( UInt i = 0; i <= pcVPS->getMaxNuhReservedZeroLayerId(); i ++ ) |
---|
| 1078 | #endif |
---|
[2] | 1079 | { |
---|
[608] | 1080 | READ_FLAG( uiCode, "layer_id_included_flag[opsIdx][i]" ); pcVPS->setLayerIdIncludedFlag( uiCode == 1 ? true : false, opsIdx, i ); |
---|
[2] | 1081 | } |
---|
| 1082 | } |
---|
[773] | 1083 | #if H_MV |
---|
[738] | 1084 | pcVPS->deriveLayerSetLayerIdList(); |
---|
| 1085 | #endif |
---|
[608] | 1086 | TimingInfo *timingInfo = pcVPS->getTimingInfo(); |
---|
| 1087 | READ_FLAG( uiCode, "vps_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); |
---|
| 1088 | if(timingInfo->getTimingInfoPresentFlag()) |
---|
[2] | 1089 | { |
---|
[608] | 1090 | READ_CODE( 32, uiCode, "vps_num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode); |
---|
| 1091 | READ_CODE( 32, uiCode, "vps_time_scale"); timingInfo->setTimeScale (uiCode); |
---|
| 1092 | READ_FLAG( uiCode, "vps_poc_proportional_to_timing_flag"); timingInfo->setPocProportionalToTimingFlag(uiCode ? true : false); |
---|
| 1093 | if(timingInfo->getPocProportionalToTimingFlag()) |
---|
[2] | 1094 | { |
---|
[608] | 1095 | READ_UVLC( uiCode, "vps_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); |
---|
| 1096 | } |
---|
| 1097 | READ_UVLC( uiCode, "vps_num_hrd_parameters" ); pcVPS->setNumHrdParameters( uiCode ); |
---|
[56] | 1098 | |
---|
[608] | 1099 | if( pcVPS->getNumHrdParameters() > 0 ) |
---|
| 1100 | { |
---|
| 1101 | pcVPS->createHrdParamBuffer(); |
---|
| 1102 | } |
---|
| 1103 | for( UInt i = 0; i < pcVPS->getNumHrdParameters(); i ++ ) |
---|
| 1104 | { |
---|
| 1105 | READ_UVLC( uiCode, "hrd_op_set_idx" ); pcVPS->setHrdOpSetIdx( uiCode, i ); |
---|
| 1106 | if( i > 0 ) |
---|
[2] | 1107 | { |
---|
[608] | 1108 | READ_FLAG( uiCode, "cprms_present_flag[i]" ); pcVPS->setCprmsPresentFlag( uiCode == 1 ? true : false, i ); |
---|
[2] | 1109 | } |
---|
[608] | 1110 | parseHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); |
---|
[56] | 1111 | } |
---|
[608] | 1112 | } |
---|
| 1113 | READ_FLAG( uiCode, "vps_extension_flag" ); |
---|
| 1114 | if (uiCode) |
---|
| 1115 | { |
---|
| 1116 | #if H_MV |
---|
| 1117 | m_pcBitstream->readOutTrailingBits(); |
---|
[622] | 1118 | parseVPSExtension( pcVPS ); |
---|
| 1119 | READ_FLAG( uiCode, "vps_extension2_flag" ); |
---|
| 1120 | if (uiCode) |
---|
| 1121 | { |
---|
| 1122 | #if H_3D |
---|
| 1123 | m_pcBitstream->readOutTrailingBits(); |
---|
[758] | 1124 | pcVPS->createCamPars(pcVPS->getNumViews()); |
---|
[622] | 1125 | parseVPSExtension2( pcVPS ); |
---|
| 1126 | READ_FLAG( uiCode, "vps_extension3_flag" ); |
---|
| 1127 | if (uiCode) |
---|
| 1128 | { |
---|
| 1129 | #endif |
---|
| 1130 | #endif |
---|
| 1131 | while ( xMoreRbspData() ) |
---|
| 1132 | { |
---|
| 1133 | READ_FLAG( uiCode, "vps_extension_data_flag"); |
---|
| 1134 | } |
---|
| 1135 | #if H_MV |
---|
| 1136 | #if H_3D |
---|
| 1137 | } |
---|
| 1138 | #endif |
---|
| 1139 | } |
---|
| 1140 | #endif |
---|
| 1141 | } |
---|
[655] | 1142 | return; |
---|
[622] | 1143 | } |
---|
[2] | 1144 | |
---|
[622] | 1145 | #if H_MV |
---|
| 1146 | Void TDecCavlc::parseVPSExtension( TComVPS* pcVPS ) |
---|
| 1147 | { |
---|
| 1148 | UInt uiCode; |
---|
| 1149 | READ_FLAG( uiCode, "avc_base_layer_flag" ); pcVPS->setAvcBaseLayerFlag( uiCode == 1 ? true : false ); |
---|
[738] | 1150 | READ_FLAG( uiCode, "vps_vui_present_flag" ); pcVPS->setVpsVuiPresentFlag( uiCode == 1 ); if ( pcVPS->getVpsVuiPresentFlag() ) |
---|
| 1151 | { |
---|
[622] | 1152 | READ_CODE( 16, uiCode, "vps_vui_offset" ); pcVPS->setVpsVuiOffset( uiCode ); |
---|
[738] | 1153 | } |
---|
| 1154 | |
---|
[622] | 1155 | READ_FLAG( uiCode, "splitting_flag" ); pcVPS->setSplittingFlag( uiCode == 1 ? true : false ); |
---|
| 1156 | |
---|
| 1157 | for( Int sIdx = 0; sIdx < MAX_NUM_SCALABILITY_TYPES; sIdx++ ) |
---|
| 1158 | { |
---|
| 1159 | READ_FLAG( uiCode, "scalability_mask_flag[i]" ); pcVPS->setScalabilityMaskFlag( sIdx, uiCode == 1 ? true : false ); |
---|
| 1160 | } |
---|
| 1161 | |
---|
| 1162 | for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes( ) - ( pcVPS->getSplittingFlag() ? 1 : 0 ); sIdx++ ) |
---|
| 1163 | { |
---|
| 1164 | READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" ); pcVPS->setDimensionIdLen( sIdx, uiCode + 1 ); |
---|
| 1165 | } |
---|
| 1166 | |
---|
| 1167 | if ( pcVPS->getSplittingFlag() ) |
---|
| 1168 | { |
---|
| 1169 | pcVPS->setDimensionIdLen( pcVPS->getNumScalabilityTypes( ) - 1, pcVPS->inferLastDimsionIdLenMinus1() ); |
---|
| 1170 | } |
---|
| 1171 | |
---|
| 1172 | READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" ); pcVPS->setVpsNuhLayerIdPresentFlag( uiCode == 1 ? true : false ); |
---|
| 1173 | |
---|
| 1174 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1175 | { |
---|
| 1176 | if ( pcVPS->getVpsNuhLayerIdPresentFlag() ) |
---|
| 1177 | { |
---|
| 1178 | READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" ); pcVPS->setLayerIdInNuh( i, uiCode ); |
---|
| 1179 | } |
---|
| 1180 | else |
---|
| 1181 | { |
---|
| 1182 | pcVPS->setLayerIdInNuh( i, i );; |
---|
| 1183 | } |
---|
| 1184 | |
---|
| 1185 | pcVPS->setLayerIdInVps( pcVPS->getLayerIdInNuh( i ), i ); |
---|
| 1186 | |
---|
| 1187 | for( Int j = 0; j < pcVPS->getNumScalabilityTypes() ; j++ ) |
---|
| 1188 | { |
---|
| 1189 | if ( !pcVPS->getSplittingFlag() ) |
---|
| 1190 | { |
---|
| 1191 | READ_CODE( pcVPS->getDimensionIdLen( j ), uiCode, "dimension_id[i][j]" ); pcVPS->setDimensionId( i, j, uiCode ); |
---|
| 1192 | } |
---|
| 1193 | else |
---|
| 1194 | { |
---|
| 1195 | pcVPS->setDimensionId( i, j, pcVPS->inferDimensionId( i, j) ); |
---|
| 1196 | } |
---|
| 1197 | } |
---|
| 1198 | } |
---|
| 1199 | |
---|
[738] | 1200 | READ_CODE( 4, uiCode, "view_id_len" ); pcVPS->setViewIdLen( uiCode ); |
---|
| 1201 | |
---|
| 1202 | if ( pcVPS->getViewIdLen( ) > 0 ) |
---|
| 1203 | { |
---|
| 1204 | for( Int i = 0; i < pcVPS->getNumViews(); i++ ) |
---|
| 1205 | { |
---|
| 1206 | READ_CODE( pcVPS->getViewIdLen( ), uiCode, "view_id_val[i]" ); pcVPS->setViewIdVal( i, uiCode ); |
---|
| 1207 | } |
---|
| 1208 | } |
---|
| 1209 | else |
---|
| 1210 | { |
---|
| 1211 | for( Int i = 0; i < pcVPS->getNumViews(); i++ ) |
---|
| 1212 | { |
---|
| 1213 | pcVPS->setViewIdVal( i, 0 ); |
---|
| 1214 | } |
---|
| 1215 | } |
---|
[622] | 1216 | |
---|
| 1217 | |
---|
| 1218 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1219 | { |
---|
| 1220 | for( Int j = 0; j < i; j++ ) |
---|
| 1221 | { |
---|
| 1222 | READ_FLAG( uiCode, "direct_dependency_flag[i][j]" ); pcVPS->setDirectDependencyFlag( i, j, uiCode ); |
---|
| 1223 | } |
---|
| 1224 | } |
---|
[738] | 1225 | pcVPS->setRefLayers(); |
---|
| 1226 | READ_FLAG( uiCode, "vps_sub_layers_max_minus1_present_flag" ); pcVPS->setVpsSubLayersMaxMinus1PresentFlag( uiCode == 1 ); |
---|
| 1227 | if ( pcVPS->getVpsSubLayersMaxMinus1PresentFlag() ) |
---|
| 1228 | { |
---|
| 1229 | for (Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1230 | { |
---|
| 1231 | READ_CODE( 3, uiCode, "sub_layers_vps_max_minus1" ); pcVPS->setSubLayersVpsMaxMinus1( i, uiCode ); |
---|
| 1232 | pcVPS->checkSubLayersVpsMaxMinus1( i ); |
---|
[622] | 1233 | |
---|
[738] | 1234 | } |
---|
| 1235 | } |
---|
| 1236 | else |
---|
| 1237 | { |
---|
| 1238 | for (Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1239 | { |
---|
| 1240 | pcVPS->setSubLayersVpsMaxMinus1( i, pcVPS->getMaxTLayers( ) - 1); |
---|
| 1241 | } |
---|
| 1242 | } |
---|
[622] | 1243 | READ_FLAG( uiCode, "max_tid_ref_present_flag" ); pcVPS->setMaxTidRefPresentFlag( uiCode == 1 ); |
---|
| 1244 | |
---|
| 1245 | if ( pcVPS->getMaxTidRefPresentFlag() ) |
---|
| 1246 | { |
---|
| 1247 | for( Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1248 | { |
---|
[738] | 1249 | for( Int j = i + 1; j <= pcVPS->getMaxLayersMinus1(); j++ ) |
---|
| 1250 | { |
---|
| 1251 | if ( pcVPS->getDirectDependencyFlag(j,i) ) |
---|
| 1252 | { |
---|
| 1253 | READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1" ); pcVPS->setMaxTidIlRefPicsPlus1( i, j, uiCode ); |
---|
| 1254 | } |
---|
| 1255 | } |
---|
[622] | 1256 | } |
---|
| 1257 | } |
---|
| 1258 | |
---|
| 1259 | READ_FLAG( uiCode, "all_ref_layers_active_flag" ); pcVPS->setAllRefLayersActiveFlag( uiCode == 1 ); |
---|
| 1260 | READ_CODE( 10, uiCode, "vps_number_layer_sets_minus1" ); pcVPS->setVpsNumberLayerSetsMinus1 ( uiCode ); |
---|
| 1261 | READ_CODE( 6, uiCode, "vps_num_profile_tier_level_minus1" ); pcVPS->setVpsNumProfileTierLevelMinus1( uiCode ); |
---|
| 1262 | |
---|
| 1263 | for( Int i = 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ ) |
---|
| 1264 | { |
---|
| 1265 | READ_FLAG( uiCode, "vps_profile_present_flag[i]" ); pcVPS->setVpsProfilePresentFlag( i, uiCode == 1 ); |
---|
| 1266 | if( !pcVPS->getVpsProfilePresentFlag( i ) ) |
---|
| 1267 | { |
---|
| 1268 | READ_CODE( 6, uiCode, "profile_ref_minus1[i]" ); pcVPS->setProfileRefMinus1( i, uiCode ); |
---|
[738] | 1269 | pcVPS->checkProfileRefMinus1( i ); |
---|
[622] | 1270 | } |
---|
| 1271 | parsePTL ( pcVPS->getPTL( i ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers()-1); |
---|
| 1272 | if( !pcVPS->getVpsProfilePresentFlag( i ) ) |
---|
| 1273 | { |
---|
| 1274 | TComPTL temp = *pcVPS->getPTL( i ); |
---|
| 1275 | *pcVPS->getPTL( i ) = *pcVPS->getPTL( pcVPS->getProfileRefMinus1( i ) + 1 ); |
---|
| 1276 | pcVPS->getPTL( i )->copyLevelFrom( &temp ); |
---|
| 1277 | } |
---|
| 1278 | } |
---|
| 1279 | |
---|
| 1280 | Int numOutputLayerSets = pcVPS->getVpsNumberLayerSetsMinus1( ) + 1; |
---|
| 1281 | |
---|
| 1282 | READ_FLAG( uiCode, "more_output_layer_sets_than_default_flag" ); pcVPS->setMoreOutputLayerSetsThanDefaultFlag( uiCode == 1 ); |
---|
| 1283 | |
---|
| 1284 | if ( pcVPS->getMoreOutputLayerSetsThanDefaultFlag( ) ) |
---|
| 1285 | { |
---|
| 1286 | READ_CODE( 10, uiCode, "num_add_output_layer_sets_minus1" ); pcVPS->setNumAddOutputLayerSetsMinus1( uiCode ); |
---|
| 1287 | numOutputLayerSets += ( pcVPS->getNumAddOutputLayerSetsMinus1( ) + 1); |
---|
| 1288 | } |
---|
| 1289 | |
---|
| 1290 | if( numOutputLayerSets > 1) |
---|
| 1291 | { |
---|
[738] | 1292 | READ_CODE( 2, uiCode, "default_one_target_output_layer_idc" ); pcVPS->setDefaultOneTargetOutputLayerIdc( uiCode ); |
---|
| 1293 | pcVPS->checkDefaultOneTargetOutputLayerIdc(); |
---|
[622] | 1294 | } |
---|
| 1295 | |
---|
[738] | 1296 | pcVPS->setOutputLayerFlag(0, 0, pcVPS->inferOutputLayerFlag( 0, 0 )); |
---|
| 1297 | pcVPS->setOutputLayerSetIdxMinus1(0, -1); |
---|
[622] | 1298 | for( Int i = 1; i < numOutputLayerSets; i++ ) |
---|
| 1299 | { |
---|
| 1300 | if( i > pcVPS->getVpsNumberLayerSetsMinus1( ) ) |
---|
| 1301 | { |
---|
| 1302 | READ_UVLC( uiCode, "output_layer_set_idx_minus1[i]" ); pcVPS->setOutputLayerSetIdxMinus1( i, uiCode ); |
---|
| 1303 | for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1; j++ ) |
---|
| 1304 | { |
---|
| 1305 | READ_FLAG( uiCode, "output_layer_flag" ); pcVPS->setOutputLayerFlag( i, j, uiCode == 1 ); |
---|
| 1306 | } |
---|
| 1307 | } |
---|
[738] | 1308 | else |
---|
| 1309 | { // These inference rules would also be helpful in spec text |
---|
| 1310 | pcVPS->setOutputLayerSetIdxMinus1(i, i - 1 ); |
---|
| 1311 | for( Int j = 0; j < pcVPS->getNumLayersInIdList( j ) - 1; j++ ) |
---|
| 1312 | { |
---|
| 1313 | pcVPS->setOutputLayerFlag(i,j, pcVPS->inferOutputLayerFlag( i, j )); |
---|
| 1314 | } |
---|
| 1315 | } |
---|
| 1316 | |
---|
[622] | 1317 | if ( pcVPS->getProfileLevelTierIdxLen() > 0 ) |
---|
| 1318 | { |
---|
| 1319 | READ_CODE( pcVPS->getProfileLevelTierIdxLen(), uiCode,"profile_level_tier_idx[ i ]" ); pcVPS->setProfileLevelTierIdx( i , uiCode ); |
---|
| 1320 | } |
---|
| 1321 | } |
---|
[738] | 1322 | if( pcVPS->getMaxLayersMinus1() > 0 ) |
---|
| 1323 | { |
---|
| 1324 | READ_FLAG( uiCode, "alt_output_layer_flag" ); pcVPS->setAltOutputLayerFlag( uiCode == 1 ); |
---|
| 1325 | } |
---|
| 1326 | pcVPS->deriveTargetLayerIdLists(); |
---|
[622] | 1327 | READ_FLAG( uiCode, "rep_format_idx_present_flag" ); pcVPS->setRepFormatIdxPresentFlag( uiCode == 1 ); |
---|
| 1328 | if ( pcVPS->getRepFormatIdxPresentFlag() ) |
---|
| 1329 | { |
---|
| 1330 | READ_CODE( 4, uiCode, "vps_num_rep_formats_minus1" ); pcVPS->setVpsNumRepFormatsMinus1( uiCode ); |
---|
| 1331 | } |
---|
| 1332 | |
---|
| 1333 | for (Int i = 0; i <= pcVPS->getVpsNumRepFormatsMinus1(); i++ ) |
---|
| 1334 | { |
---|
| 1335 | assert( pcVPS->getRepFormat(i) == NULL ); |
---|
[738] | 1336 | TComRepFormat* curRepFormat = new TComRepFormat(); |
---|
| 1337 | TComRepFormat* prevRepFormat = i > 0 ? pcVPS->getRepFormat( i - 1) : NULL; |
---|
| 1338 | parseRepFormat( i, curRepFormat , prevRepFormat); |
---|
| 1339 | pcVPS->setRepFormat(i, curRepFormat ); |
---|
[622] | 1340 | } |
---|
| 1341 | |
---|
| 1342 | if( pcVPS->getRepFormatIdxPresentFlag() ) |
---|
| 1343 | { |
---|
| 1344 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1345 | { |
---|
| 1346 | if( pcVPS->getVpsNumRepFormatsMinus1() > 0 ) |
---|
| 1347 | { |
---|
[738] | 1348 | READ_CODE( 8, uiCode, "vps_rep_format_idx" ); pcVPS->setVpsRepFormatIdx( i, uiCode ); |
---|
[622] | 1349 | } |
---|
| 1350 | } |
---|
| 1351 | } |
---|
| 1352 | |
---|
| 1353 | READ_FLAG( uiCode, "max_one_active_ref_layer_flag" ); pcVPS->setMaxOneActiveRefLayerFlag ( uiCode == 1 ); |
---|
[738] | 1354 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1355 | { |
---|
| 1356 | if( pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ) == 0 ) |
---|
| 1357 | { |
---|
| 1358 | READ_FLAG( uiCode, "poc_lsb_not_present_flag" ); pcVPS->setPocLsbNotPresentFlag( i, uiCode == 1 ); |
---|
| 1359 | } |
---|
| 1360 | } |
---|
| 1361 | |
---|
| 1362 | parseDpbSize( pcVPS ); |
---|
| 1363 | |
---|
[622] | 1364 | READ_UVLC( uiCode, "direct_dep_type_len_minus2") ; pcVPS->setDirectDepTypeLenMinus2 ( uiCode ); |
---|
| 1365 | |
---|
[738] | 1366 | READ_FLAG( uiCode, "default_direct_dependency_flag" ); pcVPS->setDefaultDirectDependencyFlag( uiCode == 1 ); |
---|
| 1367 | if ( pcVPS->getDefaultDirectDependencyFlag( ) ) |
---|
| 1368 | { |
---|
| 1369 | READ_CODE( pcVPS->getDirectDepTypeLenMinus2( ) + 2, uiCode, "default_direct_dependency_type" ); pcVPS->setDefaultDirectDependencyType( uiCode ); |
---|
| 1370 | } |
---|
| 1371 | |
---|
[622] | 1372 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1373 | { |
---|
| 1374 | for( Int j = 0; j < i; j++ ) |
---|
| 1375 | { |
---|
| 1376 | if (pcVPS->getDirectDependencyFlag( i, j) ) |
---|
| 1377 | { |
---|
[738] | 1378 | if ( pcVPS->getDefaultDirectDependencyFlag( ) ) |
---|
| 1379 | { |
---|
| 1380 | pcVPS->setDirectDependencyType( i, j , pcVPS->getDefaultDirectDependencyType( ) ); |
---|
| 1381 | } |
---|
| 1382 | else |
---|
| 1383 | { |
---|
| 1384 | READ_CODE( pcVPS->getDirectDepTypeLenMinus2( ) + 2, uiCode, "direct_dependency_type[i][j]" ); pcVPS->setDirectDependencyType( i, j , uiCode); |
---|
| 1385 | } |
---|
| 1386 | } |
---|
| 1387 | } |
---|
| 1388 | } |
---|
[622] | 1389 | |
---|
| 1390 | READ_FLAG( uiCode, "vps_shvc_reserved_zero_flag" ); |
---|
| 1391 | |
---|
| 1392 | if( pcVPS->getVpsVuiPresentFlag() ) |
---|
| 1393 | { |
---|
| 1394 | m_pcBitstream->readOutTrailingBits(); // vps_vui_alignment_bit_equal_to_one |
---|
| 1395 | parseVPSVUI( pcVPS ); |
---|
| 1396 | } |
---|
| 1397 | |
---|
| 1398 | pcVPS->checkVPSExtensionSyntax(); |
---|
| 1399 | } |
---|
| 1400 | |
---|
[738] | 1401 | Void TDecCavlc::parseRepFormat( Int i, TComRepFormat* pcRepFormat, TComRepFormat* pcPrevRepFormat ) |
---|
[622] | 1402 | { |
---|
| 1403 | assert( pcRepFormat ); |
---|
| 1404 | |
---|
| 1405 | UInt uiCode; |
---|
[738] | 1406 | |
---|
| 1407 | READ_CODE( 16, uiCode, "pic_width_vps_in_luma_samples" ); pcRepFormat->setPicWidthVpsInLumaSamples ( uiCode ); |
---|
| 1408 | READ_CODE( 16, uiCode, "pic_height_vps_in_luma_samples" ); pcRepFormat->setPicHeightVpsInLumaSamples( uiCode ); |
---|
| 1409 | READ_FLAG( uiCode, "chroma_and_bit_depth_vps_present_flag" ); pcRepFormat->setChromaAndBitDepthVpsPresentFlag( uiCode == 1 ); |
---|
| 1410 | |
---|
| 1411 | pcRepFormat->checkChromaAndBitDepthVpsPresentFlag( i ); |
---|
| 1412 | |
---|
| 1413 | if ( pcRepFormat->getChromaAndBitDepthVpsPresentFlag() ) |
---|
| 1414 | { |
---|
[622] | 1415 | READ_CODE( 2, uiCode, "chroma_format_vps_idc" ); pcRepFormat->setChromaFormatVpsIdc ( uiCode ); |
---|
| 1416 | if ( pcRepFormat->getChromaFormatVpsIdc() == 3 ) |
---|
| 1417 | { |
---|
| 1418 | READ_FLAG( uiCode, "separate_colour_plane_vps_flag" ); pcRepFormat->setSeparateColourPlaneVpsFlag( uiCode == 1 ); |
---|
| 1419 | } |
---|
| 1420 | READ_CODE( 4, uiCode, "bit_depth_vps_luma_minus8" ); pcRepFormat->setBitDepthVpsLumaMinus8 ( uiCode ); |
---|
| 1421 | READ_CODE( 4, uiCode, "bit_depth_vps_chroma_minus8" ); pcRepFormat->setBitDepthVpsChromaMinus8 ( uiCode ); |
---|
[738] | 1422 | } |
---|
| 1423 | else |
---|
| 1424 | { |
---|
| 1425 | pcRepFormat->inferChromaAndBitDepth(pcPrevRepFormat, false ); |
---|
| 1426 | } |
---|
[622] | 1427 | } |
---|
| 1428 | |
---|
| 1429 | |
---|
| 1430 | Void TDecCavlc::parseVPSVUI( TComVPS* pcVPS ) |
---|
| 1431 | { |
---|
| 1432 | assert( pcVPS ); |
---|
| 1433 | |
---|
| 1434 | TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( ); |
---|
| 1435 | |
---|
| 1436 | assert( pcVPSVUI ); |
---|
| 1437 | |
---|
| 1438 | UInt uiCode; |
---|
[738] | 1439 | READ_FLAG( uiCode, "cross_layer_pic_type_aligned_flag" ); pcVPSVUI->setCrossLayerPicTypeAlignedFlag( uiCode == 1 ); |
---|
| 1440 | if ( !pcVPSVUI->getCrossLayerPicTypeAlignedFlag() ) |
---|
| 1441 | { |
---|
| 1442 | READ_FLAG( uiCode, "cross_layer_irap_aligned_flag" ); pcVPSVUI->setCrossLayerIrapAlignedFlag( uiCode == 1 ); |
---|
| 1443 | } |
---|
[622] | 1444 | READ_FLAG( uiCode, "bit_rate_present_vps_flag" ); pcVPSVUI->setBitRatePresentVpsFlag( uiCode == 1 ); |
---|
| 1445 | READ_FLAG( uiCode, "pic_rate_present_vps_flag" ); pcVPSVUI->setPicRatePresentVpsFlag( uiCode == 1 ); |
---|
| 1446 | if( pcVPSVUI->getBitRatePresentVpsFlag( ) || pcVPSVUI->getPicRatePresentVpsFlag( ) ) |
---|
| 1447 | { |
---|
| 1448 | for( Int i = 0; i <= pcVPS->getVpsNumberLayerSetsMinus1(); i++ ) |
---|
| 1449 | { |
---|
| 1450 | for( Int j = 0; j <= pcVPS->getMaxTLayers(); j++ ) |
---|
| 1451 | { |
---|
| 1452 | if( pcVPSVUI->getBitRatePresentVpsFlag( ) ) |
---|
| 1453 | { |
---|
| 1454 | READ_FLAG( uiCode, "bit_rate_present_flag" ); pcVPSVUI->setBitRatePresentFlag( i, j, uiCode == 1 ); |
---|
| 1455 | } |
---|
| 1456 | if( pcVPSVUI->getPicRatePresentVpsFlag( ) ) |
---|
| 1457 | { |
---|
| 1458 | READ_FLAG( uiCode, "pic_rate_present_flag" ); pcVPSVUI->setPicRatePresentFlag( i, j, uiCode == 1 ); |
---|
| 1459 | } |
---|
| 1460 | if( pcVPSVUI->getBitRatePresentFlag( i, j ) ) |
---|
| 1461 | { |
---|
| 1462 | READ_CODE( 16, uiCode, "avg_bit_rate" ); pcVPSVUI->setAvgBitRate( i, j, uiCode ); |
---|
| 1463 | READ_CODE( 16, uiCode, "max_bit_rate" ); pcVPSVUI->setMaxBitRate( i, j, uiCode ); |
---|
| 1464 | } |
---|
| 1465 | if( pcVPSVUI->getPicRatePresentFlag( i, j ) ) |
---|
| 1466 | { |
---|
| 1467 | READ_CODE( 2, uiCode, "constant_pic_rate_idc" ); pcVPSVUI->setConstantPicRateIdc( i, j, uiCode ); |
---|
| 1468 | READ_CODE( 16, uiCode, "avg_pic_rate" ); pcVPSVUI->setAvgPicRate( i, j, uiCode ); |
---|
| 1469 | } |
---|
| 1470 | } |
---|
| 1471 | } |
---|
| 1472 | } |
---|
| 1473 | |
---|
[738] | 1474 | READ_FLAG( uiCode, "tiles_not_in_use_flag" ); pcVPSVUI->setTilesNotInUseFlag( uiCode == 1 ); |
---|
| 1475 | if( !pcVPSVUI->getTilesNotInUseFlag() ) |
---|
| 1476 | { |
---|
| 1477 | for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1478 | { |
---|
| 1479 | READ_FLAG( uiCode, "tiles_in_use_flag[i]" ); pcVPSVUI->setTilesInUseFlag( i, uiCode == 1 ); |
---|
| 1480 | if( pcVPSVUI->getTilesInUseFlag( i ) ) |
---|
| 1481 | { |
---|
| 1482 | READ_FLAG( uiCode, "loop_filter_not_across_tiles_flag[i]" ); pcVPSVUI->setLoopFilterNotAcrossTilesFlag( i, uiCode == 1 ); |
---|
| 1483 | } |
---|
| 1484 | } |
---|
| 1485 | |
---|
| 1486 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1487 | { |
---|
| 1488 | for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ) ; j++ ) |
---|
| 1489 | { |
---|
| 1490 | Int layerIdx = pcVPS->getLayerIdInVps(pcVPS->getRefLayerId(pcVPS->getLayerIdInNuh( i ) , j )); |
---|
| 1491 | if( pcVPSVUI->getTilesInUseFlag( i ) && pcVPSVUI->getTilesInUseFlag( layerIdx ) ) |
---|
| 1492 | { |
---|
| 1493 | READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); pcVPSVUI->setTileBoundariesAlignedFlag( i, j, uiCode == 1 ); |
---|
| 1494 | } |
---|
| 1495 | } |
---|
| 1496 | } |
---|
| 1497 | } |
---|
| 1498 | |
---|
| 1499 | READ_FLAG( uiCode, "wpp_not_in_use_flag" ); pcVPSVUI->setWppNotInUseFlag( uiCode == 1 ); |
---|
| 1500 | |
---|
| 1501 | if( !pcVPSVUI->getWppNotInUseFlag( )) |
---|
| 1502 | { |
---|
| 1503 | for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1504 | { |
---|
| 1505 | READ_FLAG( uiCode, "wpp_in_use_flag[i]" ); pcVPSVUI->setWppInUseFlag( i, uiCode == 1 ); |
---|
| 1506 | } |
---|
| 1507 | } |
---|
[622] | 1508 | |
---|
| 1509 | READ_FLAG( uiCode, "ilp_restricted_ref_layers_flag" ); pcVPSVUI->setIlpRestrictedRefLayersFlag( uiCode == 1 ); |
---|
| 1510 | |
---|
| 1511 | if( pcVPSVUI->getIlpRestrictedRefLayersFlag( ) ) |
---|
| 1512 | { |
---|
| 1513 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1514 | { |
---|
| 1515 | for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ); j++ ) |
---|
| 1516 | { |
---|
| 1517 | READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); pcVPSVUI->setMinSpatialSegmentOffsetPlus1( i, j, uiCode ); |
---|
| 1518 | if( pcVPSVUI->getMinSpatialSegmentOffsetPlus1( i, j ) > 0 ) |
---|
| 1519 | { |
---|
| 1520 | READ_FLAG( uiCode, "ctu_based_offset_enabled_flag" ); pcVPSVUI->setCtuBasedOffsetEnabledFlag( i, j, uiCode == 1 ); |
---|
| 1521 | if( pcVPSVUI->getCtuBasedOffsetEnabledFlag( i, j ) ) |
---|
| 1522 | { |
---|
| 1523 | READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1" ); pcVPSVUI->setMinHorizontalCtuOffsetPlus1( i, j, uiCode ); |
---|
| 1524 | } |
---|
| 1525 | } |
---|
| 1526 | } |
---|
| 1527 | } |
---|
| 1528 | } |
---|
[738] | 1529 | |
---|
| 1530 | READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); pcVPSVUI->setVideoSignalInfoIdxPresentFlag( uiCode == 1 ); |
---|
| 1531 | if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() ) |
---|
| 1532 | { |
---|
| 1533 | READ_CODE( 4, uiCode, "vps_num_video_signal_info_minus1" ); pcVPSVUI->setVpsNumVideoSignalInfoMinus1( uiCode ); |
---|
| 1534 | } |
---|
| 1535 | else |
---|
| 1536 | { |
---|
| 1537 | pcVPSVUI->setVpsNumVideoSignalInfoMinus1( pcVPS->getMaxLayersMinus1() ); |
---|
| 1538 | } |
---|
| 1539 | |
---|
| 1540 | for( Int i = 0; i <= pcVPSVUI->getVpsNumVideoSignalInfoMinus1(); i++ ) |
---|
| 1541 | { |
---|
| 1542 | assert( pcVPSVUI->getVideoSignalInfo( i ) == NULL ); |
---|
| 1543 | TComVideoSignalInfo* curVideoSignalInfo = new TComVideoSignalInfo(); |
---|
| 1544 | parseVideoSignalInfo( curVideoSignalInfo ); |
---|
| 1545 | pcVPSVUI->setVideoSignalInfo(i, curVideoSignalInfo ); |
---|
| 1546 | } |
---|
| 1547 | |
---|
| 1548 | if( pcVPSVUI->getVideoSignalInfoIdxPresentFlag() && pcVPSVUI->getVpsNumVideoSignalInfoMinus1() > 0 ) |
---|
| 1549 | { |
---|
| 1550 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1551 | { |
---|
| 1552 | READ_CODE( 4, uiCode, "vps_video_signal_info_idx" ); pcVPSVUI->setVpsVideoSignalInfoIdx( i, uiCode ); |
---|
| 1553 | assert( pcVPSVUI->getVpsVideoSignalInfoIdx( i ) >= 0 && pcVPSVUI->getVpsVideoSignalInfoIdx( i ) <= pcVPSVUI->getVpsNumVideoSignalInfoMinus1() ); |
---|
| 1554 | } |
---|
| 1555 | } |
---|
| 1556 | else |
---|
| 1557 | { |
---|
| 1558 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1559 | { |
---|
| 1560 | pcVPSVUI->setVpsVideoSignalInfoIdx( i, pcVPSVUI->getVideoSignalInfoIdxPresentFlag() ? 0 : i ); |
---|
| 1561 | } |
---|
| 1562 | } |
---|
| 1563 | READ_FLAG( uiCode, "vps_vui_bsp_hrd_present_flag" ); pcVPSVUI->setVpsVuiBspHrdPresentFlag( uiCode == 1 ); |
---|
| 1564 | if ( pcVPSVUI->getVpsVuiBspHrdPresentFlag( ) ) |
---|
| 1565 | { |
---|
| 1566 | parseVpsVuiBspHrdParameters( pcVPS ); |
---|
[622] | 1567 | } |
---|
[738] | 1568 | } |
---|
[622] | 1569 | |
---|
[738] | 1570 | Void TDecCavlc::parseVpsVuiBspHrdParameters( TComVPS* pcVPS ) |
---|
| 1571 | { |
---|
| 1572 | assert( pcVPS ); |
---|
| 1573 | |
---|
| 1574 | TComVPSVUI* pcVPSVUI = pcVPS->getVPSVUI( ); |
---|
| 1575 | |
---|
| 1576 | assert( pcVPSVUI ); |
---|
| 1577 | |
---|
| 1578 | TComVpsVuiBspHrdParameters* vpsVuiBspHrdP = pcVPSVUI->getVpsVuiBspHrdParameters(); |
---|
| 1579 | |
---|
| 1580 | assert ( vpsVuiBspHrdP ); |
---|
| 1581 | |
---|
| 1582 | UInt uiCode; |
---|
| 1583 | READ_UVLC( uiCode, "vps_num_bsp_hrd_parameters_minus1" ); vpsVuiBspHrdP->setVpsNumBspHrdParametersMinus1( uiCode ); |
---|
| 1584 | for( Int i = 0; i <= vpsVuiBspHrdP->getVpsNumBspHrdParametersMinus1( ); i++ ) |
---|
| 1585 | { |
---|
| 1586 | if( i > 0 ) |
---|
| 1587 | { |
---|
| 1588 | READ_FLAG( uiCode, "bsp_cprms_present_flag" ); vpsVuiBspHrdP->setBspCprmsPresentFlag( i, uiCode == 1 ); |
---|
| 1589 | } |
---|
| 1590 | TComHRD* hrdParameters = vpsVuiBspHrdP->getHrdParametermeters( i ); |
---|
| 1591 | parseHrdParameters( hrdParameters, vpsVuiBspHrdP->getBspCprmsPresentFlag( i ), pcVPS->getMaxSubLayersMinus1() ); |
---|
| 1592 | } |
---|
| 1593 | for( Int h = 1; h <= pcVPS->getVpsNumLayerSetsMinus1(); h++ ) |
---|
| 1594 | { |
---|
| 1595 | READ_UVLC( uiCode, "num_bitstream_partitions" ); vpsVuiBspHrdP->setNumBitstreamPartitions( h, uiCode ); |
---|
| 1596 | for( Int i = 0; i < vpsVuiBspHrdP->getNumBitstreamPartitions( h ); i++ ) |
---|
| 1597 | { |
---|
| 1598 | for( Int j = 0; j <= pcVPS->getMaxLayersMinus1(); j++ ) |
---|
| 1599 | { |
---|
| 1600 | if( pcVPS->getLayerIdIncludedFlag( h ,j ) ) |
---|
| 1601 | { |
---|
| 1602 | READ_FLAG( uiCode, "layer_in_bsp_flag" ); vpsVuiBspHrdP->setLayerInBspFlag( h, i, j, uiCode == 1 ); |
---|
| 1603 | } |
---|
| 1604 | else |
---|
| 1605 | { |
---|
| 1606 | vpsVuiBspHrdP->setLayerInBspFlag( h, i, j, false ); // This inference seems to be missing in spec |
---|
| 1607 | } |
---|
| 1608 | } |
---|
| 1609 | } |
---|
| 1610 | vpsVuiBspHrdP->checkLayerInBspFlag( pcVPS, h ); |
---|
| 1611 | |
---|
| 1612 | if( vpsVuiBspHrdP->getNumBitstreamPartitions( h ) ) |
---|
| 1613 | { |
---|
| 1614 | READ_UVLC( uiCode, "num_bsp_sched_combinations" ); vpsVuiBspHrdP->setNumBspSchedCombinations( h, uiCode ); |
---|
| 1615 | for( Int i = 0; i < vpsVuiBspHrdP->getNumBspSchedCombinations( h ); i++ ) |
---|
| 1616 | { |
---|
| 1617 | for( Int j = 0; j < vpsVuiBspHrdP->getNumBitstreamPartitions( h ); j++ ) |
---|
| 1618 | { |
---|
| 1619 | READ_UVLC( uiCode, "bsp_comb_hrd_idx" ); vpsVuiBspHrdP->setBspCombHrdIdx( h, i, j, uiCode ); |
---|
| 1620 | READ_UVLC( uiCode, "bsp_comb_sched_idx" ); vpsVuiBspHrdP->setBspCombSchedIdx( h, i, j, uiCode ); |
---|
| 1621 | } |
---|
| 1622 | } |
---|
| 1623 | } |
---|
| 1624 | } |
---|
| 1625 | } |
---|
| 1626 | |
---|
| 1627 | Void TDecCavlc::parseVideoSignalInfo( TComVideoSignalInfo* pcVideoSignalInfo ) |
---|
| 1628 | { |
---|
| 1629 | UInt uiCode; |
---|
| 1630 | READ_CODE( 3, uiCode, "video_vps_format" ); pcVideoSignalInfo->setVideoVpsFormat( uiCode ); |
---|
| 1631 | READ_FLAG( uiCode, "video_full_range_vps_flag" ); pcVideoSignalInfo->setVideoFullRangeVpsFlag( uiCode == 1 ); |
---|
| 1632 | READ_CODE( 8, uiCode, "colour_primaries_vps" ); pcVideoSignalInfo->setColourPrimariesVps( uiCode ); |
---|
| 1633 | READ_CODE( 8, uiCode, "transfer_characteristics_vps" ); pcVideoSignalInfo->setTransferCharacteristicsVps( uiCode ); |
---|
| 1634 | READ_CODE( 8, uiCode, "matrix_coeffs_vps" ); pcVideoSignalInfo->setMatrixCoeffsVps( uiCode ); |
---|
| 1635 | } |
---|
| 1636 | |
---|
| 1637 | Void TDecCavlc::parseDpbSize( TComVPS* vps ) |
---|
| 1638 | { |
---|
| 1639 | UInt uiCode; |
---|
| 1640 | TComDpbSize* dpbSize = vps->getDpbSize(); |
---|
| 1641 | assert ( dpbSize != 0 ); |
---|
| 1642 | |
---|
| 1643 | for( Int i = 1; i < vps->getNumOutputLayerSets(); i++ ) |
---|
| 1644 | { |
---|
| 1645 | READ_FLAG( uiCode, "sub_layer_flag_info_present_flag" ); dpbSize->setSubLayerFlagInfoPresentFlag( i, uiCode == 1 ); |
---|
| 1646 | |
---|
| 1647 | for( Int j = 0; j <= vps->getMaxTLayers() - 1 ; j++ ) |
---|
| 1648 | { |
---|
| 1649 | if( j > 0 && dpbSize->getSubLayerDpbInfoPresentFlag( i, j ) ) |
---|
| 1650 | { |
---|
| 1651 | READ_FLAG( uiCode, "sub_layer_dpb_info_present_flag" ); dpbSize->setSubLayerDpbInfoPresentFlag( i, j, uiCode == 1 ); |
---|
| 1652 | } |
---|
| 1653 | if( dpbSize->getSubLayerDpbInfoPresentFlag( i, j ) ) |
---|
| 1654 | { |
---|
| 1655 | for( Int k = 0; k < vps->getNumSubDpbs( vps->getOutputLayerSetIdxMinus1( i ) + 1 ); k++ ) |
---|
| 1656 | { |
---|
| 1657 | READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1" ); dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode ); |
---|
| 1658 | } |
---|
| 1659 | READ_UVLC( uiCode, "max_vps_num_reorder_pics" ); dpbSize->setMaxVpsNumReorderPics( i, j, uiCode ); |
---|
| 1660 | READ_UVLC( uiCode, "max_vps_latency_increase_plus1" ); dpbSize->setMaxVpsLatencyIncreasePlus1( i, j, uiCode ); |
---|
| 1661 | } |
---|
| 1662 | else |
---|
| 1663 | { |
---|
| 1664 | if ( j > 0 ) |
---|
| 1665 | { |
---|
| 1666 | for( Int k = 0; k < vps->getNumSubDpbs( vps->getOutputLayerSetIdxMinus1( i ) + 1 ); k++ ) |
---|
| 1667 | { |
---|
| 1668 | dpbSize->setMaxVpsDecPicBufferingMinus1( i, k, j, dpbSize->getMaxVpsDecPicBufferingMinus1( i,k, j - 1 ) ); |
---|
| 1669 | } |
---|
| 1670 | dpbSize->setMaxVpsNumReorderPics ( i, j, dpbSize->getMaxVpsNumReorderPics ( i, j - 1 ) ); |
---|
| 1671 | dpbSize->setMaxVpsLatencyIncreasePlus1( i, j, dpbSize->getMaxVpsLatencyIncreasePlus1( i, j - 1 ) ); |
---|
| 1672 | } |
---|
| 1673 | } |
---|
| 1674 | } |
---|
| 1675 | } |
---|
| 1676 | } |
---|
| 1677 | #endif |
---|
| 1678 | |
---|
[622] | 1679 | #if H_3D |
---|
| 1680 | Void TDecCavlc::parseVPSExtension2( TComVPS* pcVPS ) |
---|
| 1681 | { |
---|
| 1682 | UInt uiCode; |
---|
| 1683 | for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
| 1684 | { |
---|
| 1685 | #if H_3D_ARP |
---|
| 1686 | pcVPS->setUseAdvRP ( i, 0 ); |
---|
| 1687 | pcVPS->setARPStepNum( i, 1 ); |
---|
| 1688 | #endif |
---|
[773] | 1689 | #if H_3D_SPIVMP |
---|
[724] | 1690 | pcVPS->setSubPULog2Size(i, 0); |
---|
| 1691 | #endif |
---|
[622] | 1692 | if ( i != 0 ) |
---|
| 1693 | { |
---|
| 1694 | if( !( pcVPS->getDepthId( i ) == 1 ) ) |
---|
| 1695 | { |
---|
| 1696 | #if H_3D_IV_MERGE |
---|
| 1697 | READ_FLAG( uiCode, "iv_mv_pred_flag[i]"); pcVPS->setIvMvPredFlag ( i, uiCode == 1 ? true : false ); |
---|
[773] | 1698 | #if H_3D_SPIVMP |
---|
[833] | 1699 | #if SEC_SPIVMP_MCP_SIZE_G0077 |
---|
| 1700 | READ_UVLC (uiCode, "log2_sub_PU_size_minus3"); pcVPS->setSubPULog2Size(i, uiCode+3); |
---|
| 1701 | #else |
---|
[724] | 1702 | READ_UVLC (uiCode, "log2_sub_PU_size_minus2"); pcVPS->setSubPULog2Size(i, uiCode+2); |
---|
[622] | 1703 | #endif |
---|
[724] | 1704 | #endif |
---|
[833] | 1705 | #endif |
---|
[622] | 1706 | #if H_3D_ARP |
---|
| 1707 | READ_FLAG( uiCode, "iv_res_pred_flag[i]" ); pcVPS->setUseAdvRP ( i, uiCode ); pcVPS->setARPStepNum( i, uiCode ? H_3D_ARP_WFNR : 1 ); |
---|
| 1708 | |
---|
| 1709 | #endif |
---|
| 1710 | #if H_3D_NBDV_REF |
---|
| 1711 | READ_FLAG( uiCode, "depth_refinement_flag[i]"); pcVPS->setDepthRefinementFlag ( i, uiCode == 1 ? true : false ); |
---|
| 1712 | #endif |
---|
| 1713 | #if H_3D_VSP |
---|
| 1714 | READ_FLAG( uiCode, "view_synthesis_pred_flag[i]"); pcVPS->setViewSynthesisPredFlag( i, uiCode == 1 ? true : false ); |
---|
| 1715 | #endif |
---|
[833] | 1716 | #if H_3D_DBBP |
---|
| 1717 | READ_FLAG( uiCode, "use_dbbp_flag[i]" ); pcVPS->setUseDBBP( i, uiCode == 1 ? true : false ); |
---|
| 1718 | #endif |
---|
[622] | 1719 | } |
---|
| 1720 | else |
---|
| 1721 | { |
---|
[773] | 1722 | #if H_3D_IV_MERGE |
---|
[724] | 1723 | if(i!=1) |
---|
| 1724 | { |
---|
| 1725 | READ_FLAG( uiCode, "iv_mv_pred_flag[i]"); pcVPS->setIvMvPredFlag ( i, uiCode == 1 ? true : false ); |
---|
| 1726 | } |
---|
| 1727 | #endif |
---|
[773] | 1728 | #if H_3D_SPIVMP |
---|
[724] | 1729 | if (i!=1) |
---|
| 1730 | { |
---|
[833] | 1731 | #if SEC_SPIVMP_MCP_SIZE_G0077 |
---|
| 1732 | READ_UVLC (uiCode, "log2_sub_PU_size_minus3[i]"); pcVPS->setSubPULog2Size(i, uiCode+3); |
---|
| 1733 | #else |
---|
[738] | 1734 | READ_UVLC (uiCode, "log2_sub_PU_size_minus2[i]"); pcVPS->setSubPULog2Size(i, uiCode+2); |
---|
[833] | 1735 | #endif |
---|
[724] | 1736 | } |
---|
| 1737 | #endif |
---|
[773] | 1738 | #if H_3D_IV_MERGE |
---|
[724] | 1739 | READ_FLAG( uiCode, "mpi_flag[i]" ); pcVPS->setMPIFlag( i, uiCode == 1 ? true : false ); |
---|
| 1740 | #endif |
---|
[622] | 1741 | READ_FLAG( uiCode, "vps_depth_modes_flag[i]" ); pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false ); |
---|
| 1742 | // READ_FLAG( uiCode, "lim_qt_pred_flag[i]"); pcVPS->setLimQtPreFlag ( i, uiCode == 1 ? true : false ); |
---|
[655] | 1743 | #if H_3D_INTER_SDC |
---|
[622] | 1744 | READ_FLAG( uiCode, "depth_inter_SDC_flag" ); pcVPS->setInterSDCFlag( i, uiCode ? true : false ); |
---|
| 1745 | #endif |
---|
| 1746 | } |
---|
| 1747 | } |
---|
| 1748 | } |
---|
[773] | 1749 | |
---|
[758] | 1750 | UInt uiCamParPrecision = 0; |
---|
| 1751 | Bool bCamParSlice = false; |
---|
| 1752 | Bool bCamParPresentFlag = false; |
---|
| 1753 | |
---|
| 1754 | READ_UVLC( uiCamParPrecision, "cp_precision" ); |
---|
| 1755 | for (UInt viewIndex=0; viewIndex<pcVPS->getNumViews(); viewIndex++) |
---|
| 1756 | { |
---|
| 1757 | READ_FLAG( uiCode, "cp_present_flag[i]" ); bCamParPresentFlag = ( uiCode == 1); |
---|
| 1758 | if ( bCamParPresentFlag ) |
---|
| 1759 | { |
---|
| 1760 | READ_FLAG( uiCode, "cp_in_slice_segment_header_flag[i]" ); bCamParSlice = ( uiCode == 1); |
---|
| 1761 | if ( !bCamParSlice ) |
---|
| 1762 | { |
---|
| 1763 | for( UInt uiBaseIndex = 0; uiBaseIndex < viewIndex; uiBaseIndex++ ) |
---|
| 1764 | { |
---|
| 1765 | Int iCode; |
---|
| 1766 | READ_SVLC( iCode, "vps_cp_scale" ); m_aaiTempScale [ uiBaseIndex ][ viewIndex ] = iCode; |
---|
| 1767 | READ_SVLC( iCode, "vps_cp_off" ); m_aaiTempOffset [ uiBaseIndex ][ viewIndex ] = iCode; |
---|
| 1768 | READ_SVLC( iCode, "vps_cp_inv_scale_plus_scale" ); m_aaiTempScale [ viewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ viewIndex ]; |
---|
| 1769 | READ_SVLC( iCode, "vps_cp_inv_off_plus_off" ); m_aaiTempOffset [ viewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ viewIndex ]; |
---|
| 1770 | } |
---|
| 1771 | } |
---|
| 1772 | pcVPS->initCamParaVPS( viewIndex, bCamParPresentFlag, uiCamParPrecision, bCamParSlice, m_aaiTempScale, m_aaiTempOffset ); |
---|
| 1773 | } |
---|
| 1774 | } |
---|
[833] | 1775 | #if QC_SPIVMP_MPI_G0119 |
---|
| 1776 | READ_UVLC (uiCode, "log2_sub_PU_MPI_size_minus3"); pcVPS->setSubPUMPILog2Size( uiCode + 3 ); |
---|
| 1777 | #endif |
---|
[622] | 1778 | READ_FLAG( uiCode, "iv_mv_scaling_flag"); pcVPS->setIvMvScalingFlag( uiCode == 1 ? true : false ); |
---|
| 1779 | } |
---|
| 1780 | #endif |
---|
| 1781 | |
---|
[608] | 1782 | Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager) |
---|
[2] | 1783 | { |
---|
[56] | 1784 | UInt uiCode; |
---|
| 1785 | Int iCode; |
---|
[608] | 1786 | |
---|
[56] | 1787 | #if ENC_DEC_TRACE |
---|
| 1788 | xTraceSliceHeader(rpcSlice); |
---|
| 1789 | #endif |
---|
[608] | 1790 | TComPPS* pps = NULL; |
---|
| 1791 | TComSPS* sps = NULL; |
---|
| 1792 | #if H_MV |
---|
| 1793 | TComVPS* vps = NULL; |
---|
| 1794 | #endif |
---|
| 1795 | |
---|
| 1796 | UInt firstSliceSegmentInPic; |
---|
| 1797 | READ_FLAG( firstSliceSegmentInPic, "first_slice_segment_in_pic_flag" ); |
---|
| 1798 | if( rpcSlice->getRapPicFlag()) |
---|
| 1799 | { |
---|
| 1800 | READ_FLAG( uiCode, "no_output_of_prior_pics_flag" ); //ignored |
---|
| 1801 | } |
---|
| 1802 | READ_UVLC ( uiCode, "slice_pic_parameter_set_id" ); rpcSlice->setPPSId(uiCode); |
---|
| 1803 | pps = parameterSetManager->getPrefetchedPPS(uiCode); |
---|
| 1804 | //!KS: need to add error handling code here, if PPS is not available |
---|
| 1805 | assert(pps!=0); |
---|
| 1806 | sps = parameterSetManager->getPrefetchedSPS(pps->getSPSId()); |
---|
| 1807 | //!KS: need to add error handling code here, if SPS is not available |
---|
| 1808 | assert(sps!=0); |
---|
| 1809 | #if H_MV |
---|
| 1810 | vps = parameterSetManager->getPrefetchedVPS(sps->getVPSId()); |
---|
[622] | 1811 | assert( vps != NULL ); |
---|
| 1812 | |
---|
| 1813 | sps->inferRepFormat ( vps , rpcSlice->getLayerId() ); |
---|
| 1814 | sps->inferScalingList( parameterSetManager->getActiveSPS( sps->getSpsScalingListRefLayerId() ) ); |
---|
[738] | 1815 | if ( sps->getVuiParametersPresentFlag() ) |
---|
| 1816 | { |
---|
| 1817 | sps->getVuiParameters()->inferVideoSignalInfo( vps, rpcSlice->getLayerId() ); |
---|
| 1818 | } |
---|
[622] | 1819 | rpcSlice->setVPS(vps); |
---|
| 1820 | rpcSlice->setViewId ( vps->getViewId ( rpcSlice->getLayerId() ) ); |
---|
| 1821 | rpcSlice->setViewIndex( vps->getViewIndex( rpcSlice->getLayerId() ) ); |
---|
| 1822 | #if H_3D |
---|
| 1823 | rpcSlice->setIsDepth ( vps->getDepthId ( rpcSlice->getLayerId() ) == 1 ); |
---|
| 1824 | #endif |
---|
[608] | 1825 | #endif |
---|
| 1826 | rpcSlice->setSPS(sps); |
---|
| 1827 | rpcSlice->setPPS(pps); |
---|
| 1828 | if( pps->getDependentSliceSegmentsEnabledFlag() && ( !firstSliceSegmentInPic )) |
---|
[2] | 1829 | { |
---|
[608] | 1830 | READ_FLAG( uiCode, "dependent_slice_segment_flag" ); rpcSlice->setDependentSliceSegmentFlag(uiCode ? true : false); |
---|
[2] | 1831 | } |
---|
[608] | 1832 | else |
---|
[2] | 1833 | { |
---|
[608] | 1834 | rpcSlice->setDependentSliceSegmentFlag(false); |
---|
[2] | 1835 | } |
---|
[608] | 1836 | Int numCTUs = ((sps->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((sps->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight()); |
---|
| 1837 | Int maxParts = (1<<(sps->getMaxCUDepth()<<1)); |
---|
| 1838 | UInt sliceSegmentAddress = 0; |
---|
| 1839 | Int bitsSliceSegmentAddress = 0; |
---|
| 1840 | while(numCTUs>(1<<bitsSliceSegmentAddress)) |
---|
[189] | 1841 | { |
---|
[608] | 1842 | bitsSliceSegmentAddress++; |
---|
[189] | 1843 | } |
---|
| 1844 | |
---|
[608] | 1845 | if(!firstSliceSegmentInPic) |
---|
[2] | 1846 | { |
---|
[608] | 1847 | READ_CODE( bitsSliceSegmentAddress, sliceSegmentAddress, "slice_segment_address" ); |
---|
[2] | 1848 | } |
---|
[608] | 1849 | //set uiCode to equal slice start address (or dependent slice start address) |
---|
| 1850 | Int startCuAddress = maxParts*sliceSegmentAddress; |
---|
| 1851 | rpcSlice->setSliceSegmentCurStartCUAddr( startCuAddress ); |
---|
| 1852 | rpcSlice->setSliceSegmentCurEndCUAddr(numCTUs*maxParts); |
---|
[2] | 1853 | |
---|
[608] | 1854 | if (rpcSlice->getDependentSliceSegmentFlag()) |
---|
[2] | 1855 | { |
---|
[608] | 1856 | rpcSlice->setNextSlice ( false ); |
---|
| 1857 | rpcSlice->setNextSliceSegment ( true ); |
---|
[2] | 1858 | } |
---|
| 1859 | else |
---|
| 1860 | { |
---|
[608] | 1861 | rpcSlice->setNextSlice ( true ); |
---|
| 1862 | rpcSlice->setNextSliceSegment ( false ); |
---|
| 1863 | |
---|
| 1864 | rpcSlice->setSliceCurStartCUAddr(startCuAddress); |
---|
| 1865 | rpcSlice->setSliceCurEndCUAddr(numCTUs*maxParts); |
---|
[2] | 1866 | } |
---|
[608] | 1867 | |
---|
| 1868 | if(!rpcSlice->getDependentSliceSegmentFlag()) |
---|
| 1869 | { |
---|
| 1870 | #if H_MV |
---|
[622] | 1871 | Int esb = 0; //Don't use i, otherwise will shadow something below |
---|
| 1872 | |
---|
| 1873 | if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb ) |
---|
| 1874 | { |
---|
| 1875 | esb++; |
---|
| 1876 | READ_FLAG( uiCode, "discardable_flag" ); rpcSlice->setDiscardableFlag( uiCode == 1 ); |
---|
| 1877 | } |
---|
| 1878 | |
---|
[738] | 1879 | if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb ) |
---|
| 1880 | { |
---|
| 1881 | esb++; |
---|
| 1882 | READ_FLAG( uiCode, "cross_layer_bla_flag" ); rpcSlice->setCrossLayerBlaFlag( uiCode == 1 ); |
---|
| 1883 | } |
---|
| 1884 | rpcSlice->checkCrossLayerBlaFlag( ); |
---|
| 1885 | |
---|
| 1886 | if ( rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > esb ) |
---|
| 1887 | { |
---|
| 1888 | esb++; |
---|
| 1889 | READ_FLAG( uiCode, "poc_reset_flag" ); rpcSlice->setPocResetFlag( uiCode == 1 ); |
---|
| 1890 | } |
---|
| 1891 | |
---|
[622] | 1892 | for (; esb < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); esb++) |
---|
| 1893 | #else |
---|
[608] | 1894 | for (Int i = 0; i < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) |
---|
| 1895 | #endif |
---|
| 1896 | { |
---|
| 1897 | READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored |
---|
| 1898 | } |
---|
| 1899 | |
---|
| 1900 | READ_UVLC ( uiCode, "slice_type" ); rpcSlice->setSliceType((SliceType)uiCode); |
---|
[56] | 1901 | if( pps->getOutputFlagPresentFlag() ) |
---|
[2] | 1902 | { |
---|
[608] | 1903 | READ_FLAG( uiCode, "pic_output_flag" ); rpcSlice->setPicOutputFlag( uiCode ? true : false ); |
---|
[2] | 1904 | } |
---|
[56] | 1905 | else |
---|
| 1906 | { |
---|
| 1907 | rpcSlice->setPicOutputFlag( true ); |
---|
| 1908 | } |
---|
[608] | 1909 | // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present |
---|
| 1910 | assert (sps->getChromaFormatIdc() == 1 ); |
---|
| 1911 | // if( separate_colour_plane_flag == 1 ) |
---|
| 1912 | // colour_plane_id u(2) |
---|
| 1913 | |
---|
[738] | 1914 | |
---|
[773] | 1915 | #if H_MV |
---|
[738] | 1916 | UInt slicePicOrderCntLsb = 0; |
---|
| 1917 | Int iPOClsb = slicePicOrderCntLsb; // Needed later |
---|
| 1918 | if ( (rpcSlice->getLayerId() > 0 && !vps->getPocLsbNotPresentFlag( rpcSlice->getLayerIdInVps())) || !rpcSlice->getIdrPicFlag() ) |
---|
| 1919 | { |
---|
| 1920 | READ_CODE(sps->getBitsForPOC(), slicePicOrderCntLsb, "slice_pic_order_cnt_lsb"); |
---|
| 1921 | } |
---|
| 1922 | |
---|
| 1923 | Bool picOrderCntMSBZeroFlag = false; |
---|
| 1924 | |
---|
| 1925 | // as in HM code. However are all cases for IRAP picture with NoRaslOutputFlag equal to 1 covered?? |
---|
| 1926 | picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP ); |
---|
| 1927 | picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ); |
---|
| 1928 | picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ); |
---|
| 1929 | picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || rpcSlice->getIdrPicFlag(); |
---|
| 1930 | |
---|
| 1931 | // TBD picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getLayerId() > 0 && !rpcSlice->getFirstPicInLayerDecodedFlag() ); |
---|
| 1932 | |
---|
| 1933 | Int picOrderCntMSB = 0; |
---|
| 1934 | |
---|
| 1935 | if ( !picOrderCntMSBZeroFlag ) |
---|
| 1936 | { |
---|
| 1937 | Int prevPicOrderCnt = rpcSlice->getPrevTid0POC(); |
---|
| 1938 | Int maxPicOrderCntLsb = 1 << sps->getBitsForPOC(); |
---|
| 1939 | Int prevPicOrderCntLsb = prevPicOrderCnt & (maxPicOrderCntLsb - 1); |
---|
| 1940 | Int prevPicOrderCntMsb = prevPicOrderCnt - prevPicOrderCntLsb; |
---|
| 1941 | |
---|
| 1942 | if( ( slicePicOrderCntLsb < prevPicOrderCntLsb ) && ( ( prevPicOrderCntLsb - slicePicOrderCntLsb ) >= ( maxPicOrderCntLsb / 2 ) ) ) |
---|
| 1943 | { |
---|
| 1944 | picOrderCntMSB = prevPicOrderCntMsb + maxPicOrderCntLsb; |
---|
| 1945 | } |
---|
| 1946 | else if( (slicePicOrderCntLsb > prevPicOrderCntLsb ) && ( (slicePicOrderCntLsb - prevPicOrderCntLsb ) > ( maxPicOrderCntLsb / 2 ) ) ) |
---|
| 1947 | { |
---|
| 1948 | picOrderCntMSB = prevPicOrderCntMsb - maxPicOrderCntLsb; |
---|
| 1949 | } |
---|
| 1950 | else |
---|
| 1951 | { |
---|
| 1952 | picOrderCntMSB = prevPicOrderCntMsb; |
---|
| 1953 | } |
---|
| 1954 | } |
---|
| 1955 | |
---|
| 1956 | rpcSlice->setPOC( picOrderCntMSB + slicePicOrderCntLsb ); |
---|
| 1957 | if ( rpcSlice->getPocResetFlag() ) |
---|
| 1958 | { |
---|
| 1959 | rpcSlice->setPocBeforeReset ( rpcSlice->getPOC() ); |
---|
| 1960 | rpcSlice->setPOC ( 0 ); |
---|
| 1961 | } |
---|
| 1962 | #endif |
---|
| 1963 | |
---|
[608] | 1964 | if( rpcSlice->getIdrPicFlag() ) |
---|
| 1965 | { |
---|
[773] | 1966 | #if !H_MV |
---|
[56] | 1967 | rpcSlice->setPOC(0); |
---|
[738] | 1968 | #endif |
---|
[56] | 1969 | TComReferencePictureSet* rps = rpcSlice->getLocalRPS(); |
---|
| 1970 | rps->setNumberOfNegativePictures(0); |
---|
| 1971 | rps->setNumberOfPositivePictures(0); |
---|
| 1972 | rps->setNumberOfLongtermPictures(0); |
---|
| 1973 | rps->setNumberOfPictures(0); |
---|
| 1974 | rpcSlice->setRPS(rps); |
---|
[608] | 1975 | #if H_MV |
---|
| 1976 | rpcSlice->setEnableTMVPFlag(false); |
---|
| 1977 | #endif |
---|
[56] | 1978 | } |
---|
| 1979 | else |
---|
[2] | 1980 | { |
---|
[773] | 1981 | #if !H_MV |
---|
[56] | 1982 | READ_CODE(sps->getBitsForPOC(), uiCode, "pic_order_cnt_lsb"); |
---|
| 1983 | Int iPOClsb = uiCode; |
---|
[655] | 1984 | Int iPrevPOC = rpcSlice->getPrevTid0POC(); |
---|
[56] | 1985 | Int iMaxPOClsb = 1<< sps->getBitsForPOC(); |
---|
[655] | 1986 | Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1); |
---|
[56] | 1987 | Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb; |
---|
| 1988 | Int iPOCmsb; |
---|
| 1989 | if( ( iPOClsb < iPrevPOClsb ) && ( ( iPrevPOClsb - iPOClsb ) >= ( iMaxPOClsb / 2 ) ) ) |
---|
[2] | 1990 | { |
---|
[56] | 1991 | iPOCmsb = iPrevPOCmsb + iMaxPOClsb; |
---|
[2] | 1992 | } |
---|
[56] | 1993 | else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) ) |
---|
| 1994 | { |
---|
| 1995 | iPOCmsb = iPrevPOCmsb - iMaxPOClsb; |
---|
| 1996 | } |
---|
| 1997 | else |
---|
| 1998 | { |
---|
| 1999 | iPOCmsb = iPrevPOCmsb; |
---|
| 2000 | } |
---|
[608] | 2001 | if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 2002 | || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 2003 | || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) |
---|
[56] | 2004 | { |
---|
[608] | 2005 | // For BLA picture types, POCmsb is set to 0. |
---|
| 2006 | iPOCmsb = 0; |
---|
[56] | 2007 | } |
---|
[608] | 2008 | rpcSlice->setPOC (iPOCmsb+iPOClsb); |
---|
[622] | 2009 | #endif |
---|
[608] | 2010 | TComReferencePictureSet* rps; |
---|
| 2011 | rps = rpcSlice->getLocalRPS(); |
---|
| 2012 | rpcSlice->setRPS(rps); |
---|
| 2013 | READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); |
---|
| 2014 | if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header |
---|
[56] | 2015 | { |
---|
[608] | 2016 | parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); |
---|
| 2017 | } |
---|
| 2018 | else // use reference to short-term reference picture set in PPS |
---|
| 2019 | { |
---|
| 2020 | Int numBits = 0; |
---|
| 2021 | while ((1 << numBits) < rpcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets()) |
---|
[56] | 2022 | { |
---|
[608] | 2023 | numBits++; |
---|
[56] | 2024 | } |
---|
[608] | 2025 | if (numBits > 0) |
---|
[56] | 2026 | { |
---|
[608] | 2027 | READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); |
---|
[56] | 2028 | } |
---|
[608] | 2029 | else |
---|
[56] | 2030 | { |
---|
[608] | 2031 | uiCode = 0; |
---|
| 2032 | } |
---|
| 2033 | *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); |
---|
| 2034 | } |
---|
| 2035 | if(sps->getLongTermRefsPresent()) |
---|
| 2036 | { |
---|
| 2037 | Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); |
---|
| 2038 | UInt numOfLtrp = 0; |
---|
| 2039 | UInt numLtrpInSPS = 0; |
---|
| 2040 | if (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > 0) |
---|
| 2041 | { |
---|
| 2042 | READ_UVLC( uiCode, "num_long_term_sps"); |
---|
| 2043 | numLtrpInSPS = uiCode; |
---|
| 2044 | numOfLtrp += numLtrpInSPS; |
---|
| 2045 | rps->setNumberOfLongtermPictures(numOfLtrp); |
---|
| 2046 | } |
---|
| 2047 | Int bitsForLtrpInSPS = 0; |
---|
| 2048 | while (rpcSlice->getSPS()->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) |
---|
| 2049 | { |
---|
| 2050 | bitsForLtrpInSPS++; |
---|
| 2051 | } |
---|
| 2052 | READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); |
---|
| 2053 | numOfLtrp += uiCode; |
---|
| 2054 | rps->setNumberOfLongtermPictures(numOfLtrp); |
---|
| 2055 | Int maxPicOrderCntLSB = 1 << rpcSlice->getSPS()->getBitsForPOC(); |
---|
| 2056 | Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;; |
---|
| 2057 | for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) |
---|
| 2058 | { |
---|
| 2059 | Int pocLsbLt; |
---|
| 2060 | if (k < numLtrpInSPS) |
---|
[56] | 2061 | { |
---|
[608] | 2062 | uiCode = 0; |
---|
| 2063 | if (bitsForLtrpInSPS > 0) |
---|
| 2064 | { |
---|
| 2065 | READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]"); |
---|
| 2066 | } |
---|
| 2067 | Int usedByCurrFromSPS=rpcSlice->getSPS()->getUsedByCurrPicLtSPSFlag(uiCode); |
---|
[2] | 2068 | |
---|
[608] | 2069 | pocLsbLt = rpcSlice->getSPS()->getLtRefPicPocLsbSps(uiCode); |
---|
| 2070 | rps->setUsed(j,usedByCurrFromSPS); |
---|
| 2071 | } |
---|
| 2072 | else |
---|
| 2073 | { |
---|
| 2074 | READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode; |
---|
| 2075 | READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); |
---|
| 2076 | } |
---|
| 2077 | READ_FLAG(uiCode,"delta_poc_msb_present_flag"); |
---|
| 2078 | Bool mSBPresentFlag = uiCode ? true : false; |
---|
| 2079 | if(mSBPresentFlag) |
---|
| 2080 | { |
---|
| 2081 | READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); |
---|
| 2082 | Bool deltaFlag = false; |
---|
| 2083 | // First LTRP || First LTRP from SH |
---|
| 2084 | if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) |
---|
[56] | 2085 | { |
---|
[608] | 2086 | deltaFlag = true; |
---|
[56] | 2087 | } |
---|
[608] | 2088 | if(deltaFlag) |
---|
| 2089 | { |
---|
| 2090 | deltaPocMSBCycleLT = uiCode; |
---|
| 2091 | } |
---|
[56] | 2092 | else |
---|
| 2093 | { |
---|
[608] | 2094 | deltaPocMSBCycleLT = uiCode + prevDeltaMSB; |
---|
[56] | 2095 | } |
---|
[608] | 2096 | |
---|
| 2097 | Int pocLTCurr = rpcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB |
---|
| 2098 | - iPOClsb + pocLsbLt; |
---|
| 2099 | rps->setPOC (j, pocLTCurr); |
---|
| 2100 | rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLTCurr); |
---|
| 2101 | rps->setCheckLTMSBPresent(j,true); |
---|
[56] | 2102 | } |
---|
[608] | 2103 | else |
---|
| 2104 | { |
---|
| 2105 | rps->setPOC (j, pocLsbLt); |
---|
| 2106 | rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLsbLt); |
---|
| 2107 | rps->setCheckLTMSBPresent(j,false); |
---|
[655] | 2108 | |
---|
| 2109 | // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present |
---|
| 2110 | if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) |
---|
| 2111 | { |
---|
| 2112 | deltaPocMSBCycleLT = 0; |
---|
| 2113 | } |
---|
[608] | 2114 | } |
---|
| 2115 | prevDeltaMSB = deltaPocMSBCycleLT; |
---|
| 2116 | } |
---|
| 2117 | offset += rps->getNumberOfLongtermPictures(); |
---|
| 2118 | rps->setNumberOfPictures(offset); |
---|
| 2119 | } |
---|
| 2120 | if ( rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
| 2121 | || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
| 2122 | || rpcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) |
---|
| 2123 | { |
---|
| 2124 | // In the case of BLA picture types, rps data is read from slice header but ignored |
---|
| 2125 | rps = rpcSlice->getLocalRPS(); |
---|
| 2126 | rps->setNumberOfNegativePictures(0); |
---|
| 2127 | rps->setNumberOfPositivePictures(0); |
---|
| 2128 | rps->setNumberOfLongtermPictures(0); |
---|
| 2129 | rps->setNumberOfPictures(0); |
---|
| 2130 | rpcSlice->setRPS(rps); |
---|
[56] | 2131 | } |
---|
[608] | 2132 | if (rpcSlice->getSPS()->getTMVPFlagsPresent()) |
---|
[2] | 2133 | { |
---|
[608] | 2134 | READ_FLAG( uiCode, "slice_temporal_mvp_enable_flag" ); |
---|
| 2135 | rpcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); |
---|
[56] | 2136 | } |
---|
[608] | 2137 | else |
---|
[56] | 2138 | { |
---|
[608] | 2139 | rpcSlice->setEnableTMVPFlag(false); |
---|
| 2140 | } |
---|
| 2141 | } |
---|
| 2142 | #if H_MV |
---|
[738] | 2143 | Bool interLayerPredLayerIdcPresentFlag = false; |
---|
[622] | 2144 | Int layerId = rpcSlice->getLayerId(); |
---|
[738] | 2145 | if( rpcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 ) |
---|
| 2146 | { |
---|
[622] | 2147 | READ_FLAG( uiCode, "inter_layer_pred_enabled_flag" ); rpcSlice->setInterLayerPredEnabledFlag( uiCode == 1 ); |
---|
| 2148 | if( rpcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 ) |
---|
| 2149 | { |
---|
| 2150 | if( !vps->getMaxOneActiveRefLayerFlag()) |
---|
| 2151 | { |
---|
| 2152 | READ_CODE( rpcSlice->getNumInterLayerRefPicsMinus1Len( ), uiCode, "num_inter_layer_ref_pics_minus1" ); rpcSlice->setNumInterLayerRefPicsMinus1( uiCode ); |
---|
| 2153 | } |
---|
| 2154 | if ( rpcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) ) |
---|
| 2155 | { |
---|
[738] | 2156 | interLayerPredLayerIdcPresentFlag = true; |
---|
[622] | 2157 | for( Int idx = 0; idx < rpcSlice->getNumActiveRefLayerPics(); idx++ ) |
---|
| 2158 | { |
---|
| 2159 | READ_CODE( rpcSlice->getInterLayerPredLayerIdcLen( ), uiCode, "inter_layer_pred_layer_idc" ); rpcSlice->setInterLayerPredLayerIdc( idx, uiCode ); |
---|
| 2160 | } |
---|
| 2161 | } |
---|
| 2162 | } |
---|
| 2163 | } |
---|
[738] | 2164 | if ( !interLayerPredLayerIdcPresentFlag ) |
---|
| 2165 | { |
---|
| 2166 | for( Int i = 0; i < rpcSlice->getNumActiveRefLayerPics(); i++ ) |
---|
| 2167 | { |
---|
| 2168 | rpcSlice->setInterLayerPredLayerIdc( i, rpcSlice->getRefLayerPicIdc( i ) ); |
---|
| 2169 | } |
---|
| 2170 | } |
---|
[443] | 2171 | #endif |
---|
[608] | 2172 | if(sps->getUseSAO()) |
---|
| 2173 | { |
---|
| 2174 | READ_FLAG(uiCode, "slice_sao_luma_flag"); rpcSlice->setSaoEnabledFlag((Bool)uiCode); |
---|
| 2175 | READ_FLAG(uiCode, "slice_sao_chroma_flag"); rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode); |
---|
[56] | 2176 | } |
---|
[608] | 2177 | |
---|
| 2178 | if (rpcSlice->getIdrPicFlag()) |
---|
| 2179 | { |
---|
| 2180 | rpcSlice->setEnableTMVPFlag(false); |
---|
| 2181 | } |
---|
[56] | 2182 | if (!rpcSlice->isIntra()) |
---|
| 2183 | { |
---|
[608] | 2184 | |
---|
[56] | 2185 | READ_FLAG( uiCode, "num_ref_idx_active_override_flag"); |
---|
| 2186 | if (uiCode) |
---|
[2] | 2187 | { |
---|
[608] | 2188 | READ_UVLC (uiCode, "num_ref_idx_l0_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 ); |
---|
[56] | 2189 | if (rpcSlice->isInterB()) |
---|
[2] | 2190 | { |
---|
[608] | 2191 | READ_UVLC (uiCode, "num_ref_idx_l1_active_minus1" ); rpcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 ); |
---|
[2] | 2192 | } |
---|
| 2193 | else |
---|
| 2194 | { |
---|
[56] | 2195 | rpcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); |
---|
[2] | 2196 | } |
---|
| 2197 | } |
---|
| 2198 | else |
---|
| 2199 | { |
---|
[608] | 2200 | rpcSlice->setNumRefIdx(REF_PIC_LIST_0, rpcSlice->getPPS()->getNumRefIdxL0DefaultActive()); |
---|
| 2201 | if (rpcSlice->isInterB()) |
---|
| 2202 | { |
---|
| 2203 | rpcSlice->setNumRefIdx(REF_PIC_LIST_1, rpcSlice->getPPS()->getNumRefIdxL1DefaultActive()); |
---|
| 2204 | } |
---|
| 2205 | else |
---|
| 2206 | { |
---|
| 2207 | rpcSlice->setNumRefIdx(REF_PIC_LIST_1,0); |
---|
| 2208 | } |
---|
[2] | 2209 | } |
---|
| 2210 | } |
---|
[608] | 2211 | // } |
---|
[56] | 2212 | TComRefPicListModification* refPicListModification = rpcSlice->getRefPicListModification(); |
---|
[608] | 2213 | if(!rpcSlice->isIntra()) |
---|
[2] | 2214 | { |
---|
[608] | 2215 | if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) |
---|
[2] | 2216 | { |
---|
[56] | 2217 | refPicListModification->setRefPicListModificationFlagL0( 0 ); |
---|
[2] | 2218 | } |
---|
| 2219 | else |
---|
| 2220 | { |
---|
[56] | 2221 | READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); refPicListModification->setRefPicListModificationFlagL0( uiCode ? 1 : 0 ); |
---|
[2] | 2222 | } |
---|
[608] | 2223 | |
---|
[56] | 2224 | if(refPicListModification->getRefPicListModificationFlagL0()) |
---|
[608] | 2225 | { |
---|
[56] | 2226 | uiCode = 0; |
---|
| 2227 | Int i = 0; |
---|
[608] | 2228 | Int numRpsCurrTempList0 = rpcSlice->getNumRpsCurrTempList(); |
---|
| 2229 | if ( numRpsCurrTempList0 > 1 ) |
---|
[56] | 2230 | { |
---|
| 2231 | Int length = 1; |
---|
[608] | 2232 | numRpsCurrTempList0 --; |
---|
| 2233 | while ( numRpsCurrTempList0 >>= 1) |
---|
[56] | 2234 | { |
---|
| 2235 | length ++; |
---|
| 2236 | } |
---|
| 2237 | for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) |
---|
| 2238 | { |
---|
| 2239 | READ_CODE( length, uiCode, "list_entry_l0" ); |
---|
| 2240 | refPicListModification->setRefPicSetIdxL0(i, uiCode ); |
---|
| 2241 | } |
---|
| 2242 | } |
---|
| 2243 | else |
---|
| 2244 | { |
---|
| 2245 | for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) |
---|
| 2246 | { |
---|
| 2247 | refPicListModification->setRefPicSetIdxL0(i, 0 ); |
---|
| 2248 | } |
---|
| 2249 | } |
---|
[2] | 2250 | } |
---|
| 2251 | } |
---|
[56] | 2252 | else |
---|
[2] | 2253 | { |
---|
[56] | 2254 | refPicListModification->setRefPicListModificationFlagL0(0); |
---|
[2] | 2255 | } |
---|
[56] | 2256 | if(rpcSlice->isInterB()) |
---|
[2] | 2257 | { |
---|
[608] | 2258 | if( !rpcSlice->getPPS()->getListsModificationPresentFlag() || rpcSlice->getNumRpsCurrTempList() <= 1 ) |
---|
[2] | 2259 | { |
---|
[56] | 2260 | refPicListModification->setRefPicListModificationFlagL1( 0 ); |
---|
[2] | 2261 | } |
---|
| 2262 | else |
---|
| 2263 | { |
---|
[56] | 2264 | READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); refPicListModification->setRefPicListModificationFlagL1( uiCode ? 1 : 0 ); |
---|
[2] | 2265 | } |
---|
[56] | 2266 | if(refPicListModification->getRefPicListModificationFlagL1()) |
---|
[2] | 2267 | { |
---|
[56] | 2268 | uiCode = 0; |
---|
| 2269 | Int i = 0; |
---|
[608] | 2270 | Int numRpsCurrTempList1 = rpcSlice->getNumRpsCurrTempList(); |
---|
| 2271 | if ( numRpsCurrTempList1 > 1 ) |
---|
[56] | 2272 | { |
---|
| 2273 | Int length = 1; |
---|
[608] | 2274 | numRpsCurrTempList1 --; |
---|
| 2275 | while ( numRpsCurrTempList1 >>= 1) |
---|
[56] | 2276 | { |
---|
| 2277 | length ++; |
---|
| 2278 | } |
---|
| 2279 | for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) |
---|
| 2280 | { |
---|
| 2281 | READ_CODE( length, uiCode, "list_entry_l1" ); |
---|
| 2282 | refPicListModification->setRefPicSetIdxL1(i, uiCode ); |
---|
| 2283 | } |
---|
| 2284 | } |
---|
| 2285 | else |
---|
| 2286 | { |
---|
| 2287 | for (i = 0; i < rpcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) |
---|
| 2288 | { |
---|
| 2289 | refPicListModification->setRefPicSetIdxL1(i, 0 ); |
---|
| 2290 | } |
---|
| 2291 | } |
---|
[2] | 2292 | } |
---|
[56] | 2293 | } |
---|
| 2294 | else |
---|
[2] | 2295 | { |
---|
[56] | 2296 | refPicListModification->setRefPicListModificationFlagL1(0); |
---|
[2] | 2297 | } |
---|
[608] | 2298 | if (rpcSlice->isInterB()) |
---|
[2] | 2299 | { |
---|
[608] | 2300 | READ_FLAG( uiCode, "mvd_l1_zero_flag" ); rpcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) ); |
---|
| 2301 | } |
---|
| 2302 | |
---|
| 2303 | rpcSlice->setCabacInitFlag( false ); // default |
---|
| 2304 | if(pps->getCabacInitPresentFlag() && !rpcSlice->isIntra()) |
---|
| 2305 | { |
---|
| 2306 | READ_FLAG(uiCode, "cabac_init_flag"); |
---|
| 2307 | rpcSlice->setCabacInitFlag( uiCode ? true : false ); |
---|
| 2308 | } |
---|
| 2309 | |
---|
| 2310 | if ( rpcSlice->getEnableTMVPFlag() ) |
---|
| 2311 | { |
---|
| 2312 | if ( rpcSlice->getSliceType() == B_SLICE ) |
---|
[56] | 2313 | { |
---|
[608] | 2314 | READ_FLAG( uiCode, "collocated_from_l0_flag" ); |
---|
| 2315 | rpcSlice->setColFromL0Flag(uiCode); |
---|
[2] | 2316 | } |
---|
| 2317 | else |
---|
| 2318 | { |
---|
[608] | 2319 | rpcSlice->setColFromL0Flag( 1 ); |
---|
[2] | 2320 | } |
---|
[608] | 2321 | |
---|
| 2322 | if ( rpcSlice->getSliceType() != I_SLICE && |
---|
| 2323 | ((rpcSlice->getColFromL0Flag() == 1 && rpcSlice->getNumRefIdx(REF_PIC_LIST_0) > 1)|| |
---|
| 2324 | (rpcSlice->getColFromL0Flag() == 0 && rpcSlice->getNumRefIdx(REF_PIC_LIST_1) > 1))) |
---|
| 2325 | { |
---|
| 2326 | READ_UVLC( uiCode, "collocated_ref_idx" ); |
---|
| 2327 | rpcSlice->setColRefIdx(uiCode); |
---|
| 2328 | } |
---|
| 2329 | else |
---|
| 2330 | { |
---|
| 2331 | rpcSlice->setColRefIdx(0); |
---|
| 2332 | } |
---|
[2] | 2333 | } |
---|
[608] | 2334 | if ( (pps->getUseWP() && rpcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && rpcSlice->getSliceType()==B_SLICE) ) |
---|
[2] | 2335 | { |
---|
[608] | 2336 | xParsePredWeightTable(rpcSlice); |
---|
| 2337 | rpcSlice->initWpScaling(); |
---|
[2] | 2338 | } |
---|
[608] | 2339 | #if H_3D_IC |
---|
[724] | 2340 | else if( rpcSlice->getViewIndex() && ( rpcSlice->getSliceType() == P_SLICE || rpcSlice->getSliceType() == B_SLICE ) && !rpcSlice->getIsDepth()) |
---|
[608] | 2341 | { |
---|
| 2342 | UInt uiCodeTmp = 0; |
---|
[2] | 2343 | |
---|
[608] | 2344 | READ_FLAG ( uiCodeTmp, "slice_ic_enable_flag" ); |
---|
| 2345 | rpcSlice->setApplyIC( uiCodeTmp ); |
---|
| 2346 | |
---|
| 2347 | if ( uiCodeTmp ) |
---|
| 2348 | { |
---|
| 2349 | READ_FLAG ( uiCodeTmp, "ic_skip_mergeidx0" ); |
---|
| 2350 | rpcSlice->setIcSkipParseFlag( uiCodeTmp ); |
---|
| 2351 | } |
---|
| 2352 | } |
---|
| 2353 | #endif |
---|
| 2354 | if (!rpcSlice->isIntra()) |
---|
| 2355 | { |
---|
| 2356 | READ_UVLC( uiCode, "five_minus_max_num_merge_cand"); |
---|
| 2357 | #if H_3D_IV_MERGE |
---|
[724] | 2358 | if(rpcSlice->getIsDepth()) |
---|
| 2359 | { |
---|
| 2360 | Bool bMPIFlag = rpcSlice->getVPS()->getMPIFlag( rpcSlice->getLayerIdInVps() ) ; |
---|
| 2361 | Bool ivMvPredFlag = rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ; |
---|
| 2362 | rpcSlice->setMaxNumMergeCand(( ( bMPIFlag || ivMvPredFlag ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode); |
---|
| 2363 | } |
---|
| 2364 | else |
---|
| 2365 | { |
---|
| 2366 | Bool ivMvPredFlag = rpcSlice->getVPS()->getIvMvPredFlag( rpcSlice->getLayerIdInVps() ) ; |
---|
| 2367 | rpcSlice->setMaxNumMergeCand(( ivMvPredFlag ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode); |
---|
| 2368 | } |
---|
[773] | 2369 | |
---|
[724] | 2370 | #else |
---|
[608] | 2371 | rpcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); |
---|
[56] | 2372 | #endif |
---|
[608] | 2373 | } |
---|
[2] | 2374 | |
---|
[608] | 2375 | READ_SVLC( iCode, "slice_qp_delta" ); |
---|
[56] | 2376 | rpcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); |
---|
[2] | 2377 | |
---|
[56] | 2378 | assert( rpcSlice->getSliceQp() >= -sps->getQpBDOffsetY() ); |
---|
| 2379 | assert( rpcSlice->getSliceQp() <= 51 ); |
---|
[2] | 2380 | |
---|
[608] | 2381 | if (rpcSlice->getPPS()->getSliceChromaQpFlag()) |
---|
[2] | 2382 | { |
---|
[608] | 2383 | READ_SVLC( iCode, "slice_qp_delta_cb" ); |
---|
| 2384 | rpcSlice->setSliceQpDeltaCb( iCode ); |
---|
| 2385 | assert( rpcSlice->getSliceQpDeltaCb() >= -12 ); |
---|
| 2386 | assert( rpcSlice->getSliceQpDeltaCb() <= 12 ); |
---|
| 2387 | assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) >= -12 ); |
---|
| 2388 | assert( (rpcSlice->getPPS()->getChromaCbQpOffset() + rpcSlice->getSliceQpDeltaCb()) <= 12 ); |
---|
| 2389 | |
---|
| 2390 | READ_SVLC( iCode, "slice_qp_delta_cr" ); |
---|
| 2391 | rpcSlice->setSliceQpDeltaCr( iCode ); |
---|
| 2392 | assert( rpcSlice->getSliceQpDeltaCr() >= -12 ); |
---|
| 2393 | assert( rpcSlice->getSliceQpDeltaCr() <= 12 ); |
---|
| 2394 | assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) >= -12 ); |
---|
| 2395 | assert( (rpcSlice->getPPS()->getChromaCrQpOffset() + rpcSlice->getSliceQpDeltaCr()) <= 12 ); |
---|
| 2396 | } |
---|
| 2397 | |
---|
| 2398 | if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) |
---|
| 2399 | { |
---|
| 2400 | if(rpcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag()) |
---|
[2] | 2401 | { |
---|
[608] | 2402 | READ_FLAG ( uiCode, "deblocking_filter_override_flag" ); rpcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false); |
---|
[2] | 2403 | } |
---|
[608] | 2404 | else |
---|
| 2405 | { |
---|
| 2406 | rpcSlice->setDeblockingFilterOverrideFlag(0); |
---|
| 2407 | } |
---|
| 2408 | if(rpcSlice->getDeblockingFilterOverrideFlag()) |
---|
[2] | 2409 | { |
---|
[608] | 2410 | READ_FLAG ( uiCode, "slice_disable_deblocking_filter_flag" ); rpcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0); |
---|
| 2411 | if(!rpcSlice->getDeblockingFilterDisable()) |
---|
[56] | 2412 | { |
---|
[608] | 2413 | READ_SVLC( iCode, "slice_beta_offset_div2" ); rpcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); |
---|
| 2414 | assert(rpcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && |
---|
| 2415 | rpcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); |
---|
| 2416 | READ_SVLC( iCode, "slice_tc_offset_div2" ); rpcSlice->setDeblockingFilterTcOffsetDiv2(iCode); |
---|
| 2417 | assert(rpcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && |
---|
| 2418 | rpcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); |
---|
[56] | 2419 | } |
---|
[2] | 2420 | } |
---|
[608] | 2421 | else |
---|
| 2422 | { |
---|
| 2423 | rpcSlice->setDeblockingFilterDisable ( rpcSlice->getPPS()->getPicDisableDeblockingFilterFlag() ); |
---|
| 2424 | rpcSlice->setDeblockingFilterBetaOffsetDiv2( rpcSlice->getPPS()->getDeblockingFilterBetaOffsetDiv2() ); |
---|
| 2425 | rpcSlice->setDeblockingFilterTcOffsetDiv2 ( rpcSlice->getPPS()->getDeblockingFilterTcOffsetDiv2() ); |
---|
| 2426 | } |
---|
| 2427 | } |
---|
| 2428 | else |
---|
| 2429 | { |
---|
| 2430 | rpcSlice->setDeblockingFilterDisable ( false ); |
---|
| 2431 | rpcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); |
---|
| 2432 | rpcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 ); |
---|
| 2433 | } |
---|
| 2434 | |
---|
| 2435 | Bool isSAOEnabled = (!rpcSlice->getSPS()->getUseSAO())?(false):(rpcSlice->getSaoEnabledFlag()||rpcSlice->getSaoEnabledFlagChroma()); |
---|
| 2436 | Bool isDBFEnabled = (!rpcSlice->getDeblockingFilterDisable()); |
---|
| 2437 | |
---|
| 2438 | if(rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) |
---|
[56] | 2439 | { |
---|
[608] | 2440 | READ_FLAG( uiCode, "slice_loop_filter_across_slices_enabled_flag"); |
---|
[2] | 2441 | } |
---|
[608] | 2442 | else |
---|
| 2443 | { |
---|
| 2444 | uiCode = rpcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag()?1:0; |
---|
| 2445 | } |
---|
| 2446 | rpcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false); |
---|
[56] | 2447 | |
---|
[608] | 2448 | } |
---|
| 2449 | |
---|
| 2450 | UInt *entryPointOffset = NULL; |
---|
| 2451 | UInt numEntryPointOffsets, offsetLenMinus1; |
---|
| 2452 | if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) |
---|
| 2453 | { |
---|
| 2454 | READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); rpcSlice->setNumEntryPointOffsets ( numEntryPointOffsets ); |
---|
| 2455 | if (numEntryPointOffsets>0) |
---|
[2] | 2456 | { |
---|
[608] | 2457 | READ_UVLC(offsetLenMinus1, "offset_len_minus1"); |
---|
[2] | 2458 | } |
---|
[608] | 2459 | entryPointOffset = new UInt[numEntryPointOffsets]; |
---|
| 2460 | for (UInt idx=0; idx<numEntryPointOffsets; idx++) |
---|
[2] | 2461 | { |
---|
[608] | 2462 | READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); |
---|
| 2463 | entryPointOffset[ idx ] = uiCode + 1; |
---|
[2] | 2464 | } |
---|
| 2465 | } |
---|
[608] | 2466 | else |
---|
[2] | 2467 | { |
---|
[608] | 2468 | rpcSlice->setNumEntryPointOffsets ( 0 ); |
---|
| 2469 | } |
---|
| 2470 | |
---|
[773] | 2471 | #if H_3D |
---|
[758] | 2472 | if( rpcSlice->getVPS()->hasCamParInSliceHeader( rpcSlice->getViewIndex() ) && !rpcSlice->getIsDepth() ) |
---|
| 2473 | { |
---|
| 2474 | UInt uiViewIndex = rpcSlice->getViewIndex(); |
---|
| 2475 | for( UInt uiBaseIndex = 0; uiBaseIndex < uiViewIndex; uiBaseIndex++ ) |
---|
| 2476 | { |
---|
| 2477 | READ_SVLC( iCode, "cp_scale" ); m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ] = iCode; |
---|
| 2478 | READ_SVLC( iCode, "cp_off" ); m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ] = iCode; |
---|
| 2479 | READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); m_aaiTempScale [ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempScale [ uiBaseIndex ][ uiViewIndex ]; |
---|
| 2480 | READ_SVLC( iCode, "cp_inv_off_plus_off" ); m_aaiTempOffset[ uiViewIndex ][ uiBaseIndex ] = iCode - m_aaiTempOffset[ uiBaseIndex ][ uiViewIndex ]; |
---|
| 2481 | } |
---|
| 2482 | rpcSlice->setCamparaSlice( m_aaiTempScale, m_aaiTempOffset ); |
---|
| 2483 | } |
---|
| 2484 | #endif |
---|
| 2485 | |
---|
[608] | 2486 | if(pps->getSliceHeaderExtensionPresentFlag()) |
---|
| 2487 | { |
---|
| 2488 | READ_UVLC(uiCode,"slice_header_extension_length"); |
---|
| 2489 | |
---|
| 2490 | for(Int i=0; i<uiCode; i++) |
---|
| 2491 | { |
---|
| 2492 | UInt ignore; |
---|
| 2493 | READ_CODE(8,ignore,"slice_header_extension_data_byte"); |
---|
| 2494 | } |
---|
| 2495 | } |
---|
[773] | 2496 | |
---|
[608] | 2497 | m_pcBitstream->readByteAlignment(); |
---|
[56] | 2498 | |
---|
[608] | 2499 | if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) |
---|
[56] | 2500 | { |
---|
[608] | 2501 | Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); |
---|
| 2502 | |
---|
| 2503 | // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header |
---|
| 2504 | for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) |
---|
[2] | 2505 | { |
---|
[608] | 2506 | if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation ) |
---|
[2] | 2507 | { |
---|
[608] | 2508 | endOfSliceHeaderLocation++; |
---|
[2] | 2509 | } |
---|
[608] | 2510 | } |
---|
[56] | 2511 | |
---|
[608] | 2512 | Int curEntryPointOffset = 0; |
---|
| 2513 | Int prevEntryPointOffset = 0; |
---|
| 2514 | for (UInt idx=0; idx<numEntryPointOffsets; idx++) |
---|
| 2515 | { |
---|
| 2516 | curEntryPointOffset += entryPointOffset[ idx ]; |
---|
| 2517 | |
---|
| 2518 | Int emulationPreventionByteCount = 0; |
---|
| 2519 | for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) |
---|
[2] | 2520 | { |
---|
[608] | 2521 | if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && |
---|
| 2522 | m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) |
---|
| 2523 | { |
---|
| 2524 | emulationPreventionByteCount++; |
---|
| 2525 | } |
---|
[2] | 2526 | } |
---|
[56] | 2527 | |
---|
[608] | 2528 | entryPointOffset[ idx ] -= emulationPreventionByteCount; |
---|
| 2529 | prevEntryPointOffset = curEntryPointOffset; |
---|
[2] | 2530 | } |
---|
[56] | 2531 | |
---|
[608] | 2532 | if ( pps->getTilesEnabledFlag() ) |
---|
| 2533 | { |
---|
| 2534 | rpcSlice->setTileLocationCount( numEntryPointOffsets ); |
---|
[56] | 2535 | |
---|
[608] | 2536 | UInt prevPos = 0; |
---|
| 2537 | for (Int idx=0; idx<rpcSlice->getTileLocationCount(); idx++) |
---|
| 2538 | { |
---|
| 2539 | rpcSlice->setTileLocation( idx, prevPos + entryPointOffset [ idx ] ); |
---|
| 2540 | prevPos += entryPointOffset[ idx ]; |
---|
| 2541 | } |
---|
[2] | 2542 | } |
---|
[608] | 2543 | else if ( pps->getEntropyCodingSyncEnabledFlag() ) |
---|
[2] | 2544 | { |
---|
[608] | 2545 | Int numSubstreams = rpcSlice->getNumEntryPointOffsets()+1; |
---|
| 2546 | rpcSlice->allocSubstreamSizes(numSubstreams); |
---|
| 2547 | UInt *pSubstreamSizes = rpcSlice->getSubstreamSizes(); |
---|
| 2548 | for (Int idx=0; idx<numSubstreams-1; idx++) |
---|
[2] | 2549 | { |
---|
[608] | 2550 | if ( idx < numEntryPointOffsets ) |
---|
| 2551 | { |
---|
| 2552 | pSubstreamSizes[ idx ] = ( entryPointOffset[ idx ] << 3 ) ; |
---|
| 2553 | } |
---|
| 2554 | else |
---|
| 2555 | { |
---|
| 2556 | pSubstreamSizes[ idx ] = 0; |
---|
| 2557 | } |
---|
[2] | 2558 | } |
---|
[56] | 2559 | } |
---|
[608] | 2560 | |
---|
| 2561 | if (entryPointOffset) |
---|
| 2562 | { |
---|
| 2563 | delete [] entryPointOffset; |
---|
| 2564 | } |
---|
[56] | 2565 | } |
---|
[2] | 2566 | |
---|
[608] | 2567 | return; |
---|
| 2568 | } |
---|
| 2569 | |
---|
| 2570 | Void TDecCavlc::parsePTL( TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1 ) |
---|
| 2571 | { |
---|
| 2572 | UInt uiCode; |
---|
| 2573 | if(profilePresentFlag) |
---|
[56] | 2574 | { |
---|
[608] | 2575 | parseProfileTier(rpcPTL->getGeneralPTL()); |
---|
| 2576 | } |
---|
| 2577 | READ_CODE( 8, uiCode, "general_level_idc" ); rpcPTL->getGeneralPTL()->setLevelIdc(uiCode); |
---|
[2] | 2578 | |
---|
[608] | 2579 | for (Int i = 0; i < maxNumSubLayersMinus1; i++) |
---|
| 2580 | { |
---|
| 2581 | #if !H_MV |
---|
| 2582 | if(profilePresentFlag) |
---|
[56] | 2583 | { |
---|
[608] | 2584 | #endif |
---|
| 2585 | READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode); |
---|
| 2586 | #if H_MV |
---|
| 2587 | rpcPTL->setSubLayerProfilePresentFlag( i, profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) ); |
---|
| 2588 | #else |
---|
[56] | 2589 | } |
---|
[608] | 2590 | #endif |
---|
| 2591 | READ_FLAG( uiCode, "sub_layer_level_present_flag[i]" ); rpcPTL->setSubLayerLevelPresentFlag (i, uiCode); |
---|
[56] | 2592 | } |
---|
[608] | 2593 | |
---|
| 2594 | if (maxNumSubLayersMinus1 > 0) |
---|
[56] | 2595 | { |
---|
[608] | 2596 | for (Int i = maxNumSubLayersMinus1; i < 8; i++) |
---|
[56] | 2597 | { |
---|
[608] | 2598 | READ_CODE(2, uiCode, "reserved_zero_2bits"); |
---|
| 2599 | assert(uiCode == 0); |
---|
[2] | 2600 | } |
---|
[56] | 2601 | } |
---|
[608] | 2602 | |
---|
| 2603 | for(Int i = 0; i < maxNumSubLayersMinus1; i++) |
---|
[56] | 2604 | { |
---|
[608] | 2605 | if( profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) ) |
---|
| 2606 | { |
---|
| 2607 | parseProfileTier(rpcPTL->getSubLayerPTL(i)); |
---|
| 2608 | } |
---|
| 2609 | if(rpcPTL->getSubLayerLevelPresentFlag(i)) |
---|
| 2610 | { |
---|
| 2611 | READ_CODE( 8, uiCode, "sub_layer_level_idc[i]" ); rpcPTL->getSubLayerPTL(i)->setLevelIdc(uiCode); |
---|
| 2612 | } |
---|
[56] | 2613 | } |
---|
[2] | 2614 | } |
---|
| 2615 | |
---|
[608] | 2616 | Void TDecCavlc::parseProfileTier(ProfileTierLevel *ptl) |
---|
[2] | 2617 | { |
---|
[608] | 2618 | UInt uiCode; |
---|
| 2619 | READ_CODE(2 , uiCode, "XXX_profile_space[]"); ptl->setProfileSpace(uiCode); |
---|
| 2620 | READ_FLAG( uiCode, "XXX_tier_flag[]" ); ptl->setTierFlag (uiCode ? 1 : 0); |
---|
| 2621 | READ_CODE(5 , uiCode, "XXX_profile_idc[]" ); ptl->setProfileIdc (uiCode); |
---|
| 2622 | for(Int j = 0; j < 32; j++) |
---|
[2] | 2623 | { |
---|
[608] | 2624 | READ_FLAG( uiCode, "XXX_profile_compatibility_flag[][j]"); ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0); |
---|
[2] | 2625 | } |
---|
[608] | 2626 | READ_FLAG(uiCode, "general_progressive_source_flag"); |
---|
| 2627 | ptl->setProgressiveSourceFlag(uiCode ? true : false); |
---|
[2] | 2628 | |
---|
[608] | 2629 | READ_FLAG(uiCode, "general_interlaced_source_flag"); |
---|
| 2630 | ptl->setInterlacedSourceFlag(uiCode ? true : false); |
---|
| 2631 | |
---|
| 2632 | READ_FLAG(uiCode, "general_non_packed_constraint_flag"); |
---|
| 2633 | ptl->setNonPackedConstraintFlag(uiCode ? true : false); |
---|
| 2634 | |
---|
| 2635 | READ_FLAG(uiCode, "general_frame_only_constraint_flag"); |
---|
| 2636 | ptl->setFrameOnlyConstraintFlag(uiCode ? true : false); |
---|
| 2637 | |
---|
| 2638 | READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[0..15]"); |
---|
| 2639 | READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[16..31]"); |
---|
| 2640 | READ_CODE(12, uiCode, "XXX_reserved_zero_44bits[32..43]"); |
---|
[2] | 2641 | } |
---|
[56] | 2642 | |
---|
| 2643 | Void TDecCavlc::parseTerminatingBit( UInt& ruiBit ) |
---|
[2] | 2644 | { |
---|
[56] | 2645 | ruiBit = false; |
---|
| 2646 | Int iBitsLeft = m_pcBitstream->getNumBitsLeft(); |
---|
| 2647 | if(iBitsLeft <= 8) |
---|
[2] | 2648 | { |
---|
[56] | 2649 | UInt uiPeekValue = m_pcBitstream->peekBits(iBitsLeft); |
---|
| 2650 | if (uiPeekValue == (1<<(iBitsLeft-1))) |
---|
| 2651 | { |
---|
| 2652 | ruiBit = true; |
---|
| 2653 | } |
---|
[2] | 2654 | } |
---|
| 2655 | } |
---|
| 2656 | |
---|
[608] | 2657 | Void TDecCavlc::parseSkipFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
[2] | 2658 | { |
---|
[56] | 2659 | assert(0); |
---|
| 2660 | } |
---|
[2] | 2661 | |
---|
[608] | 2662 | Void TDecCavlc::parseCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
[189] | 2663 | { |
---|
| 2664 | assert(0); |
---|
| 2665 | } |
---|
| 2666 | |
---|
[608] | 2667 | Void TDecCavlc::parseMVPIdx( Int& /*riMVPIdx*/ ) |
---|
[56] | 2668 | { |
---|
| 2669 | assert(0); |
---|
| 2670 | } |
---|
[2] | 2671 | |
---|
[608] | 2672 | Void TDecCavlc::parseSplitFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
[56] | 2673 | { |
---|
| 2674 | assert(0); |
---|
| 2675 | } |
---|
[2] | 2676 | |
---|
[608] | 2677 | Void TDecCavlc::parsePartSize( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
[56] | 2678 | { |
---|
| 2679 | assert(0); |
---|
| 2680 | } |
---|
[2] | 2681 | |
---|
[608] | 2682 | Void TDecCavlc::parsePredMode( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
[56] | 2683 | { |
---|
| 2684 | assert(0); |
---|
| 2685 | } |
---|
[2] | 2686 | |
---|
[56] | 2687 | /** Parse I_PCM information. |
---|
[608] | 2688 | * \param pcCU pointer to CU |
---|
| 2689 | * \param uiAbsPartIdx CU index |
---|
| 2690 | * \param uiDepth CU depth |
---|
| 2691 | * \returns Void |
---|
| 2692 | * |
---|
| 2693 | * If I_PCM flag indicates that the CU is I_PCM, parse its PCM alignment bits and codes. |
---|
| 2694 | */ |
---|
| 2695 | Void TDecCavlc::parseIPCMInfo( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
[56] | 2696 | { |
---|
| 2697 | assert(0); |
---|
[2] | 2698 | } |
---|
| 2699 | |
---|
[608] | 2700 | Void TDecCavlc::parseIntraDirLumaAng ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
[56] | 2701 | { |
---|
| 2702 | assert(0); |
---|
[2] | 2703 | } |
---|
| 2704 | |
---|
[608] | 2705 | Void TDecCavlc::parseIntraDirChroma( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
[2] | 2706 | { |
---|
[56] | 2707 | assert(0); |
---|
[2] | 2708 | } |
---|
| 2709 | |
---|
[608] | 2710 | Void TDecCavlc::parseInterDir( TComDataCU* /*pcCU*/, UInt& /*ruiInterDir*/, UInt /*uiAbsPartIdx*/ ) |
---|
[2] | 2711 | { |
---|
[56] | 2712 | assert(0); |
---|
[2] | 2713 | } |
---|
| 2714 | |
---|
[608] | 2715 | Void TDecCavlc::parseRefFrmIdx( TComDataCU* /*pcCU*/, Int& /*riRefFrmIdx*/, RefPicList /*eRefList*/ ) |
---|
[2] | 2716 | { |
---|
[56] | 2717 | assert(0); |
---|
[2] | 2718 | } |
---|
| 2719 | |
---|
[608] | 2720 | Void TDecCavlc::parseMvd( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiPartIdx*/, UInt /*uiDepth*/, RefPicList /*eRefList*/ ) |
---|
[2] | 2721 | { |
---|
[56] | 2722 | assert(0); |
---|
[2] | 2723 | } |
---|
| 2724 | |
---|
[56] | 2725 | Void TDecCavlc::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
[2] | 2726 | { |
---|
[56] | 2727 | Int qp; |
---|
| 2728 | Int iDQp; |
---|
[608] | 2729 | |
---|
[56] | 2730 | xReadSvlc( iDQp ); |
---|
[2] | 2731 | |
---|
[56] | 2732 | Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); |
---|
| 2733 | qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) - qpBdOffsetY; |
---|
| 2734 | |
---|
[608] | 2735 | UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>((g_uiMaxCUDepth - pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())<<1))<<((g_uiMaxCUDepth - pcCU->getSlice()->getPPS()->getMaxCuDQPDepth())<<1) ; |
---|
[56] | 2736 | UInt uiQpCUDepth = min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ; |
---|
| 2737 | |
---|
| 2738 | pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth ); |
---|
[2] | 2739 | } |
---|
| 2740 | |
---|
[608] | 2741 | Void TDecCavlc::parseCoeffNxN( TComDataCU* /*pcCU*/, TCoeff* /*pcCoef*/, UInt /*uiAbsPartIdx*/, UInt /*uiWidth*/, UInt /*uiHeight*/, UInt /*uiDepth*/, TextType /*eTType*/ ) |
---|
[2] | 2742 | { |
---|
[56] | 2743 | assert(0); |
---|
[2] | 2744 | } |
---|
| 2745 | |
---|
[608] | 2746 | Void TDecCavlc::parseTransformSubdivFlag( UInt& /*ruiSubdivFlag*/, UInt /*uiLog2TransformBlockSize*/ ) |
---|
[2] | 2747 | { |
---|
[56] | 2748 | assert(0); |
---|
[2] | 2749 | } |
---|
| 2750 | |
---|
[608] | 2751 | Void TDecCavlc::parseQtCbf( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, TextType /*eType*/, UInt /*uiTrDepth*/, UInt /*uiDepth*/ ) |
---|
[2] | 2752 | { |
---|
[56] | 2753 | assert(0); |
---|
[2] | 2754 | } |
---|
| 2755 | |
---|
[608] | 2756 | Void TDecCavlc::parseQtRootCbf( UInt /*uiAbsPartIdx*/, UInt& /*uiQtRootCbf*/ ) |
---|
[2] | 2757 | { |
---|
[56] | 2758 | assert(0); |
---|
[2] | 2759 | } |
---|
| 2760 | |
---|
[608] | 2761 | Void TDecCavlc::parseTransformSkipFlags (TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*width*/, UInt /*height*/, UInt /*uiDepth*/, TextType /*eTType*/) |
---|
[2] | 2762 | { |
---|
[56] | 2763 | assert(0); |
---|
[2] | 2764 | } |
---|
| 2765 | |
---|
[608] | 2766 | Void TDecCavlc::parseMergeFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/, UInt /*uiPUIdx*/ ) |
---|
[2] | 2767 | { |
---|
[56] | 2768 | assert(0); |
---|
[2] | 2769 | } |
---|
| 2770 | |
---|
[608] | 2771 | Void TDecCavlc::parseMergeIndex ( TComDataCU* /*pcCU*/, UInt& /*ruiMergeIndex*/ ) |
---|
[2] | 2772 | { |
---|
[56] | 2773 | assert(0); |
---|
[2] | 2774 | } |
---|
[608] | 2775 | |
---|
| 2776 | #if H_3D_ARP |
---|
[443] | 2777 | Void TDecCavlc::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2778 | { |
---|
[608] | 2779 | assert(0); |
---|
[443] | 2780 | } |
---|
| 2781 | #endif |
---|
[608] | 2782 | #if H_3D_IC |
---|
| 2783 | Void TDecCavlc::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
[189] | 2784 | { |
---|
| 2785 | assert(0); |
---|
| 2786 | } |
---|
[608] | 2787 | #endif |
---|
[655] | 2788 | #if H_3D_INTER_SDC |
---|
[833] | 2789 | #if QC_SDC_UNIFY_G0130 |
---|
| 2790 | Void TDecCavlc::parseDeltaDC( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
| 2791 | { |
---|
| 2792 | assert(0); |
---|
| 2793 | } |
---|
| 2794 | |
---|
| 2795 | Void TDecCavlc::parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2796 | { |
---|
| 2797 | assert(0); |
---|
| 2798 | } |
---|
| 2799 | #else |
---|
[608] | 2800 | Void TDecCavlc::parseInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
[189] | 2801 | { |
---|
| 2802 | assert(0); |
---|
| 2803 | } |
---|
[608] | 2804 | |
---|
| 2805 | Void TDecCavlc::parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart ) |
---|
[189] | 2806 | { |
---|
| 2807 | assert(0); |
---|
| 2808 | } |
---|
| 2809 | #endif |
---|
[833] | 2810 | #endif |
---|
| 2811 | #if H_3D_DBBP |
---|
| 2812 | Void TDecCavlc::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
| 2813 | { |
---|
| 2814 | assert(0); |
---|
| 2815 | } |
---|
| 2816 | #endif |
---|
[2] | 2817 | // ==================================================================================================================== |
---|
| 2818 | // Protected member functions |
---|
| 2819 | // ==================================================================================================================== |
---|
| 2820 | |
---|
[56] | 2821 | /** parse explicit wp tables |
---|
[608] | 2822 | * \param TComSlice* pcSlice |
---|
| 2823 | * \returns Void |
---|
| 2824 | */ |
---|
[56] | 2825 | Void TDecCavlc::xParsePredWeightTable( TComSlice* pcSlice ) |
---|
[2] | 2826 | { |
---|
[56] | 2827 | wpScalingParam *wp; |
---|
| 2828 | Bool bChroma = true; // color always present in HEVC ? |
---|
| 2829 | SliceType eSliceType = pcSlice->getSliceType(); |
---|
| 2830 | Int iNbRef = (eSliceType == B_SLICE ) ? (2) : (1); |
---|
| 2831 | UInt uiLog2WeightDenomLuma, uiLog2WeightDenomChroma; |
---|
[608] | 2832 | UInt uiTotalSignalledWeightFlags = 0; |
---|
| 2833 | |
---|
| 2834 | Int iDeltaDenom; |
---|
| 2835 | // decode delta_luma_log2_weight_denom : |
---|
| 2836 | READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom |
---|
| 2837 | assert( uiLog2WeightDenomLuma <= 7 ); |
---|
| 2838 | if( bChroma ) |
---|
| 2839 | { |
---|
| 2840 | READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom |
---|
| 2841 | assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); |
---|
| 2842 | assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7); |
---|
| 2843 | uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); |
---|
| 2844 | } |
---|
[2] | 2845 | |
---|
[608] | 2846 | for ( Int iNumRef=0 ; iNumRef<iNbRef ; iNumRef++ ) |
---|
[2] | 2847 | { |
---|
[608] | 2848 | RefPicList eRefPicList = ( iNumRef ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); |
---|
| 2849 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
[2] | 2850 | { |
---|
[608] | 2851 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
| 2852 | |
---|
| 2853 | wp[0].uiLog2WeightDenom = uiLog2WeightDenomLuma; |
---|
| 2854 | wp[1].uiLog2WeightDenom = uiLog2WeightDenomChroma; |
---|
| 2855 | wp[2].uiLog2WeightDenom = uiLog2WeightDenomChroma; |
---|
| 2856 | |
---|
| 2857 | UInt uiCode; |
---|
| 2858 | READ_FLAG( uiCode, "luma_weight_lX_flag" ); // u(1): luma_weight_l0_flag |
---|
| 2859 | wp[0].bPresentFlag = ( uiCode == 1 ); |
---|
| 2860 | uiTotalSignalledWeightFlags += wp[0].bPresentFlag; |
---|
[56] | 2861 | } |
---|
[608] | 2862 | if ( bChroma ) |
---|
[56] | 2863 | { |
---|
[608] | 2864 | UInt uiCode; |
---|
[56] | 2865 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
[2] | 2866 | { |
---|
[56] | 2867 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
[608] | 2868 | READ_FLAG( uiCode, "chroma_weight_lX_flag" ); // u(1): chroma_weight_l0_flag |
---|
| 2869 | wp[1].bPresentFlag = ( uiCode == 1 ); |
---|
| 2870 | wp[2].bPresentFlag = ( uiCode == 1 ); |
---|
| 2871 | uiTotalSignalledWeightFlags += 2*wp[1].bPresentFlag; |
---|
[2] | 2872 | } |
---|
| 2873 | } |
---|
[608] | 2874 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
[2] | 2875 | { |
---|
[608] | 2876 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
[56] | 2877 | if ( wp[0].bPresentFlag ) |
---|
[2] | 2878 | { |
---|
[56] | 2879 | Int iDeltaWeight; |
---|
[608] | 2880 | READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" ); // se(v): delta_luma_weight_l0[i] |
---|
| 2881 | assert( iDeltaWeight >= -128 ); |
---|
| 2882 | assert( iDeltaWeight <= 127 ); |
---|
[56] | 2883 | wp[0].iWeight = (iDeltaWeight + (1<<wp[0].uiLog2WeightDenom)); |
---|
[608] | 2884 | READ_SVLC( wp[0].iOffset, "luma_offset_lX" ); // se(v): luma_offset_l0[i] |
---|
| 2885 | assert( wp[0].iOffset >= -128 ); |
---|
| 2886 | assert( wp[0].iOffset <= 127 ); |
---|
[2] | 2887 | } |
---|
[56] | 2888 | else |
---|
[2] | 2889 | { |
---|
[56] | 2890 | wp[0].iWeight = (1 << wp[0].uiLog2WeightDenom); |
---|
| 2891 | wp[0].iOffset = 0; |
---|
[2] | 2892 | } |
---|
[56] | 2893 | if ( bChroma ) |
---|
[2] | 2894 | { |
---|
[56] | 2895 | if ( wp[1].bPresentFlag ) |
---|
[2] | 2896 | { |
---|
[56] | 2897 | for ( Int j=1 ; j<3 ; j++ ) |
---|
[2] | 2898 | { |
---|
[56] | 2899 | Int iDeltaWeight; |
---|
[608] | 2900 | READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" ); // se(v): chroma_weight_l0[i][j] |
---|
| 2901 | assert( iDeltaWeight >= -128 ); |
---|
| 2902 | assert( iDeltaWeight <= 127 ); |
---|
[56] | 2903 | wp[j].iWeight = (iDeltaWeight + (1<<wp[1].uiLog2WeightDenom)); |
---|
| 2904 | |
---|
| 2905 | Int iDeltaChroma; |
---|
[608] | 2906 | READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" ); // se(v): delta_chroma_offset_l0[i][j] |
---|
| 2907 | assert( iDeltaChroma >= -512 ); |
---|
| 2908 | assert( iDeltaChroma <= 511 ); |
---|
| 2909 | Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); |
---|
| 2910 | wp[j].iOffset = Clip3(-128, 127, (iDeltaChroma + pred) ); |
---|
[2] | 2911 | } |
---|
| 2912 | } |
---|
[56] | 2913 | else |
---|
[2] | 2914 | { |
---|
[56] | 2915 | for ( Int j=1 ; j<3 ; j++ ) |
---|
[2] | 2916 | { |
---|
[56] | 2917 | wp[j].iWeight = (1 << wp[j].uiLog2WeightDenom); |
---|
| 2918 | wp[j].iOffset = 0; |
---|
[2] | 2919 | } |
---|
| 2920 | } |
---|
| 2921 | } |
---|
| 2922 | } |
---|
| 2923 | |
---|
[608] | 2924 | for ( Int iRefIdx=pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) |
---|
[2] | 2925 | { |
---|
[608] | 2926 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
[2] | 2927 | |
---|
[56] | 2928 | wp[0].bPresentFlag = false; |
---|
| 2929 | wp[1].bPresentFlag = false; |
---|
| 2930 | wp[2].bPresentFlag = false; |
---|
[2] | 2931 | } |
---|
| 2932 | } |
---|
[608] | 2933 | assert(uiTotalSignalledWeightFlags<=24); |
---|
[2] | 2934 | } |
---|
| 2935 | |
---|
[56] | 2936 | /** decode quantization matrix |
---|
[608] | 2937 | * \param scalingList quantization matrix information |
---|
| 2938 | */ |
---|
[56] | 2939 | Void TDecCavlc::parseScalingList(TComScalingList* scalingList) |
---|
[2] | 2940 | { |
---|
[56] | 2941 | UInt code, sizeId, listId; |
---|
| 2942 | Bool scalingListPredModeFlag; |
---|
[608] | 2943 | //for each size |
---|
| 2944 | for(sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
[2] | 2945 | { |
---|
[608] | 2946 | for(listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
[2] | 2947 | { |
---|
[608] | 2948 | READ_FLAG( code, "scaling_list_pred_mode_flag"); |
---|
| 2949 | scalingListPredModeFlag = (code) ? true : false; |
---|
| 2950 | if(!scalingListPredModeFlag) //Copy Mode |
---|
[2] | 2951 | { |
---|
[608] | 2952 | READ_UVLC( code, "scaling_list_pred_matrix_id_delta"); |
---|
| 2953 | scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code))); |
---|
| 2954 | if( sizeId > SCALING_LIST_8x8 ) |
---|
[2] | 2955 | { |
---|
[608] | 2956 | scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId)))); |
---|
[2] | 2957 | } |
---|
[608] | 2958 | scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId)); |
---|
| 2959 | |
---|
[2] | 2960 | } |
---|
[608] | 2961 | else //DPCM Mode |
---|
| 2962 | { |
---|
| 2963 | xDecodeScalingList(scalingList, sizeId, listId); |
---|
| 2964 | } |
---|
[2] | 2965 | } |
---|
| 2966 | } |
---|
| 2967 | |
---|
| 2968 | return; |
---|
| 2969 | } |
---|
[56] | 2970 | /** decode DPCM |
---|
[608] | 2971 | * \param scalingList quantization matrix information |
---|
| 2972 | * \param sizeId size index |
---|
| 2973 | * \param listId list index |
---|
| 2974 | */ |
---|
[56] | 2975 | Void TDecCavlc::xDecodeScalingList(TComScalingList *scalingList, UInt sizeId, UInt listId) |
---|
[2] | 2976 | { |
---|
[56] | 2977 | Int i,coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]); |
---|
| 2978 | Int data; |
---|
| 2979 | Int scalingListDcCoefMinus8 = 0; |
---|
| 2980 | Int nextCoef = SCALING_LIST_START_VALUE; |
---|
[608] | 2981 | UInt* scan = (sizeId == 0) ? g_auiSigLastScan [ SCAN_DIAG ] [ 1 ] : g_sigLastScanCG32x32; |
---|
[56] | 2982 | Int *dst = scalingList->getScalingListAddress(sizeId, listId); |
---|
[2] | 2983 | |
---|
[56] | 2984 | if( sizeId > SCALING_LIST_8x8 ) |
---|
[2] | 2985 | { |
---|
[56] | 2986 | READ_SVLC( scalingListDcCoefMinus8, "scaling_list_dc_coef_minus8"); |
---|
| 2987 | scalingList->setScalingListDC(sizeId,listId,scalingListDcCoefMinus8 + 8); |
---|
[608] | 2988 | nextCoef = scalingList->getScalingListDC(sizeId,listId); |
---|
[2] | 2989 | } |
---|
| 2990 | |
---|
[608] | 2991 | for(i = 0; i < coefNum; i++) |
---|
[2] | 2992 | { |
---|
[608] | 2993 | READ_SVLC( data, "scaling_list_delta_coef"); |
---|
| 2994 | nextCoef = (nextCoef + data + 256 ) % 256; |
---|
| 2995 | dst[scan[i]] = nextCoef; |
---|
[2] | 2996 | } |
---|
| 2997 | } |
---|
| 2998 | |
---|
[56] | 2999 | Bool TDecCavlc::xMoreRbspData() |
---|
| 3000 | { |
---|
| 3001 | Int bitsLeft = m_pcBitstream->getNumBitsLeft(); |
---|
[2] | 3002 | |
---|
[56] | 3003 | // if there are more than 8 bits, it cannot be rbsp_trailing_bits |
---|
| 3004 | if (bitsLeft > 8) |
---|
[2] | 3005 | { |
---|
[56] | 3006 | return true; |
---|
| 3007 | } |
---|
[2] | 3008 | |
---|
[56] | 3009 | UChar lastByte = m_pcBitstream->peekBits(bitsLeft); |
---|
| 3010 | Int cnt = bitsLeft; |
---|
[2] | 3011 | |
---|
[56] | 3012 | // remove trailing bits equal to zero |
---|
| 3013 | while ((cnt>0) && ((lastByte & 1) == 0)) |
---|
| 3014 | { |
---|
| 3015 | lastByte >>= 1; |
---|
| 3016 | cnt--; |
---|
| 3017 | } |
---|
| 3018 | // remove bit equal to one |
---|
| 3019 | cnt--; |
---|
[2] | 3020 | |
---|
[56] | 3021 | // we should not have a negative number of bits |
---|
| 3022 | assert (cnt>=0); |
---|
[2] | 3023 | |
---|
[56] | 3024 | // we have more data, if cnt is not zero |
---|
| 3025 | return (cnt>0); |
---|
| 3026 | } |
---|
[2] | 3027 | |
---|
[56] | 3028 | //! \} |
---|
[608] | 3029 | |
---|