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-2013, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file TDecSbac.cpp |
---|
35 | \brief Context-adaptive entropy decoder class |
---|
36 | */ |
---|
37 | |
---|
38 | #include "TDecSbac.h" |
---|
39 | |
---|
40 | //! \ingroup TLibDecoder |
---|
41 | //! \{ |
---|
42 | |
---|
43 | ////////////////////////////////////////////////////////////////////// |
---|
44 | // Construction/Destruction |
---|
45 | ////////////////////////////////////////////////////////////////////// |
---|
46 | |
---|
47 | TDecSbac::TDecSbac() |
---|
48 | // new structure here |
---|
49 | : m_pcBitstream ( 0 ) |
---|
50 | , m_pcTDecBinIf ( NULL ) |
---|
51 | , m_numContextModels ( 0 ) |
---|
52 | , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels ) |
---|
53 | , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
54 | , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
55 | , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
56 | #if H_3D_ARP |
---|
57 | , m_cCUPUARPW ( 1, 1, NUM_ARPW_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
58 | #endif |
---|
59 | #if H_3D_IC |
---|
60 | , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
61 | #endif |
---|
62 | , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
63 | , m_cCUPredModeSCModel ( 1, 1, NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
64 | , m_cCUIntraPredSCModel ( 1, 1, NUM_ADI_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
65 | , m_cCUChromaPredSCModel ( 1, 1, NUM_CHROMA_PRED_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
66 | , m_cCUDeltaQpSCModel ( 1, 1, NUM_DELTA_QP_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
67 | , m_cCUInterDirSCModel ( 1, 1, NUM_INTER_DIR_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
68 | , m_cCURefPicSCModel ( 1, 1, NUM_REF_NO_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
69 | , m_cCUMvdSCModel ( 1, 1, NUM_MV_RES_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
70 | , m_cCUQtCbfSCModel ( 1, 2, NUM_QT_CBF_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
71 | , m_cCUTransSubdivFlagSCModel ( 1, 1, NUM_TRANS_SUBDIV_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
72 | , m_cCUQtRootCbfSCModel ( 1, 1, NUM_QT_ROOT_CBF_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
73 | , m_cCUSigCoeffGroupSCModel ( 1, 2, NUM_SIG_CG_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
74 | , m_cCUSigSCModel ( 1, 1, NUM_SIG_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
75 | , m_cCuCtxLastX ( 1, 2, NUM_CTX_LAST_FLAG_XY , m_contextModels + m_numContextModels, m_numContextModels) |
---|
76 | , m_cCuCtxLastY ( 1, 2, NUM_CTX_LAST_FLAG_XY , m_contextModels + m_numContextModels, m_numContextModels) |
---|
77 | , m_cCUOneSCModel ( 1, 1, NUM_ONE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
78 | , m_cCUAbsSCModel ( 1, 1, NUM_ABS_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
79 | , m_cMVPIdxSCModel ( 1, 1, NUM_MVP_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
80 | , m_cCUAMPSCModel ( 1, 1, NUM_CU_AMP_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
81 | , m_cSaoMergeSCModel ( 1, 1, NUM_SAO_MERGE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
82 | , m_cSaoTypeIdxSCModel ( 1, 1, NUM_SAO_TYPE_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
83 | , m_cTransformSkipSCModel ( 1, 2, NUM_TRANSFORMSKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
84 | , m_CUTransquantBypassFlagSCModel( 1, 1, NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX, m_contextModels + m_numContextModels, m_numContextModels) |
---|
85 | { |
---|
86 | assert( m_numContextModels <= MAX_NUM_CTX_MOD ); |
---|
87 | } |
---|
88 | |
---|
89 | TDecSbac::~TDecSbac() |
---|
90 | { |
---|
91 | } |
---|
92 | |
---|
93 | // ==================================================================================================================== |
---|
94 | // Public member functions |
---|
95 | // ==================================================================================================================== |
---|
96 | |
---|
97 | Void TDecSbac::resetEntropy(TComSlice* pSlice) |
---|
98 | { |
---|
99 | SliceType sliceType = pSlice->getSliceType(); |
---|
100 | Int qp = pSlice->getSliceQp(); |
---|
101 | |
---|
102 | if (pSlice->getPPS()->getCabacInitPresentFlag() && pSlice->getCabacInitFlag()) |
---|
103 | { |
---|
104 | switch (sliceType) |
---|
105 | { |
---|
106 | case P_SLICE: // change initialization table to B_SLICE initialization |
---|
107 | sliceType = B_SLICE; |
---|
108 | break; |
---|
109 | case B_SLICE: // change initialization table to P_SLICE initialization |
---|
110 | sliceType = P_SLICE; |
---|
111 | break; |
---|
112 | default : // should not occur |
---|
113 | assert(0); |
---|
114 | } |
---|
115 | } |
---|
116 | |
---|
117 | m_cCUSplitFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SPLIT_FLAG ); |
---|
118 | m_cCUSkipFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SKIP_FLAG ); |
---|
119 | m_cCUMergeFlagExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT ); |
---|
120 | m_cCUMergeIdxExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_IDX_EXT ); |
---|
121 | #if H_3D_ARP |
---|
122 | m_cCUPUARPW.initBuffer ( sliceType, qp, (UChar*)INIT_ARPW ); |
---|
123 | #endif |
---|
124 | #if H_3D_IC |
---|
125 | m_cCUICFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_IC_FLAG ); |
---|
126 | #endif |
---|
127 | m_cCUPartSizeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PART_SIZE ); |
---|
128 | m_cCUAMPSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CU_AMP_POS ); |
---|
129 | m_cCUPredModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PRED_MODE ); |
---|
130 | m_cCUIntraPredSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTRA_PRED_MODE ); |
---|
131 | m_cCUChromaPredSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CHROMA_PRED_MODE ); |
---|
132 | m_cCUInterDirSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_DIR ); |
---|
133 | m_cCUMvdSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MVD ); |
---|
134 | m_cCURefPicSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_REF_PIC ); |
---|
135 | m_cCUDeltaQpSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DQP ); |
---|
136 | m_cCUQtCbfSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_QT_CBF ); |
---|
137 | m_cCUQtRootCbfSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_QT_ROOT_CBF ); |
---|
138 | m_cCUSigCoeffGroupSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SIG_CG_FLAG ); |
---|
139 | m_cCUSigSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SIG_FLAG ); |
---|
140 | m_cCuCtxLastX.initBuffer ( sliceType, qp, (UChar*)INIT_LAST ); |
---|
141 | m_cCuCtxLastY.initBuffer ( sliceType, qp, (UChar*)INIT_LAST ); |
---|
142 | m_cCUOneSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ONE_FLAG ); |
---|
143 | m_cCUAbsSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ABS_FLAG ); |
---|
144 | m_cMVPIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MVP_IDX ); |
---|
145 | m_cSaoMergeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_MERGE_FLAG ); |
---|
146 | m_cSaoTypeIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_TYPE_IDX ); |
---|
147 | |
---|
148 | m_cCUTransSubdivFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); |
---|
149 | m_cTransformSkipSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); |
---|
150 | m_CUTransquantBypassFlagSCModel.initBuffer( sliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); |
---|
151 | m_uiLastDQpNonZero = 0; |
---|
152 | |
---|
153 | // new structure |
---|
154 | m_uiLastQp = qp; |
---|
155 | |
---|
156 | m_pcTDecBinIf->start(); |
---|
157 | } |
---|
158 | |
---|
159 | /** The function does the following: Read out terminate bit. Flush CABAC. Byte-align for next tile. |
---|
160 | * Intialize CABAC states. Start CABAC. |
---|
161 | */ |
---|
162 | Void TDecSbac::updateContextTables( SliceType eSliceType, Int iQp ) |
---|
163 | { |
---|
164 | UInt uiBit; |
---|
165 | m_pcTDecBinIf->decodeBinTrm(uiBit); |
---|
166 | m_pcTDecBinIf->finish(); |
---|
167 | m_pcBitstream->readOutTrailingBits(); |
---|
168 | m_cCUSplitFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SPLIT_FLAG ); |
---|
169 | m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); |
---|
170 | m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT ); |
---|
171 | m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT ); |
---|
172 | #if H_3D_ARP |
---|
173 | m_cCUPUARPW.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW ); |
---|
174 | #endif |
---|
175 | #if H_3D_IC |
---|
176 | m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG ); |
---|
177 | #endif |
---|
178 | m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); |
---|
179 | m_cCUAMPSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_CU_AMP_POS ); |
---|
180 | m_cCUPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PRED_MODE ); |
---|
181 | m_cCUIntraPredSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTRA_PRED_MODE ); |
---|
182 | m_cCUChromaPredSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_CHROMA_PRED_MODE ); |
---|
183 | m_cCUInterDirSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_DIR ); |
---|
184 | m_cCUMvdSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MVD ); |
---|
185 | m_cCURefPicSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_REF_PIC ); |
---|
186 | m_cCUDeltaQpSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DQP ); |
---|
187 | m_cCUQtCbfSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_QT_CBF ); |
---|
188 | m_cCUQtRootCbfSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_QT_ROOT_CBF ); |
---|
189 | m_cCUSigCoeffGroupSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SIG_CG_FLAG ); |
---|
190 | m_cCUSigSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SIG_FLAG ); |
---|
191 | m_cCuCtxLastX.initBuffer ( eSliceType, iQp, (UChar*)INIT_LAST ); |
---|
192 | m_cCuCtxLastY.initBuffer ( eSliceType, iQp, (UChar*)INIT_LAST ); |
---|
193 | m_cCUOneSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ONE_FLAG ); |
---|
194 | m_cCUAbsSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ABS_FLAG ); |
---|
195 | m_cMVPIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MVP_IDX ); |
---|
196 | m_cSaoMergeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_FLAG ); |
---|
197 | m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); |
---|
198 | m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); |
---|
199 | m_cTransformSkipSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); |
---|
200 | m_CUTransquantBypassFlagSCModel.initBuffer( eSliceType, iQp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); |
---|
201 | m_pcTDecBinIf->start(); |
---|
202 | } |
---|
203 | |
---|
204 | Void TDecSbac::parseTerminatingBit( UInt& ruiBit ) |
---|
205 | { |
---|
206 | m_pcTDecBinIf->decodeBinTrm( ruiBit ); |
---|
207 | } |
---|
208 | |
---|
209 | |
---|
210 | Void TDecSbac::xReadUnaryMaxSymbol( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol ) |
---|
211 | { |
---|
212 | if (uiMaxSymbol == 0) |
---|
213 | { |
---|
214 | ruiSymbol = 0; |
---|
215 | return; |
---|
216 | } |
---|
217 | |
---|
218 | m_pcTDecBinIf->decodeBin( ruiSymbol, pcSCModel[0] ); |
---|
219 | |
---|
220 | if( ruiSymbol == 0 || uiMaxSymbol == 1 ) |
---|
221 | { |
---|
222 | return; |
---|
223 | } |
---|
224 | |
---|
225 | UInt uiSymbol = 0; |
---|
226 | UInt uiCont; |
---|
227 | |
---|
228 | do |
---|
229 | { |
---|
230 | m_pcTDecBinIf->decodeBin( uiCont, pcSCModel[ iOffset ] ); |
---|
231 | uiSymbol++; |
---|
232 | } |
---|
233 | while( uiCont && ( uiSymbol < uiMaxSymbol - 1 ) ); |
---|
234 | |
---|
235 | if( uiCont && ( uiSymbol == uiMaxSymbol - 1 ) ) |
---|
236 | { |
---|
237 | uiSymbol++; |
---|
238 | } |
---|
239 | |
---|
240 | ruiSymbol = uiSymbol; |
---|
241 | } |
---|
242 | |
---|
243 | Void TDecSbac::xReadEpExGolomb( UInt& ruiSymbol, UInt uiCount ) |
---|
244 | { |
---|
245 | UInt uiSymbol = 0; |
---|
246 | UInt uiBit = 1; |
---|
247 | |
---|
248 | while( uiBit ) |
---|
249 | { |
---|
250 | m_pcTDecBinIf->decodeBinEP( uiBit ); |
---|
251 | uiSymbol += uiBit << uiCount++; |
---|
252 | } |
---|
253 | |
---|
254 | if ( --uiCount ) |
---|
255 | { |
---|
256 | UInt bins; |
---|
257 | m_pcTDecBinIf->decodeBinsEP( bins, uiCount ); |
---|
258 | uiSymbol += bins; |
---|
259 | } |
---|
260 | |
---|
261 | ruiSymbol = uiSymbol; |
---|
262 | } |
---|
263 | |
---|
264 | Void TDecSbac::xReadUnarySymbol( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset ) |
---|
265 | { |
---|
266 | m_pcTDecBinIf->decodeBin( ruiSymbol, pcSCModel[0] ); |
---|
267 | |
---|
268 | if( !ruiSymbol ) |
---|
269 | { |
---|
270 | return; |
---|
271 | } |
---|
272 | |
---|
273 | UInt uiSymbol = 0; |
---|
274 | UInt uiCont; |
---|
275 | |
---|
276 | do |
---|
277 | { |
---|
278 | m_pcTDecBinIf->decodeBin( uiCont, pcSCModel[ iOffset ] ); |
---|
279 | uiSymbol++; |
---|
280 | } |
---|
281 | while( uiCont ); |
---|
282 | |
---|
283 | ruiSymbol = uiSymbol; |
---|
284 | } |
---|
285 | |
---|
286 | |
---|
287 | /** Parsing of coeff_abs_level_remaing |
---|
288 | * \param ruiSymbol reference to coeff_abs_level_remaing |
---|
289 | * \param ruiParam reference to parameter |
---|
290 | * \returns Void |
---|
291 | */ |
---|
292 | Void TDecSbac::xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam ) |
---|
293 | { |
---|
294 | |
---|
295 | UInt prefix = 0; |
---|
296 | UInt codeWord = 0; |
---|
297 | do |
---|
298 | { |
---|
299 | prefix++; |
---|
300 | m_pcTDecBinIf->decodeBinEP( codeWord ); |
---|
301 | } |
---|
302 | while( codeWord); |
---|
303 | codeWord = 1 - codeWord; |
---|
304 | prefix -= codeWord; |
---|
305 | codeWord=0; |
---|
306 | if (prefix < COEF_REMAIN_BIN_REDUCTION ) |
---|
307 | { |
---|
308 | m_pcTDecBinIf->decodeBinsEP(codeWord,rParam); |
---|
309 | rSymbol = (prefix<<rParam) + codeWord; |
---|
310 | } |
---|
311 | else |
---|
312 | { |
---|
313 | m_pcTDecBinIf->decodeBinsEP(codeWord,prefix-COEF_REMAIN_BIN_REDUCTION+rParam); |
---|
314 | rSymbol = (((1<<(prefix-COEF_REMAIN_BIN_REDUCTION))+COEF_REMAIN_BIN_REDUCTION-1)<<rParam)+codeWord; |
---|
315 | } |
---|
316 | } |
---|
317 | |
---|
318 | /** Parse I_PCM information. |
---|
319 | * \param pcCU |
---|
320 | * \param uiAbsPartIdx |
---|
321 | * \param uiDepth |
---|
322 | * \returns Void |
---|
323 | * |
---|
324 | * If I_PCM flag indicates that the CU is I_PCM, parse its PCM alignment bits and codes. |
---|
325 | */ |
---|
326 | Void TDecSbac::parseIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
327 | { |
---|
328 | UInt uiSymbol; |
---|
329 | Bool readPCMSampleFlag = false; |
---|
330 | |
---|
331 | m_pcTDecBinIf->decodeBinTrm(uiSymbol); |
---|
332 | |
---|
333 | if (uiSymbol) |
---|
334 | { |
---|
335 | readPCMSampleFlag = true; |
---|
336 | m_pcTDecBinIf->decodePCMAlignBits(); |
---|
337 | } |
---|
338 | |
---|
339 | if (readPCMSampleFlag == true) |
---|
340 | { |
---|
341 | Bool bIpcmFlag = true; |
---|
342 | |
---|
343 | pcCU->setPartSizeSubParts ( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
344 | pcCU->setSizeSubParts ( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
345 | pcCU->setTrIdxSubParts ( 0, uiAbsPartIdx, uiDepth ); |
---|
346 | pcCU->setIPCMFlagSubParts ( bIpcmFlag, uiAbsPartIdx, uiDepth ); |
---|
347 | |
---|
348 | UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight(); |
---|
349 | UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; |
---|
350 | UInt uiChromaOffset = uiLumaOffset>>2; |
---|
351 | |
---|
352 | Pel* piPCMSample; |
---|
353 | UInt uiWidth; |
---|
354 | UInt uiHeight; |
---|
355 | UInt uiSampleBits; |
---|
356 | UInt uiX, uiY; |
---|
357 | |
---|
358 | piPCMSample = pcCU->getPCMSampleY() + uiLumaOffset; |
---|
359 | uiWidth = pcCU->getWidth(uiAbsPartIdx); |
---|
360 | uiHeight = pcCU->getHeight(uiAbsPartIdx); |
---|
361 | uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthLuma(); |
---|
362 | |
---|
363 | for(uiY = 0; uiY < uiHeight; uiY++) |
---|
364 | { |
---|
365 | for(uiX = 0; uiX < uiWidth; uiX++) |
---|
366 | { |
---|
367 | UInt uiSample; |
---|
368 | m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample); |
---|
369 | piPCMSample[uiX] = uiSample; |
---|
370 | } |
---|
371 | piPCMSample += uiWidth; |
---|
372 | } |
---|
373 | |
---|
374 | piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset; |
---|
375 | uiWidth = pcCU->getWidth(uiAbsPartIdx)/2; |
---|
376 | uiHeight = pcCU->getHeight(uiAbsPartIdx)/2; |
---|
377 | uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); |
---|
378 | |
---|
379 | for(uiY = 0; uiY < uiHeight; uiY++) |
---|
380 | { |
---|
381 | for(uiX = 0; uiX < uiWidth; uiX++) |
---|
382 | { |
---|
383 | UInt uiSample; |
---|
384 | m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample); |
---|
385 | piPCMSample[uiX] = uiSample; |
---|
386 | } |
---|
387 | piPCMSample += uiWidth; |
---|
388 | } |
---|
389 | |
---|
390 | piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset; |
---|
391 | uiWidth = pcCU->getWidth(uiAbsPartIdx)/2; |
---|
392 | uiHeight = pcCU->getHeight(uiAbsPartIdx)/2; |
---|
393 | uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); |
---|
394 | |
---|
395 | for(uiY = 0; uiY < uiHeight; uiY++) |
---|
396 | { |
---|
397 | for(uiX = 0; uiX < uiWidth; uiX++) |
---|
398 | { |
---|
399 | UInt uiSample; |
---|
400 | m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample); |
---|
401 | piPCMSample[uiX] = uiSample; |
---|
402 | } |
---|
403 | piPCMSample += uiWidth; |
---|
404 | } |
---|
405 | |
---|
406 | m_pcTDecBinIf->resetBac(); |
---|
407 | } |
---|
408 | } |
---|
409 | |
---|
410 | Void TDecSbac::parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
411 | { |
---|
412 | UInt uiSymbol; |
---|
413 | m_pcTDecBinIf->decodeBin( uiSymbol, m_CUTransquantBypassFlagSCModel.get( 0, 0, 0 ) ); |
---|
414 | pcCU->setCUTransquantBypassSubParts(uiSymbol ? true : false, uiAbsPartIdx, uiDepth); |
---|
415 | } |
---|
416 | |
---|
417 | /** parse skip flag |
---|
418 | * \param pcCU |
---|
419 | * \param uiAbsPartIdx |
---|
420 | * \param uiDepth |
---|
421 | * \returns Void |
---|
422 | */ |
---|
423 | Void TDecSbac::parseSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
424 | { |
---|
425 | if( pcCU->getSlice()->isIntra() ) |
---|
426 | { |
---|
427 | return; |
---|
428 | } |
---|
429 | |
---|
430 | UInt uiSymbol = 0; |
---|
431 | UInt uiCtxSkip = pcCU->getCtxSkipFlag( uiAbsPartIdx ); |
---|
432 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSkipFlagSCModel.get( 0, 0, uiCtxSkip ) ); |
---|
433 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
434 | DTRACE_CABAC_T( "\tSkipFlag" ); |
---|
435 | DTRACE_CABAC_T( "\tuiCtxSkip: "); |
---|
436 | DTRACE_CABAC_V( uiCtxSkip ); |
---|
437 | DTRACE_CABAC_T( "\tuiSymbol: "); |
---|
438 | DTRACE_CABAC_V( uiSymbol ); |
---|
439 | DTRACE_CABAC_T( "\n"); |
---|
440 | |
---|
441 | if( uiSymbol ) |
---|
442 | { |
---|
443 | pcCU->setSkipFlagSubParts( true, uiAbsPartIdx, uiDepth ); |
---|
444 | pcCU->setPredModeSubParts( MODE_INTER, uiAbsPartIdx, uiDepth ); |
---|
445 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
446 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
447 | pcCU->setMergeFlagSubParts( true , uiAbsPartIdx, 0, uiDepth ); |
---|
448 | } |
---|
449 | } |
---|
450 | |
---|
451 | /** parse merge flag |
---|
452 | * \param pcCU |
---|
453 | * \param uiAbsPartIdx |
---|
454 | * \param uiDepth |
---|
455 | * \param uiPUIdx |
---|
456 | * \returns Void |
---|
457 | */ |
---|
458 | Void TDecSbac::parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) |
---|
459 | { |
---|
460 | UInt uiSymbol; |
---|
461 | m_pcTDecBinIf->decodeBin( uiSymbol, *m_cCUMergeFlagExtSCModel.get( 0 ) ); |
---|
462 | pcCU->setMergeFlagSubParts( uiSymbol ? true : false, uiAbsPartIdx, uiPUIdx, uiDepth ); |
---|
463 | |
---|
464 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
465 | DTRACE_CABAC_T( "\tMergeFlag: " ); |
---|
466 | DTRACE_CABAC_V( uiSymbol ); |
---|
467 | DTRACE_CABAC_T( "\tAddress: " ); |
---|
468 | DTRACE_CABAC_V( pcCU->getAddr() ); |
---|
469 | DTRACE_CABAC_T( "\tuiAbsPartIdx: " ); |
---|
470 | DTRACE_CABAC_V( uiAbsPartIdx ); |
---|
471 | DTRACE_CABAC_T( "\n" ); |
---|
472 | } |
---|
473 | |
---|
474 | Void TDecSbac::parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ) |
---|
475 | { |
---|
476 | UInt uiUnaryIdx = 0; |
---|
477 | UInt uiNumCand = pcCU->getSlice()->getMaxNumMergeCand(); |
---|
478 | if ( uiNumCand > 1 ) |
---|
479 | { |
---|
480 | for( ; uiUnaryIdx < uiNumCand - 1; ++uiUnaryIdx ) |
---|
481 | { |
---|
482 | UInt uiSymbol = 0; |
---|
483 | if ( uiUnaryIdx==0 ) |
---|
484 | { |
---|
485 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUMergeIdxExtSCModel.get( 0, 0, 0 ) ); |
---|
486 | } |
---|
487 | else |
---|
488 | { |
---|
489 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
490 | } |
---|
491 | if( uiSymbol == 0 ) |
---|
492 | { |
---|
493 | break; |
---|
494 | } |
---|
495 | } |
---|
496 | } |
---|
497 | ruiMergeIndex = uiUnaryIdx; |
---|
498 | |
---|
499 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
500 | DTRACE_CABAC_T( "\tparseMergeIndex()" ) |
---|
501 | DTRACE_CABAC_T( "\tuiMRGIdx= " ) |
---|
502 | DTRACE_CABAC_V( ruiMergeIndex ) |
---|
503 | DTRACE_CABAC_T( "\n" ) |
---|
504 | } |
---|
505 | |
---|
506 | Void TDecSbac::parseMVPIdx ( Int& riMVPIdx ) |
---|
507 | { |
---|
508 | UInt uiSymbol; |
---|
509 | xReadUnaryMaxSymbol(uiSymbol, m_cMVPIdxSCModel.get(0), 1, AMVP_MAX_NUM_CANDS-1); |
---|
510 | riMVPIdx = uiSymbol; |
---|
511 | } |
---|
512 | |
---|
513 | Void TDecSbac::parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
514 | { |
---|
515 | if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) |
---|
516 | { |
---|
517 | pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx ); |
---|
518 | return; |
---|
519 | } |
---|
520 | |
---|
521 | UInt uiSymbol; |
---|
522 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSplitFlagSCModel.get( 0, 0, pcCU->getCtxSplitFlag( uiAbsPartIdx, uiDepth ) ) ); |
---|
523 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
524 | DTRACE_CABAC_T( "\tSplitFlag\n" ) |
---|
525 | pcCU->setDepthSubParts( uiDepth + uiSymbol, uiAbsPartIdx ); |
---|
526 | |
---|
527 | return; |
---|
528 | } |
---|
529 | |
---|
530 | /** parse partition size |
---|
531 | * \param pcCU |
---|
532 | * \param uiAbsPartIdx |
---|
533 | * \param uiDepth |
---|
534 | * \returns Void |
---|
535 | */ |
---|
536 | Void TDecSbac::parsePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
537 | { |
---|
538 | UInt uiSymbol, uiMode = 0; |
---|
539 | PartSize eMode; |
---|
540 | |
---|
541 | if ( pcCU->isIntra( uiAbsPartIdx ) ) |
---|
542 | { |
---|
543 | uiSymbol = 1; |
---|
544 | if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) |
---|
545 | { |
---|
546 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 0) ); |
---|
547 | } |
---|
548 | eMode = uiSymbol ? SIZE_2Nx2N : SIZE_NxN; |
---|
549 | UInt uiTrLevel = 0; |
---|
550 | UInt uiWidthInBit = g_aucConvertToBit[pcCU->getWidth(uiAbsPartIdx)]+2; |
---|
551 | UInt uiTrSizeInBit = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxTrSize()]+2; |
---|
552 | uiTrLevel = uiWidthInBit >= uiTrSizeInBit ? uiWidthInBit - uiTrSizeInBit : 0; |
---|
553 | if( eMode == SIZE_NxN ) |
---|
554 | { |
---|
555 | pcCU->setTrIdxSubParts( 1+uiTrLevel, uiAbsPartIdx, uiDepth ); |
---|
556 | } |
---|
557 | else |
---|
558 | { |
---|
559 | pcCU->setTrIdxSubParts( uiTrLevel, uiAbsPartIdx, uiDepth ); |
---|
560 | } |
---|
561 | } |
---|
562 | else |
---|
563 | { |
---|
564 | UInt uiMaxNumBits = 2; |
---|
565 | if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( (g_uiMaxCUWidth>>uiDepth) == 8 && (g_uiMaxCUHeight>>uiDepth) == 8 ) ) |
---|
566 | { |
---|
567 | uiMaxNumBits ++; |
---|
568 | } |
---|
569 | for ( UInt ui = 0; ui < uiMaxNumBits; ui++ ) |
---|
570 | { |
---|
571 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) ); |
---|
572 | if ( uiSymbol ) |
---|
573 | { |
---|
574 | break; |
---|
575 | } |
---|
576 | uiMode++; |
---|
577 | } |
---|
578 | eMode = (PartSize) uiMode; |
---|
579 | if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) ) |
---|
580 | { |
---|
581 | if (eMode == SIZE_2NxN) |
---|
582 | { |
---|
583 | m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 )); |
---|
584 | if (uiSymbol == 0) |
---|
585 | { |
---|
586 | m_pcTDecBinIf->decodeBinEP(uiSymbol); |
---|
587 | eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD); |
---|
588 | } |
---|
589 | } |
---|
590 | else if (eMode == SIZE_Nx2N) |
---|
591 | { |
---|
592 | m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 )); |
---|
593 | if (uiSymbol == 0) |
---|
594 | { |
---|
595 | m_pcTDecBinIf->decodeBinEP(uiSymbol); |
---|
596 | eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N); |
---|
597 | } |
---|
598 | } |
---|
599 | } |
---|
600 | } |
---|
601 | pcCU->setPartSizeSubParts( eMode, uiAbsPartIdx, uiDepth ); |
---|
602 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
603 | } |
---|
604 | |
---|
605 | /** parse prediction mode |
---|
606 | * \param pcCU |
---|
607 | * \param uiAbsPartIdx |
---|
608 | * \param uiDepth |
---|
609 | * \returns Void |
---|
610 | */ |
---|
611 | Void TDecSbac::parsePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
612 | { |
---|
613 | if( pcCU->getSlice()->isIntra() ) |
---|
614 | { |
---|
615 | pcCU->setPredModeSubParts( MODE_INTRA, uiAbsPartIdx, uiDepth ); |
---|
616 | return; |
---|
617 | } |
---|
618 | |
---|
619 | UInt uiSymbol; |
---|
620 | Int iPredMode = MODE_INTER; |
---|
621 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPredModeSCModel.get( 0, 0, 0 ) ); |
---|
622 | iPredMode += uiSymbol; |
---|
623 | pcCU->setPredModeSubParts( (PredMode)iPredMode, uiAbsPartIdx, uiDepth ); |
---|
624 | } |
---|
625 | |
---|
626 | Void TDecSbac::parseIntraDirLumaAng ( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) |
---|
627 | { |
---|
628 | PartSize mode = pcCU->getPartitionSize( absPartIdx ); |
---|
629 | UInt partNum = mode==SIZE_NxN?4:1; |
---|
630 | UInt partOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth(absPartIdx) << 1 ) ) >> 2; |
---|
631 | UInt mpmPred[4],symbol; |
---|
632 | Int j,intraPredMode; |
---|
633 | if (mode==SIZE_NxN) |
---|
634 | { |
---|
635 | depth++; |
---|
636 | } |
---|
637 | for (j=0;j<partNum;j++) |
---|
638 | { |
---|
639 | m_pcTDecBinIf->decodeBin( symbol, m_cCUIntraPredSCModel.get( 0, 0, 0) ); |
---|
640 | mpmPred[j] = symbol; |
---|
641 | } |
---|
642 | for (j=0;j<partNum;j++) |
---|
643 | { |
---|
644 | Int preds[3] = {-1, -1, -1}; |
---|
645 | Int predNum = pcCU->getIntraDirLumaPredictor(absPartIdx+partOffset*j, preds); |
---|
646 | if (mpmPred[j]) |
---|
647 | { |
---|
648 | m_pcTDecBinIf->decodeBinEP( symbol ); |
---|
649 | if (symbol) |
---|
650 | { |
---|
651 | m_pcTDecBinIf->decodeBinEP( symbol ); |
---|
652 | symbol++; |
---|
653 | } |
---|
654 | intraPredMode = preds[symbol]; |
---|
655 | } |
---|
656 | else |
---|
657 | { |
---|
658 | intraPredMode = 0; |
---|
659 | m_pcTDecBinIf->decodeBinsEP( symbol, 5 ); |
---|
660 | intraPredMode = symbol; |
---|
661 | |
---|
662 | //postponed sorting of MPMs (only in remaining branch) |
---|
663 | if (preds[0] > preds[1]) |
---|
664 | { |
---|
665 | std::swap(preds[0], preds[1]); |
---|
666 | } |
---|
667 | if (preds[0] > preds[2]) |
---|
668 | { |
---|
669 | std::swap(preds[0], preds[2]); |
---|
670 | } |
---|
671 | if (preds[1] > preds[2]) |
---|
672 | { |
---|
673 | std::swap(preds[1], preds[2]); |
---|
674 | } |
---|
675 | for ( Int i = 0; i < predNum; i++ ) |
---|
676 | { |
---|
677 | intraPredMode += ( intraPredMode >= preds[i] ); |
---|
678 | } |
---|
679 | } |
---|
680 | pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, absPartIdx+partOffset*j, depth ); |
---|
681 | } |
---|
682 | } |
---|
683 | |
---|
684 | Void TDecSbac::parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
685 | { |
---|
686 | UInt uiSymbol; |
---|
687 | |
---|
688 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUChromaPredSCModel.get( 0, 0, 0 ) ); |
---|
689 | |
---|
690 | if( uiSymbol == 0 ) |
---|
691 | { |
---|
692 | uiSymbol = DM_CHROMA_IDX; |
---|
693 | } |
---|
694 | else |
---|
695 | { |
---|
696 | { |
---|
697 | UInt uiIPredMode; |
---|
698 | m_pcTDecBinIf->decodeBinsEP( uiIPredMode, 2 ); |
---|
699 | UInt uiAllowedChromaDir[ NUM_CHROMA_MODE ]; |
---|
700 | pcCU->getAllowedChromaDir( uiAbsPartIdx, uiAllowedChromaDir ); |
---|
701 | uiSymbol = uiAllowedChromaDir[ uiIPredMode ]; |
---|
702 | } |
---|
703 | } |
---|
704 | pcCU->setChromIntraDirSubParts( uiSymbol, uiAbsPartIdx, uiDepth ); |
---|
705 | return; |
---|
706 | } |
---|
707 | |
---|
708 | Void TDecSbac::parseInterDir( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx ) |
---|
709 | { |
---|
710 | UInt uiSymbol; |
---|
711 | const UInt uiCtx = pcCU->getCtxInterDir( uiAbsPartIdx ); |
---|
712 | ContextModel *pCtx = m_cCUInterDirSCModel.get( 0 ); |
---|
713 | uiSymbol = 0; |
---|
714 | if (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N || pcCU->getHeight(uiAbsPartIdx) != 8 ) |
---|
715 | { |
---|
716 | m_pcTDecBinIf->decodeBin( uiSymbol, *( pCtx + uiCtx ) ); |
---|
717 | } |
---|
718 | |
---|
719 | if( uiSymbol ) |
---|
720 | { |
---|
721 | uiSymbol = 2; |
---|
722 | } |
---|
723 | else |
---|
724 | { |
---|
725 | m_pcTDecBinIf->decodeBin( uiSymbol, *( pCtx + 4 ) ); |
---|
726 | assert(uiSymbol == 0 || uiSymbol == 1); |
---|
727 | } |
---|
728 | |
---|
729 | uiSymbol++; |
---|
730 | ruiInterDir = uiSymbol; |
---|
731 | return; |
---|
732 | } |
---|
733 | |
---|
734 | Void TDecSbac::parseRefFrmIdx( TComDataCU* pcCU, Int& riRefFrmIdx, RefPicList eRefList ) |
---|
735 | { |
---|
736 | UInt uiSymbol; |
---|
737 | { |
---|
738 | ContextModel *pCtx = m_cCURefPicSCModel.get( 0 ); |
---|
739 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
740 | |
---|
741 | if( uiSymbol ) |
---|
742 | { |
---|
743 | UInt uiRefNum = pcCU->getSlice()->getNumRefIdx( eRefList ) - 2; |
---|
744 | pCtx++; |
---|
745 | UInt ui; |
---|
746 | for( ui = 0; ui < uiRefNum; ++ui ) |
---|
747 | { |
---|
748 | if( ui == 0 ) |
---|
749 | { |
---|
750 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
751 | } |
---|
752 | else |
---|
753 | { |
---|
754 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
755 | } |
---|
756 | if( uiSymbol == 0 ) |
---|
757 | { |
---|
758 | break; |
---|
759 | } |
---|
760 | } |
---|
761 | uiSymbol = ui + 1; |
---|
762 | } |
---|
763 | riRefFrmIdx = uiSymbol; |
---|
764 | } |
---|
765 | |
---|
766 | return; |
---|
767 | } |
---|
768 | |
---|
769 | Void TDecSbac::parseMvd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList ) |
---|
770 | { |
---|
771 | UInt uiSymbol; |
---|
772 | UInt uiHorAbs; |
---|
773 | UInt uiVerAbs; |
---|
774 | UInt uiHorSign = 0; |
---|
775 | UInt uiVerSign = 0; |
---|
776 | ContextModel *pCtx = m_cCUMvdSCModel.get( 0 ); |
---|
777 | |
---|
778 | if(pcCU->getSlice()->getMvdL1ZeroFlag() && eRefList == REF_PIC_LIST_1 && pcCU->getInterDir(uiAbsPartIdx)==3) |
---|
779 | { |
---|
780 | uiHorAbs=0; |
---|
781 | uiVerAbs=0; |
---|
782 | } |
---|
783 | else |
---|
784 | { |
---|
785 | m_pcTDecBinIf->decodeBin( uiHorAbs, *pCtx ); |
---|
786 | m_pcTDecBinIf->decodeBin( uiVerAbs, *pCtx ); |
---|
787 | |
---|
788 | const Bool bHorAbsGr0 = uiHorAbs != 0; |
---|
789 | const Bool bVerAbsGr0 = uiVerAbs != 0; |
---|
790 | pCtx++; |
---|
791 | |
---|
792 | if( bHorAbsGr0 ) |
---|
793 | { |
---|
794 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
795 | uiHorAbs += uiSymbol; |
---|
796 | } |
---|
797 | |
---|
798 | if( bVerAbsGr0 ) |
---|
799 | { |
---|
800 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
801 | uiVerAbs += uiSymbol; |
---|
802 | } |
---|
803 | |
---|
804 | if( bHorAbsGr0 ) |
---|
805 | { |
---|
806 | if( 2 == uiHorAbs ) |
---|
807 | { |
---|
808 | xReadEpExGolomb( uiSymbol, 1 ); |
---|
809 | uiHorAbs += uiSymbol; |
---|
810 | } |
---|
811 | |
---|
812 | m_pcTDecBinIf->decodeBinEP( uiHorSign ); |
---|
813 | } |
---|
814 | |
---|
815 | if( bVerAbsGr0 ) |
---|
816 | { |
---|
817 | if( 2 == uiVerAbs ) |
---|
818 | { |
---|
819 | xReadEpExGolomb( uiSymbol, 1 ); |
---|
820 | uiVerAbs += uiSymbol; |
---|
821 | } |
---|
822 | |
---|
823 | m_pcTDecBinIf->decodeBinEP( uiVerSign ); |
---|
824 | } |
---|
825 | |
---|
826 | } |
---|
827 | |
---|
828 | const TComMv cMv( uiHorSign ? -Int( uiHorAbs ): uiHorAbs, uiVerSign ? -Int( uiVerAbs ) : uiVerAbs ); |
---|
829 | pcCU->getCUMvField( eRefList )->setAllMvd( cMv, pcCU->getPartitionSize( uiAbsPartIdx ), uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
830 | return; |
---|
831 | } |
---|
832 | |
---|
833 | |
---|
834 | Void TDecSbac::parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize ) |
---|
835 | { |
---|
836 | m_pcTDecBinIf->decodeBin( ruiSubdivFlag, m_cCUTransSubdivFlagSCModel.get( 0, 0, uiLog2TransformBlockSize ) ); |
---|
837 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
838 | DTRACE_CABAC_T( "\tparseTransformSubdivFlag()" ) |
---|
839 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
840 | DTRACE_CABAC_V( ruiSubdivFlag ) |
---|
841 | DTRACE_CABAC_T( "\tctx=" ) |
---|
842 | DTRACE_CABAC_V( uiLog2TransformBlockSize ) |
---|
843 | DTRACE_CABAC_T( "\n" ) |
---|
844 | } |
---|
845 | |
---|
846 | Void TDecSbac::parseQtRootCbf( UInt uiAbsPartIdx, UInt& uiQtRootCbf ) |
---|
847 | { |
---|
848 | UInt uiSymbol; |
---|
849 | const UInt uiCtx = 0; |
---|
850 | m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtRootCbfSCModel.get( 0, 0, uiCtx ) ); |
---|
851 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
852 | DTRACE_CABAC_T( "\tparseQtRootCbf()" ) |
---|
853 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
854 | DTRACE_CABAC_V( uiSymbol ) |
---|
855 | DTRACE_CABAC_T( "\tctx=" ) |
---|
856 | DTRACE_CABAC_V( uiCtx ) |
---|
857 | DTRACE_CABAC_T( "\tuiAbsPartIdx=" ) |
---|
858 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
859 | DTRACE_CABAC_T( "\n" ) |
---|
860 | |
---|
861 | uiQtRootCbf = uiSymbol; |
---|
862 | } |
---|
863 | |
---|
864 | Void TDecSbac::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
865 | { |
---|
866 | Int qp; |
---|
867 | UInt uiDQp; |
---|
868 | Int iDQp; |
---|
869 | |
---|
870 | UInt uiSymbol; |
---|
871 | |
---|
872 | xReadUnaryMaxSymbol (uiDQp, &m_cCUDeltaQpSCModel.get( 0, 0, 0 ), 1, CU_DQP_TU_CMAX); |
---|
873 | |
---|
874 | if( uiDQp >= CU_DQP_TU_CMAX) |
---|
875 | { |
---|
876 | xReadEpExGolomb( uiSymbol, CU_DQP_EG_k ); |
---|
877 | uiDQp+=uiSymbol; |
---|
878 | } |
---|
879 | |
---|
880 | if ( uiDQp > 0 ) |
---|
881 | { |
---|
882 | UInt uiSign; |
---|
883 | Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); |
---|
884 | m_pcTDecBinIf->decodeBinEP(uiSign); |
---|
885 | iDQp = uiDQp; |
---|
886 | if(uiSign) |
---|
887 | { |
---|
888 | iDQp = -iDQp; |
---|
889 | } |
---|
890 | qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+qpBdOffsetY)) - qpBdOffsetY; |
---|
891 | } |
---|
892 | else |
---|
893 | { |
---|
894 | iDQp=0; |
---|
895 | qp = pcCU->getRefQP(uiAbsPartIdx); |
---|
896 | } |
---|
897 | pcCU->setQPSubParts(qp, uiAbsPartIdx, uiDepth); |
---|
898 | pcCU->setCodedQP(qp); |
---|
899 | } |
---|
900 | |
---|
901 | Void TDecSbac::parseQtCbf( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth ) |
---|
902 | { |
---|
903 | UInt uiSymbol; |
---|
904 | const UInt uiCtx = pcCU->getCtxQtCbf( eType, uiTrDepth ); |
---|
905 | m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtCbfSCModel.get( 0, eType ? TEXT_CHROMA: eType, uiCtx ) ); |
---|
906 | |
---|
907 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
908 | DTRACE_CABAC_T( "\tparseQtCbf()" ) |
---|
909 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
910 | DTRACE_CABAC_V( uiSymbol ) |
---|
911 | DTRACE_CABAC_T( "\tctx=" ) |
---|
912 | DTRACE_CABAC_V( uiCtx ) |
---|
913 | DTRACE_CABAC_T( "\tetype=" ) |
---|
914 | DTRACE_CABAC_V( eType ) |
---|
915 | DTRACE_CABAC_T( "\tuiAbsPartIdx=" ) |
---|
916 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
917 | DTRACE_CABAC_T( "\n" ) |
---|
918 | |
---|
919 | pcCU->setCbfSubParts( uiSymbol << uiTrDepth, eType, uiAbsPartIdx, uiDepth ); |
---|
920 | } |
---|
921 | |
---|
922 | void TDecSbac::parseTransformSkipFlags (TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, UInt uiDepth, TextType eTType) |
---|
923 | { |
---|
924 | if (pcCU->getCUTransquantBypass(uiAbsPartIdx)) |
---|
925 | { |
---|
926 | return; |
---|
927 | } |
---|
928 | if(width != 4 || height != 4) |
---|
929 | { |
---|
930 | return; |
---|
931 | } |
---|
932 | |
---|
933 | UInt useTransformSkip; |
---|
934 | m_pcTDecBinIf->decodeBin( useTransformSkip , m_cTransformSkipSCModel.get( 0, eTType? TEXT_CHROMA: TEXT_LUMA, 0 ) ); |
---|
935 | if(eTType!= TEXT_LUMA) |
---|
936 | { |
---|
937 | const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()] + 2 - uiDepth; |
---|
938 | if(uiLog2TrafoSize == 2) |
---|
939 | { |
---|
940 | uiDepth --; |
---|
941 | } |
---|
942 | } |
---|
943 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
944 | DTRACE_CABAC_T("\tparseTransformSkip()"); |
---|
945 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
946 | DTRACE_CABAC_V( useTransformSkip ) |
---|
947 | DTRACE_CABAC_T( "\tAddr=" ) |
---|
948 | DTRACE_CABAC_V( pcCU->getAddr() ) |
---|
949 | DTRACE_CABAC_T( "\tetype=" ) |
---|
950 | DTRACE_CABAC_V( eTType ) |
---|
951 | DTRACE_CABAC_T( "\tuiAbsPartIdx=" ) |
---|
952 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
953 | DTRACE_CABAC_T( "\n" ) |
---|
954 | |
---|
955 | pcCU->setTransformSkipSubParts( useTransformSkip, eTType, uiAbsPartIdx, uiDepth); |
---|
956 | } |
---|
957 | |
---|
958 | /** Parse (X,Y) position of the last significant coefficient |
---|
959 | * \param uiPosLastX reference to X component of last coefficient |
---|
960 | * \param uiPosLastY reference to Y component of last coefficient |
---|
961 | * \param width Block width |
---|
962 | * \param height Block height |
---|
963 | * \param eTType plane type / luminance or chrominance |
---|
964 | * \param uiScanIdx scan type (zig-zag, hor, ver) |
---|
965 | * |
---|
966 | * This method decodes the X and Y component within a block of the last significant coefficient. |
---|
967 | */ |
---|
968 | Void TDecSbac::parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, Int width, Int height, TextType eTType, UInt uiScanIdx ) |
---|
969 | { |
---|
970 | UInt uiLast; |
---|
971 | ContextModel *pCtxX = m_cCuCtxLastX.get( 0, eTType ); |
---|
972 | ContextModel *pCtxY = m_cCuCtxLastY.get( 0, eTType ); |
---|
973 | |
---|
974 | Int blkSizeOffsetX, blkSizeOffsetY, shiftX, shiftY; |
---|
975 | blkSizeOffsetX = eTType ? 0: (g_aucConvertToBit[ width ] *3 + ((g_aucConvertToBit[ width ] +1)>>2)); |
---|
976 | blkSizeOffsetY = eTType ? 0: (g_aucConvertToBit[ height ]*3 + ((g_aucConvertToBit[ height ]+1)>>2)); |
---|
977 | shiftX= eTType ? g_aucConvertToBit[ width ] :((g_aucConvertToBit[ width ]+3)>>2); |
---|
978 | shiftY= eTType ? g_aucConvertToBit[ height ] :((g_aucConvertToBit[ height ]+3)>>2); |
---|
979 | // posX |
---|
980 | for( uiPosLastX = 0; uiPosLastX < g_uiGroupIdx[ width - 1 ]; uiPosLastX++ ) |
---|
981 | { |
---|
982 | m_pcTDecBinIf->decodeBin( uiLast, *( pCtxX + blkSizeOffsetX + (uiPosLastX >>shiftX) ) ); |
---|
983 | if( !uiLast ) |
---|
984 | { |
---|
985 | break; |
---|
986 | } |
---|
987 | } |
---|
988 | |
---|
989 | // posY |
---|
990 | for( uiPosLastY = 0; uiPosLastY < g_uiGroupIdx[ height - 1 ]; uiPosLastY++ ) |
---|
991 | { |
---|
992 | m_pcTDecBinIf->decodeBin( uiLast, *( pCtxY + blkSizeOffsetY + (uiPosLastY >>shiftY)) ); |
---|
993 | if( !uiLast ) |
---|
994 | { |
---|
995 | break; |
---|
996 | } |
---|
997 | } |
---|
998 | if ( uiPosLastX > 3 ) |
---|
999 | { |
---|
1000 | UInt uiTemp = 0; |
---|
1001 | UInt uiCount = ( uiPosLastX - 2 ) >> 1; |
---|
1002 | for ( Int i = uiCount - 1; i >= 0; i-- ) |
---|
1003 | { |
---|
1004 | m_pcTDecBinIf->decodeBinEP( uiLast ); |
---|
1005 | uiTemp += uiLast << i; |
---|
1006 | } |
---|
1007 | uiPosLastX = g_uiMinInGroup[ uiPosLastX ] + uiTemp; |
---|
1008 | } |
---|
1009 | if ( uiPosLastY > 3 ) |
---|
1010 | { |
---|
1011 | UInt uiTemp = 0; |
---|
1012 | UInt uiCount = ( uiPosLastY - 2 ) >> 1; |
---|
1013 | for ( Int i = uiCount - 1; i >= 0; i-- ) |
---|
1014 | { |
---|
1015 | m_pcTDecBinIf->decodeBinEP( uiLast ); |
---|
1016 | uiTemp += uiLast << i; |
---|
1017 | } |
---|
1018 | uiPosLastY = g_uiMinInGroup[ uiPosLastY ] + uiTemp; |
---|
1019 | } |
---|
1020 | |
---|
1021 | if( uiScanIdx == SCAN_VER ) |
---|
1022 | { |
---|
1023 | swap( uiPosLastX, uiPosLastY ); |
---|
1024 | } |
---|
1025 | } |
---|
1026 | |
---|
1027 | Void TDecSbac::parseCoeffNxN( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ) |
---|
1028 | { |
---|
1029 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
1030 | DTRACE_CABAC_T( "\tparseCoeffNxN()\teType=" ) |
---|
1031 | DTRACE_CABAC_V( eTType ) |
---|
1032 | DTRACE_CABAC_T( "\twidth=" ) |
---|
1033 | DTRACE_CABAC_V( uiWidth ) |
---|
1034 | DTRACE_CABAC_T( "\theight=" ) |
---|
1035 | DTRACE_CABAC_V( uiHeight ) |
---|
1036 | DTRACE_CABAC_T( "\tdepth=" ) |
---|
1037 | DTRACE_CABAC_V( uiDepth ) |
---|
1038 | DTRACE_CABAC_T( "\tabspartidx=" ) |
---|
1039 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
1040 | DTRACE_CABAC_T( "\ttoCU-X=" ) |
---|
1041 | DTRACE_CABAC_V( pcCU->getCUPelX() ) |
---|
1042 | DTRACE_CABAC_T( "\ttoCU-Y=" ) |
---|
1043 | DTRACE_CABAC_V( pcCU->getCUPelY() ) |
---|
1044 | DTRACE_CABAC_T( "\tCU-addr=" ) |
---|
1045 | DTRACE_CABAC_V( pcCU->getAddr() ) |
---|
1046 | DTRACE_CABAC_T( "\tinCU-X=" ) |
---|
1047 | DTRACE_CABAC_V( g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ] ) |
---|
1048 | DTRACE_CABAC_T( "\tinCU-Y=" ) |
---|
1049 | DTRACE_CABAC_V( g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ] ) |
---|
1050 | DTRACE_CABAC_T( "\tpredmode=" ) |
---|
1051 | DTRACE_CABAC_V( pcCU->getPredictionMode( uiAbsPartIdx ) ) |
---|
1052 | DTRACE_CABAC_T( "\n" ) |
---|
1053 | |
---|
1054 | if( uiWidth > pcCU->getSlice()->getSPS()->getMaxTrSize() ) |
---|
1055 | { |
---|
1056 | uiWidth = pcCU->getSlice()->getSPS()->getMaxTrSize(); |
---|
1057 | uiHeight = pcCU->getSlice()->getSPS()->getMaxTrSize(); |
---|
1058 | } |
---|
1059 | if(pcCU->getSlice()->getPPS()->getUseTransformSkip()) |
---|
1060 | { |
---|
1061 | parseTransformSkipFlags( pcCU, uiAbsPartIdx, uiWidth, uiHeight, uiDepth, eTType); |
---|
1062 | } |
---|
1063 | |
---|
1064 | eTType = eTType == TEXT_LUMA ? TEXT_LUMA : ( eTType == TEXT_NONE ? TEXT_NONE : TEXT_CHROMA ); |
---|
1065 | |
---|
1066 | //----- parse significance map ----- |
---|
1067 | const UInt uiLog2BlockSize = g_aucConvertToBit[ uiWidth ] + 2; |
---|
1068 | const UInt uiMaxNumCoeff = uiWidth * uiHeight; |
---|
1069 | const UInt uiMaxNumCoeffM1 = uiMaxNumCoeff - 1; |
---|
1070 | UInt uiScanIdx = pcCU->getCoefScanIdx(uiAbsPartIdx, uiWidth, eTType==TEXT_LUMA, pcCU->isIntra(uiAbsPartIdx)); |
---|
1071 | |
---|
1072 | //===== decode last significant ===== |
---|
1073 | UInt uiPosLastX, uiPosLastY; |
---|
1074 | parseLastSignificantXY( uiPosLastX, uiPosLastY, uiWidth, uiHeight, eTType, uiScanIdx ); |
---|
1075 | UInt uiBlkPosLast = uiPosLastX + (uiPosLastY<<uiLog2BlockSize); |
---|
1076 | pcCoef[ uiBlkPosLast ] = 1; |
---|
1077 | |
---|
1078 | //===== decode significance flags ===== |
---|
1079 | UInt uiScanPosLast = uiBlkPosLast; |
---|
1080 | const UInt *scan = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize-1 ]; |
---|
1081 | for( uiScanPosLast = 0; uiScanPosLast < uiMaxNumCoeffM1; uiScanPosLast++ ) |
---|
1082 | { |
---|
1083 | UInt uiBlkPos = scan[ uiScanPosLast ]; |
---|
1084 | if( uiBlkPosLast == uiBlkPos ) |
---|
1085 | { |
---|
1086 | break; |
---|
1087 | } |
---|
1088 | } |
---|
1089 | |
---|
1090 | ContextModel * const baseCoeffGroupCtx = m_cCUSigCoeffGroupSCModel.get( 0, eTType ); |
---|
1091 | ContextModel * const baseCtx = (eTType==TEXT_LUMA) ? m_cCUSigSCModel.get( 0, 0 ) : m_cCUSigSCModel.get( 0, 0 ) + NUM_SIG_FLAG_CTX_LUMA; |
---|
1092 | |
---|
1093 | const Int iLastScanSet = uiScanPosLast >> LOG2_SCAN_SET_SIZE; |
---|
1094 | UInt c1 = 1; |
---|
1095 | UInt uiGoRiceParam = 0; |
---|
1096 | |
---|
1097 | Bool beValid; |
---|
1098 | if (pcCU->getCUTransquantBypass(uiAbsPartIdx)) |
---|
1099 | { |
---|
1100 | beValid = false; |
---|
1101 | } |
---|
1102 | else |
---|
1103 | { |
---|
1104 | beValid = pcCU->getSlice()->getPPS()->getSignHideFlag() > 0; |
---|
1105 | } |
---|
1106 | UInt absSum = 0; |
---|
1107 | |
---|
1108 | UInt uiSigCoeffGroupFlag[ MLS_GRP_NUM ]; |
---|
1109 | ::memset( uiSigCoeffGroupFlag, 0, sizeof(UInt) * MLS_GRP_NUM ); |
---|
1110 | const UInt uiNumBlkSide = uiWidth >> (MLS_CG_SIZE >> 1); |
---|
1111 | const UInt * scanCG; |
---|
1112 | { |
---|
1113 | scanCG = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize > 3 ? uiLog2BlockSize-2-1 : 0 ]; |
---|
1114 | if( uiLog2BlockSize == 3 ) |
---|
1115 | { |
---|
1116 | scanCG = g_sigLastScan8x8[ uiScanIdx ]; |
---|
1117 | } |
---|
1118 | else if( uiLog2BlockSize == 5 ) |
---|
1119 | { |
---|
1120 | scanCG = g_sigLastScanCG32x32; |
---|
1121 | } |
---|
1122 | } |
---|
1123 | Int iScanPosSig = (Int) uiScanPosLast; |
---|
1124 | for( Int iSubSet = iLastScanSet; iSubSet >= 0; iSubSet-- ) |
---|
1125 | { |
---|
1126 | Int iSubPos = iSubSet << LOG2_SCAN_SET_SIZE; |
---|
1127 | uiGoRiceParam = 0; |
---|
1128 | Int numNonZero = 0; |
---|
1129 | |
---|
1130 | Int lastNZPosInCG = -1, firstNZPosInCG = SCAN_SET_SIZE; |
---|
1131 | |
---|
1132 | Int pos[SCAN_SET_SIZE]; |
---|
1133 | if( iScanPosSig == (Int) uiScanPosLast ) |
---|
1134 | { |
---|
1135 | lastNZPosInCG = iScanPosSig; |
---|
1136 | firstNZPosInCG = iScanPosSig; |
---|
1137 | iScanPosSig--; |
---|
1138 | pos[ numNonZero ] = uiBlkPosLast; |
---|
1139 | numNonZero = 1; |
---|
1140 | } |
---|
1141 | |
---|
1142 | // decode significant_coeffgroup_flag |
---|
1143 | Int iCGBlkPos = scanCG[ iSubSet ]; |
---|
1144 | Int iCGPosY = iCGBlkPos / uiNumBlkSide; |
---|
1145 | Int iCGPosX = iCGBlkPos - (iCGPosY * uiNumBlkSide); |
---|
1146 | if( iSubSet == iLastScanSet || iSubSet == 0) |
---|
1147 | { |
---|
1148 | uiSigCoeffGroupFlag[ iCGBlkPos ] = 1; |
---|
1149 | } |
---|
1150 | else |
---|
1151 | { |
---|
1152 | UInt uiSigCoeffGroup; |
---|
1153 | UInt uiCtxSig = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight ); |
---|
1154 | m_pcTDecBinIf->decodeBin( uiSigCoeffGroup, baseCoeffGroupCtx[ uiCtxSig ] ); |
---|
1155 | uiSigCoeffGroupFlag[ iCGBlkPos ] = uiSigCoeffGroup; |
---|
1156 | } |
---|
1157 | |
---|
1158 | // decode significant_coeff_flag |
---|
1159 | Int patternSigCtx = TComTrQuant::calcPatternSigCtx( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight ); |
---|
1160 | UInt uiBlkPos, uiPosY, uiPosX, uiSig, uiCtxSig; |
---|
1161 | for( ; iScanPosSig >= iSubPos; iScanPosSig-- ) |
---|
1162 | { |
---|
1163 | uiBlkPos = scan[ iScanPosSig ]; |
---|
1164 | uiPosY = uiBlkPos >> uiLog2BlockSize; |
---|
1165 | uiPosX = uiBlkPos - ( uiPosY << uiLog2BlockSize ); |
---|
1166 | uiSig = 0; |
---|
1167 | |
---|
1168 | if( uiSigCoeffGroupFlag[ iCGBlkPos ] ) |
---|
1169 | { |
---|
1170 | if( iScanPosSig > iSubPos || iSubSet == 0 || numNonZero ) |
---|
1171 | { |
---|
1172 | uiCtxSig = TComTrQuant::getSigCtxInc( patternSigCtx, uiScanIdx, uiPosX, uiPosY, uiLog2BlockSize, eTType ); |
---|
1173 | m_pcTDecBinIf->decodeBin( uiSig, baseCtx[ uiCtxSig ] ); |
---|
1174 | } |
---|
1175 | else |
---|
1176 | { |
---|
1177 | uiSig = 1; |
---|
1178 | } |
---|
1179 | } |
---|
1180 | pcCoef[ uiBlkPos ] = uiSig; |
---|
1181 | if( uiSig ) |
---|
1182 | { |
---|
1183 | pos[ numNonZero ] = uiBlkPos; |
---|
1184 | numNonZero ++; |
---|
1185 | if( lastNZPosInCG == -1 ) |
---|
1186 | { |
---|
1187 | lastNZPosInCG = iScanPosSig; |
---|
1188 | } |
---|
1189 | firstNZPosInCG = iScanPosSig; |
---|
1190 | } |
---|
1191 | } |
---|
1192 | |
---|
1193 | if( numNonZero ) |
---|
1194 | { |
---|
1195 | Bool signHidden = ( lastNZPosInCG - firstNZPosInCG >= SBH_THRESHOLD ); |
---|
1196 | absSum = 0; |
---|
1197 | UInt uiCtxSet = (iSubSet > 0 && eTType==TEXT_LUMA) ? 2 : 0; |
---|
1198 | UInt uiBin; |
---|
1199 | if( c1 == 0 ) |
---|
1200 | { |
---|
1201 | uiCtxSet++; |
---|
1202 | } |
---|
1203 | c1 = 1; |
---|
1204 | ContextModel *baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUOneSCModel.get( 0, 0 ) + 4 * uiCtxSet : m_cCUOneSCModel.get( 0, 0 ) + NUM_ONE_FLAG_CTX_LUMA + 4 * uiCtxSet; |
---|
1205 | Int absCoeff[SCAN_SET_SIZE]; |
---|
1206 | |
---|
1207 | for ( Int i = 0; i < numNonZero; i++) absCoeff[i] = 1; |
---|
1208 | Int numC1Flag = min(numNonZero, C1FLAG_NUMBER); |
---|
1209 | Int firstC2FlagIdx = -1; |
---|
1210 | |
---|
1211 | for( Int idx = 0; idx < numC1Flag; idx++ ) |
---|
1212 | { |
---|
1213 | m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[c1] ); |
---|
1214 | if( uiBin == 1 ) |
---|
1215 | { |
---|
1216 | c1 = 0; |
---|
1217 | if (firstC2FlagIdx == -1) |
---|
1218 | { |
---|
1219 | firstC2FlagIdx = idx; |
---|
1220 | } |
---|
1221 | } |
---|
1222 | else if( (c1 < 3) && (c1 > 0) ) |
---|
1223 | { |
---|
1224 | c1++; |
---|
1225 | } |
---|
1226 | absCoeff[ idx ] = uiBin + 1; |
---|
1227 | } |
---|
1228 | |
---|
1229 | if (c1 == 0) |
---|
1230 | { |
---|
1231 | baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUAbsSCModel.get( 0, 0 ) + uiCtxSet : m_cCUAbsSCModel.get( 0, 0 ) + NUM_ABS_FLAG_CTX_LUMA + uiCtxSet; |
---|
1232 | if ( firstC2FlagIdx != -1) |
---|
1233 | { |
---|
1234 | m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[0] ); |
---|
1235 | absCoeff[ firstC2FlagIdx ] = uiBin + 2; |
---|
1236 | } |
---|
1237 | } |
---|
1238 | |
---|
1239 | UInt coeffSigns; |
---|
1240 | if ( signHidden && beValid ) |
---|
1241 | { |
---|
1242 | m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero-1 ); |
---|
1243 | coeffSigns <<= 32 - (numNonZero-1); |
---|
1244 | } |
---|
1245 | else |
---|
1246 | { |
---|
1247 | m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero ); |
---|
1248 | coeffSigns <<= 32 - numNonZero; |
---|
1249 | } |
---|
1250 | |
---|
1251 | Int iFirstCoeff2 = 1; |
---|
1252 | if (c1 == 0 || numNonZero > C1FLAG_NUMBER) |
---|
1253 | { |
---|
1254 | for( Int idx = 0; idx < numNonZero; idx++ ) |
---|
1255 | { |
---|
1256 | UInt baseLevel = (idx < C1FLAG_NUMBER)? (2 + iFirstCoeff2) : 1; |
---|
1257 | |
---|
1258 | if( absCoeff[ idx ] == baseLevel) |
---|
1259 | { |
---|
1260 | UInt uiLevel; |
---|
1261 | xReadCoefRemainExGolomb( uiLevel, uiGoRiceParam ); |
---|
1262 | absCoeff[ idx ] = uiLevel + baseLevel; |
---|
1263 | if(absCoeff[idx]>3*(1<<uiGoRiceParam)) |
---|
1264 | { |
---|
1265 | uiGoRiceParam = min<UInt>(uiGoRiceParam+ 1, 4); |
---|
1266 | } |
---|
1267 | } |
---|
1268 | |
---|
1269 | if(absCoeff[ idx ] >= 2) |
---|
1270 | { |
---|
1271 | iFirstCoeff2 = 0; |
---|
1272 | } |
---|
1273 | } |
---|
1274 | } |
---|
1275 | |
---|
1276 | for( Int idx = 0; idx < numNonZero; idx++ ) |
---|
1277 | { |
---|
1278 | Int blkPos = pos[ idx ]; |
---|
1279 | // Signs applied later. |
---|
1280 | pcCoef[ blkPos ] = absCoeff[ idx ]; |
---|
1281 | absSum += absCoeff[ idx ]; |
---|
1282 | |
---|
1283 | if ( idx == numNonZero-1 && signHidden && beValid ) |
---|
1284 | { |
---|
1285 | // Infer sign of 1st element. |
---|
1286 | if (absSum&0x1) |
---|
1287 | { |
---|
1288 | pcCoef[ blkPos ] = -pcCoef[ blkPos ]; |
---|
1289 | } |
---|
1290 | } |
---|
1291 | else |
---|
1292 | { |
---|
1293 | Int sign = static_cast<Int>( coeffSigns ) >> 31; |
---|
1294 | pcCoef[ blkPos ] = ( pcCoef[ blkPos ] ^ sign ) - sign; |
---|
1295 | coeffSigns <<= 1; |
---|
1296 | } |
---|
1297 | } |
---|
1298 | } |
---|
1299 | } |
---|
1300 | |
---|
1301 | return; |
---|
1302 | } |
---|
1303 | |
---|
1304 | |
---|
1305 | Void TDecSbac::parseSaoMaxUvlc ( UInt& val, UInt maxSymbol ) |
---|
1306 | { |
---|
1307 | if (maxSymbol == 0) |
---|
1308 | { |
---|
1309 | val = 0; |
---|
1310 | return; |
---|
1311 | } |
---|
1312 | |
---|
1313 | UInt code; |
---|
1314 | Int i; |
---|
1315 | m_pcTDecBinIf->decodeBinEP( code ); |
---|
1316 | if ( code == 0 ) |
---|
1317 | { |
---|
1318 | val = 0; |
---|
1319 | return; |
---|
1320 | } |
---|
1321 | |
---|
1322 | i=1; |
---|
1323 | while (1) |
---|
1324 | { |
---|
1325 | m_pcTDecBinIf->decodeBinEP( code ); |
---|
1326 | if ( code == 0 ) |
---|
1327 | { |
---|
1328 | break; |
---|
1329 | } |
---|
1330 | i++; |
---|
1331 | if (i == maxSymbol) |
---|
1332 | { |
---|
1333 | break; |
---|
1334 | } |
---|
1335 | } |
---|
1336 | |
---|
1337 | val = i; |
---|
1338 | } |
---|
1339 | Void TDecSbac::parseSaoUflc (UInt uiLength, UInt& riVal) |
---|
1340 | { |
---|
1341 | m_pcTDecBinIf->decodeBinsEP ( riVal, uiLength ); |
---|
1342 | } |
---|
1343 | Void TDecSbac::parseSaoMerge (UInt& ruiVal) |
---|
1344 | { |
---|
1345 | UInt uiCode; |
---|
1346 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoMergeSCModel.get( 0, 0, 0 ) ); |
---|
1347 | ruiVal = (Int)uiCode; |
---|
1348 | } |
---|
1349 | Void TDecSbac::parseSaoTypeIdx (UInt& ruiVal) |
---|
1350 | { |
---|
1351 | UInt uiCode; |
---|
1352 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoTypeIdxSCModel.get( 0, 0, 0 ) ); |
---|
1353 | if (uiCode == 0) |
---|
1354 | { |
---|
1355 | ruiVal = 0; |
---|
1356 | } |
---|
1357 | else |
---|
1358 | { |
---|
1359 | m_pcTDecBinIf->decodeBinEP( uiCode ); |
---|
1360 | if (uiCode == 0) |
---|
1361 | { |
---|
1362 | ruiVal = 5; |
---|
1363 | } |
---|
1364 | else |
---|
1365 | { |
---|
1366 | ruiVal = 1; |
---|
1367 | } |
---|
1368 | } |
---|
1369 | } |
---|
1370 | |
---|
1371 | inline Void copySaoOneLcuParam(SaoLcuParam* psDst, SaoLcuParam* psSrc) |
---|
1372 | { |
---|
1373 | Int i; |
---|
1374 | psDst->partIdx = psSrc->partIdx; |
---|
1375 | psDst->typeIdx = psSrc->typeIdx; |
---|
1376 | if (psDst->typeIdx != -1) |
---|
1377 | { |
---|
1378 | psDst->subTypeIdx = psSrc->subTypeIdx ; |
---|
1379 | psDst->length = psSrc->length; |
---|
1380 | for (i=0;i<psDst->length;i++) |
---|
1381 | { |
---|
1382 | psDst->offset[i] = psSrc->offset[i]; |
---|
1383 | } |
---|
1384 | } |
---|
1385 | else |
---|
1386 | { |
---|
1387 | psDst->length = 0; |
---|
1388 | for (i=0;i<SAO_BO_LEN;i++) |
---|
1389 | { |
---|
1390 | psDst->offset[i] = 0; |
---|
1391 | } |
---|
1392 | } |
---|
1393 | } |
---|
1394 | |
---|
1395 | Void TDecSbac::parseSaoOffset(SaoLcuParam* psSaoLcuParam, UInt compIdx) |
---|
1396 | { |
---|
1397 | UInt uiSymbol; |
---|
1398 | static Int iTypeLength[MAX_NUM_SAO_TYPE] = |
---|
1399 | { |
---|
1400 | SAO_EO_LEN, |
---|
1401 | SAO_EO_LEN, |
---|
1402 | SAO_EO_LEN, |
---|
1403 | SAO_EO_LEN, |
---|
1404 | SAO_BO_LEN |
---|
1405 | }; |
---|
1406 | |
---|
1407 | if (compIdx==2) |
---|
1408 | { |
---|
1409 | uiSymbol = (UInt)( psSaoLcuParam->typeIdx + 1); |
---|
1410 | } |
---|
1411 | else |
---|
1412 | { |
---|
1413 | parseSaoTypeIdx(uiSymbol); |
---|
1414 | } |
---|
1415 | psSaoLcuParam->typeIdx = (Int)uiSymbol - 1; |
---|
1416 | if (uiSymbol) |
---|
1417 | { |
---|
1418 | psSaoLcuParam->length = iTypeLength[psSaoLcuParam->typeIdx]; |
---|
1419 | |
---|
1420 | Int bitDepth = compIdx ? g_bitDepthC : g_bitDepthY; |
---|
1421 | Int offsetTh = 1 << min(bitDepth - 5,5); |
---|
1422 | |
---|
1423 | if( psSaoLcuParam->typeIdx == SAO_BO ) |
---|
1424 | { |
---|
1425 | for(Int i=0; i< psSaoLcuParam->length; i++) |
---|
1426 | { |
---|
1427 | parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); |
---|
1428 | psSaoLcuParam->offset[i] = uiSymbol; |
---|
1429 | } |
---|
1430 | for(Int i=0; i< psSaoLcuParam->length; i++) |
---|
1431 | { |
---|
1432 | if (psSaoLcuParam->offset[i] != 0) |
---|
1433 | { |
---|
1434 | m_pcTDecBinIf->decodeBinEP ( uiSymbol); |
---|
1435 | if (uiSymbol) |
---|
1436 | { |
---|
1437 | psSaoLcuParam->offset[i] = -psSaoLcuParam->offset[i] ; |
---|
1438 | } |
---|
1439 | } |
---|
1440 | } |
---|
1441 | parseSaoUflc(5, uiSymbol ); |
---|
1442 | psSaoLcuParam->subTypeIdx = uiSymbol; |
---|
1443 | } |
---|
1444 | else if( psSaoLcuParam->typeIdx < 4 ) |
---|
1445 | { |
---|
1446 | parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[0] = uiSymbol; |
---|
1447 | parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[1] = uiSymbol; |
---|
1448 | parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[2] = -(Int)uiSymbol; |
---|
1449 | parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[3] = -(Int)uiSymbol; |
---|
1450 | if (compIdx != 2) |
---|
1451 | { |
---|
1452 | parseSaoUflc(2, uiSymbol ); |
---|
1453 | psSaoLcuParam->subTypeIdx = uiSymbol; |
---|
1454 | psSaoLcuParam->typeIdx += psSaoLcuParam->subTypeIdx; |
---|
1455 | } |
---|
1456 | } |
---|
1457 | } |
---|
1458 | else |
---|
1459 | { |
---|
1460 | psSaoLcuParam->length = 0; |
---|
1461 | } |
---|
1462 | } |
---|
1463 | |
---|
1464 | Void TDecSbac::parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp) |
---|
1465 | { |
---|
1466 | Int iAddr = pcCU->getAddr(); |
---|
1467 | UInt uiSymbol; |
---|
1468 | for (Int iCompIdx=0; iCompIdx<3; iCompIdx++) |
---|
1469 | { |
---|
1470 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = 0; |
---|
1471 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = 0; |
---|
1472 | pSaoParam->saoLcuParam[iCompIdx][iAddr].subTypeIdx = 0; |
---|
1473 | pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx = -1; |
---|
1474 | pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[0] = 0; |
---|
1475 | pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[1] = 0; |
---|
1476 | pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[2] = 0; |
---|
1477 | pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[3] = 0; |
---|
1478 | |
---|
1479 | } |
---|
1480 | if (pSaoParam->bSaoFlag[0] || pSaoParam->bSaoFlag[1] ) |
---|
1481 | { |
---|
1482 | if (rx>0 && iCUAddrInSlice!=0 && allowMergeLeft) |
---|
1483 | { |
---|
1484 | parseSaoMerge(uiSymbol); |
---|
1485 | pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag = (Bool)uiSymbol; |
---|
1486 | } |
---|
1487 | if (pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag==0) |
---|
1488 | { |
---|
1489 | if ((ry > 0) && (iCUAddrUpInSlice>=0) && allowMergeUp) |
---|
1490 | { |
---|
1491 | parseSaoMerge(uiSymbol); |
---|
1492 | pSaoParam->saoLcuParam[0][iAddr].mergeUpFlag = (Bool)uiSymbol; |
---|
1493 | } |
---|
1494 | } |
---|
1495 | } |
---|
1496 | |
---|
1497 | for (Int iCompIdx=0; iCompIdx<3; iCompIdx++) |
---|
1498 | { |
---|
1499 | if ((iCompIdx == 0 && pSaoParam->bSaoFlag[0]) || (iCompIdx > 0 && pSaoParam->bSaoFlag[1]) ) |
---|
1500 | { |
---|
1501 | if (rx>0 && iCUAddrInSlice!=0 && allowMergeLeft) |
---|
1502 | { |
---|
1503 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag; |
---|
1504 | } |
---|
1505 | else |
---|
1506 | { |
---|
1507 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = 0; |
---|
1508 | } |
---|
1509 | |
---|
1510 | if (pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag==0) |
---|
1511 | { |
---|
1512 | if ((ry > 0) && (iCUAddrUpInSlice>=0) && allowMergeUp) |
---|
1513 | { |
---|
1514 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = pSaoParam->saoLcuParam[0][iAddr].mergeUpFlag; |
---|
1515 | } |
---|
1516 | else |
---|
1517 | { |
---|
1518 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = 0; |
---|
1519 | } |
---|
1520 | if (!pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag) |
---|
1521 | { |
---|
1522 | pSaoParam->saoLcuParam[2][iAddr].typeIdx = pSaoParam->saoLcuParam[1][iAddr].typeIdx; |
---|
1523 | parseSaoOffset(&(pSaoParam->saoLcuParam[iCompIdx][iAddr]), iCompIdx); |
---|
1524 | } |
---|
1525 | else |
---|
1526 | { |
---|
1527 | copySaoOneLcuParam(&pSaoParam->saoLcuParam[iCompIdx][iAddr], &pSaoParam->saoLcuParam[iCompIdx][iAddr-pSaoParam->numCuInWidth]); |
---|
1528 | } |
---|
1529 | } |
---|
1530 | else |
---|
1531 | { |
---|
1532 | copySaoOneLcuParam(&pSaoParam->saoLcuParam[iCompIdx][iAddr], &pSaoParam->saoLcuParam[iCompIdx][iAddr-1]); |
---|
1533 | } |
---|
1534 | } |
---|
1535 | else |
---|
1536 | { |
---|
1537 | pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx = -1; |
---|
1538 | pSaoParam->saoLcuParam[iCompIdx][iAddr].subTypeIdx = 0; |
---|
1539 | } |
---|
1540 | } |
---|
1541 | } |
---|
1542 | |
---|
1543 | /** |
---|
1544 | - Initialize our contexts from the nominated source. |
---|
1545 | . |
---|
1546 | \param pSrc Contexts to be copied. |
---|
1547 | */ |
---|
1548 | Void TDecSbac::xCopyContextsFrom( TDecSbac* pSrc ) |
---|
1549 | { |
---|
1550 | memcpy(m_contextModels, pSrc->m_contextModels, m_numContextModels*sizeof(m_contextModels[0])); |
---|
1551 | } |
---|
1552 | |
---|
1553 | Void TDecSbac::xCopyFrom( TDecSbac* pSrc ) |
---|
1554 | { |
---|
1555 | m_pcTDecBinIf->copyState( pSrc->m_pcTDecBinIf ); |
---|
1556 | |
---|
1557 | m_uiLastQp = pSrc->m_uiLastQp; |
---|
1558 | xCopyContextsFrom( pSrc ); |
---|
1559 | |
---|
1560 | } |
---|
1561 | |
---|
1562 | Void TDecSbac::load ( TDecSbac* pScr ) |
---|
1563 | { |
---|
1564 | xCopyFrom(pScr); |
---|
1565 | } |
---|
1566 | |
---|
1567 | Void TDecSbac::loadContexts ( TDecSbac* pScr ) |
---|
1568 | { |
---|
1569 | xCopyContextsFrom(pScr); |
---|
1570 | } |
---|
1571 | |
---|
1572 | #if H_3D_ARP |
---|
1573 | Void TDecSbac::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1574 | { |
---|
1575 | UInt uiMaxW = pcCU->getSlice()->getARPStepNum() - 1; |
---|
1576 | UInt uiW = 0; |
---|
1577 | UInt uiOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx); |
---|
1578 | UInt uiCode = 0; |
---|
1579 | |
---|
1580 | assert ( uiMaxW > 0 ); |
---|
1581 | |
---|
1582 | m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPW.get( 0, 0, 0 + uiOffset ) ); |
---|
1583 | |
---|
1584 | uiW = uiCode; |
---|
1585 | if( 1 == uiW ) |
---|
1586 | { |
---|
1587 | m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPW.get( 0, 0, 3 ) ); |
---|
1588 | uiW += ( 1 == uiCode ? 1 : 0 ); |
---|
1589 | } |
---|
1590 | pcCU->setARPWSubParts( ( UChar )( uiW ) , uiAbsPartIdx, uiDepth ); |
---|
1591 | } |
---|
1592 | #endif |
---|
1593 | |
---|
1594 | #if H_3D_IC |
---|
1595 | /** parse illumination compensation flag |
---|
1596 | * \param pcCU |
---|
1597 | * \param uiAbsPartIdx |
---|
1598 | * \param uiDepth |
---|
1599 | * \returns Void |
---|
1600 | */ |
---|
1601 | Void TDecSbac::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1602 | { |
---|
1603 | UInt uiSymbol = 0; |
---|
1604 | UInt uiCtxIC = pcCU->getCtxICFlag( uiAbsPartIdx ); |
---|
1605 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) ); |
---|
1606 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
1607 | DTRACE_CABAC_T( "\tICFlag" ); |
---|
1608 | DTRACE_CABAC_T( "\tuiCtxIC: "); |
---|
1609 | DTRACE_CABAC_V( uiCtxIC ); |
---|
1610 | DTRACE_CABAC_T( "\tuiSymbol: "); |
---|
1611 | DTRACE_CABAC_V( uiSymbol ); |
---|
1612 | DTRACE_CABAC_T( "\n"); |
---|
1613 | |
---|
1614 | pcCU->setICFlagSubParts( uiSymbol ? true : false , uiAbsPartIdx, 0, uiDepth ); |
---|
1615 | } |
---|
1616 | #endif |
---|
1617 | |
---|
1618 | //! \} |
---|