HEVC Test Model (HM)  HM-16.18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TDecCAVLC.cpp
Go to the documentation of this file.
1 /* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license.
5 *
6 * Copyright (c) 2010-2017, 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 */
33 
38 #include "TDecCAVLC.h"
39 #include "SEIread.h"
40 #include "TDecSlice.h"
42 #if RExt__DECODER_DEBUG_BIT_STATISTICS
44 #endif
45 #include "TDecConformance.h"
46 
49 
50 #if ENC_DEC_TRACE
51 
52 Void xTraceVPSHeader ()
53 {
54  fprintf( g_hTrace, "=========== Video Parameter Set ===========\n" );
55 }
56 
57 Void xTraceSPSHeader ()
58 {
59  fprintf( g_hTrace, "=========== Sequence Parameter Set ===========\n" );
60 }
61 
62 Void xTracePPSHeader ()
63 {
64  fprintf( g_hTrace, "=========== Picture Parameter Set ===========\n");
65 }
66 
67 Void xTraceSliceHeader ()
68 {
69  fprintf( g_hTrace, "=========== Slice ===========\n");
70 }
71 
72 #endif
73 
74 // ====================================================================================================================
75 // Constructor / destructor / create / destroy
76 // ====================================================================================================================
77 
79 {
80 }
81 
83 {
84 
85 }
86 
87 // ====================================================================================================================
88 // Public member functions
89 // ====================================================================================================================
90 
92 {
93  UInt code;
94  UInt interRPSPred;
95  if (idx > 0)
96  {
97  READ_FLAG(interRPSPred, "inter_ref_pic_set_prediction_flag"); rps->setInterRPSPrediction(interRPSPred);
98  }
99  else
100  {
101  interRPSPred = false;
102  rps->setInterRPSPrediction(false);
103  }
104 
105  if (interRPSPred)
106  {
107  UInt bit;
108  if(idx == sps->getRPSList()->getNumberOfReferencePictureSets())
109  {
110  READ_UVLC(code, "delta_idx_minus1" ); // delta index of the Reference Picture Set used for prediction minus 1
111  }
112  else
113  {
114  code = 0;
115  }
116  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
117  Int rIdx = idx - 1 - code;
118  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
120  Int k = 0, k0 = 0, k1 = 0;
121  READ_CODE(1, bit, "delta_rps_sign"); // delta_RPS_sign
122  READ_UVLC(code, "abs_delta_rps_minus1"); // absolute delta RPS minus 1
123  Int deltaRPS = (1 - 2 * bit) * (code + 1); // delta_RPS
124  for(Int j=0 ; j <= rpsRef->getNumberOfPictures(); j++)
125  {
126  READ_CODE(1, bit, "used_by_curr_pic_flag" ); //first bit is "1" if Idc is 1
127  Int refIdc = bit;
128  if (refIdc == 0)
129  {
130  READ_CODE(1, bit, "use_delta_flag" ); //second bit is "1" if Idc is 2, "0" otherwise.
131  refIdc = bit<<1; //second bit is "1" if refIdc is 2, "0" if refIdc = 0.
132  }
133  if (refIdc == 1 || refIdc == 2)
134  {
135  Int deltaPOC = deltaRPS + ((j < rpsRef->getNumberOfPictures())? rpsRef->getDeltaPOC(j) : 0);
136  rps->setDeltaPOC(k, deltaPOC);
137  rps->setUsed(k, (refIdc == 1));
138 
139  if (deltaPOC < 0)
140  {
141  k0++;
142  }
143  else
144  {
145  k1++;
146  }
147  k++;
148  }
149  rps->setRefIdc(j,refIdc);
150  }
151  rps->setNumRefIdc(rpsRef->getNumberOfPictures()+1);
152  rps->setNumberOfPictures(k);
155  rps->sortDeltaPOC();
156  }
157  else
158  {
159  READ_UVLC(code, "num_negative_pics"); rps->setNumberOfNegativePictures(code);
160  READ_UVLC(code, "num_positive_pics"); rps->setNumberOfPositivePictures(code);
161  Int prev = 0;
162  Int poc;
163  for(Int j=0 ; j < rps->getNumberOfNegativePictures(); j++)
164  {
165  READ_UVLC(code, "delta_poc_s0_minus1");
166  poc = prev-code-1;
167  prev = poc;
168  rps->setDeltaPOC(j,poc);
169  READ_FLAG(code, "used_by_curr_pic_s0_flag"); rps->setUsed(j,code);
170  }
171  prev = 0;
173  {
174  READ_UVLC(code, "delta_poc_s1_minus1");
175  poc = prev+code+1;
176  prev = poc;
177  rps->setDeltaPOC(j,poc);
178  READ_FLAG(code, "used_by_curr_pic_s1_flag"); rps->setUsed(j,code);
179  }
181  }
182 #if PRINT_RPS_INFO
183  rps->printDeltaPOC();
184 #endif
185 }
186 
188 {
189 #if ENC_DEC_TRACE
190  xTracePPSHeader ();
191 #endif
192  UInt uiCode;
193 
194  Int iCode;
195 
196  READ_UVLC_CHK( uiCode, "pps_pic_parameter_set_id", 0, 63);
197  assert(uiCode <= 63);
198  pcPPS->setPPSId (uiCode);
199 
200  READ_UVLC_CHK( uiCode, "pps_seq_parameter_set_id", 0, 15);
201  assert(uiCode <= 15);
202  pcPPS->setSPSId (uiCode);
203 
204  READ_FLAG( uiCode, "dependent_slice_segments_enabled_flag" ); pcPPS->setDependentSliceSegmentsEnabledFlag ( uiCode == 1 );
205 
206  READ_FLAG( uiCode, "output_flag_present_flag" ); pcPPS->setOutputFlagPresentFlag( uiCode==1 );
207 
208  READ_CODE(3, uiCode, "num_extra_slice_header_bits"); pcPPS->setNumExtraSliceHeaderBits(uiCode);
209 
210  READ_FLAG( uiCode, "sign_data_hiding_enabled_flag" ); pcPPS->setSignDataHidingEnabledFlag( uiCode );
211 
212  READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false );
213 
214  READ_UVLC_CHK(uiCode, "num_ref_idx_l0_default_active_minus1", 0, 14);
215  assert(uiCode <= 14);
216  pcPPS->setNumRefIdxL0DefaultActive(uiCode+1);
217 
218  READ_UVLC_CHK(uiCode, "num_ref_idx_l1_default_active_minus1", 0, 14);
219  assert(uiCode <= 14);
220  pcPPS->setNumRefIdxL1DefaultActive(uiCode+1);
221 
222  READ_SVLC_CHK(iCode, "init_qp_minus26", std::numeric_limits<Int>::min(), 25 ); pcPPS->setPicInitQPMinus26(iCode);
223  READ_FLAG( uiCode, "constrained_intra_pred_flag" ); pcPPS->setConstrainedIntraPred( uiCode ? true : false );
224  READ_FLAG( uiCode, "transform_skip_enabled_flag" );
225  pcPPS->setUseTransformSkip ( uiCode ? true : false );
226 
227  READ_FLAG( uiCode, "cu_qp_delta_enabled_flag" ); pcPPS->setUseDQP( uiCode ? true : false );
228  if( pcPPS->getUseDQP() )
229  {
230  READ_UVLC( uiCode, "diff_cu_qp_delta_depth" );
231  pcPPS->setMaxCuDQPDepth( uiCode );
232  }
233  else
234  {
235  pcPPS->setMaxCuDQPDepth( 0 );
236  }
237  READ_SVLC_CHK( iCode, "pps_cb_qp_offset", -12, 12);
238  pcPPS->setQpOffset(COMPONENT_Cb, iCode);
239  assert( pcPPS->getQpOffset(COMPONENT_Cb) >= -12 );
240  assert( pcPPS->getQpOffset(COMPONENT_Cb) <= 12 );
241 
242  READ_SVLC_CHK( iCode, "pps_cr_qp_offset", -12, 12);
243  pcPPS->setQpOffset(COMPONENT_Cr, iCode);
244  assert( pcPPS->getQpOffset(COMPONENT_Cr) >= -12 );
245  assert( pcPPS->getQpOffset(COMPONENT_Cr) <= 12 );
246 
247  assert(MAX_NUM_COMPONENT<=3);
248 
249  READ_FLAG( uiCode, "pps_slice_chroma_qp_offsets_present_flag" );
250  pcPPS->setSliceChromaQpFlag( uiCode ? true : false );
251 
252  READ_FLAG( uiCode, "weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE)
253  pcPPS->setUseWP( uiCode==1 );
254  READ_FLAG( uiCode, "weighted_bipred_flag" ); // Use of Bi-Directional Weighting Prediction (B_SLICE)
255  pcPPS->setWPBiPred( uiCode==1 );
256 
257  READ_FLAG( uiCode, "transquant_bypass_enabled_flag");
258  pcPPS->setTransquantBypassEnabledFlag(uiCode ? true : false);
259  READ_FLAG( uiCode, "tiles_enabled_flag" ); pcPPS->setTilesEnabledFlag ( uiCode == 1 );
260  READ_FLAG( uiCode, "entropy_coding_sync_enabled_flag" ); pcPPS->setEntropyCodingSyncEnabledFlag( uiCode == 1 );
261 
262  if( pcPPS->getTilesEnabledFlag() )
263  {
264  READ_UVLC ( uiCode, "num_tile_columns_minus1" ); pcPPS->setNumTileColumnsMinus1( uiCode );
265  READ_UVLC ( uiCode, "num_tile_rows_minus1" ); pcPPS->setNumTileRowsMinus1( uiCode );
266  READ_FLAG ( uiCode, "uniform_spacing_flag" ); pcPPS->setTileUniformSpacingFlag( uiCode == 1 );
267 
268  const UInt tileColumnsMinus1 = pcPPS->getNumTileColumnsMinus1();
269  const UInt tileRowsMinus1 = pcPPS->getNumTileRowsMinus1();
270 
271  if ( !pcPPS->getTileUniformSpacingFlag())
272  {
273  if (tileColumnsMinus1 > 0)
274  {
275  std::vector<Int> columnWidth(tileColumnsMinus1);
276  for(UInt i = 0; i < tileColumnsMinus1; i++)
277  {
278  READ_UVLC( uiCode, "column_width_minus1" );
279  columnWidth[i] = uiCode+1;
280  }
281  pcPPS->setTileColumnWidth(columnWidth);
282  }
283 
284  if (tileRowsMinus1 > 0)
285  {
286  std::vector<Int> rowHeight (tileRowsMinus1);
287  for(UInt i = 0; i < tileRowsMinus1; i++)
288  {
289  READ_UVLC( uiCode, "row_height_minus1" );
290  rowHeight[i] = uiCode + 1;
291  }
292  pcPPS->setTileRowHeight(rowHeight);
293  }
294  }
295  assert ((tileColumnsMinus1 + tileRowsMinus1) != 0);
296  READ_FLAG ( uiCode, "loop_filter_across_tiles_enabled_flag" ); pcPPS->setLoopFilterAcrossTilesEnabledFlag( uiCode ? true : false );
297  }
298  READ_FLAG( uiCode, "pps_loop_filter_across_slices_enabled_flag" ); pcPPS->setLoopFilterAcrossSlicesEnabledFlag( uiCode ? true : false );
299  READ_FLAG( uiCode, "deblocking_filter_control_present_flag" ); pcPPS->setDeblockingFilterControlPresentFlag( uiCode ? true : false );
301  {
302  READ_FLAG( uiCode, "deblocking_filter_override_enabled_flag" ); pcPPS->setDeblockingFilterOverrideEnabledFlag( uiCode ? true : false );
303  READ_FLAG( uiCode, "pps_deblocking_filter_disabled_flag" ); pcPPS->setPPSDeblockingFilterDisabledFlag(uiCode ? true : false );
305  {
306  READ_SVLC ( iCode, "pps_beta_offset_div2" ); pcPPS->setDeblockingFilterBetaOffsetDiv2( iCode );
307  READ_SVLC ( iCode, "pps_tc_offset_div2" ); pcPPS->setDeblockingFilterTcOffsetDiv2( iCode );
308  }
309  }
310  READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" ); pcPPS->setScalingListPresentFlag( uiCode ? true : false );
311  if(pcPPS->getScalingListPresentFlag ())
312  {
313  parseScalingList( &(pcPPS->getScalingList()) );
314  }
315 
316  READ_FLAG( uiCode, "lists_modification_present_flag");
317  pcPPS->setListsModificationPresentFlag(uiCode);
318 
319  READ_UVLC( uiCode, "log2_parallel_merge_level_minus2");
320  pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode);
321 
322  READ_FLAG( uiCode, "slice_segment_header_extension_present_flag");
323  pcPPS->setSliceHeaderExtensionPresentFlag(uiCode);
324 
325  READ_FLAG( uiCode, "pps_extension_present_flag");
326  if (uiCode)
327  {
328 #if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS
329  static const TChar *syntaxStrings[]={ "pps_range_extension_flag",
330  "pps_multilayer_extension_flag",
331  "pps_extension_6bits[0]",
332  "pps_extension_6bits[1]",
333  "pps_extension_6bits[2]",
334  "pps_extension_6bits[3]",
335  "pps_extension_6bits[4]",
336  "pps_extension_6bits[5]" };
337 #endif
338 
339  Bool pps_extension_flags[NUM_PPS_EXTENSION_FLAGS];
340  for(Int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++)
341  {
342  READ_FLAG( uiCode, syntaxStrings[i] );
343  pps_extension_flags[i] = uiCode!=0;
344  }
345 
346  Bool bSkipTrailingExtensionBits=false;
347  for(Int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++) // loop used so that the order is determined by the enum.
348  {
349  if (pps_extension_flags[i])
350  {
351  switch (PPSExtensionFlagIndex(i))
352  {
353  case PPS_EXT__REXT:
354  {
355  TComPPSRExt &ppsRangeExtension = pcPPS->getPpsRangeExtension();
356  assert(!bSkipTrailingExtensionBits);
357 
358  if (pcPPS->getUseTransformSkip())
359  {
360  READ_UVLC( uiCode, "log2_max_transform_skip_block_size_minus2");
361  ppsRangeExtension.setLog2MaxTransformSkipBlockSize(uiCode+2);
362  }
363 
364  READ_FLAG( uiCode, "cross_component_prediction_enabled_flag");
365  ppsRangeExtension.setCrossComponentPredictionEnabledFlag(uiCode != 0);
366 
367  READ_FLAG( uiCode, "chroma_qp_offset_list_enabled_flag");
368  if (uiCode == 0)
369  {
370  ppsRangeExtension.clearChromaQpOffsetList();
371  ppsRangeExtension.setDiffCuChromaQpOffsetDepth(0);
372  }
373  else
374  {
375  READ_UVLC(uiCode, "diff_cu_chroma_qp_offset_depth"); ppsRangeExtension.setDiffCuChromaQpOffsetDepth(uiCode);
376  UInt tableSizeMinus1 = 0;
377  READ_UVLC_CHK(tableSizeMinus1, "chroma_qp_offset_list_len_minus1", 0, MAX_QP_OFFSET_LIST_SIZE-1);
378  assert(tableSizeMinus1 < MAX_QP_OFFSET_LIST_SIZE);
379 
380  for (Int cuChromaQpOffsetIdx = 0; cuChromaQpOffsetIdx <= (tableSizeMinus1); cuChromaQpOffsetIdx++)
381  {
382  Int cbOffset;
383  Int crOffset;
384  READ_SVLC_CHK(cbOffset, "cb_qp_offset_list[i]", -12, 12);
385  assert(cbOffset >= -12 && cbOffset <= 12);
386  READ_SVLC_CHK(crOffset, "cr_qp_offset_list[i]", -12, 12);
387  assert(crOffset >= -12 && crOffset <= 12);
388  // table uses +1 for index (see comment inside the function)
389  ppsRangeExtension.setChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1, cbOffset, crOffset);
390  }
391  assert(ppsRangeExtension.getChromaQpOffsetListLen() == tableSizeMinus1 + 1);
392  }
393 
394  READ_UVLC( uiCode, "log2_sao_offset_scale_luma");
395  ppsRangeExtension.setLog2SaoOffsetScale(CHANNEL_TYPE_LUMA, uiCode);
396  READ_UVLC( uiCode, "log2_sao_offset_scale_chroma");
397  ppsRangeExtension.setLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA, uiCode);
398  }
399  break;
400  default:
401  bSkipTrailingExtensionBits=true;
402  break;
403  }
404  }
405  }
406  if (bSkipTrailingExtensionBits)
407  {
408  while ( xMoreRbspData() )
409  {
410  READ_FLAG( uiCode, "pps_extension_data_flag");
411  }
412  }
413  }
415 }
416 
418 {
419 #if ENC_DEC_TRACE
420  fprintf( g_hTrace, "----------- vui_parameters -----------\n");
421 #endif
422  UInt uiCode;
423 
424  READ_FLAG( uiCode, "aspect_ratio_info_present_flag"); pcVUI->setAspectRatioInfoPresentFlag(uiCode);
425  if (pcVUI->getAspectRatioInfoPresentFlag())
426  {
427  READ_CODE(8, uiCode, "aspect_ratio_idc"); pcVUI->setAspectRatioIdc(uiCode);
428  if (pcVUI->getAspectRatioIdc() == 255)
429  {
430  READ_CODE(16, uiCode, "sar_width"); pcVUI->setSarWidth(uiCode);
431  READ_CODE(16, uiCode, "sar_height"); pcVUI->setSarHeight(uiCode);
432  }
433  }
434 
435  READ_FLAG( uiCode, "overscan_info_present_flag"); pcVUI->setOverscanInfoPresentFlag(uiCode);
436  if (pcVUI->getOverscanInfoPresentFlag())
437  {
438  READ_FLAG( uiCode, "overscan_appropriate_flag"); pcVUI->setOverscanAppropriateFlag(uiCode);
439  }
440 
441  READ_FLAG( uiCode, "video_signal_type_present_flag"); pcVUI->setVideoSignalTypePresentFlag(uiCode);
442  if (pcVUI->getVideoSignalTypePresentFlag())
443  {
444  READ_CODE(3, uiCode, "video_format"); pcVUI->setVideoFormat(uiCode);
445  READ_FLAG( uiCode, "video_full_range_flag"); pcVUI->setVideoFullRangeFlag(uiCode);
446  READ_FLAG( uiCode, "colour_description_present_flag"); pcVUI->setColourDescriptionPresentFlag(uiCode);
447  if (pcVUI->getColourDescriptionPresentFlag())
448  {
449  READ_CODE(8, uiCode, "colour_primaries"); pcVUI->setColourPrimaries(uiCode);
450  READ_CODE(8, uiCode, "transfer_characteristics"); pcVUI->setTransferCharacteristics(uiCode);
451  READ_CODE(8, uiCode, "matrix_coeffs"); pcVUI->setMatrixCoefficients(uiCode);
452  }
453  }
454 
455  READ_FLAG( uiCode, "chroma_loc_info_present_flag"); pcVUI->setChromaLocInfoPresentFlag(uiCode);
456  if (pcVUI->getChromaLocInfoPresentFlag())
457  {
458  READ_UVLC( uiCode, "chroma_sample_loc_type_top_field" ); pcVUI->setChromaSampleLocTypeTopField(uiCode);
459  READ_UVLC( uiCode, "chroma_sample_loc_type_bottom_field" ); pcVUI->setChromaSampleLocTypeBottomField(uiCode);
460  }
461 
462  READ_FLAG( uiCode, "neutral_chroma_indication_flag"); pcVUI->setNeutralChromaIndicationFlag(uiCode);
463 
464  READ_FLAG( uiCode, "field_seq_flag"); pcVUI->setFieldSeqFlag(uiCode);
465 
466  READ_FLAG(uiCode, "frame_field_info_present_flag"); pcVUI->setFrameFieldInfoPresentFlag(uiCode);
467 
468  READ_FLAG( uiCode, "default_display_window_flag");
469  if (uiCode != 0)
470  {
471  Window &defDisp = pcVUI->getDefaultDisplayWindow();
472  READ_UVLC( uiCode, "def_disp_win_left_offset" ); defDisp.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) );
473  READ_UVLC( uiCode, "def_disp_win_right_offset" ); defDisp.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) );
474  READ_UVLC( uiCode, "def_disp_win_top_offset" ); defDisp.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) );
475  READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) );
476  }
477 
478  TimingInfo *timingInfo = pcVUI->getTimingInfo();
479  READ_FLAG( uiCode, "vui_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false);
480  if(timingInfo->getTimingInfoPresentFlag())
481  {
482  READ_CODE( 32, uiCode, "vui_num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode);
483  READ_CODE( 32, uiCode, "vui_time_scale"); timingInfo->setTimeScale (uiCode);
484  READ_FLAG( uiCode, "vui_poc_proportional_to_timing_flag"); timingInfo->setPocProportionalToTimingFlag(uiCode ? true : false);
485  if(timingInfo->getPocProportionalToTimingFlag())
486  {
487  READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode);
488  }
489 
490  READ_FLAG( uiCode, "vui_hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode);
491  if( pcVUI->getHrdParametersPresentFlag() )
492  {
493  parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 );
494  }
495  }
496 
497  READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode);
498  if (pcVUI->getBitstreamRestrictionFlag())
499  {
500  READ_FLAG( uiCode, "tiles_fixed_structure_flag"); pcVUI->setTilesFixedStructureFlag(uiCode);
501  READ_FLAG( uiCode, "motion_vectors_over_pic_boundaries_flag"); pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode);
502  READ_FLAG( uiCode, "restricted_ref_pic_lists_flag"); pcVUI->setRestrictedRefPicListsFlag(uiCode);
503  READ_UVLC( uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode);
504  assert(uiCode < 4096);
505  READ_UVLC( uiCode, "max_bytes_per_pic_denom" ); pcVUI->setMaxBytesPerPicDenom(uiCode);
506  READ_UVLC( uiCode, "max_bits_per_min_cu_denom" ); pcVUI->setMaxBitsPerMinCuDenom(uiCode);
507  READ_UVLC( uiCode, "log2_max_mv_length_horizontal" ); pcVUI->setLog2MaxMvLengthHorizontal(uiCode);
508  READ_UVLC( uiCode, "log2_max_mv_length_vertical" ); pcVUI->setLog2MaxMvLengthVertical(uiCode);
509  }
510 }
511 
512 Void TDecCavlc::parseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1)
513 {
514  UInt uiCode;
515  if( commonInfPresentFlag )
516  {
517  READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false );
518  READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false );
520  {
521  READ_FLAG( uiCode, "sub_pic_hrd_params_present_flag" ); hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false );
522  if( hrd->getSubPicCpbParamsPresentFlag() )
523  {
524  READ_CODE( 8, uiCode, "tick_divisor_minus2" ); hrd->setTickDivisorMinus2( uiCode );
525  READ_CODE( 5, uiCode, "du_cpb_removal_delay_increment_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode );
526  READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false );
527  READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1" ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode );
528  }
529  READ_CODE( 4, uiCode, "bit_rate_scale" ); hrd->setBitRateScale( uiCode );
530  READ_CODE( 4, uiCode, "cpb_size_scale" ); hrd->setCpbSizeScale( uiCode );
531  if( hrd->getSubPicCpbParamsPresentFlag() )
532  {
533  READ_CODE( 4, uiCode, "cpb_size_du_scale" ); hrd->setDuCpbSizeScale( uiCode );
534  }
535  READ_CODE( 5, uiCode, "initial_cpb_removal_delay_length_minus1" ); hrd->setInitialCpbRemovalDelayLengthMinus1( uiCode );
536  READ_CODE( 5, uiCode, "au_cpb_removal_delay_length_minus1" ); hrd->setCpbRemovalDelayLengthMinus1( uiCode );
537  READ_CODE( 5, uiCode, "dpb_output_delay_length_minus1" ); hrd->setDpbOutputDelayLengthMinus1( uiCode );
538  }
539  }
540  Int i, j, nalOrVcl;
541  for( i = 0; i <= maxNumSubLayersMinus1; i ++ )
542  {
543  READ_FLAG( uiCode, "fixed_pic_rate_general_flag" ); hrd->setFixedPicRateFlag( i, uiCode == 1 ? true : false );
544  if( !hrd->getFixedPicRateFlag( i ) )
545  {
546  READ_FLAG( uiCode, "fixed_pic_rate_within_cvs_flag" ); hrd->setFixedPicRateWithinCvsFlag( i, uiCode == 1 ? true : false );
547  }
548  else
549  {
550  hrd->setFixedPicRateWithinCvsFlag( i, true );
551  }
552 
553  hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present
554  hrd->setCpbCntMinus1 ( i, 0 ); // Infered to be 0 when not present
555 
556  if( hrd->getFixedPicRateWithinCvsFlag( i ) )
557  {
558  READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" ); hrd->setPicDurationInTcMinus1( i, uiCode );
559  }
560  else
561  {
562  READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false );
563  }
564  if (!hrd->getLowDelayHrdFlag( i ))
565  {
566  READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode );
567  }
568 
569  for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
570  {
571  if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) ||
572  ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) )
573  {
574  for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ )
575  {
576  READ_UVLC( uiCode, "bit_rate_value_minus1" ); hrd->setBitRateValueMinus1( i, j, nalOrVcl, uiCode );
577  READ_UVLC( uiCode, "cpb_size_value_minus1" ); hrd->setCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );
578  if( hrd->getSubPicCpbParamsPresentFlag() )
579  {
580  READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );
581  READ_UVLC( uiCode, "bit_rate_du_value_minus1" ); hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode );
582  }
583  READ_FLAG( uiCode, "cbr_flag" ); hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false );
584  }
585  }
586  }
587  }
588 }
589 
591 {
592 #if ENC_DEC_TRACE
593  xTraceSPSHeader ();
594 #endif
595 
596  UInt uiCode;
597  READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode );
598  READ_CODE_CHK( 3, uiCode, "sps_max_sub_layers_minus1", 0, 6 ); pcSPS->setMaxTLayers ( uiCode+1 );
599  assert(uiCode <= 6);
600 
601  READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false );
602  if ( pcSPS->getMaxTLayers() == 1 )
603  {
604  // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0
605  TDecConformanceCheck::checkRange(uiCode, "sps_temporal_id_nesting_flag", 1U, 1U);
606  assert( uiCode == 1 );
607  }
608 
609  parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1);
610  READ_UVLC_CHK( uiCode, "sps_seq_parameter_set_id", 0, 15 ); pcSPS->setSPSId( uiCode );
611  assert(uiCode <= 15);
612 
613  READ_UVLC_CHK( uiCode, "chroma_format_idc", 0, 3 ); pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) );
614  assert(uiCode <= 3);
615 
616  if( pcSPS->getChromaFormatIdc() == CHROMA_444 )
617  {
618  READ_FLAG_CHK( uiCode, "separate_colour_plane_flag", 0, 0);
619  assert(uiCode == 0);
620  }
621 
622  // pic_width_in_luma_samples and pic_height_in_luma_samples needs conformance checking - multiples of MinCbSizeY
623  READ_UVLC_CHK ( uiCode, "pic_width_in_luma_samples", 1, std::numeric_limits<UInt>::max() ); pcSPS->setPicWidthInLumaSamples ( uiCode );
624  READ_UVLC_CHK ( uiCode, "pic_height_in_luma_samples", 1, std::numeric_limits<UInt>::max() ); pcSPS->setPicHeightInLumaSamples( uiCode );
625  READ_FLAG( uiCode, "conformance_window_flag");
626  if (uiCode != 0)
627  {
628  Window &conf = pcSPS->getConformanceWindow();
629  const UInt subWidthC = TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() );
630  const UInt subHeightC = TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() );
631  READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode * subWidthC );
632  READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode * subWidthC );
633  READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode * subHeightC );
634  READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode * subHeightC );
635  TDecConformanceCheck::checkRange<UInt>(conf.getWindowLeftOffset()+conf.getWindowRightOffset(), "conformance window width in pixels", 0, pcSPS->getPicWidthInLumaSamples()-1);
636  }
637 
638  READ_UVLC_CHK( uiCode, "bit_depth_luma_minus8", 0, 8 );
639  assert(uiCode <= 8);
640 #if O0043_BEST_EFFORT_DECODING
641  pcSPS->setStreamBitDepth(CHANNEL_TYPE_LUMA, 8 + uiCode);
642  const UInt forceDecodeBitDepth = pcSPS->getForceDecodeBitDepth();
643  if (forceDecodeBitDepth != 0)
644  {
645  uiCode = forceDecodeBitDepth - 8;
646  }
647  assert(uiCode <= 8);
648 #endif
649  pcSPS->setBitDepth(CHANNEL_TYPE_LUMA, 8 + uiCode);
650 
651 #if O0043_BEST_EFFORT_DECODING
652  pcSPS->setQpBDOffset(CHANNEL_TYPE_LUMA, (Int) (6*(pcSPS->getStreamBitDepth(CHANNEL_TYPE_LUMA)-8)) );
653 #else
654  pcSPS->setQpBDOffset(CHANNEL_TYPE_LUMA, (Int) (6*uiCode) );
655 #endif
656 
657  READ_UVLC_CHK( uiCode, "bit_depth_chroma_minus8", 0, 8 );
658  assert(uiCode <= 8);
659 #if O0043_BEST_EFFORT_DECODING
660  pcSPS->setStreamBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode);
661  if (forceDecodeBitDepth != 0)
662  {
663  uiCode = forceDecodeBitDepth - 8;
664  }
665  assert(uiCode <= 8);
666 #endif
667  pcSPS->setBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode);
668 #if O0043_BEST_EFFORT_DECODING
669  pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (Int) (6*(pcSPS->getStreamBitDepth(CHANNEL_TYPE_CHROMA)-8)) );
670 #else
671  pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (Int) (6*uiCode) );
672 #endif
673 
674  READ_UVLC_CHK( uiCode, "log2_max_pic_order_cnt_lsb_minus4", 0, 12 ); pcSPS->setBitsForPOC( 4 + uiCode );
675 
676  UInt subLayerOrderingInfoPresentFlag;
677  READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag");
678 
679  for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
680  {
681  READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]");
682  pcSPS->setMaxDecPicBuffering( uiCode + 1, i);
683  READ_UVLC ( uiCode, "sps_max_num_reorder_pics[i]" );
684  pcSPS->setNumReorderPics(uiCode, i);
685  READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]");
686  pcSPS->setMaxLatencyIncreasePlus1( uiCode, i );
687 
688  if (!subLayerOrderingInfoPresentFlag)
689  {
690  for (i++; i <= pcSPS->getMaxTLayers()-1; i++)
691  {
692  pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i);
693  pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i);
695  }
696  break;
697  }
698  }
699 
700  const UInt maxLog2CtbSize = TDecConformanceCheck::getMaxLog2CtbSize(*(pcSPS->getPTL()));
701  const UInt minLog2CtbSize = TDecConformanceCheck::getMinLog2CtbSize(*(pcSPS->getPTL()));
702  READ_UVLC_CHK( uiCode, "log2_min_luma_coding_block_size_minus3", 0, maxLog2CtbSize-3 );
703  assert(uiCode <= maxLog2CtbSize-3);
704  Int minCbLog2SizeY = uiCode + 3;
705  pcSPS->setLog2MinCodingBlockSize(minCbLog2SizeY);
706 
707  // Difference + log2MinCUSize must be <= maxLog2CtbSize
708  // Difference + log2MinCUSize must be >= minLog2CtbSize
709  const UInt minLog2DiffMaxMinLumaCodingBlockSize = minLog2CtbSize < minCbLog2SizeY ? 0 : minLog2CtbSize - minCbLog2SizeY;
710  const UInt maxLog2DiffMaxMinLumaCodingBlockSize = maxLog2CtbSize - minCbLog2SizeY;
711 
712  READ_UVLC_CHK( uiCode, "log2_diff_max_min_luma_coding_block_size", minLog2DiffMaxMinLumaCodingBlockSize, maxLog2DiffMaxMinLumaCodingBlockSize);
713  assert(uiCode >= minLog2DiffMaxMinLumaCodingBlockSize && uiCode <= maxLog2DiffMaxMinLumaCodingBlockSize);
714  pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode);
715 
716  const Int maxCUDepthDelta = uiCode;
717  const Int ctbLog2SizeY = minCbLog2SizeY + maxCUDepthDelta;
718  pcSPS->setMaxCUWidth ( 1<<ctbLog2SizeY );
719  pcSPS->setMaxCUHeight ( 1<<ctbLog2SizeY );
720  READ_UVLC_CHK( uiCode, "log2_min_luma_transform_block_size_minus2", 0, minCbLog2SizeY-1-2 );
721  const UInt minTbLog2SizeY = uiCode + 2;
722  pcSPS->setQuadtreeTULog2MinSize( minTbLog2SizeY );
723 
724  // log2_diff <= Min(CtbLog2SizeY, 5) - minTbLog2SizeY
725  READ_UVLC_CHK( uiCode, "log2_diff_max_min_luma_transform_block_size", 0, min<UInt>(5U, ctbLog2SizeY) - minTbLog2SizeY );
726  pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() );
727  pcSPS->setMaxTrSize( 1<<(uiCode + pcSPS->getQuadtreeTULog2MinSize()) );
728 
729  READ_UVLC_CHK( uiCode, "max_transform_hierarchy_depth_inter", 0, ctbLog2SizeY - minTbLog2SizeY); pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 );
730  READ_UVLC_CHK( uiCode, "max_transform_hierarchy_depth_intra", 0, ctbLog2SizeY - minTbLog2SizeY); pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 );
731 
732  Int addCuDepth = max (0, minCbLog2SizeY - (Int)pcSPS->getQuadtreeTULog2MinSize() );
733  pcSPS->setMaxTotalCUDepth( maxCUDepthDelta + addCuDepth + getMaxCUDepthOffset(pcSPS->getChromaFormatIdc(), pcSPS->getQuadtreeTULog2MinSize()) );
734 
735  READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode );
736  if(pcSPS->getScalingListFlag())
737  {
738  READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode );
739  if(pcSPS->getScalingListPresentFlag ())
740  {
741  parseScalingList( &(pcSPS->getScalingList()) );
742  }
743  }
744  READ_FLAG( uiCode, "amp_enabled_flag" ); pcSPS->setUseAMP( uiCode );
745  READ_FLAG( uiCode, "sample_adaptive_offset_enabled_flag" ); pcSPS->setUseSAO ( uiCode ? true : false );
746 
747  READ_FLAG( uiCode, "pcm_enabled_flag" ); pcSPS->setUsePCM( uiCode ? true : false );
748  if( pcSPS->getUsePCM() )
749  {
750 #if O0043_BEST_EFFORT_DECODING
751  READ_CODE_CHK( 4, uiCode, "pcm_sample_bit_depth_luma_minus1", 0, pcSPS->getStreamBitDepth(CHANNEL_TYPE_LUMA) ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_LUMA, 1 + uiCode );
752  READ_CODE_CHK( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1", 0, pcSPS->getStreamBitDepth(CHANNEL_TYPE_LUMA) ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_CHROMA, 1 + uiCode );
753 #else
754  READ_CODE_CHK( 4, uiCode, "pcm_sample_bit_depth_luma_minus1", 0, pcSPS->getBitDepth(CHANNEL_TYPE_LUMA) ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_LUMA, 1 + uiCode );
755  READ_CODE_CHK( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1", 0, pcSPS->getBitDepth(CHANNEL_TYPE_CHROMA) ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_CHROMA, 1 + uiCode );
756 #endif
757  READ_UVLC_CHK( uiCode, "log2_min_pcm_luma_coding_block_size_minus3", std::min<UInt>(minCbLog2SizeY, 5 )-3, std::min<UInt>(ctbLog2SizeY, 5)-3);
758  const UInt log2MinIpcmCbSizeY = uiCode+3;
759  pcSPS->setPCMLog2MinSize (log2MinIpcmCbSizeY);
760  READ_UVLC_CHK( uiCode, "log2_diff_max_min_pcm_luma_coding_block_size", 0, (std::min<UInt>(ctbLog2SizeY,5) - log2MinIpcmCbSizeY) );
761  pcSPS->setPCMLog2MaxSize ( uiCode+pcSPS->getPCMLog2MinSize() );
762  READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" ); pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false );
763  }
764 
765  READ_UVLC_CHK( uiCode, "num_short_term_ref_pic_sets", 0, 64 );
766  assert(uiCode <= 64);
767  pcSPS->createRPSList(uiCode);
768 
769  TComRPSList* rpsList = pcSPS->getRPSList();
771 
772  for(UInt i=0; i< rpsList->getNumberOfReferencePictureSets(); i++)
773  {
774  rps = rpsList->getReferencePictureSet(i);
775  parseShortTermRefPicSet(pcSPS,rps,i);
776  }
777  READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefsPresent(uiCode);
778  if (pcSPS->getLongTermRefsPresent())
779  {
780  READ_UVLC_CHK( uiCode, "num_long_term_ref_pics_sps", 0, 32 );
781  pcSPS->setNumLongTermRefPicSPS(uiCode);
782  for (UInt k = 0; k < pcSPS->getNumLongTermRefPicSPS(); k++)
783  {
784  READ_CODE( pcSPS->getBitsForPOC(), uiCode, "lt_ref_pic_poc_lsb_sps" );
785  pcSPS->setLtRefPicPocLsbSps(k, uiCode);
786  READ_FLAG( uiCode, "used_by_curr_pic_lt_sps_flag[i]");
787  pcSPS->setUsedByCurrPicLtSPSFlag(k, uiCode?1:0);
788  }
789  }
790  READ_FLAG( uiCode, "sps_temporal_mvp_enabled_flag" ); pcSPS->setSPSTemporalMVPEnabledFlag(uiCode);
791 
792  READ_FLAG( uiCode, "strong_intra_smoothing_enable_flag" ); pcSPS->setUseStrongIntraSmoothing(uiCode);
793 
794  READ_FLAG( uiCode, "vui_parameters_present_flag" ); pcSPS->setVuiParametersPresentFlag(uiCode);
795 
796  if (pcSPS->getVuiParametersPresentFlag())
797  {
798  parseVUI(pcSPS->getVuiParameters(), pcSPS);
799  }
800 
801  READ_FLAG( uiCode, "sps_extension_present_flag");
802  if (uiCode)
803  {
804 #if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS
805  static const TChar *syntaxStrings[]={ "sps_range_extension_flag",
806  "sps_multilayer_extension_flag",
807  "sps_extension_6bits[0]",
808  "sps_extension_6bits[1]",
809  "sps_extension_6bits[2]",
810  "sps_extension_6bits[3]",
811  "sps_extension_6bits[4]",
812  "sps_extension_6bits[5]" };
813 #endif
814  Bool sps_extension_flags[NUM_SPS_EXTENSION_FLAGS];
815 
816  for(Int i=0; i<NUM_SPS_EXTENSION_FLAGS; i++)
817  {
818  READ_FLAG( uiCode, syntaxStrings[i] );
819  sps_extension_flags[i] = uiCode!=0;
820  }
821 
822  Bool bSkipTrailingExtensionBits=false;
823  for(Int i=0; i<NUM_SPS_EXTENSION_FLAGS; i++) // loop used so that the order is determined by the enum.
824  {
825  if (sps_extension_flags[i])
826  {
827  switch (SPSExtensionFlagIndex(i))
828  {
829  case SPS_EXT__REXT:
830  assert(!bSkipTrailingExtensionBits);
831  {
832  TComSPSRExt &spsRangeExtension = pcSPS->getSpsRangeExtension();
833  READ_FLAG( uiCode, "transform_skip_rotation_enabled_flag"); spsRangeExtension.setTransformSkipRotationEnabledFlag(uiCode != 0);
834  READ_FLAG( uiCode, "transform_skip_context_enabled_flag"); spsRangeExtension.setTransformSkipContextEnabledFlag (uiCode != 0);
835  READ_FLAG( uiCode, "implicit_rdpcm_enabled_flag"); spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_IMPLICIT, (uiCode != 0));
836  READ_FLAG( uiCode, "explicit_rdpcm_enabled_flag"); spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_EXPLICIT, (uiCode != 0));
837  READ_FLAG( uiCode, "extended_precision_processing_flag"); spsRangeExtension.setExtendedPrecisionProcessingFlag (uiCode != 0);
838  READ_FLAG( uiCode, "intra_smoothing_disabled_flag"); spsRangeExtension.setIntraSmoothingDisabledFlag (uiCode != 0);
839  READ_FLAG( uiCode, "high_precision_offsets_enabled_flag"); spsRangeExtension.setHighPrecisionOffsetsEnabledFlag (uiCode != 0);
840  READ_FLAG( uiCode, "persistent_rice_adaptation_enabled_flag"); spsRangeExtension.setPersistentRiceAdaptationEnabledFlag (uiCode != 0);
841  READ_FLAG( uiCode, "cabac_bypass_alignment_enabled_flag"); spsRangeExtension.setCabacBypassAlignmentEnabledFlag (uiCode != 0);
842  }
843  break;
844  default:
845  bSkipTrailingExtensionBits=true;
846  break;
847  }
848  }
849  }
850  if (bSkipTrailingExtensionBits)
851  {
852  while ( xMoreRbspData() )
853  {
854  READ_FLAG( uiCode, "sps_extension_data_flag");
855  }
856  }
857  }
858 
860 }
861 
863 {
864 #if ENC_DEC_TRACE
865  xTraceVPSHeader ();
866 #endif
867  UInt uiCode;
868 
869  READ_CODE( 4, uiCode, "vps_video_parameter_set_id" ); pcVPS->setVPSId( uiCode );
870  READ_FLAG( uiCode, "vps_base_layer_internal_flag" ); assert(uiCode == 1);
871  READ_FLAG( uiCode, "vps_base_layer_available_flag" ); assert(uiCode == 1);
872  READ_CODE( 6, uiCode, "vps_max_layers_minus1" );
873  READ_CODE( 3, uiCode, "vps_max_sub_layers_minus1" ); pcVPS->setMaxTLayers( uiCode + 1 ); assert(uiCode+1 <= MAX_TLAYER);
874  READ_FLAG( uiCode, "vps_temporal_id_nesting_flag" ); pcVPS->setTemporalNestingFlag( uiCode ? true:false );
875  assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag());
876  READ_CODE( 16, uiCode, "vps_reserved_0xffff_16bits" ); assert(uiCode == 0xffff);
877  parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1);
878  UInt subLayerOrderingInfoPresentFlag;
879  READ_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag");
880  for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++)
881  {
882  READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i );
883  READ_UVLC( uiCode, "vps_max_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i );
884  READ_UVLC( uiCode, "vps_max_latency_increase_plus1[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i );
885 
886  if (!subLayerOrderingInfoPresentFlag)
887  {
888  for (i++; i <= pcVPS->getMaxTLayers()-1; i++)
889  {
890  pcVPS->setMaxDecPicBuffering(pcVPS->getMaxDecPicBuffering(0), i);
891  pcVPS->setNumReorderPics(pcVPS->getNumReorderPics(0), i);
892  pcVPS->setMaxLatencyIncrease(pcVPS->getMaxLatencyIncrease(0), i);
893  }
894  break;
895  }
896  }
897 
898  assert( pcVPS->getNumHrdParameters() < MAX_VPS_OP_SETS_PLUS1 );
900  READ_CODE( 6, uiCode, "vps_max_layer_id" ); pcVPS->setMaxNuhReservedZeroLayerId( uiCode );
901  READ_UVLC( uiCode, "vps_num_layer_sets_minus1" ); pcVPS->setMaxOpSets( uiCode + 1 );
902  for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getMaxOpSets() - 1 ); opsIdx ++ )
903  {
904  // Operation point set
905  for( UInt i = 0; i <= pcVPS->getMaxNuhReservedZeroLayerId(); i ++ )
906  {
907  READ_FLAG( uiCode, "layer_id_included_flag[opsIdx][i]" ); pcVPS->setLayerIdIncludedFlag( uiCode == 1 ? true : false, opsIdx, i );
908  }
909  }
910 
911  TimingInfo *timingInfo = pcVPS->getTimingInfo();
912  READ_FLAG( uiCode, "vps_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false);
913  if(timingInfo->getTimingInfoPresentFlag())
914  {
915  READ_CODE( 32, uiCode, "vps_num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode);
916  READ_CODE( 32, uiCode, "vps_time_scale"); timingInfo->setTimeScale (uiCode);
917  READ_FLAG( uiCode, "vps_poc_proportional_to_timing_flag"); timingInfo->setPocProportionalToTimingFlag(uiCode ? true : false);
918  if(timingInfo->getPocProportionalToTimingFlag())
919  {
920  READ_UVLC( uiCode, "vps_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode);
921  }
922 
923  READ_UVLC( uiCode, "vps_num_hrd_parameters" ); pcVPS->setNumHrdParameters( uiCode );
924 
925  if( pcVPS->getNumHrdParameters() > 0 )
926  {
927  pcVPS->createHrdParamBuffer();
928  }
929  for( UInt i = 0; i < pcVPS->getNumHrdParameters(); i ++ )
930  {
931  READ_UVLC( uiCode, "hrd_layer_set_idx[i]" ); pcVPS->setHrdOpSetIdx( uiCode, i );
932  if( i > 0 )
933  {
934  READ_FLAG( uiCode, "cprms_present_flag[i]" ); pcVPS->setCprmsPresentFlag( uiCode == 1 ? true : false, i );
935  }
936  else
937  {
938  pcVPS->setCprmsPresentFlag( true, i );
939  }
940 
941  parseHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1);
942  }
943  }
944 
945  READ_FLAG( uiCode, "vps_extension_flag" );
946  if (uiCode)
947  {
948  while ( xMoreRbspData() )
949  {
950  READ_FLAG( uiCode, "vps_extension_data_flag");
951  }
952  }
953 
955 }
956 
957 Void TDecCavlc::parseSliceHeader (TComSlice* pcSlice, ParameterSetManager *parameterSetManager, const Int prevTid0POC)
958 {
959  UInt uiCode;
960  Int iCode;
961 
962 #if ENC_DEC_TRACE
963  xTraceSliceHeader();
964 #endif
965  TComPPS* pps = NULL;
966  TComSPS* sps = NULL;
967 
968  UInt firstSliceSegmentInPic;
969  READ_FLAG( firstSliceSegmentInPic, "first_slice_segment_in_pic_flag" );
970  if( pcSlice->getRapPicFlag())
971  {
972  READ_FLAG( uiCode, "no_output_of_prior_pics_flag" ); //ignored -- updated already
973  pcSlice->setNoOutputPriorPicsFlag(uiCode ? true : false);
974  }
975  READ_UVLC ( uiCode, "slice_pic_parameter_set_id" ); pcSlice->setPPSId(uiCode);
976  pps = parameterSetManager->getPPS(uiCode);
978  assert(pps!=0);
979  sps = parameterSetManager->getSPS(pps->getSPSId());
981  assert(sps!=0);
982 
983  const ChromaFormat chFmt = sps->getChromaFormatIdc();
984  const UInt numValidComp=getNumberValidComponents(chFmt);
985  const Bool bChroma=(chFmt!=CHROMA_400);
986 
987  if( pps->getDependentSliceSegmentsEnabledFlag() && ( !firstSliceSegmentInPic ))
988  {
989  READ_FLAG( uiCode, "dependent_slice_segment_flag" ); pcSlice->setDependentSliceSegmentFlag(uiCode ? true : false);
990  }
991  else
992  {
993  pcSlice->setDependentSliceSegmentFlag(false);
994  }
995  Int numCTUs = ((sps->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((sps->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight());
996  UInt sliceSegmentAddress = 0;
997  Int bitsSliceSegmentAddress = 0;
998  while(numCTUs>(1<<bitsSliceSegmentAddress))
999  {
1000  bitsSliceSegmentAddress++;
1001  }
1002 
1003  if(!firstSliceSegmentInPic)
1004  {
1005  READ_CODE( bitsSliceSegmentAddress, sliceSegmentAddress, "slice_segment_address" );
1006  }
1007  //set uiCode to equal slice start address (or dependent slice start address)
1008  pcSlice->setSliceSegmentCurStartCtuTsAddr( sliceSegmentAddress );// this is actually a Raster-Scan (RS) address, but we do not have the RS->TS conversion table defined yet.
1009  pcSlice->setSliceSegmentCurEndCtuTsAddr(numCTUs); // Set end as the last CTU of the picture.
1010 
1011  if (!pcSlice->getDependentSliceSegmentFlag())
1012  {
1013  pcSlice->setSliceCurStartCtuTsAddr(sliceSegmentAddress); // this is actually a Raster-Scan (RS) address, but we do not have the RS->TS conversion table defined yet.
1014  pcSlice->setSliceCurEndCtuTsAddr(numCTUs);
1015  }
1016 
1017  if(!pcSlice->getDependentSliceSegmentFlag())
1018  {
1019  for (Int i = 0; i < pps->getNumExtraSliceHeaderBits(); i++)
1020  {
1021  READ_FLAG(uiCode, "slice_reserved_flag[]"); // ignored
1022  }
1023 
1024  READ_UVLC ( uiCode, "slice_type" ); pcSlice->setSliceType((SliceType)uiCode);
1025  if( pps->getOutputFlagPresentFlag() )
1026  {
1027  READ_FLAG( uiCode, "pic_output_flag" ); pcSlice->setPicOutputFlag( uiCode ? true : false );
1028  }
1029  else
1030  {
1031  pcSlice->setPicOutputFlag( true );
1032  }
1033 
1034  // if (separate_colour_plane_flag == 1)
1035  // read colour_plane_id
1036  // (separate_colour_plane_flag == 1) is not supported in this version of the standard.
1037 
1038  if( pcSlice->getIdrPicFlag() )
1039  {
1040  pcSlice->setPOC(0);
1041  TComReferencePictureSet* rps = pcSlice->getLocalRPS();
1042  (*rps)=TComReferencePictureSet();
1043  pcSlice->setRPS(rps);
1044  }
1045  else
1046  {
1047  READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb");
1048  Int iPOClsb = uiCode;
1049  Int iPrevPOC = prevTid0POC;
1050  Int iMaxPOClsb = 1<< sps->getBitsForPOC();
1051  Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1);
1052  Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb;
1053  Int iPOCmsb;
1054  if( ( iPOClsb < iPrevPOClsb ) && ( ( iPrevPOClsb - iPOClsb ) >= ( iMaxPOClsb / 2 ) ) )
1055  {
1056  iPOCmsb = iPrevPOCmsb + iMaxPOClsb;
1057  }
1058  else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) )
1059  {
1060  iPOCmsb = iPrevPOCmsb - iMaxPOClsb;
1061  }
1062  else
1063  {
1064  iPOCmsb = iPrevPOCmsb;
1065  }
1069  {
1070  // For BLA picture types, POCmsb is set to 0.
1071  iPOCmsb = 0;
1072  }
1073  pcSlice->setPOC (iPOCmsb+iPOClsb);
1074 
1076  rps = pcSlice->getLocalRPS();
1077  (*rps)=TComReferencePictureSet();
1078 
1079  pcSlice->setRPS(rps);
1080  READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" );
1081  if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header
1082  {
1084  }
1085  else // use reference to short-term reference picture set in PPS
1086  {
1087  Int numBits = 0;
1088  while ((1 << numBits) < sps->getRPSList()->getNumberOfReferencePictureSets())
1089  {
1090  numBits++;
1091  }
1092  if (numBits > 0)
1093  {
1094  READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx");
1095  }
1096  else
1097  {
1098  uiCode = 0;
1099 
1100  }
1101  *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode));
1102  }
1103  if(sps->getLongTermRefsPresent())
1104  {
1106  UInt numOfLtrp = 0;
1107  UInt numLtrpInSPS = 0;
1108  if (sps->getNumLongTermRefPicSPS() > 0)
1109  {
1110  READ_UVLC( uiCode, "num_long_term_sps");
1111  numLtrpInSPS = uiCode;
1112  numOfLtrp += numLtrpInSPS;
1113  rps->setNumberOfLongtermPictures(numOfLtrp);
1114  }
1115  Int bitsForLtrpInSPS = 0;
1116  while (sps->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS))
1117  {
1118  bitsForLtrpInSPS++;
1119  }
1120  READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode);
1121  numOfLtrp += uiCode;
1122  rps->setNumberOfLongtermPictures(numOfLtrp);
1123  Int maxPicOrderCntLSB = 1 << sps->getBitsForPOC();
1124  Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0;
1125  for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++)
1126  {
1127  Int pocLsbLt;
1128  if (k < numLtrpInSPS)
1129  {
1130  uiCode = 0;
1131  if (bitsForLtrpInSPS > 0)
1132  {
1133  READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]");
1134  }
1135  Bool usedByCurrFromSPS=sps->getUsedByCurrPicLtSPSFlag(uiCode);
1136 
1137  pocLsbLt = sps->getLtRefPicPocLsbSps(uiCode);
1138  rps->setUsed(j,usedByCurrFromSPS);
1139  }
1140  else
1141  {
1142  READ_CODE(sps->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode;
1143  READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode);
1144  }
1145  READ_FLAG(uiCode,"delta_poc_msb_present_flag");
1146  Bool mSBPresentFlag = uiCode ? true : false;
1147  if(mSBPresentFlag)
1148  {
1149  READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" );
1150  Bool deltaFlag = false;
1151  // First LTRP || First LTRP from SH
1152  if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) )
1153  {
1154  deltaFlag = true;
1155  }
1156  if(deltaFlag)
1157  {
1158  deltaPocMSBCycleLT = uiCode;
1159  }
1160  else
1161  {
1162  deltaPocMSBCycleLT = uiCode + prevDeltaMSB;
1163  }
1164 
1165  Int pocLTCurr = pcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB
1166  - iPOClsb + pocLsbLt;
1167  rps->setPOC (j, pocLTCurr);
1168  rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLTCurr);
1169  rps->setCheckLTMSBPresent(j,true);
1170  }
1171  else
1172  {
1173  rps->setPOC (j, pocLsbLt);
1174  rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLsbLt);
1175  rps->setCheckLTMSBPresent(j,false);
1176 
1177  // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present
1178  if( j == offset+(numOfLtrp-numLtrpInSPS)-1 )
1179  {
1180  deltaPocMSBCycleLT = 0;
1181  }
1182  }
1183  prevDeltaMSB = deltaPocMSBCycleLT;
1184  }
1185  offset += rps->getNumberOfLongtermPictures();
1186  rps->setNumberOfPictures(offset);
1187  }
1191  {
1192  // In the case of BLA picture types, rps data is read from slice header but ignored
1193  rps = pcSlice->getLocalRPS();
1194  (*rps)=TComReferencePictureSet();
1195  pcSlice->setRPS(rps);
1196  }
1197  if (sps->getSPSTemporalMVPEnabledFlag())
1198  {
1199  READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" );
1200  pcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false );
1201  }
1202  else
1203  {
1204  pcSlice->setEnableTMVPFlag(false);
1205  }
1206  }
1207  if(sps->getUseSAO())
1208  {
1209  READ_FLAG(uiCode, "slice_sao_luma_flag"); pcSlice->setSaoEnabledFlag(CHANNEL_TYPE_LUMA, (Bool)uiCode);
1210 
1211  if (bChroma)
1212  {
1213  READ_FLAG(uiCode, "slice_sao_chroma_flag"); pcSlice->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, (Bool)uiCode);
1214  }
1215  }
1216 
1217  if (pcSlice->getIdrPicFlag())
1218  {
1219  pcSlice->setEnableTMVPFlag(false);
1220  }
1221  if (!pcSlice->isIntra())
1222  {
1223 
1224  READ_FLAG( uiCode, "num_ref_idx_active_override_flag");
1225  if (uiCode)
1226  {
1227  READ_UVLC (uiCode, "num_ref_idx_l0_active_minus1" ); pcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 );
1228  if (pcSlice->isInterB())
1229  {
1230  READ_UVLC (uiCode, "num_ref_idx_l1_active_minus1" ); pcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 );
1231  }
1232  else
1233  {
1234  pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0);
1235  }
1236  }
1237  else
1238  {
1240  if (pcSlice->isInterB())
1241  {
1243  }
1244  else
1245  {
1246  pcSlice->setNumRefIdx(REF_PIC_LIST_1,0);
1247  }
1248  }
1249  }
1250  // }
1251  TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
1252  if(!pcSlice->isIntra())
1253  {
1254  if( !pps->getListsModificationPresentFlag() || pcSlice->getNumRpsCurrTempList() <= 1 )
1255  {
1256  refPicListModification->setRefPicListModificationFlagL0( 0 );
1257  }
1258  else
1259  {
1260  READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); refPicListModification->setRefPicListModificationFlagL0( uiCode ? 1 : 0 );
1261  }
1262 
1263  if(refPicListModification->getRefPicListModificationFlagL0())
1264  {
1265  uiCode = 0;
1266  Int i = 0;
1267  Int numRpsCurrTempList0 = pcSlice->getNumRpsCurrTempList();
1268  if ( numRpsCurrTempList0 > 1 )
1269  {
1270  Int length = 1;
1271  numRpsCurrTempList0 --;
1272  while ( numRpsCurrTempList0 >>= 1)
1273  {
1274  length ++;
1275  }
1276  for (i = 0; i < pcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++)
1277  {
1278  READ_CODE( length, uiCode, "list_entry_l0" );
1279  refPicListModification->setRefPicSetIdxL0(i, uiCode );
1280  }
1281  }
1282  else
1283  {
1284  for (i = 0; i < pcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++)
1285  {
1286  refPicListModification->setRefPicSetIdxL0(i, 0 );
1287  }
1288  }
1289  }
1290  }
1291  else
1292  {
1293  refPicListModification->setRefPicListModificationFlagL0(0);
1294  }
1295  if(pcSlice->isInterB())
1296  {
1297  if( !pps->getListsModificationPresentFlag() || pcSlice->getNumRpsCurrTempList() <= 1 )
1298  {
1299  refPicListModification->setRefPicListModificationFlagL1( 0 );
1300  }
1301  else
1302  {
1303  READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); refPicListModification->setRefPicListModificationFlagL1( uiCode ? 1 : 0 );
1304  }
1305  if(refPicListModification->getRefPicListModificationFlagL1())
1306  {
1307  uiCode = 0;
1308  Int i = 0;
1309  Int numRpsCurrTempList1 = pcSlice->getNumRpsCurrTempList();
1310  if ( numRpsCurrTempList1 > 1 )
1311  {
1312  Int length = 1;
1313  numRpsCurrTempList1 --;
1314  while ( numRpsCurrTempList1 >>= 1)
1315  {
1316  length ++;
1317  }
1318  for (i = 0; i < pcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++)
1319  {
1320  READ_CODE( length, uiCode, "list_entry_l1" );
1321  refPicListModification->setRefPicSetIdxL1(i, uiCode );
1322  }
1323  }
1324  else
1325  {
1326  for (i = 0; i < pcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++)
1327  {
1328  refPicListModification->setRefPicSetIdxL1(i, 0 );
1329  }
1330  }
1331  }
1332  }
1333  else
1334  {
1335  refPicListModification->setRefPicListModificationFlagL1(0);
1336  }
1337  if (pcSlice->isInterB())
1338  {
1339  READ_FLAG( uiCode, "mvd_l1_zero_flag" ); pcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) );
1340  }
1341 
1342  pcSlice->setCabacInitFlag( false ); // default
1343  if(pps->getCabacInitPresentFlag() && !pcSlice->isIntra())
1344  {
1345  READ_FLAG(uiCode, "cabac_init_flag");
1346  pcSlice->setCabacInitFlag( uiCode ? true : false );
1347  }
1348 
1349  if ( pcSlice->getEnableTMVPFlag() )
1350  {
1351  if ( pcSlice->getSliceType() == B_SLICE )
1352  {
1353  READ_FLAG( uiCode, "collocated_from_l0_flag" );
1354  pcSlice->setColFromL0Flag(uiCode);
1355  }
1356  else
1357  {
1358  pcSlice->setColFromL0Flag( 1 );
1359  }
1360 
1361  if ( pcSlice->getSliceType() != I_SLICE &&
1362  ((pcSlice->getColFromL0Flag() == 1 && pcSlice->getNumRefIdx(REF_PIC_LIST_0) > 1)||
1363  (pcSlice->getColFromL0Flag() == 0 && pcSlice->getNumRefIdx(REF_PIC_LIST_1) > 1)))
1364  {
1365  READ_UVLC( uiCode, "collocated_ref_idx" );
1366  pcSlice->setColRefIdx(uiCode);
1367  }
1368  else
1369  {
1370  pcSlice->setColRefIdx(0);
1371  }
1372  }
1373  if ( (pps->getUseWP() && pcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && pcSlice->getSliceType()==B_SLICE) )
1374  {
1375  xParsePredWeightTable(pcSlice, sps);
1376  pcSlice->initWpScaling(sps);
1377  }
1378  if (!pcSlice->isIntra())
1379  {
1380  READ_UVLC( uiCode, "five_minus_max_num_merge_cand");
1381  pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode);
1382  }
1383 
1384  READ_SVLC( iCode, "slice_qp_delta" );
1385  pcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode);
1386 
1387  assert( pcSlice->getSliceQp() >= -sps->getQpBDOffset(CHANNEL_TYPE_LUMA) );
1388  assert( pcSlice->getSliceQp() <= 51 );
1389 
1390  if (pps->getSliceChromaQpFlag())
1391  {
1392  if (numValidComp>COMPONENT_Cb)
1393  {
1394  READ_SVLC( iCode, "slice_cb_qp_offset" );
1395  pcSlice->setSliceChromaQpDelta(COMPONENT_Cb, iCode );
1396  assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb) >= -12 );
1397  assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb) <= 12 );
1398  assert( (pps->getQpOffset(COMPONENT_Cb) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cb)) >= -12 );
1399  assert( (pps->getQpOffset(COMPONENT_Cb) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cb)) <= 12 );
1400  }
1401 
1402  if (numValidComp>COMPONENT_Cr)
1403  {
1404  READ_SVLC( iCode, "slice_cr_qp_offset" );
1405  pcSlice->setSliceChromaQpDelta(COMPONENT_Cr, iCode );
1406  assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr) >= -12 );
1407  assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr) <= 12 );
1408  assert( (pps->getQpOffset(COMPONENT_Cr) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cr)) >= -12 );
1409  assert( (pps->getQpOffset(COMPONENT_Cr) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cr)) <= 12 );
1410  }
1411  }
1412 
1414  {
1415  READ_FLAG(uiCode, "cu_chroma_qp_offset_enabled_flag"); pcSlice->setUseChromaQpAdj(uiCode != 0);
1416  }
1417  else
1418  {
1419  pcSlice->setUseChromaQpAdj(false);
1420  }
1421 
1423  {
1425  {
1426  READ_FLAG ( uiCode, "deblocking_filter_override_flag" ); pcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false);
1427  }
1428  else
1429  {
1430  pcSlice->setDeblockingFilterOverrideFlag(0);
1431  }
1432  if(pcSlice->getDeblockingFilterOverrideFlag())
1433  {
1434  READ_FLAG ( uiCode, "slice_deblocking_filter_disabled_flag" ); pcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0);
1435  if(!pcSlice->getDeblockingFilterDisable())
1436  {
1437  READ_SVLC( iCode, "slice_beta_offset_div2" ); pcSlice->setDeblockingFilterBetaOffsetDiv2(iCode);
1438  assert(pcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 &&
1439  pcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6);
1440  READ_SVLC( iCode, "slice_tc_offset_div2" ); pcSlice->setDeblockingFilterTcOffsetDiv2(iCode);
1441  assert(pcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 &&
1442  pcSlice->getDeblockingFilterTcOffsetDiv2() <= 6);
1443  }
1444  }
1445  else
1446  {
1450  }
1451  }
1452  else
1453  {
1454  pcSlice->setDeblockingFilterDisable ( false );
1455  pcSlice->setDeblockingFilterBetaOffsetDiv2( 0 );
1456  pcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 );
1457  }
1458 
1459  Bool isSAOEnabled = sps->getUseSAO() && (pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_LUMA) || (bChroma && pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA)));
1460  Bool isDBFEnabled = (!pcSlice->getDeblockingFilterDisable());
1461 
1462  if(pps->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled ))
1463  {
1464  READ_FLAG( uiCode, "slice_loop_filter_across_slices_enabled_flag");
1465  }
1466  else
1467  {
1468  uiCode = pps->getLoopFilterAcrossSlicesEnabledFlag()?1:0;
1469  }
1470  pcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false);
1471 
1472  }
1473 
1474  std::vector<UInt> entryPointOffset;
1476  {
1477  UInt numEntryPointOffsets;
1478  UInt offsetLenMinus1;
1479  READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets");
1480  if (numEntryPointOffsets>0)
1481  {
1482  READ_UVLC(offsetLenMinus1, "offset_len_minus1");
1483  entryPointOffset.resize(numEntryPointOffsets);
1484  for (UInt idx=0; idx<numEntryPointOffsets; idx++)
1485  {
1486  READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1");
1487  entryPointOffset[ idx ] = uiCode + 1;
1488  }
1489  }
1490  }
1491 
1493  {
1494  READ_UVLC(uiCode,"slice_segment_header_extension_length");
1495  for(Int i=0; i<uiCode; i++)
1496  {
1497  UInt ignore;
1498  READ_CODE(8,ignore,"slice_segment_header_extension_data_byte");
1499  }
1500  }
1501 #if RExt__DECODER_DEBUG_BIT_STATISTICS
1503 #else
1505 #endif
1506 
1507  pcSlice->clearSubstreamSizes();
1508 
1510  {
1511  Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation();
1512 
1513  // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header
1514  for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ )
1515  {
1516  if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation )
1517  {
1518  endOfSliceHeaderLocation++;
1519  }
1520  }
1521 
1522  Int curEntryPointOffset = 0;
1523  Int prevEntryPointOffset = 0;
1524  for (UInt idx=0; idx<entryPointOffset.size(); idx++)
1525  {
1526  curEntryPointOffset += entryPointOffset[ idx ];
1527 
1528  Int emulationPreventionByteCount = 0;
1529  for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ )
1530  {
1531  if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) &&
1532  m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) )
1533  {
1534  emulationPreventionByteCount++;
1535  }
1536  }
1537 
1538  entryPointOffset[ idx ] -= emulationPreventionByteCount;
1539  prevEntryPointOffset = curEntryPointOffset;
1540  pcSlice->addSubstreamSize(entryPointOffset [ idx ] );
1541  }
1542  }
1543 
1544  return;
1545 }
1546 
1547 Void TDecCavlc::parsePTL( TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1 )
1548 {
1549  UInt uiCode;
1550  if(profilePresentFlag)
1551  {
1552  parseProfileTier(rpcPTL->getGeneralPTL(), false);
1553  }
1554  READ_CODE( 8, uiCode, "general_level_idc" ); rpcPTL->getGeneralPTL()->setLevelIdc(Level::Name(uiCode));
1555 
1556  for (Int i = 0; i < maxNumSubLayersMinus1; i++)
1557  {
1558  READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode);
1559  READ_FLAG( uiCode, "sub_layer_level_present_flag[i]" ); rpcPTL->setSubLayerLevelPresentFlag (i, uiCode);
1560  }
1561 
1562  if (maxNumSubLayersMinus1 > 0)
1563  {
1564  for (Int i = maxNumSubLayersMinus1; i < 8; i++)
1565  {
1566  READ_CODE(2, uiCode, "reserved_zero_2bits");
1567  assert(uiCode == 0);
1568  }
1569  }
1570 
1571  for(Int i = 0; i < maxNumSubLayersMinus1; i++)
1572  {
1573  if( rpcPTL->getSubLayerProfilePresentFlag(i) )
1574  {
1575  parseProfileTier(rpcPTL->getSubLayerPTL(i), true);
1576  }
1577  if(rpcPTL->getSubLayerLevelPresentFlag(i))
1578  {
1579  READ_CODE( 8, uiCode, "sub_layer_level_idc[i]" ); rpcPTL->getSubLayerPTL(i)->setLevelIdc(Level::Name(uiCode));
1580  }
1581  }
1582 }
1583 
1584 #if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS
1585 Void TDecCavlc::parseProfileTier(ProfileTierLevel *ptl, const Bool bIsSubLayer)
1586 #define PTL_TRACE_TEXT(txt) bIsSubLayer?("sub_layer_" txt) : ("general_" txt)
1587 #else
1589 #define PTL_TRACE_TEXT(txt) txt
1590 #endif
1591 {
1592  UInt uiCode;
1593  READ_CODE(2 , uiCode, PTL_TRACE_TEXT("profile_space" )); ptl->setProfileSpace(uiCode);
1594  READ_FLAG( uiCode, PTL_TRACE_TEXT("tier_flag" )); ptl->setTierFlag (uiCode ? Level::HIGH : Level::MAIN);
1595  READ_CODE(5 , uiCode, PTL_TRACE_TEXT("profile_idc" )); ptl->setProfileIdc (Profile::Name(uiCode));
1596  for(Int j = 0; j < 32; j++)
1597  {
1598  READ_FLAG( uiCode, PTL_TRACE_TEXT("profile_compatibility_flag[][j]" )); ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0);
1599  }
1600  READ_FLAG(uiCode, PTL_TRACE_TEXT("progressive_source_flag" )); ptl->setProgressiveSourceFlag(uiCode ? true : false);
1601 
1602  READ_FLAG(uiCode, PTL_TRACE_TEXT("interlaced_source_flag" )); ptl->setInterlacedSourceFlag(uiCode ? true : false);
1603 
1604  READ_FLAG(uiCode, PTL_TRACE_TEXT("non_packed_constraint_flag" )); ptl->setNonPackedConstraintFlag(uiCode ? true : false);
1605 
1606  READ_FLAG(uiCode, PTL_TRACE_TEXT("frame_only_constraint_flag" )); ptl->setFrameOnlyConstraintFlag(uiCode ? true : false);
1607 
1610  {
1611  UInt maxBitDepth=16;
1612  READ_FLAG( uiCode, PTL_TRACE_TEXT("max_12bit_constraint_flag" )); if (uiCode) maxBitDepth=12;
1613  READ_FLAG( uiCode, PTL_TRACE_TEXT("max_10bit_constraint_flag" )); if (uiCode) maxBitDepth=10;
1614  READ_FLAG( uiCode, PTL_TRACE_TEXT("max_8bit_constraint_flag" )); if (uiCode) maxBitDepth=8;
1615  ptl->setBitDepthConstraint(maxBitDepth);
1616  ChromaFormat chromaFmtConstraint=CHROMA_444;
1617  READ_FLAG( uiCode, PTL_TRACE_TEXT("max_422chroma_constraint_flag" )); if (uiCode) chromaFmtConstraint=CHROMA_422;
1618  READ_FLAG( uiCode, PTL_TRACE_TEXT("max_420chroma_constraint_flag" )); if (uiCode) chromaFmtConstraint=CHROMA_420;
1619  READ_FLAG( uiCode, PTL_TRACE_TEXT("max_monochrome_constraint_flag" )); if (uiCode) chromaFmtConstraint=CHROMA_400;
1620  ptl->setChromaFormatConstraint(chromaFmtConstraint);
1621  READ_FLAG( uiCode, PTL_TRACE_TEXT("intra_constraint_flag" )); ptl->setIntraConstraintFlag(uiCode != 0);
1622  READ_FLAG( uiCode, PTL_TRACE_TEXT("one_picture_only_constraint_flag")); ptl->setOnePictureOnlyConstraintFlag(uiCode != 0);
1623  READ_FLAG( uiCode, PTL_TRACE_TEXT("lower_bit_rate_constraint_flag" )); ptl->setLowerBitRateConstraintFlag(uiCode != 0);
1624  READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_34bits[0..15]" ));
1625  READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_34bits[16..31]" ));
1626  READ_CODE(2, uiCode, PTL_TRACE_TEXT("reserved_zero_34bits[32..33]" ));
1627  }
1628  else
1629  {
1630  ptl->setBitDepthConstraint((ptl->getProfileIdc() == Profile::MAIN10)?10:8);
1632  ptl->setIntraConstraintFlag(false);
1633  ptl->setLowerBitRateConstraintFlag(true);
1635  {
1636  READ_CODE(7, uiCode, PTL_TRACE_TEXT("reserved_zero_7bits" ));
1637  READ_FLAG( uiCode, PTL_TRACE_TEXT("one_picture_only_constraint_flag")); ptl->setOnePictureOnlyConstraintFlag(uiCode != 0);
1638  READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_35bits[0..15]" ));
1639  READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_35bits[16..31]" ));
1640  READ_CODE(3, uiCode, PTL_TRACE_TEXT("reserved_zero_35bits[32..34]" ));
1641  }
1642  else
1643  {
1644  READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_43bits[0..15]" ));
1645  READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_43bits[16..31]" ));
1646  READ_CODE(11, uiCode, PTL_TRACE_TEXT("reserved_zero_43bits[32..42]" ));
1647  }
1648  }
1649 
1656  {
1657  READ_FLAG( uiCode, PTL_TRACE_TEXT("inbld_flag" )); assert(uiCode == 0);
1658  }
1659  else
1660  {
1661  READ_FLAG( uiCode, PTL_TRACE_TEXT("reserved_zero_bit" ));
1662  }
1663 #undef PTL_TRACE_TEXT
1664 }
1665 
1667 {
1668  ruiBit = false;
1669  Int iBitsLeft = m_pcBitstream->getNumBitsLeft();
1670  if(iBitsLeft <= 8)
1671  {
1672  UInt uiPeekValue = m_pcBitstream->peekBits(iBitsLeft);
1673  if (uiPeekValue == (1<<(iBitsLeft-1)))
1674  {
1675  ruiBit = true;
1676  }
1677  }
1678 }
1679 
1680 Void TDecCavlc::parseRemainingBytes( Bool noTrailingBytesExpected )
1681 {
1682  if (noTrailingBytesExpected)
1683  {
1684  const UInt numberOfRemainingSubstreamBytes=m_pcBitstream->getNumBitsLeft();
1685  assert (numberOfRemainingSubstreamBytes == 0);
1686  }
1687  else
1688  {
1689  while (m_pcBitstream->getNumBitsLeft())
1690  {
1691  UInt trailingNullByte=m_pcBitstream->readByte();
1692  if (trailingNullByte!=0)
1693  {
1694  printf("Trailing byte should be 0, but has value %02x\n", trailingNullByte);
1695  assert(trailingNullByte==0);
1696  }
1697  }
1698  }
1699 }
1700 
1701 Void TDecCavlc::parseSkipFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
1702 {
1703  assert(0);
1704 }
1705 
1706 Void TDecCavlc::parseCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
1707 {
1708  assert(0);
1709 }
1710 
1712 {
1713  assert(0);
1714 }
1715 
1716 Void TDecCavlc::parseSplitFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
1717 {
1718  assert(0);
1719 }
1720 
1721 Void TDecCavlc::parsePartSize( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
1722 {
1723  assert(0);
1724 }
1725 
1726 Void TDecCavlc::parsePredMode( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
1727 {
1728  assert(0);
1729 }
1730 
1739 Void TDecCavlc::parseIPCMInfo( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
1740 {
1741  assert(0);
1742 }
1743 
1744 Void TDecCavlc::parseIntraDirLumaAng ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
1745 {
1746  assert(0);
1747 }
1748 
1749 Void TDecCavlc::parseIntraDirChroma( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
1750 {
1751  assert(0);
1752 }
1753 
1754 Void TDecCavlc::parseInterDir( TComDataCU* /*pcCU*/, UInt& /*ruiInterDir*/, UInt /*uiAbsPartIdx*/ )
1755 {
1756  assert(0);
1757 }
1758 
1759 Void TDecCavlc::parseRefFrmIdx( TComDataCU* /*pcCU*/, Int& /*riRefFrmIdx*/, RefPicList /*eRefList*/ )
1760 {
1761  assert(0);
1762 }
1763 
1764 Void TDecCavlc::parseMvd( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiPartIdx*/, UInt /*uiDepth*/, RefPicList /*eRefList*/ )
1765 {
1766  assert(0);
1767 }
1768 
1770 {
1771  assert(0);
1772 }
1773 
1774 Void TDecCavlc::parseDeltaQP( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
1775 {
1776  assert(0);
1777 }
1778 
1779 Void TDecCavlc::parseChromaQpAdjustment( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
1780 {
1781  assert(0);
1782 }
1783 
1785 {
1786  assert(0);
1787 }
1788 
1789 Void TDecCavlc::parseTransformSubdivFlag( UInt& /*ruiSubdivFlag*/, UInt /*uiLog2TransformBlockSize*/ )
1790 {
1791  assert(0);
1792 }
1793 
1794 Void TDecCavlc::parseQtCbf( TComTU &/*rTu*/, const ComponentID /*compID*/, const Bool /*lowestLevel*/ )
1795 {
1796  assert(0);
1797 }
1798 
1799 Void TDecCavlc::parseQtRootCbf( UInt /*uiAbsPartIdx*/, UInt& /*uiQtRootCbf*/ )
1800 {
1801  assert(0);
1802 }
1803 
1805 {
1806  assert(0);
1807 }
1808 
1809 Void TDecCavlc::parseMergeFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/, UInt /*uiPUIdx*/ )
1810 {
1811  assert(0);
1812 }
1813 
1814 Void TDecCavlc::parseMergeIndex ( TComDataCU* /*pcCU*/, UInt& /*ruiMergeIndex*/ )
1815 {
1816  assert(0);
1817 }
1818 
1819 // ====================================================================================================================
1820 // Protected member functions
1821 // ====================================================================================================================
1822 
1825 {
1826  WPScalingParam *wp;
1827  const ChromaFormat chFmt = sps->getChromaFormatIdc();
1828  const Int numValidComp = Int(getNumberValidComponents(chFmt));
1829  const Bool bChroma = (chFmt!=CHROMA_400);
1830  const SliceType eSliceType = pcSlice->getSliceType();
1831  const Int iNbRef = (eSliceType == B_SLICE ) ? (2) : (1);
1832  UInt uiLog2WeightDenomLuma=0, uiLog2WeightDenomChroma=0;
1833  UInt uiTotalSignalledWeightFlags = 0;
1834 
1835  Int iDeltaDenom;
1836  // decode delta_luma_log2_weight_denom :
1837  READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" );
1838  assert( uiLog2WeightDenomLuma <= 7 );
1839  if( bChroma )
1840  {
1841  READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" );
1842  assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0);
1843  assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7);
1844  uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma);
1845  }
1846 
1847  for ( Int iNumRef=0 ; iNumRef<iNbRef ; iNumRef++ ) // loop over l0 and l1 syntax elements
1848  {
1849  RefPicList eRefPicList = ( iNumRef ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
1850  for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ )
1851  {
1852  pcSlice->getWpScaling(eRefPicList, iRefIdx, wp);
1853 
1854  wp[COMPONENT_Y].uiLog2WeightDenom = uiLog2WeightDenomLuma;
1855  for(Int j=1; j<numValidComp; j++)
1856  {
1857  wp[j].uiLog2WeightDenom = uiLog2WeightDenomChroma;
1858  }
1859 
1860  UInt uiCode;
1861  READ_FLAG( uiCode, iNumRef==0?"luma_weight_l0_flag[i]":"luma_weight_l1_flag[i]" );
1862  wp[COMPONENT_Y].bPresentFlag = ( uiCode == 1 );
1863  uiTotalSignalledWeightFlags += wp[COMPONENT_Y].bPresentFlag;
1864  }
1865  if ( bChroma )
1866  {
1867  UInt uiCode;
1868  for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ )
1869  {
1870  pcSlice->getWpScaling(eRefPicList, iRefIdx, wp);
1871  READ_FLAG( uiCode, iNumRef==0?"chroma_weight_l0_flag[i]":"chroma_weight_l1_flag[i]" );
1872  for(Int j=1; j<numValidComp; j++)
1873  {
1874  wp[j].bPresentFlag = ( uiCode == 1 );
1875  }
1876  uiTotalSignalledWeightFlags += 2*wp[COMPONENT_Cb].bPresentFlag;
1877  }
1878  }
1879  for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ )
1880  {
1881  pcSlice->getWpScaling(eRefPicList, iRefIdx, wp);
1882  if ( wp[COMPONENT_Y].bPresentFlag )
1883  {
1884  Int iDeltaWeight;
1885  READ_SVLC( iDeltaWeight, iNumRef==0?"delta_luma_weight_l0[i]":"delta_luma_weight_l1[i]" );
1886  assert( iDeltaWeight >= -128 );
1887  assert( iDeltaWeight <= 127 );
1888  wp[COMPONENT_Y].iWeight = (iDeltaWeight + (1<<wp[COMPONENT_Y].uiLog2WeightDenom));
1889  READ_SVLC( wp[COMPONENT_Y].iOffset, iNumRef==0?"luma_offset_l0[i]":"luma_offset_l1[i]" );
1891  assert( wp[0].iOffset >= -range );
1892  assert( wp[0].iOffset < range );
1893  }
1894  else
1895  {
1897  wp[COMPONENT_Y].iOffset = 0;
1898  }
1899  if ( bChroma )
1900  {
1901  if ( wp[COMPONENT_Cb].bPresentFlag )
1902  {
1904  for ( Int j=1 ; j<numValidComp ; j++ )
1905  {
1906  Int iDeltaWeight;
1907  READ_SVLC( iDeltaWeight, iNumRef==0?"delta_chroma_weight_l0[i]":"delta_chroma_weight_l1[i]" );
1908  assert( iDeltaWeight >= -128 );
1909  assert( iDeltaWeight <= 127 );
1910  wp[j].iWeight = (iDeltaWeight + (1<<wp[j].uiLog2WeightDenom));
1911 
1912  Int iDeltaChroma;
1913  READ_SVLC( iDeltaChroma, iNumRef==0?"delta_chroma_offset_l0[i]":"delta_chroma_offset_l1[i]" );
1914  assert( iDeltaChroma >= -4*range);
1915  assert( iDeltaChroma < 4*range);
1916  Int pred = ( range - ( ( range*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) );
1917  wp[j].iOffset = Clip3(-range, range-1, (iDeltaChroma + pred) );
1918  }
1919  }
1920  else
1921  {
1922  for ( Int j=1 ; j<numValidComp ; j++ )
1923  {
1924  wp[j].iWeight = (1 << wp[j].uiLog2WeightDenom);
1925  wp[j].iOffset = 0;
1926  }
1927  }
1928  }
1929  }
1930 
1931  for ( Int iRefIdx=pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx<MAX_NUM_REF ; iRefIdx++ )
1932  {
1933  pcSlice->getWpScaling(eRefPicList, iRefIdx, wp);
1934 
1935  wp[0].bPresentFlag = false;
1936  wp[1].bPresentFlag = false;
1937  wp[2].bPresentFlag = false;
1938  }
1939  }
1940  assert(uiTotalSignalledWeightFlags<=24);
1941 }
1942 
1947 {
1948  UInt code, sizeId, listId;
1949  Bool scalingListPredModeFlag;
1950  //for each size
1951  for(sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
1952  {
1953  for(listId = 0; listId < SCALING_LIST_NUM; listId++)
1954  {
1955  if ((sizeId==SCALING_LIST_32x32) && (listId%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) != 0))
1956  {
1957  Int *src = scalingList->getScalingListAddress(sizeId, listId);
1958  const Int size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]);
1959  const Int *srcNextSmallerSize = scalingList->getScalingListAddress(sizeId-1, listId);
1960  for(Int i=0; i<size; i++)
1961  {
1962  src[i] = srcNextSmallerSize[i];
1963  }
1964  scalingList->setScalingListDC(sizeId,listId,(sizeId > SCALING_LIST_8x8) ? scalingList->getScalingListDC(sizeId-1, listId) : src[0]);
1965  }
1966  else
1967  {
1968  READ_FLAG( code, "scaling_list_pred_mode_flag");
1969  scalingListPredModeFlag = (code) ? true : false;
1970  scalingList->setScalingListPredModeFlag(sizeId, listId, scalingListPredModeFlag);
1971  if(!scalingListPredModeFlag) //Copy Mode
1972  {
1973  READ_UVLC( code, "scaling_list_pred_matrix_id_delta");
1974 
1975  if (sizeId==SCALING_LIST_32x32)
1976  {
1977  code*=(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES); // Adjust the decoded code for this size, to cope with the missing 32x32 chroma entries.
1978  }
1979 
1980  scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code)));
1981  if( sizeId > SCALING_LIST_8x8 )
1982  {
1983  scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId))));
1984  }
1985  scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId));
1986 
1987  }
1988  else //DPCM Mode
1989  {
1990  xDecodeScalingList(scalingList, sizeId, listId);
1991  }
1992  }
1993  }
1994  }
1995 
1996  return;
1997 }
2004 {
2005  Int i,coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]);
2006  Int data;
2007  Int scalingListDcCoefMinus8 = 0;
2008  Int nextCoef = SCALING_LIST_START_VALUE;
2009  UInt* scan = g_scanOrder[SCAN_UNGROUPED][SCAN_DIAG][sizeId==0 ? 2 : 3][sizeId==0 ? 2 : 3];
2010  Int *dst = scalingList->getScalingListAddress(sizeId, listId);
2011 
2012  if( sizeId > SCALING_LIST_8x8 )
2013  {
2014  READ_SVLC( scalingListDcCoefMinus8, "scaling_list_dc_coef_minus8");
2015  scalingList->setScalingListDC(sizeId,listId,scalingListDcCoefMinus8 + 8);
2016  nextCoef = scalingList->getScalingListDC(sizeId,listId);
2017  }
2018 
2019  for(i = 0; i < coefNum; i++)
2020  {
2021  READ_SVLC( data, "scaling_list_delta_coef");
2022  nextCoef = (nextCoef + data + 256 ) % 256;
2023  dst[scan[i]] = nextCoef;
2024  }
2025 }
2026 
2028 {
2029  Int bitsLeft = m_pcBitstream->getNumBitsLeft();
2030 
2031  // if there are more than 8 bits, it cannot be rbsp_trailing_bits
2032  if (bitsLeft > 8)
2033  {
2034  return true;
2035  }
2036 
2037  UChar lastByte = m_pcBitstream->peekBits(bitsLeft);
2038  Int cnt = bitsLeft;
2039 
2040  // remove trailing bits equal to zero
2041  while ((cnt>0) && ((lastByte & 1) == 0))
2042  {
2043  lastByte >>= 1;
2044  cnt--;
2045  }
2046  // remove bit equal to one
2047  cnt--;
2048 
2049  // we should not have a negative number of bits
2050  assert (cnt>=0);
2051 
2052  // we have more data, if cnt is not zero
2053  return (cnt>0);
2054 }
2055 
2057 {
2058  assert(0);
2059 }
2060 
2061 
2063 
Void setNumTileColumnsMinus1(Int i)
Definition: TComSlice.h:1158
Int getNumberOfPositivePictures() const
Definition: TComSlice.h:109
Void setColourDescriptionPresentFlag(Bool i)
Definition: TComSlice.h:614
Bool getNalHrdParametersPresentFlag() const
Definition: TComSlice.h:324
Int getNumTileRowsMinus1() const
Definition: TComSlice.h:1163
Void parseCrossComponentPrediction(class TComTU &rTu, ComponentID compID)
Definition: TDecCAVLC.cpp:1769
Void setSliceSegmentCurEndCtuTsAddr(UInt ctuTsAddr)
Definition: TComSlice.h:1493
Void setPPSId(Int i)
Definition: TComSlice.h:1093
Void parsePTL(TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1)
Definition: TDecCAVLC.cpp:1547
Void parseVPS(TComVPS *pcVPS)
Definition: TDecCAVLC.cpp:862
Void setNoOutputPriorPicsFlag(Bool val)
Definition: TComSlice.h:1467
Void setMaxTotalCUDepth(UInt u)
Definition: TComSlice.h:860
Int getPicInitQPMinus26() const
Definition: TComSlice.h:1097
Void setTransformSkipRotationEnabledFlag(const Bool value)
Definition: TComSlice.h:715
const std::vector< UInt > & getEmulationPreventionByteLocation() const
static const Int SCALING_LIST_NUM
list number for quantization matrix
Definition: CommonDef.h:232
Void setUsed(Int bufferNum, Bool used)
Definition: TComSlice.cpp:1650
Void setQuadtreeTULog2MaxSize(UInt u)
Definition: TComSlice.h:872
Void clearSubstreamSizes()
Definition: TComSlice.h:1523
UInt getMaxNuhReservedZeroLayerId() const
Definition: TComSlice.h:501
Int getSPSId() const
Definition: TComSlice.h:1094
SliceType
supported slice type
Definition: TypeDef.h:283
Bool getFixedPicRateFlag(Int layer) const
Definition: TComSlice.h:362
Bool getVclHrdParametersPresentFlag() const
Definition: TComSlice.h:327
UInt getMaxLatencyIncrease(UInt tLayer) const
Definition: TComSlice.h:496
Void setPPSId(Int PPSId)
Definition: TComSlice.h:1334
Void setVideoSignalTypePresentFlag(Bool i)
Definition: TComSlice.h:605
Bool getSPSTemporalMVPEnabledFlag() const
Definition: TComSlice.h:887
Void setDeblockingFilterTcOffsetDiv2(Int i)
Definition: TComSlice.h:1408
Void setSPSId(Int i)
Definition: TComSlice.h:825
Void setSarHeight(Int i)
Definition: TComSlice.h:596
Bool getUsedByCurrPicLtSPSFlag(Int i) const
Definition: TComSlice.h:848
PPSExtensionFlagIndex
Definition: TypeDef.h:653
UInt getMaxTLayers() const
Definition: TComSlice.h:480
Void setMaxCUHeight(UInt u)
Definition: TComSlice.h:858
Void setUseWP(Bool b)
Definition: TComSlice.h:1136
Int * getScalingListAddress(UInt sizeId, UInt listId)
get matrix coefficient
Definition: TComSlice.h:155
Void setColRefIdx(UInt refIdx)
Definition: TComSlice.h:1419
SliceType getSliceType() const
Definition: TComSlice.h:1353
Void setUseDQP(Bool b)
Definition: TComSlice.h:1100
CU data structure class.
Definition: TComDataCU.h:64
Void setDependentSliceSegmentFlag(Bool val)
Definition: TComSlice.h:1358
Void setColFromL0Flag(Bool colFromL0)
Definition: TComSlice.h:1418
Void setFixedPicRateFlag(Int layer, Bool flag)
Definition: TComSlice.h:361
Void setRefPicSetIdxL0(UInt idx, UInt refPicSetIdx)
Definition: TComSlice.h:965
Int getNumTileColumnsMinus1() const
Definition: TComSlice.h:1159
#define READ_FLAG_CHK(code, name, minValIncl, maxValIncl)
Void printDeltaPOC() const
Definition: TComSlice.cpp:1753
Void processRefMatrix(UInt sizeId, UInt listId, UInt refListId)
Definition: TComSlice.cpp:1833
Void parseIntraDirLumaAng(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecCAVLC.cpp:1744
Void setMatrixCoefficients(Int i)
Definition: TComSlice.h:623
#define READ_CODE(length, code, name)
Void setTierFlag(Level::Tier x)
Definition: TComSlice.h:210
Bool getCprmsPresentFlag(UInt i) const
Definition: TComSlice.h:474
void Void
Definition: TypeDef.h:203
Void setVideoFullRangeFlag(Bool i)
Definition: TComSlice.h:611
Void setRefPicSetIdxL1(UInt idx, UInt refPicSetIdx)
Definition: TComSlice.h:967
Void parseInterDir(TComDataCU *pcCU, UInt &ruiInterDir, UInt uiAbsPartIdx)
Definition: TDecCAVLC.cpp:1754
Void setDuCpbSizeScale(UInt value)
Definition: TComSlice.h:349
Void setScalingListPredModeFlag(UInt sizeId, UInt listId, Bool bIsDPCM)
Definition: TComSlice.h:168
Void parseQtCbf(class TComTU &rTu, const ComponentID compID, const Bool lowestLevel)
Definition: TDecCAVLC.cpp:1794
Void setNumberOfNegativePictures(Int number)
Definition: TComSlice.h:106
const TComPPSRExt & getPpsRangeExtension() const
Definition: TComSlice.h:1197
Void parseQtRootCbf(UInt uiAbsPartIdx, UInt &uiQtRootCbf)
Definition: TDecCAVLC.cpp:1799
Bool getSliceChromaQpFlag() const
Definition: TComSlice.h:1103
Void setMinSpatialSegmentationIdc(Int i)
Definition: TComSlice.h:663
static const Int MRG_MAX_NUM_CANDS
MERGE.
Definition: CommonDef.h:131
const TComSPSRExt & getSpsRangeExtension() const
Definition: TComSlice.h:941
Void parseExplicitRdpcmMode(TComTU &rTu, ComponentID compID)
Definition: TDecCAVLC.cpp:2056
Void setTransquantBypassEnabledFlag(Bool b)
Definition: TComSlice.h:1141
Void setDependentSliceSegmentsEnabledFlag(Bool val)
Definition: TComSlice.h:1150
Void setMaxCUWidth(UInt u)
Definition: TComSlice.h:856
Void setDeblockingFilterBetaOffsetDiv2(Int i)
Definition: TComSlice.h:1407
Int getWindowLeftOffset() const
Definition: TypeDef.h:925
Void setScalingListPresentFlag(Bool b)
Definition: TComSlice.h:1183
Void parseCoeffNxN(class TComTU &rTu, ComponentID compID)
Definition: TDecCAVLC.cpp:1784
#define NULL
Definition: CommonDef.h:107
Void setSubLayerProfilePresentFlag(Int i, Bool x)
Definition: TComSlice.h:260
Void parseRemainingBytes(Bool noTrailingBytesExpected)
Definition: TDecCAVLC.cpp:1680
Void setChromaSampleLocTypeTopField(Int i)
Definition: TComSlice.h:629
Void setEnableTMVPFlag(Bool b)
Definition: TComSlice.h:1535
static const Int SCALING_LIST_START_VALUE
start value for dpcm mode
Definition: CommonDef.h:234
Int getNumExtraSliceHeaderBits() const
Definition: TComSlice.h:1190
Void parseVUI(TComVUI *pcVUI, TComSPS *pcSPS)
Definition: TDecCAVLC.cpp:417
UInt getBitsForPOC() const
Definition: TComSlice.h:869
Void setCabacInitPresentFlag(Bool flag)
Definition: TComSlice.h:1170
Void addSubstreamSize(UInt size)
Definition: TComSlice.h:1525
#define READ_SVLC(code, name)
Void setPCMFilterDisableFlag(Bool bValue)
Definition: TComSlice.h:917
static UInt getMaxLog2CtbSize(const TComPTL &ptl, UInt layerPlus1=0)
Void setFrameOnlyConstraintFlag(Bool b)
Definition: TComSlice.h:231
Bool getCabacInitPresentFlag() const
Definition: TComSlice.h:1171
Void setPersistentRiceAdaptationEnabledFlag(const Bool value)
Definition: TComSlice.h:733
UInt getNumHrdParameters() const
Definition: TComSlice.h:498
Bool getScalingListPresentFlag() const
Definition: TComSlice.h:922
Void setDuCpbSizeValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl, UInt value)
Definition: TComSlice.h:381
unsigned int UInt
Definition: TypeDef.h:212
Bool getHrdParametersPresentFlag() const
Definition: TComSlice.h:647
Void setSaoEnabledFlag(ChannelType chType, Bool s)
Definition: TComSlice.h:1338
Void setDeltaPOC(Int bufferNum, Int deltaPOC)
Definition: TComSlice.cpp:1655
Bool getUseSAO() const
Definition: TComSlice.h:908
Void setCprmsPresentFlag(Bool val, UInt i)
Definition: TComSlice.h:475
Void setDiffCuChromaQpOffsetDepth(UInt u)
Definition: TComSlice.h:1007
Void setMaxBytesPerPicDenom(Int i)
Definition: TComSlice.h:666
static Int getWinUnitY(Int chromaFormatIdc)
Definition: TComSlice.h:830
Void setLowerBitRateConstraintFlag(Bool b)
Definition: TComSlice.h:246
Void setMaxBitsPerMinCuDenom(Int i)
Definition: TComSlice.h:669
Void setMaxCuDQPDepth(UInt u)
Definition: TComSlice.h:1106
Void setQuadtreeTUMaxDepthInter(UInt u)
Definition: TComSlice.h:876
Void setLtRefPicPocLsbSps(UInt index, UInt val)
Definition: TComSlice.h:846
Void setQpOffset(ComponentID compID, Int i)
Definition: TComSlice.h:1109
SCALING_LIST class.
Definition: TComSlice.h:150
Void setNumHrdParameters(UInt v)
Definition: TComSlice.h:499
const TComRPSList * getRPSList() const
Definition: TComSlice.h:883
Void setTransformSkipContextEnabledFlag(const Bool value)
Definition: TComSlice.h:718
Int getDeblockingFilterBetaOffsetDiv2() const
Definition: TComSlice.h:1367
Void setPicHeightInLumaSamples(UInt u)
Definition: TComSlice.h:835
UInt getMaxCUHeight() const
Definition: TComSlice.h:859
Void setCpbRemovalDelayLengthMinus1(UInt value)
Definition: TComSlice.h:355
Bool getLowDelayHrdFlag(Int layer) const
Definition: TComSlice.h:371
UInt getMaxDecPicBuffering(UInt tlayer) const
Definition: TComSlice.h:926
Void setNumReorderPics(Int i, UInt tlayer)
Definition: TComSlice.h:880
Void xDecodeScalingList(TComScalingList *scalingList, UInt sizeId, UInt listId)
Definition: TDecCAVLC.cpp:2003
TComRefPicListModification * getRefPicListModification()
Definition: TComSlice.h:1346
Bool getPPSDeblockingFilterDisabledFlag() const
get offset for deblocking filter disabled
Definition: TComSlice.h:1177
Void setSliceCurStartCtuTsAddr(UInt ctuTsAddr)
Definition: TComSlice.h:1480
Void setChromaFormatConstraint(ChromaFormat fmt)
Definition: TComSlice.h:237
Reference Picture Lists class.
Definition: TComSlice.h:948
Window & getDefaultDisplayWindow()
Definition: TComSlice.h:643
Void setMaxLatencyIncreasePlus1(UInt ui, UInt tlayer)
Definition: TComSlice.h:929
Int getDeblockingFilterTcOffsetDiv2() const
Definition: TComSlice.h:1368
Void parseSPS(TComSPS *pcSPS)
Definition: TDecCAVLC.cpp:590
Void setUseAMP(Bool b)
Definition: TComSlice.h:871
static const Int MAX_NUM_REF
max. number of entries in picture reference list
Definition: CommonDef.h:125
ChromaFormat getChromaFormatIdc() const
Definition: TComSlice.h:826
Int getScalingListDC(UInt sizeId, UInt listId) const
get DC value
Definition: TComSlice.h:166
Void setNumReorderPics(UInt v, UInt tLayer)
Definition: TComSlice.h:489
Void setChromaSampleLocTypeBottomField(Int i)
Definition: TComSlice.h:632
Void setRPS(const TComReferencePictureSet *pcRPS)
Definition: TComSlice.h:1340
Void setCrossComponentPredictionEnabledFlag(Bool value)
Definition: TComSlice.h:1002
Int getChromaQpOffsetListLen() const
Definition: TComSlice.h:1010
Int getNumRefIdx(RefPicList e) const
Definition: TComSlice.h:1370
Void setEntropyCodingSyncEnabledFlag(Bool val)
Definition: TComSlice.h:1152
Void setIntraConstraintFlag(Bool b)
Definition: TComSlice.h:240
ProfileTierLevel * getSubLayerPTL(Int i)
Definition: TComSlice.h:267
Void setTimeScale(UInt value)
Definition: TComSlice.h:413
Void setNalHrdParametersPresentFlag(Bool flag)
Definition: TComSlice.h:323
Bool getSubLayerProfilePresentFlag(Int i) const
Definition: TComSlice.h:259
Bool getRefPicListModificationFlagL1() const
Definition: TComSlice.h:962
Void xParsePredWeightTable(TComSlice *pcSlice, const TComSPS *sps)
parse explicit wp tables
Definition: TDecCAVLC.cpp:1824
Bool getSaoEnabledFlag(ChannelType chType) const
Definition: TComSlice.h:1339
Void setRefPicListModificationFlagL1(Bool flag)
Definition: TComSlice.h:963
Bool getLongTermRefsPresent() const
Definition: TComSlice.h:885
Void setSPSId(Int i)
Definition: TComSlice.h:1095
Void setBitsForPOC(UInt u)
Definition: TComSlice.h:868
Void setChromaFormatIdc(ChromaFormat i)
Definition: TComSlice.h:827
Void setCpbSizeScale(UInt value)
Definition: TComSlice.h:347
Void setTileUniformSpacingFlag(Bool b)
Definition: TComSlice.h:1156
char TChar
Definition: TypeDef.h:206
TComInputBitstream * m_pcBitstream
TComVUI * getVuiParameters()
Definition: TComSlice.h:936
Void setFieldSeqFlag(Bool i)
Definition: TComSlice.h:638
Void setUsedByCurrPicLtSPSFlag(Int i, Bool x)
Definition: TComSlice.h:849
Void setDuCpbRemovalDelayLengthMinus1(UInt value)
Definition: TComSlice.h:335
Void setLog2MaxMvLengthVertical(Int i)
Definition: TComSlice.h:675
Bool isInterB() const
Definition: TComSlice.h:1424
Bool getTilesEnabledFlag() const
Definition: TComSlice.h:1155
Void setLFCrossSliceBoundaryFlag(Bool val)
Definition: TComSlice.h:1532
static const Int MAX_VPS_OP_SETS_PLUS1
Definition: CommonDef.h:144
Void setRestrictedRefPicListsFlag(Bool b)
Definition: TComSlice.h:660
Void setInterRPSPrediction(Bool flag)
Definition: TComSlice.h:113
Void setAspectRatioIdc(Int i)
Definition: TComSlice.h:590
Void setWindowBottomOffset(Int val)
Definition: TypeDef.h:932
Void setSignDataHidingEnabledFlag(Bool b)
Definition: TComSlice.h:1167
Void setRefPicListModificationFlagL0(Bool flag)
Definition: TComSlice.h:961
Void setVPSId(Int i)
Definition: TComSlice.h:823
UInt getLtRefPicPocLsbSps(UInt index) const
Definition: TComSlice.h:845
Bool getDependentSliceSegmentFlag() const
Definition: TComSlice.h:1357
Void setPOC(Int bufferNum, Int deltaPOC)
Definition: TComSlice.cpp:1685
Void parseMvd(TComDataCU *pcCU, UInt uiAbsPartAddr, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList)
Definition: TDecCAVLC.cpp:1764
Void setLog2DiffMaxMinCodingBlockSize(Int val)
Definition: TComSlice.h:854
Void setSliceChromaQpFlag(Bool b)
Definition: TComSlice.h:1104
Void setRefIdc(Int bufferNum, Int refIdc)
set the reference idc value at uiBufferNum entry to the value of iRefIdc
Definition: TComSlice.cpp:1701
Void setPocProportionalToTimingFlag(Bool x)
Definition: TComSlice.h:416
ProfileTierLevel * getGeneralPTL()
Definition: TComSlice.h:265
Bool getListsModificationPresentFlag() const
Definition: TComSlice.h:1186
Bool getLoopFilterAcrossSlicesEnabledFlag() const
Definition: TComSlice.h:1193
Void setDeblockingFilterBetaOffsetDiv2(Int val)
set beta offset for deblocking filter
Definition: TComSlice.h:1178
Void parseTransformSubdivFlag(UInt &ruiSubdivFlag, UInt uiLog2TransformBlockSize)
Definition: TDecCAVLC.cpp:1789
static Void checkRange(const T &, const TChar *, const T &, const T &)
Void parseIntraDirChroma(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecCAVLC.cpp:1749
Void setNonPackedConstraintFlag(Bool b)
Definition: TComSlice.h:228
CAVLC decoder class (header)
Void setMaxDecPicBuffering(UInt v, UInt tLayer)
Definition: TComSlice.h:492
Void setSliceType(SliceType e)
Definition: TComSlice.h:1397
UInt getNumRefIdxL1DefaultActive() const
Definition: TComSlice.h:1132
Void parseSplitFlag(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecCAVLC.cpp:1716
Void setTileColumnWidth(const std::vector< Int > &columnWidth)
Definition: TComSlice.h:1160
Void setLevelIdc(Level::Name x)
Definition: TComSlice.h:219
Void setLayerIdIncludedFlag(Bool v, UInt opsIdx, UInt id)
Definition: TComSlice.h:507
Void setQuadtreeTULog2MinSize(UInt u)
Definition: TComSlice.h:874
UInt getMaxOpSets() const
Definition: TComSlice.h:504
Void setNumberOfPositivePictures(Int number)
Definition: TComSlice.h:108
UInt numEmulationPreventionBytesRead()
Void setTilesFixedStructureFlag(Bool i)
Definition: TComSlice.h:654
Void parseMergeIndex(TComDataCU *pcCU, UInt &ruiMergeIndex)
Definition: TDecCAVLC.cpp:1814
Void setDpbOutputDelayDuLengthMinus1(UInt value)
Definition: TComSlice.h:341
Void clearChromaQpOffsetList()
Definition: TComSlice.h:1004
Void setMaxLatencyIncrease(UInt v, UInt tLayer)
Definition: TComSlice.h:495
Bool getSubLayerLevelPresentFlag(Int i) const
Definition: TComSlice.h:262
Void setWindowRightOffset(Int val)
Definition: TypeDef.h:928
Int getQpBDOffset(ChannelType type) const
Definition: TComSlice.h:904
TComScalingList & getScalingList()
Definition: TComSlice.h:1184
Void setScalingListDC(UInt sizeId, UInt listId, UInt u)
set DC value
Definition: TComSlice.h:165
Void parsePPS(TComPPS *pcPPS)
Definition: TDecCAVLC.cpp:187
Void setOverscanInfoPresentFlag(Bool i)
Definition: TComSlice.h:599
bool Bool
Definition: TypeDef.h:204
Bool getUseTransformSkip() const
Definition: TComSlice.h:1144
Void setLog2ParallelMergeLevelMinus2(UInt mrgLevel)
Definition: TComSlice.h:1189
Void parseMVPIdx(Int &riMVPIdx)
Definition: TDecCAVLC.cpp:1711
Bool getSubPicCpbParamsPresentFlag() const
Definition: TComSlice.h:330
Void setBitRateValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl, UInt value)
Definition: TComSlice.h:376
TComReferencePictureSet * getReferencePictureSet(Int referencePictureSetNum)
Definition: TComSlice.h:143
Void setVclHrdParametersPresentFlag(Bool flag)
Definition: TComSlice.h:326
static const Int MAX_MATRIX_COEF_NUM
max coefficient number for quantization matrix
Definition: CommonDef.h:235
Void setPicDurationInTcMinus1(Int layer, UInt value)
Definition: TComSlice.h:367
Void setCbrFlag(Int layer, Int cpbcnt, Int nalOrVcl, Bool value)
Definition: TComSlice.h:385
Bool getRefPicListModificationFlagL0() const
Definition: TComSlice.h:960
#define READ_SVLC_CHK(code, name, minValIncl, maxValIncl)
Void setProfileSpace(Int x)
Definition: TComSlice.h:207
Bool getColourDescriptionPresentFlag() const
Definition: TComSlice.h:613
PPS class.
Definition: TComSlice.h:1034
Void setLog2MaxTransformSkipBlockSize(UInt u)
Definition: TComSlice.h:999
Void parseProfileTier(ProfileTierLevel *ptl, const Bool bIsSubLayer)
Definition: TDecCAVLC.cpp:1588
Void setVPSId(Int i)
Definition: TComSlice.h:478
Bool getOverscanInfoPresentFlag() const
Definition: TComSlice.h:598
Void setColourPrimaries(Int i)
Definition: TComSlice.h:617
Void parseHrdParameters(TComHRD *hrd, Bool cprms_present_flag, UInt tempLevelHigh)
Definition: TDecCAVLC.cpp:512
Void parseShortTermRefPicSet(TComSPS *pcSPS, TComReferencePictureSet *pcRPS, Int idx)
Definition: TDecCAVLC.cpp:91
UInt getPicHeightInLumaSamples() const
Definition: TComSlice.h:836
Void setMaxTLayers(UInt uiMaxTLayers)
Definition: TComSlice.h:911
Void setWindowTopOffset(Int val)
Definition: TypeDef.h:930
up-right diagonal scan
Definition: TypeDef.h:475
Void setUseSAO(Bool bVal)
Definition: TComSlice.h:907
UInt uiLog2WeightDenom
Definition: TComSlice.h:1206
TimingInfo * getTimingInfo()
Definition: TComSlice.h:511
Void parseRefFrmIdx(TComDataCU *pcCU, Int &riRefFrmIdx, RefPicList eRefList)
Definition: TDecCAVLC.cpp:1759
Void setProfileCompatibilityFlag(Int i, Bool x)
Definition: TComSlice.h:216
Int getDeltaPOC(Int bufferNum) const
Definition: TComSlice.cpp:1670
UInt getPCMLog2MinSize() const
Definition: TComSlice.h:867
Void setMaxTLayers(UInt t)
Definition: TComSlice.h:481
Void setScalingListPresentFlag(Bool b)
Definition: TComSlice.h:923
Int getAspectRatioIdc() const
Definition: TComSlice.h:589
Void setLog2MaxMvLengthHorizontal(Int i)
Definition: TComSlice.h:672
Bool getPocProportionalToTimingFlag() const
Definition: TComSlice.h:417
T Clip3(const T minVal, const T maxVal, const T a)
general min/max clip
Definition: CommonDef.h:252
UInt getMaxLatencyIncreasePlus1(UInt tlayer) const
Definition: TComSlice.h:928
Reference Picture Set set class.
Definition: TComSlice.h:130
UInt * g_scanOrder[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER_OF_TYPES][MAX_CU_DEPTH][MAX_CU_DEPTH]
Definition: TComRom.cpp:587
Void setTileRowHeight(const std::vector< Int > &rowHeight)
Definition: TComSlice.h:1164
Void setHrdParametersPresentFlag(Bool i)
Definition: TComSlice.h:648
reference list 0
Definition: TypeDef.h:372
Int getBitDepth(ChannelType type) const
Definition: TComSlice.h:894
Void setDeblockingFilterOverrideFlag(Bool b)
Definition: TComSlice.h:1406
Void setNumTicksPocDiffOneMinus1(Int x)
Definition: TComSlice.h:419
Bool getTemporalNestingFlag() const
Definition: TComSlice.h:486
Bool getUseDQP() const
Definition: TComSlice.h:1099
Void setTilesEnabledFlag(Bool val)
Definition: TComSlice.h:1154
static UInt getMinLog2CtbSize(const TComPTL &ptl, UInt layerPlus1=0)
UInt getNumLongTermRefPicSPS() const
Definition: TComSlice.h:842
RefPicList
reference list index
Definition: TypeDef.h:370
Bool getColFromL0Flag() const
Definition: TComSlice.h:1377
Void setSliceCurEndCtuTsAddr(UInt ctuTsAddr)
Definition: TComSlice.h:1482
Void setUseStrongIntraSmoothing(Bool bVal)
Definition: TComSlice.h:931
Bool getEnableTMVPFlag() const
Definition: TComSlice.h:1536
const TComPTL * getPTL() const
Definition: TComSlice.h:938
Void parseIPCMInfo(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecCAVLC.cpp:1739
Void getWpScaling(RefPicList e, Int iRefIdx, WPScalingParam *&wp)
get tables for weighted prediction
Definition: TComSlice.cpp:1405
ChromaFormat
chroma formats (according to semantics of chroma_format_idc)
Definition: TypeDef.h:292
Void setCheckLTMSBPresent(Int bufferNum, Bool b)
Definition: TComSlice.cpp:1695
Void setScalingListFlag(Bool b)
Definition: TComSlice.h:921
Bool getTimingInfoPresentFlag() const
Definition: TComSlice.h:408
unsigned char UChar
Definition: TypeDef.h:208
UInt getQuadtreeTULog2MinSize() const
Definition: TComSlice.h:875
Void setPCMBitDepth(ChannelType type, UInt u)
Definition: TComSlice.h:916
const UInt g_scalingListSize[SCALING_LIST_SIZE_NUM]
Definition: TComRom.cpp:692
Bool getAspectRatioInfoPresentFlag() const
Definition: TComSlice.h:586
Void setNumberOfPictures(Int numberOfPictures)
Definition: TComSlice.cpp:1660
Void setMaxNuhReservedZeroLayerId(UInt v)
Definition: TComSlice.h:502
UInt getNumRefIdxL0DefaultActive() const
Definition: TComSlice.h:1130
Void parseScalingList(TComScalingList *scalingList)
Definition: TDecCAVLC.cpp:1946
Int getDeblockingFilterBetaOffsetDiv2() const
get beta offset for deblocking filter
Definition: TComSlice.h:1179
UInt getPicWidthInLumaSamples() const
Definition: TComSlice.h:834
Void setQpBDOffset(ChannelType type, Int i)
Definition: TComSlice.h:905
Void setMaxTrSize(UInt u)
Definition: TComSlice.h:890
Void setSliceChromaQpDelta(ComponentID compID, Int i)
Definition: TComSlice.h:1403
Void setMaxNumMergeCand(UInt val)
Definition: TComSlice.h:1464
Bool getIdrPicFlag() const
Definition: TComSlice.h:1393
Void parseTransformSkipFlags(class TComTU &rTu, ComponentID component)
Definition: TDecCAVLC.cpp:1804
Void setExtendedPrecisionProcessingFlag(Bool value)
Definition: TComSlice.h:724
Void setCpbCntMinus1(Int layer, UInt value)
Definition: TComSlice.h:373
Profile::Name getProfileIdc() const
Definition: TComSlice.h:212
#define PTL_TRACE_TEXT(txt)
Void parseDeltaQP(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecCAVLC.cpp:1774
Void parsePredMode(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecCAVLC.cpp:1726
Void parseMergeFlag(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx)
Definition: TDecCAVLC.cpp:1809
Bool getUseWP() const
Definition: TComSlice.h:1134
Bool getProfileCompatibilityFlag(Int i) const
Definition: TComSlice.h:215
Bool isIntra() const
Definition: TComSlice.h:1423
#define READ_FLAG(code, name)
Bool getScalingListPresentFlag() const
Definition: TComSlice.h:1182
Void setProfileIdc(Profile::Name x)
Definition: TComSlice.h:213
Name
Definition: TypeDef.h:599
Void initWpScaling(const TComSPS *sps)
init WP table
Definition: TComSlice.cpp:1432
reference list 1
Definition: TypeDef.h:373
Void setHighPrecisionOffsetsEnabledFlag(Bool value)
Definition: TComSlice.h:730
Void setFrameFieldInfoPresentFlag(Bool i)
Definition: TComSlice.h:641
Void setPCMLog2MinSize(UInt u)
Definition: TComSlice.h:866
#define READ_UVLC(code, name)
Int getPOC() const
Definition: TComSlice.h:1354
Void parseSkipFlag(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecCAVLC.cpp:1701
Bool getDeblockingFilterControlPresentFlag() const
Definition: TComSlice.h:1173
Void setAspectRatioInfoPresentFlag(Bool i)
Definition: TComSlice.h:587
Bool getEntropyCodingSyncEnabledFlag() const
Definition: TComSlice.h:1151
Void setSPSTemporalMVPEnabledFlag(Bool b)
Definition: TComSlice.h:888
TimingInfo * getTimingInfo()
Definition: TComSlice.h:680
TComPTL * getPTL()
Definition: TComSlice.h:509
Void setListsModificationPresentFlag(Bool b)
Definition: TComSlice.h:1187
Void setHrdOpSetIdx(UInt val, UInt i)
Definition: TComSlice.h:473
Void setWindowLeftOffset(Int val)
Definition: TypeDef.h:926
#define READ_UVLC_CHK(code, name, minValIncl, maxValIncl)
static const Int MAX_TLAYER
Explicit temporal layer QP offset - max number of temporal layer.
Definition: CommonDef.h:134
Void setMaxDecPicBuffering(UInt ui, UInt tlayer)
Definition: TComSlice.h:927
Bool getVideoSignalTypePresentFlag() const
Definition: TComSlice.h:604
Void setProgressiveSourceFlag(Bool b)
Definition: TComSlice.h:222
Bool getUsePCM() const
Definition: TComSlice.h:863
Bool getScalingListFlag() const
Definition: TComSlice.h:920
Void setUsePCM(Bool b)
Definition: TComSlice.h:862
Void setLongTermRefsPresent(Bool b)
Definition: TComSlice.h:886
Void setOnePictureOnlyConstraintFlag(Bool b)
Definition: TComSlice.h:243
Void setWPBiPred(Bool b)
Definition: TComSlice.h:1137
Void setDpbOutputDelayLengthMinus1(UInt value)
Definition: TComSlice.h:358
Void setPOC(Int i)
Definition: TComSlice.h:1389
Definition: TComTU.h:48
Void setCabacInitFlag(Bool val)
set CABAC initial flag
Definition: TComSlice.h:1528
Void setNumTileRowsMinus1(Int i)
Definition: TComSlice.h:1162
Int getNumberOfReferencePictureSets() const
Definition: TComSlice.h:146
Void setInterlacedSourceFlag(Bool b)
Definition: TComSlice.h:225
Void setNumRefIdxL1DefaultActive(UInt ui)
Definition: TComSlice.h:1131
Void setSubPicCpbParamsInPicTimingSEIFlag(Bool flag)
Definition: TComSlice.h:338
Void setNumUnitsInTick(UInt value)
Definition: TComSlice.h:410
Void setQuadtreeTUMaxDepthIntra(UInt u)
Definition: TComSlice.h:877
Bool getFixedPicRateWithinCvsFlag(Int layer) const
Definition: TComSlice.h:365
Void setBitstreamRestrictionFlag(Bool i)
Definition: TComSlice.h:651
TComPPS * getPPS(Int ppsId)
get pointer to existing picture parameter set
Definition: TComSlice.h:1692
Void createHrdParamBuffer()
Definition: TComSlice.h:463
Void setChromaLocInfoPresentFlag(Bool i)
Definition: TComSlice.h:626
Void setMotionVectorsOverPicBoundariesFlag(Bool i)
Definition: TComSlice.h:657
Void setCpbSizeValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl, UInt value)
Definition: TComSlice.h:379
Void setTransferCharacteristics(Int i)
Definition: TComSlice.h:620
Void readByte(UInt &ruiBits)
Int getNumberOfNegativePictures() const
Definition: TComSlice.h:107
Void setLoopFilterAcrossSlicesEnabledFlag(Bool bValue)
Definition: TComSlice.h:1192
Void setBitRateScale(UInt value)
Definition: TComSlice.h:344
Bool getDependentSliceSegmentsEnabledFlag() const
Definition: TComSlice.h:1149
Int getQpOffset(ComponentID compID) const
Definition: TComSlice.h:1124
slice decoder class (header)
static Int getWinUnitX(Int chromaFormatIdc)
Definition: TComSlice.h:829
Void setRefMatrixId(UInt sizeId, UInt listId, UInt u)
set reference matrix ID
Definition: TComSlice.h:159
Void setCabacBypassAlignmentEnabledFlag(const Bool value)
Definition: TComSlice.h:736
Void setNumRefIdxL0DefaultActive(UInt ui)
Definition: TComSlice.h:1129
Void createRPSList(Int numRPS)
Definition: TComSlice.cpp:1566
Void setDeblockingFilterControlPresentFlag(Bool val)
Definition: TComSlice.h:1172
Void setFixedPicRateWithinCvsFlag(Int layer, Bool flag)
Definition: TComSlice.h:364
Void setDuBitRateValueMinus1(Int layer, Int cpbcnt, Int nalOrVcl, UInt value)
Definition: TComSlice.h:383
Void setTimingInfoPresentFlag(Bool flag)
Definition: TComSlice.h:407
Void setLowDelayHrdFlag(Int layer, Bool flag)
Definition: TComSlice.h:370
Void setVideoFormat(Int i)
Definition: TComSlice.h:608
UInt getMaxDecPicBuffering(UInt tLayer) const
Definition: TComSlice.h:493
Bool getSliceHeaderExtensionPresentFlag() const
Definition: TComSlice.h:1194
Bool getChromaLocInfoPresentFlag() const
Definition: TComSlice.h:625
Void setLog2MinCodingBlockSize(Int val)
Definition: TComSlice.h:852
Void setOutputFlagPresentFlag(Bool b)
Definition: TComSlice.h:1139
TComScalingList & getScalingList()
Definition: TComSlice.h:924
Int getNumberOfPictures() const
Definition: TComSlice.cpp:1675
Void setNumExtraSliceHeaderBits(Int i)
Definition: TComSlice.h:1191
Void setLoopFilterAcrossTilesEnabledFlag(Bool b)
Definition: TComSlice.h:1147
int Int
Definition: TypeDef.h:211
Window & getConformanceWindow()
Definition: TComSlice.h:838
Void setVuiParametersPresentFlag(Bool b)
Definition: TComSlice.h:935
const char data[10]
Bool getBitstreamRestrictionFlag() const
Definition: TComSlice.h:650
Void setSliceSegmentCurStartCtuTsAddr(UInt ctuTsAddr)
Definition: TComSlice.h:1491
Bool xMoreRbspData()
Definition: TDecCAVLC.cpp:2027
static UInt getMaxCUDepthOffset(const ChromaFormat chFmt, const UInt quadtreeTULog2MinSize)
Void setPicWidthInLumaSamples(UInt u)
Definition: TComSlice.h:833
UInt getMaxTLayers() const
Definition: TComSlice.h:910
TComSPS * getSPS(Int spsId)
get pointer to existing sequence parameter set
Definition: TComSlice.h:1684
ComponentID
Definition: TypeDef.h:308
Void setPPSDeblockingFilterDisabledFlag(Bool val)
set offset for deblocking filter disabled
Definition: TComSlice.h:1176
Int getNumRpsCurrTempList() const
Definition: TComSlice.cpp:469
SPSExtensionFlagIndex
Definition: TypeDef.h:645
Int getSliceChromaQpDelta(ComponentID compID) const
Definition: TComSlice.h:1363
Bool getRapPicFlag() const
Definition: TComSlice.cpp:179
Int getSliceQp() const
Definition: TComSlice.h:1355
Void setSubPicCpbParamsPresentFlag(Bool flag)
Definition: TComSlice.h:329
Bool getTileUniformSpacingFlag() const
Definition: TComSlice.h:1157
Void setNumLongTermRefPicSPS(UInt val)
Definition: TComSlice.h:843
Void setTickDivisorMinus2(UInt value)
Definition: TComSlice.h:332
Void parseCUTransquantBypassFlag(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecCAVLC.cpp:1706
Void setRdpcmEnabledFlag(const RDPCMSignallingMode signallingMode, const Bool value)
Definition: TComSlice.h:721
Int getWindowRightOffset() const
Definition: TypeDef.h:927
UInt getCpbCntMinus1(Int layer) const
Definition: TComSlice.h:374
Void setPCMLog2MaxSize(UInt u)
Definition: TComSlice.h:864
Int getNumberOfLongtermPictures() const
Definition: TComSlice.h:111
Void setLog2SaoOffsetScale(ChannelType type, UInt uiBitShift)
Definition: TComSlice.h:1028
UInt getNumReorderPics(UInt tLayer) const
Definition: TComSlice.h:490
Bool getDeblockingFilterOverrideFlag() const
Definition: TComSlice.h:1366
#define READ_CODE_CHK(length, code, name, minValIncl, maxValIncl)
Void setUseChromaQpAdj(Bool b)
Definition: TComSlice.h:1404
UInt peekBits(UInt uiBits)
Void setBitDepthConstraint(UInt bitDepth)
Definition: TComSlice.h:234
Void setOverscanAppropriateFlag(Bool i)
Definition: TComSlice.h:602
Bool getChromaQpOffsetListEnabledFlag() const
Definition: TComSlice.h:1009
Void setChromaQpOffsetListEntry(Int cuChromaQpOffsetIdxPlus1, Int cbOffset, Int crOffset)
Definition: TComSlice.h:1018
Void setDeblockingFilterDisable(Bool b)
Definition: TComSlice.h:1405
Void setDeblockingFilterOverrideEnabledFlag(Bool val)
Definition: TComSlice.h:1174
Void setDeblockingFilterTcOffsetDiv2(Int val)
set tc offset for deblocking filter
Definition: TComSlice.h:1180
Void setConstrainedIntraPred(Bool b)
Definition: TComSlice.h:1102
Reference Picture Set class.
Definition: TComSlice.h:65
Bool getDeblockingFilterDisable() const
Definition: TComSlice.h:1365
static UInt getNumberValidComponents(const ChromaFormat fmt)
SPS RExt class.
Definition: TComSlice.h:685
NalUnitType getNalUnitType() const
Definition: TComSlice.h:1391
slice header class
Definition: TComSlice.h:1225
Void setNumRefIdx(RefPicList e, Int i)
Definition: TComSlice.h:1412
TComHRD * getHrdParameters(UInt i)
Definition: TComSlice.h:470
Bool getWPBiPred() const
Definition: TComSlice.h:1135
static const Int MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1
Definition: CommonDef.h:145
Void setPicOutputFlag(Bool b)
Definition: TComSlice.h:1336
Decoder conformance functions (header)
Void setBitDepth(ChannelType type, Int u)
Definition: TComSlice.h:895
Int getDeblockingFilterTcOffsetDiv2() const
get tc offset for deblocking filter
Definition: TComSlice.h:1181
Void setMvdL1ZeroFlag(Bool b)
Definition: TComSlice.h:1421
Void setTemporalNestingFlag(Bool t)
Definition: TComSlice.h:487
Void setNeutralChromaIndicationFlag(Bool i)
Definition: TComSlice.h:635
Void setSliceQp(Int i)
Definition: TComSlice.h:1398
static Void IncrementStatisticEP(const TComCodingStatisticsClassType &stat, const Int numBits, const Int value)
Void setSubLayerLevelPresentFlag(Int i, Bool x)
Definition: TComSlice.h:263
virtual ~TDecCavlc()
Definition: TDecCAVLC.cpp:82
reading funtionality for SEI messages
PPS RExt class.
Definition: TComSlice.h:973
Void setIntraSmoothingDisabledFlag(Bool bValue)
Definition: TComSlice.h:727
Bool getDeblockingFilterOverrideEnabledFlag() const
Definition: TComSlice.h:1175
Void setTemporalIdNestingFlag(Bool bValue)
Definition: TComSlice.h:914
UInt getRefMatrixId(UInt sizeId, UInt listId) const
get reference matrix ID
Definition: TComSlice.h:160
Void setMaxOpSets(UInt v)
Definition: TComSlice.h:505
TComReferencePictureSet * getLocalRPS()
Definition: TComSlice.h:1342
TComHRD * getHrdParameters()
Definition: TComSlice.h:677
Bool getVuiParametersPresentFlag() const
Definition: TComSlice.h:934
Void setNumberOfLongtermPictures(Int number)
Definition: TComSlice.h:110
Void setInitialCpbRemovalDelayLengthMinus1(UInt value)
Definition: TComSlice.h:352
Void parseSliceHeader(TComSlice *pcSlice, ParameterSetManager *parameterSetManager, const Int prevTid0POC)
Definition: TDecCAVLC.cpp:957
Void setUseTransformSkip(Bool b)
Definition: TComSlice.h:1145
Void setPicInitQPMinus26(Int i)
Definition: TComSlice.h:1098
Void parseTerminatingBit(UInt &ruiBit)
Definition: TDecCAVLC.cpp:1666
Void setSarWidth(Int i)
Definition: TComSlice.h:593
Int getNumReorderPics(UInt tlayer) const
Definition: TComSlice.h:881
Void setNumRefIdc(Int x)
Definition: TComSlice.h:119
UInt getMaxCUWidth() const
Definition: TComSlice.h:857
Bool getOutputFlagPresentFlag() const
Definition: TComSlice.h:1140
Void setSliceHeaderExtensionPresentFlag(Bool val)
Definition: TComSlice.h:1195
Void parseChromaQpAdjustment(TComDataCU *cu, UInt absPartIdx, UInt depth)
Definition: TDecCAVLC.cpp:1779
SPS class.
Definition: TComSlice.h:740
Bool getHighPrecisionOffsetsEnabledFlag() const
Definition: TComSlice.h:729
static const Int MAX_QP_OFFSET_LIST_SIZE
Maximum size of QP offset list is 6 entries.
Definition: CommonDef.h:207
Void parsePartSize(TComDataCU *pcCU, UInt uiAbsPartIdx, UInt uiDepth)
Definition: TDecCAVLC.cpp:1721