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