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-2015, 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 | |
---|
34 | /** \file TDecCAVLC.cpp |
---|
35 | \brief CAVLC decoder class |
---|
36 | */ |
---|
37 | |
---|
38 | #include "TDecCAVLC.h" |
---|
39 | #include "SEIread.h" |
---|
40 | #include "TDecSlice.h" |
---|
41 | #include "TLibCommon/TComChromaFormat.h" |
---|
42 | #if RExt__DECODER_DEBUG_BIT_STATISTICS |
---|
43 | #include "TLibCommon/TComCodingStatistics.h" |
---|
44 | #endif |
---|
45 | #if NH_MV |
---|
46 | #include "TDecTop.h" |
---|
47 | #endif |
---|
48 | |
---|
49 | //! \ingroup TLibDecoder |
---|
50 | //! \{ |
---|
51 | |
---|
52 | #if ENC_DEC_TRACE |
---|
53 | #if !H_MV_ENC_DEC_TRAC |
---|
54 | Void xTraceVPSHeader () |
---|
55 | { |
---|
56 | fprintf( g_hTrace, "=========== Video Parameter Set ===========\n" ); |
---|
57 | } |
---|
58 | |
---|
59 | Void xTraceSPSHeader () |
---|
60 | { |
---|
61 | fprintf( g_hTrace, "=========== Sequence Parameter Set ===========\n" ); |
---|
62 | } |
---|
63 | |
---|
64 | Void xTracePPSHeader () |
---|
65 | { |
---|
66 | fprintf( g_hTrace, "=========== Picture Parameter Set ===========\n"); |
---|
67 | } |
---|
68 | #endif |
---|
69 | #endif |
---|
70 | // ==================================================================================================================== |
---|
71 | // Constructor / destructor / create / destroy |
---|
72 | // ==================================================================================================================== |
---|
73 | |
---|
74 | TDecCavlc::TDecCavlc() |
---|
75 | { |
---|
76 | } |
---|
77 | |
---|
78 | TDecCavlc::~TDecCavlc() |
---|
79 | { |
---|
80 | |
---|
81 | } |
---|
82 | |
---|
83 | // ==================================================================================================================== |
---|
84 | // Public member functions |
---|
85 | // ==================================================================================================================== |
---|
86 | |
---|
87 | Void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComReferencePictureSet* rps, Int idx ) |
---|
88 | { |
---|
89 | UInt code; |
---|
90 | UInt interRPSPred; |
---|
91 | if (idx > 0) |
---|
92 | { |
---|
93 | READ_FLAG(interRPSPred, "inter_ref_pic_set_prediction_flag"); rps->setInterRPSPrediction(interRPSPred); |
---|
94 | } |
---|
95 | else |
---|
96 | { |
---|
97 | interRPSPred = false; |
---|
98 | rps->setInterRPSPrediction(false); |
---|
99 | } |
---|
100 | |
---|
101 | if (interRPSPred) |
---|
102 | { |
---|
103 | UInt bit; |
---|
104 | if(idx == sps->getRPSList()->getNumberOfReferencePictureSets()) |
---|
105 | { |
---|
106 | READ_UVLC(code, "delta_idx_minus1" ); // delta index of the Reference Picture Set used for prediction minus 1 |
---|
107 | } |
---|
108 | else |
---|
109 | { |
---|
110 | code = 0; |
---|
111 | } |
---|
112 | 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 |
---|
113 | Int rIdx = idx - 1 - code; |
---|
114 | 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 |
---|
115 | TComReferencePictureSet* rpsRef = sps->getRPSList()->getReferencePictureSet(rIdx); |
---|
116 | Int k = 0, k0 = 0, k1 = 0; |
---|
117 | READ_CODE(1, bit, "delta_rps_sign"); // delta_RPS_sign |
---|
118 | READ_UVLC(code, "abs_delta_rps_minus1"); // absolute delta RPS minus 1 |
---|
119 | Int deltaRPS = (1 - 2 * bit) * (code + 1); // delta_RPS |
---|
120 | for(Int j=0 ; j <= rpsRef->getNumberOfPictures(); j++) |
---|
121 | { |
---|
122 | READ_CODE(1, bit, "used_by_curr_pic_flag" ); //first bit is "1" if Idc is 1 |
---|
123 | Int refIdc = bit; |
---|
124 | if (refIdc == 0) |
---|
125 | { |
---|
126 | READ_CODE(1, bit, "use_delta_flag" ); //second bit is "1" if Idc is 2, "0" otherwise. |
---|
127 | refIdc = bit<<1; //second bit is "1" if refIdc is 2, "0" if refIdc = 0. |
---|
128 | } |
---|
129 | if (refIdc == 1 || refIdc == 2) |
---|
130 | { |
---|
131 | Int deltaPOC = deltaRPS + ((j < rpsRef->getNumberOfPictures())? rpsRef->getDeltaPOC(j) : 0); |
---|
132 | rps->setDeltaPOC(k, deltaPOC); |
---|
133 | rps->setUsed(k, (refIdc == 1)); |
---|
134 | |
---|
135 | if (deltaPOC < 0) |
---|
136 | { |
---|
137 | k0++; |
---|
138 | } |
---|
139 | else |
---|
140 | { |
---|
141 | k1++; |
---|
142 | } |
---|
143 | k++; |
---|
144 | } |
---|
145 | rps->setRefIdc(j,refIdc); |
---|
146 | } |
---|
147 | rps->setNumRefIdc(rpsRef->getNumberOfPictures()+1); |
---|
148 | rps->setNumberOfPictures(k); |
---|
149 | rps->setNumberOfNegativePictures(k0); |
---|
150 | rps->setNumberOfPositivePictures(k1); |
---|
151 | rps->sortDeltaPOC(); |
---|
152 | } |
---|
153 | else |
---|
154 | { |
---|
155 | READ_UVLC(code, "num_negative_pics"); rps->setNumberOfNegativePictures(code); |
---|
156 | READ_UVLC(code, "num_positive_pics"); rps->setNumberOfPositivePictures(code); |
---|
157 | Int prev = 0; |
---|
158 | Int poc; |
---|
159 | for(Int j=0 ; j < rps->getNumberOfNegativePictures(); j++) |
---|
160 | { |
---|
161 | READ_UVLC(code, "delta_poc_s0_minus1"); |
---|
162 | poc = prev-code-1; |
---|
163 | prev = poc; |
---|
164 | rps->setDeltaPOC(j,poc); |
---|
165 | READ_FLAG(code, "used_by_curr_pic_s0_flag"); rps->setUsed(j,code); |
---|
166 | } |
---|
167 | prev = 0; |
---|
168 | for(Int j=rps->getNumberOfNegativePictures(); j < rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); j++) |
---|
169 | { |
---|
170 | READ_UVLC(code, "delta_poc_s1_minus1"); |
---|
171 | poc = prev+code+1; |
---|
172 | prev = poc; |
---|
173 | rps->setDeltaPOC(j,poc); |
---|
174 | READ_FLAG(code, "used_by_curr_pic_s1_flag"); rps->setUsed(j,code); |
---|
175 | } |
---|
176 | rps->setNumberOfPictures(rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures()); |
---|
177 | } |
---|
178 | #if PRINT_RPS_INFO |
---|
179 | rps->printDeltaPOC(); |
---|
180 | #endif |
---|
181 | } |
---|
182 | |
---|
183 | Void TDecCavlc::parsePPS(TComPPS* pcPPS) |
---|
184 | { |
---|
185 | #if ENC_DEC_TRACE |
---|
186 | #if H_MV_ENC_DEC_TRAC |
---|
187 | tracePSHeader( "PPS", pcPPS->getLayerId() ); |
---|
188 | #else |
---|
189 | xTracePPSHeader (); |
---|
190 | #endif |
---|
191 | #endif |
---|
192 | UInt uiCode; |
---|
193 | |
---|
194 | Int iCode; |
---|
195 | |
---|
196 | READ_UVLC( uiCode, "pps_pic_parameter_set_id"); |
---|
197 | assert(uiCode <= 63); |
---|
198 | pcPPS->setPPSId (uiCode); |
---|
199 | |
---|
200 | READ_UVLC( uiCode, "pps_seq_parameter_set_id"); |
---|
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_flag" ); pcPPS->setSignHideFlag( uiCode ); |
---|
211 | |
---|
212 | READ_FLAG( uiCode, "cabac_init_present_flag" ); pcPPS->setCabacInitPresentFlag( uiCode ? true : false ); |
---|
213 | |
---|
214 | READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1"); |
---|
215 | assert(uiCode <= 14); |
---|
216 | pcPPS->setNumRefIdxL0DefaultActive(uiCode+1); |
---|
217 | |
---|
218 | READ_UVLC(uiCode, "num_ref_idx_l1_default_active_minus1"); |
---|
219 | assert(uiCode <= 14); |
---|
220 | pcPPS->setNumRefIdxL1DefaultActive(uiCode+1); |
---|
221 | |
---|
222 | READ_SVLC(iCode, "init_qp_minus26" ); 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( iCode, "pps_cb_qp_offset"); |
---|
238 | pcPPS->setQpOffset(COMPONENT_Cb, iCode); |
---|
239 | assert( pcPPS->getQpOffset(COMPONENT_Cb) >= -12 ); |
---|
240 | assert( pcPPS->getQpOffset(COMPONENT_Cb) <= 12 ); |
---|
241 | |
---|
242 | READ_SVLC( iCode, "pps_cr_qp_offset"); |
---|
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_enable_flag"); |
---|
258 | pcPPS->setTransquantBypassEnableFlag(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 | |
---|
296 | if ((tileColumnsMinus1 + tileRowsMinus1) != 0) |
---|
297 | { |
---|
298 | READ_FLAG ( uiCode, "loop_filter_across_tiles_enabled_flag" ); pcPPS->setLoopFilterAcrossTilesEnabledFlag( uiCode ? true : false ); |
---|
299 | } |
---|
300 | } |
---|
301 | READ_FLAG( uiCode, "pps_loop_filter_across_slices_enabled_flag" ); pcPPS->setLoopFilterAcrossSlicesEnabledFlag( uiCode ? true : false ); |
---|
302 | READ_FLAG( uiCode, "deblocking_filter_control_present_flag" ); pcPPS->setDeblockingFilterControlPresentFlag( uiCode ? true : false ); |
---|
303 | if(pcPPS->getDeblockingFilterControlPresentFlag()) |
---|
304 | { |
---|
305 | READ_FLAG( uiCode, "deblocking_filter_override_enabled_flag" ); pcPPS->setDeblockingFilterOverrideEnabledFlag( uiCode ? true : false ); |
---|
306 | READ_FLAG( uiCode, "pps_disable_deblocking_filter_flag" ); pcPPS->setPicDisableDeblockingFilterFlag(uiCode ? true : false ); |
---|
307 | if(!pcPPS->getPicDisableDeblockingFilterFlag()) |
---|
308 | { |
---|
309 | READ_SVLC ( iCode, "pps_beta_offset_div2" ); pcPPS->setDeblockingFilterBetaOffsetDiv2( iCode ); |
---|
310 | READ_SVLC ( iCode, "pps_tc_offset_div2" ); pcPPS->setDeblockingFilterTcOffsetDiv2( iCode ); |
---|
311 | } |
---|
312 | } |
---|
313 | READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" ); pcPPS->setScalingListPresentFlag( uiCode ? true : false ); |
---|
314 | if(pcPPS->getScalingListPresentFlag ()) |
---|
315 | { |
---|
316 | parseScalingList( &(pcPPS->getScalingList()) ); |
---|
317 | } |
---|
318 | |
---|
319 | READ_FLAG( uiCode, "lists_modification_present_flag"); |
---|
320 | pcPPS->setListsModificationPresentFlag(uiCode); |
---|
321 | |
---|
322 | READ_UVLC( uiCode, "log2_parallel_merge_level_minus2"); |
---|
323 | pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode); |
---|
324 | |
---|
325 | READ_FLAG( uiCode, "slice_segment_header_extension_present_flag"); |
---|
326 | pcPPS->setSliceHeaderExtensionPresentFlag(uiCode); |
---|
327 | |
---|
328 | READ_FLAG( uiCode, "pps_extension_present_flag"); |
---|
329 | if (uiCode) |
---|
330 | { |
---|
331 | #if NH_MV |
---|
332 | READ_FLAG( uiCode, "pps_range_extensions_flag" ); pcPPS->setPpsRangeExtensionsFlag( uiCode == 1 ); |
---|
333 | READ_FLAG( uiCode, "pps_multilayer_extension_flag" ); pcPPS->setPpsMultilayerExtensionFlag( uiCode == 1 ); |
---|
334 | READ_FLAG( uiCode, "pps_3d_extension_flag" ); pcPPS->setPps3dExtensionFlag( uiCode == 1 ); |
---|
335 | READ_CODE( 5, uiCode, "pps_extension_5bits" ); pcPPS->setPpsExtension5bits( uiCode ); |
---|
336 | if ( pcPPS->getPpsRangeExtensionsFlag() ) |
---|
337 | { |
---|
338 | TComPPSRExt &ppsRangeExtension = pcPPS->getPpsRangeExtension(); |
---|
339 | |
---|
340 | if (pcPPS->getUseTransformSkip()) |
---|
341 | { |
---|
342 | READ_UVLC( uiCode, "log2_max_transform_skip_block_size_minus2"); |
---|
343 | ppsRangeExtension.setLog2MaxTransformSkipBlockSize(uiCode+2); |
---|
344 | } |
---|
345 | |
---|
346 | READ_FLAG( uiCode, "cross_component_prediction_enabled_flag"); |
---|
347 | ppsRangeExtension.setCrossComponentPredictionEnabledFlag(uiCode != 0); |
---|
348 | |
---|
349 | READ_FLAG( uiCode, "chroma_qp_offset_list_enabled_flag"); |
---|
350 | if (uiCode == 0) |
---|
351 | { |
---|
352 | ppsRangeExtension.clearChromaQpOffsetList(); |
---|
353 | ppsRangeExtension.setDiffCuChromaQpOffsetDepth(0); |
---|
354 | } |
---|
355 | else |
---|
356 | { |
---|
357 | READ_UVLC(uiCode, "diff_cu_chroma_qp_offset_depth"); ppsRangeExtension.setDiffCuChromaQpOffsetDepth(uiCode); |
---|
358 | UInt tableSizeMinus1 = 0; |
---|
359 | READ_UVLC(tableSizeMinus1, "chroma_qp_offset_list_len_minus1"); |
---|
360 | assert(tableSizeMinus1 < MAX_QP_OFFSET_LIST_SIZE); |
---|
361 | |
---|
362 | for (Int cuChromaQpOffsetIdx = 0; cuChromaQpOffsetIdx <= (tableSizeMinus1); cuChromaQpOffsetIdx++) |
---|
363 | { |
---|
364 | Int cbOffset; |
---|
365 | Int crOffset; |
---|
366 | READ_SVLC(cbOffset, "cb_qp_offset_list[i]"); |
---|
367 | assert(cbOffset >= -12 && cbOffset <= 12); |
---|
368 | READ_SVLC(crOffset, "cr_qp_offset_list[i]"); |
---|
369 | assert(crOffset >= -12 && crOffset <= 12); |
---|
370 | // table uses +1 for index (see comment inside the function) |
---|
371 | ppsRangeExtension.setChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1, cbOffset, crOffset); |
---|
372 | } |
---|
373 | assert(ppsRangeExtension.getChromaQpOffsetListLen() == tableSizeMinus1 + 1); |
---|
374 | } |
---|
375 | |
---|
376 | READ_UVLC( uiCode, "log2_sao_offset_scale_luma"); |
---|
377 | ppsRangeExtension.setLog2SaoOffsetScale(CHANNEL_TYPE_LUMA, uiCode); |
---|
378 | READ_UVLC( uiCode, "log2_sao_offset_scale_chroma"); |
---|
379 | ppsRangeExtension.setLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA, uiCode); } |
---|
380 | |
---|
381 | if ( pcPPS->getPpsMultilayerExtensionFlag() ) |
---|
382 | { |
---|
383 | parsePpsMultilayerExtension( pcPPS ); |
---|
384 | } |
---|
385 | |
---|
386 | if ( pcPPS->getPps3dExtensionFlag() ) |
---|
387 | { |
---|
388 | #if NH_3D |
---|
389 | parsePps3dExtension( pcPPS ); |
---|
390 | #endif |
---|
391 | } |
---|
392 | #if NH_3D |
---|
393 | if ( pcPPS->getPpsExtension5bits() ) |
---|
394 | #else |
---|
395 | if ( pcPPS->getPpsExtension5bits() || pcPPS->getPps3dExtensionFlag() ) |
---|
396 | #endif |
---|
397 | { |
---|
398 | while ( xMoreRbspData() ) |
---|
399 | { |
---|
400 | READ_FLAG( uiCode, "pps_extension_data_flag"); |
---|
401 | } |
---|
402 | } |
---|
403 | |
---|
404 | #else |
---|
405 | #if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS |
---|
406 | static const char *syntaxStrings[]={ "pps_range_extension_flag", |
---|
407 | "pps_multilayer_extension_flag", |
---|
408 | "pps_extension_6bits[0]", |
---|
409 | "pps_extension_6bits[1]", |
---|
410 | "pps_extension_6bits[2]", |
---|
411 | "pps_extension_6bits[3]", |
---|
412 | "pps_extension_6bits[4]", |
---|
413 | "pps_extension_6bits[5]" }; |
---|
414 | #endif |
---|
415 | |
---|
416 | Bool pps_extension_flags[NUM_PPS_EXTENSION_FLAGS]; |
---|
417 | for(Int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++) |
---|
418 | { |
---|
419 | READ_FLAG( uiCode, syntaxStrings[i] ); |
---|
420 | pps_extension_flags[i] = uiCode!=0; |
---|
421 | } |
---|
422 | |
---|
423 | Bool bSkipTrailingExtensionBits=false; |
---|
424 | for(Int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++) // loop used so that the order is determined by the enum. |
---|
425 | { |
---|
426 | if (pps_extension_flags[i]) |
---|
427 | { |
---|
428 | switch (PPSExtensionFlagIndex(i)) |
---|
429 | { |
---|
430 | case PPS_EXT__REXT: |
---|
431 | { |
---|
432 | TComPPSRExt &ppsRangeExtension = pcPPS->getPpsRangeExtension(); |
---|
433 | assert(!bSkipTrailingExtensionBits); |
---|
434 | |
---|
435 | if (pcPPS->getUseTransformSkip()) |
---|
436 | { |
---|
437 | READ_UVLC( uiCode, "log2_max_transform_skip_block_size_minus2"); |
---|
438 | ppsRangeExtension.setLog2MaxTransformSkipBlockSize(uiCode+2); |
---|
439 | } |
---|
440 | |
---|
441 | READ_FLAG( uiCode, "cross_component_prediction_enabled_flag"); |
---|
442 | ppsRangeExtension.setCrossComponentPredictionEnabledFlag(uiCode != 0); |
---|
443 | |
---|
444 | READ_FLAG( uiCode, "chroma_qp_offset_list_enabled_flag"); |
---|
445 | if (uiCode == 0) |
---|
446 | { |
---|
447 | ppsRangeExtension.clearChromaQpOffsetList(); |
---|
448 | ppsRangeExtension.setDiffCuChromaQpOffsetDepth(0); |
---|
449 | } |
---|
450 | else |
---|
451 | { |
---|
452 | READ_UVLC(uiCode, "diff_cu_chroma_qp_offset_depth"); ppsRangeExtension.setDiffCuChromaQpOffsetDepth(uiCode); |
---|
453 | UInt tableSizeMinus1 = 0; |
---|
454 | READ_UVLC(tableSizeMinus1, "chroma_qp_offset_list_len_minus1"); |
---|
455 | assert(tableSizeMinus1 < MAX_QP_OFFSET_LIST_SIZE); |
---|
456 | |
---|
457 | for (Int cuChromaQpOffsetIdx = 0; cuChromaQpOffsetIdx <= (tableSizeMinus1); cuChromaQpOffsetIdx++) |
---|
458 | { |
---|
459 | Int cbOffset; |
---|
460 | Int crOffset; |
---|
461 | READ_SVLC(cbOffset, "cb_qp_offset_list[i]"); |
---|
462 | assert(cbOffset >= -12 && cbOffset <= 12); |
---|
463 | READ_SVLC(crOffset, "cr_qp_offset_list[i]"); |
---|
464 | assert(crOffset >= -12 && crOffset <= 12); |
---|
465 | // table uses +1 for index (see comment inside the function) |
---|
466 | ppsRangeExtension.setChromaQpOffsetListEntry(cuChromaQpOffsetIdx+1, cbOffset, crOffset); |
---|
467 | } |
---|
468 | assert(ppsRangeExtension.getChromaQpOffsetListLen() == tableSizeMinus1 + 1); |
---|
469 | } |
---|
470 | |
---|
471 | READ_UVLC( uiCode, "log2_sao_offset_scale_luma"); |
---|
472 | ppsRangeExtension.setLog2SaoOffsetScale(CHANNEL_TYPE_LUMA, uiCode); |
---|
473 | READ_UVLC( uiCode, "log2_sao_offset_scale_chroma"); |
---|
474 | ppsRangeExtension.setLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA, uiCode); |
---|
475 | } |
---|
476 | break; |
---|
477 | default: |
---|
478 | bSkipTrailingExtensionBits=true; |
---|
479 | break; |
---|
480 | } |
---|
481 | } |
---|
482 | } |
---|
483 | if (bSkipTrailingExtensionBits) |
---|
484 | { |
---|
485 | while ( xMoreRbspData() ) |
---|
486 | { |
---|
487 | READ_FLAG( uiCode, "pps_extension_data_flag"); |
---|
488 | } |
---|
489 | } |
---|
490 | #endif |
---|
491 | } |
---|
492 | xReadRbspTrailingBits(); |
---|
493 | } |
---|
494 | |
---|
495 | #if NH_3D |
---|
496 | Void TDecCavlc::parsePps3dExtension( TComPPS* pcPPS ) |
---|
497 | { |
---|
498 | #if H_3D |
---|
499 | UInt uiCode = 0; |
---|
500 | // |
---|
501 | TComDLT* pcDLT = new TComDLT; |
---|
502 | //Ed.(GT): PPSs are copied in HM16.4. This would cause that the only the DLT pointer is copied. Therefore, a deep copy of the DLT needs to be implemented. Another option would be to use a vectors for the DLT arrays in TComDLT. |
---|
503 | |
---|
504 | READ_FLAG(uiCode, "dlt_present_flag"); |
---|
505 | pcDLT->setDltPresentFlag( (uiCode == 1) ? true : false ); |
---|
506 | |
---|
507 | if ( pcDLT->getDltPresentFlag() ) |
---|
508 | { |
---|
509 | READ_CODE(6, uiCode, "pps_depth_layers_minus1"); |
---|
510 | pcDLT->setNumDepthViews( uiCode ); |
---|
511 | |
---|
512 | READ_CODE(4, uiCode, "pps_bit_depth_for_depth_views_minus8"); |
---|
513 | pcDLT->setDepthViewBitDepth( (uiCode+8) ); |
---|
514 | |
---|
515 | //Ed.(GT): Please remove parsing dependency from VPS here ! |
---|
516 | for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
517 | { |
---|
518 | if ( i != 0 ) |
---|
519 | { |
---|
520 | if( pcVPS->getDepthId( i ) == 1 ) |
---|
521 | { |
---|
522 | READ_FLAG(uiCode, "dlt_flag[i]"); |
---|
523 | pcDLT->setUseDLTFlag(i, (uiCode == 1) ? true : false); |
---|
524 | |
---|
525 | if ( pcDLT->getUseDLTFlag( i ) ) |
---|
526 | { |
---|
527 | Bool bDltBitMapRepFlag = false; |
---|
528 | UInt uiMaxDiff = 0xffffffff; |
---|
529 | UInt uiMinDiff = 0; |
---|
530 | UInt uiCodeLength = 0; |
---|
531 | |
---|
532 | READ_FLAG(uiCode, "inter_view_dlt_pred_enable_flag[ i ]"); |
---|
533 | |
---|
534 | if( uiCode ) |
---|
535 | { |
---|
536 | assert( pcDLT->getUseDLTFlag( 1 )); |
---|
537 | } |
---|
538 | pcDLT->setInterViewDltPredEnableFlag( i, (uiCode == 1) ? true : false ); |
---|
539 | |
---|
540 | if ( pcDLT->getInterViewDltPredEnableFlag( i ) == false ) |
---|
541 | { |
---|
542 | READ_FLAG(uiCode, "dlt_bit_map_rep_flag[ layerId ]"); |
---|
543 | bDltBitMapRepFlag = (uiCode == 1) ? true : false; |
---|
544 | } |
---|
545 | else |
---|
546 | { |
---|
547 | bDltBitMapRepFlag = false; |
---|
548 | } |
---|
549 | |
---|
550 | UInt uiNumDepthValues = 0; |
---|
551 | Int aiIdx2DepthValue[256]; |
---|
552 | |
---|
553 | // Bit map |
---|
554 | if ( bDltBitMapRepFlag ) |
---|
555 | { |
---|
556 | for (UInt d=0; d<256; d++) |
---|
557 | { |
---|
558 | READ_FLAG(uiCode, "dlt_bit_map_flag[ layerId ][ j ]"); |
---|
559 | if (uiCode == 1) |
---|
560 | { |
---|
561 | aiIdx2DepthValue[uiNumDepthValues] = d; |
---|
562 | uiNumDepthValues++; |
---|
563 | } |
---|
564 | } |
---|
565 | } |
---|
566 | // Diff Coding |
---|
567 | else |
---|
568 | { |
---|
569 | READ_CODE(8, uiNumDepthValues, "num_depth_values_in_dlt[i]"); // num_entry |
---|
570 | |
---|
571 | { |
---|
572 | // The condition if( pcVPS->getNumDepthValues(i) > 0 ) is always true since for Single-view Diff Coding, there is at least one depth value in depth component. |
---|
573 | |
---|
574 | if (uiNumDepthValues > 1) |
---|
575 | { |
---|
576 | READ_CODE(8, uiCode, "max_diff[ layerId ]"); |
---|
577 | uiMaxDiff = uiCode; |
---|
578 | } |
---|
579 | else |
---|
580 | { |
---|
581 | uiMaxDiff = 0; // when there is only one value in DLT |
---|
582 | } |
---|
583 | |
---|
584 | if (uiNumDepthValues > 2) |
---|
585 | { |
---|
586 | uiCodeLength = (UInt) ceil(Log2(uiMaxDiff + 1)); |
---|
587 | READ_CODE(uiCodeLength, uiCode, "min_diff_minus1[ layerId ]"); |
---|
588 | uiMinDiff = uiCode + 1; |
---|
589 | } |
---|
590 | else |
---|
591 | { |
---|
592 | uiMinDiff = uiMaxDiff; // when there are only one or two values in DLT |
---|
593 | } |
---|
594 | |
---|
595 | READ_CODE(8, uiCode, "dlt_depth_value0[layerId]"); // entry0 |
---|
596 | aiIdx2DepthValue[0] = uiCode; |
---|
597 | |
---|
598 | if (uiMaxDiff == uiMinDiff) |
---|
599 | { |
---|
600 | for (UInt d=1; d<uiNumDepthValues; d++) |
---|
601 | { |
---|
602 | aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + 0; |
---|
603 | } |
---|
604 | } |
---|
605 | else |
---|
606 | { |
---|
607 | uiCodeLength = (UInt) ceil(Log2(uiMaxDiff - uiMinDiff + 1)); |
---|
608 | for (UInt d=1; d<uiNumDepthValues; d++) |
---|
609 | { |
---|
610 | READ_CODE(uiCodeLength, uiCode, "dlt_depth_value_diff_minus_min[ layerId ][ j ]"); |
---|
611 | aiIdx2DepthValue[d] = aiIdx2DepthValue[d-1] + uiMinDiff + uiCode; |
---|
612 | } |
---|
613 | } |
---|
614 | |
---|
615 | } |
---|
616 | } |
---|
617 | |
---|
618 | if( pcDLT->getInterViewDltPredEnableFlag( i ) ) |
---|
619 | { |
---|
620 | // interpret decoded values as delta DLT |
---|
621 | AOF( pcVPS->getDepthId( 1 ) == 1 ); |
---|
622 | AOF( i > 1 ); |
---|
623 | // assumes ref layer id to be 1 |
---|
624 | Int* piRefDLT = pcDLT->idx2DepthValue( 1 ); |
---|
625 | UInt uiRefNum = pcDLT->getNumDepthValues( 1 ); |
---|
626 | pcDLT->setDeltaDLT(i, piRefDLT, uiRefNum, aiIdx2DepthValue, uiNumDepthValues); |
---|
627 | } |
---|
628 | else |
---|
629 | { |
---|
630 | // store final DLT |
---|
631 | pcDLT->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues); |
---|
632 | } |
---|
633 | |
---|
634 | } |
---|
635 | } |
---|
636 | } |
---|
637 | } |
---|
638 | } |
---|
639 | |
---|
640 | pcPPS->setDLT( pcDLT ); |
---|
641 | #endif |
---|
642 | } |
---|
643 | #endif |
---|
644 | |
---|
645 | |
---|
646 | Void TDecCavlc::parseVUI(TComVUI* pcVUI, TComSPS *pcSPS) |
---|
647 | { |
---|
648 | #if ENC_DEC_TRACE |
---|
649 | fprintf( g_hTrace, "----------- vui_parameters -----------\n"); |
---|
650 | #endif |
---|
651 | UInt uiCode; |
---|
652 | |
---|
653 | READ_FLAG( uiCode, "aspect_ratio_info_present_flag"); pcVUI->setAspectRatioInfoPresentFlag(uiCode); |
---|
654 | if (pcVUI->getAspectRatioInfoPresentFlag()) |
---|
655 | { |
---|
656 | READ_CODE(8, uiCode, "aspect_ratio_idc"); pcVUI->setAspectRatioIdc(uiCode); |
---|
657 | if (pcVUI->getAspectRatioIdc() == 255) |
---|
658 | { |
---|
659 | READ_CODE(16, uiCode, "sar_width"); pcVUI->setSarWidth(uiCode); |
---|
660 | READ_CODE(16, uiCode, "sar_height"); pcVUI->setSarHeight(uiCode); |
---|
661 | } |
---|
662 | } |
---|
663 | |
---|
664 | READ_FLAG( uiCode, "overscan_info_present_flag"); pcVUI->setOverscanInfoPresentFlag(uiCode); |
---|
665 | if (pcVUI->getOverscanInfoPresentFlag()) |
---|
666 | { |
---|
667 | READ_FLAG( uiCode, "overscan_appropriate_flag"); pcVUI->setOverscanAppropriateFlag(uiCode); |
---|
668 | } |
---|
669 | |
---|
670 | READ_FLAG( uiCode, "video_signal_type_present_flag"); pcVUI->setVideoSignalTypePresentFlag(uiCode); |
---|
671 | #if NH_MV |
---|
672 | assert( pcSPS->getLayerId() == 0 || !pcVUI->getVideoSignalTypePresentFlag() ); |
---|
673 | #endif |
---|
674 | if (pcVUI->getVideoSignalTypePresentFlag()) |
---|
675 | { |
---|
676 | READ_CODE(3, uiCode, "video_format"); pcVUI->setVideoFormat(uiCode); |
---|
677 | READ_FLAG( uiCode, "video_full_range_flag"); pcVUI->setVideoFullRangeFlag(uiCode); |
---|
678 | READ_FLAG( uiCode, "colour_description_present_flag"); pcVUI->setColourDescriptionPresentFlag(uiCode); |
---|
679 | if (pcVUI->getColourDescriptionPresentFlag()) |
---|
680 | { |
---|
681 | READ_CODE(8, uiCode, "colour_primaries"); pcVUI->setColourPrimaries(uiCode); |
---|
682 | READ_CODE(8, uiCode, "transfer_characteristics"); pcVUI->setTransferCharacteristics(uiCode); |
---|
683 | READ_CODE(8, uiCode, "matrix_coeffs"); pcVUI->setMatrixCoefficients(uiCode); |
---|
684 | } |
---|
685 | } |
---|
686 | |
---|
687 | READ_FLAG( uiCode, "chroma_loc_info_present_flag"); pcVUI->setChromaLocInfoPresentFlag(uiCode); |
---|
688 | if (pcVUI->getChromaLocInfoPresentFlag()) |
---|
689 | { |
---|
690 | READ_UVLC( uiCode, "chroma_sample_loc_type_top_field" ); pcVUI->setChromaSampleLocTypeTopField(uiCode); |
---|
691 | READ_UVLC( uiCode, "chroma_sample_loc_type_bottom_field" ); pcVUI->setChromaSampleLocTypeBottomField(uiCode); |
---|
692 | } |
---|
693 | |
---|
694 | READ_FLAG( uiCode, "neutral_chroma_indication_flag"); pcVUI->setNeutralChromaIndicationFlag(uiCode); |
---|
695 | |
---|
696 | READ_FLAG( uiCode, "field_seq_flag"); pcVUI->setFieldSeqFlag(uiCode); |
---|
697 | |
---|
698 | READ_FLAG(uiCode, "frame_field_info_present_flag"); pcVUI->setFrameFieldInfoPresentFlag(uiCode); |
---|
699 | |
---|
700 | READ_FLAG( uiCode, "default_display_window_flag"); |
---|
701 | if (uiCode != 0) |
---|
702 | { |
---|
703 | Window &defDisp = pcVUI->getDefaultDisplayWindow(); |
---|
704 | #if NH_MV |
---|
705 | defDisp.setScaledFlag( false ); |
---|
706 | READ_UVLC( uiCode, "def_disp_win_left_offset" ); defDisp.setWindowLeftOffset ( uiCode ); |
---|
707 | READ_UVLC( uiCode, "def_disp_win_right_offset" ); defDisp.setWindowRightOffset ( uiCode ); |
---|
708 | READ_UVLC( uiCode, "def_disp_win_top_offset" ); defDisp.setWindowTopOffset ( uiCode ); |
---|
709 | READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode ); |
---|
710 | #else |
---|
711 | READ_UVLC( uiCode, "def_disp_win_left_offset" ); defDisp.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); |
---|
712 | READ_UVLC( uiCode, "def_disp_win_right_offset" ); defDisp.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc()) ); |
---|
713 | READ_UVLC( uiCode, "def_disp_win_top_offset" ); defDisp.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); |
---|
714 | READ_UVLC( uiCode, "def_disp_win_bottom_offset" ); defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) ); |
---|
715 | #endif |
---|
716 | } |
---|
717 | |
---|
718 | TimingInfo *timingInfo = pcVUI->getTimingInfo(); |
---|
719 | READ_FLAG( uiCode, "vui_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); |
---|
720 | if(timingInfo->getTimingInfoPresentFlag()) |
---|
721 | { |
---|
722 | READ_CODE( 32, uiCode, "vui_num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode); |
---|
723 | READ_CODE( 32, uiCode, "vui_time_scale"); timingInfo->setTimeScale (uiCode); |
---|
724 | READ_FLAG( uiCode, "vui_poc_proportional_to_timing_flag"); timingInfo->setPocProportionalToTimingFlag(uiCode ? true : false); |
---|
725 | if(timingInfo->getPocProportionalToTimingFlag()) |
---|
726 | { |
---|
727 | READ_UVLC( uiCode, "vui_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); |
---|
728 | } |
---|
729 | |
---|
730 | READ_FLAG( uiCode, "vui_hrd_parameters_present_flag"); pcVUI->setHrdParametersPresentFlag(uiCode); |
---|
731 | if( pcVUI->getHrdParametersPresentFlag() ) |
---|
732 | { |
---|
733 | parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); |
---|
734 | } |
---|
735 | } |
---|
736 | |
---|
737 | READ_FLAG( uiCode, "bitstream_restriction_flag"); pcVUI->setBitstreamRestrictionFlag(uiCode); |
---|
738 | if (pcVUI->getBitstreamRestrictionFlag()) |
---|
739 | { |
---|
740 | READ_FLAG( uiCode, "tiles_fixed_structure_flag"); pcVUI->setTilesFixedStructureFlag(uiCode); |
---|
741 | READ_FLAG( uiCode, "motion_vectors_over_pic_boundaries_flag"); pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode); |
---|
742 | READ_FLAG( uiCode, "restricted_ref_pic_lists_flag"); pcVUI->setRestrictedRefPicListsFlag(uiCode); |
---|
743 | READ_UVLC( uiCode, "min_spatial_segmentation_idc"); pcVUI->setMinSpatialSegmentationIdc(uiCode); |
---|
744 | assert(uiCode < 4096); |
---|
745 | READ_UVLC( uiCode, "max_bytes_per_pic_denom" ); pcVUI->setMaxBytesPerPicDenom(uiCode); |
---|
746 | READ_UVLC( uiCode, "max_bits_per_min_cu_denom" ); pcVUI->setMaxBitsPerMinCuDenom(uiCode); |
---|
747 | READ_UVLC( uiCode, "log2_max_mv_length_horizontal" ); pcVUI->setLog2MaxMvLengthHorizontal(uiCode); |
---|
748 | READ_UVLC( uiCode, "log2_max_mv_length_vertical" ); pcVUI->setLog2MaxMvLengthVertical(uiCode); |
---|
749 | } |
---|
750 | } |
---|
751 | |
---|
752 | Void TDecCavlc::parseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1) |
---|
753 | { |
---|
754 | UInt uiCode; |
---|
755 | if( commonInfPresentFlag ) |
---|
756 | { |
---|
757 | READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" ); hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false ); |
---|
758 | READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" ); hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false ); |
---|
759 | if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) |
---|
760 | { |
---|
761 | READ_FLAG( uiCode, "sub_pic_hrd_params_present_flag" ); hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false ); |
---|
762 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
763 | { |
---|
764 | READ_CODE( 8, uiCode, "tick_divisor_minus2" ); hrd->setTickDivisorMinus2( uiCode ); |
---|
765 | READ_CODE( 5, uiCode, "du_cpb_removal_delay_increment_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode ); |
---|
766 | READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false ); |
---|
767 | READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1" ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode ); |
---|
768 | } |
---|
769 | READ_CODE( 4, uiCode, "bit_rate_scale" ); hrd->setBitRateScale( uiCode ); |
---|
770 | READ_CODE( 4, uiCode, "cpb_size_scale" ); hrd->setCpbSizeScale( uiCode ); |
---|
771 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
772 | { |
---|
773 | READ_CODE( 4, uiCode, "cpb_size_du_scale" ); hrd->setDuCpbSizeScale( uiCode ); |
---|
774 | } |
---|
775 | READ_CODE( 5, uiCode, "initial_cpb_removal_delay_length_minus1" ); hrd->setInitialCpbRemovalDelayLengthMinus1( uiCode ); |
---|
776 | READ_CODE( 5, uiCode, "au_cpb_removal_delay_length_minus1" ); hrd->setCpbRemovalDelayLengthMinus1( uiCode ); |
---|
777 | READ_CODE( 5, uiCode, "dpb_output_delay_length_minus1" ); hrd->setDpbOutputDelayLengthMinus1( uiCode ); |
---|
778 | } |
---|
779 | } |
---|
780 | Int i, j, nalOrVcl; |
---|
781 | for( i = 0; i <= maxNumSubLayersMinus1; i ++ ) |
---|
782 | { |
---|
783 | READ_FLAG( uiCode, "fixed_pic_rate_general_flag" ); hrd->setFixedPicRateFlag( i, uiCode == 1 ? true : false ); |
---|
784 | if( !hrd->getFixedPicRateFlag( i ) ) |
---|
785 | { |
---|
786 | READ_FLAG( uiCode, "fixed_pic_rate_within_cvs_flag" ); hrd->setFixedPicRateWithinCvsFlag( i, uiCode == 1 ? true : false ); |
---|
787 | } |
---|
788 | else |
---|
789 | { |
---|
790 | hrd->setFixedPicRateWithinCvsFlag( i, true ); |
---|
791 | } |
---|
792 | |
---|
793 | hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present |
---|
794 | hrd->setCpbCntMinus1 ( i, 0 ); // Infered to be 0 when not present |
---|
795 | |
---|
796 | if( hrd->getFixedPicRateWithinCvsFlag( i ) ) |
---|
797 | { |
---|
798 | READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" ); hrd->setPicDurationInTcMinus1( i, uiCode ); |
---|
799 | } |
---|
800 | else |
---|
801 | { |
---|
802 | READ_FLAG( uiCode, "low_delay_hrd_flag" ); hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false ); |
---|
803 | } |
---|
804 | if (!hrd->getLowDelayHrdFlag( i )) |
---|
805 | { |
---|
806 | READ_UVLC( uiCode, "cpb_cnt_minus1" ); hrd->setCpbCntMinus1( i, uiCode ); |
---|
807 | } |
---|
808 | |
---|
809 | for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) |
---|
810 | { |
---|
811 | if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || |
---|
812 | ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) |
---|
813 | { |
---|
814 | for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) |
---|
815 | { |
---|
816 | READ_UVLC( uiCode, "bit_rate_value_minus1" ); hrd->setBitRateValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
817 | READ_UVLC( uiCode, "cpb_size_value_minus1" ); hrd->setCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
818 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
819 | { |
---|
820 | READ_UVLC( uiCode, "cpb_size_du_value_minus1" ); hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
821 | READ_UVLC( uiCode, "bit_rate_du_value_minus1" ); hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode ); |
---|
822 | } |
---|
823 | READ_FLAG( uiCode, "cbr_flag" ); hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false ); |
---|
824 | } |
---|
825 | } |
---|
826 | } |
---|
827 | } |
---|
828 | } |
---|
829 | |
---|
830 | Void TDecCavlc::parseSPS(TComSPS* pcSPS) |
---|
831 | { |
---|
832 | #if ENC_DEC_TRACE |
---|
833 | #if H_MV_ENC_DEC_TRAC |
---|
834 | tracePSHeader( "SPS", pcSPS->getLayerId() ); |
---|
835 | #else |
---|
836 | xTraceSPSHeader (); |
---|
837 | #endif |
---|
838 | #endif |
---|
839 | |
---|
840 | UInt uiCode; |
---|
841 | READ_CODE( 4, uiCode, "sps_video_parameter_set_id"); pcSPS->setVPSId ( uiCode ); |
---|
842 | |
---|
843 | #if NH_MV |
---|
844 | if ( pcSPS->getLayerId() == 0 ) |
---|
845 | { |
---|
846 | #endif |
---|
847 | READ_CODE( 3, uiCode, "sps_max_sub_layers_minus1" ); pcSPS->setMaxTLayers ( uiCode+1 ); |
---|
848 | assert(uiCode <= 6); |
---|
849 | #if NH_MV |
---|
850 | } |
---|
851 | else |
---|
852 | { |
---|
853 | READ_CODE( 3, uiCode, "sps_ext_or_max_sub_layers_minus1" ); pcSPS->setSpsExtOrMaxSubLayersMinus1( uiCode ); |
---|
854 | pcSPS->inferSpsMaxSubLayersMinus1( false, NULL ); |
---|
855 | } |
---|
856 | if ( !pcSPS->getMultiLayerExtSpsFlag() ) |
---|
857 | { |
---|
858 | #endif |
---|
859 | |
---|
860 | READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" ); pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false ); |
---|
861 | if ( pcSPS->getMaxTLayers() == 1 ) |
---|
862 | { |
---|
863 | // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0 |
---|
864 | assert( uiCode == 1 ); |
---|
865 | } |
---|
866 | |
---|
867 | parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); |
---|
868 | #if NH_MV |
---|
869 | pcSPS->getPTL()->inferGeneralValues ( true, 0, NULL ); |
---|
870 | pcSPS->getPTL()->inferSubLayerValues( pcSPS->getMaxTLayers() - 1, 0, NULL ); |
---|
871 | } |
---|
872 | #endif |
---|
873 | READ_UVLC( uiCode, "sps_seq_parameter_set_id" ); pcSPS->setSPSId( uiCode ); |
---|
874 | assert(uiCode <= 15); |
---|
875 | #if NH_MV |
---|
876 | if ( pcSPS->getMultiLayerExtSpsFlag() ) |
---|
877 | { |
---|
878 | READ_FLAG( uiCode, "update_rep_format_flag" ); pcSPS->setUpdateRepFormatFlag( uiCode == 1 ); |
---|
879 | if ( pcSPS->getUpdateRepFormatFlag() ) |
---|
880 | { |
---|
881 | READ_CODE( 8, uiCode, "sps_rep_format_idx" ); pcSPS->setSpsRepFormatIdx( uiCode ); |
---|
882 | } |
---|
883 | } |
---|
884 | else |
---|
885 | { |
---|
886 | #endif |
---|
887 | |
---|
888 | READ_UVLC( uiCode, "chroma_format_idc" ); pcSPS->setChromaFormatIdc( ChromaFormat(uiCode) ); |
---|
889 | assert(uiCode <= 3); |
---|
890 | if( pcSPS->getChromaFormatIdc() == CHROMA_444 ) |
---|
891 | { |
---|
892 | READ_FLAG( uiCode, "separate_colour_plane_flag"); assert(uiCode == 0); |
---|
893 | } |
---|
894 | |
---|
895 | READ_UVLC ( uiCode, "pic_width_in_luma_samples" ); pcSPS->setPicWidthInLumaSamples ( uiCode ); |
---|
896 | READ_UVLC ( uiCode, "pic_height_in_luma_samples" ); pcSPS->setPicHeightInLumaSamples( uiCode ); |
---|
897 | READ_FLAG( uiCode, "conformance_window_flag"); |
---|
898 | if (uiCode != 0) |
---|
899 | { |
---|
900 | Window &conf = pcSPS->getConformanceWindow(); |
---|
901 | #if NH_MV |
---|
902 | // Needs to be scaled later, when ChromaFormatIdc is known. |
---|
903 | conf.setScaledFlag( false ); |
---|
904 | READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode ); |
---|
905 | READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode ); |
---|
906 | READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode ); |
---|
907 | READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode ); |
---|
908 | } |
---|
909 | #else |
---|
910 | READ_UVLC( uiCode, "conf_win_left_offset" ); conf.setWindowLeftOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); |
---|
911 | READ_UVLC( uiCode, "conf_win_right_offset" ); conf.setWindowRightOffset ( uiCode * TComSPS::getWinUnitX( pcSPS->getChromaFormatIdc() ) ); |
---|
912 | READ_UVLC( uiCode, "conf_win_top_offset" ); conf.setWindowTopOffset ( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); |
---|
913 | READ_UVLC( uiCode, "conf_win_bottom_offset" ); conf.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc() ) ); |
---|
914 | #endif |
---|
915 | } |
---|
916 | |
---|
917 | #if NH_MV |
---|
918 | if ( !pcSPS->getMultiLayerExtSpsFlag() ) |
---|
919 | { |
---|
920 | #endif |
---|
921 | |
---|
922 | READ_UVLC( uiCode, "bit_depth_luma_minus8" ); |
---|
923 | #if O0043_BEST_EFFORT_DECODING |
---|
924 | pcSPS->setStreamBitDepth(CHANNEL_TYPE_LUMA, 8 + uiCode); |
---|
925 | const UInt forceDecodeBitDepth = pcSPS->getForceDecodeBitDepth(); |
---|
926 | if (forceDecodeBitDepth != 0) |
---|
927 | { |
---|
928 | uiCode = forceDecodeBitDepth - 8; |
---|
929 | } |
---|
930 | #endif |
---|
931 | assert(uiCode <= 8); |
---|
932 | pcSPS->setBitDepth(CHANNEL_TYPE_LUMA, 8 + uiCode); |
---|
933 | |
---|
934 | #if O0043_BEST_EFFORT_DECODING |
---|
935 | pcSPS->setQpBDOffset(CHANNEL_TYPE_LUMA, (Int) (6*(pcSPS->getStreamBitDepth(CHANNEL_TYPE_LUMA)-8)) ); |
---|
936 | #else |
---|
937 | pcSPS->setQpBDOffset(CHANNEL_TYPE_LUMA, (Int) (6*uiCode) ); |
---|
938 | #endif |
---|
939 | |
---|
940 | READ_UVLC( uiCode, "bit_depth_chroma_minus8" ); |
---|
941 | #if O0043_BEST_EFFORT_DECODING |
---|
942 | pcSPS->setStreamBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode); |
---|
943 | if (forceDecodeBitDepth != 0) |
---|
944 | { |
---|
945 | uiCode = forceDecodeBitDepth - 8; |
---|
946 | } |
---|
947 | #endif |
---|
948 | assert(uiCode <= 8); |
---|
949 | pcSPS->setBitDepth(CHANNEL_TYPE_CHROMA, 8 + uiCode); |
---|
950 | #if O0043_BEST_EFFORT_DECODING |
---|
951 | pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (Int) (6*(pcSPS->getStreamBitDepth(CHANNEL_TYPE_CHROMA)-8)) ); |
---|
952 | #else |
---|
953 | pcSPS->setQpBDOffset(CHANNEL_TYPE_CHROMA, (Int) (6*uiCode) ); |
---|
954 | #endif |
---|
955 | #if NH_MV |
---|
956 | } |
---|
957 | #endif |
---|
958 | |
---|
959 | READ_UVLC( uiCode, "log2_max_pic_order_cnt_lsb_minus4" ); pcSPS->setBitsForPOC( 4 + uiCode ); |
---|
960 | assert(uiCode <= 12); |
---|
961 | |
---|
962 | #if NH_MV |
---|
963 | if ( !pcSPS->getMultiLayerExtSpsFlag()) |
---|
964 | { |
---|
965 | #endif |
---|
966 | UInt subLayerOrderingInfoPresentFlag; |
---|
967 | READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); |
---|
968 | |
---|
969 | for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) |
---|
970 | { |
---|
971 | READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]"); |
---|
972 | pcSPS->setMaxDecPicBuffering( uiCode + 1, i); |
---|
973 | READ_UVLC ( uiCode, "sps_max_num_reorder_pics[i]" ); |
---|
974 | pcSPS->setNumReorderPics(uiCode, i); |
---|
975 | READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]"); |
---|
976 | pcSPS->setMaxLatencyIncrease( uiCode, i ); |
---|
977 | |
---|
978 | if (!subLayerOrderingInfoPresentFlag) |
---|
979 | { |
---|
980 | for (i++; i <= pcSPS->getMaxTLayers()-1; i++) |
---|
981 | { |
---|
982 | pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i); |
---|
983 | pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i); |
---|
984 | pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i); |
---|
985 | } |
---|
986 | break; |
---|
987 | } |
---|
988 | } |
---|
989 | #if NH_MV |
---|
990 | } |
---|
991 | #endif |
---|
992 | |
---|
993 | READ_UVLC( uiCode, "log2_min_luma_coding_block_size_minus3" ); |
---|
994 | Int log2MinCUSize = uiCode + 3; |
---|
995 | pcSPS->setLog2MinCodingBlockSize(log2MinCUSize); |
---|
996 | READ_UVLC( uiCode, "log2_diff_max_min_luma_coding_block_size" ); |
---|
997 | pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode); |
---|
998 | |
---|
999 | if (pcSPS->getPTL()->getGeneralPTL()->getLevelIdc() >= Level::LEVEL5) |
---|
1000 | { |
---|
1001 | assert(log2MinCUSize + pcSPS->getLog2DiffMaxMinCodingBlockSize() >= 5); |
---|
1002 | } |
---|
1003 | |
---|
1004 | Int maxCUDepthDelta = uiCode; |
---|
1005 | pcSPS->setMaxCUWidth ( 1<<(log2MinCUSize + maxCUDepthDelta) ); |
---|
1006 | pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) ); |
---|
1007 | READ_UVLC( uiCode, "log2_min_luma_transform_block_size_minus2" ); pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 ); |
---|
1008 | |
---|
1009 | READ_UVLC( uiCode, "log2_diff_max_min_luma_transform_block_size" ); pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() ); |
---|
1010 | pcSPS->setMaxTrSize( 1<<(uiCode + pcSPS->getQuadtreeTULog2MinSize()) ); |
---|
1011 | |
---|
1012 | READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" ); pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 ); |
---|
1013 | READ_UVLC( uiCode, "max_transform_hierarchy_depth_intra" ); pcSPS->setQuadtreeTUMaxDepthIntra( uiCode+1 ); |
---|
1014 | |
---|
1015 | Int addCuDepth = max (0, log2MinCUSize - (Int)pcSPS->getQuadtreeTULog2MinSize() ); |
---|
1016 | pcSPS->setMaxTotalCUDepth( maxCUDepthDelta + addCuDepth + getMaxCUDepthOffset(pcSPS->getChromaFormatIdc(), pcSPS->getQuadtreeTULog2MinSize()) ); |
---|
1017 | |
---|
1018 | READ_FLAG( uiCode, "scaling_list_enabled_flag" ); pcSPS->setScalingListFlag ( uiCode ); |
---|
1019 | if(pcSPS->getScalingListFlag()) |
---|
1020 | { |
---|
1021 | #if NH_MV |
---|
1022 | if ( pcSPS->getMultiLayerExtSpsFlag() ) |
---|
1023 | { |
---|
1024 | READ_FLAG( uiCode, "sps_infer_scaling_list_flag" ); pcSPS->setSpsInferScalingListFlag( uiCode == 1 ); |
---|
1025 | } |
---|
1026 | |
---|
1027 | if ( pcSPS->getSpsInferScalingListFlag() ) |
---|
1028 | { |
---|
1029 | READ_CODE( 6, uiCode, "sps_scaling_list_ref_layer_id" ); pcSPS->setSpsScalingListRefLayerId( uiCode ); |
---|
1030 | } |
---|
1031 | else |
---|
1032 | { |
---|
1033 | #endif |
---|
1034 | READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" ); pcSPS->setScalingListPresentFlag ( uiCode ); |
---|
1035 | if(pcSPS->getScalingListPresentFlag ()) |
---|
1036 | { |
---|
1037 | parseScalingList( &(pcSPS->getScalingList()) ); |
---|
1038 | } |
---|
1039 | #if NH_MV |
---|
1040 | } |
---|
1041 | #endif |
---|
1042 | } |
---|
1043 | READ_FLAG( uiCode, "amp_enabled_flag" ); pcSPS->setUseAMP( uiCode ); |
---|
1044 | READ_FLAG( uiCode, "sample_adaptive_offset_enabled_flag" ); pcSPS->setUseSAO ( uiCode ? true : false ); |
---|
1045 | |
---|
1046 | READ_FLAG( uiCode, "pcm_enabled_flag" ); pcSPS->setUsePCM( uiCode ? true : false ); |
---|
1047 | if( pcSPS->getUsePCM() ) |
---|
1048 | { |
---|
1049 | READ_CODE( 4, uiCode, "pcm_sample_bit_depth_luma_minus1" ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_LUMA, 1 + uiCode ); |
---|
1050 | READ_CODE( 4, uiCode, "pcm_sample_bit_depth_chroma_minus1" ); pcSPS->setPCMBitDepth ( CHANNEL_TYPE_CHROMA, 1 + uiCode ); |
---|
1051 | READ_UVLC( uiCode, "log2_min_pcm_luma_coding_block_size_minus3" ); pcSPS->setPCMLog2MinSize (uiCode+3); |
---|
1052 | READ_UVLC( uiCode, "log2_diff_max_min_pcm_luma_coding_block_size" ); pcSPS->setPCMLog2MaxSize ( uiCode+pcSPS->getPCMLog2MinSize() ); |
---|
1053 | READ_FLAG( uiCode, "pcm_loop_filter_disable_flag" ); pcSPS->setPCMFilterDisableFlag ( uiCode ? true : false ); |
---|
1054 | } |
---|
1055 | |
---|
1056 | READ_UVLC( uiCode, "num_short_term_ref_pic_sets" ); |
---|
1057 | assert(uiCode <= 64); |
---|
1058 | pcSPS->createRPSList(uiCode); |
---|
1059 | |
---|
1060 | TComRPSList* rpsList = pcSPS->getRPSList(); |
---|
1061 | TComReferencePictureSet* rps; |
---|
1062 | |
---|
1063 | for(UInt i=0; i< rpsList->getNumberOfReferencePictureSets(); i++) |
---|
1064 | { |
---|
1065 | rps = rpsList->getReferencePictureSet(i); |
---|
1066 | parseShortTermRefPicSet(pcSPS,rps,i); |
---|
1067 | } |
---|
1068 | READ_FLAG( uiCode, "long_term_ref_pics_present_flag" ); pcSPS->setLongTermRefsPresent(uiCode); |
---|
1069 | if (pcSPS->getLongTermRefsPresent()) |
---|
1070 | { |
---|
1071 | READ_UVLC( uiCode, "num_long_term_ref_pics_sps" ); |
---|
1072 | pcSPS->setNumLongTermRefPicSPS(uiCode); |
---|
1073 | for (UInt k = 0; k < pcSPS->getNumLongTermRefPicSPS(); k++) |
---|
1074 | { |
---|
1075 | READ_CODE( pcSPS->getBitsForPOC(), uiCode, "lt_ref_pic_poc_lsb_sps" ); |
---|
1076 | pcSPS->setLtRefPicPocLsbSps(k, uiCode); |
---|
1077 | READ_FLAG( uiCode, "used_by_curr_pic_lt_sps_flag[i]"); |
---|
1078 | pcSPS->setUsedByCurrPicLtSPSFlag(k, uiCode?1:0); |
---|
1079 | } |
---|
1080 | } |
---|
1081 | READ_FLAG( uiCode, "sps_temporal_mvp_enable_flag" ); pcSPS->setTMVPFlagsPresent(uiCode); |
---|
1082 | |
---|
1083 | READ_FLAG( uiCode, "sps_strong_intra_smoothing_enable_flag" ); pcSPS->setUseStrongIntraSmoothing(uiCode); |
---|
1084 | |
---|
1085 | READ_FLAG( uiCode, "vui_parameters_present_flag" ); pcSPS->setVuiParametersPresentFlag(uiCode); |
---|
1086 | |
---|
1087 | if (pcSPS->getVuiParametersPresentFlag()) |
---|
1088 | { |
---|
1089 | parseVUI(pcSPS->getVuiParameters(), pcSPS); |
---|
1090 | } |
---|
1091 | |
---|
1092 | READ_FLAG( uiCode, "sps_extension_present_flag"); |
---|
1093 | #if NH_MV |
---|
1094 | pcSPS->setSpsExtensionPresentFlag( uiCode ); |
---|
1095 | if (pcSPS->getSpsExtensionPresentFlag( ) ) |
---|
1096 | { |
---|
1097 | READ_FLAG( uiCode, "sps_range_extensions_flag" ); pcSPS->setSpsRangeExtensionsFlag( uiCode == 1 ); |
---|
1098 | READ_FLAG( uiCode, "sps_multilayer_extension_flag" ); pcSPS->setSpsMultilayerExtensionFlag( uiCode == 1 ); |
---|
1099 | READ_FLAG( uiCode , "sps_3d_extension_flag" ); pcSPS->setSps3dExtensionFlag( uiCode == 1 ); |
---|
1100 | READ_CODE( 5, uiCode, "sps_extension_5bits" ) ; pcSPS->setSpsExtension5bits( uiCode ); |
---|
1101 | |
---|
1102 | if ( pcSPS->getSpsRangeExtensionsFlag() ) |
---|
1103 | { |
---|
1104 | TComSPSRExt &spsRangeExtension = pcSPS->getSpsRangeExtension(); |
---|
1105 | READ_FLAG( uiCode, "transform_skip_rotation_enabled_flag"); spsRangeExtension.setTransformSkipRotationEnabledFlag(uiCode != 0); |
---|
1106 | READ_FLAG( uiCode, "transform_skip_context_enabled_flag"); spsRangeExtension.setTransformSkipContextEnabledFlag (uiCode != 0); |
---|
1107 | READ_FLAG( uiCode, "implicit_rdpcm_enabled_flag"); spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_IMPLICIT, (uiCode != 0)); |
---|
1108 | READ_FLAG( uiCode, "explicit_rdpcm_enabled_flag"); spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_EXPLICIT, (uiCode != 0)); |
---|
1109 | READ_FLAG( uiCode, "extended_precision_processing_flag"); spsRangeExtension.setExtendedPrecisionProcessingFlag (uiCode != 0); |
---|
1110 | READ_FLAG( uiCode, "intra_smoothing_disabled_flag"); spsRangeExtension.setIntraSmoothingDisabledFlag (uiCode != 0); |
---|
1111 | READ_FLAG( uiCode, "high_precision_offsets_enabled_flag"); spsRangeExtension.setHighPrecisionOffsetsEnabledFlag (uiCode != 0); |
---|
1112 | READ_FLAG( uiCode, "persistent_rice_adaptation_enabled_flag"); spsRangeExtension.setPersistentRiceAdaptationEnabledFlag (uiCode != 0); |
---|
1113 | READ_FLAG( uiCode, "cabac_bypass_alignment_enabled_flag"); spsRangeExtension.setCabacBypassAlignmentEnabledFlag (uiCode != 0); |
---|
1114 | } |
---|
1115 | |
---|
1116 | if ( pcSPS->getSpsMultilayerExtensionFlag() ) |
---|
1117 | { |
---|
1118 | parseSpsMultilayerExtension( pcSPS ); |
---|
1119 | } |
---|
1120 | |
---|
1121 | if ( pcSPS->getSps3dExtensionFlag() ) |
---|
1122 | { |
---|
1123 | #if NH_3D |
---|
1124 | parseSps3dExtension( pcSPS ); |
---|
1125 | #endif |
---|
1126 | } |
---|
1127 | |
---|
1128 | #if NH_3D |
---|
1129 | if ( pcSPS->getSpsExtension5bits() ) |
---|
1130 | #else |
---|
1131 | if ( pcSPS->getSpsExtension5bits() || pcSPS->getSps3dExtensionFlag() ) |
---|
1132 | #endif |
---|
1133 | { |
---|
1134 | while ( xMoreRbspData() ) |
---|
1135 | { |
---|
1136 | READ_FLAG( uiCode, "sps_extension_data_flag"); |
---|
1137 | } |
---|
1138 | } |
---|
1139 | } |
---|
1140 | #else |
---|
1141 | if (uiCode) |
---|
1142 | { |
---|
1143 | |
---|
1144 | #if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS |
---|
1145 | static const char *syntaxStrings[]={ "sps_range_extension_flag", |
---|
1146 | "sps_multilayer_extension_flag", |
---|
1147 | "sps_extension_6bits[0]", |
---|
1148 | "sps_extension_6bits[1]", |
---|
1149 | "sps_extension_6bits[2]", |
---|
1150 | "sps_extension_6bits[3]", |
---|
1151 | "sps_extension_6bits[4]", |
---|
1152 | "sps_extension_6bits[5]" }; |
---|
1153 | #endif |
---|
1154 | Bool sps_extension_flags[NUM_SPS_EXTENSION_FLAGS]; |
---|
1155 | |
---|
1156 | for(Int i=0; i<NUM_SPS_EXTENSION_FLAGS; i++) |
---|
1157 | { |
---|
1158 | READ_FLAG( uiCode, syntaxStrings[i] ); |
---|
1159 | sps_extension_flags[i] = uiCode!=0; |
---|
1160 | } |
---|
1161 | |
---|
1162 | Bool bSkipTrailingExtensionBits=false; |
---|
1163 | for(Int i=0; i<NUM_SPS_EXTENSION_FLAGS; i++) // loop used so that the order is determined by the enum. |
---|
1164 | { |
---|
1165 | if (sps_extension_flags[i]) |
---|
1166 | { |
---|
1167 | switch (SPSExtensionFlagIndex(i)) |
---|
1168 | { |
---|
1169 | case SPS_EXT__REXT: |
---|
1170 | assert(!bSkipTrailingExtensionBits); |
---|
1171 | { |
---|
1172 | TComSPSRExt &spsRangeExtension = pcSPS->getSpsRangeExtension(); |
---|
1173 | READ_FLAG( uiCode, "transform_skip_rotation_enabled_flag"); spsRangeExtension.setTransformSkipRotationEnabledFlag(uiCode != 0); |
---|
1174 | READ_FLAG( uiCode, "transform_skip_context_enabled_flag"); spsRangeExtension.setTransformSkipContextEnabledFlag (uiCode != 0); |
---|
1175 | READ_FLAG( uiCode, "implicit_rdpcm_enabled_flag"); spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_IMPLICIT, (uiCode != 0)); |
---|
1176 | READ_FLAG( uiCode, "explicit_rdpcm_enabled_flag"); spsRangeExtension.setRdpcmEnabledFlag(RDPCM_SIGNAL_EXPLICIT, (uiCode != 0)); |
---|
1177 | READ_FLAG( uiCode, "extended_precision_processing_flag"); spsRangeExtension.setExtendedPrecisionProcessingFlag (uiCode != 0); |
---|
1178 | READ_FLAG( uiCode, "intra_smoothing_disabled_flag"); spsRangeExtension.setIntraSmoothingDisabledFlag (uiCode != 0); |
---|
1179 | READ_FLAG( uiCode, "high_precision_offsets_enabled_flag"); spsRangeExtension.setHighPrecisionOffsetsEnabledFlag (uiCode != 0); |
---|
1180 | READ_FLAG( uiCode, "persistent_rice_adaptation_enabled_flag"); spsRangeExtension.setPersistentRiceAdaptationEnabledFlag (uiCode != 0); |
---|
1181 | READ_FLAG( uiCode, "cabac_bypass_alignment_enabled_flag"); spsRangeExtension.setCabacBypassAlignmentEnabledFlag (uiCode != 0); |
---|
1182 | } |
---|
1183 | break; |
---|
1184 | default: |
---|
1185 | bSkipTrailingExtensionBits=true; |
---|
1186 | break; |
---|
1187 | } |
---|
1188 | } |
---|
1189 | } |
---|
1190 | if (bSkipTrailingExtensionBits) |
---|
1191 | { |
---|
1192 | while ( xMoreRbspData() ) |
---|
1193 | { |
---|
1194 | READ_FLAG( uiCode, "sps_extension_data_flag"); |
---|
1195 | } |
---|
1196 | } |
---|
1197 | } |
---|
1198 | #endif |
---|
1199 | xReadRbspTrailingBits(); |
---|
1200 | } |
---|
1201 | |
---|
1202 | #if NH_MV |
---|
1203 | Void TDecCavlc::parseSpsMultilayerExtension( TComSPS* pcSPS ) |
---|
1204 | { |
---|
1205 | UInt uiCode; |
---|
1206 | READ_FLAG( uiCode, "inter_view_mv_vert_constraint_flag" ); pcSPS->setInterViewMvVertConstraintFlag(uiCode == 1 ? true : false); |
---|
1207 | } |
---|
1208 | |
---|
1209 | #if NH_3D |
---|
1210 | Void TDecCavlc::parseSps3dExtension( TComSPS* pcSPS ) |
---|
1211 | { |
---|
1212 | TComSps3dExtension sps3dExt; |
---|
1213 | UInt uiCode; |
---|
1214 | for( Int d = 0; d <= 1; d++ ) |
---|
1215 | { |
---|
1216 | READ_FLAG( uiCode, "iv_mv_pred_flag" ); sps3dExt.setIvMvPredFlag( d, uiCode == 1 ); |
---|
1217 | READ_FLAG( uiCode, "iv_mv_scaling_flag" ); sps3dExt.setIvMvScalingFlag( d, uiCode == 1 ); |
---|
1218 | if( d == 0 ) |
---|
1219 | { |
---|
1220 | READ_UVLC( uiCode, "log2_sub_pb_size_minus3" ); sps3dExt.setLog2SubPbSizeMinus3( d, uiCode ); |
---|
1221 | READ_FLAG( uiCode, "iv_res_pred_flag" ); sps3dExt.setIvResPredFlag( d, uiCode == 1 ); |
---|
1222 | READ_FLAG( uiCode, "depth_refinement_flag" ); sps3dExt.setDepthRefinementFlag( d, uiCode == 1 ); |
---|
1223 | READ_FLAG( uiCode, "view_synthesis_pred_flag" ); sps3dExt.setViewSynthesisPredFlag( d, uiCode == 1 ); |
---|
1224 | READ_FLAG( uiCode, "depth_based_blk_part_flag" ); sps3dExt.setDepthBasedBlkPartFlag( d, uiCode == 1 ); |
---|
1225 | } |
---|
1226 | else |
---|
1227 | { |
---|
1228 | READ_FLAG( uiCode, "mpi_flag" ); sps3dExt.setMpiFlag( d, uiCode == 1 ); |
---|
1229 | READ_UVLC( uiCode, "log2_mpi_sub_pb_size_minus3" ); sps3dExt.setLog2MpiSubPbSizeMinus3( d, uiCode ); |
---|
1230 | READ_FLAG( uiCode, "intra_contour_flag" ); sps3dExt.setIntraContourFlag( d, uiCode == 1 ); |
---|
1231 | READ_FLAG( uiCode, "intra_sdc_wedge_flag" ); sps3dExt.setIntraSdcWedgeFlag( d, uiCode == 1 ); |
---|
1232 | READ_FLAG( uiCode, "qt_pred_flag" ); sps3dExt.setQtPredFlag( d, uiCode == 1 ); |
---|
1233 | READ_FLAG( uiCode, "inter_sdc_flag" ); sps3dExt.setInterSdcFlag( d, uiCode == 1 ); |
---|
1234 | READ_FLAG( uiCode, "intra_skip_flag" ); sps3dExt.setDepthIntraSkipFlag( d, uiCode == 1 ); |
---|
1235 | } |
---|
1236 | } |
---|
1237 | pcSPS->setSps3dExtension( sps3dExt ); |
---|
1238 | } |
---|
1239 | #endif |
---|
1240 | |
---|
1241 | Void TDecCavlc::parsePpsMultilayerExtension(TComPPS* pcPPS) |
---|
1242 | { |
---|
1243 | UInt uiCode = 0; |
---|
1244 | READ_FLAG( uiCode, "poc_reset_info_present_flag" ); pcPPS->setPocResetInfoPresentFlag( uiCode == 1 ); |
---|
1245 | READ_FLAG( uiCode, "pps_infer_scaling_list_flag" ); pcPPS->setPpsInferScalingListFlag( uiCode == 1 ); |
---|
1246 | if (pcPPS->getPpsInferScalingListFlag()) |
---|
1247 | { |
---|
1248 | READ_CODE( 6, uiCode, "pps_scaling_list_ref_layer_id" ); pcPPS->setPpsScalingListRefLayerId( uiCode ); |
---|
1249 | } |
---|
1250 | |
---|
1251 | UInt numRefLocOffsets;; |
---|
1252 | READ_UVLC( numRefLocOffsets, "num_ref_loc_offsets" ); |
---|
1253 | |
---|
1254 | // All of the following stuff is not needed, but allowed to be present. |
---|
1255 | for (Int i = 0; i < numRefLocOffsets; i++ ) |
---|
1256 | { |
---|
1257 | Int iCode = 0; |
---|
1258 | READ_CODE( 6, uiCode, "ref_loc_offset_layer_id" ); |
---|
1259 | READ_FLAG( uiCode, "scaled_ref_layer_offset_present_flag" ); |
---|
1260 | |
---|
1261 | if (uiCode) |
---|
1262 | { |
---|
1263 | READ_SVLC( iCode, "scaled_ref_layer_left_offset" ); |
---|
1264 | READ_SVLC( iCode, "scaled_ref_layer_top_offset" ); |
---|
1265 | READ_SVLC( iCode, "scaled_ref_layer_right_offset" ); |
---|
1266 | READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" ); |
---|
1267 | } |
---|
1268 | |
---|
1269 | READ_FLAG( uiCode, "ref_region_offset_present_flag" ); |
---|
1270 | if (uiCode) |
---|
1271 | { |
---|
1272 | READ_SVLC( iCode, "ref_region_left_offset" ); |
---|
1273 | READ_SVLC( iCode, "ref_region_top_offset" ); |
---|
1274 | READ_SVLC( iCode, "ref_region_right_offset" ); |
---|
1275 | READ_SVLC( iCode, "ref_region_bottom_offset" ); |
---|
1276 | } |
---|
1277 | |
---|
1278 | READ_FLAG( uiCode, "resample_phase_set_present_flag" ); |
---|
1279 | if (uiCode) |
---|
1280 | { |
---|
1281 | READ_UVLC( uiCode, "phase_hor_luma" ); |
---|
1282 | READ_UVLC( uiCode, "phase_ver_luma" ); |
---|
1283 | READ_UVLC( uiCode, "phase_hor_chroma_plus8" ); |
---|
1284 | READ_UVLC( uiCode, "phase_ver_chroma_plus8" ); |
---|
1285 | } |
---|
1286 | } |
---|
1287 | READ_FLAG( uiCode, "colour_mapping_enabled_flag" ); |
---|
1288 | // This is required to equal to 0 for Multiview Main profile. |
---|
1289 | assert( uiCode == 0 ); |
---|
1290 | } |
---|
1291 | |
---|
1292 | #endif |
---|
1293 | |
---|
1294 | Void TDecCavlc::parseVPS(TComVPS* pcVPS) |
---|
1295 | { |
---|
1296 | #if ENC_DEC_TRACE |
---|
1297 | #if H_MV_ENC_DEC_TRAC |
---|
1298 | tracePSHeader( "VPS", getDecTop()->getLayerId() ); |
---|
1299 | #else |
---|
1300 | xTraceVPSHeader (); |
---|
1301 | #endif |
---|
1302 | #endif |
---|
1303 | |
---|
1304 | UInt uiCode; |
---|
1305 | |
---|
1306 | READ_CODE( 4, uiCode, "vps_video_parameter_set_id" ); pcVPS->setVPSId( uiCode ); |
---|
1307 | #if NH_MV |
---|
1308 | READ_FLAG( uiCode, "vps_base_layer_internal_flag" ); pcVPS->setVpsBaseLayerInternalFlag( uiCode == 1 ); |
---|
1309 | READ_FLAG( uiCode, "vps_base_layer_available_flag" ); pcVPS->setVpsBaseLayerAvailableFlag( uiCode == 1 ); |
---|
1310 | #else |
---|
1311 | READ_FLAG( uiCode, "vps_base_layer_internal_flag" ); assert(uiCode == 1); |
---|
1312 | READ_FLAG( uiCode, "vps_base_layer_available_flag" ); assert(uiCode == 1); |
---|
1313 | #endif |
---|
1314 | #if NH_MV |
---|
1315 | READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); pcVPS->setMaxLayersMinus1( std::min( uiCode, (UInt) ( MAX_NUM_LAYER_IDS-1) ) ); |
---|
1316 | #else |
---|
1317 | READ_CODE( 6, uiCode, "vps_max_layers_minus1" ); |
---|
1318 | #endif |
---|
1319 | READ_CODE( 3, uiCode, "vps_max_sub_layers_minus1" ); pcVPS->setMaxTLayers( uiCode + 1 ); assert(uiCode+1 <= MAX_TLAYER); |
---|
1320 | READ_FLAG( uiCode, "vps_temporal_id_nesting_flag" ); pcVPS->setTemporalNestingFlag( uiCode ? true:false ); |
---|
1321 | assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag()); |
---|
1322 | READ_CODE( 16, uiCode, "vps_reserved_0xffff_16bits" ); assert(uiCode == 0xffff); |
---|
1323 | parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1); |
---|
1324 | #if NH_MV |
---|
1325 | pcVPS->getPTL()->inferGeneralValues ( true, 0, NULL ); |
---|
1326 | pcVPS->getPTL()->inferSubLayerValues( pcVPS->getMaxTLayers() - 1, 0, NULL ); |
---|
1327 | #endif |
---|
1328 | UInt subLayerOrderingInfoPresentFlag; |
---|
1329 | READ_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag"); |
---|
1330 | for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++) |
---|
1331 | { |
---|
1332 | READ_UVLC( uiCode, "vps_max_dec_pic_buffering_minus1[i]" ); pcVPS->setMaxDecPicBuffering( uiCode + 1, i ); |
---|
1333 | READ_UVLC( uiCode, "vps_max_num_reorder_pics[i]" ); pcVPS->setNumReorderPics( uiCode, i ); |
---|
1334 | READ_UVLC( uiCode, "vps_max_latency_increase_plus1[i]" ); pcVPS->setMaxLatencyIncrease( uiCode, i ); |
---|
1335 | |
---|
1336 | if (!subLayerOrderingInfoPresentFlag) |
---|
1337 | { |
---|
1338 | for (i++; i <= pcVPS->getMaxTLayers()-1; i++) |
---|
1339 | { |
---|
1340 | pcVPS->setMaxDecPicBuffering(pcVPS->getMaxDecPicBuffering(0), i); |
---|
1341 | pcVPS->setNumReorderPics(pcVPS->getNumReorderPics(0), i); |
---|
1342 | pcVPS->setMaxLatencyIncrease(pcVPS->getMaxLatencyIncrease(0), i); |
---|
1343 | } |
---|
1344 | break; |
---|
1345 | } |
---|
1346 | } |
---|
1347 | |
---|
1348 | assert( pcVPS->getNumHrdParameters() < MAX_VPS_OP_SETS_PLUS1 ); |
---|
1349 | #if NH_MV |
---|
1350 | assert( pcVPS->getVpsMaxLayerId() < MAX_VPS_NUH_LAYER_ID_PLUS1 ); |
---|
1351 | READ_CODE( 6, uiCode, "vps_max_layer_id" ); pcVPS->setVpsMaxLayerId( uiCode ); |
---|
1352 | |
---|
1353 | READ_UVLC( uiCode, "vps_num_layer_sets_minus1" ); pcVPS->setVpsNumLayerSetsMinus1( uiCode ); |
---|
1354 | for( UInt opsIdx = 1; opsIdx <= pcVPS->getVpsNumLayerSetsMinus1(); opsIdx ++ ) |
---|
1355 | { |
---|
1356 | for( UInt i = 0; i <= pcVPS->getVpsMaxLayerId(); i ++ ) |
---|
1357 | #else |
---|
1358 | assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 ); |
---|
1359 | READ_CODE( 6, uiCode, "vps_max_layer_id" ); pcVPS->setMaxNuhReservedZeroLayerId( uiCode ); |
---|
1360 | READ_UVLC( uiCode, "vps_num_layer_sets_minus1" ); pcVPS->setMaxOpSets( uiCode + 1 ); |
---|
1361 | for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getMaxOpSets() - 1 ); opsIdx ++ ) |
---|
1362 | { |
---|
1363 | // Operation point set |
---|
1364 | for( UInt i = 0; i <= pcVPS->getMaxNuhReservedZeroLayerId(); i ++ ) |
---|
1365 | #endif |
---|
1366 | { |
---|
1367 | READ_FLAG( uiCode, "layer_id_included_flag[opsIdx][i]" ); pcVPS->setLayerIdIncludedFlag( uiCode == 1 ? true : false, opsIdx, i ); |
---|
1368 | } |
---|
1369 | } |
---|
1370 | #if NH_MV |
---|
1371 | pcVPS->deriveLayerSetLayerIdList(); |
---|
1372 | #endif |
---|
1373 | |
---|
1374 | TimingInfo *timingInfo = pcVPS->getTimingInfo(); |
---|
1375 | READ_FLAG( uiCode, "vps_timing_info_present_flag"); timingInfo->setTimingInfoPresentFlag (uiCode ? true : false); |
---|
1376 | if(timingInfo->getTimingInfoPresentFlag()) |
---|
1377 | { |
---|
1378 | READ_CODE( 32, uiCode, "vps_num_units_in_tick"); timingInfo->setNumUnitsInTick (uiCode); |
---|
1379 | READ_CODE( 32, uiCode, "vps_time_scale"); timingInfo->setTimeScale (uiCode); |
---|
1380 | READ_FLAG( uiCode, "vps_poc_proportional_to_timing_flag"); timingInfo->setPocProportionalToTimingFlag(uiCode ? true : false); |
---|
1381 | if(timingInfo->getPocProportionalToTimingFlag()) |
---|
1382 | { |
---|
1383 | READ_UVLC( uiCode, "vps_num_ticks_poc_diff_one_minus1"); timingInfo->setNumTicksPocDiffOneMinus1 (uiCode); |
---|
1384 | } |
---|
1385 | |
---|
1386 | READ_UVLC( uiCode, "vps_num_hrd_parameters" ); pcVPS->setNumHrdParameters( uiCode ); |
---|
1387 | |
---|
1388 | if( pcVPS->getNumHrdParameters() > 0 ) |
---|
1389 | { |
---|
1390 | pcVPS->createHrdParamBuffer(); |
---|
1391 | } |
---|
1392 | for( UInt i = 0; i < pcVPS->getNumHrdParameters(); i ++ ) |
---|
1393 | { |
---|
1394 | READ_UVLC( uiCode, "hrd_layer_set_idx[i]" ); pcVPS->setHrdOpSetIdx( uiCode, i ); |
---|
1395 | if( i > 0 ) |
---|
1396 | { |
---|
1397 | READ_FLAG( uiCode, "cprms_present_flag[i]" ); pcVPS->setCprmsPresentFlag( uiCode == 1 ? true : false, i ); |
---|
1398 | } |
---|
1399 | else |
---|
1400 | { |
---|
1401 | pcVPS->setCprmsPresentFlag( true, i ); |
---|
1402 | } |
---|
1403 | |
---|
1404 | parseHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); |
---|
1405 | } |
---|
1406 | } |
---|
1407 | #if NH_MV |
---|
1408 | READ_FLAG( uiCode, "vps_extension_flag" ); pcVPS->setVpsExtensionFlag( uiCode == 1 ? true : false ); |
---|
1409 | if ( pcVPS->getVpsExtensionFlag() ) |
---|
1410 | #else |
---|
1411 | READ_FLAG( uiCode, "vps_extension_flag" ); |
---|
1412 | if (uiCode) |
---|
1413 | #endif |
---|
1414 | { |
---|
1415 | #if NH_MV |
---|
1416 | m_pcBitstream->readOutTrailingBits(); |
---|
1417 | parseVPSExtension( pcVPS ); |
---|
1418 | READ_FLAG( uiCode, "vps_extension2_flag" ); |
---|
1419 | if (uiCode) |
---|
1420 | { |
---|
1421 | #if NH_3D |
---|
1422 | READ_FLAG( uiCode, "vps_3d_extension_flag" ); |
---|
1423 | if ( uiCode ) |
---|
1424 | { |
---|
1425 | m_pcBitstream->readOutTrailingBits(); |
---|
1426 | pcVPS->createCamPars(pcVPS->getNumViews()); |
---|
1427 | parseVps3dExtension( pcVPS ); |
---|
1428 | } |
---|
1429 | READ_FLAG( uiCode, "vps_extension3_flag" ); |
---|
1430 | if (uiCode) |
---|
1431 | { |
---|
1432 | #endif |
---|
1433 | #endif |
---|
1434 | while ( xMoreRbspData() ) |
---|
1435 | { |
---|
1436 | READ_FLAG( uiCode, "vps_extension_data_flag"); |
---|
1437 | } |
---|
1438 | #if NH_MV |
---|
1439 | #if NH_3D |
---|
1440 | } |
---|
1441 | #endif |
---|
1442 | } |
---|
1443 | #endif |
---|
1444 | } |
---|
1445 | |
---|
1446 | xReadRbspTrailingBits(); |
---|
1447 | } |
---|
1448 | |
---|
1449 | #if NH_MV |
---|
1450 | Void TDecCavlc::parseVPSExtension( TComVPS* pcVPS ) |
---|
1451 | { |
---|
1452 | UInt uiCode; |
---|
1453 | |
---|
1454 | if( pcVPS->getMaxLayersMinus1() > 0 && pcVPS->getVpsBaseLayerInternalFlag() ) |
---|
1455 | { |
---|
1456 | parsePTL( pcVPS->getPTL( 1 ),0, pcVPS->getMaxSubLayersMinus1() ); |
---|
1457 | |
---|
1458 | pcVPS->getPTL( 1 )->inferGeneralValues ( false, 1, pcVPS->getPTL( 0 ) ); |
---|
1459 | pcVPS->getPTL( 1 )->inferSubLayerValues( pcVPS->getMaxSubLayersMinus1(), 1, pcVPS->getPTL( 0 ) ); |
---|
1460 | } |
---|
1461 | |
---|
1462 | READ_FLAG( uiCode, "splitting_flag" ); pcVPS->setSplittingFlag( uiCode == 1 ? true : false ); |
---|
1463 | |
---|
1464 | for( Int sIdx = 0; sIdx < MAX_NUM_SCALABILITY_TYPES; sIdx++ ) |
---|
1465 | { |
---|
1466 | READ_FLAG( uiCode, "scalability_mask_flag[i]" ); pcVPS->setScalabilityMaskFlag( sIdx, uiCode == 1 ? true : false ); |
---|
1467 | } |
---|
1468 | |
---|
1469 | for( Int sIdx = 0; sIdx < pcVPS->getNumScalabilityTypes( ) - ( pcVPS->getSplittingFlag() ? 1 : 0 ); sIdx++ ) |
---|
1470 | { |
---|
1471 | READ_CODE( 3, uiCode, "dimension_id_len_minus1[j]" ); pcVPS->setDimensionIdLen( sIdx, uiCode + 1 ); |
---|
1472 | } |
---|
1473 | |
---|
1474 | if ( pcVPS->getSplittingFlag() ) |
---|
1475 | { |
---|
1476 | pcVPS->setDimensionIdLen( pcVPS->getNumScalabilityTypes( ) - 1, pcVPS->inferLastDimsionIdLenMinus1() ); |
---|
1477 | } |
---|
1478 | |
---|
1479 | READ_FLAG( uiCode, "vps_nuh_layer_id_present_flag" ); pcVPS->setVpsNuhLayerIdPresentFlag( uiCode == 1 ? true : false ); |
---|
1480 | |
---|
1481 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1482 | { |
---|
1483 | if ( pcVPS->getVpsNuhLayerIdPresentFlag() ) |
---|
1484 | { |
---|
1485 | READ_CODE( 6, uiCode, "layer_id_in_nuh[i]" ); pcVPS->setLayerIdInNuh( i, uiCode ); |
---|
1486 | } |
---|
1487 | else |
---|
1488 | { |
---|
1489 | pcVPS->setLayerIdInNuh( i, i );; |
---|
1490 | } |
---|
1491 | |
---|
1492 | pcVPS->setLayerIdInVps( pcVPS->getLayerIdInNuh( i ), i ); |
---|
1493 | |
---|
1494 | for( Int j = 0; j < pcVPS->getNumScalabilityTypes() ; j++ ) |
---|
1495 | { |
---|
1496 | if ( !pcVPS->getSplittingFlag() ) |
---|
1497 | { |
---|
1498 | READ_CODE( pcVPS->getDimensionIdLen( j ), uiCode, "dimension_id[i][j]" ); pcVPS->setDimensionId( i, j, uiCode ); |
---|
1499 | } |
---|
1500 | else |
---|
1501 | { |
---|
1502 | pcVPS->setDimensionId( i, j, pcVPS->inferDimensionId( i, j) ); |
---|
1503 | } |
---|
1504 | } |
---|
1505 | } |
---|
1506 | |
---|
1507 | pcVPS->initNumViews(); |
---|
1508 | |
---|
1509 | READ_CODE( 4, uiCode, "view_id_len" ); pcVPS->setViewIdLen( uiCode ); |
---|
1510 | |
---|
1511 | if ( pcVPS->getViewIdLen( ) > 0 ) |
---|
1512 | { |
---|
1513 | for( Int i = 0; i < pcVPS->getNumViews(); i++ ) |
---|
1514 | { |
---|
1515 | READ_CODE( pcVPS->getViewIdLen( ), uiCode, "view_id_val[i]" ); pcVPS->setViewIdVal( i, uiCode ); |
---|
1516 | } |
---|
1517 | } |
---|
1518 | else |
---|
1519 | { |
---|
1520 | for( Int i = 0; i < pcVPS->getNumViews(); i++ ) |
---|
1521 | { |
---|
1522 | pcVPS->setViewIdVal( i, 0 ); |
---|
1523 | } |
---|
1524 | } |
---|
1525 | |
---|
1526 | #if NH_3D |
---|
1527 | pcVPS->initViewCompLayer( ); |
---|
1528 | #endif |
---|
1529 | |
---|
1530 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1531 | { |
---|
1532 | for( Int j = 0; j < i; j++ ) |
---|
1533 | { |
---|
1534 | READ_FLAG( uiCode, "direct_dependency_flag[i][j]" ); pcVPS->setDirectDependencyFlag( i, j, uiCode ); |
---|
1535 | } |
---|
1536 | } |
---|
1537 | pcVPS->setRefLayers(); |
---|
1538 | |
---|
1539 | if ( pcVPS->getNumIndependentLayers() > 1 ) |
---|
1540 | { |
---|
1541 | READ_UVLC( uiCode, "num_add_layer_sets" ); pcVPS->setNumAddLayerSets( uiCode ); |
---|
1542 | } |
---|
1543 | for (Int i = 0; i < pcVPS->getNumAddLayerSets(); i++) |
---|
1544 | { |
---|
1545 | for (Int j = 1; j < pcVPS->getNumIndependentLayers(); j++) |
---|
1546 | { |
---|
1547 | READ_CODE( pcVPS->getHighestLayerIdxPlus1Len( j ) , uiCode, "highest_layer_idx_plus1" ); pcVPS->setHighestLayerIdxPlus1( i, j, uiCode ); |
---|
1548 | } |
---|
1549 | pcVPS->deriveAddLayerSetLayerIdList( i ); |
---|
1550 | } |
---|
1551 | |
---|
1552 | READ_FLAG( uiCode, "vps_sub_layers_max_minus1_present_flag" ); pcVPS->setVpsSubLayersMaxMinus1PresentFlag( uiCode == 1 ); |
---|
1553 | if ( pcVPS->getVpsSubLayersMaxMinus1PresentFlag() ) |
---|
1554 | { |
---|
1555 | for (Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1556 | { |
---|
1557 | READ_CODE( 3, uiCode, "sub_layers_vps_max_minus1" ); pcVPS->setSubLayersVpsMaxMinus1( i, uiCode ); |
---|
1558 | pcVPS->checkSubLayersVpsMaxMinus1( i ); |
---|
1559 | } |
---|
1560 | } |
---|
1561 | else |
---|
1562 | { |
---|
1563 | for (Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1564 | { |
---|
1565 | pcVPS->setSubLayersVpsMaxMinus1( i, pcVPS->getMaxTLayers( ) - 1); |
---|
1566 | } |
---|
1567 | } |
---|
1568 | READ_FLAG( uiCode, "max_tid_ref_present_flag" ); pcVPS->setMaxTidRefPresentFlag( uiCode == 1 ); |
---|
1569 | |
---|
1570 | if ( pcVPS->getMaxTidRefPresentFlag() ) |
---|
1571 | { |
---|
1572 | for( Int i = 0; i < pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1573 | { |
---|
1574 | for( Int j = i + 1; j <= pcVPS->getMaxLayersMinus1(); j++ ) |
---|
1575 | { |
---|
1576 | if ( pcVPS->getDirectDependencyFlag(j,i) ) |
---|
1577 | { |
---|
1578 | READ_CODE( 3, uiCode, "max_tid_il_ref_pics_plus1" ); pcVPS->setMaxTidIlRefPicsPlus1( i, j, uiCode ); |
---|
1579 | } |
---|
1580 | } |
---|
1581 | } |
---|
1582 | } |
---|
1583 | |
---|
1584 | READ_FLAG( uiCode, "all_ref_layers_active_flag" ); pcVPS->setAllRefLayersActiveFlag( uiCode == 1 ); |
---|
1585 | READ_UVLC( uiCode, "vps_num_profile_tier_level_minus1" ); pcVPS->setVpsNumProfileTierLevelMinus1( uiCode ); |
---|
1586 | |
---|
1587 | Int offsetVal = ( pcVPS->getMaxLayersMinus1() > 0 && pcVPS->getVpsBaseLayerInternalFlag() ) ? 2 : 1; |
---|
1588 | for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 2 : 1; i <= pcVPS->getVpsNumProfileTierLevelMinus1(); i++ ) |
---|
1589 | { |
---|
1590 | READ_FLAG( uiCode, "vps_profile_present_flag[i]" ); pcVPS->setVpsProfilePresentFlag( i, uiCode == 1 ); |
---|
1591 | parsePTL ( pcVPS->getPTL( offsetVal ), pcVPS->getVpsProfilePresentFlag( i ), pcVPS->getMaxTLayers()-1); |
---|
1592 | pcVPS->getPTL( offsetVal )->inferGeneralValues ( pcVPS->getVpsProfilePresentFlag( i ), offsetVal, pcVPS->getPTL( offsetVal - 1 ) ); |
---|
1593 | pcVPS->getPTL( offsetVal )->inferSubLayerValues( pcVPS->getMaxSubLayersMinus1() , offsetVal, pcVPS->getPTL( offsetVal - 1 ) ); |
---|
1594 | offsetVal++; |
---|
1595 | } |
---|
1596 | |
---|
1597 | |
---|
1598 | if (pcVPS->getNumLayerSets() > 1) |
---|
1599 | { |
---|
1600 | READ_UVLC( uiCode, "num_add_olss" ); pcVPS->setNumAddOlss( uiCode ); |
---|
1601 | READ_CODE( 2, uiCode, "default_output_layer_idc" ); pcVPS->setDefaultOutputLayerIdc( std::min( uiCode, (UInt) 2 ) ); |
---|
1602 | } |
---|
1603 | |
---|
1604 | pcVPS->initTargetLayerIdLists( ); |
---|
1605 | |
---|
1606 | |
---|
1607 | pcVPS->setOutputLayerFlag(0, 0, pcVPS->inferOutputLayerFlag( 0, 0 )); |
---|
1608 | pcVPS->setLayerSetIdxForOlsMinus1(0, -1); |
---|
1609 | |
---|
1610 | pcVPS->deriveNecessaryLayerFlags( 0 ); |
---|
1611 | pcVPS->deriveTargetLayerIdList( 0 ); |
---|
1612 | |
---|
1613 | if (pcVPS->getVpsBaseLayerInternalFlag() ) |
---|
1614 | { |
---|
1615 | pcVPS->setProfileTierLevelIdx(0,0, pcVPS->inferProfileTierLevelIdx(0,0) ); |
---|
1616 | } |
---|
1617 | for( Int i = 1; i < pcVPS->getNumOutputLayerSets( ); i++ ) |
---|
1618 | { |
---|
1619 | if( pcVPS->getNumLayerSets() > 2 && i >= pcVPS->getNumLayerSets( ) ) |
---|
1620 | { |
---|
1621 | READ_CODE( pcVPS->getLayerSetIdxForOlsMinus1Len( i ), uiCode, "layer_set_idx_for_ols_minus1[i]" ); pcVPS->setLayerSetIdxForOlsMinus1( i, uiCode ); |
---|
1622 | } |
---|
1623 | |
---|
1624 | if ( i > pcVPS->getVpsNumLayerSetsMinus1() || pcVPS->getDefaultOutputLayerIdc() == 2 ) |
---|
1625 | { |
---|
1626 | for( Int j = 0; j < pcVPS->getNumLayersInIdList( pcVPS->olsIdxToLsIdx( i ) ); j++ ) |
---|
1627 | { |
---|
1628 | READ_FLAG( uiCode, "output_layer_flag" ); pcVPS->setOutputLayerFlag( i, j, uiCode == 1 ); |
---|
1629 | } |
---|
1630 | } |
---|
1631 | else |
---|
1632 | { |
---|
1633 | for( Int j = 0; j < pcVPS->getNumLayersInIdList( pcVPS->olsIdxToLsIdx( i ) ); j++ ) |
---|
1634 | { |
---|
1635 | pcVPS->setOutputLayerFlag(i,j, pcVPS->inferOutputLayerFlag( i, j )); |
---|
1636 | } |
---|
1637 | } |
---|
1638 | pcVPS->deriveNecessaryLayerFlags( i ); |
---|
1639 | pcVPS->deriveTargetLayerIdList( i ); |
---|
1640 | |
---|
1641 | for ( Int j = 0; j < pcVPS->getNumLayersInIdList( pcVPS->olsIdxToLsIdx(i)); j++ ) |
---|
1642 | { |
---|
1643 | if (pcVPS->getNecessaryLayerFlag( i, j ) && pcVPS->getVpsNumProfileTierLevelMinus1() > 0 ) |
---|
1644 | { |
---|
1645 | READ_CODE( pcVPS->getProfileTierLevelIdxLen(), uiCode,"profile_tier_level_idx[ i ][ j ]" ); pcVPS->setProfileTierLevelIdx( i, j, uiCode ); |
---|
1646 | } |
---|
1647 | if (pcVPS->getNecessaryLayerFlag( i, j ) && pcVPS->getVpsNumProfileTierLevelMinus1() == 0 ) |
---|
1648 | { |
---|
1649 | pcVPS->setProfileTierLevelIdx( i , j, pcVPS->inferProfileTierLevelIdx( i, j) ); |
---|
1650 | } |
---|
1651 | } |
---|
1652 | |
---|
1653 | if( pcVPS->getNumOutputLayersInOutputLayerSet( i ) == 1 && pcVPS->getNumDirectRefLayers( pcVPS->getOlsHighestOutputLayerId( i ) ) > 0 ) |
---|
1654 | { |
---|
1655 | READ_FLAG( uiCode, "alt_output_layer_flag[ i ]" ); pcVPS->setAltOutputLayerFlag( i, uiCode == 1 ); |
---|
1656 | } |
---|
1657 | } |
---|
1658 | |
---|
1659 | READ_UVLC( uiCode, "vps_num_rep_formats_minus1" ); pcVPS->setVpsNumRepFormatsMinus1( uiCode ); |
---|
1660 | |
---|
1661 | std::vector<TComRepFormat> repFormats; |
---|
1662 | repFormats.resize( pcVPS->getVpsNumRepFormatsMinus1() + 1 ); |
---|
1663 | for (Int i = 0; i <= pcVPS->getVpsNumRepFormatsMinus1(); i++ ) |
---|
1664 | { |
---|
1665 | TComRepFormat* curRepFormat = &repFormats[i]; |
---|
1666 | TComRepFormat* prevRepFormat = i > 0 ? &repFormats[ i - 1] : NULL; |
---|
1667 | parseRepFormat( i, curRepFormat , prevRepFormat); |
---|
1668 | } |
---|
1669 | pcVPS->setRepFormat( repFormats ); |
---|
1670 | |
---|
1671 | if ( pcVPS->getVpsNumRepFormatsMinus1() > 0 ) |
---|
1672 | { |
---|
1673 | READ_FLAG( uiCode, "rep_format_idx_present_flag" ); pcVPS->setRepFormatIdxPresentFlag( uiCode == 1 ); |
---|
1674 | } |
---|
1675 | if( pcVPS->getRepFormatIdxPresentFlag() ) |
---|
1676 | { |
---|
1677 | for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 1 : 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1678 | { |
---|
1679 | READ_CODE( pcVPS->getVpsRepFormatIdxLen(), uiCode, "vps_rep_format_idx[i]" ); pcVPS->setVpsRepFormatIdx( i, uiCode ); |
---|
1680 | } |
---|
1681 | } |
---|
1682 | else |
---|
1683 | { |
---|
1684 | for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 1 : 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1685 | { |
---|
1686 | pcVPS->setVpsRepFormatIdx( i, pcVPS->inferVpsRepFormatIdx( i ) ); |
---|
1687 | } |
---|
1688 | } |
---|
1689 | |
---|
1690 | READ_FLAG( uiCode, "max_one_active_ref_layer_flag" ); pcVPS->setMaxOneActiveRefLayerFlag ( uiCode == 1 ); |
---|
1691 | |
---|
1692 | READ_FLAG( uiCode, "vps_poc_lsb_aligned_flag" ); pcVPS->setVpsPocLsbAlignedFlag( uiCode == 1 ); |
---|
1693 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1694 | { |
---|
1695 | if( pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ) == 0 ) |
---|
1696 | { |
---|
1697 | READ_FLAG( uiCode, "poc_lsb_not_present_flag" ); pcVPS->setPocLsbNotPresentFlag( i, uiCode == 1 ); |
---|
1698 | } |
---|
1699 | } |
---|
1700 | |
---|
1701 | parseDpbSize( pcVPS ); |
---|
1702 | |
---|
1703 | READ_UVLC( uiCode, "direct_dep_type_len_minus2") ; pcVPS->setDirectDepTypeLenMinus2 ( uiCode ); |
---|
1704 | |
---|
1705 | READ_FLAG( uiCode, "default_direct_dependency_flag" ); pcVPS->setDefaultDirectDependencyFlag( uiCode == 1 ); |
---|
1706 | if ( pcVPS->getDefaultDirectDependencyFlag( ) ) |
---|
1707 | { |
---|
1708 | READ_CODE( pcVPS->getDirectDepTypeLenMinus2( ) + 2, uiCode, "default_direct_dependency_type" ); pcVPS->setDefaultDirectDependencyType( uiCode ); |
---|
1709 | } |
---|
1710 | |
---|
1711 | for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 1 : 2; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1712 | { |
---|
1713 | for( Int j = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; j < i; j++ ) |
---|
1714 | { |
---|
1715 | if (pcVPS->getDirectDependencyFlag( i, j) ) |
---|
1716 | { |
---|
1717 | if ( pcVPS->getDefaultDirectDependencyFlag( ) ) |
---|
1718 | { |
---|
1719 | pcVPS->setDirectDependencyType( i, j , pcVPS->getDefaultDirectDependencyType( ) ); |
---|
1720 | } |
---|
1721 | else |
---|
1722 | { |
---|
1723 | |
---|
1724 | READ_CODE( pcVPS->getDirectDepTypeLenMinus2( ) + 2, uiCode, "direct_dependency_type[i][j]" ); pcVPS->setDirectDependencyType( i, j , uiCode); |
---|
1725 | } |
---|
1726 | } |
---|
1727 | } |
---|
1728 | } |
---|
1729 | READ_UVLC( uiCode, "vps_non_vui_extension_length" ); pcVPS->setVpsNonVuiExtensionLength( uiCode ); |
---|
1730 | for ( Int i = 1; i <= pcVPS->getVpsNonVuiExtensionLength(); i++ ) |
---|
1731 | { |
---|
1732 | READ_CODE( 8, uiCode, "vps_non_vui_extension_data_byte" ); |
---|
1733 | } |
---|
1734 | READ_FLAG( uiCode, "vps_vui_present_flag" ); pcVPS->setVpsVuiPresentFlag( uiCode == 1 ); |
---|
1735 | |
---|
1736 | TComVPSVUI vpsVui; |
---|
1737 | if( pcVPS->getVpsVuiPresentFlag() ) |
---|
1738 | { |
---|
1739 | m_pcBitstream->readOutTrailingBits(); // vps_vui_alignment_bit_equal_to_one |
---|
1740 | parseVPSVUI( pcVPS, &vpsVui ); |
---|
1741 | } |
---|
1742 | else |
---|
1743 | { |
---|
1744 | // inference of syntax elements that differ from default inference (as done in constructor), when VPS VUI is not present |
---|
1745 | vpsVui.setCrossLayerIrapAlignedFlag( false ); |
---|
1746 | } |
---|
1747 | pcVPS->setVPSVUI( vpsVui ); |
---|
1748 | pcVPS->checkVPSExtensionSyntax(); |
---|
1749 | } |
---|
1750 | |
---|
1751 | Void TDecCavlc::parseRepFormat( Int i, TComRepFormat* pcRepFormat, const TComRepFormat* pcPrevRepFormat ) |
---|
1752 | { |
---|
1753 | assert( pcRepFormat ); |
---|
1754 | |
---|
1755 | UInt uiCode; |
---|
1756 | |
---|
1757 | READ_CODE( 16, uiCode, "pic_width_vps_in_luma_samples" ); pcRepFormat->setPicWidthVpsInLumaSamples ( uiCode ); |
---|
1758 | READ_CODE( 16, uiCode, "pic_height_vps_in_luma_samples" ); pcRepFormat->setPicHeightVpsInLumaSamples( uiCode ); |
---|
1759 | READ_FLAG( uiCode, "chroma_and_bit_depth_vps_present_flag" ); pcRepFormat->setChromaAndBitDepthVpsPresentFlag( uiCode == 1 ); |
---|
1760 | |
---|
1761 | pcRepFormat->checkChromaAndBitDepthVpsPresentFlag( i ); |
---|
1762 | |
---|
1763 | if ( pcRepFormat->getChromaAndBitDepthVpsPresentFlag() ) |
---|
1764 | { |
---|
1765 | READ_CODE( 2, uiCode, "chroma_format_vps_idc" ); pcRepFormat->setChromaFormatVpsIdc ( uiCode ); |
---|
1766 | if ( pcRepFormat->getChromaFormatVpsIdc() == 3 ) |
---|
1767 | { |
---|
1768 | READ_FLAG( uiCode, "separate_colour_plane_vps_flag" ); pcRepFormat->setSeparateColourPlaneVpsFlag( uiCode == 1 ); |
---|
1769 | } |
---|
1770 | READ_CODE( 4, uiCode, "bit_depth_vps_luma_minus8" ); pcRepFormat->setBitDepthVpsLumaMinus8 ( uiCode ); |
---|
1771 | READ_CODE( 4, uiCode, "bit_depth_vps_chroma_minus8" ); pcRepFormat->setBitDepthVpsChromaMinus8 ( uiCode ); |
---|
1772 | } |
---|
1773 | else |
---|
1774 | { |
---|
1775 | pcRepFormat->inferChromaAndBitDepth(pcPrevRepFormat ); |
---|
1776 | } |
---|
1777 | READ_FLAG( uiCode, "conformance_window_vps_flag" ); pcRepFormat->setConformanceWindowVpsFlag( uiCode == 1 ); |
---|
1778 | if ( pcRepFormat->getConformanceWindowVpsFlag() ) |
---|
1779 | { |
---|
1780 | READ_UVLC( uiCode, "conf_win_vps_left_offset" ); pcRepFormat->setConfWinVpsLeftOffset( uiCode ); |
---|
1781 | READ_UVLC( uiCode, "conf_win_vps_right_offset" ); pcRepFormat->setConfWinVpsRightOffset( uiCode ); |
---|
1782 | READ_UVLC( uiCode, "conf_win_vps_top_offset" ); pcRepFormat->setConfWinVpsTopOffset( uiCode ); |
---|
1783 | READ_UVLC( uiCode, "conf_win_vps_bottom_offset" ); pcRepFormat->setConfWinVpsBottomOffset( uiCode ); |
---|
1784 | } |
---|
1785 | } |
---|
1786 | |
---|
1787 | |
---|
1788 | Void TDecCavlc::parseVPSVUI( const TComVPS* pcVPS, TComVPSVUI* vpsVui ) |
---|
1789 | { |
---|
1790 | assert( pcVPS ); |
---|
1791 | assert( vpsVui ); |
---|
1792 | |
---|
1793 | vpsVui->init(pcVPS->getNumAddLayerSets(),pcVPS->getMaxSubLayersMinus1() + 1, pcVPS->getMaxLayersMinus1() + 1 ); |
---|
1794 | |
---|
1795 | UInt uiCode; |
---|
1796 | READ_FLAG( uiCode, "cross_layer_pic_type_aligned_flag" ); vpsVui->setCrossLayerPicTypeAlignedFlag( uiCode == 1 ); |
---|
1797 | if ( !vpsVui->getCrossLayerPicTypeAlignedFlag() ) |
---|
1798 | { |
---|
1799 | READ_FLAG( uiCode, "cross_layer_irap_aligned_flag" ); vpsVui->setCrossLayerIrapAlignedFlag( uiCode == 1 ); |
---|
1800 | } |
---|
1801 | if( vpsVui->getCrossLayerIrapAlignedFlag( ) ) |
---|
1802 | { |
---|
1803 | READ_FLAG( uiCode, "all_layers_idr_aligned_flag" ); vpsVui->setAllLayersIdrAlignedFlag( uiCode == 1 ); |
---|
1804 | } |
---|
1805 | READ_FLAG( uiCode, "bit_rate_present_vps_flag" ); vpsVui->setBitRatePresentVpsFlag( uiCode == 1 ); |
---|
1806 | READ_FLAG( uiCode, "pic_rate_present_vps_flag" ); vpsVui->setPicRatePresentVpsFlag( uiCode == 1 ); |
---|
1807 | if( vpsVui->getBitRatePresentVpsFlag( ) || vpsVui->getPicRatePresentVpsFlag( ) ) |
---|
1808 | { |
---|
1809 | for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i < pcVPS->getNumLayerSets(); i++ ) |
---|
1810 | { |
---|
1811 | for( Int j = 0; j <= pcVPS->getMaxSubLayersInLayerSetMinus1( i ); j++ ) |
---|
1812 | { |
---|
1813 | if( vpsVui->getBitRatePresentVpsFlag( ) ) |
---|
1814 | { |
---|
1815 | READ_FLAG( uiCode, "bit_rate_present_flag" ); vpsVui->setBitRatePresentFlag( i, j, uiCode == 1 ); |
---|
1816 | } |
---|
1817 | if( vpsVui->getPicRatePresentVpsFlag( ) ) |
---|
1818 | { |
---|
1819 | READ_FLAG( uiCode, "pic_rate_present_flag" ); vpsVui->setPicRatePresentFlag( i, j, uiCode == 1 ); |
---|
1820 | } |
---|
1821 | if( vpsVui->getBitRatePresentFlag( i, j ) ) |
---|
1822 | { |
---|
1823 | READ_CODE( 16, uiCode, "avg_bit_rate" ); vpsVui->setAvgBitRate( i, j, uiCode ); |
---|
1824 | READ_CODE( 16, uiCode, "max_bit_rate" ); vpsVui->setMaxBitRate( i, j, uiCode ); |
---|
1825 | } |
---|
1826 | if( vpsVui->getPicRatePresentFlag( i, j ) ) |
---|
1827 | { |
---|
1828 | READ_CODE( 2, uiCode, "constant_pic_rate_idc" ); vpsVui->setConstantPicRateIdc( i, j, uiCode ); |
---|
1829 | READ_CODE( 16, uiCode, "avg_pic_rate" ); vpsVui->setAvgPicRate( i, j, uiCode ); |
---|
1830 | } |
---|
1831 | } |
---|
1832 | } |
---|
1833 | } |
---|
1834 | |
---|
1835 | READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); vpsVui->setVideoSignalInfoIdxPresentFlag( uiCode == 1 ); |
---|
1836 | if( vpsVui->getVideoSignalInfoIdxPresentFlag() ) |
---|
1837 | { |
---|
1838 | READ_CODE( 4, uiCode, "vps_num_video_signal_info_minus1" ); vpsVui->setVpsNumVideoSignalInfoMinus1( uiCode ); |
---|
1839 | } |
---|
1840 | else |
---|
1841 | { |
---|
1842 | vpsVui->setVpsNumVideoSignalInfoMinus1( pcVPS->getMaxLayersMinus1() - pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1 ); |
---|
1843 | } |
---|
1844 | |
---|
1845 | std::vector<TComVideoSignalInfo> videoSignalInfos; |
---|
1846 | videoSignalInfos.resize(vpsVui->getVpsNumVideoSignalInfoMinus1() + 1 ); |
---|
1847 | |
---|
1848 | for( Int i = 0; i <= vpsVui->getVpsNumVideoSignalInfoMinus1(); i++ ) |
---|
1849 | { |
---|
1850 | parseVideoSignalInfo( &videoSignalInfos[i] ); |
---|
1851 | } |
---|
1852 | vpsVui->setVideoSignalInfo( videoSignalInfos ); |
---|
1853 | |
---|
1854 | if( vpsVui->getVideoSignalInfoIdxPresentFlag() && vpsVui->getVpsNumVideoSignalInfoMinus1() > 0 ) |
---|
1855 | { |
---|
1856 | for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1857 | { |
---|
1858 | READ_CODE( 4, uiCode, "vps_video_signal_info_idx" ); vpsVui->setVpsVideoSignalInfoIdx( i, uiCode ); |
---|
1859 | } |
---|
1860 | } |
---|
1861 | else if ( !vpsVui->getVideoSignalInfoIdxPresentFlag() ) |
---|
1862 | { |
---|
1863 | for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1864 | { |
---|
1865 | vpsVui->setVpsVideoSignalInfoIdx( i, i ); |
---|
1866 | } |
---|
1867 | } |
---|
1868 | else |
---|
1869 | { |
---|
1870 | for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1871 | { |
---|
1872 | vpsVui->setVpsVideoSignalInfoIdx( i, 0 ); |
---|
1873 | } |
---|
1874 | } |
---|
1875 | |
---|
1876 | READ_FLAG( uiCode, "tiles_not_in_use_flag" ); vpsVui->setTilesNotInUseFlag( uiCode == 1 ); |
---|
1877 | if( !vpsVui->getTilesNotInUseFlag() ) |
---|
1878 | { |
---|
1879 | for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 0 : 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1880 | { |
---|
1881 | READ_FLAG( uiCode, "tiles_in_use_flag[i]" ); vpsVui->setTilesInUseFlag( i, uiCode == 1 ); |
---|
1882 | if( vpsVui->getTilesInUseFlag( i ) ) |
---|
1883 | { |
---|
1884 | READ_FLAG( uiCode, "loop_filter_not_across_tiles_flag[i]" ); vpsVui->setLoopFilterNotAcrossTilesFlag( i, uiCode == 1 ); |
---|
1885 | } |
---|
1886 | } |
---|
1887 | for( Int i = pcVPS->getVpsBaseLayerInternalFlag() ? 1 : 2; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1888 | { |
---|
1889 | for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ) ; j++ ) |
---|
1890 | { |
---|
1891 | Int layerIdx = pcVPS->getLayerIdInVps(pcVPS->getIdDirectRefLayer(pcVPS->getLayerIdInNuh( i ) , j )); |
---|
1892 | if( vpsVui->getTilesInUseFlag( i ) && vpsVui->getTilesInUseFlag( layerIdx ) ) |
---|
1893 | { |
---|
1894 | READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vpsVui->setTileBoundariesAlignedFlag( i, j, uiCode == 1 ); |
---|
1895 | } |
---|
1896 | } |
---|
1897 | } |
---|
1898 | } |
---|
1899 | |
---|
1900 | READ_FLAG( uiCode, "wpp_not_in_use_flag" ); vpsVui->setWppNotInUseFlag( uiCode == 1 ); |
---|
1901 | |
---|
1902 | if( !vpsVui->getWppNotInUseFlag( )) |
---|
1903 | { |
---|
1904 | for( Int i = 0; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1905 | { |
---|
1906 | READ_FLAG( uiCode, "wpp_in_use_flag[i]" ); vpsVui->setWppInUseFlag( i, uiCode == 1 ); |
---|
1907 | } |
---|
1908 | } |
---|
1909 | READ_FLAG( uiCode, "single_layer_for_non_irap_flag" ); vpsVui->setSingleLayerForNonIrapFlag( uiCode == 1 ); |
---|
1910 | READ_FLAG( uiCode, "higher_layer_irap_skip_flag" ); vpsVui->setHigherLayerIrapSkipFlag( uiCode == 1 ); |
---|
1911 | READ_FLAG( uiCode, "ilp_restricted_ref_layers_flag" ); vpsVui->setIlpRestrictedRefLayersFlag( uiCode == 1 ); |
---|
1912 | |
---|
1913 | if( vpsVui->getIlpRestrictedRefLayersFlag( ) ) |
---|
1914 | { |
---|
1915 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1916 | { |
---|
1917 | for( Int j = 0; j < pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i ) ); j++ ) |
---|
1918 | { |
---|
1919 | if( pcVPS->getVpsBaseLayerInternalFlag() || pcVPS->getIdDirectRefLayer( pcVPS->getLayerIdInNuh( i ), j ) > 0 ) |
---|
1920 | { |
---|
1921 | READ_UVLC( uiCode, "min_spatial_segment_offset_plus1" ); vpsVui->setMinSpatialSegmentOffsetPlus1( i, j, uiCode ); |
---|
1922 | if( vpsVui->getMinSpatialSegmentOffsetPlus1( i, j ) > 0 ) |
---|
1923 | { |
---|
1924 | READ_FLAG( uiCode, "ctu_based_offset_enabled_flag" ); vpsVui->setCtuBasedOffsetEnabledFlag( i, j, uiCode == 1 ); |
---|
1925 | if( vpsVui->getCtuBasedOffsetEnabledFlag( i, j ) ) |
---|
1926 | { |
---|
1927 | READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1" ); vpsVui->setMinHorizontalCtuOffsetPlus1( i, j, uiCode ); |
---|
1928 | } |
---|
1929 | } |
---|
1930 | } |
---|
1931 | } |
---|
1932 | } |
---|
1933 | } |
---|
1934 | |
---|
1935 | READ_FLAG( uiCode, "vps_vui_bsp_hrd_present_flag" ); vpsVui->setVpsVuiBspHrdPresentFlag( uiCode == 1 ); |
---|
1936 | if ( vpsVui->getVpsVuiBspHrdPresentFlag( ) ) |
---|
1937 | { |
---|
1938 | assert(pcVPS->getTimingInfo()->getTimingInfoPresentFlag() == 1); |
---|
1939 | parseVpsVuiBspHrdParameters( pcVPS, vpsVui ); |
---|
1940 | } |
---|
1941 | for( Int i = 1; i <= pcVPS->getMaxLayersMinus1(); i++ ) |
---|
1942 | { |
---|
1943 | if( pcVPS->getNumDirectRefLayers( pcVPS->getLayerIdInNuh( i )) == 0 ) |
---|
1944 | { |
---|
1945 | READ_FLAG( uiCode, "base_layer_parameter_set_compatibility_flag" ); vpsVui->setBaseLayerParameterSetCompatibilityFlag( i, uiCode == 1 ); |
---|
1946 | } |
---|
1947 | } |
---|
1948 | } |
---|
1949 | |
---|
1950 | Void TDecCavlc::parseVpsVuiBspHrdParameters( const TComVPS* pcVPS, TComVPSVUI* vpsVui ) |
---|
1951 | { |
---|
1952 | assert( pcVPS ); |
---|
1953 | assert( vpsVui ); |
---|
1954 | |
---|
1955 | TComVpsVuiBspHrdParameters vpsVuiBspHrdP; |
---|
1956 | |
---|
1957 | UInt uiCode; |
---|
1958 | READ_UVLC( uiCode, "vps_num_add_hrd_params" ); vpsVuiBspHrdP.setVpsNumAddHrdParams( uiCode ); |
---|
1959 | vpsVuiBspHrdP.createAfterVpsNumAddHrdParams( pcVPS ); |
---|
1960 | for( Int i = pcVPS->getNumHrdParameters(); i < pcVPS->getNumHrdParameters() + vpsVuiBspHrdP.getVpsNumAddHrdParams(); i++ ) |
---|
1961 | { |
---|
1962 | if( i > 0 ) |
---|
1963 | { |
---|
1964 | READ_FLAG( uiCode, "cprms_add_present_flag" ); vpsVuiBspHrdP.setCprmsAddPresentFlag( i, uiCode == 1 ); |
---|
1965 | } |
---|
1966 | else |
---|
1967 | { |
---|
1968 | vpsVuiBspHrdP.setCprmsAddPresentFlag( i, true ); |
---|
1969 | } |
---|
1970 | |
---|
1971 | READ_UVLC( uiCode, "num_sub_layer_hrd_minus1" ); vpsVuiBspHrdP.setNumSubLayerHrdMinus1( i, uiCode ); |
---|
1972 | |
---|
1973 | TComHRD hrdParameters; |
---|
1974 | parseHrdParameters( &hrdParameters, vpsVuiBspHrdP.getCprmsAddPresentFlag( i ), vpsVuiBspHrdP.getNumSubLayerHrdMinus1( i ) ); |
---|
1975 | vpsVuiBspHrdP.setHrdParametermeters( i, hrdParameters ); |
---|
1976 | } |
---|
1977 | |
---|
1978 | vpsVuiBspHrdP.setNumPartitionsInSchemeMinus1( 0, 0, 0); |
---|
1979 | vpsVuiBspHrdP.createAfterNumPartitionsInSchemeMinus1( pcVPS, 0, 0 ); |
---|
1980 | |
---|
1981 | for( Int h = 0; h < pcVPS->getNumOutputLayerSets(); h++ ) |
---|
1982 | { |
---|
1983 | if ( h == 0) |
---|
1984 | { |
---|
1985 | vpsVuiBspHrdP.setNumSignalledPartitioningSchemes( h, 0 ); |
---|
1986 | } |
---|
1987 | else |
---|
1988 | { |
---|
1989 | READ_UVLC( uiCode, "num_signalled_partitioning_schemes" ); vpsVuiBspHrdP.setNumSignalledPartitioningSchemes( h, uiCode ); |
---|
1990 | } |
---|
1991 | vpsVuiBspHrdP.createAfterNumSignalledPartitioningSchemes( pcVPS, h ); |
---|
1992 | |
---|
1993 | for( Int j = 0; j < vpsVuiBspHrdP.getNumSignalledPartitioningSchemes( h ) + 1; j++ ) |
---|
1994 | { |
---|
1995 | if ( j == 0 && h == 0 ) |
---|
1996 | { |
---|
1997 | vpsVuiBspHrdP.setNumPartitionsInSchemeMinus1( h, j, uiCode ); |
---|
1998 | } |
---|
1999 | else if( j == 0 ) |
---|
2000 | { |
---|
2001 | vpsVuiBspHrdP.setNumPartitionsInSchemeMinus1( h, j, pcVPS->getNumLayersInIdList( h ) - 1 ); |
---|
2002 | } |
---|
2003 | else |
---|
2004 | { |
---|
2005 | READ_UVLC( uiCode, "num_partitions_in_scheme_minus1" ); vpsVuiBspHrdP.setNumPartitionsInSchemeMinus1( h, j, uiCode ); |
---|
2006 | } |
---|
2007 | vpsVuiBspHrdP.createAfterNumPartitionsInSchemeMinus1(pcVPS, h, j ); |
---|
2008 | |
---|
2009 | for( Int k = 0; k <= vpsVuiBspHrdP.getNumPartitionsInSchemeMinus1( h, j ); k++ ) |
---|
2010 | { |
---|
2011 | for( Int r = 0; r < pcVPS->getNumLayersInIdList(pcVPS->olsIdxToLsIdx( h ) ) ; r++ ) |
---|
2012 | { |
---|
2013 | if( h == 0 && j == 0 && k == 0 && r == 0 ) |
---|
2014 | { |
---|
2015 | vpsVuiBspHrdP.setLayerIncludedInPartitionFlag( h, j, k, r, true ); |
---|
2016 | } |
---|
2017 | else if ( h > 0 && j == 0 ) |
---|
2018 | { |
---|
2019 | vpsVuiBspHrdP.setLayerIncludedInPartitionFlag( h, j, k, r, (k == r) ); |
---|
2020 | } |
---|
2021 | else |
---|
2022 | { |
---|
2023 | READ_FLAG( uiCode, "layer_included_in_partition_flag" ); vpsVuiBspHrdP.setLayerIncludedInPartitionFlag( h, j, k, r, uiCode == 1 ); |
---|
2024 | } |
---|
2025 | } |
---|
2026 | } |
---|
2027 | } |
---|
2028 | if ( h > 0 ) |
---|
2029 | { |
---|
2030 | for( Int i = 0; i < vpsVuiBspHrdP.getNumSignalledPartitioningSchemes( h ) + 1; i++ ) |
---|
2031 | { |
---|
2032 | for( Int t = 0; t <= pcVPS->getMaxSubLayersInLayerSetMinus1( pcVPS->olsIdxToLsIdx( i ) ); t++ ) |
---|
2033 | { |
---|
2034 | READ_UVLC( uiCode, "num_bsp_schedules_minus1" ); vpsVuiBspHrdP.setNumBspSchedulesMinus1( h, i, t, uiCode ); |
---|
2035 | vpsVuiBspHrdP.createAfterNumBspSchedulesMinus1(pcVPS, h, i, t ); |
---|
2036 | for( Int j = 0; j <= vpsVuiBspHrdP.getNumBspSchedulesMinus1( h, i, t ); j++ ) |
---|
2037 | { |
---|
2038 | for( Int k = 0; k <= vpsVuiBspHrdP.getNumPartitionsInSchemeMinus1( h, j ); k++ ) |
---|
2039 | { |
---|
2040 | READ_CODE( vpsVuiBspHrdP.getBspHrdIdxLen( pcVPS ), uiCode, "bsp_hrd_idx" ); vpsVuiBspHrdP.setBspHrdIdx( h, i, t, j, k, uiCode ); |
---|
2041 | READ_UVLC( uiCode, "bsp_sched_idx" ); vpsVuiBspHrdP.setBspSchedIdx( h, i, t, j, k, uiCode ); |
---|
2042 | } |
---|
2043 | } |
---|
2044 | } |
---|
2045 | } |
---|
2046 | } |
---|
2047 | } |
---|
2048 | vpsVui->setVpsVuiBspHrdParameters( vpsVuiBspHrdP ); |
---|
2049 | } |
---|
2050 | |
---|
2051 | Void TDecCavlc::parseVideoSignalInfo( TComVideoSignalInfo* pcVideoSignalInfo ) |
---|
2052 | { |
---|
2053 | UInt uiCode; |
---|
2054 | READ_CODE( 3, uiCode, "video_vps_format" ); pcVideoSignalInfo->setVideoVpsFormat( uiCode ); |
---|
2055 | READ_FLAG( uiCode, "video_full_range_vps_flag" ); pcVideoSignalInfo->setVideoFullRangeVpsFlag( uiCode == 1 ); |
---|
2056 | READ_CODE( 8, uiCode, "colour_primaries_vps" ); pcVideoSignalInfo->setColourPrimariesVps( uiCode ); |
---|
2057 | READ_CODE( 8, uiCode, "transfer_characteristics_vps" ); pcVideoSignalInfo->setTransferCharacteristicsVps( uiCode ); |
---|
2058 | READ_CODE( 8, uiCode, "matrix_coeffs_vps" ); pcVideoSignalInfo->setMatrixCoeffsVps( uiCode ); |
---|
2059 | } |
---|
2060 | |
---|
2061 | Void TDecCavlc::parseDpbSize( TComVPS* vps ) |
---|
2062 | { |
---|
2063 | UInt uiCode; |
---|
2064 | TComDpbSize dpbSize; |
---|
2065 | |
---|
2066 | dpbSize.init( vps->getNumOutputLayerSets(), vps->getVpsMaxLayerId() + 1, vps->getMaxSubLayersMinus1() + 1 ) ; |
---|
2067 | |
---|
2068 | for( Int i = 1; i < vps->getNumOutputLayerSets(); i++ ) |
---|
2069 | { |
---|
2070 | Int currLsIdx = vps->olsIdxToLsIdx( i ); |
---|
2071 | READ_FLAG( uiCode, "sub_layer_flag_info_present_flag" ); dpbSize.setSubLayerFlagInfoPresentFlag( i, uiCode == 1 ); |
---|
2072 | for( Int j = 0; j <= vps->getMaxSubLayersInLayerSetMinus1( currLsIdx ); j++ ) |
---|
2073 | { |
---|
2074 | if( j > 0 && dpbSize.getSubLayerDpbInfoPresentFlag( i, j ) ) |
---|
2075 | { |
---|
2076 | READ_FLAG( uiCode, "sub_layer_dpb_info_present_flag" ); dpbSize.setSubLayerDpbInfoPresentFlag( i, j, uiCode == 1 ); |
---|
2077 | } |
---|
2078 | if( dpbSize.getSubLayerDpbInfoPresentFlag( i, j ) ) |
---|
2079 | { |
---|
2080 | for( Int k = 0; k < vps->getNumLayersInIdList( currLsIdx ); k++ ) |
---|
2081 | { |
---|
2082 | if ( vps->getNecessaryLayerFlag( i, k ) && ( vps->getVpsBaseLayerInternalFlag() || ( vps->getLayerSetLayerIdList(vps->olsIdxToLsIdx(i),k) != 0 ) )) |
---|
2083 | { |
---|
2084 | READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1" ); dpbSize.setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode ); |
---|
2085 | } |
---|
2086 | else |
---|
2087 | { |
---|
2088 | if ( vps->getNecessaryLayerFlag( i, k ) && ( j == 0 ) && ( k == 0 )) |
---|
2089 | { |
---|
2090 | dpbSize.setMaxVpsDecPicBufferingMinus1(i ,k, j, 0 ); |
---|
2091 | } |
---|
2092 | } |
---|
2093 | } |
---|
2094 | READ_UVLC( uiCode, "max_vps_num_reorder_pics" ); dpbSize.setMaxVpsNumReorderPics( i, j, uiCode ); |
---|
2095 | READ_UVLC( uiCode, "max_vps_latency_increase_plus1" ); dpbSize.setMaxVpsLatencyIncreasePlus1( i, j, uiCode ); |
---|
2096 | } |
---|
2097 | else |
---|
2098 | { |
---|
2099 | if ( j > 0 ) |
---|
2100 | { |
---|
2101 | for( Int k = 0; k < vps->getNumLayersInIdList( vps->olsIdxToLsIdx( i ) ); k++ ) |
---|
2102 | { |
---|
2103 | if ( vps->getNecessaryLayerFlag(i, k ) ) |
---|
2104 | { |
---|
2105 | dpbSize.setMaxVpsDecPicBufferingMinus1( i, k, j, dpbSize.getMaxVpsDecPicBufferingMinus1( i,k, j - 1 ) ); |
---|
2106 | } |
---|
2107 | } |
---|
2108 | dpbSize.setMaxVpsNumReorderPics ( i, j, dpbSize.getMaxVpsNumReorderPics ( i, j - 1 ) ); |
---|
2109 | dpbSize.setMaxVpsLatencyIncreasePlus1( i, j, dpbSize.getMaxVpsLatencyIncreasePlus1( i, j - 1 ) ); |
---|
2110 | } |
---|
2111 | } |
---|
2112 | } |
---|
2113 | } |
---|
2114 | vps->setDpbSize( dpbSize ); |
---|
2115 | } |
---|
2116 | |
---|
2117 | #if NH_3D |
---|
2118 | Void TDecCavlc::parseVps3dExtension( TComVPS* pcVPS ) |
---|
2119 | { |
---|
2120 | UInt uiCode; |
---|
2121 | READ_UVLC( uiCode, "cp_precision"); pcVPS->setCpPrecision( uiCode ) ; |
---|
2122 | |
---|
2123 | for (Int n = 1; n < pcVPS->getNumViews(); n++) |
---|
2124 | { |
---|
2125 | Int i = pcVPS->getViewOIdxList( n ); |
---|
2126 | Int iInVps = pcVPS->getVoiInVps( i ); |
---|
2127 | READ_CODE( 6, uiCode, "num_cp" ); pcVPS->setNumCp( iInVps, uiCode ); |
---|
2128 | |
---|
2129 | if( pcVPS->getNumCp( iInVps ) > 0 ) |
---|
2130 | { |
---|
2131 | READ_FLAG( uiCode, "cp_in_slice_segment_header_flag" ); pcVPS->setCpInSliceSegmentHeaderFlag( iInVps, uiCode == 1 ); |
---|
2132 | for( Int m = 0; m < pcVPS->getNumCp( iInVps ); m++ ) |
---|
2133 | { |
---|
2134 | READ_UVLC( uiCode, "cp_ref_voi" ); pcVPS->setCpRefVoi( iInVps, m, uiCode ); |
---|
2135 | if( !pcVPS->getCpInSliceSegmentHeaderFlag( iInVps ) ) |
---|
2136 | { |
---|
2137 | Int j = pcVPS->getCpRefVoi( iInVps, m ); |
---|
2138 | Int jInVps = pcVPS->getVoiInVps( j ); |
---|
2139 | Int iCode; |
---|
2140 | READ_SVLC( iCode, "vps_cp_scale" ); pcVPS->setVpsCpScale ( iInVps, jInVps, iCode ); |
---|
2141 | READ_SVLC( iCode, "vps_cp_off" ); pcVPS->setVpsCpOff ( iInVps, jInVps, iCode ); |
---|
2142 | READ_SVLC( iCode, "vps_cp_inv_scale_plus_scale" ); pcVPS->setVpsCpInvScale( iInVps, jInVps, iCode - pcVPS->getVpsCpScale( iInVps, jInVps ) ); |
---|
2143 | READ_SVLC( iCode, "vps_cp_inv_off_plus_off" ); pcVPS->setVpsCpInvOff ( iInVps, jInVps, iCode - pcVPS->getVpsCpOff ( iInVps, jInVps ) ); |
---|
2144 | } |
---|
2145 | } |
---|
2146 | } |
---|
2147 | } |
---|
2148 | pcVPS->deriveCpPresentFlag(); |
---|
2149 | } |
---|
2150 | #endif |
---|
2151 | #endif |
---|
2152 | |
---|
2153 | Void TDecCavlc::parseSliceHeader (TComSlice* pcSlice, ParameterSetManager *parameterSetManager, const Int prevTid0POC) |
---|
2154 | { |
---|
2155 | UInt uiCode; |
---|
2156 | Int iCode; |
---|
2157 | |
---|
2158 | #if ENC_DEC_TRACE |
---|
2159 | #if NH_MV |
---|
2160 | tracePSHeader( "Slice", pcSlice->getLayerId() ); |
---|
2161 | #else |
---|
2162 | xTraceSliceHeader(); |
---|
2163 | #endif |
---|
2164 | #endif |
---|
2165 | TComPPS* pps = NULL; |
---|
2166 | TComSPS* sps = NULL; |
---|
2167 | #if NH_MV |
---|
2168 | TComVPS* vps = NULL; |
---|
2169 | #endif |
---|
2170 | |
---|
2171 | UInt firstSliceSegmentInPic; |
---|
2172 | READ_FLAG( firstSliceSegmentInPic, "first_slice_segment_in_pic_flag" ); |
---|
2173 | if( pcSlice->getRapPicFlag()) |
---|
2174 | { |
---|
2175 | READ_FLAG( uiCode, "no_output_of_prior_pics_flag" ); //ignored -- updated already |
---|
2176 | pcSlice->setNoOutputPriorPicsFlag(uiCode ? true : false); |
---|
2177 | } |
---|
2178 | READ_UVLC ( uiCode, "slice_pic_parameter_set_id" ); pcSlice->setPPSId(uiCode); |
---|
2179 | pps = parameterSetManager->getPPS(uiCode); |
---|
2180 | //!KS: need to add error handling code here, if PPS is not available |
---|
2181 | assert(pps!=0); |
---|
2182 | sps = parameterSetManager->getSPS(pps->getSPSId()); |
---|
2183 | //!KS: need to add error handling code here, if SPS is not available |
---|
2184 | assert(sps!=0); |
---|
2185 | #if NH_MV |
---|
2186 | vps = parameterSetManager->getVPS(sps->getVPSId()); |
---|
2187 | assert( vps != NULL ); |
---|
2188 | m_decTop->initFromActiveVps( vps ); |
---|
2189 | Int targetOlsIdx = m_decTop->getTargetOlsIdx(); |
---|
2190 | |
---|
2191 | // Do inference |
---|
2192 | sps->inferRepFormat ( vps , pcSlice->getLayerId(), false ); |
---|
2193 | sps->inferScalingList( parameterSetManager->getActiveSPS( sps->getSpsScalingListRefLayerId() ) ); |
---|
2194 | sps->inferSpsMaxDecPicBufferingMinus1( vps, targetOlsIdx, pcSlice->getLayerId(), false ); |
---|
2195 | |
---|
2196 | if( sps->getMultiLayerExtSpsFlag() ) |
---|
2197 | { |
---|
2198 | sps->setTemporalIdNestingFlag( (sps->getMaxTLayers() > 1) ? vps->getTemporalNestingFlag() : true ); |
---|
2199 | } |
---|
2200 | |
---|
2201 | if ( sps->getVuiParametersPresentFlag() ) |
---|
2202 | { |
---|
2203 | sps->getVuiParameters()->inferVideoSignalInfo( vps, pcSlice->getLayerId() ); |
---|
2204 | } |
---|
2205 | |
---|
2206 | |
---|
2207 | pcSlice->setVPS(vps); |
---|
2208 | pcSlice->setSPS(sps); |
---|
2209 | pcSlice->setPPS(pps); |
---|
2210 | |
---|
2211 | pcSlice->setViewId ( vps->getViewId ( pcSlice->getLayerId() ) ); |
---|
2212 | pcSlice->setViewIndex( vps->getViewIndex( pcSlice->getLayerId() ) ); |
---|
2213 | #if NH_3D |
---|
2214 | pcSlice->setIsDepth ( vps->getDepthId ( pcSlice->getLayerId() ) == 1 ); |
---|
2215 | #endif |
---|
2216 | #endif |
---|
2217 | |
---|
2218 | const ChromaFormat chFmt = sps->getChromaFormatIdc(); |
---|
2219 | const UInt numValidComp=getNumberValidComponents(chFmt); |
---|
2220 | const Bool bChroma=(chFmt!=CHROMA_400); |
---|
2221 | |
---|
2222 | if( pps->getDependentSliceSegmentsEnabledFlag() && ( !firstSliceSegmentInPic )) |
---|
2223 | { |
---|
2224 | READ_FLAG( uiCode, "dependent_slice_segment_flag" ); pcSlice->setDependentSliceSegmentFlag(uiCode ? true : false); |
---|
2225 | } |
---|
2226 | else |
---|
2227 | { |
---|
2228 | pcSlice->setDependentSliceSegmentFlag(false); |
---|
2229 | } |
---|
2230 | Int numCTUs = ((sps->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((sps->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight()); |
---|
2231 | UInt sliceSegmentAddress = 0; |
---|
2232 | Int bitsSliceSegmentAddress = 0; |
---|
2233 | while(numCTUs>(1<<bitsSliceSegmentAddress)) |
---|
2234 | { |
---|
2235 | bitsSliceSegmentAddress++; |
---|
2236 | } |
---|
2237 | |
---|
2238 | if(!firstSliceSegmentInPic) |
---|
2239 | { |
---|
2240 | READ_CODE( bitsSliceSegmentAddress, sliceSegmentAddress, "slice_segment_address" ); |
---|
2241 | } |
---|
2242 | //set uiCode to equal slice start address (or dependent slice start address) |
---|
2243 | pcSlice->setSliceSegmentCurStartCtuTsAddr( sliceSegmentAddress );// this is actually a Raster-Scan (RS) address, but we do not have the RS->TS conversion table defined yet. |
---|
2244 | pcSlice->setSliceSegmentCurEndCtuTsAddr(numCTUs); // Set end as the last CTU of the picture. |
---|
2245 | |
---|
2246 | #if NH_MV |
---|
2247 | UInt slicePicOrderCntLsb = 0; |
---|
2248 | #endif |
---|
2249 | |
---|
2250 | |
---|
2251 | if (!pcSlice->getDependentSliceSegmentFlag()) |
---|
2252 | { |
---|
2253 | pcSlice->setSliceCurStartCtuTsAddr(sliceSegmentAddress); // this is actually a Raster-Scan (RS) address, but we do not have the RS->TS conversion table defined yet. |
---|
2254 | pcSlice->setSliceCurEndCtuTsAddr(numCTUs); |
---|
2255 | } |
---|
2256 | |
---|
2257 | if(!pcSlice->getDependentSliceSegmentFlag()) |
---|
2258 | { |
---|
2259 | #if NH_MV |
---|
2260 | Int esb = 0; //Don't use i, otherwise will shadow something below |
---|
2261 | |
---|
2262 | if ( pps->getNumExtraSliceHeaderBits() > esb ) |
---|
2263 | { |
---|
2264 | esb++; |
---|
2265 | READ_FLAG( uiCode, "discardable_flag" ); pcSlice->setDiscardableFlag( uiCode == 1 ); |
---|
2266 | if ( uiCode == 1 ) |
---|
2267 | { |
---|
2268 | assert(pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_TRAIL_R && |
---|
2269 | pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_TSA_R && |
---|
2270 | pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_STSA_R && |
---|
2271 | pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RADL_R && |
---|
2272 | pcSlice->getNalUnitType() != NAL_UNIT_CODED_SLICE_RASL_R); |
---|
2273 | } |
---|
2274 | } |
---|
2275 | |
---|
2276 | if ( pps->getNumExtraSliceHeaderBits() > esb ) |
---|
2277 | { |
---|
2278 | esb++; |
---|
2279 | READ_FLAG( uiCode, "cross_layer_bla_flag" ); pcSlice->setCrossLayerBlaFlag( uiCode == 1 ); |
---|
2280 | } |
---|
2281 | pcSlice->checkCrossLayerBlaFlag( ); |
---|
2282 | |
---|
2283 | |
---|
2284 | for (; esb < pps->getNumExtraSliceHeaderBits(); esb++) |
---|
2285 | #else |
---|
2286 | for (Int i = 0; i < pps->getNumExtraSliceHeaderBits(); i++) |
---|
2287 | #endif |
---|
2288 | { |
---|
2289 | READ_FLAG(uiCode, "slice_reserved_flag[]"); // ignored |
---|
2290 | } |
---|
2291 | |
---|
2292 | READ_UVLC ( uiCode, "slice_type" ); pcSlice->setSliceType((SliceType)uiCode); |
---|
2293 | if( pps->getOutputFlagPresentFlag() ) |
---|
2294 | { |
---|
2295 | READ_FLAG( uiCode, "pic_output_flag" ); pcSlice->setPicOutputFlag( uiCode ? true : false ); |
---|
2296 | } |
---|
2297 | else |
---|
2298 | { |
---|
2299 | pcSlice->setPicOutputFlag( true ); |
---|
2300 | } |
---|
2301 | |
---|
2302 | // if (separate_colour_plane_flag == 1) |
---|
2303 | // read colour_plane_id |
---|
2304 | // (separate_colour_plane_flag == 1) is not supported in this version of the standard. |
---|
2305 | |
---|
2306 | #if NH_MV |
---|
2307 | Int iPOClsb = slicePicOrderCntLsb; // Needed later |
---|
2308 | if ( (pcSlice->getLayerId() > 0 && !vps->getPocLsbNotPresentFlag( pcSlice->getLayerIdInVps())) || !pcSlice->getIdrPicFlag() ) |
---|
2309 | { |
---|
2310 | READ_CODE(sps->getBitsForPOC(), slicePicOrderCntLsb, "slice_pic_order_cnt_lsb"); |
---|
2311 | } |
---|
2312 | pcSlice->setSlicePicOrderCntLsb( slicePicOrderCntLsb ); |
---|
2313 | |
---|
2314 | Bool picOrderCntMSBZeroFlag = false; |
---|
2315 | |
---|
2316 | // as in HM code. However are all cases for IRAP picture with NoRaslOutputFlag equal to 1 covered?? |
---|
2317 | picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP ); |
---|
2318 | picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ); |
---|
2319 | picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ); |
---|
2320 | picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || pcSlice->getIdrPicFlag(); |
---|
2321 | |
---|
2322 | // TBD picOrderCntMSBZeroFlag = picOrderCntMSBZeroFlag || ( rpcSlice->getLayerId() > 0 && !rpcSlice->getFirstPicInLayerDecodedFlag() ); |
---|
2323 | |
---|
2324 | Int picOrderCntMSB = 0; |
---|
2325 | |
---|
2326 | if ( !picOrderCntMSBZeroFlag ) |
---|
2327 | { |
---|
2328 | Int prevPicOrderCnt = prevTid0POC; |
---|
2329 | Int maxPicOrderCntLsb = 1 << sps->getBitsForPOC(); |
---|
2330 | Int prevPicOrderCntLsb = prevPicOrderCnt & (maxPicOrderCntLsb - 1); |
---|
2331 | Int prevPicOrderCntMsb = prevPicOrderCnt - prevPicOrderCntLsb; |
---|
2332 | |
---|
2333 | if( ( slicePicOrderCntLsb < prevPicOrderCntLsb ) && ( ( prevPicOrderCntLsb - slicePicOrderCntLsb ) >= ( maxPicOrderCntLsb / 2 ) ) ) |
---|
2334 | { |
---|
2335 | picOrderCntMSB = prevPicOrderCntMsb + maxPicOrderCntLsb; |
---|
2336 | } |
---|
2337 | else if( (slicePicOrderCntLsb > prevPicOrderCntLsb ) && ( (slicePicOrderCntLsb - prevPicOrderCntLsb ) > ( maxPicOrderCntLsb / 2 ) ) ) |
---|
2338 | { |
---|
2339 | picOrderCntMSB = prevPicOrderCntMsb - maxPicOrderCntLsb; |
---|
2340 | } |
---|
2341 | else |
---|
2342 | { |
---|
2343 | picOrderCntMSB = prevPicOrderCntMsb; |
---|
2344 | } |
---|
2345 | } |
---|
2346 | |
---|
2347 | pcSlice->setPOC( picOrderCntMSB + slicePicOrderCntLsb ); |
---|
2348 | if ( pcSlice->getPocResetFlag() ) |
---|
2349 | { |
---|
2350 | pcSlice->setPocBeforeReset ( pcSlice->getPOC() ); |
---|
2351 | pcSlice->setPOC ( 0 ); |
---|
2352 | } |
---|
2353 | #endif |
---|
2354 | |
---|
2355 | if( pcSlice->getIdrPicFlag() ) |
---|
2356 | { |
---|
2357 | #if !NH_MV |
---|
2358 | pcSlice->setPOC(0); |
---|
2359 | #endif |
---|
2360 | TComReferencePictureSet* rps = pcSlice->getLocalRPS(); |
---|
2361 | rps->setNumberOfNegativePictures(0); |
---|
2362 | rps->setNumberOfPositivePictures(0); |
---|
2363 | rps->setNumberOfLongtermPictures(0); |
---|
2364 | rps->setNumberOfPictures(0); |
---|
2365 | pcSlice->setRPS(rps); |
---|
2366 | #if NH_MV |
---|
2367 | pcSlice->setEnableTMVPFlag(false); |
---|
2368 | #endif |
---|
2369 | } |
---|
2370 | else |
---|
2371 | { |
---|
2372 | #if !NH_MV |
---|
2373 | READ_CODE(sps->getBitsForPOC(), uiCode, "slice_pic_order_cnt_lsb"); |
---|
2374 | Int iPOClsb = uiCode; |
---|
2375 | Int iPrevPOC = prevTid0POC; |
---|
2376 | Int iMaxPOClsb = 1<< sps->getBitsForPOC(); |
---|
2377 | Int iPrevPOClsb = iPrevPOC & (iMaxPOClsb - 1); |
---|
2378 | Int iPrevPOCmsb = iPrevPOC-iPrevPOClsb; |
---|
2379 | Int iPOCmsb; |
---|
2380 | if( ( iPOClsb < iPrevPOClsb ) && ( ( iPrevPOClsb - iPOClsb ) >= ( iMaxPOClsb / 2 ) ) ) |
---|
2381 | { |
---|
2382 | iPOCmsb = iPrevPOCmsb + iMaxPOClsb; |
---|
2383 | } |
---|
2384 | else if( (iPOClsb > iPrevPOClsb ) && ( (iPOClsb - iPrevPOClsb ) > ( iMaxPOClsb / 2 ) ) ) |
---|
2385 | { |
---|
2386 | iPOCmsb = iPrevPOCmsb - iMaxPOClsb; |
---|
2387 | } |
---|
2388 | else |
---|
2389 | { |
---|
2390 | iPOCmsb = iPrevPOCmsb; |
---|
2391 | } |
---|
2392 | if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
2393 | || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
2394 | || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) |
---|
2395 | { |
---|
2396 | // For BLA picture types, POCmsb is set to 0. |
---|
2397 | iPOCmsb = 0; |
---|
2398 | } |
---|
2399 | pcSlice->setPOC (iPOCmsb+iPOClsb); |
---|
2400 | #endif |
---|
2401 | TComReferencePictureSet* rps; |
---|
2402 | rps = pcSlice->getLocalRPS(); |
---|
2403 | pcSlice->setRPS(rps); |
---|
2404 | READ_FLAG( uiCode, "short_term_ref_pic_set_sps_flag" ); |
---|
2405 | if(uiCode == 0) // use short-term reference picture set explicitly signalled in slice header |
---|
2406 | { |
---|
2407 | parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets()); |
---|
2408 | #if NH_MV |
---|
2409 | if ( !rps->getInterRPSPrediction( ) ) |
---|
2410 | { // check sum of num_positive_pics and num_negative_pics |
---|
2411 | rps->checkMaxNumPics( |
---|
2412 | vps->getVpsExtensionFlag(), |
---|
2413 | MAX_INT, // To be replaced by MaxDbpSize |
---|
2414 | pcSlice->getLayerId(), |
---|
2415 | sps->getMaxDecPicBuffering( sps->getSpsMaxSubLayersMinus1() ) - 1 ); |
---|
2416 | } |
---|
2417 | #endif |
---|
2418 | |
---|
2419 | } |
---|
2420 | else // use reference to short-term reference picture set in PPS |
---|
2421 | { |
---|
2422 | Int numBits = 0; |
---|
2423 | while ((1 << numBits) < sps->getRPSList()->getNumberOfReferencePictureSets()) |
---|
2424 | { |
---|
2425 | numBits++; |
---|
2426 | } |
---|
2427 | if (numBits > 0) |
---|
2428 | { |
---|
2429 | READ_CODE( numBits, uiCode, "short_term_ref_pic_set_idx"); |
---|
2430 | } |
---|
2431 | else |
---|
2432 | { |
---|
2433 | uiCode = 0; |
---|
2434 | |
---|
2435 | } |
---|
2436 | *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode)); |
---|
2437 | } |
---|
2438 | if(sps->getLongTermRefsPresent()) |
---|
2439 | { |
---|
2440 | Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); |
---|
2441 | UInt numOfLtrp = 0; |
---|
2442 | UInt numLtrpInSPS = 0; |
---|
2443 | if (sps->getNumLongTermRefPicSPS() > 0) |
---|
2444 | { |
---|
2445 | READ_UVLC( uiCode, "num_long_term_sps"); |
---|
2446 | numLtrpInSPS = uiCode; |
---|
2447 | numOfLtrp += numLtrpInSPS; |
---|
2448 | rps->setNumberOfLongtermPictures(numOfLtrp); |
---|
2449 | } |
---|
2450 | Int bitsForLtrpInSPS = 0; |
---|
2451 | while (sps->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) |
---|
2452 | { |
---|
2453 | bitsForLtrpInSPS++; |
---|
2454 | } |
---|
2455 | READ_UVLC( uiCode, "num_long_term_pics"); rps->setNumberOfLongtermPictures(uiCode); |
---|
2456 | numOfLtrp += uiCode; |
---|
2457 | rps->setNumberOfLongtermPictures(numOfLtrp); |
---|
2458 | Int maxPicOrderCntLSB = 1 << sps->getBitsForPOC(); |
---|
2459 | Int prevDeltaMSB = 0, deltaPocMSBCycleLT = 0; |
---|
2460 | for(Int j=offset+rps->getNumberOfLongtermPictures()-1, k = 0; k < numOfLtrp; j--, k++) |
---|
2461 | { |
---|
2462 | Int pocLsbLt; |
---|
2463 | if (k < numLtrpInSPS) |
---|
2464 | { |
---|
2465 | uiCode = 0; |
---|
2466 | if (bitsForLtrpInSPS > 0) |
---|
2467 | { |
---|
2468 | READ_CODE(bitsForLtrpInSPS, uiCode, "lt_idx_sps[i]"); |
---|
2469 | } |
---|
2470 | Bool usedByCurrFromSPS=sps->getUsedByCurrPicLtSPSFlag(uiCode); |
---|
2471 | |
---|
2472 | pocLsbLt = sps->getLtRefPicPocLsbSps(uiCode); |
---|
2473 | rps->setUsed(j,usedByCurrFromSPS); |
---|
2474 | } |
---|
2475 | else |
---|
2476 | { |
---|
2477 | READ_CODE(sps->getBitsForPOC(), uiCode, "poc_lsb_lt"); pocLsbLt= uiCode; |
---|
2478 | READ_FLAG( uiCode, "used_by_curr_pic_lt_flag"); rps->setUsed(j,uiCode); |
---|
2479 | } |
---|
2480 | READ_FLAG(uiCode,"delta_poc_msb_present_flag"); |
---|
2481 | Bool mSBPresentFlag = uiCode ? true : false; |
---|
2482 | if(mSBPresentFlag) |
---|
2483 | { |
---|
2484 | READ_UVLC( uiCode, "delta_poc_msb_cycle_lt[i]" ); |
---|
2485 | Bool deltaFlag = false; |
---|
2486 | // First LTRP || First LTRP from SH |
---|
2487 | if( (j == offset+rps->getNumberOfLongtermPictures()-1) || (j == offset+(numOfLtrp-numLtrpInSPS)-1) ) |
---|
2488 | { |
---|
2489 | deltaFlag = true; |
---|
2490 | } |
---|
2491 | if(deltaFlag) |
---|
2492 | { |
---|
2493 | deltaPocMSBCycleLT = uiCode; |
---|
2494 | } |
---|
2495 | else |
---|
2496 | { |
---|
2497 | deltaPocMSBCycleLT = uiCode + prevDeltaMSB; |
---|
2498 | } |
---|
2499 | |
---|
2500 | Int pocLTCurr = pcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB |
---|
2501 | - iPOClsb + pocLsbLt; |
---|
2502 | rps->setPOC (j, pocLTCurr); |
---|
2503 | rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLTCurr); |
---|
2504 | rps->setCheckLTMSBPresent(j,true); |
---|
2505 | } |
---|
2506 | else |
---|
2507 | { |
---|
2508 | rps->setPOC (j, pocLsbLt); |
---|
2509 | rps->setDeltaPOC(j, - pcSlice->getPOC() + pocLsbLt); |
---|
2510 | rps->setCheckLTMSBPresent(j,false); |
---|
2511 | |
---|
2512 | // reset deltaPocMSBCycleLT for first LTRP from slice header if MSB not present |
---|
2513 | if( j == offset+(numOfLtrp-numLtrpInSPS)-1 ) |
---|
2514 | { |
---|
2515 | deltaPocMSBCycleLT = 0; |
---|
2516 | } |
---|
2517 | } |
---|
2518 | prevDeltaMSB = deltaPocMSBCycleLT; |
---|
2519 | } |
---|
2520 | offset += rps->getNumberOfLongtermPictures(); |
---|
2521 | rps->setNumberOfPictures(offset); |
---|
2522 | } |
---|
2523 | #if NH_MV |
---|
2524 | if ( !rps->getInterRPSPrediction( ) ) |
---|
2525 | { // check sum of NumPositivePics, NumNegativePics, num_long_term_sps and num_long_term_pics |
---|
2526 | rps->checkMaxNumPics( |
---|
2527 | vps->getVpsExtensionFlag(), |
---|
2528 | MAX_INT, // To be replaced by MaxDbpsize |
---|
2529 | pcSlice->getLayerId(), |
---|
2530 | sps->getMaxDecPicBuffering( sps->getSpsMaxSubLayersMinus1() ) - 1 ); |
---|
2531 | } |
---|
2532 | #endif |
---|
2533 | |
---|
2534 | if ( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP |
---|
2535 | || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL |
---|
2536 | || pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP ) |
---|
2537 | { |
---|
2538 | // In the case of BLA picture types, rps data is read from slice header but ignored |
---|
2539 | rps = pcSlice->getLocalRPS(); |
---|
2540 | rps->setNumberOfNegativePictures(0); |
---|
2541 | rps->setNumberOfPositivePictures(0); |
---|
2542 | rps->setNumberOfLongtermPictures(0); |
---|
2543 | rps->setNumberOfPictures(0); |
---|
2544 | pcSlice->setRPS(rps); |
---|
2545 | } |
---|
2546 | if (sps->getTMVPFlagsPresent()) |
---|
2547 | { |
---|
2548 | #if NH_MV |
---|
2549 | READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); |
---|
2550 | #else |
---|
2551 | READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" ); |
---|
2552 | #endif |
---|
2553 | pcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false ); |
---|
2554 | } |
---|
2555 | else |
---|
2556 | { |
---|
2557 | pcSlice->setEnableTMVPFlag(false); |
---|
2558 | } |
---|
2559 | } |
---|
2560 | #if NH_MV |
---|
2561 | Bool interLayerPredLayerIdcPresentFlag = false; |
---|
2562 | Int layerId = pcSlice->getLayerId(); |
---|
2563 | #if NH_3D |
---|
2564 | if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumRefListLayers( layerId ) > 0 ) |
---|
2565 | #else |
---|
2566 | if( pcSlice->getLayerId() > 0 && !vps->getAllRefLayersActiveFlag() && vps->getNumDirectRefLayers( layerId ) > 0 ) |
---|
2567 | #endif |
---|
2568 | { |
---|
2569 | READ_FLAG( uiCode, "inter_layer_pred_enabled_flag" ); pcSlice->setInterLayerPredEnabledFlag( uiCode == 1 ); |
---|
2570 | #if NH_3D |
---|
2571 | if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumRefListLayers( layerId ) > 1 ) |
---|
2572 | #else |
---|
2573 | if( pcSlice->getInterLayerPredEnabledFlag() && vps->getNumDirectRefLayers( layerId ) > 1 ) |
---|
2574 | #endif |
---|
2575 | { |
---|
2576 | if( !vps->getMaxOneActiveRefLayerFlag()) |
---|
2577 | { |
---|
2578 | READ_CODE( pcSlice->getNumInterLayerRefPicsMinus1Len( ), uiCode, "num_inter_layer_ref_pics_minus1" ); pcSlice->setNumInterLayerRefPicsMinus1( uiCode ); |
---|
2579 | } |
---|
2580 | #if NH_3D |
---|
2581 | if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumRefListLayers( layerId ) ) |
---|
2582 | #else |
---|
2583 | if ( pcSlice->getNumActiveRefLayerPics() != vps->getNumDirectRefLayers( layerId ) ) |
---|
2584 | #endif |
---|
2585 | { |
---|
2586 | interLayerPredLayerIdcPresentFlag = true; |
---|
2587 | for( Int idx = 0; idx < pcSlice->getNumActiveRefLayerPics(); idx++ ) |
---|
2588 | { |
---|
2589 | READ_CODE( pcSlice->getInterLayerPredLayerIdcLen( ), uiCode, "inter_layer_pred_layer_idc" ); pcSlice->setInterLayerPredLayerIdc( idx, uiCode ); |
---|
2590 | } |
---|
2591 | } |
---|
2592 | } |
---|
2593 | } |
---|
2594 | if ( !interLayerPredLayerIdcPresentFlag ) |
---|
2595 | { |
---|
2596 | for( Int i = 0; i < pcSlice->getNumActiveRefLayerPics(); i++ ) |
---|
2597 | { |
---|
2598 | pcSlice->setInterLayerPredLayerIdc( i, pcSlice->getRefLayerPicIdc( i ) ); |
---|
2599 | } |
---|
2600 | } |
---|
2601 | #if NH_3D |
---|
2602 | if ( getDecTop()->decProcAnnexI() ) |
---|
2603 | { |
---|
2604 | pcSlice->deriveInCmpPredAndCpAvailFlag( ); |
---|
2605 | if ( pcSlice->getInCmpPredAvailFlag() ) |
---|
2606 | { |
---|
2607 | READ_FLAG(uiCode, "in_comp_pred_flag"); pcSlice->setInCompPredFlag((Bool)uiCode); |
---|
2608 | } |
---|
2609 | pcSlice->init3dToolParameters(); |
---|
2610 | } |
---|
2611 | #endif |
---|
2612 | #endif |
---|
2613 | if(sps->getUseSAO()) |
---|
2614 | { |
---|
2615 | READ_FLAG(uiCode, "slice_sao_luma_flag"); pcSlice->setSaoEnabledFlag(CHANNEL_TYPE_LUMA, (Bool)uiCode); |
---|
2616 | |
---|
2617 | if (bChroma) |
---|
2618 | { |
---|
2619 | READ_FLAG(uiCode, "slice_sao_chroma_flag"); pcSlice->setSaoEnabledFlag(CHANNEL_TYPE_CHROMA, (Bool)uiCode); |
---|
2620 | } |
---|
2621 | } |
---|
2622 | |
---|
2623 | if (pcSlice->getIdrPicFlag()) |
---|
2624 | { |
---|
2625 | pcSlice->setEnableTMVPFlag(false); |
---|
2626 | } |
---|
2627 | if (!pcSlice->isIntra()) |
---|
2628 | { |
---|
2629 | |
---|
2630 | READ_FLAG( uiCode, "num_ref_idx_active_override_flag"); |
---|
2631 | if (uiCode) |
---|
2632 | { |
---|
2633 | READ_UVLC (uiCode, "num_ref_idx_l0_active_minus1" ); pcSlice->setNumRefIdx( REF_PIC_LIST_0, uiCode + 1 ); |
---|
2634 | if (pcSlice->isInterB()) |
---|
2635 | { |
---|
2636 | READ_UVLC (uiCode, "num_ref_idx_l1_active_minus1" ); pcSlice->setNumRefIdx( REF_PIC_LIST_1, uiCode + 1 ); |
---|
2637 | } |
---|
2638 | else |
---|
2639 | { |
---|
2640 | pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); |
---|
2641 | } |
---|
2642 | } |
---|
2643 | else |
---|
2644 | { |
---|
2645 | pcSlice->setNumRefIdx(REF_PIC_LIST_0, pps->getNumRefIdxL0DefaultActive()); |
---|
2646 | if (pcSlice->isInterB()) |
---|
2647 | { |
---|
2648 | pcSlice->setNumRefIdx(REF_PIC_LIST_1, pps->getNumRefIdxL1DefaultActive()); |
---|
2649 | } |
---|
2650 | else |
---|
2651 | { |
---|
2652 | pcSlice->setNumRefIdx(REF_PIC_LIST_1,0); |
---|
2653 | } |
---|
2654 | } |
---|
2655 | } |
---|
2656 | // } |
---|
2657 | TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); |
---|
2658 | if(!pcSlice->isIntra()) |
---|
2659 | { |
---|
2660 | if( !pps->getListsModificationPresentFlag() || pcSlice->getNumRpsCurrTempList() <= 1 ) |
---|
2661 | { |
---|
2662 | refPicListModification->setRefPicListModificationFlagL0( 0 ); |
---|
2663 | } |
---|
2664 | else |
---|
2665 | { |
---|
2666 | READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); refPicListModification->setRefPicListModificationFlagL0( uiCode ? 1 : 0 ); |
---|
2667 | } |
---|
2668 | |
---|
2669 | if(refPicListModification->getRefPicListModificationFlagL0()) |
---|
2670 | { |
---|
2671 | uiCode = 0; |
---|
2672 | Int i = 0; |
---|
2673 | Int numRpsCurrTempList0 = pcSlice->getNumRpsCurrTempList(); |
---|
2674 | if ( numRpsCurrTempList0 > 1 ) |
---|
2675 | { |
---|
2676 | Int length = 1; |
---|
2677 | numRpsCurrTempList0 --; |
---|
2678 | while ( numRpsCurrTempList0 >>= 1) |
---|
2679 | { |
---|
2680 | length ++; |
---|
2681 | } |
---|
2682 | for (i = 0; i < pcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) |
---|
2683 | { |
---|
2684 | READ_CODE( length, uiCode, "list_entry_l0" ); |
---|
2685 | refPicListModification->setRefPicSetIdxL0(i, uiCode ); |
---|
2686 | } |
---|
2687 | } |
---|
2688 | else |
---|
2689 | { |
---|
2690 | for (i = 0; i < pcSlice->getNumRefIdx(REF_PIC_LIST_0); i ++) |
---|
2691 | { |
---|
2692 | refPicListModification->setRefPicSetIdxL0(i, 0 ); |
---|
2693 | } |
---|
2694 | } |
---|
2695 | } |
---|
2696 | } |
---|
2697 | else |
---|
2698 | { |
---|
2699 | refPicListModification->setRefPicListModificationFlagL0(0); |
---|
2700 | } |
---|
2701 | if(pcSlice->isInterB()) |
---|
2702 | { |
---|
2703 | if( !pps->getListsModificationPresentFlag() || pcSlice->getNumRpsCurrTempList() <= 1 ) |
---|
2704 | { |
---|
2705 | refPicListModification->setRefPicListModificationFlagL1( 0 ); |
---|
2706 | } |
---|
2707 | else |
---|
2708 | { |
---|
2709 | READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); refPicListModification->setRefPicListModificationFlagL1( uiCode ? 1 : 0 ); |
---|
2710 | } |
---|
2711 | if(refPicListModification->getRefPicListModificationFlagL1()) |
---|
2712 | { |
---|
2713 | uiCode = 0; |
---|
2714 | Int i = 0; |
---|
2715 | Int numRpsCurrTempList1 = pcSlice->getNumRpsCurrTempList(); |
---|
2716 | if ( numRpsCurrTempList1 > 1 ) |
---|
2717 | { |
---|
2718 | Int length = 1; |
---|
2719 | numRpsCurrTempList1 --; |
---|
2720 | while ( numRpsCurrTempList1 >>= 1) |
---|
2721 | { |
---|
2722 | length ++; |
---|
2723 | } |
---|
2724 | for (i = 0; i < pcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) |
---|
2725 | { |
---|
2726 | READ_CODE( length, uiCode, "list_entry_l1" ); |
---|
2727 | refPicListModification->setRefPicSetIdxL1(i, uiCode ); |
---|
2728 | } |
---|
2729 | } |
---|
2730 | else |
---|
2731 | { |
---|
2732 | for (i = 0; i < pcSlice->getNumRefIdx(REF_PIC_LIST_1); i ++) |
---|
2733 | { |
---|
2734 | refPicListModification->setRefPicSetIdxL1(i, 0 ); |
---|
2735 | } |
---|
2736 | } |
---|
2737 | } |
---|
2738 | } |
---|
2739 | else |
---|
2740 | { |
---|
2741 | refPicListModification->setRefPicListModificationFlagL1(0); |
---|
2742 | } |
---|
2743 | if (pcSlice->isInterB()) |
---|
2744 | { |
---|
2745 | READ_FLAG( uiCode, "mvd_l1_zero_flag" ); pcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) ); |
---|
2746 | } |
---|
2747 | |
---|
2748 | pcSlice->setCabacInitFlag( false ); // default |
---|
2749 | if(pps->getCabacInitPresentFlag() && !pcSlice->isIntra()) |
---|
2750 | { |
---|
2751 | READ_FLAG(uiCode, "cabac_init_flag"); |
---|
2752 | pcSlice->setCabacInitFlag( uiCode ? true : false ); |
---|
2753 | } |
---|
2754 | |
---|
2755 | if ( pcSlice->getEnableTMVPFlag() ) |
---|
2756 | { |
---|
2757 | if ( pcSlice->getSliceType() == B_SLICE ) |
---|
2758 | { |
---|
2759 | READ_FLAG( uiCode, "collocated_from_l0_flag" ); |
---|
2760 | pcSlice->setColFromL0Flag(uiCode); |
---|
2761 | } |
---|
2762 | else |
---|
2763 | { |
---|
2764 | pcSlice->setColFromL0Flag( 1 ); |
---|
2765 | } |
---|
2766 | |
---|
2767 | if ( pcSlice->getSliceType() != I_SLICE && |
---|
2768 | ((pcSlice->getColFromL0Flag() == 1 && pcSlice->getNumRefIdx(REF_PIC_LIST_0) > 1)|| |
---|
2769 | (pcSlice->getColFromL0Flag() == 0 && pcSlice->getNumRefIdx(REF_PIC_LIST_1) > 1))) |
---|
2770 | { |
---|
2771 | READ_UVLC( uiCode, "collocated_ref_idx" ); |
---|
2772 | pcSlice->setColRefIdx(uiCode); |
---|
2773 | } |
---|
2774 | else |
---|
2775 | { |
---|
2776 | pcSlice->setColRefIdx(0); |
---|
2777 | } |
---|
2778 | } |
---|
2779 | if ( (pps->getUseWP() && pcSlice->getSliceType()==P_SLICE) || (pps->getWPBiPred() && pcSlice->getSliceType()==B_SLICE) ) |
---|
2780 | { |
---|
2781 | xParsePredWeightTable(pcSlice, sps); |
---|
2782 | pcSlice->initWpScaling(sps); |
---|
2783 | } |
---|
2784 | |
---|
2785 | #if NH_3D_IC |
---|
2786 | else if( pcSlice->getViewIndex() && ( pcSlice->getSliceType() == P_SLICE || pcSlice->getSliceType() == B_SLICE ) |
---|
2787 | && !pcSlice->getIsDepth() && vps->getNumRefListLayers( layerId ) > 0 |
---|
2788 | && getDecTop()->decProcAnnexI() |
---|
2789 | ) |
---|
2790 | { |
---|
2791 | UInt uiCodeTmp = 0; |
---|
2792 | |
---|
2793 | READ_FLAG ( uiCodeTmp, "slice_ic_enable_flag" ); |
---|
2794 | pcSlice->setApplyIC( uiCodeTmp ); |
---|
2795 | |
---|
2796 | if ( uiCodeTmp ) |
---|
2797 | { |
---|
2798 | READ_FLAG ( uiCodeTmp, "slice_ic_disabled_merge_zero_idx_flag" ); |
---|
2799 | pcSlice->setIcSkipParseFlag( uiCodeTmp ); |
---|
2800 | } |
---|
2801 | } |
---|
2802 | #endif |
---|
2803 | |
---|
2804 | if (!pcSlice->isIntra()) |
---|
2805 | { |
---|
2806 | READ_UVLC( uiCode, "five_minus_max_num_merge_cand"); |
---|
2807 | #if H_3D_IV_MERGE |
---|
2808 | pcSlice->setMaxNumMergeCand(( ( pcSlice->getMpiFlag() || pcSlice->getIvMvPredFlag() || pcSlice->getViewSynthesisPredFlag() ) ? MRG_MAX_NUM_CANDS_MEM : MRG_MAX_NUM_CANDS) - uiCode); |
---|
2809 | #else |
---|
2810 | pcSlice->setMaxNumMergeCand(MRG_MAX_NUM_CANDS - uiCode); |
---|
2811 | #endif |
---|
2812 | } |
---|
2813 | |
---|
2814 | READ_SVLC( iCode, "slice_qp_delta" ); |
---|
2815 | pcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode); |
---|
2816 | |
---|
2817 | assert( pcSlice->getSliceQp() >= -sps->getQpBDOffset(CHANNEL_TYPE_LUMA) ); |
---|
2818 | assert( pcSlice->getSliceQp() <= 51 ); |
---|
2819 | |
---|
2820 | if (pps->getSliceChromaQpFlag()) |
---|
2821 | { |
---|
2822 | if (numValidComp>COMPONENT_Cb) |
---|
2823 | { |
---|
2824 | READ_SVLC( iCode, "slice_cb_qp_offset" ); |
---|
2825 | pcSlice->setSliceChromaQpDelta(COMPONENT_Cb, iCode ); |
---|
2826 | assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb) >= -12 ); |
---|
2827 | assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb) <= 12 ); |
---|
2828 | assert( (pps->getQpOffset(COMPONENT_Cb) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cb)) >= -12 ); |
---|
2829 | assert( (pps->getQpOffset(COMPONENT_Cb) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cb)) <= 12 ); |
---|
2830 | } |
---|
2831 | |
---|
2832 | if (numValidComp>COMPONENT_Cr) |
---|
2833 | { |
---|
2834 | READ_SVLC( iCode, "slice_cr_qp_offset" ); |
---|
2835 | pcSlice->setSliceChromaQpDelta(COMPONENT_Cr, iCode ); |
---|
2836 | assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr) >= -12 ); |
---|
2837 | assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr) <= 12 ); |
---|
2838 | assert( (pps->getQpOffset(COMPONENT_Cr) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cr)) >= -12 ); |
---|
2839 | assert( (pps->getQpOffset(COMPONENT_Cr) + pcSlice->getSliceChromaQpDelta(COMPONENT_Cr)) <= 12 ); |
---|
2840 | } |
---|
2841 | } |
---|
2842 | |
---|
2843 | if (pps->getPpsRangeExtension().getChromaQpOffsetListEnabledFlag()) |
---|
2844 | { |
---|
2845 | READ_FLAG(uiCode, "cu_chroma_qp_offset_enabled_flag"); pcSlice->setUseChromaQpAdj(uiCode != 0); |
---|
2846 | } |
---|
2847 | else |
---|
2848 | { |
---|
2849 | pcSlice->setUseChromaQpAdj(false); |
---|
2850 | } |
---|
2851 | |
---|
2852 | if (pps->getDeblockingFilterControlPresentFlag()) |
---|
2853 | { |
---|
2854 | if(pps->getDeblockingFilterOverrideEnabledFlag()) |
---|
2855 | { |
---|
2856 | READ_FLAG ( uiCode, "deblocking_filter_override_flag" ); pcSlice->setDeblockingFilterOverrideFlag(uiCode ? true : false); |
---|
2857 | } |
---|
2858 | else |
---|
2859 | { |
---|
2860 | pcSlice->setDeblockingFilterOverrideFlag(0); |
---|
2861 | } |
---|
2862 | if(pcSlice->getDeblockingFilterOverrideFlag()) |
---|
2863 | { |
---|
2864 | READ_FLAG ( uiCode, "slice_disable_deblocking_filter_flag" ); pcSlice->setDeblockingFilterDisable(uiCode ? 1 : 0); |
---|
2865 | if(!pcSlice->getDeblockingFilterDisable()) |
---|
2866 | { |
---|
2867 | READ_SVLC( iCode, "slice_beta_offset_div2" ); pcSlice->setDeblockingFilterBetaOffsetDiv2(iCode); |
---|
2868 | assert(pcSlice->getDeblockingFilterBetaOffsetDiv2() >= -6 && |
---|
2869 | pcSlice->getDeblockingFilterBetaOffsetDiv2() <= 6); |
---|
2870 | READ_SVLC( iCode, "slice_tc_offset_div2" ); pcSlice->setDeblockingFilterTcOffsetDiv2(iCode); |
---|
2871 | assert(pcSlice->getDeblockingFilterTcOffsetDiv2() >= -6 && |
---|
2872 | pcSlice->getDeblockingFilterTcOffsetDiv2() <= 6); |
---|
2873 | } |
---|
2874 | } |
---|
2875 | else |
---|
2876 | { |
---|
2877 | pcSlice->setDeblockingFilterDisable ( pps->getPicDisableDeblockingFilterFlag() ); |
---|
2878 | pcSlice->setDeblockingFilterBetaOffsetDiv2( pps->getDeblockingFilterBetaOffsetDiv2() ); |
---|
2879 | pcSlice->setDeblockingFilterTcOffsetDiv2 ( pps->getDeblockingFilterTcOffsetDiv2() ); |
---|
2880 | } |
---|
2881 | } |
---|
2882 | else |
---|
2883 | { |
---|
2884 | pcSlice->setDeblockingFilterDisable ( false ); |
---|
2885 | pcSlice->setDeblockingFilterBetaOffsetDiv2( 0 ); |
---|
2886 | pcSlice->setDeblockingFilterTcOffsetDiv2 ( 0 ); |
---|
2887 | } |
---|
2888 | |
---|
2889 | Bool isSAOEnabled = sps->getUseSAO() && (pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_LUMA) || (bChroma && pcSlice->getSaoEnabledFlag(CHANNEL_TYPE_CHROMA))); |
---|
2890 | Bool isDBFEnabled = (!pcSlice->getDeblockingFilterDisable()); |
---|
2891 | |
---|
2892 | if(pps->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) |
---|
2893 | { |
---|
2894 | READ_FLAG( uiCode, "slice_loop_filter_across_slices_enabled_flag"); |
---|
2895 | } |
---|
2896 | else |
---|
2897 | { |
---|
2898 | uiCode = pps->getLoopFilterAcrossSlicesEnabledFlag()?1:0; |
---|
2899 | } |
---|
2900 | pcSlice->setLFCrossSliceBoundaryFlag( (uiCode==1)?true:false); |
---|
2901 | |
---|
2902 | #if NH_3D |
---|
2903 | if ( getDecTop()->decProcAnnexI() ) |
---|
2904 | { |
---|
2905 | Int voiInVps = vps->getVoiInVps( pcSlice->getViewIndex() ); |
---|
2906 | if( vps->getCpInSliceSegmentHeaderFlag( voiInVps ) && !pcSlice->getIsDepth() ) |
---|
2907 | { |
---|
2908 | for( Int m = 0; m < vps->getNumCp( voiInVps ); m++ ) |
---|
2909 | { |
---|
2910 | Int jInVps = vps->getVoiInVps( vps->getCpRefVoi( voiInVps, m )); |
---|
2911 | READ_SVLC( iCode, "cp_scale" ); pcSlice->setCpScale ( jInVps, iCode ); |
---|
2912 | READ_SVLC( iCode, "cp_off" ); pcSlice->setCpOff ( jInVps, iCode ); |
---|
2913 | READ_SVLC( iCode, "cp_inv_scale_plus_scale" ); pcSlice->setCpInvScale( jInVps, iCode - pcSlice->getCpScale ( jInVps )); |
---|
2914 | READ_SVLC( iCode, "cp_inv_off_plus_off" ); pcSlice->setCpInvOff ( jInVps, iCode - pcSlice->getCpOff ( jInVps )); |
---|
2915 | } |
---|
2916 | } |
---|
2917 | } |
---|
2918 | #endif |
---|
2919 | |
---|
2920 | } |
---|
2921 | |
---|
2922 | std::vector<UInt> entryPointOffset; |
---|
2923 | if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) |
---|
2924 | { |
---|
2925 | UInt numEntryPointOffsets; |
---|
2926 | UInt offsetLenMinus1; |
---|
2927 | READ_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); |
---|
2928 | if (numEntryPointOffsets>0) |
---|
2929 | { |
---|
2930 | READ_UVLC(offsetLenMinus1, "offset_len_minus1"); |
---|
2931 | entryPointOffset.resize(numEntryPointOffsets); |
---|
2932 | for (UInt idx=0; idx<numEntryPointOffsets; idx++) |
---|
2933 | { |
---|
2934 | READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1"); |
---|
2935 | entryPointOffset[ idx ] = uiCode + 1; |
---|
2936 | } |
---|
2937 | } |
---|
2938 | } |
---|
2939 | |
---|
2940 | if(pps->getSliceHeaderExtensionPresentFlag()) |
---|
2941 | { |
---|
2942 | #if NH_MV |
---|
2943 | READ_UVLC( uiCode, "slice_segment_header_extension_length" ); pcSlice->setSliceSegmentHeaderExtensionLength( uiCode ); |
---|
2944 | UInt posFollSliceSegHeaderExtLen = m_pcBitstream->getNumBitsRead(); |
---|
2945 | |
---|
2946 | if( pps->getPocResetInfoPresentFlag() ) |
---|
2947 | { |
---|
2948 | READ_CODE( 2, uiCode, "poc_reset_idc" ); pcSlice->setPocResetIdc( uiCode ); |
---|
2949 | } |
---|
2950 | else |
---|
2951 | { |
---|
2952 | pcSlice->setPocResetIdc( 0 ); |
---|
2953 | } |
---|
2954 | pcSlice->checkPocResetIdc(); |
---|
2955 | |
---|
2956 | if ( pcSlice->getVPS()->getPocLsbNotPresentFlag(pcSlice->getLayerId()) && slicePicOrderCntLsb > 0 ) |
---|
2957 | { |
---|
2958 | assert( pcSlice->getPocResetIdc() != 2 ); |
---|
2959 | } |
---|
2960 | |
---|
2961 | if( pcSlice->getPocResetIdc() != 0 ) |
---|
2962 | { |
---|
2963 | READ_CODE( 6, uiCode, "poc_reset_period_id" ); pcSlice->setPocResetPeriodId( uiCode ); |
---|
2964 | } |
---|
2965 | else |
---|
2966 | { |
---|
2967 | // TODO Copy poc_reset_period from earlier picture |
---|
2968 | pcSlice->setPocResetPeriodId( 0 ); |
---|
2969 | } |
---|
2970 | |
---|
2971 | if( pcSlice->getPocResetIdc() == 3 ) |
---|
2972 | { |
---|
2973 | READ_FLAG( uiCode, "full_poc_reset_flag" ); pcSlice->setFullPocResetFlag( uiCode == 1 ); |
---|
2974 | READ_CODE( pcSlice->getPocLsbValLen() , uiCode, "poc_lsb_val" ); pcSlice->setPocLsbVal( uiCode ); |
---|
2975 | } |
---|
2976 | pcSlice->checkPocLsbVal(); |
---|
2977 | |
---|
2978 | // Derive the value of PocMs8bValRequiredFlag |
---|
2979 | |
---|
2980 | if( !pcSlice->getPocMsbValRequiredFlag() && pcSlice->getVPS()->getVpsPocLsbAlignedFlag() ) |
---|
2981 | { |
---|
2982 | READ_FLAG( uiCode, "poc_msb_val_present_flag" ); pcSlice->setPocMsbValPresentFlag( uiCode == 1 ); |
---|
2983 | } |
---|
2984 | else |
---|
2985 | { |
---|
2986 | pcSlice->setPocMsbValPresentFlag( pcSlice->inferPocMsbValPresentFlag( ) ); |
---|
2987 | } |
---|
2988 | |
---|
2989 | |
---|
2990 | if( pcSlice->getPocMsbValPresentFlag() ) |
---|
2991 | { |
---|
2992 | READ_UVLC( uiCode, "poc_msb_val" ); pcSlice->setPocMsbVal( uiCode ); |
---|
2993 | } |
---|
2994 | |
---|
2995 | while( ( m_pcBitstream->getNumBitsRead() - posFollSliceSegHeaderExtLen ) < pcSlice->getSliceSegmentHeaderExtensionLength() * 8 ) |
---|
2996 | { |
---|
2997 | READ_FLAG( uiCode, "slice_segment_header_extension_data_bit" ); |
---|
2998 | } |
---|
2999 | assert( ( m_pcBitstream->getNumBitsRead() - posFollSliceSegHeaderExtLen ) == pcSlice->getSliceSegmentHeaderExtensionLength() * 8 ); |
---|
3000 | } |
---|
3001 | #else |
---|
3002 | |
---|
3003 | READ_UVLC(uiCode,"slice_segment_header_extension_length"); |
---|
3004 | for(Int i=0; i<uiCode; i++) |
---|
3005 | { |
---|
3006 | UInt ignore; |
---|
3007 | READ_CODE(8,ignore,"slice_segment_header_extension_data_byte"); |
---|
3008 | } |
---|
3009 | } |
---|
3010 | #endif |
---|
3011 | #if RExt__DECODER_DEBUG_BIT_STATISTICS |
---|
3012 | TComCodingStatistics::IncrementStatisticEP(STATS__BYTE_ALIGNMENT_BITS,m_pcBitstream->readByteAlignment(),0); |
---|
3013 | #else |
---|
3014 | m_pcBitstream->readByteAlignment(); |
---|
3015 | #endif |
---|
3016 | |
---|
3017 | pcSlice->clearSubstreamSizes(); |
---|
3018 | |
---|
3019 | if( pps->getTilesEnabledFlag() || pps->getEntropyCodingSyncEnabledFlag() ) |
---|
3020 | { |
---|
3021 | Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation(); |
---|
3022 | |
---|
3023 | // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header |
---|
3024 | for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) |
---|
3025 | { |
---|
3026 | if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation ) |
---|
3027 | { |
---|
3028 | endOfSliceHeaderLocation++; |
---|
3029 | } |
---|
3030 | } |
---|
3031 | |
---|
3032 | Int curEntryPointOffset = 0; |
---|
3033 | Int prevEntryPointOffset = 0; |
---|
3034 | for (UInt idx=0; idx<entryPointOffset.size(); idx++) |
---|
3035 | { |
---|
3036 | curEntryPointOffset += entryPointOffset[ idx ]; |
---|
3037 | |
---|
3038 | Int emulationPreventionByteCount = 0; |
---|
3039 | for ( UInt curByteIdx = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ ) |
---|
3040 | { |
---|
3041 | if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) >= ( prevEntryPointOffset + endOfSliceHeaderLocation ) && |
---|
3042 | m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < ( curEntryPointOffset + endOfSliceHeaderLocation ) ) |
---|
3043 | { |
---|
3044 | emulationPreventionByteCount++; |
---|
3045 | } |
---|
3046 | } |
---|
3047 | |
---|
3048 | entryPointOffset[ idx ] -= emulationPreventionByteCount; |
---|
3049 | prevEntryPointOffset = curEntryPointOffset; |
---|
3050 | pcSlice->addSubstreamSize(entryPointOffset [ idx ] ); |
---|
3051 | } |
---|
3052 | } |
---|
3053 | |
---|
3054 | return; |
---|
3055 | } |
---|
3056 | |
---|
3057 | Void TDecCavlc::parsePTL( TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1 ) |
---|
3058 | { |
---|
3059 | UInt uiCode; |
---|
3060 | if(profilePresentFlag) |
---|
3061 | { |
---|
3062 | parseProfileTier(rpcPTL->getGeneralPTL(), false); |
---|
3063 | } |
---|
3064 | READ_CODE( 8, uiCode, "general_level_idc" ); rpcPTL->getGeneralPTL()->setLevelIdc(Level::Name(uiCode)); |
---|
3065 | |
---|
3066 | for (Int i = 0; i < maxNumSubLayersMinus1; i++) |
---|
3067 | { |
---|
3068 | READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode); |
---|
3069 | READ_FLAG( uiCode, "sub_layer_level_present_flag[i]" ); rpcPTL->setSubLayerLevelPresentFlag (i, uiCode); |
---|
3070 | #if NH_MV |
---|
3071 | // When profilePresentFlag is equal to 0, sub_layer_profile_present_flag[ i ] shall be equal to 0. |
---|
3072 | assert( profilePresentFlag || !rpcPTL->getSubLayerProfilePresentFlag(i) ); |
---|
3073 | #endif |
---|
3074 | } |
---|
3075 | |
---|
3076 | if (maxNumSubLayersMinus1 > 0) |
---|
3077 | { |
---|
3078 | for (Int i = maxNumSubLayersMinus1; i < 8; i++) |
---|
3079 | { |
---|
3080 | READ_CODE(2, uiCode, "reserved_zero_2bits"); |
---|
3081 | assert(uiCode == 0); |
---|
3082 | } |
---|
3083 | } |
---|
3084 | |
---|
3085 | for(Int i = 0; i < maxNumSubLayersMinus1; i++) |
---|
3086 | { |
---|
3087 | if( rpcPTL->getSubLayerProfilePresentFlag(i) ) |
---|
3088 | { |
---|
3089 | parseProfileTier(rpcPTL->getSubLayerPTL(i), true); |
---|
3090 | } |
---|
3091 | if(rpcPTL->getSubLayerLevelPresentFlag(i)) |
---|
3092 | { |
---|
3093 | READ_CODE( 8, uiCode, "sub_layer_level_idc[i]" ); rpcPTL->getSubLayerPTL(i)->setLevelIdc(Level::Name(uiCode)); |
---|
3094 | } |
---|
3095 | } |
---|
3096 | } |
---|
3097 | |
---|
3098 | #if ENC_DEC_TRACE || RExt__DECODER_DEBUG_BIT_STATISTICS |
---|
3099 | Void TDecCavlc::parseProfileTier(ProfileTierLevel *ptl, const Bool bIsSubLayer) |
---|
3100 | #define PTL_TRACE_TEXT(txt) bIsSubLayer?("sub_layer_" txt) : ("general_" txt) |
---|
3101 | #else |
---|
3102 | Void TDecCavlc::parseProfileTier(ProfileTierLevel *ptl, const Bool /*bIsSubLayer*/) |
---|
3103 | #define PTL_TRACE_TEXT(txt) txt |
---|
3104 | #endif |
---|
3105 | { |
---|
3106 | UInt uiCode; |
---|
3107 | READ_CODE(2 , uiCode, PTL_TRACE_TEXT("profile_space" )); ptl->setProfileSpace(uiCode); |
---|
3108 | READ_FLAG( uiCode, PTL_TRACE_TEXT("tier_flag" )); ptl->setTierFlag (uiCode ? Level::HIGH : Level::MAIN); |
---|
3109 | READ_CODE(5 , uiCode, PTL_TRACE_TEXT("profile_idc" )); ptl->setProfileIdc (Profile::Name(uiCode)); |
---|
3110 | for(Int j = 0; j < 32; j++) |
---|
3111 | { |
---|
3112 | READ_FLAG( uiCode, PTL_TRACE_TEXT("profile_compatibility_flag[][j]" )); ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0); |
---|
3113 | } |
---|
3114 | READ_FLAG(uiCode, PTL_TRACE_TEXT("progressive_source_flag" )); ptl->setProgressiveSourceFlag(uiCode ? true : false); |
---|
3115 | |
---|
3116 | READ_FLAG(uiCode, PTL_TRACE_TEXT("interlaced_source_flag" )); ptl->setInterlacedSourceFlag(uiCode ? true : false); |
---|
3117 | |
---|
3118 | READ_FLAG(uiCode, PTL_TRACE_TEXT("non_packed_constraint_flag" )); ptl->setNonPackedConstraintFlag(uiCode ? true : false); |
---|
3119 | |
---|
3120 | READ_FLAG(uiCode, PTL_TRACE_TEXT("frame_only_constraint_flag" )); ptl->setFrameOnlyConstraintFlag(uiCode ? true : false); |
---|
3121 | #if NH_MV |
---|
3122 | if( ptl->getV2ConstraintsPresentFlag() ) |
---|
3123 | { |
---|
3124 | READ_FLAG( uiCode, "max_12bit_constraint_flag" ); ptl->setMax12bitConstraintFlag ( uiCode == 1 ); |
---|
3125 | READ_FLAG( uiCode, "max_10bit_constraint_flag" ); ptl->setMax10bitConstraintFlag ( uiCode == 1 ); |
---|
3126 | READ_FLAG( uiCode, "max_8bit_constraint_flag" ); ptl->setMax8bitConstraintFlag ( uiCode == 1 ); |
---|
3127 | READ_FLAG( uiCode, "max_422chroma_constraint_flag" ); ptl->setMax422chromaConstraintFlag ( uiCode == 1 ); |
---|
3128 | READ_FLAG( uiCode, "max_420chroma_constraint_flag" ); ptl->setMax420chromaConstraintFlag ( uiCode == 1 ); |
---|
3129 | READ_FLAG( uiCode, "max_monochrome_constraint_flag" ); ptl->setMaxMonochromeConstraintFlag ( uiCode == 1 ); |
---|
3130 | READ_FLAG( uiCode, "intra_constraint_flag" ); ptl->setIntraConstraintFlag ( uiCode == 1 ); |
---|
3131 | READ_FLAG( uiCode, "one_picture_only_constraint_flag" ); ptl->setOnePictureOnlyConstraintFlag( uiCode == 1 ); |
---|
3132 | READ_FLAG( uiCode, "lower_bit_rate_constraint_flag" ); ptl->setLowerBitRateConstraintFlag ( uiCode == 1 ); |
---|
3133 | READ_CODE(16, uiCode, "XXX_reserved_zero_34bits[0..15]"); |
---|
3134 | READ_CODE(16, uiCode, "XXX_reserved_zero_34bits[16..31]"); |
---|
3135 | READ_CODE(2 , uiCode, "XXX_reserved_zero_34bits[32..33]"); |
---|
3136 | } |
---|
3137 | else |
---|
3138 | { |
---|
3139 | READ_CODE(16, uiCode, "XXX_reserved_zero_43bits[0..15]"); |
---|
3140 | READ_CODE(16, uiCode, "XXX_reserved_zero_43bits[16..31]"); |
---|
3141 | READ_CODE(11, uiCode, "XXX_reserved_zero_43bits[32..42]"); |
---|
3142 | } |
---|
3143 | if( ptl->getInbldPresentFlag() ) |
---|
3144 | { |
---|
3145 | READ_FLAG( uiCode, "inbld_flag" ); ptl->setInbldFlag( uiCode == 1 ); |
---|
3146 | } |
---|
3147 | else |
---|
3148 | { |
---|
3149 | READ_FLAG(uiCode, "reserved_zero_bit"); |
---|
3150 | } |
---|
3151 | #else |
---|
3152 | |
---|
3153 | if (ptl->getProfileIdc() == Profile::MAINREXT || ptl->getProfileCompatibilityFlag(Profile::MAINREXT) || |
---|
3154 | ptl->getProfileIdc() == Profile::HIGHTHROUGHPUTREXT || ptl->getProfileCompatibilityFlag(Profile::HIGHTHROUGHPUTREXT)) |
---|
3155 | { |
---|
3156 | UInt maxBitDepth=16; |
---|
3157 | READ_FLAG( uiCode, PTL_TRACE_TEXT("max_12bit_constraint_flag" )); if (uiCode) maxBitDepth=12; |
---|
3158 | READ_FLAG( uiCode, PTL_TRACE_TEXT("max_10bit_constraint_flag" )); if (uiCode) maxBitDepth=10; |
---|
3159 | READ_FLAG( uiCode, PTL_TRACE_TEXT("max_8bit_constraint_flag" )); if (uiCode) maxBitDepth=8; |
---|
3160 | ptl->setBitDepthConstraint(maxBitDepth); |
---|
3161 | ChromaFormat chromaFmtConstraint=CHROMA_444; |
---|
3162 | READ_FLAG( uiCode, PTL_TRACE_TEXT("max_422chroma_constraint_flag" )); if (uiCode) chromaFmtConstraint=CHROMA_422; |
---|
3163 | READ_FLAG( uiCode, PTL_TRACE_TEXT("max_420chroma_constraint_flag" )); if (uiCode) chromaFmtConstraint=CHROMA_420; |
---|
3164 | READ_FLAG( uiCode, PTL_TRACE_TEXT("max_monochrome_constraint_flag" )); if (uiCode) chromaFmtConstraint=CHROMA_400; |
---|
3165 | ptl->setChromaFormatConstraint(chromaFmtConstraint); |
---|
3166 | READ_FLAG( uiCode, PTL_TRACE_TEXT("intra_constraint_flag" )); ptl->setIntraConstraintFlag(uiCode != 0); |
---|
3167 | READ_FLAG( uiCode, PTL_TRACE_TEXT("one_picture_only_constraint_flag")); ptl->setOnePictureOnlyConstraintFlag(uiCode != 0); |
---|
3168 | READ_FLAG( uiCode, PTL_TRACE_TEXT("lower_bit_rate_constraint_flag" )); ptl->setLowerBitRateConstraintFlag(uiCode != 0); |
---|
3169 | READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_34bits[0..15]" )); |
---|
3170 | READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_34bits[16..31]" )); |
---|
3171 | READ_CODE(2, uiCode, PTL_TRACE_TEXT("reserved_zero_34bits[32..33]" )); |
---|
3172 | } |
---|
3173 | else |
---|
3174 | { |
---|
3175 | ptl->setBitDepthConstraint((ptl->getProfileIdc() == Profile::MAIN10)?10:8); |
---|
3176 | ptl->setChromaFormatConstraint(CHROMA_420); |
---|
3177 | ptl->setIntraConstraintFlag(false); |
---|
3178 | ptl->setLowerBitRateConstraintFlag(true); |
---|
3179 | READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_43bits[0..15]" )); |
---|
3180 | READ_CODE(16, uiCode, PTL_TRACE_TEXT("reserved_zero_43bits[16..31]" )); |
---|
3181 | READ_CODE(11, uiCode, PTL_TRACE_TEXT("reserved_zero_43bits[32..42]" )); |
---|
3182 | } |
---|
3183 | |
---|
3184 | if ((ptl->getProfileIdc() >= Profile::MAIN && ptl->getProfileIdc() <= Profile::HIGHTHROUGHPUTREXT) || |
---|
3185 | ptl->getProfileCompatibilityFlag(Profile::MAIN) || |
---|
3186 | ptl->getProfileCompatibilityFlag(Profile::MAIN10) || |
---|
3187 | ptl->getProfileCompatibilityFlag(Profile::MAINSTILLPICTURE) || |
---|
3188 | ptl->getProfileCompatibilityFlag(Profile::MAINREXT) || |
---|
3189 | ptl->getProfileCompatibilityFlag(Profile::HIGHTHROUGHPUTREXT) ) |
---|
3190 | { |
---|
3191 | READ_FLAG( uiCode, PTL_TRACE_TEXT("inbld_flag" )); assert(uiCode == 0); |
---|
3192 | } |
---|
3193 | else |
---|
3194 | { |
---|
3195 | READ_FLAG( uiCode, PTL_TRACE_TEXT("reserved_zero_bit" )); |
---|
3196 | } |
---|
3197 | #undef PTL_TRACE_TEXT |
---|
3198 | #endif |
---|
3199 | } |
---|
3200 | |
---|
3201 | Void TDecCavlc::parseTerminatingBit( UInt& ruiBit ) |
---|
3202 | { |
---|
3203 | ruiBit = false; |
---|
3204 | Int iBitsLeft = m_pcBitstream->getNumBitsLeft(); |
---|
3205 | if(iBitsLeft <= 8) |
---|
3206 | { |
---|
3207 | UInt uiPeekValue = m_pcBitstream->peekBits(iBitsLeft); |
---|
3208 | if (uiPeekValue == (1<<(iBitsLeft-1))) |
---|
3209 | { |
---|
3210 | ruiBit = true; |
---|
3211 | } |
---|
3212 | } |
---|
3213 | } |
---|
3214 | |
---|
3215 | Void TDecCavlc::parseRemainingBytes( Bool noTrailingBytesExpected ) |
---|
3216 | { |
---|
3217 | if (noTrailingBytesExpected) |
---|
3218 | { |
---|
3219 | const UInt numberOfRemainingSubstreamBytes=m_pcBitstream->getNumBitsLeft(); |
---|
3220 | assert (numberOfRemainingSubstreamBytes == 0); |
---|
3221 | } |
---|
3222 | else |
---|
3223 | { |
---|
3224 | while (m_pcBitstream->getNumBitsLeft()) |
---|
3225 | { |
---|
3226 | UInt trailingNullByte=m_pcBitstream->readByte(); |
---|
3227 | if (trailingNullByte!=0) |
---|
3228 | { |
---|
3229 | printf("Trailing byte should be 0, but has value %02x\n", trailingNullByte); |
---|
3230 | assert(trailingNullByte==0); |
---|
3231 | } |
---|
3232 | } |
---|
3233 | } |
---|
3234 | } |
---|
3235 | |
---|
3236 | #if H_3D |
---|
3237 | Void TDecCavlc::parseDIS( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
3238 | { |
---|
3239 | assert(0); |
---|
3240 | } |
---|
3241 | #endif |
---|
3242 | |
---|
3243 | Void TDecCavlc::parseSkipFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
3244 | { |
---|
3245 | assert(0); |
---|
3246 | } |
---|
3247 | |
---|
3248 | Void TDecCavlc::parseCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
3249 | { |
---|
3250 | assert(0); |
---|
3251 | } |
---|
3252 | |
---|
3253 | Void TDecCavlc::parseMVPIdx( Int& /*riMVPIdx*/ ) |
---|
3254 | { |
---|
3255 | assert(0); |
---|
3256 | } |
---|
3257 | |
---|
3258 | Void TDecCavlc::parseSplitFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
3259 | { |
---|
3260 | assert(0); |
---|
3261 | } |
---|
3262 | |
---|
3263 | Void TDecCavlc::parsePartSize( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
3264 | { |
---|
3265 | assert(0); |
---|
3266 | } |
---|
3267 | |
---|
3268 | Void TDecCavlc::parsePredMode( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
3269 | { |
---|
3270 | assert(0); |
---|
3271 | } |
---|
3272 | |
---|
3273 | /** Parse I_PCM information. |
---|
3274 | * \param pcCU pointer to CU |
---|
3275 | * \param uiAbsPartIdx CU index |
---|
3276 | * \param uiDepth CU depth |
---|
3277 | * \returns Void |
---|
3278 | * |
---|
3279 | * If I_PCM flag indicates that the CU is I_PCM, parse its PCM alignment bits and codes. |
---|
3280 | */ |
---|
3281 | Void TDecCavlc::parseIPCMInfo( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
3282 | { |
---|
3283 | assert(0); |
---|
3284 | } |
---|
3285 | |
---|
3286 | Void TDecCavlc::parseIntraDirLumaAng ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
3287 | { |
---|
3288 | assert(0); |
---|
3289 | } |
---|
3290 | |
---|
3291 | Void TDecCavlc::parseIntraDirChroma( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
3292 | { |
---|
3293 | assert(0); |
---|
3294 | } |
---|
3295 | |
---|
3296 | Void TDecCavlc::parseInterDir( TComDataCU* /*pcCU*/, UInt& /*ruiInterDir*/, UInt /*uiAbsPartIdx*/ ) |
---|
3297 | { |
---|
3298 | assert(0); |
---|
3299 | } |
---|
3300 | |
---|
3301 | Void TDecCavlc::parseRefFrmIdx( TComDataCU* /*pcCU*/, Int& /*riRefFrmIdx*/, RefPicList /*eRefList*/ ) |
---|
3302 | { |
---|
3303 | assert(0); |
---|
3304 | } |
---|
3305 | |
---|
3306 | Void TDecCavlc::parseMvd( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiPartIdx*/, UInt /*uiDepth*/, RefPicList /*eRefList*/ ) |
---|
3307 | { |
---|
3308 | assert(0); |
---|
3309 | } |
---|
3310 | |
---|
3311 | Void TDecCavlc::parseCrossComponentPrediction( class TComTU& /*rTu*/, ComponentID /*compID*/ ) |
---|
3312 | { |
---|
3313 | assert(0); |
---|
3314 | } |
---|
3315 | |
---|
3316 | Void TDecCavlc::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
3317 | { |
---|
3318 | Int iDQp; |
---|
3319 | |
---|
3320 | #if RExt__DECODER_DEBUG_BIT_STATISTICS |
---|
3321 | READ_SVLC(iDQp, "delta_qp"); |
---|
3322 | #else |
---|
3323 | xReadSvlc( iDQp ); |
---|
3324 | #endif |
---|
3325 | |
---|
3326 | Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA); |
---|
3327 | const Int qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) - qpBdOffsetY; |
---|
3328 | |
---|
3329 | const UInt maxCUDepth = pcCU->getSlice()->getSPS()->getMaxTotalCUDepth(); |
---|
3330 | const UInt maxCuDQPDepth = pcCU->getSlice()->getPPS()->getMaxCuDQPDepth(); |
---|
3331 | const UInt doubleDepthDifference = ((maxCUDepth - maxCuDQPDepth)<<1); |
---|
3332 | const UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>doubleDepthDifference)<<doubleDepthDifference ; |
---|
3333 | const UInt uiQpCUDepth = min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ; |
---|
3334 | |
---|
3335 | pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth ); |
---|
3336 | } |
---|
3337 | |
---|
3338 | Void TDecCavlc::parseChromaQpAdjustment( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
3339 | { |
---|
3340 | assert(0); |
---|
3341 | } |
---|
3342 | |
---|
3343 | Void TDecCavlc::parseCoeffNxN( TComTU &/*rTu*/, ComponentID /*compID*/ ) |
---|
3344 | { |
---|
3345 | assert(0); |
---|
3346 | } |
---|
3347 | |
---|
3348 | Void TDecCavlc::parseTransformSubdivFlag( UInt& /*ruiSubdivFlag*/, UInt /*uiLog2TransformBlockSize*/ ) |
---|
3349 | { |
---|
3350 | assert(0); |
---|
3351 | } |
---|
3352 | |
---|
3353 | Void TDecCavlc::parseQtCbf( TComTU &/*rTu*/, const ComponentID /*compID*/, const Bool /*lowestLevel*/ ) |
---|
3354 | { |
---|
3355 | assert(0); |
---|
3356 | } |
---|
3357 | |
---|
3358 | Void TDecCavlc::parseQtRootCbf( UInt /*uiAbsPartIdx*/, UInt& /*uiQtRootCbf*/ ) |
---|
3359 | { |
---|
3360 | assert(0); |
---|
3361 | } |
---|
3362 | |
---|
3363 | Void TDecCavlc::parseTransformSkipFlags (TComTU &/*rTu*/, ComponentID /*component*/) |
---|
3364 | { |
---|
3365 | assert(0); |
---|
3366 | } |
---|
3367 | |
---|
3368 | Void TDecCavlc::parseMergeFlag ( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/, UInt /*uiPUIdx*/ ) |
---|
3369 | { |
---|
3370 | assert(0); |
---|
3371 | } |
---|
3372 | |
---|
3373 | Void TDecCavlc::parseMergeIndex ( TComDataCU* /*pcCU*/, UInt& /*ruiMergeIndex*/ ) |
---|
3374 | { |
---|
3375 | assert(0); |
---|
3376 | } |
---|
3377 | |
---|
3378 | #if H_3D_ARP |
---|
3379 | Void TDecCavlc::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
3380 | { |
---|
3381 | assert(0); |
---|
3382 | } |
---|
3383 | #endif |
---|
3384 | #if NH_3D_IC |
---|
3385 | Void TDecCavlc::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
3386 | { |
---|
3387 | assert(0); |
---|
3388 | } |
---|
3389 | #endif |
---|
3390 | #if H_3D_INTER_SDC |
---|
3391 | Void TDecCavlc::parseDeltaDC( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ ) |
---|
3392 | { |
---|
3393 | assert(0); |
---|
3394 | } |
---|
3395 | |
---|
3396 | Void TDecCavlc::parseSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
3397 | { |
---|
3398 | assert(0); |
---|
3399 | } |
---|
3400 | |
---|
3401 | #endif |
---|
3402 | #if H_3D_DBBP |
---|
3403 | Void TDecCavlc::parseDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
3404 | { |
---|
3405 | assert(0); |
---|
3406 | } |
---|
3407 | #endif |
---|
3408 | // ==================================================================================================================== |
---|
3409 | // Protected member functions |
---|
3410 | // ==================================================================================================================== |
---|
3411 | |
---|
3412 | //! parse explicit wp tables |
---|
3413 | Void TDecCavlc::xParsePredWeightTable( TComSlice* pcSlice, const TComSPS *sps ) |
---|
3414 | { |
---|
3415 | WPScalingParam *wp; |
---|
3416 | const ChromaFormat chFmt = sps->getChromaFormatIdc(); |
---|
3417 | const Int numValidComp = Int(getNumberValidComponents(chFmt)); |
---|
3418 | const Bool bChroma = (chFmt!=CHROMA_400); |
---|
3419 | const SliceType eSliceType = pcSlice->getSliceType(); |
---|
3420 | const Int iNbRef = (eSliceType == B_SLICE ) ? (2) : (1); |
---|
3421 | UInt uiLog2WeightDenomLuma=0, uiLog2WeightDenomChroma=0; |
---|
3422 | UInt uiTotalSignalledWeightFlags = 0; |
---|
3423 | |
---|
3424 | Int iDeltaDenom; |
---|
3425 | // decode delta_luma_log2_weight_denom : |
---|
3426 | READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); |
---|
3427 | assert( uiLog2WeightDenomLuma <= 7 ); |
---|
3428 | if( bChroma ) |
---|
3429 | { |
---|
3430 | READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); |
---|
3431 | assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)>=0); |
---|
3432 | assert((iDeltaDenom + (Int)uiLog2WeightDenomLuma)<=7); |
---|
3433 | uiLog2WeightDenomChroma = (UInt)(iDeltaDenom + uiLog2WeightDenomLuma); |
---|
3434 | } |
---|
3435 | |
---|
3436 | |
---|
3437 | |
---|
3438 | for ( Int iNumRef=0 ; iNumRef<iNbRef ; iNumRef++ ) // loop over l0 and l1 syntax elements |
---|
3439 | { |
---|
3440 | RefPicList eRefPicList = ( iNumRef ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); |
---|
3441 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
3442 | { |
---|
3443 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
3444 | |
---|
3445 | wp[COMPONENT_Y].uiLog2WeightDenom = uiLog2WeightDenomLuma; |
---|
3446 | for(Int j=1; j<numValidComp; j++) |
---|
3447 | { |
---|
3448 | wp[j].uiLog2WeightDenom = uiLog2WeightDenomChroma; |
---|
3449 | } |
---|
3450 | |
---|
3451 | UInt uiCode; |
---|
3452 | READ_FLAG( uiCode, iNumRef==0?"luma_weight_l0_flag[i]":"luma_weight_l1_flag[i]" ); |
---|
3453 | wp[COMPONENT_Y].bPresentFlag = ( uiCode == 1 ); |
---|
3454 | uiTotalSignalledWeightFlags += wp[COMPONENT_Y].bPresentFlag; |
---|
3455 | } |
---|
3456 | if ( bChroma ) |
---|
3457 | { |
---|
3458 | UInt uiCode; |
---|
3459 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
3460 | { |
---|
3461 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
3462 | READ_FLAG( uiCode, iNumRef==0?"chroma_weight_l0_flag[i]":"chroma_weight_l1_flag[i]" ); |
---|
3463 | for(Int j=1; j<numValidComp; j++) |
---|
3464 | { |
---|
3465 | wp[j].bPresentFlag = ( uiCode == 1 ); |
---|
3466 | } |
---|
3467 | uiTotalSignalledWeightFlags += 2*wp[COMPONENT_Cb].bPresentFlag; |
---|
3468 | } |
---|
3469 | } |
---|
3470 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
3471 | { |
---|
3472 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
3473 | if ( wp[COMPONENT_Y].bPresentFlag ) |
---|
3474 | { |
---|
3475 | Int iDeltaWeight; |
---|
3476 | READ_SVLC( iDeltaWeight, iNumRef==0?"delta_luma_weight_l0[i]":"delta_luma_weight_l1[i]" ); |
---|
3477 | assert( iDeltaWeight >= -128 ); |
---|
3478 | assert( iDeltaWeight <= 127 ); |
---|
3479 | wp[COMPONENT_Y].iWeight = (iDeltaWeight + (1<<wp[COMPONENT_Y].uiLog2WeightDenom)); |
---|
3480 | READ_SVLC( wp[COMPONENT_Y].iOffset, iNumRef==0?"luma_offset_l0[i]":"luma_offset_l1[i]" ); |
---|
3481 | Int range=sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<sps->getBitDepth(CHANNEL_TYPE_LUMA))/2 : 128; |
---|
3482 | assert( wp[0].iOffset >= -range ); |
---|
3483 | assert( wp[0].iOffset < range ); |
---|
3484 | } |
---|
3485 | else |
---|
3486 | { |
---|
3487 | wp[COMPONENT_Y].iWeight = (1 << wp[COMPONENT_Y].uiLog2WeightDenom); |
---|
3488 | wp[COMPONENT_Y].iOffset = 0; |
---|
3489 | } |
---|
3490 | if ( bChroma ) |
---|
3491 | { |
---|
3492 | if ( wp[COMPONENT_Cb].bPresentFlag ) |
---|
3493 | { |
---|
3494 | Int range=sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<sps->getBitDepth(CHANNEL_TYPE_CHROMA))/2 : 128; |
---|
3495 | for ( Int j=1 ; j<numValidComp ; j++ ) |
---|
3496 | { |
---|
3497 | Int iDeltaWeight; |
---|
3498 | READ_SVLC( iDeltaWeight, iNumRef==0?"delta_chroma_weight_l0[i]":"delta_chroma_weight_l1[i]" ); |
---|
3499 | assert( iDeltaWeight >= -128 ); |
---|
3500 | assert( iDeltaWeight <= 127 ); |
---|
3501 | wp[j].iWeight = (iDeltaWeight + (1<<wp[j].uiLog2WeightDenom)); |
---|
3502 | |
---|
3503 | Int iDeltaChroma; |
---|
3504 | READ_SVLC( iDeltaChroma, iNumRef==0?"delta_chroma_offset_l0[i]":"delta_chroma_offset_l1[i]" ); |
---|
3505 | assert( iDeltaChroma >= -4*range); |
---|
3506 | assert( iDeltaChroma < 4*range); |
---|
3507 | Int pred = ( range - ( ( range*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); |
---|
3508 | wp[j].iOffset = Clip3(-range, range-1, (iDeltaChroma + pred) ); |
---|
3509 | } |
---|
3510 | } |
---|
3511 | else |
---|
3512 | { |
---|
3513 | for ( Int j=1 ; j<numValidComp ; j++ ) |
---|
3514 | { |
---|
3515 | wp[j].iWeight = (1 << wp[j].uiLog2WeightDenom); |
---|
3516 | wp[j].iOffset = 0; |
---|
3517 | } |
---|
3518 | } |
---|
3519 | } |
---|
3520 | } |
---|
3521 | |
---|
3522 | for ( Int iRefIdx=pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) |
---|
3523 | { |
---|
3524 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
3525 | |
---|
3526 | wp[0].bPresentFlag = false; |
---|
3527 | wp[1].bPresentFlag = false; |
---|
3528 | wp[2].bPresentFlag = false; |
---|
3529 | } |
---|
3530 | } |
---|
3531 | assert(uiTotalSignalledWeightFlags<=24); |
---|
3532 | } |
---|
3533 | |
---|
3534 | /** decode quantization matrix |
---|
3535 | * \param scalingList quantization matrix information |
---|
3536 | */ |
---|
3537 | Void TDecCavlc::parseScalingList(TComScalingList* scalingList) |
---|
3538 | { |
---|
3539 | UInt code, sizeId, listId; |
---|
3540 | Bool scalingListPredModeFlag; |
---|
3541 | //for each size |
---|
3542 | for(sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
3543 | { |
---|
3544 | for(listId = 0; listId < SCALING_LIST_NUM; listId++) |
---|
3545 | { |
---|
3546 | if ((sizeId==SCALING_LIST_32x32) && (listId%(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES) != 0)) |
---|
3547 | { |
---|
3548 | Int *src = scalingList->getScalingListAddress(sizeId, listId); |
---|
3549 | const Int size = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]); |
---|
3550 | const Int *srcNextSmallerSize = scalingList->getScalingListAddress(sizeId-1, listId); |
---|
3551 | for(Int i=0; i<size; i++) |
---|
3552 | { |
---|
3553 | src[i] = srcNextSmallerSize[i]; |
---|
3554 | } |
---|
3555 | scalingList->setScalingListDC(sizeId,listId,(sizeId > SCALING_LIST_8x8) ? scalingList->getScalingListDC(sizeId-1, listId) : src[0]); |
---|
3556 | } |
---|
3557 | else |
---|
3558 | { |
---|
3559 | READ_FLAG( code, "scaling_list_pred_mode_flag"); |
---|
3560 | scalingListPredModeFlag = (code) ? true : false; |
---|
3561 | scalingList->setScalingListPredModeFlag(sizeId, listId, scalingListPredModeFlag); |
---|
3562 | if(!scalingListPredModeFlag) //Copy Mode |
---|
3563 | { |
---|
3564 | READ_UVLC( code, "scaling_list_pred_matrix_id_delta"); |
---|
3565 | |
---|
3566 | if (sizeId==SCALING_LIST_32x32) |
---|
3567 | { |
---|
3568 | code*=(SCALING_LIST_NUM/NUMBER_OF_PREDICTION_MODES); // Adjust the decoded code for this size, to cope with the missing 32x32 chroma entries. |
---|
3569 | } |
---|
3570 | |
---|
3571 | scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code))); |
---|
3572 | if( sizeId > SCALING_LIST_8x8 ) |
---|
3573 | { |
---|
3574 | scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId)))); |
---|
3575 | } |
---|
3576 | scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId)); |
---|
3577 | |
---|
3578 | } |
---|
3579 | else //DPCM Mode |
---|
3580 | { |
---|
3581 | xDecodeScalingList(scalingList, sizeId, listId); |
---|
3582 | } |
---|
3583 | } |
---|
3584 | } |
---|
3585 | } |
---|
3586 | |
---|
3587 | return; |
---|
3588 | } |
---|
3589 | /** decode DPCM |
---|
3590 | * \param scalingList quantization matrix information |
---|
3591 | * \param sizeId size index |
---|
3592 | * \param listId list index |
---|
3593 | */ |
---|
3594 | Void TDecCavlc::xDecodeScalingList(TComScalingList *scalingList, UInt sizeId, UInt listId) |
---|
3595 | { |
---|
3596 | Int i,coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]); |
---|
3597 | Int data; |
---|
3598 | Int scalingListDcCoefMinus8 = 0; |
---|
3599 | Int nextCoef = SCALING_LIST_START_VALUE; |
---|
3600 | UInt* scan = g_scanOrder[SCAN_UNGROUPED][SCAN_DIAG][sizeId==0 ? 2 : 3][sizeId==0 ? 2 : 3]; |
---|
3601 | Int *dst = scalingList->getScalingListAddress(sizeId, listId); |
---|
3602 | |
---|
3603 | if( sizeId > SCALING_LIST_8x8 ) |
---|
3604 | { |
---|
3605 | READ_SVLC( scalingListDcCoefMinus8, "scaling_list_dc_coef_minus8"); |
---|
3606 | scalingList->setScalingListDC(sizeId,listId,scalingListDcCoefMinus8 + 8); |
---|
3607 | nextCoef = scalingList->getScalingListDC(sizeId,listId); |
---|
3608 | } |
---|
3609 | |
---|
3610 | for(i = 0; i < coefNum; i++) |
---|
3611 | { |
---|
3612 | READ_SVLC( data, "scaling_list_delta_coef"); |
---|
3613 | nextCoef = (nextCoef + data + 256 ) % 256; |
---|
3614 | dst[scan[i]] = nextCoef; |
---|
3615 | } |
---|
3616 | } |
---|
3617 | |
---|
3618 | Bool TDecCavlc::xMoreRbspData() |
---|
3619 | { |
---|
3620 | Int bitsLeft = m_pcBitstream->getNumBitsLeft(); |
---|
3621 | |
---|
3622 | // if there are more than 8 bits, it cannot be rbsp_trailing_bits |
---|
3623 | if (bitsLeft > 8) |
---|
3624 | { |
---|
3625 | return true; |
---|
3626 | } |
---|
3627 | |
---|
3628 | UChar lastByte = m_pcBitstream->peekBits(bitsLeft); |
---|
3629 | Int cnt = bitsLeft; |
---|
3630 | |
---|
3631 | // remove trailing bits equal to zero |
---|
3632 | while ((cnt>0) && ((lastByte & 1) == 0)) |
---|
3633 | { |
---|
3634 | lastByte >>= 1; |
---|
3635 | cnt--; |
---|
3636 | } |
---|
3637 | // remove bit equal to one |
---|
3638 | cnt--; |
---|
3639 | |
---|
3640 | // we should not have a negative number of bits |
---|
3641 | assert (cnt>=0); |
---|
3642 | |
---|
3643 | // we have more data, if cnt is not zero |
---|
3644 | return (cnt>0); |
---|
3645 | } |
---|
3646 | |
---|
3647 | Void TDecCavlc::parseExplicitRdpcmMode( TComTU& /*rTu*/, ComponentID /*compID*/ ) |
---|
3648 | { |
---|
3649 | assert(0); |
---|
3650 | } |
---|
3651 | //! \} |
---|
3652 | |
---|