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-2012, 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 | #if RWTH_SDC_DLT_B0036 |
---|
41 | #define GetNumDepthValues() (pcCU->getSlice()->getSPS()->getNumDepthValues()) |
---|
42 | #define GetBitsPerDepthValue() (pcCU->getSlice()->getSPS()->getBitsPerDepthValue()) |
---|
43 | #endif |
---|
44 | |
---|
45 | //! \ingroup TLibDecoder |
---|
46 | //! \{ |
---|
47 | |
---|
48 | ////////////////////////////////////////////////////////////////////// |
---|
49 | // Construction/Destruction |
---|
50 | ////////////////////////////////////////////////////////////////////// |
---|
51 | |
---|
52 | TDecSbac::TDecSbac() |
---|
53 | // new structure here |
---|
54 | : m_pcBitstream ( 0 ) |
---|
55 | , m_pcTDecBinIf ( NULL ) |
---|
56 | , m_numContextModels ( 0 ) |
---|
57 | , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels ) |
---|
58 | , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
59 | #if LGE_ILLUCOMP_B0045 |
---|
60 | , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
61 | #endif |
---|
62 | , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
63 | , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
64 | #if H3D_IVRP |
---|
65 | , m_cResPredFlagSCModel ( 1, 1, NUM_RES_PRED_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
66 | #endif |
---|
67 | , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
68 | , m_cCUPredModeSCModel ( 1, 1, NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
69 | , m_cCUAlfCtrlFlagSCModel ( 1, 1, NUM_ALF_CTRL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
70 | , m_cCUIntraPredSCModel ( 1, 1, NUM_ADI_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
71 | , m_cCUChromaPredSCModel ( 1, 1, NUM_CHROMA_PRED_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
72 | , m_cCUDeltaQpSCModel ( 1, 1, NUM_DELTA_QP_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
73 | , m_cCUInterDirSCModel ( 1, 1, NUM_INTER_DIR_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
74 | , m_cCURefPicSCModel ( 1, 1, NUM_REF_NO_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
75 | , m_cCUMvdSCModel ( 1, 1, NUM_MV_RES_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
76 | , m_cCUQtCbfSCModel ( 1, 2, NUM_QT_CBF_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
77 | , m_cCUTransSubdivFlagSCModel ( 1, 1, NUM_TRANS_SUBDIV_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
78 | , m_cCUQtRootCbfSCModel ( 1, 1, NUM_QT_ROOT_CBF_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
79 | , m_cCUSigCoeffGroupSCModel ( 1, 2, NUM_SIG_CG_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
80 | , m_cCUSigSCModel ( 1, 1, NUM_SIG_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
81 | , m_cCuCtxLastX ( 1, 2, NUM_CTX_LAST_FLAG_XY , m_contextModels + m_numContextModels, m_numContextModels) |
---|
82 | , m_cCuCtxLastY ( 1, 2, NUM_CTX_LAST_FLAG_XY , m_contextModels + m_numContextModels, m_numContextModels) |
---|
83 | , m_cCUOneSCModel ( 1, 1, NUM_ONE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
84 | , m_cCUAbsSCModel ( 1, 1, NUM_ABS_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
85 | , m_cMVPIdxSCModel ( 1, 1, NUM_MVP_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
86 | , m_cALFFlagSCModel ( 1, 1, NUM_ALF_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
87 | , m_cALFUvlcSCModel ( 1, 1, NUM_ALF_UVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
88 | , m_cALFSvlcSCModel ( 1, 1, NUM_ALF_SVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
89 | , m_cCUAMPSCModel ( 1, 1, NUM_CU_AMP_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
90 | , m_cSaoFlagSCModel ( 1, 1, NUM_SAO_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
91 | , m_cSaoUvlcSCModel ( 1, 1, NUM_SAO_UVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
92 | , m_cSaoSvlcSCModel ( 1, 1, NUM_SAO_SVLC_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
93 | , m_cSaoMergeLeftSCModel ( 1, 1, NUM_SAO_MERGE_LEFT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
94 | , m_cSaoMergeUpSCModel ( 1, 1, NUM_SAO_MERGE_UP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
95 | , m_cSaoTypeIdxSCModel ( 1, 1, NUM_SAO_TYPE_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
96 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
97 | #if !PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
98 | , m_cDmmFlagSCModel ( 1, 1, NUM_DMM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
99 | , m_cDmmModeSCModel ( 1, 1, NUM_DMM_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
100 | #endif |
---|
101 | , m_cDmmDataSCModel ( 1, 1, NUM_DMM_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
102 | #endif |
---|
103 | #if LGE_EDGE_INTRA_A0070 |
---|
104 | , m_cEdgeIntraSCModel ( 1, 1, NUM_EDGE_INTRA_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
105 | #if LGE_EDGE_INTRA_DELTA_DC |
---|
106 | , m_cEdgeIntraDeltaDCSCModel ( 1, 1, NUM_EDGE_INTRA_DELTA_DC_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
107 | #endif |
---|
108 | #endif |
---|
109 | #if RWTH_SDC_DLT_B0036 |
---|
110 | #if !PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
111 | , m_cSDCFlagSCModel ( 1, 1, SDC_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
112 | #else |
---|
113 | , m_cDepthModeModel ( 1, 1, DEPTH_MODE_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
114 | , m_cDmmDeltaFlagModel ( 1, 1, DMM_DELTA_NUM_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
115 | #endif |
---|
116 | #if RWTH_SDC_CTX_SIMPL_D0032 |
---|
117 | , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
118 | , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
119 | , m_cSDCPredModeSCModel ( 1, 3, SDC_NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
120 | #else |
---|
121 | , m_cSDCResidualFlagSCModel ( 1, 2, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
122 | , m_cSDCResidualSignFlagSCModel ( 1, 2, SDC_NUM_SIGN_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
123 | , m_cSDCResidualSCModel ( 1, 2, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
124 | , m_cSDCPredModeSCModel ( 1, 3, SDC_NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
125 | #endif |
---|
126 | #endif |
---|
127 | { |
---|
128 | assert( m_numContextModels <= MAX_NUM_CTX_MOD ); |
---|
129 | m_iSliceGranularity = 0; |
---|
130 | } |
---|
131 | |
---|
132 | TDecSbac::~TDecSbac() |
---|
133 | { |
---|
134 | } |
---|
135 | |
---|
136 | // ==================================================================================================================== |
---|
137 | // Public member functions |
---|
138 | // ==================================================================================================================== |
---|
139 | |
---|
140 | #if CABAC_INIT_FLAG |
---|
141 | Void TDecSbac::resetEntropy(TComSlice* pSlice) |
---|
142 | { |
---|
143 | SliceType sliceType = pSlice->getSliceType(); |
---|
144 | Int qp = pSlice->getSliceQp(); |
---|
145 | |
---|
146 | if (pSlice->getPPS()->getCabacInitPresentFlag() && pSlice->getCabacInitFlag()) |
---|
147 | { |
---|
148 | switch (sliceType) |
---|
149 | { |
---|
150 | case P_SLICE: // change initialization table to B_SLICE initialization |
---|
151 | sliceType = B_SLICE; |
---|
152 | break; |
---|
153 | case B_SLICE: // change initialization table to P_SLICE initialization |
---|
154 | sliceType = P_SLICE; |
---|
155 | break; |
---|
156 | default : // should not occur |
---|
157 | assert(0); |
---|
158 | } |
---|
159 | } |
---|
160 | |
---|
161 | #else |
---|
162 | Void TDecSbac::resetEntropywithQPandInitIDC (Int qp, Int iID) |
---|
163 | { |
---|
164 | SliceType sliceType = (SliceType)iID; |
---|
165 | #endif |
---|
166 | |
---|
167 | m_cCUSplitFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SPLIT_FLAG ); |
---|
168 | m_cCUSkipFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SKIP_FLAG ); |
---|
169 | #if LGE_ILLUCOMP_B0045 |
---|
170 | m_cCUICFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_IC_FLAG ); |
---|
171 | #endif |
---|
172 | m_cCUMergeFlagExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT ); |
---|
173 | m_cCUMergeIdxExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_IDX_EXT ); |
---|
174 | #if H3D_IVRP |
---|
175 | m_cResPredFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_RES_PRED_FLAG ); |
---|
176 | #endif |
---|
177 | m_cCUAlfCtrlFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ALF_CTRL_FLAG ); |
---|
178 | m_cCUPartSizeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PART_SIZE ); |
---|
179 | m_cCUAMPSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CU_AMP_POS ); |
---|
180 | m_cCUPredModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PRED_MODE ); |
---|
181 | m_cCUIntraPredSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTRA_PRED_MODE ); |
---|
182 | m_cCUChromaPredSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CHROMA_PRED_MODE ); |
---|
183 | m_cCUInterDirSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_DIR ); |
---|
184 | m_cCUMvdSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MVD ); |
---|
185 | m_cCURefPicSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_REF_PIC ); |
---|
186 | m_cCUDeltaQpSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DQP ); |
---|
187 | m_cCUQtCbfSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_QT_CBF ); |
---|
188 | m_cCUQtRootCbfSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_QT_ROOT_CBF ); |
---|
189 | m_cCUSigCoeffGroupSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SIG_CG_FLAG ); |
---|
190 | m_cCUSigSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SIG_FLAG ); |
---|
191 | m_cCuCtxLastX.initBuffer ( sliceType, qp, (UChar*)INIT_LAST ); |
---|
192 | m_cCuCtxLastY.initBuffer ( sliceType, qp, (UChar*)INIT_LAST ); |
---|
193 | m_cCUOneSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ONE_FLAG ); |
---|
194 | m_cCUAbsSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ABS_FLAG ); |
---|
195 | m_cMVPIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MVP_IDX ); |
---|
196 | m_cALFFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ALF_FLAG ); |
---|
197 | m_cALFUvlcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ALF_UVLC ); |
---|
198 | m_cALFSvlcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ALF_SVLC ); |
---|
199 | m_cSaoFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_FLAG ); |
---|
200 | m_cSaoUvlcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_UVLC ); |
---|
201 | m_cSaoSvlcSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_SVLC ); |
---|
202 | m_cSaoMergeLeftSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG ); |
---|
203 | m_cSaoMergeUpSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_MERGE_UP_FLAG ); |
---|
204 | m_cSaoTypeIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_TYPE_IDX ); |
---|
205 | |
---|
206 | m_cCUTransSubdivFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); |
---|
207 | #if LGE_EDGE_INTRA_A0070 |
---|
208 | m_cEdgeIntraSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_EDGE_INTRA ); |
---|
209 | #if LGE_EDGE_INTRA_DELTA_DC |
---|
210 | m_cEdgeIntraDeltaDCSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_EDGE_INTRA_DELTA_DC ); |
---|
211 | #endif |
---|
212 | #endif |
---|
213 | m_uiLastDQpNonZero = 0; |
---|
214 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
215 | #if !PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
216 | m_cDmmFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_FLAG ); |
---|
217 | m_cDmmModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_MODE ); |
---|
218 | #endif |
---|
219 | m_cDmmDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM_DATA ); |
---|
220 | #endif |
---|
221 | #if RWTH_SDC_DLT_B0036 |
---|
222 | #if !PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
223 | m_cSDCFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_FLAG ); |
---|
224 | #else |
---|
225 | m_cDepthModeModel.initBuffer ( sliceType, qp, (UChar*)INIT_DEPTHMODE_FLAG ); |
---|
226 | m_cDmmDeltaFlagModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMMDELTA_FLAG ); |
---|
227 | #endif |
---|
228 | m_cSDCResidualFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); |
---|
229 | m_cSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL ); |
---|
230 | #if !RWTH_SDC_CTX_SIMPL_D0032 |
---|
231 | m_cSDCResidualSignFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_SIGN_FLAG ); |
---|
232 | #endif |
---|
233 | m_cSDCPredModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_PRED_MODE ); |
---|
234 | #endif |
---|
235 | |
---|
236 | // new structure |
---|
237 | m_uiLastQp = qp; |
---|
238 | |
---|
239 | m_pcTDecBinIf->start(); |
---|
240 | } |
---|
241 | |
---|
242 | /** The function does the following: Read out terminate bit. Flush CABAC. Byte-align for next tile. |
---|
243 | * Intialize CABAC states. Start CABAC. |
---|
244 | */ |
---|
245 | Void TDecSbac::updateContextTables( SliceType eSliceType, Int iQp ) |
---|
246 | { |
---|
247 | UInt uiBit; |
---|
248 | m_pcTDecBinIf->decodeBinTrm(uiBit); |
---|
249 | m_pcTDecBinIf->finish(); |
---|
250 | #if !OL_FLUSH_ALIGN |
---|
251 | // Account for misaligned CABAC. |
---|
252 | Int iCABACReadAhead = m_pcTDecBinIf->getBitsReadAhead(); |
---|
253 | iCABACReadAhead--; |
---|
254 | Int iStreamBits = 8-m_pcBitstream->getNumBitsUntilByteAligned(); |
---|
255 | if (iCABACReadAhead >= iStreamBits) |
---|
256 | { |
---|
257 | // Misaligned CABAC has read into the 1st byte of the next tile. |
---|
258 | // Back up a byte prior to alignment. |
---|
259 | m_pcBitstream->backupByte(); |
---|
260 | } |
---|
261 | #endif |
---|
262 | m_pcBitstream->readOutTrailingBits(); |
---|
263 | m_cCUSplitFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SPLIT_FLAG ); |
---|
264 | m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); |
---|
265 | #if LGE_ILLUCOMP_B0045 |
---|
266 | m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG ); |
---|
267 | #endif |
---|
268 | m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT ); |
---|
269 | m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT ); |
---|
270 | #if H3D_IVRP |
---|
271 | m_cResPredFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RES_PRED_FLAG ); |
---|
272 | #endif |
---|
273 | m_cCUAlfCtrlFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_CTRL_FLAG ); |
---|
274 | m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); |
---|
275 | m_cCUAMPSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_CU_AMP_POS ); |
---|
276 | m_cCUPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PRED_MODE ); |
---|
277 | m_cCUIntraPredSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTRA_PRED_MODE ); |
---|
278 | m_cCUChromaPredSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_CHROMA_PRED_MODE ); |
---|
279 | m_cCUInterDirSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_DIR ); |
---|
280 | m_cCUMvdSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MVD ); |
---|
281 | m_cCURefPicSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_REF_PIC ); |
---|
282 | m_cCUDeltaQpSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DQP ); |
---|
283 | m_cCUQtCbfSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_QT_CBF ); |
---|
284 | m_cCUQtRootCbfSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_QT_ROOT_CBF ); |
---|
285 | m_cCUSigCoeffGroupSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SIG_CG_FLAG ); |
---|
286 | m_cCUSigSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SIG_FLAG ); |
---|
287 | m_cCuCtxLastX.initBuffer ( eSliceType, iQp, (UChar*)INIT_LAST ); |
---|
288 | m_cCuCtxLastY.initBuffer ( eSliceType, iQp, (UChar*)INIT_LAST ); |
---|
289 | m_cCUOneSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ONE_FLAG ); |
---|
290 | m_cCUAbsSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ABS_FLAG ); |
---|
291 | m_cMVPIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MVP_IDX ); |
---|
292 | m_cALFFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_FLAG ); |
---|
293 | m_cALFUvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_UVLC ); |
---|
294 | m_cALFSvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ALF_SVLC ); |
---|
295 | m_cSaoFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_FLAG ); |
---|
296 | m_cSaoUvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_UVLC ); |
---|
297 | m_cSaoSvlcSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_SVLC ); |
---|
298 | m_cSaoMergeLeftSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG ); |
---|
299 | m_cSaoMergeUpSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_UP_FLAG ); |
---|
300 | m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); |
---|
301 | m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); |
---|
302 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
303 | #if !PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
304 | m_cDmmFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_FLAG ); |
---|
305 | m_cDmmModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_MODE ); |
---|
306 | #endif |
---|
307 | m_cDmmDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM_DATA ); |
---|
308 | #endif |
---|
309 | #if RWTH_SDC_DLT_B0036 |
---|
310 | #if !PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
311 | m_cSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG ); |
---|
312 | #else |
---|
313 | m_cDepthModeModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTHMODE_FLAG ); |
---|
314 | m_cDmmDeltaFlagModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMMDELTA_FLAG ); |
---|
315 | #endif |
---|
316 | m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); |
---|
317 | m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); |
---|
318 | #if !RWTH_SDC_CTX_SIMPL_D0032 |
---|
319 | m_cSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_SIGN_FLAG ); |
---|
320 | #endif |
---|
321 | m_cSDCPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_PRED_MODE ); |
---|
322 | #endif |
---|
323 | |
---|
324 | m_pcTDecBinIf->start(); |
---|
325 | } |
---|
326 | |
---|
327 | Void TDecSbac::readTileMarker( UInt& uiTileIdx, UInt uiBitsUsed ) |
---|
328 | { |
---|
329 | UInt uiSymbol; |
---|
330 | uiTileIdx = 0; |
---|
331 | for (Int iShift=uiBitsUsed-1; iShift>=0; iShift--) |
---|
332 | { |
---|
333 | m_pcTDecBinIf->decodeBinEP ( uiSymbol ); |
---|
334 | if (uiSymbol) |
---|
335 | { |
---|
336 | uiTileIdx |= (1<<iShift); |
---|
337 | } |
---|
338 | } |
---|
339 | } |
---|
340 | |
---|
341 | Void TDecSbac::parseTerminatingBit( UInt& ruiBit ) |
---|
342 | { |
---|
343 | m_pcTDecBinIf->decodeBinTrm( ruiBit ); |
---|
344 | } |
---|
345 | |
---|
346 | |
---|
347 | Void TDecSbac::xReadUnaryMaxSymbol( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol ) |
---|
348 | { |
---|
349 | if (uiMaxSymbol == 0) |
---|
350 | { |
---|
351 | ruiSymbol = 0; |
---|
352 | return; |
---|
353 | } |
---|
354 | |
---|
355 | m_pcTDecBinIf->decodeBin( ruiSymbol, pcSCModel[0] ); |
---|
356 | |
---|
357 | if( ruiSymbol == 0 || uiMaxSymbol == 1 ) |
---|
358 | { |
---|
359 | return; |
---|
360 | } |
---|
361 | |
---|
362 | UInt uiSymbol = 0; |
---|
363 | UInt uiCont; |
---|
364 | |
---|
365 | do |
---|
366 | { |
---|
367 | m_pcTDecBinIf->decodeBin( uiCont, pcSCModel[ iOffset ] ); |
---|
368 | uiSymbol++; |
---|
369 | } |
---|
370 | while( uiCont && ( uiSymbol < uiMaxSymbol - 1 ) ); |
---|
371 | |
---|
372 | if( uiCont && ( uiSymbol == uiMaxSymbol - 1 ) ) |
---|
373 | { |
---|
374 | uiSymbol++; |
---|
375 | } |
---|
376 | |
---|
377 | ruiSymbol = uiSymbol; |
---|
378 | } |
---|
379 | |
---|
380 | Void TDecSbac::xReadEpExGolomb( UInt& ruiSymbol, UInt uiCount ) |
---|
381 | { |
---|
382 | UInt uiSymbol = 0; |
---|
383 | UInt uiBit = 1; |
---|
384 | |
---|
385 | while( uiBit ) |
---|
386 | { |
---|
387 | m_pcTDecBinIf->decodeBinEP( uiBit ); |
---|
388 | uiSymbol += uiBit << uiCount++; |
---|
389 | } |
---|
390 | |
---|
391 | if ( --uiCount ) |
---|
392 | { |
---|
393 | UInt bins; |
---|
394 | m_pcTDecBinIf->decodeBinsEP( bins, uiCount ); |
---|
395 | uiSymbol += bins; |
---|
396 | } |
---|
397 | |
---|
398 | ruiSymbol = uiSymbol; |
---|
399 | } |
---|
400 | |
---|
401 | Void TDecSbac::xReadUnarySymbol( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset ) |
---|
402 | { |
---|
403 | m_pcTDecBinIf->decodeBin( ruiSymbol, pcSCModel[0] ); |
---|
404 | |
---|
405 | if( !ruiSymbol ) |
---|
406 | { |
---|
407 | return; |
---|
408 | } |
---|
409 | |
---|
410 | UInt uiSymbol = 0; |
---|
411 | UInt uiCont; |
---|
412 | |
---|
413 | do |
---|
414 | { |
---|
415 | m_pcTDecBinIf->decodeBin( uiCont, pcSCModel[ iOffset ] ); |
---|
416 | uiSymbol++; |
---|
417 | } |
---|
418 | while( uiCont ); |
---|
419 | |
---|
420 | ruiSymbol = uiSymbol; |
---|
421 | } |
---|
422 | |
---|
423 | /** Parsing of coeff_abs_level_minus3 |
---|
424 | * \param ruiSymbol reference to coeff_abs_level_minus3 |
---|
425 | * \param ruiGoRiceParam reference to Rice parameter |
---|
426 | * \returns Void |
---|
427 | */ |
---|
428 | Void TDecSbac::xReadGoRiceExGolomb( UInt &ruiSymbol, UInt &ruiGoRiceParam ) |
---|
429 | { |
---|
430 | Bool bExGolomb = false; |
---|
431 | UInt uiCodeWord = 0; |
---|
432 | UInt uiQuotient = 0; |
---|
433 | UInt uiRemainder = 0; |
---|
434 | UInt uiMaxVlc = g_auiGoRiceRange[ ruiGoRiceParam ]; |
---|
435 | UInt uiMaxPreLen = g_auiGoRicePrefixLen[ ruiGoRiceParam ]; |
---|
436 | |
---|
437 | do |
---|
438 | { |
---|
439 | uiQuotient++; |
---|
440 | m_pcTDecBinIf->decodeBinEP( uiCodeWord ); |
---|
441 | } |
---|
442 | while( uiCodeWord && uiQuotient < uiMaxPreLen ); |
---|
443 | |
---|
444 | uiCodeWord = 1 - uiCodeWord; |
---|
445 | uiQuotient -= uiCodeWord; |
---|
446 | |
---|
447 | if ( ruiGoRiceParam > 0 ) |
---|
448 | { |
---|
449 | m_pcTDecBinIf->decodeBinsEP( uiRemainder, ruiGoRiceParam ); |
---|
450 | } |
---|
451 | |
---|
452 | ruiSymbol = uiRemainder + ( uiQuotient << ruiGoRiceParam ); |
---|
453 | bExGolomb = ruiSymbol == ( uiMaxVlc + 1 ); |
---|
454 | |
---|
455 | if( bExGolomb ) |
---|
456 | { |
---|
457 | xReadEpExGolomb( uiCodeWord, 0 ); |
---|
458 | ruiSymbol += uiCodeWord; |
---|
459 | } |
---|
460 | |
---|
461 | ruiGoRiceParam = g_aauiGoRiceUpdate[ ruiGoRiceParam ][ min<UInt>( ruiSymbol, 23 ) ]; |
---|
462 | |
---|
463 | return; |
---|
464 | } |
---|
465 | |
---|
466 | |
---|
467 | /** Parse I_PCM information. |
---|
468 | * \param pcCU |
---|
469 | * \param uiAbsPartIdx |
---|
470 | * \param uiDepth |
---|
471 | * \returns Void |
---|
472 | * |
---|
473 | * If I_PCM flag indicates that the CU is I_PCM, parse its PCM alignment bits and codes. |
---|
474 | */ |
---|
475 | Void TDecSbac::parseIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
476 | { |
---|
477 | UInt uiSymbol; |
---|
478 | Int numSubseqIPCM = 0; |
---|
479 | Bool readPCMSampleFlag = false; |
---|
480 | |
---|
481 | if(pcCU->getNumSucIPCM() > 0) |
---|
482 | { |
---|
483 | readPCMSampleFlag = true; |
---|
484 | } |
---|
485 | else |
---|
486 | { |
---|
487 | m_pcTDecBinIf->decodeBinTrm(uiSymbol); |
---|
488 | |
---|
489 | if (uiSymbol) |
---|
490 | { |
---|
491 | readPCMSampleFlag = true; |
---|
492 | m_pcTDecBinIf->decodeNumSubseqIPCM(numSubseqIPCM); |
---|
493 | pcCU->setNumSucIPCM(numSubseqIPCM + 1); |
---|
494 | m_pcTDecBinIf->decodePCMAlignBits(); |
---|
495 | } |
---|
496 | } |
---|
497 | |
---|
498 | if (readPCMSampleFlag == true) |
---|
499 | { |
---|
500 | Bool bIpcmFlag = true; |
---|
501 | |
---|
502 | |
---|
503 | pcCU->setPartSizeSubParts ( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
504 | pcCU->setSizeSubParts ( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
505 | pcCU->setIPCMFlagSubParts ( bIpcmFlag, uiAbsPartIdx, uiDepth ); |
---|
506 | |
---|
507 | UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight(); |
---|
508 | UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; |
---|
509 | UInt uiChromaOffset = uiLumaOffset>>2; |
---|
510 | |
---|
511 | Pel* piPCMSample; |
---|
512 | UInt uiWidth; |
---|
513 | UInt uiHeight; |
---|
514 | UInt uiSampleBits; |
---|
515 | UInt uiX, uiY; |
---|
516 | |
---|
517 | piPCMSample = pcCU->getPCMSampleY() + uiLumaOffset; |
---|
518 | uiWidth = pcCU->getWidth(uiAbsPartIdx); |
---|
519 | uiHeight = pcCU->getHeight(uiAbsPartIdx); |
---|
520 | uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthLuma(); |
---|
521 | |
---|
522 | for(uiY = 0; uiY < uiHeight; uiY++) |
---|
523 | { |
---|
524 | for(uiX = 0; uiX < uiWidth; uiX++) |
---|
525 | { |
---|
526 | UInt uiSample; |
---|
527 | m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample); |
---|
528 | piPCMSample[uiX] = uiSample; |
---|
529 | } |
---|
530 | piPCMSample += uiWidth; |
---|
531 | } |
---|
532 | |
---|
533 | piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset; |
---|
534 | uiWidth = pcCU->getWidth(uiAbsPartIdx)/2; |
---|
535 | uiHeight = pcCU->getHeight(uiAbsPartIdx)/2; |
---|
536 | uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); |
---|
537 | |
---|
538 | for(uiY = 0; uiY < uiHeight; uiY++) |
---|
539 | { |
---|
540 | for(uiX = 0; uiX < uiWidth; uiX++) |
---|
541 | { |
---|
542 | UInt uiSample; |
---|
543 | m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample); |
---|
544 | piPCMSample[uiX] = uiSample; |
---|
545 | } |
---|
546 | piPCMSample += uiWidth; |
---|
547 | } |
---|
548 | |
---|
549 | piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset; |
---|
550 | uiWidth = pcCU->getWidth(uiAbsPartIdx)/2; |
---|
551 | uiHeight = pcCU->getHeight(uiAbsPartIdx)/2; |
---|
552 | uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); |
---|
553 | |
---|
554 | for(uiY = 0; uiY < uiHeight; uiY++) |
---|
555 | { |
---|
556 | for(uiX = 0; uiX < uiWidth; uiX++) |
---|
557 | { |
---|
558 | UInt uiSample; |
---|
559 | m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample); |
---|
560 | piPCMSample[uiX] = uiSample; |
---|
561 | } |
---|
562 | piPCMSample += uiWidth; |
---|
563 | } |
---|
564 | |
---|
565 | pcCU->setNumSucIPCM( pcCU->getNumSucIPCM() - 1); |
---|
566 | if(pcCU->getNumSucIPCM() == 0) |
---|
567 | { |
---|
568 | m_pcTDecBinIf->resetBac(); |
---|
569 | } |
---|
570 | } |
---|
571 | } |
---|
572 | |
---|
573 | /** parse skip flag |
---|
574 | * \param pcCU |
---|
575 | * \param uiAbsPartIdx |
---|
576 | * \param uiDepth |
---|
577 | * \returns Void |
---|
578 | */ |
---|
579 | Void TDecSbac::parseSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
580 | { |
---|
581 | if( pcCU->getSlice()->isIntra() ) |
---|
582 | { |
---|
583 | return; |
---|
584 | } |
---|
585 | |
---|
586 | UInt uiSymbol = 0; |
---|
587 | UInt uiCtxSkip = pcCU->getCtxSkipFlag( uiAbsPartIdx ); |
---|
588 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSkipFlagSCModel.get( 0, 0, uiCtxSkip ) ); |
---|
589 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
590 | DTRACE_CABAC_T( "\tSkipFlag" ); |
---|
591 | DTRACE_CABAC_T( "\tuiCtxSkip: "); |
---|
592 | DTRACE_CABAC_V( uiCtxSkip ); |
---|
593 | DTRACE_CABAC_T( "\tuiSymbol: "); |
---|
594 | DTRACE_CABAC_V( uiSymbol ); |
---|
595 | DTRACE_CABAC_T( "\n"); |
---|
596 | |
---|
597 | if( uiSymbol ) |
---|
598 | { |
---|
599 | pcCU->setPredModeSubParts( MODE_SKIP, uiAbsPartIdx, uiDepth ); |
---|
600 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
601 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
602 | pcCU->setMergeFlagSubParts( true , uiAbsPartIdx, 0, uiDepth ); |
---|
603 | } |
---|
604 | } |
---|
605 | |
---|
606 | #if LGE_ILLUCOMP_B0045 |
---|
607 | /** parse illumination compensation flag |
---|
608 | * \param pcCU |
---|
609 | * \param uiAbsPartIdx |
---|
610 | * \param uiDepth |
---|
611 | * \returns Void |
---|
612 | */ |
---|
613 | Void TDecSbac::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
614 | { |
---|
615 | UInt uiSymbol = 0; |
---|
616 | UInt uiCtxIC = pcCU->getCtxICFlag( uiAbsPartIdx ); |
---|
617 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) ); |
---|
618 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
619 | DTRACE_CABAC_T( "\tICFlag" ); |
---|
620 | DTRACE_CABAC_T( "\tuiCtxIC: "); |
---|
621 | DTRACE_CABAC_V( uiCtxIC ); |
---|
622 | DTRACE_CABAC_T( "\tuiSymbol: "); |
---|
623 | DTRACE_CABAC_V( uiSymbol ); |
---|
624 | DTRACE_CABAC_T( "\n"); |
---|
625 | |
---|
626 | pcCU->setICFlagSubParts( uiSymbol ? true : false , uiAbsPartIdx, 0, uiDepth ); |
---|
627 | } |
---|
628 | #endif |
---|
629 | |
---|
630 | |
---|
631 | /** parse merge flag |
---|
632 | * \param pcCU |
---|
633 | * \param uiAbsPartIdx |
---|
634 | * \param uiDepth |
---|
635 | * \param uiPUIdx |
---|
636 | * \returns Void |
---|
637 | */ |
---|
638 | Void TDecSbac::parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) |
---|
639 | { |
---|
640 | UInt uiSymbol; |
---|
641 | m_pcTDecBinIf->decodeBin( uiSymbol, *m_cCUMergeFlagExtSCModel.get( 0 ) ); |
---|
642 | pcCU->setMergeFlagSubParts( uiSymbol ? true : false, uiAbsPartIdx, uiPUIdx, uiDepth ); |
---|
643 | |
---|
644 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
645 | DTRACE_CABAC_T( "\tMergeFlag: " ); |
---|
646 | DTRACE_CABAC_V( uiSymbol ); |
---|
647 | DTRACE_CABAC_T( "\tAddress: " ); |
---|
648 | DTRACE_CABAC_V( pcCU->getAddr() ); |
---|
649 | DTRACE_CABAC_T( "\tuiAbsPartIdx: " ); |
---|
650 | DTRACE_CABAC_V( uiAbsPartIdx ); |
---|
651 | DTRACE_CABAC_T( "\n" ); |
---|
652 | } |
---|
653 | |
---|
654 | Void TDecSbac::parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
655 | { |
---|
656 | UInt uiNumCand = MRG_MAX_NUM_CANDS; |
---|
657 | UInt uiUnaryIdx = 0; |
---|
658 | uiNumCand = pcCU->getSlice()->getMaxNumMergeCand(); |
---|
659 | #if HHI_MPI |
---|
660 | const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE; |
---|
661 | const UInt uiMviMergePos = bMVIAvailable ? HHI_MPI_MERGE_POS : uiNumCand; |
---|
662 | #endif |
---|
663 | if ( uiNumCand > 1 ) |
---|
664 | { |
---|
665 | for( ; uiUnaryIdx < uiNumCand - 1; ++uiUnaryIdx ) |
---|
666 | { |
---|
667 | UInt uiSymbol = 0; |
---|
668 | if ( uiUnaryIdx==0 ) |
---|
669 | { |
---|
670 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUMergeIdxExtSCModel.get( 0, 0, 0 ) ); |
---|
671 | } |
---|
672 | else |
---|
673 | { |
---|
674 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
675 | } |
---|
676 | if( uiSymbol == 0 ) |
---|
677 | { |
---|
678 | break; |
---|
679 | } |
---|
680 | } |
---|
681 | } |
---|
682 | ruiMergeIndex = uiUnaryIdx; |
---|
683 | |
---|
684 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
685 | DTRACE_CABAC_T( "\tparseMergeIndex()" ) |
---|
686 | DTRACE_CABAC_T( "\tuiMRGIdx= " ) |
---|
687 | DTRACE_CABAC_V( ruiMergeIndex ) |
---|
688 | DTRACE_CABAC_T( "\n" ) |
---|
689 | #if HHI_MPI |
---|
690 | if( ruiMergeIndex > uiMviMergePos ) |
---|
691 | { |
---|
692 | assert( bMVIAvailable ); |
---|
693 | ruiMergeIndex--; |
---|
694 | } |
---|
695 | else if( ruiMergeIndex == uiMviMergePos ) |
---|
696 | { |
---|
697 | assert( bMVIAvailable ); |
---|
698 | pcCU->setTextureModeDepthSubParts( uiDepth, uiAbsPartIdx, uiDepth ); |
---|
699 | } |
---|
700 | #endif |
---|
701 | } |
---|
702 | |
---|
703 | #if H3D_IVRP |
---|
704 | Void |
---|
705 | TDecSbac::parseResPredFlag( TComDataCU* pcCU, Bool& rbResPredFlag, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
706 | { |
---|
707 | UInt uiCtx = pcCU->getCtxResPredFlag( uiAbsPartIdx ); |
---|
708 | UInt uiSymbol = 0; |
---|
709 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cResPredFlagSCModel.get( 0, 0, uiCtx ) ); |
---|
710 | rbResPredFlag = ( uiSymbol != 0 ); |
---|
711 | } |
---|
712 | #endif |
---|
713 | |
---|
714 | #if H3D_IVMP |
---|
715 | Void TDecSbac::parseMVPIdx ( Int& riMVPIdx, Int iNumAMVPCands ) |
---|
716 | { |
---|
717 | UInt uiSymbol; |
---|
718 | xReadUnaryMaxSymbol(uiSymbol, m_cMVPIdxSCModel.get(0), 1, iNumAMVPCands-1); |
---|
719 | riMVPIdx = uiSymbol; |
---|
720 | } |
---|
721 | #else |
---|
722 | Void TDecSbac::parseMVPIdx ( Int& riMVPIdx ) |
---|
723 | { |
---|
724 | UInt uiSymbol; |
---|
725 | xReadUnaryMaxSymbol(uiSymbol, m_cMVPIdxSCModel.get(0), 1, AMVP_MAX_NUM_CANDS-1); |
---|
726 | riMVPIdx = uiSymbol; |
---|
727 | } |
---|
728 | #endif |
---|
729 | |
---|
730 | Void TDecSbac::parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
731 | { |
---|
732 | if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) |
---|
733 | { |
---|
734 | pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx ); |
---|
735 | return; |
---|
736 | } |
---|
737 | |
---|
738 | UInt uiSymbol; |
---|
739 | |
---|
740 | #if H3D_QTL |
---|
741 | Bool bParseSplitFlag = true; |
---|
742 | |
---|
743 | TComSPS *sps = pcCU->getPic()->getSlice(0)->getSPS(); |
---|
744 | TComPic *pcTexture = pcCU->getSlice()->getTexturePic(); |
---|
745 | Bool bDepthMapDetect = (pcTexture != NULL); |
---|
746 | Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE); |
---|
747 | |
---|
748 | Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); |
---|
749 | if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTLPC()) |
---|
750 | { |
---|
751 | TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr()); |
---|
752 | assert(pcTextureCU->getDepth(uiAbsPartIdx) >= uiDepth); |
---|
753 | bParseSplitFlag = (pcTextureCU->getDepth(uiAbsPartIdx) > uiDepth); |
---|
754 | } |
---|
755 | |
---|
756 | if(bParseSplitFlag) |
---|
757 | { |
---|
758 | #endif |
---|
759 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSplitFlagSCModel.get( 0, 0, pcCU->getCtxSplitFlag( uiAbsPartIdx, uiDepth ) ) ); |
---|
760 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
761 | DTRACE_CABAC_T( "\tSplitFlag\n" ) |
---|
762 | #if H3D_QTL |
---|
763 | } |
---|
764 | else |
---|
765 | uiSymbol = 0; |
---|
766 | #endif |
---|
767 | |
---|
768 | pcCU->setDepthSubParts( uiDepth + uiSymbol, uiAbsPartIdx ); |
---|
769 | |
---|
770 | return; |
---|
771 | } |
---|
772 | |
---|
773 | /** parse partition size |
---|
774 | * \param pcCU |
---|
775 | * \param uiAbsPartIdx |
---|
776 | * \param uiDepth |
---|
777 | * \returns Void |
---|
778 | */ |
---|
779 | Void TDecSbac::parsePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
780 | { |
---|
781 | UInt uiSymbol, uiMode = 0; |
---|
782 | PartSize eMode; |
---|
783 | |
---|
784 | #if H3D_QTL |
---|
785 | Bool bParsePartSize = true; |
---|
786 | TComSPS *sps = pcCU->getPic()->getSlice(0)->getSPS(); |
---|
787 | TComPic *pcTexture = pcCU->getSlice()->getTexturePic(); |
---|
788 | Bool bDepthMapDetect = (pcTexture != NULL); |
---|
789 | Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE); |
---|
790 | |
---|
791 | Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); |
---|
792 | if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTLPC()) |
---|
793 | { |
---|
794 | TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr()); |
---|
795 | assert(pcTextureCU->getDepth(uiAbsPartIdx) >= uiDepth); |
---|
796 | if (pcTextureCU->getDepth(uiAbsPartIdx) == uiDepth && pcTextureCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN) |
---|
797 | { |
---|
798 | bParsePartSize = false; |
---|
799 | eMode = SIZE_2Nx2N; |
---|
800 | } |
---|
801 | } |
---|
802 | #endif |
---|
803 | |
---|
804 | if ( pcCU->isIntra( uiAbsPartIdx ) ) |
---|
805 | { |
---|
806 | #if H3D_QTL |
---|
807 | if(bParsePartSize) |
---|
808 | { |
---|
809 | #endif |
---|
810 | uiSymbol = 1; |
---|
811 | if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) |
---|
812 | { |
---|
813 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 0) ); |
---|
814 | } |
---|
815 | eMode = uiSymbol ? SIZE_2Nx2N : SIZE_NxN; |
---|
816 | #if H3D_QTL |
---|
817 | } |
---|
818 | #endif |
---|
819 | UInt uiTrLevel = 0; |
---|
820 | UInt uiWidthInBit = g_aucConvertToBit[pcCU->getWidth(uiAbsPartIdx)]+2; |
---|
821 | UInt uiTrSizeInBit = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxTrSize()]+2; |
---|
822 | uiTrLevel = uiWidthInBit >= uiTrSizeInBit ? uiWidthInBit - uiTrSizeInBit : 0; |
---|
823 | if( eMode == SIZE_NxN ) |
---|
824 | { |
---|
825 | pcCU->setTrIdxSubParts( 1+uiTrLevel, uiAbsPartIdx, uiDepth ); |
---|
826 | } |
---|
827 | else |
---|
828 | { |
---|
829 | pcCU->setTrIdxSubParts( uiTrLevel, uiAbsPartIdx, uiDepth ); |
---|
830 | } |
---|
831 | } |
---|
832 | else |
---|
833 | { |
---|
834 | #if H3D_QTL |
---|
835 | if(bParsePartSize) |
---|
836 | { |
---|
837 | #endif |
---|
838 | UInt uiMaxNumBits = 2; |
---|
839 | if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( pcCU->getSlice()->getSPS()->getDisInter4x4() && (g_uiMaxCUWidth>>uiDepth) == 8 && (g_uiMaxCUHeight>>uiDepth) == 8 ) ) |
---|
840 | { |
---|
841 | uiMaxNumBits ++; |
---|
842 | } |
---|
843 | for ( UInt ui = 0; ui < uiMaxNumBits; ui++ ) |
---|
844 | { |
---|
845 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) ); |
---|
846 | if ( uiSymbol ) |
---|
847 | { |
---|
848 | break; |
---|
849 | } |
---|
850 | uiMode++; |
---|
851 | } |
---|
852 | eMode = (PartSize) uiMode; |
---|
853 | if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) ) |
---|
854 | { |
---|
855 | if (eMode == SIZE_2NxN) |
---|
856 | { |
---|
857 | m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 )); |
---|
858 | if (uiSymbol == 0) |
---|
859 | { |
---|
860 | m_pcTDecBinIf->decodeBinEP(uiSymbol); |
---|
861 | eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD); |
---|
862 | } |
---|
863 | } |
---|
864 | else if (eMode == SIZE_Nx2N) |
---|
865 | { |
---|
866 | m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 )); |
---|
867 | if (uiSymbol == 0) |
---|
868 | { |
---|
869 | m_pcTDecBinIf->decodeBinEP(uiSymbol); |
---|
870 | eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N); |
---|
871 | } |
---|
872 | } |
---|
873 | } |
---|
874 | #if H3D_QTL |
---|
875 | } |
---|
876 | #endif |
---|
877 | } |
---|
878 | pcCU->setPartSizeSubParts( eMode, uiAbsPartIdx, uiDepth ); |
---|
879 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
880 | } |
---|
881 | |
---|
882 | /** parse prediction mode |
---|
883 | * \param pcCU |
---|
884 | * \param uiAbsPartIdx |
---|
885 | * \param uiDepth |
---|
886 | * \returns Void |
---|
887 | */ |
---|
888 | Void TDecSbac::parsePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
889 | { |
---|
890 | if( pcCU->getSlice()->isIntra() ) |
---|
891 | { |
---|
892 | pcCU->setPredModeSubParts( MODE_INTRA, uiAbsPartIdx, uiDepth ); |
---|
893 | return; |
---|
894 | } |
---|
895 | |
---|
896 | UInt uiSymbol; |
---|
897 | Int iPredMode = MODE_INTER; |
---|
898 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPredModeSCModel.get( 0, 0, 0 ) ); |
---|
899 | iPredMode += uiSymbol; |
---|
900 | pcCU->setPredModeSubParts( (PredMode)iPredMode, uiAbsPartIdx, uiDepth ); |
---|
901 | } |
---|
902 | #if PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
903 | Void TDecSbac::parseDepthIntraMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
904 | { |
---|
905 | UInt uiPuIdx = ( pcCU->getWidth(uiAbsPartIdx) == 64 )? 2 : ( ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && pcCU->getWidth(uiAbsPartIdx) == 8 )? 0 : 1); |
---|
906 | UInt uiDir = 0; |
---|
907 | Bool bSDCFlag = 0; |
---|
908 | UInt uiSymbol = 1; |
---|
909 | UInt uiCode = 0 ; |
---|
910 | UInt uiBinNum = 0; |
---|
911 | UInt uiCtxDepthMode = 0; |
---|
912 | if ( uiPuIdx ==2 ) |
---|
913 | { |
---|
914 | while(uiBinNum<2 && uiSymbol) |
---|
915 | { |
---|
916 | uiCtxDepthMode = uiPuIdx*3 + uiBinNum; |
---|
917 | m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); |
---|
918 | uiCode = (uiCode<<1)+uiSymbol; |
---|
919 | uiBinNum++; |
---|
920 | } |
---|
921 | if (uiCode == 0) { uiDir = PLANAR_IDX; bSDCFlag = 1;} |
---|
922 | else if (uiCode == 2) { uiDir = 0; bSDCFlag = 0;} |
---|
923 | else if (uiCode == 3) { uiDir = DC_IDX; bSDCFlag = 1;} |
---|
924 | } |
---|
925 | else if ( uiPuIdx ==0 ) |
---|
926 | { |
---|
927 | while(uiBinNum<3 && uiSymbol) |
---|
928 | { |
---|
929 | uiCtxDepthMode = uiPuIdx*3 + ( uiBinNum >= 2? 2 : uiBinNum ); |
---|
930 | m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); |
---|
931 | uiCode = (uiCode<<1)+uiSymbol; |
---|
932 | uiBinNum++; |
---|
933 | } |
---|
934 | if (uiCode == 0) { uiDir = 0; bSDCFlag = 0;} |
---|
935 | else if (uiCode == 2) { uiDir = DMM_WEDGE_FULL_IDX; bSDCFlag = 0;} |
---|
936 | else if (uiCode == 6) { uiDir = DMM_WEDGE_PREDTEX_IDX; bSDCFlag = 0;} |
---|
937 | else if (uiCode == 7) { uiDir = EDGE_INTRA_IDX; bSDCFlag = 0;} |
---|
938 | } |
---|
939 | else |
---|
940 | { |
---|
941 | uiCtxDepthMode = uiPuIdx*3 ; |
---|
942 | m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); |
---|
943 | uiCode = (uiCode<<1)+uiSymbol; |
---|
944 | if (!uiSymbol) |
---|
945 | { |
---|
946 | uiCtxDepthMode = uiPuIdx*3 + 1; |
---|
947 | m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); |
---|
948 | uiCode = (uiCode<<1)+uiSymbol; |
---|
949 | if (uiSymbol) |
---|
950 | { |
---|
951 | uiCtxDepthMode = uiPuIdx*3 + 2; |
---|
952 | m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); |
---|
953 | uiCode = (uiCode<<1)+uiSymbol; |
---|
954 | } |
---|
955 | } |
---|
956 | else |
---|
957 | { |
---|
958 | uiCtxDepthMode = uiPuIdx*3 + 1; |
---|
959 | m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); |
---|
960 | uiCode = (uiCode<<1)+uiSymbol; |
---|
961 | if (!uiSymbol) |
---|
962 | { |
---|
963 | uiCtxDepthMode = uiPuIdx*3 + 2; |
---|
964 | m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); |
---|
965 | uiCode = (uiCode<<1)+uiSymbol; |
---|
966 | } |
---|
967 | else |
---|
968 | { |
---|
969 | uiBinNum = 0; |
---|
970 | while( uiSymbol && uiBinNum<3 ) |
---|
971 | { |
---|
972 | uiCtxDepthMode = uiPuIdx*3 + 2; |
---|
973 | m_pcTDecBinIf->decodeBin(uiSymbol,m_cDepthModeModel.get(0,0,uiCtxDepthMode)); |
---|
974 | uiCode = (uiCode<<1)+uiSymbol; |
---|
975 | uiBinNum++; |
---|
976 | } |
---|
977 | } |
---|
978 | } |
---|
979 | if (uiCode == 0) { uiDir = PLANAR_IDX; bSDCFlag = 1;} |
---|
980 | else if (uiCode == 2) { uiDir = 5; bSDCFlag = 0;} |
---|
981 | else if (uiCode == 3) { uiDir = DMM_WEDGE_FULL_IDX; bSDCFlag = 1;} |
---|
982 | else if (uiCode == 4) { uiDir = DMM_WEDGE_FULL_IDX; bSDCFlag = 0;} |
---|
983 | else if (uiCode == 5) { uiDir = DMM_CONTOUR_PREDTEX_IDX; bSDCFlag = 0;} |
---|
984 | else if (uiCode == 6) { uiDir = DMM_WEDGE_PREDTEX_IDX; bSDCFlag = 0;} |
---|
985 | else if (uiCode == 14) { uiDir = DC_IDX; bSDCFlag = 1;} |
---|
986 | else if (uiCode == 31) { uiDir = DMM_WEDGE_PREDDIR_IDX; bSDCFlag = 0;} |
---|
987 | else if (uiCode == 30) { uiDir = EDGE_INTRA_IDX; bSDCFlag = 0;} |
---|
988 | } |
---|
989 | pcCU->setLumaIntraDirSubParts( (UChar)uiDir, uiAbsPartIdx, uiDepth ); |
---|
990 | pcCU->setSDCFlagSubParts(bSDCFlag, uiAbsPartIdx, 0, uiDepth); |
---|
991 | } |
---|
992 | Void TDecSbac::parseDepthModelingTable ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
993 | { |
---|
994 | parseDepthIntraMode(pcCU,uiAbsPartIdx,uiDepth); |
---|
995 | |
---|
996 | UInt uiDir = pcCU->getLumaIntraDir(uiAbsPartIdx); |
---|
997 | Bool bSdcFlag = pcCU->getSDCAvailable(uiAbsPartIdx) && pcCU->getSDCFlag(uiAbsPartIdx); |
---|
998 | Bool bDmmFlag = (uiDir >= NUM_INTRA_MODE && uiDir < EDGE_INTRA_IDX &&(!bSdcFlag))? 1:0; |
---|
999 | if (uiDir >= NUM_INTRA_MODE && uiDir < EDGE_INTRA_IDX)//DMM modes and SDC DMM1 |
---|
1000 | { |
---|
1001 | if( uiDir == DMM_WEDGE_FULL_IDX ) { xParseWedgeFullInfo ( pcCU, uiAbsPartIdx, uiDepth ); } |
---|
1002 | else if( uiDir == DMM_WEDGE_PREDTEX_IDX ) { xParseWedgePredTexInfo ( pcCU, uiAbsPartIdx, uiDepth ); } |
---|
1003 | else if( uiDir == DMM_WEDGE_PREDDIR_IDX ) { xParseWedgePredDirInfo ( pcCU, uiAbsPartIdx, uiDepth ); } |
---|
1004 | } |
---|
1005 | else if(uiDir >= EDGE_INTRA_IDX)//CCM mode |
---|
1006 | { |
---|
1007 | xParseEdgeIntraInfo( pcCU, uiAbsPartIdx, uiDepth ); |
---|
1008 | } |
---|
1009 | |
---|
1010 | UInt uiSymbol; |
---|
1011 | if (bDmmFlag) |
---|
1012 | { |
---|
1013 | if (bDmmFlag) |
---|
1014 | { |
---|
1015 | m_pcTDecBinIf->decodeBin( uiSymbol , m_cDmmDeltaFlagModel.get(0, 0, 0) ); |
---|
1016 | uiDir += uiSymbol; |
---|
1017 | } |
---|
1018 | if (uiSymbol) |
---|
1019 | { |
---|
1020 | UInt uiDC; |
---|
1021 | Int iDC = 0,iDC1 = 0,iDC2 = 0; |
---|
1022 | for ( Int i = 0; i <2; i++ ) |
---|
1023 | { |
---|
1024 | xReadExGolombLevel( uiDC, m_cDmmDataSCModel.get(0, 0, 1) ); |
---|
1025 | iDC = uiDC; |
---|
1026 | if ( uiDC ) |
---|
1027 | { |
---|
1028 | UInt uiSign; |
---|
1029 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
1030 | if ( uiSign ) |
---|
1031 | { |
---|
1032 | iDC = -iDC; |
---|
1033 | } |
---|
1034 | } |
---|
1035 | if ( i == 0 ) { iDC1 = iDC; } |
---|
1036 | else { iDC2 = iDC; } |
---|
1037 | } |
---|
1038 | |
---|
1039 | if( uiDir == DMM_WEDGE_FULL_D_IDX ) |
---|
1040 | { |
---|
1041 | pcCU->setWedgeFullDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); |
---|
1042 | pcCU->setWedgeFullDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); |
---|
1043 | } |
---|
1044 | else if( uiDir == DMM_WEDGE_PREDDIR_D_IDX ) |
---|
1045 | { |
---|
1046 | pcCU->setWedgePredDirDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); |
---|
1047 | pcCU->setWedgePredDirDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); |
---|
1048 | } |
---|
1049 | else if( uiDir == DMM_WEDGE_PREDTEX_D_IDX) |
---|
1050 | { |
---|
1051 | pcCU->setWedgePredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); |
---|
1052 | pcCU->setWedgePredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); |
---|
1053 | } |
---|
1054 | else if (uiDir== DMM_CONTOUR_PREDTEX_D_IDX ) |
---|
1055 | { |
---|
1056 | pcCU->setContourPredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); |
---|
1057 | pcCU->setContourPredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); |
---|
1058 | } |
---|
1059 | } |
---|
1060 | } |
---|
1061 | else if (uiDir >= EDGE_INTRA_IDX) |
---|
1062 | { |
---|
1063 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 0) ); |
---|
1064 | if( uiSymbol ) |
---|
1065 | { |
---|
1066 | uiDir = EDGE_INTRA_DELTA_IDX; |
---|
1067 | Int iDeltaDC = 0,iDeltaDC0 = 0,iDeltaDC1 = 0; |
---|
1068 | for (Int i = 0; i<2; i++) |
---|
1069 | { |
---|
1070 | xReadExGolombLevel( (UInt &) iDeltaDC, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) ); |
---|
1071 | if( iDeltaDC != 0 ) |
---|
1072 | { |
---|
1073 | UInt uiSign; |
---|
1074 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
1075 | if ( uiSign ) |
---|
1076 | { |
---|
1077 | iDeltaDC = -iDeltaDC; |
---|
1078 | } |
---|
1079 | } |
---|
1080 | if ( i == 0 ) { iDeltaDC0 = iDeltaDC; } |
---|
1081 | else { iDeltaDC1 = iDeltaDC; } |
---|
1082 | } |
---|
1083 | |
---|
1084 | pcCU->setEdgeDeltaDC0( uiAbsPartIdx, iDeltaDC0 ); |
---|
1085 | pcCU->setEdgeDeltaDC1( uiAbsPartIdx, iDeltaDC1 ); |
---|
1086 | } |
---|
1087 | } |
---|
1088 | else if(bSdcFlag)//SDC mode |
---|
1089 | { |
---|
1090 | assert(pcCU->getPartitionSize(uiAbsPartIdx)!=SIZE_NxN); |
---|
1091 | pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth); |
---|
1092 | pcCU->setCbfSubParts(1, 1, 1, uiAbsPartIdx, uiDepth); |
---|
1093 | |
---|
1094 | UInt uiNumSegments = ( uiDir == DC_IDX || uiDir == PLANAR_IDX )? 1 : 2; |
---|
1095 | for (int uiSeg=0; uiSeg<uiNumSegments; uiSeg++) |
---|
1096 | { |
---|
1097 | parseSDCResidualData(pcCU, uiAbsPartIdx, uiDepth, uiSeg); |
---|
1098 | } |
---|
1099 | } |
---|
1100 | |
---|
1101 | pcCU->setLumaIntraDirSubParts( (UChar)uiDir, uiAbsPartIdx, uiDepth ); |
---|
1102 | } |
---|
1103 | #endif |
---|
1104 | Void TDecSbac::parseIntraDirLumaAng ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1105 | { |
---|
1106 | UInt uiSymbol; |
---|
1107 | Int intraPredMode; |
---|
1108 | #if PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
1109 | if (pcCU->getSlice()->getSPS()->isDepth()) |
---|
1110 | { |
---|
1111 | parseDepthModelingTable(pcCU, uiAbsPartIdx, uiDepth); |
---|
1112 | } |
---|
1113 | if (pcCU->getLumaIntraDir(uiAbsPartIdx)<NUM_INTRA_MODE && !pcCU->getSDCFlag(uiAbsPartIdx)) |
---|
1114 | { |
---|
1115 | #else |
---|
1116 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
1117 | UInt uiFlag = 0; |
---|
1118 | if( pcCU->getSlice()->getSPS()->getUseDMM() && (g_uiMaxCUWidth>>uiDepth) <= DMM_WEDGEMODEL_MAX_SIZE ) |
---|
1119 | { |
---|
1120 | m_pcTDecBinIf->decodeBin( uiFlag, m_cDmmFlagSCModel.get(0, 0, 0) ); |
---|
1121 | } |
---|
1122 | if( uiFlag ) |
---|
1123 | { |
---|
1124 | UInt uiDMMode; |
---|
1125 | |
---|
1126 | #if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX |
---|
1127 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmModeSCModel.get(0, 0, 0) ); uiDMMode = uiSymbol; |
---|
1128 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmModeSCModel.get(0, 0, 0) ); uiDMMode |= uiSymbol << 1; |
---|
1129 | if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && g_uiMaxCUWidth>>uiDepth > 4 ) |
---|
1130 | { |
---|
1131 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmModeSCModel.get(0, 0, 0) ); uiDMMode |= uiSymbol << 2; |
---|
1132 | } |
---|
1133 | #else |
---|
1134 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmModeSCModel.get(0, 0, 0) ); uiDMMode = uiSymbol; |
---|
1135 | if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && g_uiMaxCUWidth>>uiDepth > 4 ) |
---|
1136 | { |
---|
1137 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmModeSCModel.get(0, 0, 0) ); uiDMMode |= uiSymbol << 1; |
---|
1138 | } |
---|
1139 | #endif |
---|
1140 | intraPredMode = uiDMMode + NUM_INTRA_MODE; |
---|
1141 | |
---|
1142 | #if HHI_DMM_WEDGE_INTRA |
---|
1143 | if( intraPredMode == DMM_WEDGE_FULL_IDX ) { xParseWedgeFullInfo ( pcCU, uiAbsPartIdx, uiDepth ); } |
---|
1144 | if( intraPredMode == DMM_WEDGE_FULL_D_IDX ) { xParseWedgeFullDeltaInfo ( pcCU, uiAbsPartIdx, uiDepth ); } |
---|
1145 | if( intraPredMode == DMM_WEDGE_PREDDIR_IDX ) { xParseWedgePredDirInfo ( pcCU, uiAbsPartIdx, uiDepth ); } |
---|
1146 | if( intraPredMode == DMM_WEDGE_PREDDIR_D_IDX ) { xParseWedgePredDirDeltaInfo ( pcCU, uiAbsPartIdx, uiDepth ); } |
---|
1147 | #endif |
---|
1148 | #if HHI_DMM_PRED_TEX |
---|
1149 | if( intraPredMode == DMM_WEDGE_PREDTEX_D_IDX ) { xParseWedgePredTexDeltaInfo ( pcCU, uiAbsPartIdx, uiDepth ); } |
---|
1150 | #if LGE_DMM3_SIMP_C0044 |
---|
1151 | if( intraPredMode == DMM_WEDGE_PREDTEX_IDX ) { xParseWedgePredTexInfo ( pcCU, uiAbsPartIdx, uiDepth ); } |
---|
1152 | #endif |
---|
1153 | if( intraPredMode == DMM_CONTOUR_PREDTEX_D_IDX ) { xParseContourPredTexDeltaInfo( pcCU, uiAbsPartIdx, uiDepth ); } |
---|
1154 | #endif |
---|
1155 | } |
---|
1156 | else |
---|
1157 | { |
---|
1158 | #endif |
---|
1159 | |
---|
1160 | #if LGE_EDGE_INTRA_A0070 |
---|
1161 | Bool bCodeEdgeIntra = false; |
---|
1162 | if( pcCU->getSlice()->getSPS()->isDepth() ) |
---|
1163 | { |
---|
1164 | UInt uiPUWidth = pcCU->getWidth( uiAbsPartIdx ) >> (pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 1 : 0); |
---|
1165 | if( uiPUWidth <= LGE_EDGE_INTRA_MAX_SIZE && uiPUWidth >= LGE_EDGE_INTRA_MIN_SIZE ) |
---|
1166 | bCodeEdgeIntra = true; |
---|
1167 | } |
---|
1168 | #endif |
---|
1169 | #endif |
---|
1170 | Int uiPreds[3] = {-1, -1, -1}; |
---|
1171 | Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds); |
---|
1172 | #if !PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
1173 | #if LGE_EDGE_INTRA_A0070 |
---|
1174 | UInt uiCheckBit = 0; |
---|
1175 | #endif |
---|
1176 | #endif |
---|
1177 | |
---|
1178 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUIntraPredSCModel.get( 0, 0, 0) ); |
---|
1179 | |
---|
1180 | if ( uiSymbol ) |
---|
1181 | { |
---|
1182 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
1183 | if (uiSymbol) |
---|
1184 | { |
---|
1185 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
1186 | uiSymbol++; |
---|
1187 | } |
---|
1188 | intraPredMode = uiPreds[uiSymbol]; |
---|
1189 | } |
---|
1190 | else |
---|
1191 | { |
---|
1192 | intraPredMode = 0; |
---|
1193 | |
---|
1194 | |
---|
1195 | m_pcTDecBinIf->decodeBinsEP( uiSymbol, 5 ); |
---|
1196 | #if !PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
1197 | #if LGE_EDGE_INTRA_A0070 |
---|
1198 | if (bCodeEdgeIntra) |
---|
1199 | { |
---|
1200 | if (uiSymbol==31) |
---|
1201 | { |
---|
1202 | m_pcTDecBinIf->decodeBinsEP(uiCheckBit,1); |
---|
1203 | if (uiCheckBit) |
---|
1204 | uiSymbol = EDGE_INTRA_IDX; |
---|
1205 | } |
---|
1206 | } |
---|
1207 | #endif |
---|
1208 | #endif |
---|
1209 | intraPredMode = uiSymbol; |
---|
1210 | |
---|
1211 | //postponed sorting of MPMs (only in remaining branch) |
---|
1212 | if (uiPreds[0] > uiPreds[1]) |
---|
1213 | { |
---|
1214 | std::swap(uiPreds[0], uiPreds[1]); |
---|
1215 | } |
---|
1216 | if (uiPreds[0] > uiPreds[2]) |
---|
1217 | { |
---|
1218 | std::swap(uiPreds[0], uiPreds[2]); |
---|
1219 | } |
---|
1220 | if (uiPreds[1] > uiPreds[2]) |
---|
1221 | { |
---|
1222 | std::swap(uiPreds[1], uiPreds[2]); |
---|
1223 | } |
---|
1224 | #if !PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
1225 | #if LGE_EDGE_INTRA_A0070 |
---|
1226 | if ( intraPredMode != EDGE_INTRA_IDX) |
---|
1227 | { |
---|
1228 | #endif |
---|
1229 | #endif |
---|
1230 | for ( Int i = 0; i < uiPredNum; i++ ) |
---|
1231 | { |
---|
1232 | intraPredMode += ( intraPredMode >= uiPreds[i] ); |
---|
1233 | } |
---|
1234 | #if !PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
1235 | #if LGE_EDGE_INTRA_A0070 |
---|
1236 | } |
---|
1237 | #endif |
---|
1238 | #endif |
---|
1239 | } |
---|
1240 | |
---|
1241 | #if !PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
1242 | #if LGE_EDGE_INTRA_A0070 |
---|
1243 | if( intraPredMode == EDGE_INTRA_IDX ) |
---|
1244 | { |
---|
1245 | xParseEdgeIntraInfo( pcCU, uiAbsPartIdx, uiDepth ); |
---|
1246 | #if LGE_EDGE_INTRA_DELTA_DC |
---|
1247 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 0) ); |
---|
1248 | if( uiSymbol ) |
---|
1249 | { |
---|
1250 | intraPredMode = EDGE_INTRA_DELTA_IDX; |
---|
1251 | Int iDeltaDC0; |
---|
1252 | Int iDeltaDC1; |
---|
1253 | |
---|
1254 | xReadExGolombLevel( (UInt &) iDeltaDC0, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) ); |
---|
1255 | if( iDeltaDC0 != 0 ) |
---|
1256 | { |
---|
1257 | UInt uiSign; |
---|
1258 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
1259 | if ( uiSign ) |
---|
1260 | { |
---|
1261 | iDeltaDC0 = -iDeltaDC0; |
---|
1262 | } |
---|
1263 | } |
---|
1264 | xReadExGolombLevel( (UInt &) iDeltaDC1, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) ); |
---|
1265 | if( iDeltaDC1 != 0 ) |
---|
1266 | { |
---|
1267 | UInt uiSign; |
---|
1268 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
1269 | if ( uiSign ) |
---|
1270 | { |
---|
1271 | iDeltaDC1 = -iDeltaDC1; |
---|
1272 | } |
---|
1273 | } |
---|
1274 | |
---|
1275 | pcCU->setEdgeDeltaDC0( uiAbsPartIdx, iDeltaDC0 ); |
---|
1276 | pcCU->setEdgeDeltaDC1( uiAbsPartIdx, iDeltaDC1 ); |
---|
1277 | } |
---|
1278 | #endif |
---|
1279 | } |
---|
1280 | #endif |
---|
1281 | |
---|
1282 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
1283 | } |
---|
1284 | #endif |
---|
1285 | pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, uiAbsPartIdx, uiDepth ); |
---|
1286 | #else |
---|
1287 | pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, uiAbsPartIdx, uiDepth ); |
---|
1288 | } |
---|
1289 | #endif |
---|
1290 | } |
---|
1291 | |
---|
1292 | Void TDecSbac::parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1293 | { |
---|
1294 | UInt uiSymbol; |
---|
1295 | |
---|
1296 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUChromaPredSCModel.get( 0, 0, 0 ) ); |
---|
1297 | |
---|
1298 | if( uiSymbol == 0 ) |
---|
1299 | { |
---|
1300 | uiSymbol = DM_CHROMA_IDX; |
---|
1301 | } |
---|
1302 | else |
---|
1303 | { |
---|
1304 | if( pcCU->getSlice()->getSPS()->getUseLMChroma() ) |
---|
1305 | { |
---|
1306 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUChromaPredSCModel.get( 0, 0, 1 ) ); |
---|
1307 | } |
---|
1308 | else |
---|
1309 | { |
---|
1310 | uiSymbol = 1; |
---|
1311 | } |
---|
1312 | |
---|
1313 | if( uiSymbol == 0 ) |
---|
1314 | { |
---|
1315 | uiSymbol = LM_CHROMA_IDX; |
---|
1316 | } |
---|
1317 | else |
---|
1318 | { |
---|
1319 | UInt uiIPredMode; |
---|
1320 | m_pcTDecBinIf->decodeBinsEP( uiIPredMode, 2 ); |
---|
1321 | UInt uiAllowedChromaDir[ NUM_CHROMA_MODE ]; |
---|
1322 | pcCU->getAllowedChromaDir( uiAbsPartIdx, uiAllowedChromaDir ); |
---|
1323 | uiSymbol = uiAllowedChromaDir[ uiIPredMode ]; |
---|
1324 | } |
---|
1325 | } |
---|
1326 | pcCU->setChromIntraDirSubParts( uiSymbol, uiAbsPartIdx, uiDepth ); |
---|
1327 | return; |
---|
1328 | } |
---|
1329 | |
---|
1330 | Void TDecSbac::parseInterDir( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1331 | { |
---|
1332 | UInt uiSymbol; |
---|
1333 | const UInt uiCtx = pcCU->getCtxInterDir( uiAbsPartIdx ); |
---|
1334 | ContextModel *pCtx = m_cCUInterDirSCModel.get( 0 ); |
---|
1335 | m_pcTDecBinIf->decodeBin( uiSymbol, *( pCtx + uiCtx ) ); |
---|
1336 | |
---|
1337 | if( uiSymbol ) |
---|
1338 | { |
---|
1339 | uiSymbol = 2; |
---|
1340 | } |
---|
1341 | |
---|
1342 | uiSymbol++; |
---|
1343 | ruiInterDir = uiSymbol; |
---|
1344 | return; |
---|
1345 | } |
---|
1346 | |
---|
1347 | Void TDecSbac::parseRefFrmIdx( TComDataCU* pcCU, Int& riRefFrmIdx, UInt uiAbsPartIdx, UInt uiDepth, RefPicList eRefList ) |
---|
1348 | { |
---|
1349 | UInt uiSymbol; |
---|
1350 | |
---|
1351 | if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C ) > 0 && eRefList==REF_PIC_LIST_C) |
---|
1352 | { |
---|
1353 | ContextModel *pCtx = m_cCURefPicSCModel.get( 0 ); |
---|
1354 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
1355 | |
---|
1356 | if( uiSymbol ) |
---|
1357 | { |
---|
1358 | xReadUnaryMaxSymbol( uiSymbol, pCtx + 1, 1, pcCU->getSlice()->getNumRefIdx( REF_PIC_LIST_C )-2 ); |
---|
1359 | uiSymbol++; |
---|
1360 | } |
---|
1361 | riRefFrmIdx = uiSymbol; |
---|
1362 | } |
---|
1363 | else |
---|
1364 | { |
---|
1365 | ContextModel *pCtx = m_cCURefPicSCModel.get( 0 ); |
---|
1366 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
1367 | |
---|
1368 | if( uiSymbol ) |
---|
1369 | { |
---|
1370 | xReadUnaryMaxSymbol( uiSymbol, pCtx + 1, 1, pcCU->getSlice()->getNumRefIdx( eRefList )-2 ); |
---|
1371 | uiSymbol++; |
---|
1372 | } |
---|
1373 | riRefFrmIdx = uiSymbol; |
---|
1374 | } |
---|
1375 | |
---|
1376 | return; |
---|
1377 | } |
---|
1378 | |
---|
1379 | Void TDecSbac::parseMvd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList ) |
---|
1380 | { |
---|
1381 | UInt uiSymbol; |
---|
1382 | UInt uiHorAbs; |
---|
1383 | UInt uiVerAbs; |
---|
1384 | UInt uiHorSign = 0; |
---|
1385 | UInt uiVerSign = 0; |
---|
1386 | ContextModel *pCtx = m_cCUMvdSCModel.get( 0 ); |
---|
1387 | |
---|
1388 | if(pcCU->getSlice()->getMvdL1ZeroFlag() && eRefList == REF_PIC_LIST_1 && pcCU->getInterDir(uiAbsPartIdx)==3) |
---|
1389 | { |
---|
1390 | uiHorAbs=0; |
---|
1391 | uiVerAbs=0; |
---|
1392 | } |
---|
1393 | else |
---|
1394 | { |
---|
1395 | |
---|
1396 | m_pcTDecBinIf->decodeBin( uiHorAbs, *pCtx ); |
---|
1397 | m_pcTDecBinIf->decodeBin( uiVerAbs, *pCtx ); |
---|
1398 | |
---|
1399 | const Bool bHorAbsGr0 = uiHorAbs != 0; |
---|
1400 | const Bool bVerAbsGr0 = uiVerAbs != 0; |
---|
1401 | pCtx++; |
---|
1402 | |
---|
1403 | if( bHorAbsGr0 ) |
---|
1404 | { |
---|
1405 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
1406 | uiHorAbs += uiSymbol; |
---|
1407 | } |
---|
1408 | |
---|
1409 | if( bVerAbsGr0 ) |
---|
1410 | { |
---|
1411 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
1412 | uiVerAbs += uiSymbol; |
---|
1413 | } |
---|
1414 | |
---|
1415 | if( bHorAbsGr0 ) |
---|
1416 | { |
---|
1417 | if( 2 == uiHorAbs ) |
---|
1418 | { |
---|
1419 | xReadEpExGolomb( uiSymbol, 1 ); |
---|
1420 | uiHorAbs += uiSymbol; |
---|
1421 | } |
---|
1422 | |
---|
1423 | m_pcTDecBinIf->decodeBinEP( uiHorSign ); |
---|
1424 | } |
---|
1425 | |
---|
1426 | if( bVerAbsGr0 ) |
---|
1427 | { |
---|
1428 | if( 2 == uiVerAbs ) |
---|
1429 | { |
---|
1430 | xReadEpExGolomb( uiSymbol, 1 ); |
---|
1431 | uiVerAbs += uiSymbol; |
---|
1432 | } |
---|
1433 | |
---|
1434 | m_pcTDecBinIf->decodeBinEP( uiVerSign ); |
---|
1435 | } |
---|
1436 | |
---|
1437 | } |
---|
1438 | |
---|
1439 | const TComMv cMv( uiHorSign ? -Int( uiHorAbs ): uiHorAbs, uiVerSign ? -Int( uiVerAbs ) : uiVerAbs ); |
---|
1440 | pcCU->getCUMvField( eRefList )->setAllMvd( cMv, pcCU->getPartitionSize( uiAbsPartIdx ), uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
1441 | return; |
---|
1442 | } |
---|
1443 | |
---|
1444 | |
---|
1445 | Void TDecSbac::parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize ) |
---|
1446 | { |
---|
1447 | m_pcTDecBinIf->decodeBin( ruiSubdivFlag, m_cCUTransSubdivFlagSCModel.get( 0, 0, uiLog2TransformBlockSize ) ); |
---|
1448 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
1449 | DTRACE_CABAC_T( "\tparseTransformSubdivFlag()" ) |
---|
1450 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
1451 | DTRACE_CABAC_V( ruiSubdivFlag ) |
---|
1452 | DTRACE_CABAC_T( "\tctx=" ) |
---|
1453 | DTRACE_CABAC_V( uiLog2TransformBlockSize ) |
---|
1454 | DTRACE_CABAC_T( "\n" ) |
---|
1455 | } |
---|
1456 | |
---|
1457 | Void TDecSbac::parseQtRootCbf( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& uiQtRootCbf ) |
---|
1458 | { |
---|
1459 | UInt uiSymbol; |
---|
1460 | const UInt uiCtx = 0; |
---|
1461 | m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtRootCbfSCModel.get( 0, 0, uiCtx ) ); |
---|
1462 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
1463 | DTRACE_CABAC_T( "\tparseQtRootCbf()" ) |
---|
1464 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
1465 | DTRACE_CABAC_V( uiSymbol ) |
---|
1466 | DTRACE_CABAC_T( "\tctx=" ) |
---|
1467 | DTRACE_CABAC_V( uiCtx ) |
---|
1468 | DTRACE_CABAC_T( "\tuiAbsPartIdx=" ) |
---|
1469 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
1470 | DTRACE_CABAC_T( "\n" ) |
---|
1471 | |
---|
1472 | uiQtRootCbf = uiSymbol; |
---|
1473 | } |
---|
1474 | |
---|
1475 | Void TDecSbac::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1476 | { |
---|
1477 | Int qp; |
---|
1478 | UInt uiDQp; |
---|
1479 | Int iDQp; |
---|
1480 | |
---|
1481 | m_pcTDecBinIf->decodeBin( uiDQp, m_cCUDeltaQpSCModel.get( 0, 0, 0 ) ); |
---|
1482 | |
---|
1483 | if ( uiDQp == 0 ) |
---|
1484 | { |
---|
1485 | qp = pcCU->getRefQP(uiAbsPartIdx); |
---|
1486 | } |
---|
1487 | else |
---|
1488 | { |
---|
1489 | UInt uiSign; |
---|
1490 | Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); |
---|
1491 | m_pcTDecBinIf->decodeBinEP(uiSign); |
---|
1492 | |
---|
1493 | UInt uiMaxAbsDQpMinus1 = 24 + (qpBdOffsetY/2) + (uiSign); |
---|
1494 | UInt uiAbsDQpMinus1; |
---|
1495 | xReadUnaryMaxSymbol (uiAbsDQpMinus1, &m_cCUDeltaQpSCModel.get( 0, 0, 1 ), 1, uiMaxAbsDQpMinus1); |
---|
1496 | |
---|
1497 | iDQp = uiAbsDQpMinus1 + 1; |
---|
1498 | |
---|
1499 | if(uiSign) |
---|
1500 | { |
---|
1501 | iDQp = -iDQp; |
---|
1502 | } |
---|
1503 | |
---|
1504 | qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+qpBdOffsetY)) - qpBdOffsetY; |
---|
1505 | } |
---|
1506 | |
---|
1507 | UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)) ; |
---|
1508 | UInt uiQpCUDepth = min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ; |
---|
1509 | pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth ); |
---|
1510 | } |
---|
1511 | |
---|
1512 | Void TDecSbac::parseQtCbf( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth ) |
---|
1513 | { |
---|
1514 | UInt uiSymbol; |
---|
1515 | const UInt uiCtx = pcCU->getCtxQtCbf( uiAbsPartIdx, eType, uiTrDepth ); |
---|
1516 | m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtCbfSCModel.get( 0, eType ? TEXT_CHROMA: eType, uiCtx ) ); |
---|
1517 | |
---|
1518 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
1519 | DTRACE_CABAC_T( "\tparseQtCbf()" ) |
---|
1520 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
1521 | DTRACE_CABAC_V( uiSymbol ) |
---|
1522 | DTRACE_CABAC_T( "\tctx=" ) |
---|
1523 | DTRACE_CABAC_V( uiCtx ) |
---|
1524 | DTRACE_CABAC_T( "\tetype=" ) |
---|
1525 | DTRACE_CABAC_V( eType ) |
---|
1526 | DTRACE_CABAC_T( "\tuiAbsPartIdx=" ) |
---|
1527 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
1528 | DTRACE_CABAC_T( "\n" ) |
---|
1529 | |
---|
1530 | pcCU->setCbfSubParts( uiSymbol << uiTrDepth, eType, uiAbsPartIdx, uiDepth ); |
---|
1531 | } |
---|
1532 | |
---|
1533 | /** Parse (X,Y) position of the last significant coefficient |
---|
1534 | * \param uiPosLastX reference to X component of last coefficient |
---|
1535 | * \param uiPosLastY reference to Y component of last coefficient |
---|
1536 | * \param width Block width |
---|
1537 | * \param height Block height |
---|
1538 | * \param eTType plane type / luminance or chrominance |
---|
1539 | * \param uiScanIdx scan type (zig-zag, hor, ver) |
---|
1540 | * |
---|
1541 | * This method decodes the X and Y component within a block of the last significant coefficient. |
---|
1542 | */ |
---|
1543 | Void TDecSbac::parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, Int width, Int height, TextType eTType, UInt uiScanIdx ) |
---|
1544 | { |
---|
1545 | UInt uiLast; |
---|
1546 | ContextModel *pCtxX = m_cCuCtxLastX.get( 0, eTType ); |
---|
1547 | ContextModel *pCtxY = m_cCuCtxLastY.get( 0, eTType ); |
---|
1548 | |
---|
1549 | // posX |
---|
1550 | Int widthCtx = eTType ? 4 : width; |
---|
1551 | const UInt *puiCtxIdxX = g_uiLastCtx + ( g_aucConvertToBit[ widthCtx ] * ( g_aucConvertToBit[ widthCtx ] + 3 ) ); |
---|
1552 | for( uiPosLastX = 0; uiPosLastX < g_uiGroupIdx[ width - 1 ]; uiPosLastX++ ) |
---|
1553 | { |
---|
1554 | if ( eTType ) |
---|
1555 | { |
---|
1556 | m_pcTDecBinIf->decodeBin( uiLast, *( pCtxX + (uiPosLastX>>g_aucConvertToBit[ width ]) ) ); |
---|
1557 | } |
---|
1558 | else |
---|
1559 | { |
---|
1560 | m_pcTDecBinIf->decodeBin( uiLast, *( pCtxX + puiCtxIdxX[ uiPosLastX ] ) ); |
---|
1561 | } |
---|
1562 | if( !uiLast ) |
---|
1563 | { |
---|
1564 | break; |
---|
1565 | } |
---|
1566 | } |
---|
1567 | |
---|
1568 | // posY |
---|
1569 | Int heightCtx = eTType? 4 : height; |
---|
1570 | const UInt *puiCtxIdxY = g_uiLastCtx + ( g_aucConvertToBit[ heightCtx ] * ( g_aucConvertToBit[ heightCtx ] + 3 ) ); |
---|
1571 | for( uiPosLastY = 0; uiPosLastY < g_uiGroupIdx[ height - 1 ]; uiPosLastY++ ) |
---|
1572 | { |
---|
1573 | if (eTType) |
---|
1574 | { |
---|
1575 | m_pcTDecBinIf->decodeBin( uiLast, *( pCtxY + (uiPosLastY>>g_aucConvertToBit[ height ]) ) ); |
---|
1576 | } |
---|
1577 | else |
---|
1578 | { |
---|
1579 | m_pcTDecBinIf->decodeBin( uiLast, *( pCtxY + puiCtxIdxY[ uiPosLastY ] ) ); |
---|
1580 | } |
---|
1581 | if( !uiLast ) |
---|
1582 | { |
---|
1583 | break; |
---|
1584 | } |
---|
1585 | } |
---|
1586 | if ( uiPosLastX > 3 ) |
---|
1587 | { |
---|
1588 | UInt uiTemp = 0; |
---|
1589 | UInt uiCount = ( uiPosLastX - 2 ) >> 1; |
---|
1590 | for ( Int i = uiCount - 1; i >= 0; i-- ) |
---|
1591 | { |
---|
1592 | m_pcTDecBinIf->decodeBinEP( uiLast ); |
---|
1593 | uiTemp += uiLast << i; |
---|
1594 | } |
---|
1595 | uiPosLastX = g_uiMinInGroup[ uiPosLastX ] + uiTemp; |
---|
1596 | } |
---|
1597 | if ( uiPosLastY > 3 ) |
---|
1598 | { |
---|
1599 | UInt uiTemp = 0; |
---|
1600 | UInt uiCount = ( uiPosLastY - 2 ) >> 1; |
---|
1601 | for ( Int i = uiCount - 1; i >= 0; i-- ) |
---|
1602 | { |
---|
1603 | m_pcTDecBinIf->decodeBinEP( uiLast ); |
---|
1604 | uiTemp += uiLast << i; |
---|
1605 | } |
---|
1606 | uiPosLastY = g_uiMinInGroup[ uiPosLastY ] + uiTemp; |
---|
1607 | } |
---|
1608 | |
---|
1609 | if( uiScanIdx == SCAN_VER ) |
---|
1610 | { |
---|
1611 | swap( uiPosLastX, uiPosLastY ); |
---|
1612 | } |
---|
1613 | } |
---|
1614 | |
---|
1615 | Void TDecSbac::parseCoeffNxN( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ) |
---|
1616 | { |
---|
1617 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
1618 | DTRACE_CABAC_T( "\tparseCoeffNxN()\teType=" ) |
---|
1619 | DTRACE_CABAC_V( eTType ) |
---|
1620 | DTRACE_CABAC_T( "\twidth=" ) |
---|
1621 | DTRACE_CABAC_V( uiWidth ) |
---|
1622 | DTRACE_CABAC_T( "\theight=" ) |
---|
1623 | DTRACE_CABAC_V( uiHeight ) |
---|
1624 | DTRACE_CABAC_T( "\tdepth=" ) |
---|
1625 | DTRACE_CABAC_V( uiDepth ) |
---|
1626 | DTRACE_CABAC_T( "\tabspartidx=" ) |
---|
1627 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
1628 | DTRACE_CABAC_T( "\ttoCU-X=" ) |
---|
1629 | DTRACE_CABAC_V( pcCU->getCUPelX() ) |
---|
1630 | DTRACE_CABAC_T( "\ttoCU-Y=" ) |
---|
1631 | DTRACE_CABAC_V( pcCU->getCUPelY() ) |
---|
1632 | DTRACE_CABAC_T( "\tCU-addr=" ) |
---|
1633 | DTRACE_CABAC_V( pcCU->getAddr() ) |
---|
1634 | DTRACE_CABAC_T( "\tinCU-X=" ) |
---|
1635 | DTRACE_CABAC_V( g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ] ) |
---|
1636 | DTRACE_CABAC_T( "\tinCU-Y=" ) |
---|
1637 | DTRACE_CABAC_V( g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ] ) |
---|
1638 | DTRACE_CABAC_T( "\tpredmode=" ) |
---|
1639 | DTRACE_CABAC_V( pcCU->getPredictionMode( uiAbsPartIdx ) ) |
---|
1640 | DTRACE_CABAC_T( "\n" ) |
---|
1641 | |
---|
1642 | if( uiWidth > pcCU->getSlice()->getSPS()->getMaxTrSize() ) |
---|
1643 | { |
---|
1644 | uiWidth = pcCU->getSlice()->getSPS()->getMaxTrSize(); |
---|
1645 | uiHeight = pcCU->getSlice()->getSPS()->getMaxTrSize(); |
---|
1646 | } |
---|
1647 | |
---|
1648 | eTType = eTType == TEXT_LUMA ? TEXT_LUMA : ( eTType == TEXT_NONE ? TEXT_NONE : TEXT_CHROMA ); |
---|
1649 | |
---|
1650 | //----- parse significance map ----- |
---|
1651 | const UInt uiLog2BlockSize = g_aucConvertToBit[ uiWidth ] + 2; |
---|
1652 | const UInt uiMaxNumCoeff = uiWidth * uiHeight; |
---|
1653 | const UInt uiMaxNumCoeffM1 = uiMaxNumCoeff - 1; |
---|
1654 | UInt uiScanIdx = pcCU->getCoefScanIdx(uiAbsPartIdx, uiWidth, eTType==TEXT_LUMA, pcCU->isIntra(uiAbsPartIdx)); |
---|
1655 | int blockType = uiLog2BlockSize; |
---|
1656 | if (uiWidth != uiHeight) |
---|
1657 | { |
---|
1658 | uiScanIdx = SCAN_DIAG; |
---|
1659 | blockType = 4; |
---|
1660 | } |
---|
1661 | |
---|
1662 | //===== decode last significant ===== |
---|
1663 | UInt uiPosLastX, uiPosLastY; |
---|
1664 | parseLastSignificantXY( uiPosLastX, uiPosLastY, uiWidth, uiHeight, eTType, uiScanIdx ); |
---|
1665 | UInt uiBlkPosLast = uiPosLastX + (uiPosLastY<<uiLog2BlockSize); |
---|
1666 | pcCoef[ uiBlkPosLast ] = 1; |
---|
1667 | |
---|
1668 | //===== decode significance flags ===== |
---|
1669 | UInt uiScanPosLast = uiBlkPosLast; |
---|
1670 | if (uiScanIdx == SCAN_ZIGZAG) |
---|
1671 | { |
---|
1672 | // Map zigzag to diagonal scan |
---|
1673 | uiScanIdx = SCAN_DIAG; |
---|
1674 | } |
---|
1675 | const UInt * scan; |
---|
1676 | if (uiWidth == uiHeight) |
---|
1677 | { |
---|
1678 | scan = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize-1 ]; |
---|
1679 | } |
---|
1680 | else |
---|
1681 | { |
---|
1682 | scan = g_sigScanNSQT[ uiLog2BlockSize - 2 ]; |
---|
1683 | } |
---|
1684 | for( uiScanPosLast = 0; uiScanPosLast < uiMaxNumCoeffM1; uiScanPosLast++ ) |
---|
1685 | { |
---|
1686 | UInt uiBlkPos = scan[ uiScanPosLast ]; |
---|
1687 | if( uiBlkPosLast == uiBlkPos ) |
---|
1688 | { |
---|
1689 | break; |
---|
1690 | } |
---|
1691 | } |
---|
1692 | |
---|
1693 | ContextModel * const baseCoeffGroupCtx = m_cCUSigCoeffGroupSCModel.get( 0, eTType ); |
---|
1694 | ContextModel * const baseCtx = (eTType==TEXT_LUMA) ? m_cCUSigSCModel.get( 0, 0 ) : m_cCUSigSCModel.get( 0, 0 ) + NUM_SIG_FLAG_CTX_LUMA; |
---|
1695 | |
---|
1696 | const Int iLastScanSet = uiScanPosLast >> LOG2_SCAN_SET_SIZE; |
---|
1697 | UInt uiNumOne = 0; |
---|
1698 | UInt uiGoRiceParam = 0; |
---|
1699 | |
---|
1700 | UInt const tsig = pcCU->getSlice()->getPPS()->getTSIG(); |
---|
1701 | #if LOSSLESS_CODING |
---|
1702 | Bool beValid; |
---|
1703 | if (pcCU->isLosslessCoded(uiAbsPartIdx)) |
---|
1704 | { |
---|
1705 | beValid = false; |
---|
1706 | } |
---|
1707 | else |
---|
1708 | { |
---|
1709 | beValid = pcCU->getSlice()->getPPS()->getSignHideFlag() > 0; |
---|
1710 | } |
---|
1711 | #else |
---|
1712 | Bool beValid = pcCU->getSlice()->getPPS()->getSignHideFlag() > 0; |
---|
1713 | #endif |
---|
1714 | UInt absSum = 0; |
---|
1715 | |
---|
1716 | UInt uiSigCoeffGroupFlag[ MLS_GRP_NUM ]; |
---|
1717 | ::memset( uiSigCoeffGroupFlag, 0, sizeof(UInt) * MLS_GRP_NUM ); |
---|
1718 | const UInt uiNumBlkSide = uiWidth >> (MLS_CG_SIZE >> 1); |
---|
1719 | const UInt * scanCG; |
---|
1720 | if (uiWidth == uiHeight) |
---|
1721 | { |
---|
1722 | scanCG = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize > 3 ? uiLog2BlockSize-2-1 : 0 ]; |
---|
1723 | if( uiLog2BlockSize == 3 ) |
---|
1724 | { |
---|
1725 | scanCG = g_sigLastScan8x8[ uiScanIdx ]; |
---|
1726 | } |
---|
1727 | else if( uiLog2BlockSize == 5 ) |
---|
1728 | { |
---|
1729 | scanCG = g_sigLastScanCG32x32; |
---|
1730 | } |
---|
1731 | } |
---|
1732 | else |
---|
1733 | { |
---|
1734 | scanCG = g_sigCGScanNSQT[ uiLog2BlockSize - 2 ]; |
---|
1735 | } |
---|
1736 | Int iScanPosSig = (Int) uiScanPosLast; |
---|
1737 | for( Int iSubSet = iLastScanSet; iSubSet >= 0; iSubSet-- ) |
---|
1738 | { |
---|
1739 | Int iSubPos = iSubSet << LOG2_SCAN_SET_SIZE; |
---|
1740 | uiGoRiceParam = 0; |
---|
1741 | Int numNonZero = 0; |
---|
1742 | |
---|
1743 | Int lastNZPosInCG = -1, firstNZPosInCG = SCAN_SET_SIZE; |
---|
1744 | |
---|
1745 | Int pos[SCAN_SET_SIZE]; |
---|
1746 | if( iScanPosSig == (Int) uiScanPosLast ) |
---|
1747 | { |
---|
1748 | lastNZPosInCG = iScanPosSig; |
---|
1749 | firstNZPosInCG = iScanPosSig; |
---|
1750 | iScanPosSig--; |
---|
1751 | pos[ numNonZero ] = uiBlkPosLast; |
---|
1752 | numNonZero = 1; |
---|
1753 | } |
---|
1754 | |
---|
1755 | // decode significant_coeffgroup_flag |
---|
1756 | Int iCGBlkPos = scanCG[ iSubSet ]; |
---|
1757 | Int iCGPosY = iCGBlkPos / uiNumBlkSide; |
---|
1758 | Int iCGPosX = iCGBlkPos - (iCGPosY * uiNumBlkSide); |
---|
1759 | if( uiWidth == 8 && uiHeight == 8 && (uiScanIdx == SCAN_HOR || uiScanIdx == SCAN_VER) ) |
---|
1760 | { |
---|
1761 | iCGPosY = (uiScanIdx == SCAN_HOR ? iCGBlkPos : 0); |
---|
1762 | iCGPosX = (uiScanIdx == SCAN_VER ? iCGBlkPos : 0); |
---|
1763 | } |
---|
1764 | if( iSubSet == iLastScanSet || iSubSet == 0) |
---|
1765 | { |
---|
1766 | uiSigCoeffGroupFlag[ iCGBlkPos ] = 1; |
---|
1767 | } |
---|
1768 | else |
---|
1769 | { |
---|
1770 | UInt uiSigCoeffGroup; |
---|
1771 | UInt uiCtxSig = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiScanIdx, uiWidth, uiHeight ); |
---|
1772 | m_pcTDecBinIf->decodeBin( uiSigCoeffGroup, baseCoeffGroupCtx[ uiCtxSig ] ); |
---|
1773 | uiSigCoeffGroupFlag[ iCGBlkPos ] = uiSigCoeffGroup; |
---|
1774 | } |
---|
1775 | |
---|
1776 | // decode significant_coeff_flag |
---|
1777 | UInt uiBlkPos, uiPosY, uiPosX, uiSig, uiCtxSig; |
---|
1778 | for( ; iScanPosSig >= iSubPos; iScanPosSig-- ) |
---|
1779 | { |
---|
1780 | uiBlkPos = scan[ iScanPosSig ]; |
---|
1781 | uiPosY = uiBlkPos >> uiLog2BlockSize; |
---|
1782 | uiPosX = uiBlkPos - ( uiPosY << uiLog2BlockSize ); |
---|
1783 | uiSig = 0; |
---|
1784 | |
---|
1785 | if( uiSigCoeffGroupFlag[ iCGBlkPos ] ) |
---|
1786 | { |
---|
1787 | if( iScanPosSig > iSubPos || iSubSet == 0 || numNonZero ) |
---|
1788 | { |
---|
1789 | uiCtxSig = TComTrQuant::getSigCtxInc( pcCoef, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType ); |
---|
1790 | m_pcTDecBinIf->decodeBin( uiSig, baseCtx[ uiCtxSig ] ); |
---|
1791 | } |
---|
1792 | else |
---|
1793 | { |
---|
1794 | uiSig = 1; |
---|
1795 | } |
---|
1796 | } |
---|
1797 | pcCoef[ uiBlkPos ] = uiSig; |
---|
1798 | if( uiSig ) |
---|
1799 | { |
---|
1800 | pos[ numNonZero ] = uiBlkPos; |
---|
1801 | numNonZero ++; |
---|
1802 | if( lastNZPosInCG == -1 ) |
---|
1803 | { |
---|
1804 | lastNZPosInCG = iScanPosSig; |
---|
1805 | } |
---|
1806 | firstNZPosInCG = iScanPosSig; |
---|
1807 | } |
---|
1808 | } |
---|
1809 | |
---|
1810 | |
---|
1811 | if( numNonZero ) |
---|
1812 | { |
---|
1813 | Bool signHidden = ( lastNZPosInCG - firstNZPosInCG >= (Int)tsig ); |
---|
1814 | absSum = 0; |
---|
1815 | |
---|
1816 | UInt c1 = 1; |
---|
1817 | UInt uiCtxSet = (iSubSet > 0 && eTType==TEXT_LUMA) ? 2 : 0; |
---|
1818 | UInt uiBin; |
---|
1819 | |
---|
1820 | if( uiNumOne > 0 ) |
---|
1821 | { |
---|
1822 | uiCtxSet++; |
---|
1823 | } |
---|
1824 | |
---|
1825 | uiNumOne >>= 1; |
---|
1826 | ContextModel *baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUOneSCModel.get( 0, 0 ) + 4 * uiCtxSet : m_cCUOneSCModel.get( 0, 0 ) + NUM_ONE_FLAG_CTX_LUMA + 4 * uiCtxSet; |
---|
1827 | Int absCoeff[SCAN_SET_SIZE]; |
---|
1828 | |
---|
1829 | for ( Int i = 0; i < numNonZero; i++) absCoeff[i] = 1; |
---|
1830 | Int numC1Flag = min(numNonZero, C1FLAG_NUMBER); |
---|
1831 | Int firstC2FlagIdx = -1; |
---|
1832 | |
---|
1833 | for( Int idx = 0; idx < numC1Flag; idx++ ) |
---|
1834 | { |
---|
1835 | m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[c1] ); |
---|
1836 | if( uiBin == 1 ) |
---|
1837 | { |
---|
1838 | c1 = 0; |
---|
1839 | if (firstC2FlagIdx == -1) |
---|
1840 | { |
---|
1841 | firstC2FlagIdx = idx; |
---|
1842 | } |
---|
1843 | } |
---|
1844 | else if( (c1 < 3) && (c1 > 0) ) |
---|
1845 | { |
---|
1846 | c1++; |
---|
1847 | } |
---|
1848 | absCoeff[ idx ] = uiBin + 1; |
---|
1849 | } |
---|
1850 | |
---|
1851 | if (c1 == 0) |
---|
1852 | { |
---|
1853 | baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUAbsSCModel.get( 0, 0 ) + uiCtxSet : m_cCUAbsSCModel.get( 0, 0 ) + NUM_ABS_FLAG_CTX_LUMA + uiCtxSet; |
---|
1854 | if ( firstC2FlagIdx != -1) |
---|
1855 | { |
---|
1856 | m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[0] ); |
---|
1857 | absCoeff[ firstC2FlagIdx ] = uiBin + 2; |
---|
1858 | } |
---|
1859 | } |
---|
1860 | |
---|
1861 | UInt coeffSigns; |
---|
1862 | if ( signHidden && beValid ) |
---|
1863 | { |
---|
1864 | m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero-1 ); |
---|
1865 | coeffSigns <<= 32 - (numNonZero-1); |
---|
1866 | } |
---|
1867 | else |
---|
1868 | { |
---|
1869 | m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero ); |
---|
1870 | coeffSigns <<= 32 - numNonZero; |
---|
1871 | } |
---|
1872 | |
---|
1873 | Int iFirstCoeff2 = 1; |
---|
1874 | if (c1 == 0 || numNonZero > C1FLAG_NUMBER) |
---|
1875 | { |
---|
1876 | for( Int idx = 0; idx < numNonZero; idx++ ) |
---|
1877 | { |
---|
1878 | UInt baseLevel = (idx < C1FLAG_NUMBER)? (2 + iFirstCoeff2) : 1; |
---|
1879 | |
---|
1880 | if( absCoeff[ idx ] == baseLevel) |
---|
1881 | { |
---|
1882 | UInt uiLevel; |
---|
1883 | xReadGoRiceExGolomb( uiLevel, uiGoRiceParam ); |
---|
1884 | absCoeff[ idx ] = uiLevel + baseLevel; |
---|
1885 | } |
---|
1886 | |
---|
1887 | if(absCoeff[ idx ] >= 2) |
---|
1888 | { |
---|
1889 | iFirstCoeff2 = 0; |
---|
1890 | uiNumOne++; |
---|
1891 | } |
---|
1892 | } |
---|
1893 | } |
---|
1894 | |
---|
1895 | for( Int idx = 0; idx < numNonZero; idx++ ) |
---|
1896 | { |
---|
1897 | Int blkPos = pos[ idx ]; |
---|
1898 | // Signs applied later. |
---|
1899 | pcCoef[ blkPos ] = absCoeff[ idx ]; |
---|
1900 | absSum += absCoeff[ idx ]; |
---|
1901 | |
---|
1902 | if ( idx == numNonZero-1 && signHidden && beValid ) |
---|
1903 | { |
---|
1904 | // Infer sign of 1st element. |
---|
1905 | if (absSum&0x1) |
---|
1906 | pcCoef[ blkPos ] = -pcCoef[ blkPos ]; |
---|
1907 | } |
---|
1908 | else |
---|
1909 | { |
---|
1910 | Int sign = static_cast<Int>( coeffSigns ) >> 31; |
---|
1911 | pcCoef[ blkPos ] = ( pcCoef[ blkPos ] ^ sign ) - sign; |
---|
1912 | coeffSigns <<= 1; |
---|
1913 | } |
---|
1914 | } |
---|
1915 | } |
---|
1916 | else |
---|
1917 | { |
---|
1918 | uiNumOne >>= 1; |
---|
1919 | } |
---|
1920 | } |
---|
1921 | |
---|
1922 | return; |
---|
1923 | } |
---|
1924 | |
---|
1925 | |
---|
1926 | Void TDecSbac::parseSaoUvlc (UInt& ruiVal) |
---|
1927 | { |
---|
1928 | UInt uiCode; |
---|
1929 | Int i; |
---|
1930 | |
---|
1931 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoUvlcSCModel.get( 0, 0, 0 ) ); |
---|
1932 | if ( uiCode == 0 ) |
---|
1933 | { |
---|
1934 | ruiVal = 0; |
---|
1935 | return; |
---|
1936 | } |
---|
1937 | |
---|
1938 | i=1; |
---|
1939 | while (1) |
---|
1940 | { |
---|
1941 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoUvlcSCModel.get( 0, 0, 1 ) ); |
---|
1942 | if ( uiCode == 0 ) break; |
---|
1943 | i++; |
---|
1944 | } |
---|
1945 | |
---|
1946 | ruiVal = i; |
---|
1947 | } |
---|
1948 | |
---|
1949 | Void TDecSbac::parseSaoSvlc (Int& riVal) |
---|
1950 | { |
---|
1951 | UInt uiCode; |
---|
1952 | Int iSign; |
---|
1953 | Int i; |
---|
1954 | |
---|
1955 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoSvlcSCModel.get( 0, 0, 0 ) ); |
---|
1956 | |
---|
1957 | if ( uiCode == 0 ) |
---|
1958 | { |
---|
1959 | riVal = 0; |
---|
1960 | return; |
---|
1961 | } |
---|
1962 | |
---|
1963 | // read sign |
---|
1964 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoSvlcSCModel.get( 0, 0, 1 ) ); |
---|
1965 | |
---|
1966 | if ( uiCode == 0 ) |
---|
1967 | { |
---|
1968 | iSign = 1; |
---|
1969 | } |
---|
1970 | else |
---|
1971 | { |
---|
1972 | iSign = -1; |
---|
1973 | } |
---|
1974 | |
---|
1975 | // read magnitude |
---|
1976 | i=1; |
---|
1977 | while (1) |
---|
1978 | { |
---|
1979 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoSvlcSCModel.get( 0, 0, 2 ) ); |
---|
1980 | if ( uiCode == 0 ) break; |
---|
1981 | i++; |
---|
1982 | } |
---|
1983 | |
---|
1984 | riVal = i*iSign; |
---|
1985 | } |
---|
1986 | |
---|
1987 | Void TDecSbac::parseSaoUflc (UInt& riVal) |
---|
1988 | { |
---|
1989 | UInt uiSymbol; |
---|
1990 | riVal = 0; |
---|
1991 | for (Int i=0;i<5;i++) |
---|
1992 | { |
---|
1993 | m_pcTDecBinIf->decodeBinEP ( uiSymbol ); |
---|
1994 | if (uiSymbol) |
---|
1995 | { |
---|
1996 | riVal |= (1<<i); |
---|
1997 | } |
---|
1998 | } |
---|
1999 | } |
---|
2000 | Void TDecSbac::parseSaoMergeLeft (UInt& ruiVal, UInt uiCompIdx) |
---|
2001 | { |
---|
2002 | UInt uiCode; |
---|
2003 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoMergeLeftSCModel.get( 0, 0, uiCompIdx ) ); |
---|
2004 | ruiVal = (Int)uiCode; |
---|
2005 | } |
---|
2006 | |
---|
2007 | Void TDecSbac::parseSaoMergeUp (UInt& ruiVal) |
---|
2008 | { |
---|
2009 | UInt uiCode; |
---|
2010 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoMergeUpSCModel.get( 0, 0, 0 ) ); |
---|
2011 | ruiVal = (Int)uiCode; |
---|
2012 | } |
---|
2013 | Void TDecSbac::parseSaoTypeIdx (UInt& ruiVal) |
---|
2014 | { |
---|
2015 | UInt uiCode; |
---|
2016 | Int i; |
---|
2017 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoTypeIdxSCModel.get( 0, 0, 0 ) ); |
---|
2018 | if ( uiCode == 0 ) |
---|
2019 | { |
---|
2020 | ruiVal = 0; |
---|
2021 | return; |
---|
2022 | } |
---|
2023 | i=1; |
---|
2024 | while (1) |
---|
2025 | { |
---|
2026 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoTypeIdxSCModel.get( 0, 0, 1 ) ); |
---|
2027 | if ( uiCode == 0 ) break; |
---|
2028 | i++; |
---|
2029 | } |
---|
2030 | ruiVal = i; |
---|
2031 | } |
---|
2032 | |
---|
2033 | inline Void copySaoOneLcuParam(SaoLcuParam* psDst, SaoLcuParam* psSrc) |
---|
2034 | { |
---|
2035 | Int i; |
---|
2036 | psDst->partIdx = psSrc->partIdx; |
---|
2037 | psDst->typeIdx = psSrc->typeIdx; |
---|
2038 | if (psDst->typeIdx != -1) |
---|
2039 | { |
---|
2040 | if (psDst->typeIdx == SAO_BO) |
---|
2041 | { |
---|
2042 | psDst->bandPosition = psSrc->bandPosition ; |
---|
2043 | } |
---|
2044 | else |
---|
2045 | { |
---|
2046 | psDst->bandPosition = 0; |
---|
2047 | } |
---|
2048 | psDst->length = psSrc->length; |
---|
2049 | for (i=0;i<psDst->length;i++) |
---|
2050 | { |
---|
2051 | psDst->offset[i] = psSrc->offset[i]; |
---|
2052 | } |
---|
2053 | } |
---|
2054 | else |
---|
2055 | { |
---|
2056 | psDst->length = 0; |
---|
2057 | for (i=0;i<SAO_BO_LEN;i++) |
---|
2058 | { |
---|
2059 | psDst->offset[i] = 0; |
---|
2060 | } |
---|
2061 | } |
---|
2062 | } |
---|
2063 | Void TDecSbac::parseSaoOffset(SaoLcuParam* psSaoLcuParam) |
---|
2064 | { |
---|
2065 | UInt uiSymbol; |
---|
2066 | Int iSymbol; |
---|
2067 | static Int iTypeLength[MAX_NUM_SAO_TYPE] = { |
---|
2068 | SAO_EO_LEN, |
---|
2069 | SAO_EO_LEN, |
---|
2070 | SAO_EO_LEN, |
---|
2071 | SAO_EO_LEN, |
---|
2072 | SAO_BO_LEN |
---|
2073 | }; |
---|
2074 | |
---|
2075 | parseSaoTypeIdx(uiSymbol); |
---|
2076 | psSaoLcuParam->typeIdx = (Int)uiSymbol - 1; |
---|
2077 | if (uiSymbol) |
---|
2078 | { |
---|
2079 | psSaoLcuParam->length = iTypeLength[psSaoLcuParam->typeIdx]; |
---|
2080 | if( psSaoLcuParam->typeIdx == SAO_BO ) |
---|
2081 | { |
---|
2082 | // Parse Left Band Index |
---|
2083 | parseSaoUflc( uiSymbol ); |
---|
2084 | psSaoLcuParam->bandPosition = uiSymbol; |
---|
2085 | for(Int i=0; i< psSaoLcuParam->length; i++) |
---|
2086 | { |
---|
2087 | parseSaoSvlc(iSymbol); |
---|
2088 | psSaoLcuParam->offset[i] = iSymbol; |
---|
2089 | } |
---|
2090 | } |
---|
2091 | else if( psSaoLcuParam->typeIdx < 4 ) |
---|
2092 | { |
---|
2093 | parseSaoUvlc(uiSymbol); psSaoLcuParam->offset[0] = uiSymbol; |
---|
2094 | parseSaoUvlc(uiSymbol); psSaoLcuParam->offset[1] = uiSymbol; |
---|
2095 | parseSaoUvlc(uiSymbol); psSaoLcuParam->offset[2] = -(Int)uiSymbol; |
---|
2096 | parseSaoUvlc(uiSymbol); psSaoLcuParam->offset[3] = -(Int)uiSymbol; |
---|
2097 | } |
---|
2098 | } |
---|
2099 | else |
---|
2100 | { |
---|
2101 | psSaoLcuParam->length = 0; |
---|
2102 | } |
---|
2103 | } |
---|
2104 | |
---|
2105 | Void TDecSbac::parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Bool bLFCrossSliceBoundaryFlag) |
---|
2106 | { |
---|
2107 | Int iAddr = pcCU->getAddr(); |
---|
2108 | UInt uiSymbol; |
---|
2109 | for (Int iCompIdx=0; iCompIdx<3; iCompIdx++) |
---|
2110 | { |
---|
2111 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = 0; |
---|
2112 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = 0; |
---|
2113 | pSaoParam->saoLcuParam[iCompIdx][iAddr].bandPosition = 0; |
---|
2114 | pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx = -1; |
---|
2115 | pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[0] = 0; |
---|
2116 | pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[1] = 0; |
---|
2117 | pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[2] = 0; |
---|
2118 | pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[3] = 0; |
---|
2119 | |
---|
2120 | if (pSaoParam->bSaoFlag[iCompIdx]) |
---|
2121 | { |
---|
2122 | if (rx>0 && iCUAddrInSlice!=0) |
---|
2123 | { |
---|
2124 | parseSaoMergeLeft(uiSymbol,iCompIdx); pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = (Int)uiSymbol; |
---|
2125 | } |
---|
2126 | else |
---|
2127 | { |
---|
2128 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = 0; |
---|
2129 | } |
---|
2130 | |
---|
2131 | if (pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag==0) |
---|
2132 | { |
---|
2133 | if ((ry > 0) && (iCUAddrUpInSlice>0||bLFCrossSliceBoundaryFlag)) |
---|
2134 | { |
---|
2135 | parseSaoMergeUp(uiSymbol); pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = uiSymbol; |
---|
2136 | } |
---|
2137 | else |
---|
2138 | { |
---|
2139 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = 0; |
---|
2140 | } |
---|
2141 | if (!pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag) |
---|
2142 | { |
---|
2143 | parseSaoOffset(&(pSaoParam->saoLcuParam[iCompIdx][iAddr])); |
---|
2144 | } |
---|
2145 | else |
---|
2146 | { |
---|
2147 | copySaoOneLcuParam(&pSaoParam->saoLcuParam[iCompIdx][iAddr], &pSaoParam->saoLcuParam[iCompIdx][iAddr-pSaoParam->numCuInWidth]); |
---|
2148 | } |
---|
2149 | } |
---|
2150 | else |
---|
2151 | { |
---|
2152 | copySaoOneLcuParam(&pSaoParam->saoLcuParam[iCompIdx][iAddr], &pSaoParam->saoLcuParam[iCompIdx][iAddr-1]); |
---|
2153 | } |
---|
2154 | } |
---|
2155 | else |
---|
2156 | { |
---|
2157 | pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx = -1; |
---|
2158 | pSaoParam->saoLcuParam[iCompIdx][iAddr].bandPosition = 0; |
---|
2159 | } |
---|
2160 | } |
---|
2161 | } |
---|
2162 | |
---|
2163 | /** |
---|
2164 | - Initialize our contexts from the nominated source. |
---|
2165 | . |
---|
2166 | \param pSrc Contexts to be copied. |
---|
2167 | */ |
---|
2168 | Void TDecSbac::xCopyContextsFrom( TDecSbac* pSrc ) |
---|
2169 | { |
---|
2170 | memcpy(m_contextModels, pSrc->m_contextModels, m_numContextModels*sizeof(m_contextModels[0])); |
---|
2171 | } |
---|
2172 | |
---|
2173 | Void TDecSbac::xCopyFrom( TDecSbac* pSrc ) |
---|
2174 | { |
---|
2175 | m_pcTDecBinIf->copyState( pSrc->m_pcTDecBinIf ); |
---|
2176 | |
---|
2177 | m_uiLastQp = pSrc->m_uiLastQp; |
---|
2178 | xCopyContextsFrom( pSrc ); |
---|
2179 | |
---|
2180 | } |
---|
2181 | |
---|
2182 | Void TDecSbac::load ( TDecSbac* pScr ) |
---|
2183 | { |
---|
2184 | xCopyFrom(pScr); |
---|
2185 | } |
---|
2186 | |
---|
2187 | Void TDecSbac::loadContexts ( TDecSbac* pScr ) |
---|
2188 | { |
---|
2189 | xCopyContextsFrom(pScr); |
---|
2190 | } |
---|
2191 | |
---|
2192 | Void TDecSbac::decodeFlush ( ) |
---|
2193 | { |
---|
2194 | UInt uiBit; |
---|
2195 | m_pcTDecBinIf->decodeBinTrm(uiBit); |
---|
2196 | m_pcTDecBinIf->flush(); |
---|
2197 | |
---|
2198 | } |
---|
2199 | |
---|
2200 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX || (LGE_EDGE_INTRA_A0070 && LGE_EDGE_INTRA_DELTA_DC) |
---|
2201 | Void TDecSbac::xReadExGolombLevel( UInt& ruiSymbol, ContextModel& rcSCModel ) |
---|
2202 | { |
---|
2203 | UInt uiSymbol; |
---|
2204 | UInt uiCount = 0; |
---|
2205 | do |
---|
2206 | { |
---|
2207 | m_pcTDecBinIf->decodeBin( uiSymbol, rcSCModel ); |
---|
2208 | uiCount++; |
---|
2209 | } |
---|
2210 | while( uiSymbol && ( uiCount != 13 ) ); |
---|
2211 | |
---|
2212 | ruiSymbol = uiCount - 1; |
---|
2213 | |
---|
2214 | if( uiSymbol ) |
---|
2215 | { |
---|
2216 | xReadEpExGolomb( uiSymbol, 0 ); |
---|
2217 | ruiSymbol += uiSymbol + 1; |
---|
2218 | } |
---|
2219 | |
---|
2220 | return; |
---|
2221 | } |
---|
2222 | #endif |
---|
2223 | #if HHI_DMM_WEDGE_INTRA |
---|
2224 | Void TDecSbac::xParseWedgeFullInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2225 | { |
---|
2226 | Int iIntraIdx = pcCU->getIntraSizeIdx(uiAbsPartIdx); |
---|
2227 | Int iBits = g_aucWedgeFullBitsListIdx[iIntraIdx]; |
---|
2228 | |
---|
2229 | UInt uiSymbol, uiTabIdx = 0; |
---|
2230 | for ( Int i = 0; i < iBits; i++ ) |
---|
2231 | { |
---|
2232 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 0) ); |
---|
2233 | uiTabIdx += ( uiSymbol && i == 0 ) ? 1 : 0; |
---|
2234 | uiTabIdx += ( uiSymbol && i == 1 ) ? 2 : 0; |
---|
2235 | uiTabIdx += ( uiSymbol && i == 2 ) ? 4 : 0; |
---|
2236 | uiTabIdx += ( uiSymbol && i == 3 ) ? 8 : 0; |
---|
2237 | uiTabIdx += ( uiSymbol && i == 4 ) ? 16 : 0; |
---|
2238 | uiTabIdx += ( uiSymbol && i == 5 ) ? 32 : 0; |
---|
2239 | uiTabIdx += ( uiSymbol && i == 6 ) ? 64 : 0; |
---|
2240 | uiTabIdx += ( uiSymbol && i == 7 ) ? 128 : 0; |
---|
2241 | uiTabIdx += ( uiSymbol && i == 8 ) ? 256 : 0; |
---|
2242 | uiTabIdx += ( uiSymbol && i == 9 ) ? 512 : 0; |
---|
2243 | uiTabIdx += ( uiSymbol && i == 10 ) ? 1024 : 0; |
---|
2244 | uiTabIdx += ( uiSymbol && i == 11 ) ? 2048 : 0; |
---|
2245 | uiTabIdx += ( uiSymbol && i == 12 ) ? 4096 : 0; |
---|
2246 | } |
---|
2247 | |
---|
2248 | pcCU->setWedgeFullTabIdxSubParts( uiTabIdx, uiAbsPartIdx, uiDepth ); |
---|
2249 | } |
---|
2250 | |
---|
2251 | Void TDecSbac::xParseWedgeFullDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2252 | { |
---|
2253 | Int iIntraIdx = pcCU->getIntraSizeIdx(uiAbsPartIdx); |
---|
2254 | Int iBits = g_aucWedgeFullBitsListIdx[iIntraIdx]; |
---|
2255 | |
---|
2256 | UInt uiSymbol, uiTabIdx = 0; |
---|
2257 | for ( Int i = 0; i < iBits; i++ ) |
---|
2258 | { |
---|
2259 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 0) ); |
---|
2260 | uiTabIdx += ( uiSymbol && i == 0 ) ? 1 : 0; |
---|
2261 | uiTabIdx += ( uiSymbol && i == 1 ) ? 2 : 0; |
---|
2262 | uiTabIdx += ( uiSymbol && i == 2 ) ? 4 : 0; |
---|
2263 | uiTabIdx += ( uiSymbol && i == 3 ) ? 8 : 0; |
---|
2264 | uiTabIdx += ( uiSymbol && i == 4 ) ? 16 : 0; |
---|
2265 | uiTabIdx += ( uiSymbol && i == 5 ) ? 32 : 0; |
---|
2266 | uiTabIdx += ( uiSymbol && i == 6 ) ? 64 : 0; |
---|
2267 | uiTabIdx += ( uiSymbol && i == 7 ) ? 128 : 0; |
---|
2268 | uiTabIdx += ( uiSymbol && i == 8 ) ? 256 : 0; |
---|
2269 | uiTabIdx += ( uiSymbol && i == 9 ) ? 512 : 0; |
---|
2270 | uiTabIdx += ( uiSymbol && i == 10 ) ? 1024 : 0; |
---|
2271 | uiTabIdx += ( uiSymbol && i == 11 ) ? 2048 : 0; |
---|
2272 | uiTabIdx += ( uiSymbol && i == 12 ) ? 4096 : 0; |
---|
2273 | } |
---|
2274 | |
---|
2275 | pcCU->setWedgeFullTabIdxSubParts( uiTabIdx, uiAbsPartIdx, uiDepth ); |
---|
2276 | |
---|
2277 | UInt uiDC1, uiDC2; |
---|
2278 | xReadExGolombLevel( uiDC1, m_cDmmDataSCModel.get(0, 0, 1) ); |
---|
2279 | Int iDC1 = uiDC1; |
---|
2280 | if ( uiDC1 ) |
---|
2281 | { |
---|
2282 | UInt uiSign; |
---|
2283 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
2284 | if ( uiSign ) |
---|
2285 | { |
---|
2286 | iDC1 = -iDC1; |
---|
2287 | } |
---|
2288 | } |
---|
2289 | xReadExGolombLevel( uiDC2, m_cDmmDataSCModel.get(0, 0, 1) ); |
---|
2290 | Int iDC2 = uiDC2; |
---|
2291 | if ( uiDC2 ) |
---|
2292 | { |
---|
2293 | UInt uiSign; |
---|
2294 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
2295 | if ( uiSign ) |
---|
2296 | { |
---|
2297 | iDC2 = -iDC2; |
---|
2298 | } |
---|
2299 | } |
---|
2300 | |
---|
2301 | pcCU->setWedgeFullDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); |
---|
2302 | pcCU->setWedgeFullDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); |
---|
2303 | } |
---|
2304 | |
---|
2305 | Void TDecSbac::xParseWedgePredDirInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2306 | { |
---|
2307 | if( DMM_WEDGE_PREDDIR_DELTAEND_MAX > 0 ) |
---|
2308 | { |
---|
2309 | UInt uiDeltaEnd = 0; |
---|
2310 | m_pcTDecBinIf->decodeBin( uiDeltaEnd, m_cDmmDataSCModel.get(0, 0, 2) ); |
---|
2311 | |
---|
2312 | Int iDeltaEnd; |
---|
2313 | if( uiDeltaEnd != 0 ) |
---|
2314 | { |
---|
2315 | UInt uiAbsValMinus1; |
---|
2316 | UInt uiSymbol; |
---|
2317 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 2) ); uiAbsValMinus1 = uiSymbol; |
---|
2318 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 2) ); uiAbsValMinus1 |= uiSymbol << 1; |
---|
2319 | uiDeltaEnd = uiAbsValMinus1 + 1; |
---|
2320 | |
---|
2321 | iDeltaEnd = uiDeltaEnd; |
---|
2322 | UInt uiSign; |
---|
2323 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
2324 | if( uiSign ) |
---|
2325 | { |
---|
2326 | iDeltaEnd = -iDeltaEnd; |
---|
2327 | } |
---|
2328 | } |
---|
2329 | else |
---|
2330 | { |
---|
2331 | iDeltaEnd = 0; |
---|
2332 | } |
---|
2333 | pcCU->setWedgePredDirDeltaEndSubParts( iDeltaEnd, uiAbsPartIdx, uiDepth ); |
---|
2334 | } |
---|
2335 | } |
---|
2336 | |
---|
2337 | Void TDecSbac::xParseWedgePredDirDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2338 | { |
---|
2339 | if( DMM_WEDGE_PREDDIR_DELTAEND_MAX > 0 ) |
---|
2340 | { |
---|
2341 | UInt uiDeltaEnd = 0; |
---|
2342 | m_pcTDecBinIf->decodeBin( uiDeltaEnd, m_cDmmDataSCModel.get(0, 0, 2) ); |
---|
2343 | |
---|
2344 | Int iDeltaEnd; |
---|
2345 | if( uiDeltaEnd != 0 ) |
---|
2346 | { |
---|
2347 | UInt uiAbsValMinus1; |
---|
2348 | UInt uiSymbol; |
---|
2349 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 2) ); uiAbsValMinus1 = uiSymbol; |
---|
2350 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 2) ); uiAbsValMinus1 |= uiSymbol << 1; |
---|
2351 | uiDeltaEnd = uiAbsValMinus1 + 1; |
---|
2352 | |
---|
2353 | iDeltaEnd = uiDeltaEnd; |
---|
2354 | UInt uiSign; |
---|
2355 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
2356 | if( uiSign ) |
---|
2357 | { |
---|
2358 | iDeltaEnd = -iDeltaEnd; |
---|
2359 | } |
---|
2360 | } |
---|
2361 | else |
---|
2362 | { |
---|
2363 | iDeltaEnd = 0; |
---|
2364 | } |
---|
2365 | |
---|
2366 | pcCU->setWedgePredDirDeltaEndSubParts( iDeltaEnd, uiAbsPartIdx, uiDepth ); |
---|
2367 | } |
---|
2368 | |
---|
2369 | UInt uiDC1, uiDC2; |
---|
2370 | xReadExGolombLevel( uiDC1, m_cDmmDataSCModel.get(0, 0, 1) ); |
---|
2371 | Int iDC1 = uiDC1; |
---|
2372 | if ( uiDC1 ) |
---|
2373 | { |
---|
2374 | UInt uiSign; |
---|
2375 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
2376 | if ( uiSign ) |
---|
2377 | { |
---|
2378 | iDC1 = -iDC1; |
---|
2379 | } |
---|
2380 | } |
---|
2381 | xReadExGolombLevel( uiDC2, m_cDmmDataSCModel.get(0, 0, 1) ); |
---|
2382 | Int iDC2 = uiDC2; |
---|
2383 | if ( uiDC2 ) |
---|
2384 | { |
---|
2385 | UInt uiSign; |
---|
2386 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
2387 | if ( uiSign ) |
---|
2388 | { |
---|
2389 | iDC2 = -iDC2; |
---|
2390 | } |
---|
2391 | } |
---|
2392 | |
---|
2393 | pcCU->setWedgePredDirDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); |
---|
2394 | pcCU->setWedgePredDirDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); |
---|
2395 | } |
---|
2396 | #endif |
---|
2397 | #if HHI_DMM_PRED_TEX |
---|
2398 | #if LGE_DMM3_SIMP_C0044 |
---|
2399 | Void TDecSbac::xParseWedgePredTexInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2400 | { |
---|
2401 | Int iIntraIdx = pcCU->getIntraSizeIdx(uiAbsPartIdx); |
---|
2402 | Int iBits = g_aucWedgeTexPredBitsListIdx[iIntraIdx]; |
---|
2403 | |
---|
2404 | UInt uiSymbol, uiTabIdx = 0; |
---|
2405 | for ( Int i = 0; i < iBits; i++ ) |
---|
2406 | { |
---|
2407 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmmDataSCModel.get(0, 0, 3) ); |
---|
2408 | uiTabIdx += ( uiSymbol && i == 0 ) ? 1 : 0; |
---|
2409 | uiTabIdx += ( uiSymbol && i == 1 ) ? 2 : 0; |
---|
2410 | uiTabIdx += ( uiSymbol && i == 2 ) ? 4 : 0; |
---|
2411 | uiTabIdx += ( uiSymbol && i == 3 ) ? 8 : 0; |
---|
2412 | uiTabIdx += ( uiSymbol && i == 4 ) ? 16 : 0; |
---|
2413 | uiTabIdx += ( uiSymbol && i == 5 ) ? 32 : 0; |
---|
2414 | uiTabIdx += ( uiSymbol && i == 6 ) ? 64 : 0; |
---|
2415 | uiTabIdx += ( uiSymbol && i == 7 ) ? 128 : 0; |
---|
2416 | uiTabIdx += ( uiSymbol && i == 8 ) ? 256 : 0; |
---|
2417 | uiTabIdx += ( uiSymbol && i == 9 ) ? 512 : 0; |
---|
2418 | uiTabIdx += ( uiSymbol && i == 10 ) ? 1024 : 0; |
---|
2419 | } |
---|
2420 | |
---|
2421 | pcCU->setWedgePredTexIntraTabIdxSubParts( uiTabIdx, uiAbsPartIdx, uiDepth ); |
---|
2422 | } |
---|
2423 | #endif |
---|
2424 | |
---|
2425 | Void TDecSbac::xParseWedgePredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2426 | { |
---|
2427 | #if LGE_DMM3_SIMP_C0044 |
---|
2428 | xParseWedgePredTexInfo( pcCU, uiAbsPartIdx, uiDepth ); |
---|
2429 | #endif |
---|
2430 | UInt uiDC1, uiDC2; |
---|
2431 | xReadExGolombLevel( uiDC1, m_cDmmDataSCModel.get(0, 0, 1) ); |
---|
2432 | Int iDC1 = uiDC1; |
---|
2433 | if ( uiDC1 ) |
---|
2434 | { |
---|
2435 | UInt uiSign; |
---|
2436 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
2437 | if ( uiSign ) |
---|
2438 | { |
---|
2439 | iDC1 = -iDC1; |
---|
2440 | } |
---|
2441 | } |
---|
2442 | xReadExGolombLevel( uiDC2, m_cDmmDataSCModel.get(0, 0, 1) ); |
---|
2443 | Int iDC2 = uiDC2; |
---|
2444 | if ( uiDC2 ) |
---|
2445 | { |
---|
2446 | UInt uiSign; |
---|
2447 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
2448 | if ( uiSign ) |
---|
2449 | { |
---|
2450 | iDC2 = -iDC2; |
---|
2451 | } |
---|
2452 | } |
---|
2453 | |
---|
2454 | pcCU->setWedgePredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); |
---|
2455 | pcCU->setWedgePredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); |
---|
2456 | } |
---|
2457 | |
---|
2458 | Void TDecSbac::xParseContourPredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2459 | { |
---|
2460 | UInt uiDC1, uiDC2; |
---|
2461 | xReadExGolombLevel( uiDC1, m_cDmmDataSCModel.get(0, 0, 1) ); |
---|
2462 | Int iDC1 = uiDC1; |
---|
2463 | if ( uiDC1 ) |
---|
2464 | { |
---|
2465 | UInt uiSign; |
---|
2466 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
2467 | if ( uiSign ) |
---|
2468 | { |
---|
2469 | iDC1 = -iDC1; |
---|
2470 | } |
---|
2471 | } |
---|
2472 | xReadExGolombLevel( uiDC2, m_cDmmDataSCModel.get(0, 0, 1) ); |
---|
2473 | Int iDC2 = uiDC2; |
---|
2474 | if ( uiDC2 ) |
---|
2475 | { |
---|
2476 | UInt uiSign; |
---|
2477 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
2478 | if ( uiSign ) |
---|
2479 | { |
---|
2480 | iDC2 = -iDC2; |
---|
2481 | } |
---|
2482 | } |
---|
2483 | |
---|
2484 | pcCU->setContourPredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth ); |
---|
2485 | pcCU->setContourPredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth ); |
---|
2486 | } |
---|
2487 | #endif |
---|
2488 | |
---|
2489 | #if LGE_EDGE_INTRA_A0070 |
---|
2490 | Void TDecSbac::xParseEdgeIntraInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2491 | { |
---|
2492 | UInt uiSymbol = 0; |
---|
2493 | |
---|
2494 | // 1. Top(0) or Left(1) |
---|
2495 | UChar ucLeft; |
---|
2496 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
2497 | ucLeft = uiSymbol; |
---|
2498 | |
---|
2499 | // 2. Start position (lowest bit first) |
---|
2500 | UChar ucStart = 0; |
---|
2501 | for( UInt ui = 0; ui < 6 - uiDepth; ui++ ) |
---|
2502 | { |
---|
2503 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
2504 | ucStart |= (uiSymbol << ui); |
---|
2505 | } |
---|
2506 | |
---|
2507 | // 3. Number of edges |
---|
2508 | UChar ucMax = 0; |
---|
2509 | for( UInt ui = 0; ui < 7 - uiDepth; ui++ ) |
---|
2510 | { |
---|
2511 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
2512 | ucMax |= (uiSymbol << ui); |
---|
2513 | } |
---|
2514 | ucMax++; // +1 |
---|
2515 | |
---|
2516 | // 4. Edges |
---|
2517 | UChar* pucSymbolList = (UChar*) xMalloc( UChar, 256 * LGE_EDGE_INTRA_MAX_EDGE_NUM_PER_4x4 ); |
---|
2518 | UInt uiCtxEdgeIntra = pcCU->getCtxEdgeIntra( uiAbsPartIdx ); |
---|
2519 | for( Int iPtr = 0; iPtr < ucMax; iPtr++ ) |
---|
2520 | { |
---|
2521 | UChar ucEdge = 0; |
---|
2522 | UInt uiReorderEdge = 0; |
---|
2523 | // Left-friendly direction |
---|
2524 | // 0 ( 0deg) => 0 |
---|
2525 | // 1 ( 45deg) => 10 |
---|
2526 | // 2 ( -45deg) => 110 |
---|
2527 | // 3 ( 90deg) => 1110 |
---|
2528 | // 4 ( -90deg) => 11110 |
---|
2529 | // 5 ( 135deg) => 111110 |
---|
2530 | // 6 (-135deg) => 111111 |
---|
2531 | // Right-friendly direction |
---|
2532 | // 0 ( 0deg) => 0 |
---|
2533 | // 1 ( -45deg) => 10 |
---|
2534 | // 2 ( 45deg) => 110 |
---|
2535 | // 3 ( -90deg) => 1110 |
---|
2536 | // 4 ( 90deg) => 11110 |
---|
2537 | // 5 (-135deg) => 111110 |
---|
2538 | // 6 ( 135deg) => 111111 |
---|
2539 | // refer to a paper "An efficient chain code with Huffman coding" |
---|
2540 | for( UInt ui = 0; ui < 6; ui++ ) |
---|
2541 | { |
---|
2542 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cEdgeIntraSCModel.get( 0, 0, uiCtxEdgeIntra ) ); |
---|
2543 | ucEdge <<= 1; |
---|
2544 | ucEdge |= uiSymbol; |
---|
2545 | if( uiSymbol == 0 ) |
---|
2546 | break; |
---|
2547 | } |
---|
2548 | |
---|
2549 | switch( ucEdge ) |
---|
2550 | { |
---|
2551 | case 0 : // "0" |
---|
2552 | uiReorderEdge = 0; |
---|
2553 | break; |
---|
2554 | case 2 : // "10" |
---|
2555 | uiReorderEdge = 1; |
---|
2556 | break; |
---|
2557 | case 6 : // "110" |
---|
2558 | uiReorderEdge = 2; |
---|
2559 | break; |
---|
2560 | case 14 : // "1110" |
---|
2561 | uiReorderEdge = 3; |
---|
2562 | break; |
---|
2563 | case 30 : // "11110" |
---|
2564 | uiReorderEdge = 4; |
---|
2565 | break; |
---|
2566 | case 62 : // "111110" |
---|
2567 | uiReorderEdge = 5; |
---|
2568 | break; |
---|
2569 | case 63 : // "111111" |
---|
2570 | uiReorderEdge = 6; |
---|
2571 | break; |
---|
2572 | default : |
---|
2573 | printf("parseIntraEdgeChain: error (unknown code %d)\n",ucEdge); |
---|
2574 | assert(false); |
---|
2575 | break; |
---|
2576 | } |
---|
2577 | pucSymbolList[iPtr] = uiReorderEdge; |
---|
2578 | } |
---|
2579 | ///////////////////// |
---|
2580 | // Edge Reconstruction |
---|
2581 | Bool* pbRegion = pcCU->getEdgePartition( uiAbsPartIdx ); |
---|
2582 | pcCU->reconPartition( uiAbsPartIdx, uiDepth, ucLeft == 1, ucStart, ucMax, pucSymbolList, pbRegion ); |
---|
2583 | xFree( pucSymbolList ); |
---|
2584 | } |
---|
2585 | #endif |
---|
2586 | |
---|
2587 | #if RWTH_SDC_DLT_B0036 |
---|
2588 | #if !PKU_QC_DEPTH_INTRA_UNI_D0195 |
---|
2589 | Void TDecSbac::parseSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2590 | { |
---|
2591 | assert( pcCU->getSlice()->getSPS()->isDepth() ); |
---|
2592 | |
---|
2593 | UInt uiSymbol = 0; |
---|
2594 | UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx ); |
---|
2595 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) ); |
---|
2596 | |
---|
2597 | if( uiSymbol == 1 ) |
---|
2598 | { |
---|
2599 | pcCU->setPartSizeSubParts(SIZE_2Nx2N, uiAbsPartIdx, uiDepth); |
---|
2600 | |
---|
2601 | pcCU->setSDCFlagSubParts( true, uiAbsPartIdx, 0, uiDepth); |
---|
2602 | pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth); |
---|
2603 | pcCU->setCbfSubParts(1, 1, 1, uiAbsPartIdx, uiDepth); |
---|
2604 | } |
---|
2605 | } |
---|
2606 | |
---|
2607 | Void TDecSbac::parseSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2608 | { |
---|
2609 | assert( pcCU->getSlice()->getSPS()->isDepth() ); |
---|
2610 | assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); |
---|
2611 | |
---|
2612 | assert( pcCU->getSDCFlag(uiAbsPartIdx) ); |
---|
2613 | |
---|
2614 | UInt uiCtx = 0; |
---|
2615 | |
---|
2616 | UInt uiMPModeIdx = 0; |
---|
2617 | |
---|
2618 | for(Int i=0; i<RWTH_SDC_NUM_PRED_MODES-1; i++) |
---|
2619 | { |
---|
2620 | UInt uiIsMostProb = 0; |
---|
2621 | #if INTEL_SDC64_D0193 |
---|
2622 | if( !(pcCU->getWidth(uiAbsPartIdx) == 64 && i == 1)) |
---|
2623 | #endif |
---|
2624 | m_pcTDecBinIf->decodeBin( uiIsMostProb, m_cSDCPredModeSCModel.get( 0, i, uiCtx ) ); |
---|
2625 | |
---|
2626 | if ( uiIsMostProb == 1 ) |
---|
2627 | break; |
---|
2628 | |
---|
2629 | // else: get next most probable pred mode |
---|
2630 | uiMPModeIdx = (uiMPModeIdx+1)%RWTH_SDC_NUM_PRED_MODES; |
---|
2631 | } |
---|
2632 | |
---|
2633 | Int intraPredMode = g_auiSDCPredModes[uiMPModeIdx]; |
---|
2634 | |
---|
2635 | #if HHI_DMM_WEDGE_INTRA |
---|
2636 | if( intraPredMode == DMM_WEDGE_FULL_IDX ) { xParseWedgeFullInfo ( pcCU, uiAbsPartIdx, uiDepth ); } |
---|
2637 | if( intraPredMode == DMM_WEDGE_PREDDIR_IDX ) { xParseWedgePredDirInfo ( pcCU, uiAbsPartIdx, uiDepth ); } |
---|
2638 | #endif |
---|
2639 | |
---|
2640 | pcCU->setLumaIntraDirSubParts((UChar)intraPredMode, uiAbsPartIdx, uiDepth); |
---|
2641 | } |
---|
2642 | #endif |
---|
2643 | |
---|
2644 | Void TDecSbac::parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment ) |
---|
2645 | { |
---|
2646 | assert( pcCU->getSlice()->getSPS()->isDepth() ); |
---|
2647 | assert( pcCU->getSDCFlag(uiAbsPartIdx) ); |
---|
2648 | assert( uiSegment < 2 ); |
---|
2649 | |
---|
2650 | UInt uiResidual = 0; |
---|
2651 | UInt uiBit = 0; |
---|
2652 | UInt uiAbsIdx = 0; |
---|
2653 | UInt uiSign = 0; |
---|
2654 | Int iIdx = 0; |
---|
2655 | |
---|
2656 | UInt uiMaxResidualBits = GetBitsPerDepthValue(); |
---|
2657 | assert( uiMaxResidualBits <= g_uiBitDepth ); |
---|
2658 | |
---|
2659 | #if RWTH_SDC_CTX_SIMPL_D0032 |
---|
2660 | m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) ); |
---|
2661 | #else |
---|
2662 | m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, uiSegment, 0 ) ); |
---|
2663 | #endif |
---|
2664 | |
---|
2665 | if (uiResidual) |
---|
2666 | { |
---|
2667 | // decode residual sign bit |
---|
2668 | #if RWTH_SDC_CTX_SIMPL_D0032 |
---|
2669 | m_pcTDecBinIf->decodeBinEP(uiSign); |
---|
2670 | #else |
---|
2671 | m_pcTDecBinIf->decodeBin(uiSign, m_cSDCResidualSignFlagSCModel.get( 0, uiSegment, 0 ) ); |
---|
2672 | #endif |
---|
2673 | |
---|
2674 | // decode residual magnitude |
---|
2675 | for (Int i=0; i<uiMaxResidualBits; i++) |
---|
2676 | { |
---|
2677 | #if RWTH_SDC_CTX_SIMPL_D0032 |
---|
2678 | m_pcTDecBinIf->decodeBin(uiBit, m_cSDCResidualSCModel.get( 0, 0, i ) ); |
---|
2679 | #else |
---|
2680 | m_pcTDecBinIf->decodeBin(uiBit, m_cSDCResidualSCModel.get( 0, uiSegment, i ) ); |
---|
2681 | #endif |
---|
2682 | uiAbsIdx |= uiBit << i; |
---|
2683 | } |
---|
2684 | |
---|
2685 | uiAbsIdx += 1; |
---|
2686 | iIdx =(Int)(uiSign ? -1 : 1)*uiAbsIdx; |
---|
2687 | } |
---|
2688 | |
---|
2689 | pcCU->setSDCSegmentDCOffset(iIdx, uiSegment, uiAbsPartIdx); |
---|
2690 | } |
---|
2691 | #endif |
---|
2692 | |
---|
2693 | //! \} |
---|