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-2014, 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 TEncCavlc.cpp |
---|
35 | \brief CAVLC encoder class |
---|
36 | */ |
---|
37 | |
---|
38 | #include "../TLibCommon/CommonDef.h" |
---|
39 | #include "TEncCavlc.h" |
---|
40 | #include "SEIwrite.h" |
---|
41 | |
---|
42 | //! \ingroup TLibEncoder |
---|
43 | //! \{ |
---|
44 | |
---|
45 | #if ENC_DEC_TRACE |
---|
46 | |
---|
47 | Void xTraceSPSHeader (TComSPS *pSPS) |
---|
48 | { |
---|
49 | fprintf( g_hTrace, "=========== Sequence Parameter Set ID: %d ===========\n", pSPS->getSPSId() ); |
---|
50 | } |
---|
51 | |
---|
52 | Void xTracePPSHeader (TComPPS *pPPS) |
---|
53 | { |
---|
54 | fprintf( g_hTrace, "=========== Picture Parameter Set ID: %d ===========\n", pPPS->getPPSId() ); |
---|
55 | } |
---|
56 | |
---|
57 | Void xTraceSliceHeader (TComSlice *pSlice) |
---|
58 | { |
---|
59 | fprintf( g_hTrace, "=========== Slice ===========\n"); |
---|
60 | } |
---|
61 | |
---|
62 | #endif |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | // ==================================================================================================================== |
---|
67 | // Constructor / destructor / create / destroy |
---|
68 | // ==================================================================================================================== |
---|
69 | |
---|
70 | TEncCavlc::TEncCavlc() |
---|
71 | { |
---|
72 | m_pcBitIf = NULL; |
---|
73 | m_uiCoeffCost = 0; |
---|
74 | } |
---|
75 | |
---|
76 | TEncCavlc::~TEncCavlc() |
---|
77 | { |
---|
78 | } |
---|
79 | |
---|
80 | |
---|
81 | // ==================================================================================================================== |
---|
82 | // Public member functions |
---|
83 | // ==================================================================================================================== |
---|
84 | |
---|
85 | Void TEncCavlc::resetEntropy() |
---|
86 | { |
---|
87 | } |
---|
88 | |
---|
89 | |
---|
90 | Void TEncCavlc::codeDFFlag(UInt uiCode, const Char *pSymbolName) |
---|
91 | { |
---|
92 | WRITE_FLAG(uiCode, pSymbolName); |
---|
93 | } |
---|
94 | Void TEncCavlc::codeDFSvlc(Int iCode, const Char *pSymbolName) |
---|
95 | { |
---|
96 | WRITE_SVLC(iCode, pSymbolName); |
---|
97 | } |
---|
98 | |
---|
99 | Void TEncCavlc::codeShortTermRefPicSet( TComSPS* pcSPS, TComReferencePictureSet* rps, Bool calledFromSliceHeader, Int idx) |
---|
100 | { |
---|
101 | #if PRINT_RPS_INFO |
---|
102 | Int lastBits = getNumberOfWrittenBits(); |
---|
103 | #endif |
---|
104 | if (idx > 0) |
---|
105 | { |
---|
106 | WRITE_FLAG( rps->getInterRPSPrediction(), "inter_ref_pic_set_prediction_flag" ); // inter_RPS_prediction_flag |
---|
107 | } |
---|
108 | if (rps->getInterRPSPrediction()) |
---|
109 | { |
---|
110 | Int deltaRPS = rps->getDeltaRPS(); |
---|
111 | if(calledFromSliceHeader) |
---|
112 | { |
---|
113 | WRITE_UVLC( rps->getDeltaRIdxMinus1(), "delta_idx_minus1" ); // delta index of the Reference Picture Set used for prediction minus 1 |
---|
114 | } |
---|
115 | |
---|
116 | WRITE_CODE( (deltaRPS >=0 ? 0: 1), 1, "delta_rps_sign" ); //delta_rps_sign |
---|
117 | WRITE_UVLC( abs(deltaRPS) - 1, "abs_delta_rps_minus1"); // absolute delta RPS minus 1 |
---|
118 | |
---|
119 | for(Int j=0; j < rps->getNumRefIdc(); j++) |
---|
120 | { |
---|
121 | Int refIdc = rps->getRefIdc(j); |
---|
122 | WRITE_CODE( (refIdc==1? 1: 0), 1, "used_by_curr_pic_flag" ); //first bit is "1" if Idc is 1 |
---|
123 | if (refIdc != 1) |
---|
124 | { |
---|
125 | WRITE_CODE( refIdc>>1, 1, "use_delta_flag" ); //second bit is "1" if Idc is 2, "0" otherwise. |
---|
126 | } |
---|
127 | } |
---|
128 | } |
---|
129 | else |
---|
130 | { |
---|
131 | WRITE_UVLC( rps->getNumberOfNegativePictures(), "num_negative_pics" ); |
---|
132 | WRITE_UVLC( rps->getNumberOfPositivePictures(), "num_positive_pics" ); |
---|
133 | Int prev = 0; |
---|
134 | for(Int j=0 ; j < rps->getNumberOfNegativePictures(); j++) |
---|
135 | { |
---|
136 | WRITE_UVLC( prev-rps->getDeltaPOC(j)-1, "delta_poc_s0_minus1" ); |
---|
137 | prev = rps->getDeltaPOC(j); |
---|
138 | WRITE_FLAG( rps->getUsed(j), "used_by_curr_pic_s0_flag"); |
---|
139 | } |
---|
140 | prev = 0; |
---|
141 | for(Int j=rps->getNumberOfNegativePictures(); j < rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures(); j++) |
---|
142 | { |
---|
143 | WRITE_UVLC( rps->getDeltaPOC(j)-prev-1, "delta_poc_s1_minus1" ); |
---|
144 | prev = rps->getDeltaPOC(j); |
---|
145 | WRITE_FLAG( rps->getUsed(j), "used_by_curr_pic_s1_flag" ); |
---|
146 | } |
---|
147 | } |
---|
148 | |
---|
149 | #if PRINT_RPS_INFO |
---|
150 | printf("irps=%d (%2d bits) ", rps->getInterRPSPrediction(), getNumberOfWrittenBits() - lastBits); |
---|
151 | rps->printDeltaPOC(); |
---|
152 | #endif |
---|
153 | } |
---|
154 | |
---|
155 | |
---|
156 | Void TEncCavlc::codePPS( TComPPS* pcPPS |
---|
157 | #if Q0048_CGS_3D_ASYMLUT |
---|
158 | , TEnc3DAsymLUT * pc3DAsymLUT |
---|
159 | #endif |
---|
160 | ) |
---|
161 | { |
---|
162 | #if ENC_DEC_TRACE |
---|
163 | xTracePPSHeader (pcPPS); |
---|
164 | #endif |
---|
165 | |
---|
166 | WRITE_UVLC( pcPPS->getPPSId(), "pps_pic_parameter_set_id" ); |
---|
167 | WRITE_UVLC( pcPPS->getSPSId(), "pps_seq_parameter_set_id" ); |
---|
168 | WRITE_FLAG( pcPPS->getDependentSliceSegmentsEnabledFlag() ? 1 : 0, "dependent_slice_segments_enabled_flag" ); |
---|
169 | WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0, "output_flag_present_flag" ); |
---|
170 | WRITE_CODE( pcPPS->getNumExtraSliceHeaderBits(), 3, "num_extra_slice_header_bits"); |
---|
171 | WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" ); |
---|
172 | WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0, "cabac_init_present_flag" ); |
---|
173 | WRITE_UVLC( pcPPS->getNumRefIdxL0DefaultActive()-1, "num_ref_idx_l0_default_active_minus1"); |
---|
174 | WRITE_UVLC( pcPPS->getNumRefIdxL1DefaultActive()-1, "num_ref_idx_l1_default_active_minus1"); |
---|
175 | |
---|
176 | WRITE_SVLC( pcPPS->getPicInitQPMinus26(), "init_qp_minus26"); |
---|
177 | WRITE_FLAG( pcPPS->getConstrainedIntraPred() ? 1 : 0, "constrained_intra_pred_flag" ); |
---|
178 | WRITE_FLAG( pcPPS->getUseTransformSkip() ? 1 : 0, "transform_skip_enabled_flag" ); |
---|
179 | WRITE_FLAG( pcPPS->getUseDQP() ? 1 : 0, "cu_qp_delta_enabled_flag" ); |
---|
180 | if ( pcPPS->getUseDQP() ) |
---|
181 | { |
---|
182 | WRITE_UVLC( pcPPS->getMaxCuDQPDepth(), "diff_cu_qp_delta_depth" ); |
---|
183 | } |
---|
184 | WRITE_SVLC( pcPPS->getChromaCbQpOffset(), "pps_cb_qp_offset" ); |
---|
185 | WRITE_SVLC( pcPPS->getChromaCrQpOffset(), "pps_cr_qp_offset" ); |
---|
186 | WRITE_FLAG( pcPPS->getSliceChromaQpFlag() ? 1 : 0, "pps_slice_chroma_qp_offsets_present_flag" ); |
---|
187 | |
---|
188 | WRITE_FLAG( pcPPS->getUseWP() ? 1 : 0, "weighted_pred_flag" ); // Use of Weighting Prediction (P_SLICE) |
---|
189 | WRITE_FLAG( pcPPS->getWPBiPred() ? 1 : 0, "weighted_bipred_flag" ); // Use of Weighting Bi-Prediction (B_SLICE) |
---|
190 | WRITE_FLAG( pcPPS->getTransquantBypassEnableFlag() ? 1 : 0, "transquant_bypass_enable_flag" ); |
---|
191 | WRITE_FLAG( pcPPS->getTilesEnabledFlag() ? 1 : 0, "tiles_enabled_flag" ); |
---|
192 | WRITE_FLAG( pcPPS->getEntropyCodingSyncEnabledFlag() ? 1 : 0, "entropy_coding_sync_enabled_flag" ); |
---|
193 | if( pcPPS->getTilesEnabledFlag() ) |
---|
194 | { |
---|
195 | WRITE_UVLC( pcPPS->getNumTileColumnsMinus1(), "num_tile_columns_minus1" ); |
---|
196 | WRITE_UVLC( pcPPS->getTileNumRowsMinus1(), "num_tile_rows_minus1" ); |
---|
197 | WRITE_FLAG( pcPPS->getTileUniformSpacingFlag(), "uniform_spacing_flag" ); |
---|
198 | if( !pcPPS->getTileUniformSpacingFlag() ) |
---|
199 | { |
---|
200 | for(UInt i=0; i<pcPPS->getNumTileColumnsMinus1(); i++) |
---|
201 | { |
---|
202 | WRITE_UVLC( pcPPS->getTileColumnWidth(i)-1, "column_width_minus1" ); |
---|
203 | } |
---|
204 | for(UInt i=0; i<pcPPS->getTileNumRowsMinus1(); i++) |
---|
205 | { |
---|
206 | WRITE_UVLC( pcPPS->getTileRowHeight(i)-1, "row_height_minus1" ); |
---|
207 | } |
---|
208 | } |
---|
209 | if(pcPPS->getNumTileColumnsMinus1() !=0 || pcPPS->getTileNumRowsMinus1() !=0) |
---|
210 | { |
---|
211 | WRITE_FLAG( pcPPS->getLoopFilterAcrossTilesEnabledFlag()?1 : 0, "loop_filter_across_tiles_enabled_flag"); |
---|
212 | } |
---|
213 | } |
---|
214 | WRITE_FLAG( pcPPS->getLoopFilterAcrossSlicesEnabledFlag()?1 : 0, "loop_filter_across_slices_enabled_flag"); |
---|
215 | WRITE_FLAG( pcPPS->getDeblockingFilterControlPresentFlag()?1 : 0, "deblocking_filter_control_present_flag"); |
---|
216 | if(pcPPS->getDeblockingFilterControlPresentFlag()) |
---|
217 | { |
---|
218 | WRITE_FLAG( pcPPS->getDeblockingFilterOverrideEnabledFlag() ? 1 : 0, "deblocking_filter_override_enabled_flag" ); |
---|
219 | WRITE_FLAG( pcPPS->getPicDisableDeblockingFilterFlag() ? 1 : 0, "pps_disable_deblocking_filter_flag" ); |
---|
220 | if(!pcPPS->getPicDisableDeblockingFilterFlag()) |
---|
221 | { |
---|
222 | WRITE_SVLC( pcPPS->getDeblockingFilterBetaOffsetDiv2(), "pps_beta_offset_div2" ); |
---|
223 | WRITE_SVLC( pcPPS->getDeblockingFilterTcOffsetDiv2(), "pps_tc_offset_div2" ); |
---|
224 | } |
---|
225 | } |
---|
226 | |
---|
227 | #if SCALINGLIST_INFERRING |
---|
228 | if( pcPPS->getLayerId() > 0 ) |
---|
229 | { |
---|
230 | WRITE_FLAG( pcPPS->getInferScalingListFlag() ? 1 : 0, "pps_infer_scaling_list_flag" ); |
---|
231 | } |
---|
232 | |
---|
233 | if( pcPPS->getInferScalingListFlag() ) |
---|
234 | { |
---|
235 | // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive |
---|
236 | assert( pcPPS->getScalingListRefLayerId() <= 62 ); |
---|
237 | |
---|
238 | WRITE_UVLC( pcPPS->getScalingListRefLayerId(), "pps_scaling_list_ref_layer_id" ); |
---|
239 | } |
---|
240 | else |
---|
241 | { |
---|
242 | #endif |
---|
243 | |
---|
244 | WRITE_FLAG( pcPPS->getScalingListPresentFlag() ? 1 : 0, "pps_scaling_list_data_present_flag" ); |
---|
245 | if( pcPPS->getScalingListPresentFlag() ) |
---|
246 | { |
---|
247 | codeScalingList( m_pcSlice->getScalingList() ); |
---|
248 | } |
---|
249 | |
---|
250 | #if SCALINGLIST_INFERRING |
---|
251 | } |
---|
252 | #endif |
---|
253 | |
---|
254 | WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag"); |
---|
255 | WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2"); |
---|
256 | WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag"); |
---|
257 | #if P0166_MODIFIED_PPS_EXTENSION |
---|
258 | WRITE_FLAG( pcPPS->getExtensionFlag() ? 1 : 0, "pps_extension_flag" ); |
---|
259 | |
---|
260 | if( pcPPS->getExtensionFlag() ) |
---|
261 | { |
---|
262 | #if !POC_RESET_IDC |
---|
263 | UInt ppsExtensionTypeFlag[8] = { 0, 1, 0, 0, 0, 0, 0, 0 }; |
---|
264 | #else |
---|
265 | UInt ppsExtensionTypeFlag[8] = { 1, 0, 0, 0, 0, 0, 0, 0 }; |
---|
266 | #endif |
---|
267 | for (UInt i = 0; i < 8; i++) |
---|
268 | { |
---|
269 | WRITE_FLAG( ppsExtensionTypeFlag[i], "pps_extension_type_flag" ); |
---|
270 | } |
---|
271 | #if POC_RESET_IDC |
---|
272 | if( ppsExtensionTypeFlag[0] ) |
---|
273 | { |
---|
274 | WRITE_FLAG( pcPPS->getPocResetInfoPresentFlag() ? 1 : 0, "poc_reset_info_present_flag" ); |
---|
275 | #if Q0048_CGS_3D_ASYMLUT |
---|
276 | UInt uiPos = getNumberOfWrittenBits(); |
---|
277 | WRITE_FLAG( pcPPS->getCGSFlag() , "colour_mapping_enabled_flag" ); |
---|
278 | if( pcPPS->getCGSFlag() ) |
---|
279 | { |
---|
280 | assert( pc3DAsymLUT != NULL ); |
---|
281 | xCode3DAsymLUT( pc3DAsymLUT ); |
---|
282 | } |
---|
283 | pc3DAsymLUT->setPPSBit( getNumberOfWrittenBits() - uiPos ); |
---|
284 | #endif |
---|
285 | #endif |
---|
286 | } |
---|
287 | } |
---|
288 | #else |
---|
289 | WRITE_FLAG( 0, "pps_extension_flag" ); |
---|
290 | #endif |
---|
291 | } |
---|
292 | |
---|
293 | Void TEncCavlc::codeVUI( TComVUI *pcVUI, TComSPS* pcSPS ) |
---|
294 | { |
---|
295 | #if ENC_DEC_TRACE |
---|
296 | fprintf( g_hTrace, "----------- vui_parameters -----------\n"); |
---|
297 | #endif |
---|
298 | WRITE_FLAG(pcVUI->getAspectRatioInfoPresentFlag(), "aspect_ratio_info_present_flag"); |
---|
299 | if (pcVUI->getAspectRatioInfoPresentFlag()) |
---|
300 | { |
---|
301 | WRITE_CODE(pcVUI->getAspectRatioIdc(), 8, "aspect_ratio_idc" ); |
---|
302 | if (pcVUI->getAspectRatioIdc() == 255) |
---|
303 | { |
---|
304 | WRITE_CODE(pcVUI->getSarWidth(), 16, "sar_width"); |
---|
305 | WRITE_CODE(pcVUI->getSarHeight(), 16, "sar_height"); |
---|
306 | } |
---|
307 | } |
---|
308 | WRITE_FLAG(pcVUI->getOverscanInfoPresentFlag(), "overscan_info_present_flag"); |
---|
309 | if (pcVUI->getOverscanInfoPresentFlag()) |
---|
310 | { |
---|
311 | WRITE_FLAG(pcVUI->getOverscanAppropriateFlag(), "overscan_appropriate_flag"); |
---|
312 | } |
---|
313 | WRITE_FLAG(pcVUI->getVideoSignalTypePresentFlag(), "video_signal_type_present_flag"); |
---|
314 | if (pcVUI->getVideoSignalTypePresentFlag()) |
---|
315 | { |
---|
316 | WRITE_CODE(pcVUI->getVideoFormat(), 3, "video_format"); |
---|
317 | WRITE_FLAG(pcVUI->getVideoFullRangeFlag(), "video_full_range_flag"); |
---|
318 | WRITE_FLAG(pcVUI->getColourDescriptionPresentFlag(), "colour_description_present_flag"); |
---|
319 | if (pcVUI->getColourDescriptionPresentFlag()) |
---|
320 | { |
---|
321 | WRITE_CODE(pcVUI->getColourPrimaries(), 8, "colour_primaries"); |
---|
322 | WRITE_CODE(pcVUI->getTransferCharacteristics(), 8, "transfer_characteristics"); |
---|
323 | WRITE_CODE(pcVUI->getMatrixCoefficients(), 8, "matrix_coefficients"); |
---|
324 | } |
---|
325 | } |
---|
326 | |
---|
327 | WRITE_FLAG(pcVUI->getChromaLocInfoPresentFlag(), "chroma_loc_info_present_flag"); |
---|
328 | if (pcVUI->getChromaLocInfoPresentFlag()) |
---|
329 | { |
---|
330 | WRITE_UVLC(pcVUI->getChromaSampleLocTypeTopField(), "chroma_sample_loc_type_top_field"); |
---|
331 | WRITE_UVLC(pcVUI->getChromaSampleLocTypeBottomField(), "chroma_sample_loc_type_bottom_field"); |
---|
332 | } |
---|
333 | |
---|
334 | WRITE_FLAG(pcVUI->getNeutralChromaIndicationFlag(), "neutral_chroma_indication_flag"); |
---|
335 | WRITE_FLAG(pcVUI->getFieldSeqFlag(), "field_seq_flag"); |
---|
336 | WRITE_FLAG(pcVUI->getFrameFieldInfoPresentFlag(), "frame_field_info_present_flag"); |
---|
337 | |
---|
338 | Window defaultDisplayWindow = pcVUI->getDefaultDisplayWindow(); |
---|
339 | WRITE_FLAG(defaultDisplayWindow.getWindowEnabledFlag(), "default_display_window_flag"); |
---|
340 | if( defaultDisplayWindow.getWindowEnabledFlag() ) |
---|
341 | { |
---|
342 | WRITE_UVLC(defaultDisplayWindow.getWindowLeftOffset() / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc()), "def_disp_win_left_offset"); |
---|
343 | WRITE_UVLC(defaultDisplayWindow.getWindowRightOffset() / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc()), "def_disp_win_right_offset"); |
---|
344 | WRITE_UVLC(defaultDisplayWindow.getWindowTopOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc()), "def_disp_win_top_offset"); |
---|
345 | WRITE_UVLC(defaultDisplayWindow.getWindowBottomOffset()/ TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc()), "def_disp_win_bottom_offset"); |
---|
346 | } |
---|
347 | TimingInfo *timingInfo = pcVUI->getTimingInfo(); |
---|
348 | WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(), "vui_timing_info_present_flag"); |
---|
349 | if(timingInfo->getTimingInfoPresentFlag()) |
---|
350 | { |
---|
351 | WRITE_CODE(timingInfo->getNumUnitsInTick(), 32, "vui_num_units_in_tick"); |
---|
352 | WRITE_CODE(timingInfo->getTimeScale(), 32, "vui_time_scale"); |
---|
353 | WRITE_FLAG(timingInfo->getPocProportionalToTimingFlag(), "vui_poc_proportional_to_timing_flag"); |
---|
354 | if(timingInfo->getPocProportionalToTimingFlag()) |
---|
355 | { |
---|
356 | WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(), "vui_num_ticks_poc_diff_one_minus1"); |
---|
357 | } |
---|
358 | WRITE_FLAG(pcVUI->getHrdParametersPresentFlag(), "hrd_parameters_present_flag"); |
---|
359 | if( pcVUI->getHrdParametersPresentFlag() ) |
---|
360 | { |
---|
361 | codeHrdParameters(pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 ); |
---|
362 | } |
---|
363 | } |
---|
364 | |
---|
365 | WRITE_FLAG(pcVUI->getBitstreamRestrictionFlag(), "bitstream_restriction_flag"); |
---|
366 | if (pcVUI->getBitstreamRestrictionFlag()) |
---|
367 | { |
---|
368 | WRITE_FLAG(pcVUI->getTilesFixedStructureFlag(), "tiles_fixed_structure_flag"); |
---|
369 | WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(), "motion_vectors_over_pic_boundaries_flag"); |
---|
370 | WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(), "restricted_ref_pic_lists_flag"); |
---|
371 | WRITE_UVLC(pcVUI->getMinSpatialSegmentationIdc(), "min_spatial_segmentation_idc"); |
---|
372 | WRITE_UVLC(pcVUI->getMaxBytesPerPicDenom(), "max_bytes_per_pic_denom"); |
---|
373 | WRITE_UVLC(pcVUI->getMaxBitsPerMinCuDenom(), "max_bits_per_mincu_denom"); |
---|
374 | WRITE_UVLC(pcVUI->getLog2MaxMvLengthHorizontal(), "log2_max_mv_length_horizontal"); |
---|
375 | WRITE_UVLC(pcVUI->getLog2MaxMvLengthVertical(), "log2_max_mv_length_vertical"); |
---|
376 | } |
---|
377 | } |
---|
378 | |
---|
379 | Void TEncCavlc::codeHrdParameters( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 ) |
---|
380 | { |
---|
381 | if( commonInfPresentFlag ) |
---|
382 | { |
---|
383 | WRITE_FLAG( hrd->getNalHrdParametersPresentFlag() ? 1 : 0 , "nal_hrd_parameters_present_flag" ); |
---|
384 | WRITE_FLAG( hrd->getVclHrdParametersPresentFlag() ? 1 : 0 , "vcl_hrd_parameters_present_flag" ); |
---|
385 | if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() ) |
---|
386 | { |
---|
387 | WRITE_FLAG( hrd->getSubPicCpbParamsPresentFlag() ? 1 : 0, "sub_pic_cpb_params_present_flag" ); |
---|
388 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
389 | { |
---|
390 | WRITE_CODE( hrd->getTickDivisorMinus2(), 8, "tick_divisor_minus2" ); |
---|
391 | WRITE_CODE( hrd->getDuCpbRemovalDelayLengthMinus1(), 5, "du_cpb_removal_delay_length_minus1" ); |
---|
392 | WRITE_FLAG( hrd->getSubPicCpbParamsInPicTimingSEIFlag() ? 1 : 0, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); |
---|
393 | WRITE_CODE( hrd->getDpbOutputDelayDuLengthMinus1(), 5, "dpb_output_delay_du_length_minus1" ); |
---|
394 | } |
---|
395 | WRITE_CODE( hrd->getBitRateScale(), 4, "bit_rate_scale" ); |
---|
396 | WRITE_CODE( hrd->getCpbSizeScale(), 4, "cpb_size_scale" ); |
---|
397 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
398 | { |
---|
399 | WRITE_CODE( hrd->getDuCpbSizeScale(), 4, "du_cpb_size_scale" ); |
---|
400 | } |
---|
401 | WRITE_CODE( hrd->getInitialCpbRemovalDelayLengthMinus1(), 5, "initial_cpb_removal_delay_length_minus1" ); |
---|
402 | WRITE_CODE( hrd->getCpbRemovalDelayLengthMinus1(), 5, "au_cpb_removal_delay_length_minus1" ); |
---|
403 | WRITE_CODE( hrd->getDpbOutputDelayLengthMinus1(), 5, "dpb_output_delay_length_minus1" ); |
---|
404 | } |
---|
405 | } |
---|
406 | Int i, j, nalOrVcl; |
---|
407 | for( i = 0; i <= maxNumSubLayersMinus1; i ++ ) |
---|
408 | { |
---|
409 | WRITE_FLAG( hrd->getFixedPicRateFlag( i ) ? 1 : 0, "fixed_pic_rate_general_flag"); |
---|
410 | if( !hrd->getFixedPicRateFlag( i ) ) |
---|
411 | { |
---|
412 | WRITE_FLAG( hrd->getFixedPicRateWithinCvsFlag( i ) ? 1 : 0, "fixed_pic_rate_within_cvs_flag"); |
---|
413 | } |
---|
414 | else |
---|
415 | { |
---|
416 | hrd->setFixedPicRateWithinCvsFlag( i, true ); |
---|
417 | } |
---|
418 | if( hrd->getFixedPicRateWithinCvsFlag( i ) ) |
---|
419 | { |
---|
420 | WRITE_UVLC( hrd->getPicDurationInTcMinus1( i ), "elemental_duration_in_tc_minus1"); |
---|
421 | } |
---|
422 | else |
---|
423 | { |
---|
424 | WRITE_FLAG( hrd->getLowDelayHrdFlag( i ) ? 1 : 0, "low_delay_hrd_flag"); |
---|
425 | } |
---|
426 | if (!hrd->getLowDelayHrdFlag( i )) |
---|
427 | { |
---|
428 | WRITE_UVLC( hrd->getCpbCntMinus1( i ), "cpb_cnt_minus1"); |
---|
429 | } |
---|
430 | |
---|
431 | for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ ) |
---|
432 | { |
---|
433 | if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) || |
---|
434 | ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) ) |
---|
435 | { |
---|
436 | for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ ) |
---|
437 | { |
---|
438 | WRITE_UVLC( hrd->getBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_value_minus1"); |
---|
439 | WRITE_UVLC( hrd->getCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_value_minus1"); |
---|
440 | if( hrd->getSubPicCpbParamsPresentFlag() ) |
---|
441 | { |
---|
442 | WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1"); |
---|
443 | WRITE_UVLC( hrd->getDuBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_du_value_minus1"); |
---|
444 | } |
---|
445 | WRITE_FLAG( hrd->getCbrFlag( i, j, nalOrVcl ) ? 1 : 0, "cbr_flag"); |
---|
446 | } |
---|
447 | } |
---|
448 | } |
---|
449 | } |
---|
450 | } |
---|
451 | |
---|
452 | Void TEncCavlc::codeSPS( TComSPS* pcSPS ) |
---|
453 | { |
---|
454 | #if ENC_DEC_TRACE |
---|
455 | xTraceSPSHeader (pcSPS); |
---|
456 | #endif |
---|
457 | WRITE_CODE( pcSPS->getVPSId (), 4, "sps_video_parameter_set_id" ); |
---|
458 | #if SVC_EXTENSION |
---|
459 | if(pcSPS->getLayerId() == 0) |
---|
460 | { |
---|
461 | #endif |
---|
462 | WRITE_CODE( pcSPS->getMaxTLayers() - 1, 3, "sps_max_sub_layers_minus1" ); |
---|
463 | WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0, "sps_temporal_id_nesting_flag" ); |
---|
464 | #if SVC_EXTENSION |
---|
465 | } |
---|
466 | #endif |
---|
467 | #ifdef SPS_PTL_FIX |
---|
468 | if (pcSPS->getLayerId() == 0) |
---|
469 | { |
---|
470 | codePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); |
---|
471 | } |
---|
472 | #else |
---|
473 | codePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1); |
---|
474 | #endif |
---|
475 | WRITE_UVLC( pcSPS->getSPSId (), "sps_seq_parameter_set_id" ); |
---|
476 | #if REPN_FORMAT_IN_VPS |
---|
477 | if( pcSPS->getLayerId() > 0 ) |
---|
478 | { |
---|
479 | WRITE_FLAG( pcSPS->getUpdateRepFormatFlag(), "update_rep_format_flag" ); |
---|
480 | } |
---|
481 | #if O0096_REP_FORMAT_INDEX |
---|
482 | if( pcSPS->getLayerId() == 0 ) |
---|
483 | #else |
---|
484 | if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) |
---|
485 | #endif |
---|
486 | { |
---|
487 | #endif |
---|
488 | WRITE_UVLC( pcSPS->getChromaFormatIdc (), "chroma_format_idc" ); |
---|
489 | assert(pcSPS->getChromaFormatIdc () == 1); |
---|
490 | // in the first version chroma_format_idc can only be equal to 1 (4:2:0) |
---|
491 | if( pcSPS->getChromaFormatIdc () == 3 ) |
---|
492 | { |
---|
493 | WRITE_FLAG( 0, "separate_colour_plane_flag"); |
---|
494 | } |
---|
495 | |
---|
496 | WRITE_UVLC( pcSPS->getPicWidthInLumaSamples (), "pic_width_in_luma_samples" ); |
---|
497 | WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(), "pic_height_in_luma_samples" ); |
---|
498 | #if REPN_FORMAT_IN_VPS |
---|
499 | } |
---|
500 | #if O0096_REP_FORMAT_INDEX |
---|
501 | else if (pcSPS->getUpdateRepFormatFlag()) |
---|
502 | { |
---|
503 | WRITE_CODE( pcSPS->getUpdateRepFormatIndex(), 8, "update_rep_format_index"); |
---|
504 | } |
---|
505 | #endif |
---|
506 | #endif |
---|
507 | Window conf = pcSPS->getConformanceWindow(); |
---|
508 | |
---|
509 | WRITE_FLAG( conf.getWindowEnabledFlag(), "conformance_window_flag" ); |
---|
510 | if (conf.getWindowEnabledFlag()) |
---|
511 | { |
---|
512 | #if REPN_FORMAT_IN_VPS |
---|
513 | WRITE_UVLC( conf.getWindowLeftOffset(), "conf_win_left_offset" ); |
---|
514 | WRITE_UVLC( conf.getWindowRightOffset(), "conf_win_right_offset" ); |
---|
515 | WRITE_UVLC( conf.getWindowTopOffset(), "conf_win_top_offset" ); |
---|
516 | WRITE_UVLC( conf.getWindowBottomOffset(), "conf_win_bottom_offset" ); |
---|
517 | #else |
---|
518 | WRITE_UVLC( conf.getWindowLeftOffset() / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc() ), "conf_win_left_offset" ); |
---|
519 | WRITE_UVLC( conf.getWindowRightOffset() / TComSPS::getWinUnitX(pcSPS->getChromaFormatIdc() ), "conf_win_right_offset" ); |
---|
520 | WRITE_UVLC( conf.getWindowTopOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_top_offset" ); |
---|
521 | WRITE_UVLC( conf.getWindowBottomOffset() / TComSPS::getWinUnitY(pcSPS->getChromaFormatIdc() ), "conf_win_bottom_offset" ); |
---|
522 | #endif |
---|
523 | } |
---|
524 | |
---|
525 | #if REPN_FORMAT_IN_VPS |
---|
526 | #if O0096_REP_FORMAT_INDEX |
---|
527 | if( pcSPS->getLayerId() == 0 ) |
---|
528 | #else |
---|
529 | if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() ) |
---|
530 | #endif |
---|
531 | { |
---|
532 | assert( pcSPS->getBitDepthY() >= 8 ); |
---|
533 | assert( pcSPS->getBitDepthC() >= 8 ); |
---|
534 | #endif |
---|
535 | WRITE_UVLC( pcSPS->getBitDepthY() - 8, "bit_depth_luma_minus8" ); |
---|
536 | WRITE_UVLC( pcSPS->getBitDepthC() - 8, "bit_depth_chroma_minus8" ); |
---|
537 | #if REPN_FORMAT_IN_VPS |
---|
538 | } |
---|
539 | #endif |
---|
540 | WRITE_UVLC( pcSPS->getBitsForPOC()-4, "log2_max_pic_order_cnt_lsb_minus4" ); |
---|
541 | |
---|
542 | #if SPS_DPB_PARAMS |
---|
543 | if( pcSPS->getLayerId() == 0 ) |
---|
544 | { |
---|
545 | #endif |
---|
546 | const Bool subLayerOrderingInfoPresentFlag = 1; |
---|
547 | WRITE_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag"); |
---|
548 | for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++) |
---|
549 | { |
---|
550 | WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1, "sps_max_dec_pic_buffering_minus1[i]" ); |
---|
551 | WRITE_UVLC( pcSPS->getNumReorderPics(i), "sps_num_reorder_pics[i]" ); |
---|
552 | WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i), "sps_max_latency_increase_plus1[i]" ); |
---|
553 | if (!subLayerOrderingInfoPresentFlag) |
---|
554 | { |
---|
555 | break; |
---|
556 | } |
---|
557 | } |
---|
558 | #if SPS_DPB_PARAMS |
---|
559 | } |
---|
560 | #endif |
---|
561 | assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() ); |
---|
562 | |
---|
563 | WRITE_UVLC( pcSPS->getLog2MinCodingBlockSize() - 3, "log2_min_coding_block_size_minus3" ); |
---|
564 | WRITE_UVLC( pcSPS->getLog2DiffMaxMinCodingBlockSize(), "log2_diff_max_min_coding_block_size" ); |
---|
565 | WRITE_UVLC( pcSPS->getQuadtreeTULog2MinSize() - 2, "log2_min_transform_block_size_minus2" ); |
---|
566 | WRITE_UVLC( pcSPS->getQuadtreeTULog2MaxSize() - pcSPS->getQuadtreeTULog2MinSize(), "log2_diff_max_min_transform_block_size" ); |
---|
567 | WRITE_UVLC( pcSPS->getQuadtreeTUMaxDepthInter() - 1, "max_transform_hierarchy_depth_inter" ); |
---|
568 | WRITE_UVLC( pcSPS->getQuadtreeTUMaxDepthIntra() - 1, "max_transform_hierarchy_depth_intra" ); |
---|
569 | WRITE_FLAG( pcSPS->getScalingListFlag() ? 1 : 0, "scaling_list_enabled_flag" ); |
---|
570 | if(pcSPS->getScalingListFlag()) |
---|
571 | { |
---|
572 | #if SCALINGLIST_INFERRING |
---|
573 | if( pcSPS->getLayerId() > 0 ) |
---|
574 | { |
---|
575 | WRITE_FLAG( pcSPS->getInferScalingListFlag() ? 1 : 0, "sps_infer_scaling_list_flag" ); |
---|
576 | } |
---|
577 | |
---|
578 | if( pcSPS->getInferScalingListFlag() ) |
---|
579 | { |
---|
580 | // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive |
---|
581 | assert( pcSPS->getScalingListRefLayerId() <= 62 ); |
---|
582 | |
---|
583 | WRITE_UVLC( pcSPS->getScalingListRefLayerId(), "sps_scaling_list_ref_layer_id" ); |
---|
584 | } |
---|
585 | else |
---|
586 | { |
---|
587 | #endif |
---|
588 | WRITE_FLAG( pcSPS->getScalingListPresentFlag() ? 1 : 0, "sps_scaling_list_data_present_flag" ); |
---|
589 | if(pcSPS->getScalingListPresentFlag()) |
---|
590 | { |
---|
591 | codeScalingList( m_pcSlice->getScalingList() ); |
---|
592 | } |
---|
593 | #if SCALINGLIST_INFERRING |
---|
594 | } |
---|
595 | #endif |
---|
596 | } |
---|
597 | WRITE_FLAG( pcSPS->getUseAMP() ? 1 : 0, "amp_enabled_flag" ); |
---|
598 | WRITE_FLAG( pcSPS->getUseSAO() ? 1 : 0, "sample_adaptive_offset_enabled_flag"); |
---|
599 | |
---|
600 | WRITE_FLAG( pcSPS->getUsePCM() ? 1 : 0, "pcm_enabled_flag"); |
---|
601 | if( pcSPS->getUsePCM() ) |
---|
602 | { |
---|
603 | WRITE_CODE( pcSPS->getPCMBitDepthLuma() - 1, 4, "pcm_sample_bit_depth_luma_minus1" ); |
---|
604 | WRITE_CODE( pcSPS->getPCMBitDepthChroma() - 1, 4, "pcm_sample_bit_depth_chroma_minus1" ); |
---|
605 | WRITE_UVLC( pcSPS->getPCMLog2MinSize() - 3, "log2_min_pcm_luma_coding_block_size_minus3" ); |
---|
606 | WRITE_UVLC( pcSPS->getPCMLog2MaxSize() - pcSPS->getPCMLog2MinSize(), "log2_diff_max_min_pcm_luma_coding_block_size" ); |
---|
607 | WRITE_FLAG( pcSPS->getPCMFilterDisableFlag()?1 : 0, "pcm_loop_filter_disable_flag"); |
---|
608 | } |
---|
609 | |
---|
610 | assert( pcSPS->getMaxTLayers() > 0 ); |
---|
611 | |
---|
612 | TComRPSList* rpsList = pcSPS->getRPSList(); |
---|
613 | TComReferencePictureSet* rps; |
---|
614 | |
---|
615 | WRITE_UVLC(rpsList->getNumberOfReferencePictureSets(), "num_short_term_ref_pic_sets" ); |
---|
616 | for(Int i=0; i < rpsList->getNumberOfReferencePictureSets(); i++) |
---|
617 | { |
---|
618 | rps = rpsList->getReferencePictureSet(i); |
---|
619 | codeShortTermRefPicSet(pcSPS,rps,false, i); |
---|
620 | } |
---|
621 | WRITE_FLAG( pcSPS->getLongTermRefsPresent() ? 1 : 0, "long_term_ref_pics_present_flag" ); |
---|
622 | if (pcSPS->getLongTermRefsPresent()) |
---|
623 | { |
---|
624 | WRITE_UVLC(pcSPS->getNumLongTermRefPicSPS(), "num_long_term_ref_pic_sps" ); |
---|
625 | for (UInt k = 0; k < pcSPS->getNumLongTermRefPicSPS(); k++) |
---|
626 | { |
---|
627 | WRITE_CODE( pcSPS->getLtRefPicPocLsbSps(k), pcSPS->getBitsForPOC(), "lt_ref_pic_poc_lsb_sps"); |
---|
628 | WRITE_FLAG( pcSPS->getUsedByCurrPicLtSPSFlag(k), "used_by_curr_pic_lt_sps_flag"); |
---|
629 | } |
---|
630 | } |
---|
631 | WRITE_FLAG( pcSPS->getTMVPFlagsPresent() ? 1 : 0, "sps_temporal_mvp_enable_flag" ); |
---|
632 | |
---|
633 | WRITE_FLAG( pcSPS->getUseStrongIntraSmoothing(), "sps_strong_intra_smoothing_enable_flag" ); |
---|
634 | |
---|
635 | WRITE_FLAG( pcSPS->getVuiParametersPresentFlag(), "vui_parameters_present_flag" ); |
---|
636 | if (pcSPS->getVuiParametersPresentFlag()) |
---|
637 | { |
---|
638 | codeVUI(pcSPS->getVuiParameters(), pcSPS); |
---|
639 | } |
---|
640 | |
---|
641 | #if SVC_EXTENSION |
---|
642 | WRITE_FLAG( pcSPS->getExtensionFlag() ? 1 : 0, "sps_extension_flag" ); |
---|
643 | |
---|
644 | if( pcSPS->getExtensionFlag() ) |
---|
645 | { |
---|
646 | #if O0142_CONDITIONAL_SPS_EXTENSION |
---|
647 | UInt spsExtensionTypeFlag[8] = { 0, 1, 0, 0, 0, 0, 0, 0 }; |
---|
648 | for (UInt i = 0; i < 8; i++) |
---|
649 | { |
---|
650 | WRITE_FLAG( spsExtensionTypeFlag[i], "sps_extension_type_flag" ); |
---|
651 | } |
---|
652 | if (spsExtensionTypeFlag[1]) |
---|
653 | { |
---|
654 | codeSPSExtension( pcSPS ); |
---|
655 | } |
---|
656 | #else |
---|
657 | codeSPSExtension( pcSPS ); |
---|
658 | WRITE_FLAG( 0, "sps_extension2_flag" ); |
---|
659 | #endif |
---|
660 | } |
---|
661 | #else |
---|
662 | WRITE_FLAG( 0, "sps_extension_flag" ); |
---|
663 | #endif |
---|
664 | } |
---|
665 | |
---|
666 | #if SVC_EXTENSION |
---|
667 | Void TEncCavlc::codeSPSExtension( TComSPS* pcSPS ) |
---|
668 | { |
---|
669 | // more syntax elements to be written here |
---|
670 | |
---|
671 | // Vertical MV component restriction is not used in SHVC CTC |
---|
672 | WRITE_FLAG( 0, "inter_view_mv_vert_constraint_flag" ); |
---|
673 | |
---|
674 | if( pcSPS->getLayerId() > 0 ) |
---|
675 | { |
---|
676 | WRITE_UVLC( pcSPS->getNumScaledRefLayerOffsets(), "num_scaled_ref_layer_offsets" ); |
---|
677 | for(Int i = 0; i < pcSPS->getNumScaledRefLayerOffsets(); i++) |
---|
678 | { |
---|
679 | Window scaledWindow = pcSPS->getScaledRefLayerWindow(i); |
---|
680 | #if O0098_SCALED_REF_LAYER_ID |
---|
681 | WRITE_CODE( pcSPS->getScaledRefLayerId(i), 6, "scaled_ref_layer_id" ); |
---|
682 | #endif |
---|
683 | WRITE_SVLC( scaledWindow.getWindowLeftOffset() >> 1, "scaled_ref_layer_left_offset" ); |
---|
684 | WRITE_SVLC( scaledWindow.getWindowTopOffset() >> 1, "scaled_ref_layer_top_offset" ); |
---|
685 | WRITE_SVLC( scaledWindow.getWindowRightOffset() >> 1, "scaled_ref_layer_right_offset" ); |
---|
686 | WRITE_SVLC( scaledWindow.getWindowBottomOffset() >> 1, "scaled_ref_layer_bottom_offset" ); |
---|
687 | #if P0312_VERT_PHASE_ADJ |
---|
688 | WRITE_FLAG( scaledWindow.getVertPhasePositionEnableFlag(), "vert_phase_position_enable_flag" ); |
---|
689 | #endif |
---|
690 | } |
---|
691 | } |
---|
692 | } |
---|
693 | #endif //SVC_EXTENSION |
---|
694 | |
---|
695 | Void TEncCavlc::codeVPS( TComVPS* pcVPS ) |
---|
696 | { |
---|
697 | #if !P0125_REVERT_VPS_EXTN_OFFSET_TO_RESERVED |
---|
698 | #if VPS_EXTN_OFFSET_CALC |
---|
699 | UInt numBytesInVps = this->m_pcBitIf->getNumberOfWrittenBits(); |
---|
700 | #endif |
---|
701 | #endif |
---|
702 | #if !P0307_REMOVE_VPS_VUI_OFFSET |
---|
703 | #if VPS_VUI_OFFSET |
---|
704 | m_vpsVuiCounter = this->m_pcBitIf->getNumberOfWrittenBits(); |
---|
705 | #endif |
---|
706 | #endif |
---|
707 | WRITE_CODE( pcVPS->getVPSId(), 4, "vps_video_parameter_set_id" ); |
---|
708 | #if VPS_RESERVED_FLAGS |
---|
709 | WRITE_FLAG( pcVPS->getBaseLayerInternalFlag(), "vps_base_layer_internal_flag"); |
---|
710 | WRITE_FLAG( pcVPS->getBaseLayerAvailableFlag(), "vps_base_layer_available_flag"); |
---|
711 | #else |
---|
712 | WRITE_CODE( 3, 2, "vps_reserved_three_2bits" ); |
---|
713 | #endif |
---|
714 | #if SVC_EXTENSION |
---|
715 | WRITE_CODE( pcVPS->getMaxLayers() - 1, 6, "vps_max_layers_minus1" ); |
---|
716 | #else |
---|
717 | WRITE_CODE( 0, 6, "vps_reserved_zero_6bits" ); |
---|
718 | #endif |
---|
719 | WRITE_CODE( pcVPS->getMaxTLayers() - 1, 3, "vps_max_sub_layers_minus1" ); |
---|
720 | WRITE_FLAG( pcVPS->getTemporalNestingFlag(), "vps_temporal_id_nesting_flag" ); |
---|
721 | assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag()); |
---|
722 | #if !P0125_REVERT_VPS_EXTN_OFFSET_TO_RESERVED |
---|
723 | #if VPS_EXTN_OFFSET |
---|
724 | WRITE_CODE( pcVPS->getExtensionOffset(), 16, "vps_extension_offset" ); |
---|
725 | #else |
---|
726 | WRITE_CODE( 0xffff, 16, "vps_reserved_ffff_16bits" ); |
---|
727 | #endif |
---|
728 | #else |
---|
729 | WRITE_CODE( 0xffff, 16, "vps_reserved_ffff_16bits" ); |
---|
730 | #endif |
---|
731 | codePTL( pcVPS->getPTL(), true, pcVPS->getMaxTLayers() - 1 ); |
---|
732 | const Bool subLayerOrderingInfoPresentFlag = 1; |
---|
733 | WRITE_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag"); |
---|
734 | for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++) |
---|
735 | { |
---|
736 | WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1, "vps_max_dec_pic_buffering_minus1[i]" ); |
---|
737 | WRITE_UVLC( pcVPS->getNumReorderPics(i), "vps_num_reorder_pics[i]" ); |
---|
738 | WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i), "vps_max_latency_increase_plus1[i]" ); |
---|
739 | if (!subLayerOrderingInfoPresentFlag) |
---|
740 | { |
---|
741 | break; |
---|
742 | } |
---|
743 | } |
---|
744 | |
---|
745 | #if SVC_EXTENSION |
---|
746 | assert( pcVPS->getNumHrdParameters() <= MAX_VPS_LAYER_SETS_PLUS1 ); |
---|
747 | assert( pcVPS->getMaxLayerId() < MAX_VPS_LAYER_ID_PLUS1 ); |
---|
748 | #if !VPS_EXTN_OP_LAYER_SETS // num layer sets set in TAppEncTop.cpp |
---|
749 | pcVPS->setNumLayerSets(1); |
---|
750 | #endif |
---|
751 | WRITE_CODE( pcVPS->getMaxLayerId(), 6, "vps_max_layer_id" ); |
---|
752 | #if Q0078_ADD_LAYER_SETS |
---|
753 | WRITE_UVLC(pcVPS->getVpsNumLayerSetsMinus1(), "vps_num_layer_sets_minus1"); |
---|
754 | for (UInt opsIdx = 1; opsIdx <= pcVPS->getVpsNumLayerSetsMinus1(); opsIdx++) |
---|
755 | #else |
---|
756 | WRITE_UVLC( pcVPS->getNumLayerSets() - 1, "vps_num_layer_sets_minus1" ); |
---|
757 | for (UInt opsIdx = 1; opsIdx <= (pcVPS->getNumLayerSets() - 1); opsIdx++) |
---|
758 | #endif |
---|
759 | { |
---|
760 | // Operation point set |
---|
761 | for( UInt i = 0; i <= pcVPS->getMaxLayerId(); i ++ ) |
---|
762 | #else |
---|
763 | assert( pcVPS->getNumHrdParameters() <= MAX_VPS_NUM_HRD_PARAMETERS ); |
---|
764 | assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 ); |
---|
765 | WRITE_CODE( pcVPS->getMaxNuhReservedZeroLayerId(), 6, "vps_max_nuh_reserved_zero_layer_id" ); |
---|
766 | pcVPS->setMaxOpSets(1); |
---|
767 | WRITE_UVLC( pcVPS->getMaxOpSets() - 1, "vps_max_op_sets_minus1" ); |
---|
768 | for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getMaxOpSets() - 1 ); opsIdx ++ ) |
---|
769 | { |
---|
770 | // Operation point set |
---|
771 | for( UInt i = 0; i <= pcVPS->getMaxNuhReservedZeroLayerId(); i ++ ) |
---|
772 | #endif |
---|
773 | { |
---|
774 | #if !VPS_EXTN_OP_LAYER_SETS // layer Id include flag set in TAppEncTop.cpp |
---|
775 | // Only applicable for version 1 |
---|
776 | pcVPS->setLayerIdIncludedFlag( true, opsIdx, i ); |
---|
777 | #endif |
---|
778 | WRITE_FLAG( pcVPS->getLayerIdIncludedFlag( opsIdx, i ) ? 1 : 0, "layer_id_included_flag[opsIdx][i]" ); |
---|
779 | } |
---|
780 | } |
---|
781 | #if DERIVE_LAYER_ID_LIST_VARIABLES |
---|
782 | pcVPS->deriveLayerIdListVariables(); |
---|
783 | #endif |
---|
784 | TimingInfo *timingInfo = pcVPS->getTimingInfo(); |
---|
785 | WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(), "vps_timing_info_present_flag"); |
---|
786 | if(timingInfo->getTimingInfoPresentFlag()) |
---|
787 | { |
---|
788 | WRITE_CODE(timingInfo->getNumUnitsInTick(), 32, "vps_num_units_in_tick"); |
---|
789 | WRITE_CODE(timingInfo->getTimeScale(), 32, "vps_time_scale"); |
---|
790 | WRITE_FLAG(timingInfo->getPocProportionalToTimingFlag(), "vps_poc_proportional_to_timing_flag"); |
---|
791 | if(timingInfo->getPocProportionalToTimingFlag()) |
---|
792 | { |
---|
793 | WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(), "vps_num_ticks_poc_diff_one_minus1"); |
---|
794 | } |
---|
795 | pcVPS->setNumHrdParameters( 0 ); |
---|
796 | WRITE_UVLC( pcVPS->getNumHrdParameters(), "vps_num_hrd_parameters" ); |
---|
797 | |
---|
798 | if( pcVPS->getNumHrdParameters() > 0 ) |
---|
799 | { |
---|
800 | pcVPS->createHrdParamBuffer(); |
---|
801 | } |
---|
802 | for( UInt i = 0; i < pcVPS->getNumHrdParameters(); i ++ ) |
---|
803 | { |
---|
804 | // Only applicable for version 1 |
---|
805 | pcVPS->setHrdOpSetIdx( 0, i ); |
---|
806 | WRITE_UVLC( pcVPS->getHrdOpSetIdx( i ), "hrd_op_set_idx" ); |
---|
807 | if( i > 0 ) |
---|
808 | { |
---|
809 | WRITE_FLAG( pcVPS->getCprmsPresentFlag( i ) ? 1 : 0, "cprms_present_flag[i]" ); |
---|
810 | } |
---|
811 | codeHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1); |
---|
812 | } |
---|
813 | } |
---|
814 | #if SVC_EXTENSION |
---|
815 | // When MaxLayersMinus1 is greater than 0, vps_extension_flag shall be equal to 1. |
---|
816 | if( pcVPS->getMaxLayers() > 1 ) |
---|
817 | { |
---|
818 | assert( pcVPS->getVpsExtensionFlag() == true ); |
---|
819 | } |
---|
820 | |
---|
821 | WRITE_FLAG( pcVPS->getVpsExtensionFlag() ? 1 : 0, "vps_extension_flag" ); |
---|
822 | |
---|
823 | if( pcVPS->getVpsExtensionFlag() ) |
---|
824 | { |
---|
825 | while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 ) |
---|
826 | { |
---|
827 | WRITE_FLAG(1, "vps_extension_alignment_bit_equal_to_one"); |
---|
828 | } |
---|
829 | #if !P0125_REVERT_VPS_EXTN_OFFSET_TO_RESERVED |
---|
830 | #if VPS_EXTN_OFFSET_CALC |
---|
831 | Int vpsExntOffsetValueInBits = this->m_pcBitIf->getNumberOfWrittenBits() - numBytesInVps + 16; // 2 bytes for NUH |
---|
832 | assert( vpsExntOffsetValueInBits % 8 == 0 ); |
---|
833 | pcVPS->setExtensionOffset( vpsExntOffsetValueInBits >> 3 ); |
---|
834 | #endif |
---|
835 | #endif |
---|
836 | codeVPSExtension(pcVPS); |
---|
837 | WRITE_FLAG( 0, "vps_extension2_flag" ); // Flag value of 1 reserved |
---|
838 | } |
---|
839 | #else |
---|
840 | WRITE_FLAG( 0, "vps_extension_flag" ); |
---|
841 | #endif |
---|
842 | //future extensions here.. |
---|
843 | |
---|
844 | return; |
---|
845 | } |
---|
846 | |
---|
847 | #if SVC_EXTENSION |
---|
848 | Void TEncCavlc::codeVPSExtension (TComVPS *vps) |
---|
849 | { |
---|
850 | // ... More syntax elements to be written here |
---|
851 | #if P0300_ALT_OUTPUT_LAYER_FLAG |
---|
852 | Int NumOutputLayersInOutputLayerSet[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
853 | Int OlsHighestOutputLayerId[MAX_VPS_LAYER_SETS_PLUS1]; |
---|
854 | #endif |
---|
855 | #if VPS_EXTN_MASK_AND_DIM_INFO |
---|
856 | UInt i = 0, j = 0; |
---|
857 | |
---|
858 | WRITE_FLAG( vps->getAvcBaseLayerFlag(), "avc_base_layer_flag" ); |
---|
859 | #if !P0307_REMOVE_VPS_VUI_OFFSET |
---|
860 | #if O0109_MOVE_VPS_VUI_FLAG |
---|
861 | WRITE_FLAG( 1, "vps_vui_present_flag" ); |
---|
862 | vps->setVpsVuiPresentFlag(true); |
---|
863 | if ( vps->getVpsVuiPresentFlag() ) |
---|
864 | { |
---|
865 | #if VPS_VUI_OFFSET |
---|
866 | WRITE_CODE( vps->getVpsVuiOffset( ), 16, "vps_vui_offset" ); |
---|
867 | #endif |
---|
868 | WRITE_FLAG( vps->getSplittingFlag(), "splitting_flag" ); |
---|
869 | } |
---|
870 | #else |
---|
871 | #if VPS_VUI_OFFSET |
---|
872 | WRITE_CODE( vps->getVpsVuiOffset( ), 16, "vps_vui_offset" ); |
---|
873 | #endif |
---|
874 | WRITE_FLAG( vps->getSplittingFlag(), "splitting_flag" ); |
---|
875 | #endif // O0109_MOVE_VPS_VUI_FLAG |
---|
876 | #endif |
---|
877 | WRITE_FLAG( vps->getSplittingFlag(), "splitting_flag" ); |
---|
878 | |
---|
879 | for(i = 0; i < MAX_VPS_NUM_SCALABILITY_TYPES; i++) |
---|
880 | { |
---|
881 | WRITE_FLAG( vps->getScalabilityMask(i), "scalability_mask[i]" ); |
---|
882 | } |
---|
883 | |
---|
884 | for(j = 0; j < vps->getNumScalabilityTypes() - vps->getSplittingFlag(); j++) |
---|
885 | { |
---|
886 | WRITE_CODE( vps->getDimensionIdLen(j) - 1, 3, "dimension_id_len_minus1[j]" ); |
---|
887 | } |
---|
888 | |
---|
889 | // The value of dimBitOffset[ NumScalabilityTypes ] is set equal to 6. |
---|
890 | if(vps->getSplittingFlag()) |
---|
891 | { |
---|
892 | UInt splDimSum=0; |
---|
893 | for(j = 0; j < vps->getNumScalabilityTypes(); j++) |
---|
894 | { |
---|
895 | splDimSum+=(vps->getDimensionIdLen(j)); |
---|
896 | } |
---|
897 | assert(splDimSum<=6); |
---|
898 | } |
---|
899 | |
---|
900 | WRITE_FLAG( vps->getNuhLayerIdPresentFlag(), "vps_nuh_layer_id_present_flag" ); |
---|
901 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
902 | { |
---|
903 | if( vps->getNuhLayerIdPresentFlag() ) |
---|
904 | { |
---|
905 | WRITE_CODE( vps->getLayerIdInNuh(i), 6, "layer_id_in_nuh[i]" ); |
---|
906 | } |
---|
907 | |
---|
908 | if( !vps->getSplittingFlag() ) |
---|
909 | { |
---|
910 | for(j = 0; j < vps->getNumScalabilityTypes(); j++) |
---|
911 | { |
---|
912 | UInt bits = vps->getDimensionIdLen(j); |
---|
913 | WRITE_CODE( vps->getDimensionId(i, j), bits, "dimension_id[i][j]" ); |
---|
914 | } |
---|
915 | } |
---|
916 | } |
---|
917 | #endif |
---|
918 | #if VIEW_ID_RELATED_SIGNALING |
---|
919 | // if ( pcVPS->getNumViews() > 1 ) |
---|
920 | // However, this is a bug in the text since, view_id_len_minus1 is needed to parse view_id_val. |
---|
921 | { |
---|
922 | #if O0109_VIEW_ID_LEN |
---|
923 | WRITE_CODE( vps->getViewIdLen( ), 4, "view_id_len" ); |
---|
924 | assert ( vps->getNumViews() >= (1<<vps->getViewIdLen()) ); |
---|
925 | #else |
---|
926 | WRITE_CODE( vps->getViewIdLenMinus1( ), 4, "view_id_len_minus1" ); |
---|
927 | #endif |
---|
928 | } |
---|
929 | |
---|
930 | #if O0109_VIEW_ID_LEN |
---|
931 | if ( vps->getViewIdLen() > 0 ) |
---|
932 | { |
---|
933 | #endif |
---|
934 | for( i = 0; i < vps->getNumViews(); i++ ) |
---|
935 | { |
---|
936 | #if O0109_VIEW_ID_LEN |
---|
937 | WRITE_CODE( vps->getViewIdVal( i ), vps->getViewIdLen( ), "view_id_val[i]" ); |
---|
938 | #else |
---|
939 | WRITE_CODE( vps->getViewIdVal( i ), vps->getViewIdLenMinus1( ) + 1, "view_id_val[i]" ); |
---|
940 | #endif |
---|
941 | } |
---|
942 | #if O0109_VIEW_ID_LEN |
---|
943 | } |
---|
944 | #endif |
---|
945 | #endif // VIEW_ID_RELATED_SIGNALING |
---|
946 | |
---|
947 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
948 | for( Int layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++) |
---|
949 | { |
---|
950 | for( Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++) |
---|
951 | { |
---|
952 | WRITE_FLAG(vps->getDirectDependencyFlag(layerCtr, refLayerCtr), "direct_dependency_flag[i][j]" ); |
---|
953 | } |
---|
954 | } |
---|
955 | #endif |
---|
956 | #if VPS_TSLAYERS |
---|
957 | WRITE_FLAG( vps->getMaxTSLayersPresentFlag(), "vps_sub_layers_max_minus1_present_flag"); |
---|
958 | if (vps->getMaxTSLayersPresentFlag()) |
---|
959 | { |
---|
960 | for( i = 0; i < vps->getMaxLayers(); i++) |
---|
961 | { |
---|
962 | WRITE_CODE(vps->getMaxTSLayersMinus1(i), 3, "sub_layers_vps_max_minus1[i]" ); |
---|
963 | } |
---|
964 | } |
---|
965 | #endif |
---|
966 | WRITE_FLAG( vps->getMaxTidRefPresentFlag(), "max_tid_ref_present_flag"); |
---|
967 | if (vps->getMaxTidRefPresentFlag()) |
---|
968 | { |
---|
969 | for( i = 0; i < vps->getMaxLayers() - 1; i++) |
---|
970 | { |
---|
971 | #if O0225_MAX_TID_FOR_REF_LAYERS |
---|
972 | for( j = i+1; j <= vps->getMaxLayers() - 1; j++) |
---|
973 | { |
---|
974 | if(vps->getDirectDependencyFlag(j, i)) |
---|
975 | { |
---|
976 | WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i,j), 3, "max_tid_il_ref_pics_plus1[i][j]" ); |
---|
977 | } |
---|
978 | } |
---|
979 | #else |
---|
980 | WRITE_CODE(vps->getMaxTidIlRefPicsPlus1(i), 3, "max_tid_il_ref_pics_plus1[i]" ); |
---|
981 | #endif |
---|
982 | } |
---|
983 | } |
---|
984 | WRITE_FLAG( vps->getIlpSshSignalingEnabledFlag(), "all_ref_layers_active_flag" ); |
---|
985 | #if VPS_EXTN_PROFILE_INFO |
---|
986 | // Profile-tier-level signalling |
---|
987 | #if !VPS_EXTN_UEV_CODING |
---|
988 | WRITE_CODE( vps->getNumLayerSets() - 1 , 10, "vps_number_layer_sets_minus1" ); |
---|
989 | WRITE_CODE( vps->getNumProfileTierLevel() - 1, 6, "vps_num_profile_tier_level_minus1"); |
---|
990 | #else |
---|
991 | WRITE_UVLC( vps->getNumProfileTierLevel() - 1, "vps_num_profile_tier_level_minus1"); |
---|
992 | #endif |
---|
993 | for(Int idx = 1; idx <= vps->getNumProfileTierLevel() - 1; idx++) |
---|
994 | { |
---|
995 | WRITE_FLAG( vps->getProfilePresentFlag(idx), "vps_profile_present_flag[i]" ); |
---|
996 | #if !P0048_REMOVE_PROFILE_REF |
---|
997 | if( !vps->getProfilePresentFlag(idx) ) |
---|
998 | { |
---|
999 | WRITE_CODE( vps->getProfileLayerSetRef(idx) - 1, 6, "profile_ref_minus1[i]" ); |
---|
1000 | } |
---|
1001 | #endif |
---|
1002 | codePTL( vps->getPTLForExtn(idx), vps->getProfilePresentFlag(idx), vps->getMaxTLayers() - 1 ); |
---|
1003 | } |
---|
1004 | #endif |
---|
1005 | |
---|
1006 | #if Q0078_ADD_LAYER_SETS |
---|
1007 | if (vps->getNumIndependentLayers() > 1) |
---|
1008 | { |
---|
1009 | WRITE_UVLC( vps->getNumAddLayerSets(), "num_add_layer_sets" ); |
---|
1010 | for (i = 0; i < vps->getNumAddLayerSets(); i++) |
---|
1011 | { |
---|
1012 | for (j = 1; j < vps->getNumIndependentLayers(); j++) |
---|
1013 | { |
---|
1014 | int len = 1; |
---|
1015 | while ((1 << len) < (vps->getNumLayersInTreePartition(j) + 1)) |
---|
1016 | { |
---|
1017 | len++; |
---|
1018 | } |
---|
1019 | WRITE_CODE(vps->getHighestLayerIdxPlus1(i, j), len, "highest_layer_idx_plus1[i][j]"); |
---|
1020 | } |
---|
1021 | } |
---|
1022 | } |
---|
1023 | #endif |
---|
1024 | |
---|
1025 | #if !VPS_EXTN_UEV_CODING |
---|
1026 | Int numOutputLayerSets = vps->getNumOutputLayerSets() ; |
---|
1027 | WRITE_FLAG( (numOutputLayerSets > vps->getNumLayerSets()), "more_output_layer_sets_than_default_flag" ); |
---|
1028 | if(numOutputLayerSets > vps->getNumLayerSets()) |
---|
1029 | { |
---|
1030 | WRITE_CODE( numOutputLayerSets - vps->getNumLayerSets(), 10, "num_add_output_layer_sets" ); |
---|
1031 | } |
---|
1032 | #else |
---|
1033 | Int numOutputLayerSets = vps->getNumOutputLayerSets(); |
---|
1034 | Int numAddOutputLayerSets = numOutputLayerSets - (Int)vps->getNumLayerSets(); |
---|
1035 | |
---|
1036 | // The value of num_add_olss shall be in the range of 0 to 1023, inclusive. |
---|
1037 | assert( numAddOutputLayerSets >= 0 && numAddOutputLayerSets < 1024 ); |
---|
1038 | |
---|
1039 | #if Q0165_NUM_ADD_OUTPUT_LAYER_SETS |
---|
1040 | if( vps->getNumLayerSets() > 1 ) |
---|
1041 | { |
---|
1042 | WRITE_UVLC( numAddOutputLayerSets, "num_add_olss" ); |
---|
1043 | WRITE_CODE( vps->getDefaultTargetOutputLayerIdc(), 2, "default_output_layer_idc" ); |
---|
1044 | } |
---|
1045 | #else |
---|
1046 | WRITE_UVLC( numOutputLayerSets - vps->getNumLayerSets(), "num_add_output_layer_sets" ); |
---|
1047 | #endif |
---|
1048 | #endif |
---|
1049 | |
---|
1050 | #if !Q0165_NUM_ADD_OUTPUT_LAYER_SETS |
---|
1051 | if( numOutputLayerSets > 1 ) |
---|
1052 | { |
---|
1053 | #if P0295_DEFAULT_OUT_LAYER_IDC |
---|
1054 | WRITE_CODE( vps->getDefaultTargetOutputLayerIdc(), 2, "default_target_output_layer_idc" ); |
---|
1055 | #else |
---|
1056 | #if O0109_DEFAULT_ONE_OUT_LAYER_IDC |
---|
1057 | WRITE_CODE( vps->getDefaultOneTargetOutputLayerIdc(), 2, "default_one_target_output_layer_idc" ); |
---|
1058 | #else |
---|
1059 | WRITE_FLAG( vps->getDefaultOneTargetOutputLayerFlag(), "default_one_target_output_layer_flag" ); |
---|
1060 | #endif |
---|
1061 | #endif |
---|
1062 | } |
---|
1063 | #endif |
---|
1064 | |
---|
1065 | for(i = 1; i < numOutputLayerSets; i++) |
---|
1066 | { |
---|
1067 | if( i > (vps->getNumLayerSets() - 1) ) |
---|
1068 | { |
---|
1069 | Int numBits = 1; |
---|
1070 | while ((1 << numBits) < (vps->getNumLayerSets() - 1)) |
---|
1071 | { |
---|
1072 | numBits++; |
---|
1073 | } |
---|
1074 | WRITE_CODE( vps->getOutputLayerSetIdx(i) - 1, numBits, "layer_set_idx_for_ols_minus1"); |
---|
1075 | #if P0295_DEFAULT_OUT_LAYER_IDC |
---|
1076 | } |
---|
1077 | #if Q0078_ADD_LAYER_SETS |
---|
1078 | if ( i > vps->getVpsNumLayerSetsMinus1() || vps->getDefaultTargetOutputLayerIdc() >= 2 ) //Instead of == 2, >= 2 is used to follow the agreement that value 3 should be interpreted as 2 |
---|
1079 | #else |
---|
1080 | if ( i > (vps->getNumLayerSets() - 1) || vps->getDefaultTargetOutputLayerIdc() >= 2 ) //Instead of == 2, >= 2 is used to follow the agreement that value 3 should be interpreted as 2 |
---|
1081 | #endif |
---|
1082 | { |
---|
1083 | #endif |
---|
1084 | Int lsIdx = vps->getOutputLayerSetIdx(i); |
---|
1085 | #if NUM_OL_FLAGS |
---|
1086 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx) ; j++) |
---|
1087 | #else |
---|
1088 | for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++) |
---|
1089 | #endif |
---|
1090 | { |
---|
1091 | WRITE_FLAG( vps->getOutputLayerFlag(i,j), "output_layer_flag[i][j]"); |
---|
1092 | } |
---|
1093 | } |
---|
1094 | Int numBits = 1; |
---|
1095 | while ((1 << numBits) < (vps->getNumProfileTierLevel())) |
---|
1096 | { |
---|
1097 | numBits++; |
---|
1098 | } |
---|
1099 | WRITE_CODE( vps->getProfileLevelTierIdx(i), numBits, "profile_level_tier_idx[i]" ); |
---|
1100 | #if P0300_ALT_OUTPUT_LAYER_FLAG |
---|
1101 | NumOutputLayersInOutputLayerSet[i] = 0; |
---|
1102 | Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx(i); |
---|
1103 | for (j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++) |
---|
1104 | { |
---|
1105 | NumOutputLayersInOutputLayerSet[i] += vps->getOutputLayerFlag(i, j); |
---|
1106 | if (vps->getOutputLayerFlag(i, j)) |
---|
1107 | { |
---|
1108 | OlsHighestOutputLayerId[i] = vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j); |
---|
1109 | } |
---|
1110 | } |
---|
1111 | if (NumOutputLayersInOutputLayerSet[i] == 1 && vps->getNumDirectRefLayers(OlsHighestOutputLayerId[i]) > 0) |
---|
1112 | { |
---|
1113 | WRITE_FLAG(vps->getAltOuputLayerFlag(i), "alt_output_layer_flag[i]"); |
---|
1114 | } |
---|
1115 | |
---|
1116 | #if Q0165_OUTPUT_LAYER_SET |
---|
1117 | assert( NumOutputLayersInOutputLayerSet[i]>0 ); |
---|
1118 | #endif |
---|
1119 | |
---|
1120 | #endif |
---|
1121 | } |
---|
1122 | |
---|
1123 | #if !P0300_ALT_OUTPUT_LAYER_FLAG |
---|
1124 | #if O0153_ALT_OUTPUT_LAYER_FLAG |
---|
1125 | if( vps->getMaxLayers() > 1 ) |
---|
1126 | { |
---|
1127 | WRITE_FLAG( vps->getAltOuputLayerFlag(), "alt_output_layer_flag" ); |
---|
1128 | } |
---|
1129 | #endif |
---|
1130 | #endif |
---|
1131 | |
---|
1132 | #if REPN_FORMAT_IN_VPS |
---|
1133 | #if Q0195_REP_FORMAT_CLEANUP |
---|
1134 | // The value of vps_num_rep_formats_minus1 shall be in the range of 0 to 255, inclusive. |
---|
1135 | assert( vps->getVpsNumRepFormats() > 0 && vps->getVpsNumRepFormats() <= 256 ); |
---|
1136 | |
---|
1137 | WRITE_UVLC( vps->getVpsNumRepFormats() - 1, "vps_num_rep_formats_minus1" ); |
---|
1138 | |
---|
1139 | for(i = 0; i < vps->getVpsNumRepFormats(); i++) |
---|
1140 | { |
---|
1141 | // Write rep_format_structures |
---|
1142 | codeRepFormat( vps->getVpsRepFormat(i) ); |
---|
1143 | } |
---|
1144 | |
---|
1145 | if( vps->getVpsNumRepFormats() > 1 ) |
---|
1146 | { |
---|
1147 | WRITE_FLAG( vps->getRepFormatIdxPresentFlag(), "rep_format_idx_present_flag"); |
---|
1148 | } |
---|
1149 | else |
---|
1150 | { |
---|
1151 | // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0 |
---|
1152 | assert( !vps->getRepFormatIdxPresentFlag() ); |
---|
1153 | } |
---|
1154 | |
---|
1155 | if( vps->getRepFormatIdxPresentFlag() ) |
---|
1156 | { |
---|
1157 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
1158 | { |
---|
1159 | Int numBits = 1; |
---|
1160 | while ((1 << numBits) < (vps->getVpsNumRepFormats())) |
---|
1161 | { |
---|
1162 | numBits++; |
---|
1163 | } |
---|
1164 | WRITE_CODE( vps->getVpsRepFormatIdx(i), numBits, "vps_rep_format_idx[i]" ); |
---|
1165 | } |
---|
1166 | } |
---|
1167 | #else |
---|
1168 | WRITE_FLAG( vps->getRepFormatIdxPresentFlag(), "rep_format_idx_present_flag"); |
---|
1169 | |
---|
1170 | if( vps->getRepFormatIdxPresentFlag() ) |
---|
1171 | { |
---|
1172 | // The value of vps_num_rep_formats_minus1 shall be in the range of 0 to 255, inclusive. |
---|
1173 | assert( vps->getVpsNumRepFormats() > 0 && vps->getVpsNumRepFormats() <= 256 ); |
---|
1174 | |
---|
1175 | #if O0096_REP_FORMAT_INDEX |
---|
1176 | #if !VPS_EXTN_UEV_CODING |
---|
1177 | WRITE_CODE( vps->getVpsNumRepFormats() - 1, 8, "vps_num_rep_formats_minus1" ); |
---|
1178 | #else |
---|
1179 | WRITE_UVLC( vps->getVpsNumRepFormats() - 1, "vps_num_rep_formats_minus1" ); |
---|
1180 | #endif |
---|
1181 | #else |
---|
1182 | WRITE_CODE( vps->getVpsNumRepFormats() - 1, 4, "vps_num_rep_formats_minus1" ); |
---|
1183 | #endif |
---|
1184 | } |
---|
1185 | for(i = 0; i < vps->getVpsNumRepFormats(); i++) |
---|
1186 | { |
---|
1187 | // Read rep_format_structures |
---|
1188 | codeRepFormat( vps->getVpsRepFormat(i) ); |
---|
1189 | } |
---|
1190 | |
---|
1191 | if( vps->getRepFormatIdxPresentFlag() ) |
---|
1192 | { |
---|
1193 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
1194 | { |
---|
1195 | if( vps->getVpsNumRepFormats() > 1 ) |
---|
1196 | { |
---|
1197 | #if O0096_REP_FORMAT_INDEX |
---|
1198 | #if !VPS_EXTN_UEV_CODING |
---|
1199 | WRITE_CODE( vps->getVpsRepFormatIdx(i), 8, "vps_rep_format_idx[i]" ); |
---|
1200 | #else |
---|
1201 | Int numBits = 1; |
---|
1202 | while ((1 << numBits) < (vps->getVpsNumRepFormats())) |
---|
1203 | { |
---|
1204 | numBits++; |
---|
1205 | } |
---|
1206 | WRITE_CODE( vps->getVpsRepFormatIdx(i), numBits, "vps_rep_format_idx[i]" ); |
---|
1207 | #endif |
---|
1208 | #else |
---|
1209 | WRITE_CODE( vps->getVpsRepFormatIdx(i), 4, "vps_rep_format_idx[i]" ); |
---|
1210 | #endif |
---|
1211 | } |
---|
1212 | } |
---|
1213 | } |
---|
1214 | #endif |
---|
1215 | #endif |
---|
1216 | |
---|
1217 | WRITE_FLAG(vps->getMaxOneActiveRefLayerFlag(), "max_one_active_ref_layer_flag"); |
---|
1218 | #if O0062_POC_LSB_NOT_PRESENT_FLAG |
---|
1219 | for(i = 1; i< vps->getMaxLayers(); i++) |
---|
1220 | { |
---|
1221 | if( vps->getNumDirectRefLayers( vps->getLayerIdInNuh(i) ) == 0 ) |
---|
1222 | { |
---|
1223 | WRITE_FLAG(vps->getPocLsbNotPresentFlag(i), "poc_lsb_not_present_flag[i]"); |
---|
1224 | } |
---|
1225 | } |
---|
1226 | #endif |
---|
1227 | #if O0215_PHASE_ALIGNMENT |
---|
1228 | WRITE_FLAG(vps->getPhaseAlignFlag(), "cross_layer_phase_alignment_flag" ); |
---|
1229 | #endif |
---|
1230 | #if !IRAP_ALIGN_FLAG_IN_VPS_VUI |
---|
1231 | WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag"); |
---|
1232 | #endif |
---|
1233 | #if VPS_DPB_SIZE_TABLE |
---|
1234 | codeVpsDpbSizeTable(vps); |
---|
1235 | #endif |
---|
1236 | #if VPS_EXTN_DIRECT_REF_LAYERS |
---|
1237 | WRITE_UVLC( vps->getDirectDepTypeLen()-2, "direct_dep_type_len_minus2"); |
---|
1238 | #if O0096_DEFAULT_DEPENDENCY_TYPE |
---|
1239 | WRITE_FLAG(vps->getDefaultDirectDependencyTypeFlag(), "default_direct_dependency_flag"); |
---|
1240 | if (vps->getDefaultDirectDependencyTypeFlag()) |
---|
1241 | { |
---|
1242 | WRITE_CODE( vps->getDefaultDirectDependencyType(), vps->getDirectDepTypeLen(), "default_direct_dependency_type" ); |
---|
1243 | } |
---|
1244 | else |
---|
1245 | { |
---|
1246 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
1247 | { |
---|
1248 | for(j = 0; j < i; j++) |
---|
1249 | { |
---|
1250 | if (vps->getDirectDependencyFlag(i, j)) |
---|
1251 | { |
---|
1252 | WRITE_CODE( vps->getDirectDependencyType(i, j), vps->getDirectDepTypeLen(), "direct_dependency_type[i][j]" ); |
---|
1253 | } |
---|
1254 | } |
---|
1255 | } |
---|
1256 | } |
---|
1257 | #else |
---|
1258 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
1259 | { |
---|
1260 | for(j = 0; j < i; j++) |
---|
1261 | { |
---|
1262 | if (vps->getDirectDependencyFlag(i, j)) |
---|
1263 | { |
---|
1264 | WRITE_CODE( vps->getDirectDependencyType(i, j), vps->getDirectDepTypeLen(), "direct_dependency_type[i][j]" ); |
---|
1265 | } |
---|
1266 | } |
---|
1267 | } |
---|
1268 | #endif |
---|
1269 | #endif |
---|
1270 | |
---|
1271 | #if !O0109_O0199_FLAGS_TO_VUI |
---|
1272 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
1273 | WRITE_FLAG(vps->getSingleLayerForNonIrapFlag(), "single_layer_for_non_irap_flag" ); |
---|
1274 | #endif |
---|
1275 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
1276 | WRITE_FLAG(vps->getHigherLayerIrapSkipFlag(), "higher_layer_irap_skip_flag" ); |
---|
1277 | #endif |
---|
1278 | #endif |
---|
1279 | |
---|
1280 | #if P0307_VPS_NON_VUI_EXTENSION |
---|
1281 | // The value of vps_non_vui_extension_length shall be in the range of 0 to 4096, inclusive. |
---|
1282 | assert( vps->getVpsNonVuiExtLength() >= 0 && vps->getVpsNonVuiExtLength() <= 4096 ); |
---|
1283 | |
---|
1284 | WRITE_UVLC( vps->getVpsNonVuiExtLength(), "vps_non_vui_extension_length" ); |
---|
1285 | #if P0307_VPS_NON_VUI_EXT_UPDATE |
---|
1286 | for (i = 1; i <= vps->getVpsNonVuiExtLength(); i++) |
---|
1287 | { |
---|
1288 | WRITE_CODE(1, 8, "vps_non_vui_extension_data_byte"); |
---|
1289 | } |
---|
1290 | #else |
---|
1291 | if ( vps->getVpsNonVuiExtLength() > 0 ) |
---|
1292 | { |
---|
1293 | printf("\n\nUp to the current spec, the value of vps_non_vui_extension_length is supposed to be 0\n"); |
---|
1294 | } |
---|
1295 | #endif |
---|
1296 | #endif |
---|
1297 | |
---|
1298 | #if !O0109_MOVE_VPS_VUI_FLAG |
---|
1299 | WRITE_FLAG( 1, "vps_vui_present_flag" ); |
---|
1300 | if(1) // Should be conditioned on the value of vps_vui_present_flag |
---|
1301 | { |
---|
1302 | while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 ) |
---|
1303 | { |
---|
1304 | WRITE_FLAG(1, "vps_vui_alignment_bit_equal_to_one"); |
---|
1305 | } |
---|
1306 | #if VPS_VUI_OFFSET |
---|
1307 | Int vpsVuiOffsetValeInBits = this->m_pcBitIf->getNumberOfWrittenBits() - m_vpsVuiCounter + 16; // 2 bytes for NUH |
---|
1308 | assert( vpsVuiOffsetValeInBits % 8 == 0 ); |
---|
1309 | vps->setVpsVuiOffset( vpsVuiOffsetValeInBits >> 3 ); |
---|
1310 | #endif |
---|
1311 | codeVPSVUI(vps); |
---|
1312 | } |
---|
1313 | #else |
---|
1314 | #if P0307_REMOVE_VPS_VUI_OFFSET |
---|
1315 | vps->setVpsVuiPresentFlag(true); |
---|
1316 | WRITE_FLAG( vps->getVpsVuiPresentFlag() ? 1 : 0, "vps_vui_present_flag" ); |
---|
1317 | #endif |
---|
1318 | if(vps->getVpsVuiPresentFlag()) // Should be conditioned on the value of vps_vui_present_flag |
---|
1319 | { |
---|
1320 | while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 ) |
---|
1321 | { |
---|
1322 | WRITE_FLAG(1, "vps_vui_alignment_bit_equal_to_one"); |
---|
1323 | } |
---|
1324 | #if !P0307_REMOVE_VPS_VUI_OFFSET |
---|
1325 | #if VPS_VUI_OFFSET |
---|
1326 | Int vpsVuiOffsetValeInBits = this->m_pcBitIf->getNumberOfWrittenBits() - m_vpsVuiCounter + 16; // 2 bytes for NUH |
---|
1327 | assert( vpsVuiOffsetValeInBits % 8 == 0 ); |
---|
1328 | vps->setVpsVuiOffset( vpsVuiOffsetValeInBits >> 3 ); |
---|
1329 | #endif |
---|
1330 | #endif |
---|
1331 | codeVPSVUI(vps); |
---|
1332 | } |
---|
1333 | #endif // 0109_MOVE_VPS_FLAG |
---|
1334 | } |
---|
1335 | |
---|
1336 | #if REPN_FORMAT_IN_VPS |
---|
1337 | Void TEncCavlc::codeRepFormat( RepFormat *repFormat ) |
---|
1338 | { |
---|
1339 | #if REPN_FORMAT_CONTROL_FLAG |
---|
1340 | WRITE_CODE( repFormat->getPicWidthVpsInLumaSamples (), 16, "pic_width_vps_in_luma_samples" ); |
---|
1341 | WRITE_CODE( repFormat->getPicHeightVpsInLumaSamples(), 16, "pic_height_vps_in_luma_samples" ); |
---|
1342 | WRITE_FLAG( repFormat->getChromaAndBitDepthVpsPresentFlag(), "chroma_and_bit_depth_vps_present_flag" ); |
---|
1343 | |
---|
1344 | if( repFormat->getChromaAndBitDepthVpsPresentFlag() ) |
---|
1345 | { |
---|
1346 | WRITE_CODE( repFormat->getChromaFormatVpsIdc(), 2, "chroma_format_vps_idc" ); |
---|
1347 | |
---|
1348 | if( repFormat->getChromaFormatVpsIdc() == 3 ) |
---|
1349 | { |
---|
1350 | WRITE_FLAG( repFormat->getSeparateColourPlaneVpsFlag(), "separate_colour_plane_vps_flag" ); |
---|
1351 | } |
---|
1352 | |
---|
1353 | assert( repFormat->getBitDepthVpsLuma() >= 8 ); |
---|
1354 | assert( repFormat->getBitDepthVpsChroma() >= 8 ); |
---|
1355 | WRITE_CODE( repFormat->getBitDepthVpsLuma() - 8, 4, "bit_depth_vps_luma_minus8" ); |
---|
1356 | WRITE_CODE( repFormat->getBitDepthVpsChroma() - 8, 4, "bit_depth_vps_chroma_minus8" ); |
---|
1357 | } |
---|
1358 | #else |
---|
1359 | WRITE_CODE( repFormat->getChromaFormatVpsIdc(), 2, "chroma_format_idc" ); |
---|
1360 | |
---|
1361 | if( repFormat->getChromaFormatVpsIdc() == 3 ) |
---|
1362 | { |
---|
1363 | WRITE_FLAG( repFormat->getSeparateColourPlaneVpsFlag(), "separate_colour_plane_flag"); |
---|
1364 | } |
---|
1365 | |
---|
1366 | WRITE_CODE ( repFormat->getPicWidthVpsInLumaSamples (), 16, "pic_width_in_luma_samples" ); |
---|
1367 | WRITE_CODE ( repFormat->getPicHeightVpsInLumaSamples(), 16, "pic_height_in_luma_samples" ); |
---|
1368 | |
---|
1369 | assert( repFormat->getBitDepthVpsLuma() >= 8 ); |
---|
1370 | assert( repFormat->getBitDepthVpsChroma() >= 8 ); |
---|
1371 | WRITE_CODE( repFormat->getBitDepthVpsLuma() - 8, 4, "bit_depth_luma_minus8" ); |
---|
1372 | WRITE_CODE( repFormat->getBitDepthVpsChroma() - 8, 4, "bit_depth_chroma_minus8" ); |
---|
1373 | #endif |
---|
1374 | } |
---|
1375 | #endif |
---|
1376 | #if VPS_DPB_SIZE_TABLE |
---|
1377 | Void TEncCavlc::codeVpsDpbSizeTable(TComVPS *vps) |
---|
1378 | { |
---|
1379 | #if DPB_PARAMS_MAXTLAYERS |
---|
1380 | #if BITRATE_PICRATE_SIGNALLING |
---|
1381 | Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumLayerSets()]; |
---|
1382 | for(Int i = 0; i < vps->getNumLayerSets(); i++) |
---|
1383 | #else |
---|
1384 | Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumOutputLayerSets()]; |
---|
1385 | for(Int i = 1; i < vps->getNumOutputLayerSets(); i++) |
---|
1386 | #endif |
---|
1387 | { |
---|
1388 | UInt maxSLMinus1 = 0; |
---|
1389 | #if CHANGE_NUMSUBDPB_IDX |
---|
1390 | Int optLsIdx = vps->getOutputLayerSetIdx( i ); |
---|
1391 | #else |
---|
1392 | Int optLsIdx = i; |
---|
1393 | #endif |
---|
1394 | #if BITRATE_PICRATE_SIGNALLING |
---|
1395 | optLsIdx = i; |
---|
1396 | #endif |
---|
1397 | for(Int k = 0; k < vps->getNumLayersInIdList(optLsIdx); k++ ) { |
---|
1398 | Int lId = vps->getLayerSetLayerIdList(optLsIdx, k); |
---|
1399 | maxSLMinus1 = max(maxSLMinus1, vps->getMaxTSLayersMinus1(vps->getLayerIdInVps(lId))); |
---|
1400 | } |
---|
1401 | MaxSubLayersInLayerSetMinus1[ i ] = maxSLMinus1; |
---|
1402 | #if BITRATE_PICRATE_SIGNALLING |
---|
1403 | vps->setMaxSLayersInLayerSetMinus1(i,MaxSubLayersInLayerSetMinus1[ i ]); |
---|
1404 | #endif |
---|
1405 | } |
---|
1406 | #endif |
---|
1407 | |
---|
1408 | |
---|
1409 | for(Int i = 1; i < vps->getNumOutputLayerSets(); i++) |
---|
1410 | { |
---|
1411 | #if CHANGE_NUMSUBDPB_IDX |
---|
1412 | Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx( i ); |
---|
1413 | #endif |
---|
1414 | WRITE_FLAG( vps->getSubLayerFlagInfoPresentFlag( i ), "sub_layer_flag_info_present_flag[i]"); |
---|
1415 | #if DPB_PARAMS_MAXTLAYERS |
---|
1416 | #if BITRATE_PICRATE_SIGNALLING |
---|
1417 | for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ vps->getOutputLayerSetIdx( i ) ]; j++) |
---|
1418 | #else |
---|
1419 | for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ i ]; j++) |
---|
1420 | #endif |
---|
1421 | #else |
---|
1422 | for(Int j = 0; j < vps->getMaxTLayers(); j++) |
---|
1423 | #endif |
---|
1424 | { |
---|
1425 | if( j > 0 && vps->getSubLayerFlagInfoPresentFlag(i) ) |
---|
1426 | { |
---|
1427 | WRITE_FLAG( vps->getSubLayerDpbInfoPresentFlag( i, j), "sub_layer_dpb_info_present_flag[i]"); |
---|
1428 | } |
---|
1429 | if( vps->getSubLayerDpbInfoPresentFlag(i, j) ) |
---|
1430 | { |
---|
1431 | #if CHANGE_NUMSUBDPB_IDX |
---|
1432 | #if RESOLUTION_BASED_DPB |
---|
1433 | for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet); k++) |
---|
1434 | #else |
---|
1435 | for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++) |
---|
1436 | #endif |
---|
1437 | #else |
---|
1438 | for(Int k = 0; k < vps->getNumSubDpbs(i); k++) |
---|
1439 | #endif |
---|
1440 | { |
---|
1441 | WRITE_UVLC( vps->getMaxVpsDecPicBufferingMinus1( i, k, j), "max_vps_dec_pic_buffering_minus1[i][k][j]" ); |
---|
1442 | } |
---|
1443 | WRITE_UVLC( vps->getMaxVpsNumReorderPics( i, j), "max_vps_num_reorder_pics[i][j]" ); |
---|
1444 | #if RESOLUTION_BASED_DPB |
---|
1445 | if( vps->getNumSubDpbs(layerSetIdxForOutputLayerSet) != vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ) ) // NumSubDpbs |
---|
1446 | { |
---|
1447 | for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++) |
---|
1448 | { |
---|
1449 | WRITE_UVLC( vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j), "max_vps_layer_dec_pic_buff_minus1[i][k][j]" ); |
---|
1450 | } |
---|
1451 | } |
---|
1452 | #endif |
---|
1453 | WRITE_UVLC( vps->getMaxVpsLatencyIncreasePlus1( i, j), "max_vps_latency_increase_plus1[i][j]" ); |
---|
1454 | } |
---|
1455 | } |
---|
1456 | } |
---|
1457 | |
---|
1458 | #if BITRATE_PICRATE_SIGNALLING |
---|
1459 | if( MaxSubLayersInLayerSetMinus1 ) |
---|
1460 | { |
---|
1461 | delete [] MaxSubLayersInLayerSetMinus1; |
---|
1462 | } |
---|
1463 | #endif |
---|
1464 | } |
---|
1465 | #endif |
---|
1466 | |
---|
1467 | Void TEncCavlc::codeVPSVUI (TComVPS *vps) |
---|
1468 | { |
---|
1469 | Int i,j; |
---|
1470 | #if O0223_PICTURE_TYPES_ALIGN_FLAG |
---|
1471 | WRITE_FLAG(vps->getCrossLayerPictureTypeAlignFlag(), "cross_layer_pic_type_aligned_flag"); |
---|
1472 | if (!vps->getCrossLayerPictureTypeAlignFlag()) |
---|
1473 | { |
---|
1474 | #endif |
---|
1475 | #if IRAP_ALIGN_FLAG_IN_VPS_VUI |
---|
1476 | WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag"); |
---|
1477 | #if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG |
---|
1478 | if(vps->getCrossLayerIrapAlignFlag()) |
---|
1479 | { |
---|
1480 | WRITE_FLAG(vps->getCrossLayerAlignedIdrOnlyFlag(), "all_layers_idr_aligned_flag"); |
---|
1481 | } |
---|
1482 | #endif |
---|
1483 | #endif |
---|
1484 | #if O0223_PICTURE_TYPES_ALIGN_FLAG |
---|
1485 | } |
---|
1486 | #endif |
---|
1487 | WRITE_FLAG( vps->getBitRatePresentVpsFlag(), "bit_rate_present_vps_flag" ); |
---|
1488 | WRITE_FLAG( vps->getPicRatePresentVpsFlag(), "pic_rate_present_vps_flag" ); |
---|
1489 | |
---|
1490 | if( vps->getBitRatePresentVpsFlag() || vps->getPicRatePresentVpsFlag() ) |
---|
1491 | { |
---|
1492 | #if Q0078_ADD_LAYER_SETS |
---|
1493 | #if R0227_BR_PR_ADD_LAYER_SET |
---|
1494 | for( i = 0; i < vps->getNumLayerSets(); i++ ) |
---|
1495 | #else |
---|
1496 | for( i = 0; i <= vps->getVpsNumLayerSetsMinus1(); i++ ) |
---|
1497 | #endif |
---|
1498 | #else |
---|
1499 | for( i = 0; i < vps->getNumLayerSets(); i++ ) |
---|
1500 | #endif |
---|
1501 | { |
---|
1502 | #if BITRATE_PICRATE_SIGNALLING |
---|
1503 | for( j = 0; j <= vps->getMaxSLayersInLayerSetMinus1(i); j++ ) |
---|
1504 | #else |
---|
1505 | for( j = 0; j < vps->getMaxTLayers(); j++ ) |
---|
1506 | #endif |
---|
1507 | { |
---|
1508 | if( vps->getBitRatePresentVpsFlag() ) |
---|
1509 | { |
---|
1510 | WRITE_FLAG( vps->getBitRatePresentFlag( i, j), "bit_rate_present_flag[i][j]" ); |
---|
1511 | } |
---|
1512 | if( vps->getPicRatePresentVpsFlag() ) |
---|
1513 | { |
---|
1514 | WRITE_FLAG( vps->getPicRatePresentFlag( i, j), "pic_rate_present_flag[i][j]" ); |
---|
1515 | } |
---|
1516 | if( vps->getBitRatePresentFlag(i, j) ) |
---|
1517 | { |
---|
1518 | WRITE_CODE( vps->getAvgBitRate( i, j ), 16, "avg_bit_rate[i][j]" ); |
---|
1519 | WRITE_CODE( vps->getAvgBitRate( i, j ), 16, "max_bit_rate[i][j]" ); |
---|
1520 | } |
---|
1521 | if( vps->getPicRatePresentFlag(i, j) ) |
---|
1522 | { |
---|
1523 | WRITE_CODE( vps->getConstPicRateIdc( i, j), 2 , "constant_pic_rate_idc[i][j]" ); |
---|
1524 | WRITE_CODE( vps->getConstPicRateIdc( i, j), 16, "avg_pic_rate[i][j]" ); |
---|
1525 | } |
---|
1526 | } |
---|
1527 | } |
---|
1528 | } |
---|
1529 | #if VPS_VUI_VIDEO_SIGNAL_MOVE |
---|
1530 | WRITE_FLAG( vps->getVideoSigPresentVpsFlag(), "video_signal_info_idx_present_flag" ); |
---|
1531 | if (vps->getVideoSigPresentVpsFlag()) |
---|
1532 | { |
---|
1533 | WRITE_CODE(vps->getNumVideoSignalInfo()-1, 4, "vps_num_video_signal_info_minus1" ); |
---|
1534 | } |
---|
1535 | |
---|
1536 | for(i = 0; i < vps->getNumVideoSignalInfo(); i++) |
---|
1537 | { |
---|
1538 | WRITE_CODE(vps->getVideoVPSFormat(i), 3, "video_vps_format" ); |
---|
1539 | WRITE_FLAG(vps->getVideoFullRangeVpsFlag(i), "video_full_range_vps_flag" ); |
---|
1540 | WRITE_CODE(vps->getColorPrimaries(i), 8, "color_primaries_vps" ); |
---|
1541 | WRITE_CODE(vps->getTransCharacter(i), 8, "transfer_characteristics_vps" ); |
---|
1542 | WRITE_CODE(vps->getMaxtrixCoeff(i), 8, "matrix_coeffs_vps" ); |
---|
1543 | } |
---|
1544 | |
---|
1545 | if (vps->getVideoSigPresentVpsFlag() && vps->getNumVideoSignalInfo() > 1 ) |
---|
1546 | { |
---|
1547 | #if VPS_VUI_VST_PARAMS |
---|
1548 | for(i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++) |
---|
1549 | { |
---|
1550 | WRITE_CODE( vps->getVideoSignalInfoIdx(i), 4, "vps_video_signal_info_idx" ); |
---|
1551 | } |
---|
1552 | #else |
---|
1553 | for (i=1; i < vps->getMaxLayers(); i++) |
---|
1554 | WRITE_CODE(vps->getVideoSignalInfoIdx(i), 4, "vps_video_signal_info_idx" ); |
---|
1555 | #endif |
---|
1556 | } |
---|
1557 | #endif |
---|
1558 | #if VPS_VUI_TILES_NOT_IN_USE__FLAG |
---|
1559 | UInt layerIdx; |
---|
1560 | WRITE_FLAG( vps->getTilesNotInUseFlag() ? 1 : 0 , "tiles_not_in_use_flag" ); |
---|
1561 | if (!vps->getTilesNotInUseFlag()) |
---|
1562 | { |
---|
1563 | for(i = 0; i < vps->getMaxLayers(); i++) |
---|
1564 | { |
---|
1565 | WRITE_FLAG( vps->getTilesInUseFlag(i) ? 1 : 0 , "tiles_in_use_flag[ i ]" ); |
---|
1566 | if (vps->getTilesInUseFlag(i)) |
---|
1567 | { |
---|
1568 | WRITE_FLAG( vps->getLoopFilterNotAcrossTilesFlag(i) ? 1 : 0 , "loop_filter_not_across_tiles_flag[ i ]" ); |
---|
1569 | } |
---|
1570 | } |
---|
1571 | #endif |
---|
1572 | |
---|
1573 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
1574 | { |
---|
1575 | for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++) |
---|
1576 | { |
---|
1577 | #if VPS_VUI_TILES_NOT_IN_USE__FLAG |
---|
1578 | layerIdx = vps->getLayerIdInVps(vps->getRefLayerId(vps->getLayerIdInNuh(i), j)); |
---|
1579 | if (vps->getTilesInUseFlag(i) && vps->getTilesInUseFlag(layerIdx)) { |
---|
1580 | WRITE_FLAG( vps->getTileBoundariesAlignedFlag(i,j) ? 1 : 0 , "tile_boundaries_aligned_flag[i][j]" ); |
---|
1581 | } |
---|
1582 | #else |
---|
1583 | WRITE_FLAG( vps->getTileBoundariesAlignedFlag(i,j) ? 1 : 0 , "tile_boundaries_aligned_flag[i][j]" ); |
---|
1584 | #endif |
---|
1585 | } |
---|
1586 | } |
---|
1587 | #if VPS_VUI_TILES_NOT_IN_USE__FLAG |
---|
1588 | } |
---|
1589 | #endif |
---|
1590 | #if VPS_VUI_WPP_NOT_IN_USE__FLAG |
---|
1591 | WRITE_FLAG( vps->getWppNotInUseFlag() ? 1 : 0 , "wpp_not_in_use_flag" ); |
---|
1592 | if (!vps->getWppNotInUseFlag()) |
---|
1593 | { |
---|
1594 | for(i = 0; i < vps->getMaxLayers(); i++) |
---|
1595 | { |
---|
1596 | WRITE_FLAG( vps->getWppInUseFlag(i) ? 1 : 0 , "wpp_in_use_flag[ i ]" ); |
---|
1597 | } |
---|
1598 | } |
---|
1599 | #endif |
---|
1600 | |
---|
1601 | #if O0109_O0199_FLAGS_TO_VUI |
---|
1602 | #if M0040_ADAPTIVE_RESOLUTION_CHANGE |
---|
1603 | WRITE_FLAG(vps->getSingleLayerForNonIrapFlag(), "single_layer_for_non_irap_flag" ); |
---|
1604 | #endif |
---|
1605 | #if HIGHER_LAYER_IRAP_SKIP_FLAG |
---|
1606 | // When single_layer_for_non_irap_flag is equal to 0, higher_layer_irap_skip_flag shall be equal to 0 |
---|
1607 | if( !vps->getSingleLayerForNonIrapFlag() ) |
---|
1608 | { |
---|
1609 | assert( !vps->getHigherLayerIrapSkipFlag() ); |
---|
1610 | } |
---|
1611 | |
---|
1612 | WRITE_FLAG(vps->getHigherLayerIrapSkipFlag(), "higher_layer_irap_skip_flag" ); |
---|
1613 | #endif |
---|
1614 | #endif |
---|
1615 | #if P0312_VERT_PHASE_ADJ |
---|
1616 | WRITE_FLAG( vps->getVpsVuiVertPhaseInUseFlag(), "vps_vui_vert_phase_in_use_flag" ); |
---|
1617 | #endif |
---|
1618 | #if N0160_VUI_EXT_ILP_REF |
---|
1619 | WRITE_FLAG( vps->getIlpRestrictedRefLayersFlag() ? 1 : 0 , "ilp_restricted_ref_layers_flag" ); |
---|
1620 | if( vps->getIlpRestrictedRefLayersFlag()) |
---|
1621 | { |
---|
1622 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
1623 | { |
---|
1624 | for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++) |
---|
1625 | { |
---|
1626 | WRITE_UVLC(vps->getMinSpatialSegmentOffsetPlus1( i, j), "min_spatial_segment_offset_plus1[i][j]"); |
---|
1627 | |
---|
1628 | if( vps->getMinSpatialSegmentOffsetPlus1(i,j ) > 0 ) |
---|
1629 | { |
---|
1630 | WRITE_FLAG( vps->getCtuBasedOffsetEnabledFlag( i, j) ? 1 : 0 , "ctu_based_offset_enabled_flag[i][j]" ); |
---|
1631 | |
---|
1632 | if(vps->getCtuBasedOffsetEnabledFlag(i,j)) |
---|
1633 | { |
---|
1634 | WRITE_UVLC(vps->getMinHorizontalCtuOffsetPlus1( i, j), "min_horizontal_ctu_offset_plus1[i][j]"); |
---|
1635 | } |
---|
1636 | } |
---|
1637 | } |
---|
1638 | } |
---|
1639 | } |
---|
1640 | #endif |
---|
1641 | #if VPS_VUI_VIDEO_SIGNAL |
---|
1642 | #if VPS_VUI_VIDEO_SIGNAL_MOVE |
---|
1643 | #else |
---|
1644 | WRITE_FLAG( vps->getVideoSigPresentVpsFlag(), "video_signal_info_idx_present_flag" ); |
---|
1645 | if (vps->getVideoSigPresentVpsFlag()) |
---|
1646 | { |
---|
1647 | WRITE_CODE(vps->getNumVideoSignalInfo()-1, 4, "vps_num_video_signal_info_minus1" ); |
---|
1648 | } |
---|
1649 | |
---|
1650 | for(i = 0; i < vps->getNumVideoSignalInfo(); i++) |
---|
1651 | { |
---|
1652 | WRITE_CODE(vps->getVideoVPSFormat(i), 3, "video_vps_format" ); |
---|
1653 | WRITE_FLAG(vps->getVideoFullRangeVpsFlag(i), "video_full_range_vps_flag" ); |
---|
1654 | WRITE_CODE(vps->getColorPrimaries(i), 8, "color_primaries_vps" ); |
---|
1655 | WRITE_CODE(vps->getTransCharacter(i), 8, "transfer_characteristics_vps" ); |
---|
1656 | WRITE_CODE(vps->getMaxtrixCoeff(i), 8, "matrix_coeffs_vps" ); |
---|
1657 | } |
---|
1658 | |
---|
1659 | if (vps->getVideoSigPresentVpsFlag() && vps->getNumVideoSignalInfo() > 1 ) |
---|
1660 | { |
---|
1661 | for (i=1; i < vps->getMaxLayers(); i++) |
---|
1662 | WRITE_CODE(vps->getVideoSignalInfoIdx(i), 4, "vps_video_signal_info_idx" ); |
---|
1663 | } |
---|
1664 | #endif |
---|
1665 | #endif |
---|
1666 | #if O0164_MULTI_LAYER_HRD |
---|
1667 | WRITE_FLAG(vps->getVpsVuiBspHrdPresentFlag(), "vps_vui_bsp_hrd_present_flag" ); |
---|
1668 | if (vps->getVpsVuiBspHrdPresentFlag()) |
---|
1669 | { |
---|
1670 | WRITE_UVLC( vps->getVpsNumBspHrdParametersMinus1(), "vps_num_bsp_hrd_parameters_minus1" ); |
---|
1671 | for( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ ) |
---|
1672 | { |
---|
1673 | if( i > 0 ) |
---|
1674 | { |
---|
1675 | WRITE_FLAG( vps->getBspCprmsPresentFlag(i), "bsp_cprms_present_flag[i]" ); |
---|
1676 | } |
---|
1677 | codeHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1); |
---|
1678 | } |
---|
1679 | #if Q0078_ADD_LAYER_SETS |
---|
1680 | for( UInt h = 1; h <= vps->getVpsNumLayerSetsMinus1(); h++ ) |
---|
1681 | #else |
---|
1682 | for( UInt h = 1; h <= (vps->getNumLayerSets()-1); h++ ) |
---|
1683 | #endif |
---|
1684 | { |
---|
1685 | WRITE_UVLC( vps->getNumBitstreamPartitions(h), "num_bitstream_partitions[i]"); |
---|
1686 | for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ ) |
---|
1687 | { |
---|
1688 | for( j = 0; j <= (vps->getMaxLayers()-1); j++ ) |
---|
1689 | { |
---|
1690 | if (vps->getLayerIdIncludedFlag(h, j)) |
---|
1691 | { |
---|
1692 | WRITE_FLAG( vps->getLayerInBspFlag(h, i, j), "layer_in_bsp_flag[h][i][j]" ); |
---|
1693 | } |
---|
1694 | } |
---|
1695 | } |
---|
1696 | if (vps->getNumBitstreamPartitions(h)) |
---|
1697 | { |
---|
1698 | #if Q0182_MULTI_LAYER_HRD_UPDATE |
---|
1699 | WRITE_UVLC(vps->getNumBspSchedCombinations(h) - 1, "num_bsp_sched_combinations_minus1[h]"); |
---|
1700 | #else |
---|
1701 | WRITE_UVLC( vps->getNumBspSchedCombinations(h), "num_bsp_sched_combinations[h]"); |
---|
1702 | #endif |
---|
1703 | for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ ) |
---|
1704 | { |
---|
1705 | for( j = 0; j < vps->getNumBitstreamPartitions(h); j++ ) |
---|
1706 | { |
---|
1707 | WRITE_UVLC( vps->getBspCombHrdIdx(h, i, j), "bsp_comb_hrd_idx[h][i][j]"); |
---|
1708 | WRITE_UVLC( vps->getBspCombSchedIdx(h, i, j), "bsp_comb_sched_idx[h][i][j]"); |
---|
1709 | } |
---|
1710 | } |
---|
1711 | } |
---|
1712 | } |
---|
1713 | } |
---|
1714 | #endif |
---|
1715 | #if P0182_VPS_VUI_PS_FLAG |
---|
1716 | for(i = 1; i < vps->getMaxLayers(); i++) |
---|
1717 | { |
---|
1718 | if( vps->getNumRefLayers(vps->getLayerIdInNuh(i)) == 0 ) |
---|
1719 | { |
---|
1720 | if( (vps->getSPSId(i) == 0) && (vps->getPPSId(i) == 0) ) |
---|
1721 | { |
---|
1722 | vps->setBaseLayerPSCompatibilityFlag(i, 1); |
---|
1723 | } |
---|
1724 | else |
---|
1725 | { |
---|
1726 | vps->setBaseLayerPSCompatibilityFlag(i, 0); |
---|
1727 | } |
---|
1728 | WRITE_FLAG(vps->getBaseLayerPSCompatibilityFlag(i), "base_layer_parameter_set_compatibility_flag" ); |
---|
1729 | } |
---|
1730 | } |
---|
1731 | #endif |
---|
1732 | } |
---|
1733 | #endif //SVC_EXTENSION |
---|
1734 | |
---|
1735 | Void TEncCavlc::codeSliceHeader ( TComSlice* pcSlice ) |
---|
1736 | { |
---|
1737 | #if ENC_DEC_TRACE |
---|
1738 | xTraceSliceHeader (pcSlice); |
---|
1739 | #endif |
---|
1740 | |
---|
1741 | //calculate number of bits required for slice address |
---|
1742 | Int maxSliceSegmentAddress = pcSlice->getPic()->getNumCUsInFrame(); |
---|
1743 | Int bitsSliceSegmentAddress = 0; |
---|
1744 | while(maxSliceSegmentAddress>(1<<bitsSliceSegmentAddress)) |
---|
1745 | { |
---|
1746 | bitsSliceSegmentAddress++; |
---|
1747 | } |
---|
1748 | Int ctuAddress; |
---|
1749 | if (pcSlice->isNextSlice()) |
---|
1750 | { |
---|
1751 | // Calculate slice address |
---|
1752 | ctuAddress = (pcSlice->getSliceCurStartCUAddr()/pcSlice->getPic()->getNumPartInCU()); |
---|
1753 | } |
---|
1754 | else |
---|
1755 | { |
---|
1756 | // Calculate slice address |
---|
1757 | ctuAddress = (pcSlice->getSliceSegmentCurStartCUAddr()/pcSlice->getPic()->getNumPartInCU()); |
---|
1758 | } |
---|
1759 | //write slice address |
---|
1760 | Int sliceSegmentAddress = pcSlice->getPic()->getPicSym()->getCUOrderMap(ctuAddress); |
---|
1761 | |
---|
1762 | WRITE_FLAG( sliceSegmentAddress==0, "first_slice_segment_in_pic_flag" ); |
---|
1763 | if ( pcSlice->getRapPicFlag() ) |
---|
1764 | { |
---|
1765 | #if SETTING_NO_OUT_PIC_PRIOR |
---|
1766 | WRITE_FLAG( pcSlice->getNoOutputPriorPicsFlag() ? 1 : 0, "no_output_of_prior_pics_flag" ); |
---|
1767 | #else |
---|
1768 | WRITE_FLAG( 0, "no_output_of_prior_pics_flag" ); |
---|
1769 | #endif |
---|
1770 | } |
---|
1771 | WRITE_UVLC( pcSlice->getPPS()->getPPSId(), "slice_pic_parameter_set_id" ); |
---|
1772 | pcSlice->setDependentSliceSegmentFlag(!pcSlice->isNextSlice()); |
---|
1773 | if ( pcSlice->getPPS()->getDependentSliceSegmentsEnabledFlag() && (sliceSegmentAddress!=0) ) |
---|
1774 | { |
---|
1775 | WRITE_FLAG( pcSlice->getDependentSliceSegmentFlag() ? 1 : 0, "dependent_slice_segment_flag" ); |
---|
1776 | } |
---|
1777 | if(sliceSegmentAddress>0) |
---|
1778 | { |
---|
1779 | WRITE_CODE( sliceSegmentAddress, bitsSliceSegmentAddress, "slice_segment_address" ); |
---|
1780 | } |
---|
1781 | if ( !pcSlice->getDependentSliceSegmentFlag() ) |
---|
1782 | { |
---|
1783 | #if SVC_EXTENSION |
---|
1784 | #if POC_RESET_FLAG |
---|
1785 | Int iBits = 0; |
---|
1786 | if( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits ) |
---|
1787 | { |
---|
1788 | WRITE_FLAG( pcSlice->getPocResetFlag(), "poc_reset_flag" ); |
---|
1789 | iBits++; |
---|
1790 | } |
---|
1791 | if( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits ) |
---|
1792 | { |
---|
1793 | assert(!!"discardable_flag"); |
---|
1794 | WRITE_FLAG(pcSlice->getDiscardableFlag(), "discardable_flag"); |
---|
1795 | iBits++; |
---|
1796 | } |
---|
1797 | #if O0149_CROSS_LAYER_BLA_FLAG |
---|
1798 | if( pcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits ) |
---|
1799 | { |
---|
1800 | assert(!!"cross_layer_bla_flag"); |
---|
1801 | WRITE_FLAG(pcSlice->getCrossLayerBLAFlag(), "cross_layer_bla_flag"); |
---|
1802 | iBits++; |
---|
1803 | } |
---|
1804 | #endif |
---|
1805 | for ( ; iBits < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); iBits++) |
---|
1806 | { |
---|
1807 | assert(!!"slice_reserved_undetermined_flag[]"); |
---|
1808 | WRITE_FLAG(0, "slice_reserved_undetermined_flag[]"); |
---|
1809 | } |
---|
1810 | #else |
---|
1811 | if (pcSlice->getPPS()->getNumExtraSliceHeaderBits()>0) |
---|
1812 | { |
---|
1813 | assert(!!"discardable_flag"); |
---|
1814 | WRITE_FLAG(pcSlice->getDiscardableFlag(), "discardable_flag"); |
---|
1815 | } |
---|
1816 | for (Int i = 1; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) |
---|
1817 | { |
---|
1818 | assert(!!"slice_reserved_undetermined_flag[]"); |
---|
1819 | WRITE_FLAG(0, "slice_reserved_undetermined_flag[]"); |
---|
1820 | } |
---|
1821 | #endif |
---|
1822 | #else //SVC_EXTENSION |
---|
1823 | for (Int i = 0; i < pcSlice->getPPS()->getNumExtraSliceHeaderBits(); i++) |
---|
1824 | { |
---|
1825 | assert(!!"slice_reserved_undetermined_flag[]"); |
---|
1826 | WRITE_FLAG(0, "slice_reserved_undetermined_flag[]"); |
---|
1827 | } |
---|
1828 | #endif //SVC_EXTENSION |
---|
1829 | |
---|
1830 | WRITE_UVLC( pcSlice->getSliceType(), "slice_type" ); |
---|
1831 | |
---|
1832 | if( pcSlice->getPPS()->getOutputFlagPresentFlag() ) |
---|
1833 | { |
---|
1834 | WRITE_FLAG( pcSlice->getPicOutputFlag() ? 1 : 0, "pic_output_flag" ); |
---|
1835 | } |
---|
1836 | |
---|
1837 | #if !AUXILIARY_PICTURES |
---|
1838 | #if REPN_FORMAT_IN_VPS |
---|
1839 | // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present |
---|
1840 | assert( pcSlice->getChromaFormatIdc() == 1 ); |
---|
1841 | #else |
---|
1842 | // in the first version chroma_format_idc is equal to one, thus colour_plane_id will not be present |
---|
1843 | assert (pcSlice->getSPS()->getChromaFormatIdc() == 1 ); |
---|
1844 | #endif |
---|
1845 | #endif |
---|
1846 | // if( separate_colour_plane_flag == 1 ) |
---|
1847 | // colour_plane_id u(2) |
---|
1848 | |
---|
1849 | #if N0065_LAYER_POC_ALIGNMENT |
---|
1850 | #if O0062_POC_LSB_NOT_PRESENT_FLAG |
---|
1851 | if( (pcSlice->getLayerId() > 0 && !pcSlice->getVPS()->getPocLsbNotPresentFlag( pcSlice->getVPS()->getLayerIdInVps(pcSlice->getLayerId())) ) || !pcSlice->getIdrPicFlag()) |
---|
1852 | #else |
---|
1853 | if( pcSlice->getLayerId() > 0 || !pcSlice->getIdrPicFlag() ) |
---|
1854 | #endif |
---|
1855 | #else |
---|
1856 | if( !pcSlice->getIdrPicFlag() ) |
---|
1857 | #endif |
---|
1858 | { |
---|
1859 | #if POC_RESET_FLAG |
---|
1860 | Int picOrderCntLSB; |
---|
1861 | if( !pcSlice->getPocResetFlag() ) |
---|
1862 | { |
---|
1863 | picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1); |
---|
1864 | } |
---|
1865 | else |
---|
1866 | { |
---|
1867 | picOrderCntLSB = (pcSlice->getPocValueBeforeReset()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1); |
---|
1868 | } |
---|
1869 | #else |
---|
1870 | #if POC_RESET_IDC_ENCODER |
---|
1871 | Int picOrderCntLSB; |
---|
1872 | if( pcSlice->getPocResetIdc() == 2 ) // i.e. the LSB is reset |
---|
1873 | { |
---|
1874 | picOrderCntLSB = pcSlice->getPicOrderCntLsb(); // This will be the LSB value w.r.t to the previous POC reset period. |
---|
1875 | } |
---|
1876 | else |
---|
1877 | { |
---|
1878 | picOrderCntLSB = (pcSlice->getPOC() + (1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1); |
---|
1879 | } |
---|
1880 | #else |
---|
1881 | Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC())) & ((1<<pcSlice->getSPS()->getBitsForPOC())-1); |
---|
1882 | #endif |
---|
1883 | #endif |
---|
1884 | WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb"); |
---|
1885 | |
---|
1886 | #if N0065_LAYER_POC_ALIGNMENT |
---|
1887 | #if SHM_FIX7 |
---|
1888 | } |
---|
1889 | #endif |
---|
1890 | if( !pcSlice->getIdrPicFlag() ) |
---|
1891 | { |
---|
1892 | #endif |
---|
1893 | TComReferencePictureSet* rps = pcSlice->getRPS(); |
---|
1894 | |
---|
1895 | // check for bitstream restriction stating that: |
---|
1896 | // If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0. |
---|
1897 | // Ideally this process should not be repeated for each slice in a picture |
---|
1898 | #if SVC_EXTENSION |
---|
1899 | if( pcSlice->getLayerId() == 0 ) |
---|
1900 | #endif |
---|
1901 | if (pcSlice->isIRAP()) |
---|
1902 | { |
---|
1903 | for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++) |
---|
1904 | { |
---|
1905 | assert (!rps->getUsed(picIdx)); |
---|
1906 | } |
---|
1907 | } |
---|
1908 | |
---|
1909 | if(pcSlice->getRPSidx() < 0) |
---|
1910 | { |
---|
1911 | WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag"); |
---|
1912 | codeShortTermRefPicSet(pcSlice->getSPS(), rps, true, pcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets()); |
---|
1913 | } |
---|
1914 | else |
---|
1915 | { |
---|
1916 | WRITE_FLAG( 1, "short_term_ref_pic_set_sps_flag"); |
---|
1917 | Int numBits = 0; |
---|
1918 | while ((1 << numBits) < pcSlice->getSPS()->getRPSList()->getNumberOfReferencePictureSets()) |
---|
1919 | { |
---|
1920 | numBits++; |
---|
1921 | } |
---|
1922 | if (numBits > 0) |
---|
1923 | { |
---|
1924 | WRITE_CODE( pcSlice->getRPSidx(), numBits, "short_term_ref_pic_set_idx" ); |
---|
1925 | } |
---|
1926 | } |
---|
1927 | if(pcSlice->getSPS()->getLongTermRefsPresent()) |
---|
1928 | { |
---|
1929 | Int numLtrpInSH = rps->getNumberOfLongtermPictures(); |
---|
1930 | Int ltrpInSPS[MAX_NUM_REF_PICS]; |
---|
1931 | Int numLtrpInSPS = 0; |
---|
1932 | UInt ltrpIndex; |
---|
1933 | Int counter = 0; |
---|
1934 | for(Int k = rps->getNumberOfPictures()-1; k > rps->getNumberOfPictures()-rps->getNumberOfLongtermPictures()-1; k--) |
---|
1935 | { |
---|
1936 | if (findMatchingLTRP(pcSlice, <rpIndex, rps->getPOC(k), rps->getUsed(k))) |
---|
1937 | { |
---|
1938 | ltrpInSPS[numLtrpInSPS] = ltrpIndex; |
---|
1939 | numLtrpInSPS++; |
---|
1940 | } |
---|
1941 | else |
---|
1942 | { |
---|
1943 | counter++; |
---|
1944 | } |
---|
1945 | } |
---|
1946 | numLtrpInSH -= numLtrpInSPS; |
---|
1947 | |
---|
1948 | Int bitsForLtrpInSPS = 0; |
---|
1949 | while (pcSlice->getSPS()->getNumLongTermRefPicSPS() > (1 << bitsForLtrpInSPS)) |
---|
1950 | { |
---|
1951 | bitsForLtrpInSPS++; |
---|
1952 | } |
---|
1953 | if (pcSlice->getSPS()->getNumLongTermRefPicSPS() > 0) |
---|
1954 | { |
---|
1955 | WRITE_UVLC( numLtrpInSPS, "num_long_term_sps"); |
---|
1956 | } |
---|
1957 | WRITE_UVLC( numLtrpInSH, "num_long_term_pics"); |
---|
1958 | // Note that the LSBs of the LT ref. pic. POCs must be sorted before. |
---|
1959 | // Not sorted here because LT ref indices will be used in setRefPicList() |
---|
1960 | Int prevDeltaMSB = 0, prevLSB = 0; |
---|
1961 | Int offset = rps->getNumberOfNegativePictures() + rps->getNumberOfPositivePictures(); |
---|
1962 | for(Int i=rps->getNumberOfPictures()-1 ; i > offset-1; i--) |
---|
1963 | { |
---|
1964 | if (counter < numLtrpInSPS) |
---|
1965 | { |
---|
1966 | if (bitsForLtrpInSPS > 0) |
---|
1967 | { |
---|
1968 | WRITE_CODE( ltrpInSPS[counter], bitsForLtrpInSPS, "lt_idx_sps[i]"); |
---|
1969 | } |
---|
1970 | } |
---|
1971 | else |
---|
1972 | { |
---|
1973 | WRITE_CODE( rps->getPocLSBLT(i), pcSlice->getSPS()->getBitsForPOC(), "poc_lsb_lt"); |
---|
1974 | WRITE_FLAG( rps->getUsed(i), "used_by_curr_pic_lt_flag"); |
---|
1975 | } |
---|
1976 | WRITE_FLAG( rps->getDeltaPocMSBPresentFlag(i), "delta_poc_msb_present_flag"); |
---|
1977 | |
---|
1978 | if(rps->getDeltaPocMSBPresentFlag(i)) |
---|
1979 | { |
---|
1980 | Bool deltaFlag = false; |
---|
1981 | // First LTRP from SPS || First LTRP from SH || curr LSB != prev LSB |
---|
1982 | if( (i == rps->getNumberOfPictures()-1) || (i == rps->getNumberOfPictures()-1-numLtrpInSPS) || (rps->getPocLSBLT(i) != prevLSB) ) |
---|
1983 | { |
---|
1984 | deltaFlag = true; |
---|
1985 | } |
---|
1986 | if(deltaFlag) |
---|
1987 | { |
---|
1988 | WRITE_UVLC( rps->getDeltaPocMSBCycleLT(i), "delta_poc_msb_cycle_lt[i]" ); |
---|
1989 | } |
---|
1990 | else |
---|
1991 | { |
---|
1992 | Int differenceInDeltaMSB = rps->getDeltaPocMSBCycleLT(i) - prevDeltaMSB; |
---|
1993 | assert(differenceInDeltaMSB >= 0); |
---|
1994 | WRITE_UVLC( differenceInDeltaMSB, "delta_poc_msb_cycle_lt[i]" ); |
---|
1995 | } |
---|
1996 | prevLSB = rps->getPocLSBLT(i); |
---|
1997 | prevDeltaMSB = rps->getDeltaPocMSBCycleLT(i); |
---|
1998 | } |
---|
1999 | } |
---|
2000 | } |
---|
2001 | if (pcSlice->getSPS()->getTMVPFlagsPresent()) |
---|
2002 | { |
---|
2003 | WRITE_FLAG( pcSlice->getEnableTMVPFlag() ? 1 : 0, "slice_temporal_mvp_enable_flag" ); |
---|
2004 | } |
---|
2005 | #if N0065_LAYER_POC_ALIGNMENT && !SHM_FIX7 |
---|
2006 | } |
---|
2007 | #endif |
---|
2008 | } |
---|
2009 | |
---|
2010 | #if SVC_EXTENSION |
---|
2011 | if((pcSlice->getLayerId() > 0) && !(pcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (pcSlice->getNumILRRefIdx() > 0) ) |
---|
2012 | { |
---|
2013 | WRITE_FLAG(pcSlice->getInterLayerPredEnabledFlag(),"inter_layer_pred_enabled_flag"); |
---|
2014 | if( pcSlice->getInterLayerPredEnabledFlag()) |
---|
2015 | { |
---|
2016 | if(pcSlice->getNumILRRefIdx() > 1) |
---|
2017 | { |
---|
2018 | Int numBits = 1; |
---|
2019 | while ((1 << numBits) < pcSlice->getNumILRRefIdx()) |
---|
2020 | { |
---|
2021 | numBits++; |
---|
2022 | } |
---|
2023 | if( !pcSlice->getVPS()->getMaxOneActiveRefLayerFlag()) |
---|
2024 | { |
---|
2025 | WRITE_CODE(pcSlice->getActiveNumILRRefIdx() - 1, numBits,"num_inter_layer_ref_pics_minus1"); |
---|
2026 | } |
---|
2027 | |
---|
2028 | if( pcSlice->getNumILRRefIdx() != pcSlice->getActiveNumILRRefIdx() ) |
---|
2029 | { |
---|
2030 | for(Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) |
---|
2031 | { |
---|
2032 | WRITE_CODE(pcSlice->getInterLayerPredLayerIdc(i),numBits,"inter_layer_pred_layer_idc[i]"); |
---|
2033 | } |
---|
2034 | } |
---|
2035 | } |
---|
2036 | } |
---|
2037 | } |
---|
2038 | #if P0312_VERT_PHASE_ADJ |
---|
2039 | for(Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ ) |
---|
2040 | { |
---|
2041 | UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i); |
---|
2042 | if( pcSlice->getSPS()->getVertPhasePositionEnableFlag(refLayerIdc) ) |
---|
2043 | { |
---|
2044 | WRITE_FLAG( pcSlice->getVertPhasePositionFlag(refLayerIdc), "vert_phase_position_flag" ); |
---|
2045 | } |
---|
2046 | } |
---|
2047 | #endif |
---|
2048 | #endif //SVC_EXTENSION |
---|
2049 | |
---|
2050 | if(pcSlice->getSPS()->getUseSAO()) |
---|
2051 | { |
---|
2052 | if (pcSlice->getSPS()->getUseSAO()) |
---|
2053 | { |
---|
2054 | WRITE_FLAG( pcSlice->getSaoEnabledFlag(), "slice_sao_luma_flag" ); |
---|
2055 | #if AUXILIARY_PICTURES |
---|
2056 | if (pcSlice->getChromaFormatIdc() != CHROMA_400) |
---|
2057 | #endif |
---|
2058 | WRITE_FLAG( pcSlice->getSaoEnabledFlagChroma(), "slice_sao_chroma_flag" ); |
---|
2059 | } |
---|
2060 | } |
---|
2061 | |
---|
2062 | //check if numrefidxes match the defaults. If not, override |
---|
2063 | |
---|
2064 | if (!pcSlice->isIntra()) |
---|
2065 | { |
---|
2066 | Bool overrideFlag = (pcSlice->getNumRefIdx( REF_PIC_LIST_0 )!=pcSlice->getPPS()->getNumRefIdxL0DefaultActive()||(pcSlice->isInterB()&&pcSlice->getNumRefIdx( REF_PIC_LIST_1 )!=pcSlice->getPPS()->getNumRefIdxL1DefaultActive())); |
---|
2067 | WRITE_FLAG( overrideFlag ? 1 : 0, "num_ref_idx_active_override_flag"); |
---|
2068 | if (overrideFlag) |
---|
2069 | { |
---|
2070 | WRITE_UVLC( pcSlice->getNumRefIdx( REF_PIC_LIST_0 ) - 1, "num_ref_idx_l0_active_minus1" ); |
---|
2071 | if (pcSlice->isInterB()) |
---|
2072 | { |
---|
2073 | WRITE_UVLC( pcSlice->getNumRefIdx( REF_PIC_LIST_1 ) - 1, "num_ref_idx_l1_active_minus1" ); |
---|
2074 | } |
---|
2075 | else |
---|
2076 | { |
---|
2077 | pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); |
---|
2078 | } |
---|
2079 | } |
---|
2080 | } |
---|
2081 | else |
---|
2082 | { |
---|
2083 | pcSlice->setNumRefIdx(REF_PIC_LIST_0, 0); |
---|
2084 | pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0); |
---|
2085 | } |
---|
2086 | |
---|
2087 | if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList() > 1) |
---|
2088 | { |
---|
2089 | TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification(); |
---|
2090 | if(!pcSlice->isIntra()) |
---|
2091 | { |
---|
2092 | WRITE_FLAG(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL0() ? 1 : 0, "ref_pic_list_modification_flag_l0" ); |
---|
2093 | if (pcSlice->getRefPicListModification()->getRefPicListModificationFlagL0()) |
---|
2094 | { |
---|
2095 | Int numRpsCurrTempList0 = pcSlice->getNumRpsCurrTempList(); |
---|
2096 | if (numRpsCurrTempList0 > 1) |
---|
2097 | { |
---|
2098 | Int length = 1; |
---|
2099 | numRpsCurrTempList0 --; |
---|
2100 | while ( numRpsCurrTempList0 >>= 1) |
---|
2101 | { |
---|
2102 | length ++; |
---|
2103 | } |
---|
2104 | for(Int i = 0; i < pcSlice->getNumRefIdx( REF_PIC_LIST_0 ); i++) |
---|
2105 | { |
---|
2106 | WRITE_CODE( refPicListModification->getRefPicSetIdxL0(i), length, "list_entry_l0"); |
---|
2107 | } |
---|
2108 | } |
---|
2109 | } |
---|
2110 | } |
---|
2111 | if(pcSlice->isInterB()) |
---|
2112 | { |
---|
2113 | WRITE_FLAG(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL1() ? 1 : 0, "ref_pic_list_modification_flag_l1" ); |
---|
2114 | if (pcSlice->getRefPicListModification()->getRefPicListModificationFlagL1()) |
---|
2115 | { |
---|
2116 | Int numRpsCurrTempList1 = pcSlice->getNumRpsCurrTempList(); |
---|
2117 | if ( numRpsCurrTempList1 > 1 ) |
---|
2118 | { |
---|
2119 | Int length = 1; |
---|
2120 | numRpsCurrTempList1 --; |
---|
2121 | while ( numRpsCurrTempList1 >>= 1) |
---|
2122 | { |
---|
2123 | length ++; |
---|
2124 | } |
---|
2125 | for(Int i = 0; i < pcSlice->getNumRefIdx( REF_PIC_LIST_1 ); i++) |
---|
2126 | { |
---|
2127 | WRITE_CODE( refPicListModification->getRefPicSetIdxL1(i), length, "list_entry_l1"); |
---|
2128 | } |
---|
2129 | } |
---|
2130 | } |
---|
2131 | } |
---|
2132 | } |
---|
2133 | |
---|
2134 | if (pcSlice->isInterB()) |
---|
2135 | { |
---|
2136 | WRITE_FLAG( pcSlice->getMvdL1ZeroFlag() ? 1 : 0, "mvd_l1_zero_flag"); |
---|
2137 | } |
---|
2138 | |
---|
2139 | if(!pcSlice->isIntra()) |
---|
2140 | { |
---|
2141 | if (!pcSlice->isIntra() && pcSlice->getPPS()->getCabacInitPresentFlag()) |
---|
2142 | { |
---|
2143 | SliceType sliceType = pcSlice->getSliceType(); |
---|
2144 | Int encCABACTableIdx = pcSlice->getPPS()->getEncCABACTableIdx(); |
---|
2145 | Bool encCabacInitFlag = (sliceType!=encCABACTableIdx && encCABACTableIdx!=I_SLICE) ? true : false; |
---|
2146 | pcSlice->setCabacInitFlag( encCabacInitFlag ); |
---|
2147 | WRITE_FLAG( encCabacInitFlag?1:0, "cabac_init_flag" ); |
---|
2148 | } |
---|
2149 | } |
---|
2150 | |
---|
2151 | if ( pcSlice->getEnableTMVPFlag() ) |
---|
2152 | { |
---|
2153 | if ( pcSlice->getSliceType() == B_SLICE ) |
---|
2154 | { |
---|
2155 | WRITE_FLAG( pcSlice->getColFromL0Flag(), "collocated_from_l0_flag" ); |
---|
2156 | } |
---|
2157 | |
---|
2158 | if ( pcSlice->getSliceType() != I_SLICE && |
---|
2159 | ((pcSlice->getColFromL0Flag()==1 && pcSlice->getNumRefIdx(REF_PIC_LIST_0)>1)|| |
---|
2160 | (pcSlice->getColFromL0Flag()==0 && pcSlice->getNumRefIdx(REF_PIC_LIST_1)>1))) |
---|
2161 | { |
---|
2162 | WRITE_UVLC( pcSlice->getColRefIdx(), "collocated_ref_idx" ); |
---|
2163 | } |
---|
2164 | } |
---|
2165 | if ( (pcSlice->getPPS()->getUseWP() && pcSlice->getSliceType()==P_SLICE) || (pcSlice->getPPS()->getWPBiPred() && pcSlice->getSliceType()==B_SLICE) ) |
---|
2166 | { |
---|
2167 | xCodePredWeightTable( pcSlice ); |
---|
2168 | } |
---|
2169 | assert(pcSlice->getMaxNumMergeCand()<=MRG_MAX_NUM_CANDS); |
---|
2170 | if (!pcSlice->isIntra()) |
---|
2171 | { |
---|
2172 | WRITE_UVLC(MRG_MAX_NUM_CANDS - pcSlice->getMaxNumMergeCand(), "five_minus_max_num_merge_cand"); |
---|
2173 | } |
---|
2174 | Int iCode = pcSlice->getSliceQp() - ( pcSlice->getPPS()->getPicInitQPMinus26() + 26 ); |
---|
2175 | WRITE_SVLC( iCode, "slice_qp_delta" ); |
---|
2176 | if (pcSlice->getPPS()->getSliceChromaQpFlag()) |
---|
2177 | { |
---|
2178 | iCode = pcSlice->getSliceQpDeltaCb(); |
---|
2179 | WRITE_SVLC( iCode, "slice_qp_delta_cb" ); |
---|
2180 | iCode = pcSlice->getSliceQpDeltaCr(); |
---|
2181 | WRITE_SVLC( iCode, "slice_qp_delta_cr" ); |
---|
2182 | } |
---|
2183 | if (pcSlice->getPPS()->getDeblockingFilterControlPresentFlag()) |
---|
2184 | { |
---|
2185 | if (pcSlice->getPPS()->getDeblockingFilterOverrideEnabledFlag() ) |
---|
2186 | { |
---|
2187 | WRITE_FLAG(pcSlice->getDeblockingFilterOverrideFlag(), "deblocking_filter_override_flag"); |
---|
2188 | } |
---|
2189 | if (pcSlice->getDeblockingFilterOverrideFlag()) |
---|
2190 | { |
---|
2191 | WRITE_FLAG(pcSlice->getDeblockingFilterDisable(), "slice_disable_deblocking_filter_flag"); |
---|
2192 | if(!pcSlice->getDeblockingFilterDisable()) |
---|
2193 | { |
---|
2194 | WRITE_SVLC (pcSlice->getDeblockingFilterBetaOffsetDiv2(), "slice_beta_offset_div2"); |
---|
2195 | WRITE_SVLC (pcSlice->getDeblockingFilterTcOffsetDiv2(), "slice_tc_offset_div2"); |
---|
2196 | } |
---|
2197 | } |
---|
2198 | } |
---|
2199 | |
---|
2200 | Bool isSAOEnabled = (!pcSlice->getSPS()->getUseSAO())?(false):(pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()); |
---|
2201 | Bool isDBFEnabled = (!pcSlice->getDeblockingFilterDisable()); |
---|
2202 | |
---|
2203 | if(pcSlice->getPPS()->getLoopFilterAcrossSlicesEnabledFlag() && ( isSAOEnabled || isDBFEnabled )) |
---|
2204 | { |
---|
2205 | WRITE_FLAG(pcSlice->getLFCrossSliceBoundaryFlag()?1:0, "slice_loop_filter_across_slices_enabled_flag"); |
---|
2206 | } |
---|
2207 | } |
---|
2208 | |
---|
2209 | #if !POC_RESET_IDC_SIGNALLING // Wrong place to put slice header extension |
---|
2210 | if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag()) |
---|
2211 | { |
---|
2212 | WRITE_UVLC(0,"slice_header_extension_length"); |
---|
2213 | } |
---|
2214 | #endif |
---|
2215 | } |
---|
2216 | |
---|
2217 | Void TEncCavlc::codePTL( TComPTL* pcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1) |
---|
2218 | { |
---|
2219 | if(profilePresentFlag) |
---|
2220 | { |
---|
2221 | codeProfileTier(pcPTL->getGeneralPTL()); // general_... |
---|
2222 | } |
---|
2223 | WRITE_CODE( pcPTL->getGeneralPTL()->getLevelIdc(), 8, "general_level_idc" ); |
---|
2224 | |
---|
2225 | for (Int i = 0; i < maxNumSubLayersMinus1; i++) |
---|
2226 | { |
---|
2227 | if(profilePresentFlag) |
---|
2228 | { |
---|
2229 | WRITE_FLAG( pcPTL->getSubLayerProfilePresentFlag(i), "sub_layer_profile_present_flag[i]" ); |
---|
2230 | } |
---|
2231 | |
---|
2232 | WRITE_FLAG( pcPTL->getSubLayerLevelPresentFlag(i), "sub_layer_level_present_flag[i]" ); |
---|
2233 | } |
---|
2234 | |
---|
2235 | if (maxNumSubLayersMinus1 > 0) |
---|
2236 | { |
---|
2237 | for (Int i = maxNumSubLayersMinus1; i < 8; i++) |
---|
2238 | { |
---|
2239 | WRITE_CODE(0, 2, "reserved_zero_2bits"); |
---|
2240 | } |
---|
2241 | } |
---|
2242 | |
---|
2243 | for(Int i = 0; i < maxNumSubLayersMinus1; i++) |
---|
2244 | { |
---|
2245 | if( profilePresentFlag && pcPTL->getSubLayerProfilePresentFlag(i) ) |
---|
2246 | { |
---|
2247 | codeProfileTier(pcPTL->getSubLayerPTL(i)); // sub_layer_... |
---|
2248 | } |
---|
2249 | if( pcPTL->getSubLayerLevelPresentFlag(i) ) |
---|
2250 | { |
---|
2251 | WRITE_CODE( pcPTL->getSubLayerPTL(i)->getLevelIdc(), 8, "sub_layer_level_idc[i]" ); |
---|
2252 | } |
---|
2253 | } |
---|
2254 | } |
---|
2255 | Void TEncCavlc::codeProfileTier( ProfileTierLevel* ptl ) |
---|
2256 | { |
---|
2257 | WRITE_CODE( ptl->getProfileSpace(), 2 , "XXX_profile_space[]"); |
---|
2258 | WRITE_FLAG( ptl->getTierFlag (), "XXX_tier_flag[]" ); |
---|
2259 | WRITE_CODE( ptl->getProfileIdc (), 5 , "XXX_profile_idc[]" ); |
---|
2260 | for(Int j = 0; j < 32; j++) |
---|
2261 | { |
---|
2262 | WRITE_FLAG( ptl->getProfileCompatibilityFlag(j), "XXX_profile_compatibility_flag[][j]"); |
---|
2263 | } |
---|
2264 | |
---|
2265 | WRITE_FLAG(ptl->getProgressiveSourceFlag(), "general_progressive_source_flag"); |
---|
2266 | WRITE_FLAG(ptl->getInterlacedSourceFlag(), "general_interlaced_source_flag"); |
---|
2267 | WRITE_FLAG(ptl->getNonPackedConstraintFlag(), "general_non_packed_constraint_flag"); |
---|
2268 | WRITE_FLAG(ptl->getFrameOnlyConstraintFlag(), "general_frame_only_constraint_flag"); |
---|
2269 | |
---|
2270 | WRITE_CODE(0 , 16, "XXX_reserved_zero_44bits[0..15]"); |
---|
2271 | WRITE_CODE(0 , 16, "XXX_reserved_zero_44bits[16..31]"); |
---|
2272 | WRITE_CODE(0 , 12, "XXX_reserved_zero_44bits[32..43]"); |
---|
2273 | } |
---|
2274 | |
---|
2275 | /** |
---|
2276 | - write wavefront substreams sizes for the slice header. |
---|
2277 | . |
---|
2278 | \param pcSlice Where we find the substream size information. |
---|
2279 | */ |
---|
2280 | Void TEncCavlc::codeTilesWPPEntryPoint( TComSlice* pSlice ) |
---|
2281 | { |
---|
2282 | if (!pSlice->getPPS()->getTilesEnabledFlag() && !pSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) |
---|
2283 | { |
---|
2284 | return; |
---|
2285 | } |
---|
2286 | UInt numEntryPointOffsets = 0, offsetLenMinus1 = 0, maxOffset = 0; |
---|
2287 | Int numZeroSubstreamsAtStartOfSlice = 0; |
---|
2288 | UInt *entryPointOffset = NULL; |
---|
2289 | if ( pSlice->getPPS()->getTilesEnabledFlag() ) |
---|
2290 | { |
---|
2291 | numEntryPointOffsets = pSlice->getTileLocationCount(); |
---|
2292 | entryPointOffset = new UInt[numEntryPointOffsets]; |
---|
2293 | for (Int idx=0; idx<pSlice->getTileLocationCount(); idx++) |
---|
2294 | { |
---|
2295 | if ( idx == 0 ) |
---|
2296 | { |
---|
2297 | entryPointOffset [ idx ] = pSlice->getTileLocation( 0 ); |
---|
2298 | } |
---|
2299 | else |
---|
2300 | { |
---|
2301 | entryPointOffset [ idx ] = pSlice->getTileLocation( idx ) - pSlice->getTileLocation( idx-1 ); |
---|
2302 | } |
---|
2303 | |
---|
2304 | if ( entryPointOffset[ idx ] > maxOffset ) |
---|
2305 | { |
---|
2306 | maxOffset = entryPointOffset[ idx ]; |
---|
2307 | } |
---|
2308 | } |
---|
2309 | } |
---|
2310 | else if ( pSlice->getPPS()->getEntropyCodingSyncEnabledFlag() ) |
---|
2311 | { |
---|
2312 | UInt* pSubstreamSizes = pSlice->getSubstreamSizes(); |
---|
2313 | Int maxNumParts = pSlice->getPic()->getNumPartInCU(); |
---|
2314 | numZeroSubstreamsAtStartOfSlice = pSlice->getSliceSegmentCurStartCUAddr()/maxNumParts/pSlice->getPic()->getFrameWidthInCU(); |
---|
2315 | Int numZeroSubstreamsAtEndOfSlice = pSlice->getPic()->getFrameHeightInCU()-1 - ((pSlice->getSliceSegmentCurEndCUAddr()-1)/maxNumParts/pSlice->getPic()->getFrameWidthInCU()); |
---|
2316 | numEntryPointOffsets = pSlice->getPPS()->getNumSubstreams() - numZeroSubstreamsAtStartOfSlice - numZeroSubstreamsAtEndOfSlice - 1; |
---|
2317 | pSlice->setNumEntryPointOffsets(numEntryPointOffsets); |
---|
2318 | entryPointOffset = new UInt[numEntryPointOffsets]; |
---|
2319 | for (Int idx=0; idx<numEntryPointOffsets; idx++) |
---|
2320 | { |
---|
2321 | entryPointOffset[ idx ] = ( pSubstreamSizes[ idx+numZeroSubstreamsAtStartOfSlice ] >> 3 ) ; |
---|
2322 | if ( entryPointOffset[ idx ] > maxOffset ) |
---|
2323 | { |
---|
2324 | maxOffset = entryPointOffset[ idx ]; |
---|
2325 | } |
---|
2326 | } |
---|
2327 | } |
---|
2328 | // Determine number of bits "offsetLenMinus1+1" required for entry point information |
---|
2329 | offsetLenMinus1 = 0; |
---|
2330 | while (maxOffset >= (1u << (offsetLenMinus1 + 1))) |
---|
2331 | { |
---|
2332 | offsetLenMinus1++; |
---|
2333 | assert(offsetLenMinus1 + 1 < 32); |
---|
2334 | } |
---|
2335 | |
---|
2336 | WRITE_UVLC(numEntryPointOffsets, "num_entry_point_offsets"); |
---|
2337 | if (numEntryPointOffsets>0) |
---|
2338 | { |
---|
2339 | WRITE_UVLC(offsetLenMinus1, "offset_len_minus1"); |
---|
2340 | } |
---|
2341 | |
---|
2342 | for (UInt idx=0; idx<numEntryPointOffsets; idx++) |
---|
2343 | { |
---|
2344 | WRITE_CODE(entryPointOffset[ idx ]-1, offsetLenMinus1+1, "entry_point_offset_minus1"); |
---|
2345 | } |
---|
2346 | |
---|
2347 | delete [] entryPointOffset; |
---|
2348 | } |
---|
2349 | |
---|
2350 | #if POC_RESET_IDC_SIGNALLING |
---|
2351 | Void TEncCavlc::codeSliceHeaderExtn( TComSlice* slice, Int shBitsWrittenTillNow ) |
---|
2352 | { |
---|
2353 | Int tmpBitsBeforeWriting = getNumberOfWrittenBits(); |
---|
2354 | Int maxPocLsb = 1 << slice->getSPS()->getBitsForPOC(); |
---|
2355 | if(slice->getPPS()->getSliceHeaderExtensionPresentFlag()) |
---|
2356 | { |
---|
2357 | // Derive the value of PocMsbValRequiredFlag |
---|
2358 | slice->setPocMsbValRequiredFlag( slice->getCraPicFlag() || slice->getBlaPicFlag() |
---|
2359 | /* || related to vps_poc_lsb_aligned_flag */ |
---|
2360 | ); |
---|
2361 | |
---|
2362 | // Determine value of SH extension length. |
---|
2363 | Int shExtnLengthInBit = 0; |
---|
2364 | if (slice->getPPS()->getPocResetInfoPresentFlag()) |
---|
2365 | { |
---|
2366 | shExtnLengthInBit += 2; |
---|
2367 | } |
---|
2368 | if (slice->getPocResetIdc() > 0) |
---|
2369 | { |
---|
2370 | shExtnLengthInBit += 6; |
---|
2371 | } |
---|
2372 | if (slice->getPocResetIdc() == 3) |
---|
2373 | { |
---|
2374 | shExtnLengthInBit += (slice->getSPS()->getBitsForPOC() + 1); |
---|
2375 | } |
---|
2376 | |
---|
2377 | |
---|
2378 | if( !slice->getPocMsbValRequiredFlag() /* && vps_poc_lsb_aligned_flag */ ) |
---|
2379 | { |
---|
2380 | shExtnLengthInBit++; |
---|
2381 | } |
---|
2382 | else |
---|
2383 | { |
---|
2384 | if( slice->getPocMsbValRequiredFlag() ) |
---|
2385 | { |
---|
2386 | slice->setPocMsbValPresentFlag( true ); |
---|
2387 | } |
---|
2388 | else |
---|
2389 | { |
---|
2390 | slice->setPocMsbValPresentFlag( false ); |
---|
2391 | } |
---|
2392 | } |
---|
2393 | |
---|
2394 | if( slice->getPocMsbValPresentFlag() ) |
---|
2395 | { |
---|
2396 | UInt lengthVal = 1; |
---|
2397 | UInt tempVal = (slice->getPocMsbVal() / maxPocLsb) + 1; |
---|
2398 | assert ( tempVal ); |
---|
2399 | while( 1 != tempVal ) |
---|
2400 | { |
---|
2401 | tempVal >>= 1; |
---|
2402 | lengthVal += 2; |
---|
2403 | } |
---|
2404 | shExtnLengthInBit += lengthVal; |
---|
2405 | } |
---|
2406 | Int shExtnAdditionalBits = 0; |
---|
2407 | if(shExtnLengthInBit % 8 != 0) |
---|
2408 | { |
---|
2409 | shExtnAdditionalBits = 8 - (shExtnLengthInBit % 8); |
---|
2410 | } |
---|
2411 | Int shExtnLength = (shExtnLengthInBit + shExtnAdditionalBits) / 8; |
---|
2412 | WRITE_UVLC( shExtnLength, "slice_header_extension_length" ); |
---|
2413 | |
---|
2414 | if(slice->getPPS()->getPocResetInfoPresentFlag()) |
---|
2415 | { |
---|
2416 | WRITE_CODE( slice->getPocResetIdc(), 2, "poc_reset_idc"); |
---|
2417 | } |
---|
2418 | if(slice->getPocResetIdc() > 0) |
---|
2419 | { |
---|
2420 | WRITE_CODE( slice->getPocResetPeriodId(), 6, "poc_reset_period_id"); |
---|
2421 | } |
---|
2422 | if(slice->getPocResetIdc() == 3) |
---|
2423 | { |
---|
2424 | WRITE_FLAG( slice->getFullPocResetFlag() ? 1 : 0, "full_poc_reset_flag"); |
---|
2425 | WRITE_CODE( slice->getPocLsbVal(), slice->getSPS()->getBitsForPOC(), "poc_lsb_val"); |
---|
2426 | } |
---|
2427 | |
---|
2428 | if( !slice->getPocMsbValRequiredFlag() /* && vps_poc_lsb_aligned_flag */ ) |
---|
2429 | { |
---|
2430 | WRITE_FLAG( slice->getPocMsbValPresentFlag(), "poc_msb_val_present_flag" ); |
---|
2431 | } |
---|
2432 | if( slice->getPocMsbValPresentFlag() ) |
---|
2433 | { |
---|
2434 | assert( slice->getPocMsbVal() % maxPocLsb == 0 ); |
---|
2435 | WRITE_UVLC( slice->getPocMsbVal() / maxPocLsb, "poc_msb_val" ); |
---|
2436 | } |
---|
2437 | for (Int i = 0; i < shExtnAdditionalBits; i++) |
---|
2438 | { |
---|
2439 | #if Q0146_SSH_EXT_DATA_BIT |
---|
2440 | WRITE_FLAG( 1, "slice_segment_header_extension_data_bit"); |
---|
2441 | #else |
---|
2442 | WRITE_FLAG( 1, "slice_segment_header_extension_reserved_bit"); |
---|
2443 | #endif |
---|
2444 | } |
---|
2445 | } |
---|
2446 | shBitsWrittenTillNow += ( getNumberOfWrittenBits() - tmpBitsBeforeWriting ); |
---|
2447 | |
---|
2448 | // Slice header byte_alignment() included in xAttachSliceDataToNalUnit |
---|
2449 | } |
---|
2450 | #endif |
---|
2451 | |
---|
2452 | Void TEncCavlc::codeTerminatingBit ( UInt uilsLast ) |
---|
2453 | { |
---|
2454 | } |
---|
2455 | |
---|
2456 | Void TEncCavlc::codeSliceFinish () |
---|
2457 | { |
---|
2458 | } |
---|
2459 | |
---|
2460 | Void TEncCavlc::codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ) |
---|
2461 | { |
---|
2462 | assert(0); |
---|
2463 | } |
---|
2464 | |
---|
2465 | Void TEncCavlc::codePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2466 | { |
---|
2467 | assert(0); |
---|
2468 | } |
---|
2469 | |
---|
2470 | Void TEncCavlc::codePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
2471 | { |
---|
2472 | assert(0); |
---|
2473 | } |
---|
2474 | |
---|
2475 | Void TEncCavlc::codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
2476 | { |
---|
2477 | assert(0); |
---|
2478 | } |
---|
2479 | |
---|
2480 | Void TEncCavlc::codeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
2481 | { |
---|
2482 | assert(0); |
---|
2483 | } |
---|
2484 | |
---|
2485 | Void TEncCavlc::codeInterModeFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiEncMode ) |
---|
2486 | { |
---|
2487 | assert(0); |
---|
2488 | } |
---|
2489 | |
---|
2490 | Void TEncCavlc::codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
2491 | { |
---|
2492 | assert(0); |
---|
2493 | } |
---|
2494 | |
---|
2495 | Void TEncCavlc::codeSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
2496 | { |
---|
2497 | assert(0); |
---|
2498 | } |
---|
2499 | |
---|
2500 | Void TEncCavlc::codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2501 | { |
---|
2502 | assert(0); |
---|
2503 | } |
---|
2504 | |
---|
2505 | Void TEncCavlc::codeTransformSubdivFlag( UInt uiSymbol, UInt uiCtx ) |
---|
2506 | { |
---|
2507 | assert(0); |
---|
2508 | } |
---|
2509 | |
---|
2510 | Void TEncCavlc::codeQtCbf( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth ) |
---|
2511 | { |
---|
2512 | assert(0); |
---|
2513 | } |
---|
2514 | |
---|
2515 | Void TEncCavlc::codeQtRootCbf( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
2516 | { |
---|
2517 | assert(0); |
---|
2518 | } |
---|
2519 | |
---|
2520 | Void TEncCavlc::codeQtCbfZero( TComDataCU* pcCU, TextType eType, UInt uiTrDepth ) |
---|
2521 | { |
---|
2522 | assert(0); |
---|
2523 | } |
---|
2524 | Void TEncCavlc::codeQtRootCbfZero( TComDataCU* pcCU ) |
---|
2525 | { |
---|
2526 | assert(0); |
---|
2527 | } |
---|
2528 | |
---|
2529 | Void TEncCavlc::codeTransformSkipFlags (TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, TextType eTType ) |
---|
2530 | { |
---|
2531 | assert(0); |
---|
2532 | } |
---|
2533 | |
---|
2534 | /** Code I_PCM information. |
---|
2535 | * \param pcCU pointer to CU |
---|
2536 | * \param uiAbsPartIdx CU index |
---|
2537 | * \returns Void |
---|
2538 | */ |
---|
2539 | Void TEncCavlc::codeIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
2540 | { |
---|
2541 | assert(0); |
---|
2542 | } |
---|
2543 | |
---|
2544 | Void TEncCavlc::codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool isMultiple) |
---|
2545 | { |
---|
2546 | assert(0); |
---|
2547 | } |
---|
2548 | |
---|
2549 | Void TEncCavlc::codeIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
2550 | { |
---|
2551 | assert(0); |
---|
2552 | } |
---|
2553 | |
---|
2554 | Void TEncCavlc::codeInterDir( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
2555 | { |
---|
2556 | assert(0); |
---|
2557 | } |
---|
2558 | |
---|
2559 | Void TEncCavlc::codeRefFrmIdx( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ) |
---|
2560 | { |
---|
2561 | assert(0); |
---|
2562 | } |
---|
2563 | |
---|
2564 | Void TEncCavlc::codeMvd( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ) |
---|
2565 | { |
---|
2566 | assert(0); |
---|
2567 | } |
---|
2568 | |
---|
2569 | Void TEncCavlc::codeDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
2570 | { |
---|
2571 | Int iDQp = pcCU->getQP( uiAbsPartIdx ) - pcCU->getRefQP( uiAbsPartIdx ); |
---|
2572 | |
---|
2573 | #if REPN_FORMAT_IN_VPS |
---|
2574 | Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffsetY(); |
---|
2575 | #else |
---|
2576 | Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); |
---|
2577 | #endif |
---|
2578 | iDQp = (iDQp + 78 + qpBdOffsetY + (qpBdOffsetY/2)) % (52 + qpBdOffsetY) - 26 - (qpBdOffsetY/2); |
---|
2579 | |
---|
2580 | xWriteSvlc( iDQp ); |
---|
2581 | |
---|
2582 | return; |
---|
2583 | } |
---|
2584 | |
---|
2585 | Void TEncCavlc::codeCoeffNxN ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ) |
---|
2586 | { |
---|
2587 | assert(0); |
---|
2588 | } |
---|
2589 | |
---|
2590 | Void TEncCavlc::estBit( estBitsSbacStruct* pcEstBitsCabac, Int width, Int height, TextType eTType ) |
---|
2591 | { |
---|
2592 | // printf("error : no VLC mode support in this version\n"); |
---|
2593 | return; |
---|
2594 | } |
---|
2595 | |
---|
2596 | // ==================================================================================================================== |
---|
2597 | // Protected member functions |
---|
2598 | // ==================================================================================================================== |
---|
2599 | |
---|
2600 | /** code explicit wp tables |
---|
2601 | * \param TComSlice* pcSlice |
---|
2602 | * \returns Void |
---|
2603 | */ |
---|
2604 | Void TEncCavlc::xCodePredWeightTable( TComSlice* pcSlice ) |
---|
2605 | { |
---|
2606 | wpScalingParam *wp; |
---|
2607 | Bool bChroma = true; // color always present in HEVC ? |
---|
2608 | Int iNbRef = (pcSlice->getSliceType() == B_SLICE ) ? (2) : (1); |
---|
2609 | Bool bDenomCoded = false; |
---|
2610 | UInt uiMode = 0; |
---|
2611 | UInt uiTotalSignalledWeightFlags = 0; |
---|
2612 | #if AUXILIARY_PICTURES |
---|
2613 | if (pcSlice->getChromaFormatIdc() == CHROMA_400) |
---|
2614 | { |
---|
2615 | bChroma = false; |
---|
2616 | } |
---|
2617 | #endif |
---|
2618 | if ( (pcSlice->getSliceType()==P_SLICE && pcSlice->getPPS()->getUseWP()) || (pcSlice->getSliceType()==B_SLICE && pcSlice->getPPS()->getWPBiPred()) ) |
---|
2619 | { |
---|
2620 | uiMode = 1; // explicit |
---|
2621 | } |
---|
2622 | if(uiMode == 1) |
---|
2623 | { |
---|
2624 | |
---|
2625 | for ( Int iNumRef=0 ; iNumRef<iNbRef ; iNumRef++ ) |
---|
2626 | { |
---|
2627 | RefPicList eRefPicList = ( iNumRef ? REF_PIC_LIST_1 : REF_PIC_LIST_0 ); |
---|
2628 | |
---|
2629 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
2630 | { |
---|
2631 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
2632 | if ( !bDenomCoded ) |
---|
2633 | { |
---|
2634 | Int iDeltaDenom; |
---|
2635 | WRITE_UVLC( wp[0].uiLog2WeightDenom, "luma_log2_weight_denom" ); // ue(v): luma_log2_weight_denom |
---|
2636 | |
---|
2637 | if( bChroma ) |
---|
2638 | { |
---|
2639 | iDeltaDenom = (wp[1].uiLog2WeightDenom - wp[0].uiLog2WeightDenom); |
---|
2640 | WRITE_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); // se(v): delta_chroma_log2_weight_denom |
---|
2641 | } |
---|
2642 | bDenomCoded = true; |
---|
2643 | } |
---|
2644 | WRITE_FLAG( wp[0].bPresentFlag, "luma_weight_lX_flag" ); // u(1): luma_weight_lX_flag |
---|
2645 | uiTotalSignalledWeightFlags += wp[0].bPresentFlag; |
---|
2646 | } |
---|
2647 | if (bChroma) |
---|
2648 | { |
---|
2649 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
2650 | { |
---|
2651 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
2652 | WRITE_FLAG( wp[1].bPresentFlag, "chroma_weight_lX_flag" ); // u(1): chroma_weight_lX_flag |
---|
2653 | uiTotalSignalledWeightFlags += 2*wp[1].bPresentFlag; |
---|
2654 | } |
---|
2655 | } |
---|
2656 | |
---|
2657 | for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ ) |
---|
2658 | { |
---|
2659 | pcSlice->getWpScaling(eRefPicList, iRefIdx, wp); |
---|
2660 | if ( wp[0].bPresentFlag ) |
---|
2661 | { |
---|
2662 | Int iDeltaWeight = (wp[0].iWeight - (1<<wp[0].uiLog2WeightDenom)); |
---|
2663 | WRITE_SVLC( iDeltaWeight, "delta_luma_weight_lX" ); // se(v): delta_luma_weight_lX |
---|
2664 | WRITE_SVLC( wp[0].iOffset, "luma_offset_lX" ); // se(v): luma_offset_lX |
---|
2665 | } |
---|
2666 | |
---|
2667 | if ( bChroma ) |
---|
2668 | { |
---|
2669 | if ( wp[1].bPresentFlag ) |
---|
2670 | { |
---|
2671 | for ( Int j=1 ; j<3 ; j++ ) |
---|
2672 | { |
---|
2673 | Int iDeltaWeight = (wp[j].iWeight - (1<<wp[1].uiLog2WeightDenom)); |
---|
2674 | WRITE_SVLC( iDeltaWeight, "delta_chroma_weight_lX" ); // se(v): delta_chroma_weight_lX |
---|
2675 | |
---|
2676 | Int pred = ( 128 - ( ( 128*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); |
---|
2677 | Int iDeltaChroma = (wp[j].iOffset - pred); |
---|
2678 | WRITE_SVLC( iDeltaChroma, "delta_chroma_offset_lX" ); // se(v): delta_chroma_offset_lX |
---|
2679 | } |
---|
2680 | } |
---|
2681 | } |
---|
2682 | } |
---|
2683 | } |
---|
2684 | assert(uiTotalSignalledWeightFlags<=24); |
---|
2685 | } |
---|
2686 | } |
---|
2687 | |
---|
2688 | /** code quantization matrix |
---|
2689 | * \param scalingList quantization matrix information |
---|
2690 | */ |
---|
2691 | Void TEncCavlc::codeScalingList( TComScalingList* scalingList ) |
---|
2692 | { |
---|
2693 | UInt listId,sizeId; |
---|
2694 | Bool scalingListPredModeFlag; |
---|
2695 | |
---|
2696 | //for each size |
---|
2697 | for(sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++) |
---|
2698 | { |
---|
2699 | for(listId = 0; listId < g_scalingListNum[sizeId]; listId++) |
---|
2700 | { |
---|
2701 | scalingListPredModeFlag = scalingList->checkPredMode( sizeId, listId ); |
---|
2702 | WRITE_FLAG( scalingListPredModeFlag, "scaling_list_pred_mode_flag" ); |
---|
2703 | if(!scalingListPredModeFlag)// Copy Mode |
---|
2704 | { |
---|
2705 | WRITE_UVLC( (Int)listId - (Int)scalingList->getRefMatrixId (sizeId,listId), "scaling_list_pred_matrix_id_delta"); |
---|
2706 | } |
---|
2707 | else// DPCM Mode |
---|
2708 | { |
---|
2709 | xCodeScalingList(scalingList, sizeId, listId); |
---|
2710 | } |
---|
2711 | } |
---|
2712 | } |
---|
2713 | return; |
---|
2714 | } |
---|
2715 | /** code DPCM |
---|
2716 | * \param scalingList quantization matrix information |
---|
2717 | * \param sizeIdc size index |
---|
2718 | * \param listIdc list index |
---|
2719 | */ |
---|
2720 | Void TEncCavlc::xCodeScalingList(TComScalingList* scalingList, UInt sizeId, UInt listId) |
---|
2721 | { |
---|
2722 | Int coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]); |
---|
2723 | UInt* scan = (sizeId == 0) ? g_auiSigLastScan [ SCAN_DIAG ] [ 1 ] : g_sigLastScanCG32x32; |
---|
2724 | Int nextCoef = SCALING_LIST_START_VALUE; |
---|
2725 | Int data; |
---|
2726 | Int *src = scalingList->getScalingListAddress(sizeId, listId); |
---|
2727 | if( sizeId > SCALING_LIST_8x8 ) |
---|
2728 | { |
---|
2729 | WRITE_SVLC( scalingList->getScalingListDC(sizeId,listId) - 8, "scaling_list_dc_coef_minus8"); |
---|
2730 | nextCoef = scalingList->getScalingListDC(sizeId,listId); |
---|
2731 | } |
---|
2732 | for(Int i=0;i<coefNum;i++) |
---|
2733 | { |
---|
2734 | data = src[scan[i]] - nextCoef; |
---|
2735 | nextCoef = src[scan[i]]; |
---|
2736 | if(data > 127) |
---|
2737 | { |
---|
2738 | data = data - 256; |
---|
2739 | } |
---|
2740 | if(data < -128) |
---|
2741 | { |
---|
2742 | data = data + 256; |
---|
2743 | } |
---|
2744 | |
---|
2745 | WRITE_SVLC( data, "scaling_list_delta_coef"); |
---|
2746 | } |
---|
2747 | } |
---|
2748 | Bool TEncCavlc::findMatchingLTRP ( TComSlice* pcSlice, UInt *ltrpsIndex, Int ltrpPOC, Bool usedFlag ) |
---|
2749 | { |
---|
2750 | // Bool state = true, state2 = false; |
---|
2751 | Int lsb = ltrpPOC & ((1<<pcSlice->getSPS()->getBitsForPOC())-1); |
---|
2752 | for (Int k = 0; k < pcSlice->getSPS()->getNumLongTermRefPicSPS(); k++) |
---|
2753 | { |
---|
2754 | if ( (lsb == pcSlice->getSPS()->getLtRefPicPocLsbSps(k)) && (usedFlag == pcSlice->getSPS()->getUsedByCurrPicLtSPSFlag(k)) ) |
---|
2755 | { |
---|
2756 | *ltrpsIndex = k; |
---|
2757 | return true; |
---|
2758 | } |
---|
2759 | } |
---|
2760 | return false; |
---|
2761 | } |
---|
2762 | Bool TComScalingList::checkPredMode(UInt sizeId, UInt listId) |
---|
2763 | { |
---|
2764 | for(Int predListIdx = (Int)listId ; predListIdx >= 0; predListIdx--) |
---|
2765 | { |
---|
2766 | if( !memcmp(getScalingListAddress(sizeId,listId),((listId == predListIdx) ? |
---|
2767 | getScalingListDefaultAddress(sizeId, predListIdx): getScalingListAddress(sizeId, predListIdx)),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix |
---|
2768 | && ((sizeId < SCALING_LIST_16x16) || (getScalingListDC(sizeId,listId) == getScalingListDC(sizeId,predListIdx)))) // check DC value |
---|
2769 | { |
---|
2770 | setRefMatrixId(sizeId, listId, predListIdx); |
---|
2771 | return false; |
---|
2772 | } |
---|
2773 | } |
---|
2774 | return true; |
---|
2775 | } |
---|
2776 | |
---|
2777 | #if Q0048_CGS_3D_ASYMLUT |
---|
2778 | Void TEncCavlc::xCode3DAsymLUT( TCom3DAsymLUT * pc3DAsymLUT ) |
---|
2779 | { |
---|
2780 | #if R0150_CGS_SIGNAL_CONSTRAINTS |
---|
2781 | UInt uiNumRefLayers = ( UInt )pc3DAsymLUT->getRefLayerNum(); |
---|
2782 | WRITE_UVLC( uiNumRefLayers - 1 , "num_cm_ref_layers_minus1" ); |
---|
2783 | for( UInt i = 0 ; i < uiNumRefLayers ; i++ ) |
---|
2784 | { |
---|
2785 | WRITE_CODE( pc3DAsymLUT->getRefLayerId( i ) , 6 , "cm_ref_layer_id" ); |
---|
2786 | } |
---|
2787 | #endif |
---|
2788 | assert( pc3DAsymLUT->getCurOctantDepth() < 4 ); |
---|
2789 | WRITE_CODE( pc3DAsymLUT->getCurOctantDepth() , 2 , "cm_octant_depth" ); |
---|
2790 | assert( pc3DAsymLUT->getCurYPartNumLog2() < 4 ); |
---|
2791 | WRITE_CODE( pc3DAsymLUT->getCurYPartNumLog2() , 2 , "cm_y_part_num_log2" ); |
---|
2792 | assert( pc3DAsymLUT->getInputBitDepthY() < 16 ); |
---|
2793 | #if R0150_CGS_SIGNAL_CONSTRAINTS |
---|
2794 | WRITE_CODE( pc3DAsymLUT->getInputBitDepthY() - 8 , 3 , "cm_input_luma_bit_depth_minus8" ); |
---|
2795 | WRITE_CODE( pc3DAsymLUT->getInputBitDepthC() - 8 , 3 , "cm_input_chroma_bit_depth_minus8" ); |
---|
2796 | WRITE_CODE( pc3DAsymLUT->getOutputBitDepthY() - 8 , 3 , "cm_output_luma_bit_depth_minus8" ); |
---|
2797 | WRITE_CODE( pc3DAsymLUT->getOutputBitDepthC() - 8 , 3 , "cm_output_chroma_bit_depth_minus8" ); |
---|
2798 | #else |
---|
2799 | WRITE_CODE( pc3DAsymLUT->getInputBitDepthY() - 8 , 3 , "cm_input_bit_depth_minus8" ); |
---|
2800 | WRITE_SVLC(pc3DAsymLUT->getInputBitDepthC()-pc3DAsymLUT->getInputBitDepthY(), "cm_input_bit_depth_chroma delta"); |
---|
2801 | assert( pc3DAsymLUT->getOutputBitDepthY() < 16 ); |
---|
2802 | WRITE_CODE( pc3DAsymLUT->getOutputBitDepthY() - 8 , 3 , "cm_output_bit_depth_minus8" ); |
---|
2803 | WRITE_SVLC(pc3DAsymLUT->getOutputBitDepthC()-pc3DAsymLUT->getOutputBitDepthY(), "cm_output_bit_depth_chroma_delta"); |
---|
2804 | #endif |
---|
2805 | assert( pc3DAsymLUT->getResQuantBit() < 4 ); |
---|
2806 | WRITE_CODE( pc3DAsymLUT->getResQuantBit() , 2 , "cm_res_quant_bit" ); |
---|
2807 | #if R0300_CGS_RES_COEFF_CODING |
---|
2808 | xFindDeltaBits( pc3DAsymLUT ); |
---|
2809 | assert(pc3DAsymLUT->getDeltaBits() >=1 && pc3DAsymLUT->getDeltaBits() <= 4); |
---|
2810 | WRITE_CODE( pc3DAsymLUT->getDeltaBits()-1 , 2 , "cm_delta_bit" ); |
---|
2811 | #endif |
---|
2812 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
2813 | if( pc3DAsymLUT->getCurOctantDepth() == 1 ) |
---|
2814 | { |
---|
2815 | WRITE_SVLC( pc3DAsymLUT->getAdaptChromaThresholdU() - ( 1 << ( pc3DAsymLUT->getInputBitDepthC() - 1 ) ) , "cm_adapt_threshold_u_delta" ); |
---|
2816 | WRITE_SVLC( pc3DAsymLUT->getAdaptChromaThresholdV() - ( 1 << ( pc3DAsymLUT->getInputBitDepthC() - 1 ) ) , "cm_adapt_threshold_v_delta" ); |
---|
2817 | } |
---|
2818 | #endif |
---|
2819 | |
---|
2820 | #if R0164_CGS_LUT_BUGFIX |
---|
2821 | pc3DAsymLUT->xInitCuboids(); |
---|
2822 | #endif |
---|
2823 | xCode3DAsymLUTOctant( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth() ); |
---|
2824 | #if R0164_CGS_LUT_BUGFIX |
---|
2825 | pc3DAsymLUT->xCuboidsExplicitCheck( false ); |
---|
2826 | #endif |
---|
2827 | } |
---|
2828 | |
---|
2829 | Void TEncCavlc::xCode3DAsymLUTOctant( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength ) |
---|
2830 | { |
---|
2831 | UInt uiOctantSplit = nDepth < pc3DAsymLUT->getCurOctantDepth(); |
---|
2832 | if( nDepth < pc3DAsymLUT->getCurOctantDepth() ) |
---|
2833 | WRITE_FLAG( uiOctantSplit , "split_octant_flag" ); |
---|
2834 | Int nYPartNum = 1 << pc3DAsymLUT->getCurYPartNumLog2(); |
---|
2835 | if( uiOctantSplit ) |
---|
2836 | { |
---|
2837 | Int nHalfLength = nLength >> 1; |
---|
2838 | for( Int l = 0 ; l < 2 ; l++ ) |
---|
2839 | { |
---|
2840 | for( Int m = 0 ; m < 2 ; m++ ) |
---|
2841 | { |
---|
2842 | for( Int n = 0 ; n < 2 ; n++ ) |
---|
2843 | { |
---|
2844 | xCode3DAsymLUTOctant( pc3DAsymLUT , nDepth + 1 , yIdx + l * nHalfLength * nYPartNum , uIdx + m * nHalfLength , vIdx + n * nHalfLength , nHalfLength ); |
---|
2845 | } |
---|
2846 | } |
---|
2847 | } |
---|
2848 | } |
---|
2849 | else |
---|
2850 | { |
---|
2851 | #if R0300_CGS_RES_COEFF_CODING |
---|
2852 | Int nFLCbits = pc3DAsymLUT->getMappingShift()-pc3DAsymLUT->getResQuantBit()-pc3DAsymLUT->getDeltaBits() ; |
---|
2853 | nFLCbits = nFLCbits >= 0 ? nFLCbits : 0; |
---|
2854 | #endif |
---|
2855 | for( Int l = 0 ; l < nYPartNum ; l++ ) |
---|
2856 | { |
---|
2857 | #if R0164_CGS_LUT_BUGFIX |
---|
2858 | Int shift = pc3DAsymLUT->getMaxOctantDepth() - nDepth ; |
---|
2859 | #endif |
---|
2860 | for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) |
---|
2861 | { |
---|
2862 | #if R0164_CGS_LUT_BUGFIX |
---|
2863 | SYUVP sRes = pc3DAsymLUT->getCuboidVertexResTree( yIdx + (l<<shift) , uIdx , vIdx , nVertexIdx ); |
---|
2864 | #else |
---|
2865 | SYUVP sRes = pc3DAsymLUT->getCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx ); |
---|
2866 | #endif |
---|
2867 | UInt uiCodeVertex = sRes.Y != 0 || sRes.U != 0 || sRes.V != 0; |
---|
2868 | WRITE_FLAG( uiCodeVertex , "coded_vertex_flag" ); |
---|
2869 | if( uiCodeVertex ) |
---|
2870 | { |
---|
2871 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
2872 | #if R0300_CGS_RES_COEFF_CODING |
---|
2873 | xWriteParam( sRes.Y, nFLCbits ); |
---|
2874 | xWriteParam( sRes.U, nFLCbits ); |
---|
2875 | xWriteParam( sRes.V, nFLCbits ); |
---|
2876 | #else |
---|
2877 | xWriteParam( sRes.Y ); |
---|
2878 | xWriteParam( sRes.U ); |
---|
2879 | xWriteParam( sRes.V ); |
---|
2880 | #endif |
---|
2881 | #else |
---|
2882 | WRITE_SVLC( sRes.Y , "resY" ); |
---|
2883 | WRITE_SVLC( sRes.U , "resU" ); |
---|
2884 | WRITE_SVLC( sRes.V , "resV" ); |
---|
2885 | #endif |
---|
2886 | } |
---|
2887 | } |
---|
2888 | #if R0164_CGS_LUT_BUGFIX |
---|
2889 | pc3DAsymLUT->xSetExplicit( yIdx + (l<<shift) , uIdx , vIdx ); |
---|
2890 | #endif |
---|
2891 | } |
---|
2892 | } |
---|
2893 | } |
---|
2894 | |
---|
2895 | #if R0151_CGS_3D_ASYMLUT_IMPROVE |
---|
2896 | #if R0300_CGS_RES_COEFF_CODING |
---|
2897 | Void TEncCavlc::xWriteParam( Int param, UInt rParam) |
---|
2898 | #else |
---|
2899 | Void TEncCavlc::xWriteParam( Int param) |
---|
2900 | #endif |
---|
2901 | { |
---|
2902 | #if !R0300_CGS_RES_COEFF_CODING |
---|
2903 | const UInt rParam = 7; |
---|
2904 | #endif |
---|
2905 | Int codeNumber = abs(param); |
---|
2906 | WRITE_UVLC(codeNumber / (1 << rParam), "quotient"); |
---|
2907 | WRITE_CODE((codeNumber % (1 << rParam)), rParam, "remainder"); |
---|
2908 | if (abs(param)) |
---|
2909 | WRITE_FLAG( param <0, "sign"); |
---|
2910 | } |
---|
2911 | #endif |
---|
2912 | |
---|
2913 | #if R0300_CGS_RES_COEFF_CODING |
---|
2914 | Void TEncCavlc::xFindDeltaBits( TCom3DAsymLUT * pc3DAsymLUT ) |
---|
2915 | { |
---|
2916 | Int nDeltaBits; |
---|
2917 | Int nBestDeltaBits = -1; |
---|
2918 | Int nBestBits = MAX_INT; |
---|
2919 | for( nDeltaBits = 1; nDeltaBits < 5; nDeltaBits++) |
---|
2920 | { |
---|
2921 | Int nCurBits = 0; |
---|
2922 | xTally3DAsymLUTOctantBits( pc3DAsymLUT , 0 , 0 , 0 , 0 , 1 << pc3DAsymLUT->getCurOctantDepth(), nDeltaBits, nCurBits ); |
---|
2923 | //printf("%d, %d, %d\n", nDeltaBits, nCurBits, nBestBits); |
---|
2924 | if(nCurBits < nBestBits) |
---|
2925 | { |
---|
2926 | nBestDeltaBits = nDeltaBits; |
---|
2927 | nBestBits = nCurBits; |
---|
2928 | } |
---|
2929 | } |
---|
2930 | |
---|
2931 | assert(nBestDeltaBits >=1 && nBestDeltaBits < 5); |
---|
2932 | pc3DAsymLUT->setDeltaBits(nBestDeltaBits); |
---|
2933 | } |
---|
2934 | |
---|
2935 | Void TEncCavlc::xTally3DAsymLUTOctantBits( TCom3DAsymLUT * pc3DAsymLUT , Int nDepth , Int yIdx , Int uIdx , Int vIdx , Int nLength, Int nDeltaBits, Int& nCurBits ) |
---|
2936 | { |
---|
2937 | UInt uiOctantSplit = nDepth < pc3DAsymLUT->getCurOctantDepth(); |
---|
2938 | if( nDepth < pc3DAsymLUT->getCurOctantDepth() ) |
---|
2939 | nCurBits ++; |
---|
2940 | Int nYPartNum = 1 << pc3DAsymLUT->getCurYPartNumLog2(); |
---|
2941 | if( uiOctantSplit ) |
---|
2942 | { |
---|
2943 | Int nHalfLength = nLength >> 1; |
---|
2944 | for( Int l = 0 ; l < 2 ; l++ ) |
---|
2945 | { |
---|
2946 | for( Int m = 0 ; m < 2 ; m++ ) |
---|
2947 | { |
---|
2948 | for( Int n = 0 ; n < 2 ; n++ ) |
---|
2949 | { |
---|
2950 | xTally3DAsymLUTOctantBits( pc3DAsymLUT , nDepth + 1 , yIdx + l * nHalfLength * nYPartNum , uIdx + m * nHalfLength , vIdx + n * nHalfLength , nHalfLength, nDeltaBits, nCurBits ); |
---|
2951 | } |
---|
2952 | } |
---|
2953 | } |
---|
2954 | } |
---|
2955 | else |
---|
2956 | { |
---|
2957 | Int nFLCbits = pc3DAsymLUT->getMappingShift()-pc3DAsymLUT->getResQuantBit()-nDeltaBits ; |
---|
2958 | nFLCbits = nFLCbits >= 0 ? nFLCbits:0; |
---|
2959 | //printf("nFLCbits = %d\n", nFLCbits); |
---|
2960 | |
---|
2961 | for( Int l = 0 ; l < nYPartNum ; l++ ) |
---|
2962 | { |
---|
2963 | for( Int nVertexIdx = 0 ; nVertexIdx < 4 ; nVertexIdx++ ) |
---|
2964 | { |
---|
2965 | SYUVP sRes = pc3DAsymLUT->getCuboidVertexResTree( yIdx + l , uIdx , vIdx , nVertexIdx ); |
---|
2966 | |
---|
2967 | UInt uiCodeVertex = sRes.Y != 0 || sRes.U != 0 || sRes.V != 0; |
---|
2968 | nCurBits++; |
---|
2969 | if( uiCodeVertex ) |
---|
2970 | { |
---|
2971 | xCheckParamBits( sRes.Y, nFLCbits, nCurBits ); |
---|
2972 | xCheckParamBits( sRes.U, nFLCbits, nCurBits ); |
---|
2973 | xCheckParamBits( sRes.V, nFLCbits, nCurBits ); |
---|
2974 | } |
---|
2975 | } |
---|
2976 | } |
---|
2977 | } |
---|
2978 | } |
---|
2979 | |
---|
2980 | Void TEncCavlc::xCheckParamBits( Int param, Int rParam, Int &nBits) |
---|
2981 | { |
---|
2982 | Int codeNumber = abs(param); |
---|
2983 | Int codeQuotient = codeNumber >> rParam; |
---|
2984 | Int qLen; |
---|
2985 | |
---|
2986 | UInt uiLength = 1; |
---|
2987 | UInt uiTemp = ++codeQuotient; |
---|
2988 | |
---|
2989 | while( 1 != uiTemp ) |
---|
2990 | { |
---|
2991 | uiTemp >>= 1; |
---|
2992 | uiLength += 2; |
---|
2993 | } |
---|
2994 | |
---|
2995 | qLen = (uiLength >> 1); |
---|
2996 | qLen += ((uiLength+1) >> 1); |
---|
2997 | |
---|
2998 | nBits += qLen; |
---|
2999 | nBits += rParam; |
---|
3000 | if (abs(param)) |
---|
3001 | nBits++; |
---|
3002 | } |
---|
3003 | #endif |
---|
3004 | |
---|
3005 | #endif |
---|
3006 | //! \} |
---|