1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2013, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file TDecSbac.cpp |
---|
35 | \brief Context-adaptive entropy decoder class |
---|
36 | */ |
---|
37 | |
---|
38 | #include "TDecSbac.h" |
---|
39 | |
---|
40 | //! \ingroup TLibDecoder |
---|
41 | //! \{ |
---|
42 | |
---|
43 | ////////////////////////////////////////////////////////////////////// |
---|
44 | // Construction/Destruction |
---|
45 | ////////////////////////////////////////////////////////////////////// |
---|
46 | |
---|
47 | TDecSbac::TDecSbac() |
---|
48 | // new structure here |
---|
49 | : m_pcBitstream ( 0 ) |
---|
50 | , m_pcTDecBinIf ( NULL ) |
---|
51 | , m_numContextModels ( 0 ) |
---|
52 | , m_cCUSplitFlagSCModel ( 1, 1, NUM_SPLIT_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels ) |
---|
53 | , m_cCUSkipFlagSCModel ( 1, 1, NUM_SKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
54 | , m_cCUMergeFlagExtSCModel ( 1, 1, NUM_MERGE_FLAG_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
55 | , m_cCUMergeIdxExtSCModel ( 1, 1, NUM_MERGE_IDX_EXT_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
56 | #if H_3D_ARP |
---|
57 | , m_cCUPUARPWSCModel ( 1, 1, NUM_ARPW_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
58 | #endif |
---|
59 | #if H_3D_IC |
---|
60 | , m_cCUICFlagSCModel ( 1, 1, NUM_IC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
61 | #endif |
---|
62 | , m_cCUPartSizeSCModel ( 1, 1, NUM_PART_SIZE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
63 | , m_cCUPredModeSCModel ( 1, 1, NUM_PRED_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
64 | , m_cCUIntraPredSCModel ( 1, 1, NUM_ADI_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
65 | , m_cCUChromaPredSCModel ( 1, 1, NUM_CHROMA_PRED_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
66 | , m_cCUDeltaQpSCModel ( 1, 1, NUM_DELTA_QP_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
67 | , m_cCUInterDirSCModel ( 1, 1, NUM_INTER_DIR_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
68 | , m_cCURefPicSCModel ( 1, 1, NUM_REF_NO_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
69 | , m_cCUMvdSCModel ( 1, 1, NUM_MV_RES_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
70 | , m_cCUQtCbfSCModel ( 1, 2, NUM_QT_CBF_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
71 | , m_cCUTransSubdivFlagSCModel ( 1, 1, NUM_TRANS_SUBDIV_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
72 | , m_cCUQtRootCbfSCModel ( 1, 1, NUM_QT_ROOT_CBF_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
73 | , m_cCUSigCoeffGroupSCModel ( 1, 2, NUM_SIG_CG_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
74 | , m_cCUSigSCModel ( 1, 1, NUM_SIG_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
75 | , m_cCuCtxLastX ( 1, 2, NUM_CTX_LAST_FLAG_XY , m_contextModels + m_numContextModels, m_numContextModels) |
---|
76 | , m_cCuCtxLastY ( 1, 2, NUM_CTX_LAST_FLAG_XY , m_contextModels + m_numContextModels, m_numContextModels) |
---|
77 | , m_cCUOneSCModel ( 1, 1, NUM_ONE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
78 | , m_cCUAbsSCModel ( 1, 1, NUM_ABS_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
79 | , m_cMVPIdxSCModel ( 1, 1, NUM_MVP_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
80 | , m_cCUAMPSCModel ( 1, 1, NUM_CU_AMP_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
81 | , m_cSaoMergeSCModel ( 1, 1, NUM_SAO_MERGE_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
82 | , m_cSaoTypeIdxSCModel ( 1, 1, NUM_SAO_TYPE_IDX_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
83 | , m_cTransformSkipSCModel ( 1, 2, NUM_TRANSFORMSKIP_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
84 | , m_CUTransquantBypassFlagSCModel( 1, 1, NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX, m_contextModels + m_numContextModels, m_numContextModels) |
---|
85 | #if H_3D_DIM |
---|
86 | , m_cDepthIntraModeSCModel ( 1, 1, NUM_DEPTH_INTRA_MODE_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
87 | , m_cDdcFlagSCModel ( 1, 1, NUM_DDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
88 | , m_cDdcDataSCModel ( 1, 1, NUM_DDC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
89 | #if H_3D_DIM_DMM |
---|
90 | , m_cDmm1DataSCModel ( 1, 1, NUM_DMM1_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
91 | #if !SEC_DMM2_E0146_HHIFIX |
---|
92 | , m_cDmm2DataSCModel ( 1, 1, NUM_DMM2_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
93 | #endif |
---|
94 | , m_cDmm3DataSCModel ( 1, 1, NUM_DMM3_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
95 | #endif |
---|
96 | #if H_3D_DIM_RBC |
---|
97 | , m_cRbcDataSCModel ( 1, 1, NUM_RBC_DATA_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
98 | #endif |
---|
99 | #if H_3D_DIM_SDC |
---|
100 | , m_cSDCResidualFlagSCModel ( 1, 1, SDC_NUM_RESIDUAL_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
101 | , m_cSDCResidualSCModel ( 1, 1, SDC_NUM_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
102 | #endif |
---|
103 | #endif |
---|
104 | #if LGE_INTER_SDC_E0156 |
---|
105 | , m_cInterSDCFlagSCModel ( 1, 1, NUM_INTER_SDC_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
106 | , m_cInterSDCResidualSCModel ( 1, 1, NUM_INTER_SDC_RESIDUAL_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
107 | , m_cInterSDCResidualSignFlagSCModel ( 1, 1, NUM_INTER_SDC_SIGN_FLAG_CTX , m_contextModels + m_numContextModels, m_numContextModels) |
---|
108 | #endif |
---|
109 | { |
---|
110 | assert( m_numContextModels <= MAX_NUM_CTX_MOD ); |
---|
111 | } |
---|
112 | |
---|
113 | TDecSbac::~TDecSbac() |
---|
114 | { |
---|
115 | } |
---|
116 | |
---|
117 | // ==================================================================================================================== |
---|
118 | // Public member functions |
---|
119 | // ==================================================================================================================== |
---|
120 | |
---|
121 | Void TDecSbac::resetEntropy(TComSlice* pSlice) |
---|
122 | { |
---|
123 | SliceType sliceType = pSlice->getSliceType(); |
---|
124 | Int qp = pSlice->getSliceQp(); |
---|
125 | |
---|
126 | if (pSlice->getPPS()->getCabacInitPresentFlag() && pSlice->getCabacInitFlag()) |
---|
127 | { |
---|
128 | switch (sliceType) |
---|
129 | { |
---|
130 | case P_SLICE: // change initialization table to B_SLICE initialization |
---|
131 | sliceType = B_SLICE; |
---|
132 | break; |
---|
133 | case B_SLICE: // change initialization table to P_SLICE initialization |
---|
134 | sliceType = P_SLICE; |
---|
135 | break; |
---|
136 | default : // should not occur |
---|
137 | assert(0); |
---|
138 | } |
---|
139 | } |
---|
140 | |
---|
141 | m_cCUSplitFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SPLIT_FLAG ); |
---|
142 | m_cCUSkipFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SKIP_FLAG ); |
---|
143 | m_cCUMergeFlagExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT ); |
---|
144 | m_cCUMergeIdxExtSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MERGE_IDX_EXT ); |
---|
145 | #if H_3D_ARP |
---|
146 | m_cCUPUARPWSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ARPW ); |
---|
147 | #endif |
---|
148 | #if H_3D_IC |
---|
149 | m_cCUICFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_IC_FLAG ); |
---|
150 | #endif |
---|
151 | m_cCUPartSizeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PART_SIZE ); |
---|
152 | m_cCUAMPSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CU_AMP_POS ); |
---|
153 | m_cCUPredModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_PRED_MODE ); |
---|
154 | m_cCUIntraPredSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTRA_PRED_MODE ); |
---|
155 | m_cCUChromaPredSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_CHROMA_PRED_MODE ); |
---|
156 | m_cCUInterDirSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_DIR ); |
---|
157 | m_cCUMvdSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MVD ); |
---|
158 | m_cCURefPicSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_REF_PIC ); |
---|
159 | m_cCUDeltaQpSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DQP ); |
---|
160 | m_cCUQtCbfSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_QT_CBF ); |
---|
161 | m_cCUQtRootCbfSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_QT_ROOT_CBF ); |
---|
162 | m_cCUSigCoeffGroupSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SIG_CG_FLAG ); |
---|
163 | m_cCUSigSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SIG_FLAG ); |
---|
164 | m_cCuCtxLastX.initBuffer ( sliceType, qp, (UChar*)INIT_LAST ); |
---|
165 | m_cCuCtxLastY.initBuffer ( sliceType, qp, (UChar*)INIT_LAST ); |
---|
166 | m_cCUOneSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ONE_FLAG ); |
---|
167 | m_cCUAbsSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_ABS_FLAG ); |
---|
168 | m_cMVPIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_MVP_IDX ); |
---|
169 | m_cSaoMergeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_MERGE_FLAG ); |
---|
170 | m_cSaoTypeIdxSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SAO_TYPE_IDX ); |
---|
171 | |
---|
172 | m_cCUTransSubdivFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); |
---|
173 | m_cTransformSkipSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); |
---|
174 | m_CUTransquantBypassFlagSCModel.initBuffer( sliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); |
---|
175 | #if H_3D_DIM |
---|
176 | m_cDepthIntraModeSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE ); |
---|
177 | m_cDdcFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DDC_FLAG ); |
---|
178 | m_cDdcDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DDC_DATA ); |
---|
179 | #if H_3D_DIM_DMM |
---|
180 | m_cDmm1DataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM1_DATA ); |
---|
181 | #if !SEC_DMM2_E0146_HHIFIX |
---|
182 | m_cDmm2DataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM2_DATA ); |
---|
183 | #endif |
---|
184 | m_cDmm3DataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_DMM3_DATA ); |
---|
185 | #endif |
---|
186 | #if H_3D_DIM_RBC |
---|
187 | m_cRbcDataSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_RBC_DATA ); |
---|
188 | #endif |
---|
189 | #if H_3D_DIM_SDC |
---|
190 | m_cSDCResidualFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); |
---|
191 | m_cSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL ); |
---|
192 | #endif |
---|
193 | #endif |
---|
194 | #if LGE_INTER_SDC_E0156 |
---|
195 | m_cInterSDCFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_SDC_FLAG ); |
---|
196 | m_cInterSDCResidualSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL ); |
---|
197 | m_cInterSDCResidualSignFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_INTER_SDC_SIGN_FLAG ); |
---|
198 | #endif |
---|
199 | m_uiLastDQpNonZero = 0; |
---|
200 | |
---|
201 | // new structure |
---|
202 | m_uiLastQp = qp; |
---|
203 | |
---|
204 | m_pcTDecBinIf->start(); |
---|
205 | } |
---|
206 | |
---|
207 | /** The function does the following: Read out terminate bit. Flush CABAC. Byte-align for next tile. |
---|
208 | * Intialize CABAC states. Start CABAC. |
---|
209 | */ |
---|
210 | Void TDecSbac::updateContextTables( SliceType eSliceType, Int iQp ) |
---|
211 | { |
---|
212 | UInt uiBit; |
---|
213 | m_pcTDecBinIf->decodeBinTrm(uiBit); |
---|
214 | assert(uiBit); // end_of_sub_stream_one_bit must be equal to 1 |
---|
215 | m_pcTDecBinIf->finish(); |
---|
216 | m_pcBitstream->readOutTrailingBits(); |
---|
217 | m_cCUSplitFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SPLIT_FLAG ); |
---|
218 | m_cCUSkipFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG ); |
---|
219 | m_cCUMergeFlagExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT ); |
---|
220 | m_cCUMergeIdxExtSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT ); |
---|
221 | #if H_3D_ARP |
---|
222 | m_cCUPUARPWSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ARPW ); |
---|
223 | #endif |
---|
224 | #if H_3D_IC |
---|
225 | m_cCUICFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_IC_FLAG ); |
---|
226 | #endif |
---|
227 | m_cCUPartSizeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PART_SIZE ); |
---|
228 | m_cCUAMPSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_CU_AMP_POS ); |
---|
229 | m_cCUPredModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_PRED_MODE ); |
---|
230 | m_cCUIntraPredSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTRA_PRED_MODE ); |
---|
231 | m_cCUChromaPredSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_CHROMA_PRED_MODE ); |
---|
232 | m_cCUInterDirSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_DIR ); |
---|
233 | m_cCUMvdSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MVD ); |
---|
234 | m_cCURefPicSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_REF_PIC ); |
---|
235 | m_cCUDeltaQpSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DQP ); |
---|
236 | m_cCUQtCbfSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_QT_CBF ); |
---|
237 | m_cCUQtRootCbfSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_QT_ROOT_CBF ); |
---|
238 | m_cCUSigCoeffGroupSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SIG_CG_FLAG ); |
---|
239 | m_cCUSigSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SIG_FLAG ); |
---|
240 | m_cCuCtxLastX.initBuffer ( eSliceType, iQp, (UChar*)INIT_LAST ); |
---|
241 | m_cCuCtxLastY.initBuffer ( eSliceType, iQp, (UChar*)INIT_LAST ); |
---|
242 | m_cCUOneSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ONE_FLAG ); |
---|
243 | m_cCUAbsSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_ABS_FLAG ); |
---|
244 | m_cMVPIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_MVP_IDX ); |
---|
245 | m_cSaoMergeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_FLAG ); |
---|
246 | m_cSaoTypeIdxSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX ); |
---|
247 | m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG ); |
---|
248 | m_cTransformSkipSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANSFORMSKIP_FLAG ); |
---|
249 | m_CUTransquantBypassFlagSCModel.initBuffer( eSliceType, iQp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG ); |
---|
250 | |
---|
251 | #if H_3D_DIM |
---|
252 | m_cDepthIntraModeSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DEPTH_INTRA_MODE ); |
---|
253 | m_cDdcFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG ); |
---|
254 | m_cDdcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DDC_DATA ); |
---|
255 | #if H_3D_DIM_DMM |
---|
256 | m_cDmm1DataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA ); |
---|
257 | #if !SEC_DMM2_E0146_HHIFIX |
---|
258 | m_cDmm2DataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM2_DATA ); |
---|
259 | #endif |
---|
260 | m_cDmm3DataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA ); |
---|
261 | #endif |
---|
262 | #if H_3D_DIM_RBC |
---|
263 | m_cRbcDataSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_RBC_DATA ); |
---|
264 | #endif |
---|
265 | #if H_3D_DIM_SDC |
---|
266 | m_cSDCResidualFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG ); |
---|
267 | m_cSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL ); |
---|
268 | #endif |
---|
269 | #endif |
---|
270 | #if LGE_INTER_SDC_E0156 |
---|
271 | m_cInterSDCFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG ); |
---|
272 | m_cInterSDCResidualSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL ); |
---|
273 | m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG ); |
---|
274 | #endif |
---|
275 | m_pcTDecBinIf->start(); |
---|
276 | } |
---|
277 | |
---|
278 | Void TDecSbac::parseTerminatingBit( UInt& ruiBit ) |
---|
279 | { |
---|
280 | m_pcTDecBinIf->decodeBinTrm( ruiBit ); |
---|
281 | if ( ruiBit ) |
---|
282 | { |
---|
283 | m_pcTDecBinIf->finish(); |
---|
284 | } |
---|
285 | } |
---|
286 | |
---|
287 | |
---|
288 | Void TDecSbac::xReadUnaryMaxSymbol( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol ) |
---|
289 | { |
---|
290 | if (uiMaxSymbol == 0) |
---|
291 | { |
---|
292 | ruiSymbol = 0; |
---|
293 | return; |
---|
294 | } |
---|
295 | |
---|
296 | m_pcTDecBinIf->decodeBin( ruiSymbol, pcSCModel[0] ); |
---|
297 | |
---|
298 | if( ruiSymbol == 0 || uiMaxSymbol == 1 ) |
---|
299 | { |
---|
300 | return; |
---|
301 | } |
---|
302 | |
---|
303 | UInt uiSymbol = 0; |
---|
304 | UInt uiCont; |
---|
305 | |
---|
306 | do |
---|
307 | { |
---|
308 | m_pcTDecBinIf->decodeBin( uiCont, pcSCModel[ iOffset ] ); |
---|
309 | uiSymbol++; |
---|
310 | } |
---|
311 | while( uiCont && ( uiSymbol < uiMaxSymbol - 1 ) ); |
---|
312 | |
---|
313 | if( uiCont && ( uiSymbol == uiMaxSymbol - 1 ) ) |
---|
314 | { |
---|
315 | uiSymbol++; |
---|
316 | } |
---|
317 | |
---|
318 | ruiSymbol = uiSymbol; |
---|
319 | } |
---|
320 | |
---|
321 | Void TDecSbac::xReadEpExGolomb( UInt& ruiSymbol, UInt uiCount ) |
---|
322 | { |
---|
323 | UInt uiSymbol = 0; |
---|
324 | UInt uiBit = 1; |
---|
325 | |
---|
326 | while( uiBit ) |
---|
327 | { |
---|
328 | m_pcTDecBinIf->decodeBinEP( uiBit ); |
---|
329 | uiSymbol += uiBit << uiCount++; |
---|
330 | } |
---|
331 | |
---|
332 | if ( --uiCount ) |
---|
333 | { |
---|
334 | UInt bins; |
---|
335 | m_pcTDecBinIf->decodeBinsEP( bins, uiCount ); |
---|
336 | uiSymbol += bins; |
---|
337 | } |
---|
338 | |
---|
339 | ruiSymbol = uiSymbol; |
---|
340 | } |
---|
341 | |
---|
342 | Void TDecSbac::xReadUnarySymbol( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset ) |
---|
343 | { |
---|
344 | m_pcTDecBinIf->decodeBin( ruiSymbol, pcSCModel[0] ); |
---|
345 | |
---|
346 | if( !ruiSymbol ) |
---|
347 | { |
---|
348 | return; |
---|
349 | } |
---|
350 | |
---|
351 | UInt uiSymbol = 0; |
---|
352 | UInt uiCont; |
---|
353 | |
---|
354 | do |
---|
355 | { |
---|
356 | m_pcTDecBinIf->decodeBin( uiCont, pcSCModel[ iOffset ] ); |
---|
357 | uiSymbol++; |
---|
358 | } |
---|
359 | while( uiCont ); |
---|
360 | |
---|
361 | ruiSymbol = uiSymbol; |
---|
362 | } |
---|
363 | |
---|
364 | |
---|
365 | /** Parsing of coeff_abs_level_remaing |
---|
366 | * \param ruiSymbol reference to coeff_abs_level_remaing |
---|
367 | * \param ruiParam reference to parameter |
---|
368 | * \returns Void |
---|
369 | */ |
---|
370 | Void TDecSbac::xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam ) |
---|
371 | { |
---|
372 | |
---|
373 | UInt prefix = 0; |
---|
374 | UInt codeWord = 0; |
---|
375 | do |
---|
376 | { |
---|
377 | prefix++; |
---|
378 | m_pcTDecBinIf->decodeBinEP( codeWord ); |
---|
379 | } |
---|
380 | while( codeWord); |
---|
381 | codeWord = 1 - codeWord; |
---|
382 | prefix -= codeWord; |
---|
383 | codeWord=0; |
---|
384 | if (prefix < COEF_REMAIN_BIN_REDUCTION ) |
---|
385 | { |
---|
386 | m_pcTDecBinIf->decodeBinsEP(codeWord,rParam); |
---|
387 | rSymbol = (prefix<<rParam) + codeWord; |
---|
388 | } |
---|
389 | else |
---|
390 | { |
---|
391 | m_pcTDecBinIf->decodeBinsEP(codeWord,prefix-COEF_REMAIN_BIN_REDUCTION+rParam); |
---|
392 | rSymbol = (((1<<(prefix-COEF_REMAIN_BIN_REDUCTION))+COEF_REMAIN_BIN_REDUCTION-1)<<rParam)+codeWord; |
---|
393 | } |
---|
394 | } |
---|
395 | |
---|
396 | #if H_3D_DIM |
---|
397 | Void TDecSbac::xReadExGolombLevel( UInt& ruiSymbol, ContextModel& rcSCModel ) |
---|
398 | { |
---|
399 | UInt uiSymbol; |
---|
400 | UInt uiCount = 0; |
---|
401 | do |
---|
402 | { |
---|
403 | m_pcTDecBinIf->decodeBin( uiSymbol, rcSCModel ); |
---|
404 | uiCount++; |
---|
405 | } |
---|
406 | while( uiSymbol && ( uiCount != 13 ) ); |
---|
407 | |
---|
408 | ruiSymbol = uiCount - 1; |
---|
409 | |
---|
410 | if( uiSymbol ) |
---|
411 | { |
---|
412 | xReadEpExGolomb( uiSymbol, 0 ); |
---|
413 | ruiSymbol += uiSymbol + 1; |
---|
414 | } |
---|
415 | |
---|
416 | return; |
---|
417 | } |
---|
418 | |
---|
419 | Void TDecSbac::xParseDimDeltaDC( Pel& rValDeltaDC, UInt dimType ) |
---|
420 | { |
---|
421 | UInt absValDeltaDC = 0; |
---|
422 | xReadExGolombLevel( absValDeltaDC, m_cDdcDataSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) ); |
---|
423 | rValDeltaDC = (Pel)absValDeltaDC; |
---|
424 | |
---|
425 | if( rValDeltaDC != 0 ) |
---|
426 | { |
---|
427 | UInt uiSign; |
---|
428 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
429 | if ( uiSign ) |
---|
430 | { |
---|
431 | rValDeltaDC = -rValDeltaDC; |
---|
432 | } |
---|
433 | } |
---|
434 | } |
---|
435 | #if H_3D_DIM_DMM |
---|
436 | Void TDecSbac::xParseDmm1WedgeIdx( UInt& ruiTabIdx, Int iNumBit ) |
---|
437 | { |
---|
438 | UInt uiSymbol, uiIdx = 0; |
---|
439 | for( Int i = 0; i < iNumBit; i++ ) |
---|
440 | { |
---|
441 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm1DataSCModel.get(0, 0, 0) ); |
---|
442 | uiIdx += uiSymbol << i; |
---|
443 | } |
---|
444 | ruiTabIdx = uiIdx; |
---|
445 | } |
---|
446 | #if !SEC_DMM2_E0146_HHIFIX |
---|
447 | Void TDecSbac::xParseDmm2Offset( Int& riOffset ) |
---|
448 | { |
---|
449 | Int iDeltaEnd = 0; |
---|
450 | if( DMM2_DELTAEND_MAX > 0 ) |
---|
451 | { |
---|
452 | UInt uiFlag = 0; |
---|
453 | m_pcTDecBinIf->decodeBin( uiFlag, m_cDmm2DataSCModel.get(0, 0, 0) ); |
---|
454 | |
---|
455 | if( uiFlag ) |
---|
456 | { |
---|
457 | UInt uiAbsValMinus1; |
---|
458 | UInt uiSymbol; |
---|
459 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm2DataSCModel.get(0, 0, 0) ); uiAbsValMinus1 = uiSymbol; |
---|
460 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm2DataSCModel.get(0, 0, 0) ); uiAbsValMinus1 |= uiSymbol << 1; |
---|
461 | iDeltaEnd = uiAbsValMinus1 + 1; |
---|
462 | UInt uiSign; |
---|
463 | m_pcTDecBinIf->decodeBinEP( uiSign ); |
---|
464 | if( uiSign ) |
---|
465 | { |
---|
466 | iDeltaEnd = -iDeltaEnd; |
---|
467 | } |
---|
468 | } |
---|
469 | } |
---|
470 | riOffset = iDeltaEnd; |
---|
471 | } |
---|
472 | #endif |
---|
473 | Void TDecSbac::xParseDmm3WedgeIdx( UInt& ruiIntraIdx, Int iNumBit ) |
---|
474 | { |
---|
475 | UInt uiSymbol, uiIdx = 0; |
---|
476 | for( Int i = 0; i < iNumBit; i++ ) |
---|
477 | { |
---|
478 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm3DataSCModel.get(0, 0, 0) ); |
---|
479 | uiIdx += uiSymbol << i; |
---|
480 | } |
---|
481 | ruiIntraIdx = uiIdx; |
---|
482 | } |
---|
483 | #endif |
---|
484 | #if H_3D_DIM_RBC |
---|
485 | Void TDecSbac::xParseRbcEdge( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
486 | { |
---|
487 | UInt uiSymbol = 0; |
---|
488 | |
---|
489 | // 1. Top(0) or Left(1) |
---|
490 | UChar ucLeft; |
---|
491 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
492 | ucLeft = uiSymbol; |
---|
493 | |
---|
494 | // 2. Start position (lowest bit first) |
---|
495 | UChar ucStart = 0; |
---|
496 | for( UInt ui = 0; ui < 6 - uiDepth; ui++ ) |
---|
497 | { |
---|
498 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
499 | ucStart |= (uiSymbol << ui); |
---|
500 | } |
---|
501 | |
---|
502 | // 3. Number of edges |
---|
503 | UChar ucMax = 0; |
---|
504 | for( UInt ui = 0; ui < 7 - uiDepth; ui++ ) |
---|
505 | { |
---|
506 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
507 | ucMax |= (uiSymbol << ui); |
---|
508 | } |
---|
509 | ucMax++; // +1 |
---|
510 | |
---|
511 | // 4. Edges |
---|
512 | UChar* pucSymbolList = (UChar*) xMalloc( UChar, 256 * RBC_MAX_EDGE_NUM_PER_4x4 ); |
---|
513 | for( Int iPtr = 0; iPtr < ucMax; iPtr++ ) |
---|
514 | { |
---|
515 | UChar ucEdge = 0; |
---|
516 | UInt uiReorderEdge = 0; |
---|
517 | for( UInt ui = 0; ui < 6; ui++ ) |
---|
518 | { |
---|
519 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cRbcDataSCModel.get( 0, 0, 0 ) ); |
---|
520 | ucEdge <<= 1; |
---|
521 | ucEdge |= uiSymbol; |
---|
522 | if( uiSymbol == 0 ) |
---|
523 | break; |
---|
524 | } |
---|
525 | |
---|
526 | switch( ucEdge ) |
---|
527 | { |
---|
528 | case 0 : // "0" |
---|
529 | uiReorderEdge = 0; |
---|
530 | break; |
---|
531 | case 2 : // "10" |
---|
532 | uiReorderEdge = 1; |
---|
533 | break; |
---|
534 | case 6 : // "110" |
---|
535 | uiReorderEdge = 2; |
---|
536 | break; |
---|
537 | case 14 : // "1110" |
---|
538 | uiReorderEdge = 3; |
---|
539 | break; |
---|
540 | case 30 : // "11110" |
---|
541 | uiReorderEdge = 4; |
---|
542 | break; |
---|
543 | case 62 : // "111110" |
---|
544 | uiReorderEdge = 5; |
---|
545 | break; |
---|
546 | case 63 : // "111111" |
---|
547 | uiReorderEdge = 6; |
---|
548 | break; |
---|
549 | default : |
---|
550 | printf("parseIntraEdgeChain: error (unknown code %d)\n",ucEdge); |
---|
551 | assert(false); |
---|
552 | break; |
---|
553 | } |
---|
554 | pucSymbolList[iPtr] = uiReorderEdge; |
---|
555 | } |
---|
556 | ///////////////////// |
---|
557 | // Edge Reconstruction |
---|
558 | Bool* pbRegion = pcCU->getEdgePartition( uiAbsPartIdx ); |
---|
559 | pcCU->reconPartition( uiAbsPartIdx, uiDepth, ucLeft == 1, ucStart, ucMax, pucSymbolList, pbRegion ); |
---|
560 | xFree( pucSymbolList ); |
---|
561 | } |
---|
562 | #endif |
---|
563 | #if H_3D_DIM_SDC |
---|
564 | Void TDecSbac::xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment ) |
---|
565 | { |
---|
566 | assert( pcCU->getSlice()->getIsDepth() ); |
---|
567 | assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); |
---|
568 | assert( pcCU->getSDCFlag(uiAbsPartIdx) ); |
---|
569 | assert( uiSegment < 2 ); |
---|
570 | |
---|
571 | UInt uiResidual = 0; |
---|
572 | UInt uiBit = 0; |
---|
573 | UInt uiAbsIdx = 0; |
---|
574 | UInt uiSign = 0; |
---|
575 | Int iIdx = 0; |
---|
576 | |
---|
577 | #if H_3D_DIM_DLT |
---|
578 | UInt uiMaxResidualBits = pcCU->getSlice()->getVPS()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() ); |
---|
579 | #else |
---|
580 | UInt uiMaxResidualBits = g_bitDepthY; |
---|
581 | #endif |
---|
582 | assert( uiMaxResidualBits <= g_bitDepthY ); |
---|
583 | |
---|
584 | m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) ); |
---|
585 | |
---|
586 | #if H_MV_ENC_DEC_TRAC |
---|
587 | DTRACE_CU("sdc_residual_flag[i]", uiResidual) |
---|
588 | #endif |
---|
589 | |
---|
590 | if (uiResidual) |
---|
591 | { |
---|
592 | // decode residual sign bit |
---|
593 | m_pcTDecBinIf->decodeBinEP(uiSign); |
---|
594 | #if H_MV_ENC_DEC_TRAC |
---|
595 | DTRACE_CU("sdc_residual_sign_flag[i]", uiSign) |
---|
596 | #endif |
---|
597 | |
---|
598 | // decode residual magnitude |
---|
599 | // prefix part |
---|
600 | UInt uiCount = 0; |
---|
601 | #if H_3D_DIM_DLT |
---|
602 | UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ); |
---|
603 | #else |
---|
604 | UInt uiNumDepthValues = ((1 << g_bitDepthY)-1); |
---|
605 | #endif |
---|
606 | UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2); |
---|
607 | for ( UInt ui = 0; ui < uiPrefixThreshold; ui++) |
---|
608 | { |
---|
609 | m_pcTDecBinIf->decodeBin( uiBit, m_cSDCResidualSCModel.get(0, 0, 0) ); |
---|
610 | if ( uiBit == 0 ) |
---|
611 | break; |
---|
612 | else |
---|
613 | uiCount++; |
---|
614 | } |
---|
615 | // suffix part |
---|
616 | if ( uiCount == uiPrefixThreshold ) |
---|
617 | { |
---|
618 | for ( UInt ui = 0; ui < numBitsForValue(uiNumDepthValues - uiPrefixThreshold); ui++ ) |
---|
619 | { |
---|
620 | m_pcTDecBinIf->decodeBinEP( uiBit ); |
---|
621 | uiAbsIdx |= uiBit << ui; |
---|
622 | } |
---|
623 | uiAbsIdx += uiCount; |
---|
624 | } |
---|
625 | else |
---|
626 | { |
---|
627 | uiAbsIdx = uiCount; |
---|
628 | } |
---|
629 | |
---|
630 | #if H_MV_ENC_DEC_TRAC |
---|
631 | DTRACE_CU("sdc_residual_abs_minus1[i]", uiAbsIdx) |
---|
632 | #endif |
---|
633 | |
---|
634 | uiAbsIdx += 1; |
---|
635 | iIdx =(Int)(uiSign ? -1 : 1)*uiAbsIdx; |
---|
636 | } |
---|
637 | |
---|
638 | pcCU->setSDCSegmentDCOffset(iIdx, uiSegment, uiAbsPartIdx); |
---|
639 | } |
---|
640 | #endif |
---|
641 | #endif |
---|
642 | |
---|
643 | /** Parse I_PCM information. |
---|
644 | * \param pcCU |
---|
645 | * \param uiAbsPartIdx |
---|
646 | * \param uiDepth |
---|
647 | * \returns Void |
---|
648 | * |
---|
649 | * If I_PCM flag indicates that the CU is I_PCM, parse its PCM alignment bits and codes. |
---|
650 | */ |
---|
651 | Void TDecSbac::parseIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
652 | { |
---|
653 | UInt uiSymbol; |
---|
654 | |
---|
655 | m_pcTDecBinIf->decodeBinTrm(uiSymbol); |
---|
656 | |
---|
657 | #if H_MV_ENC_DEC_TRAC |
---|
658 | DTRACE_CU("pcm_flag", uiSymbol) |
---|
659 | #endif |
---|
660 | if (uiSymbol) |
---|
661 | { |
---|
662 | Bool bIpcmFlag = true; |
---|
663 | |
---|
664 | pcCU->setPartSizeSubParts ( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
665 | pcCU->setSizeSubParts ( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
666 | pcCU->setTrIdxSubParts ( 0, uiAbsPartIdx, uiDepth ); |
---|
667 | pcCU->setIPCMFlagSubParts ( bIpcmFlag, uiAbsPartIdx, uiDepth ); |
---|
668 | |
---|
669 | UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight(); |
---|
670 | UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; |
---|
671 | UInt uiChromaOffset = uiLumaOffset>>2; |
---|
672 | |
---|
673 | Pel* piPCMSample; |
---|
674 | UInt uiWidth; |
---|
675 | UInt uiHeight; |
---|
676 | UInt uiSampleBits; |
---|
677 | UInt uiX, uiY; |
---|
678 | |
---|
679 | piPCMSample = pcCU->getPCMSampleY() + uiLumaOffset; |
---|
680 | uiWidth = pcCU->getWidth(uiAbsPartIdx); |
---|
681 | uiHeight = pcCU->getHeight(uiAbsPartIdx); |
---|
682 | uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthLuma(); |
---|
683 | |
---|
684 | for(uiY = 0; uiY < uiHeight; uiY++) |
---|
685 | { |
---|
686 | for(uiX = 0; uiX < uiWidth; uiX++) |
---|
687 | { |
---|
688 | UInt uiSample; |
---|
689 | m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample); |
---|
690 | piPCMSample[uiX] = uiSample; |
---|
691 | } |
---|
692 | piPCMSample += uiWidth; |
---|
693 | } |
---|
694 | |
---|
695 | piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset; |
---|
696 | uiWidth = pcCU->getWidth(uiAbsPartIdx)/2; |
---|
697 | uiHeight = pcCU->getHeight(uiAbsPartIdx)/2; |
---|
698 | uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); |
---|
699 | |
---|
700 | for(uiY = 0; uiY < uiHeight; uiY++) |
---|
701 | { |
---|
702 | for(uiX = 0; uiX < uiWidth; uiX++) |
---|
703 | { |
---|
704 | UInt uiSample; |
---|
705 | m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample); |
---|
706 | piPCMSample[uiX] = uiSample; |
---|
707 | } |
---|
708 | piPCMSample += uiWidth; |
---|
709 | } |
---|
710 | |
---|
711 | piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset; |
---|
712 | uiWidth = pcCU->getWidth(uiAbsPartIdx)/2; |
---|
713 | uiHeight = pcCU->getHeight(uiAbsPartIdx)/2; |
---|
714 | uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma(); |
---|
715 | |
---|
716 | for(uiY = 0; uiY < uiHeight; uiY++) |
---|
717 | { |
---|
718 | for(uiX = 0; uiX < uiWidth; uiX++) |
---|
719 | { |
---|
720 | UInt uiSample; |
---|
721 | m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample); |
---|
722 | piPCMSample[uiX] = uiSample; |
---|
723 | } |
---|
724 | piPCMSample += uiWidth; |
---|
725 | } |
---|
726 | |
---|
727 | m_pcTDecBinIf->start(); |
---|
728 | } |
---|
729 | } |
---|
730 | |
---|
731 | Void TDecSbac::parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
732 | { |
---|
733 | UInt uiSymbol; |
---|
734 | m_pcTDecBinIf->decodeBin( uiSymbol, m_CUTransquantBypassFlagSCModel.get( 0, 0, 0 ) ); |
---|
735 | #if H_MV_ENC_DEC_TRAC |
---|
736 | DTRACE_CU("cu_transquant_bypass_flag", uiSymbol); |
---|
737 | #endif |
---|
738 | pcCU->setCUTransquantBypassSubParts(uiSymbol ? true : false, uiAbsPartIdx, uiDepth); |
---|
739 | } |
---|
740 | |
---|
741 | /** parse skip flag |
---|
742 | * \param pcCU |
---|
743 | * \param uiAbsPartIdx |
---|
744 | * \param uiDepth |
---|
745 | * \returns Void |
---|
746 | */ |
---|
747 | Void TDecSbac::parseSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
748 | { |
---|
749 | if( pcCU->getSlice()->isIntra() ) |
---|
750 | { |
---|
751 | return; |
---|
752 | } |
---|
753 | |
---|
754 | UInt uiSymbol = 0; |
---|
755 | UInt uiCtxSkip = pcCU->getCtxSkipFlag( uiAbsPartIdx ); |
---|
756 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSkipFlagSCModel.get( 0, 0, uiCtxSkip ) ); |
---|
757 | #if !H_MV_ENC_DEC_TRAC |
---|
758 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
759 | DTRACE_CABAC_T( "\tSkipFlag" ); |
---|
760 | DTRACE_CABAC_T( "\tuiCtxSkip: "); |
---|
761 | DTRACE_CABAC_V( uiCtxSkip ); |
---|
762 | DTRACE_CABAC_T( "\tuiSymbol: "); |
---|
763 | DTRACE_CABAC_V( uiSymbol ); |
---|
764 | DTRACE_CABAC_T( "\n"); |
---|
765 | #endif |
---|
766 | |
---|
767 | if( uiSymbol ) |
---|
768 | { |
---|
769 | pcCU->setSkipFlagSubParts( true, uiAbsPartIdx, uiDepth ); |
---|
770 | pcCU->setPredModeSubParts( MODE_INTER, uiAbsPartIdx, uiDepth ); |
---|
771 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
772 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
773 | pcCU->setMergeFlagSubParts( true , uiAbsPartIdx, 0, uiDepth ); |
---|
774 | } |
---|
775 | #if H_MV_ENC_DEC_TRAC |
---|
776 | DTRACE_CU("cu_skip_flag", uiSymbol); |
---|
777 | #endif |
---|
778 | } |
---|
779 | |
---|
780 | /** parse merge flag |
---|
781 | * \param pcCU |
---|
782 | * \param uiAbsPartIdx |
---|
783 | * \param uiDepth |
---|
784 | * \param uiPUIdx |
---|
785 | * \returns Void |
---|
786 | */ |
---|
787 | Void TDecSbac::parseMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) |
---|
788 | { |
---|
789 | UInt uiSymbol; |
---|
790 | m_pcTDecBinIf->decodeBin( uiSymbol, *m_cCUMergeFlagExtSCModel.get( 0 ) ); |
---|
791 | #if H_MV_ENC_DEC_TRAC |
---|
792 | DTRACE_PU("merge_flag", uiSymbol) |
---|
793 | #endif |
---|
794 | pcCU->setMergeFlagSubParts( uiSymbol ? true : false, uiAbsPartIdx, uiPUIdx, uiDepth ); |
---|
795 | |
---|
796 | #if !H_MV_ENC_DEC_TRAC |
---|
797 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
798 | DTRACE_CABAC_T( "\tMergeFlag: " ); |
---|
799 | DTRACE_CABAC_V( uiSymbol ); |
---|
800 | DTRACE_CABAC_T( "\tAddress: " ); |
---|
801 | DTRACE_CABAC_V( pcCU->getAddr() ); |
---|
802 | DTRACE_CABAC_T( "\tuiAbsPartIdx: " ); |
---|
803 | DTRACE_CABAC_V( uiAbsPartIdx ); |
---|
804 | DTRACE_CABAC_T( "\n" ); |
---|
805 | #endif |
---|
806 | } |
---|
807 | |
---|
808 | Void TDecSbac::parseMergeIndex ( TComDataCU* pcCU, UInt& ruiMergeIndex ) |
---|
809 | { |
---|
810 | UInt uiUnaryIdx = 0; |
---|
811 | UInt uiNumCand = pcCU->getSlice()->getMaxNumMergeCand(); |
---|
812 | if ( uiNumCand > 1 ) |
---|
813 | { |
---|
814 | for( ; uiUnaryIdx < uiNumCand - 1; ++uiUnaryIdx ) |
---|
815 | { |
---|
816 | UInt uiSymbol = 0; |
---|
817 | if ( uiUnaryIdx==0 ) |
---|
818 | { |
---|
819 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUMergeIdxExtSCModel.get( 0, 0, 0 ) ); |
---|
820 | } |
---|
821 | else |
---|
822 | { |
---|
823 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
824 | } |
---|
825 | if( uiSymbol == 0 ) |
---|
826 | { |
---|
827 | break; |
---|
828 | } |
---|
829 | } |
---|
830 | #if H_MV_ENC_DEC_TRAC |
---|
831 | DTRACE_PU("merge_idx", uiUnaryIdx) |
---|
832 | #endif |
---|
833 | } |
---|
834 | ruiMergeIndex = uiUnaryIdx; |
---|
835 | |
---|
836 | #if !H_MV_ENC_DEC_TRAC |
---|
837 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
838 | DTRACE_CABAC_T( "\tparseMergeIndex()" ) |
---|
839 | DTRACE_CABAC_T( "\tuiMRGIdx= " ) |
---|
840 | DTRACE_CABAC_V( ruiMergeIndex ) |
---|
841 | DTRACE_CABAC_T( "\n" ) |
---|
842 | #endif |
---|
843 | } |
---|
844 | |
---|
845 | Void TDecSbac::parseMVPIdx ( Int& riMVPIdx ) |
---|
846 | { |
---|
847 | UInt uiSymbol; |
---|
848 | xReadUnaryMaxSymbol(uiSymbol, m_cMVPIdxSCModel.get(0), 1, AMVP_MAX_NUM_CANDS-1); |
---|
849 | riMVPIdx = uiSymbol; |
---|
850 | } |
---|
851 | |
---|
852 | Void TDecSbac::parseSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
853 | { |
---|
854 | if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) |
---|
855 | { |
---|
856 | pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx ); |
---|
857 | return; |
---|
858 | } |
---|
859 | |
---|
860 | UInt uiSymbol; |
---|
861 | #if H_3D_QTLPC |
---|
862 | Bool bParseSplitFlag = true; |
---|
863 | |
---|
864 | TComSPS *sps = pcCU->getPic()->getSlice(0)->getSPS(); |
---|
865 | TComPic *pcTexture = pcCU->getSlice()->getTexturePic(); |
---|
866 | Bool bDepthMapDetect = (pcTexture != NULL); |
---|
867 | Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE); |
---|
868 | |
---|
869 | Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); |
---|
870 | |
---|
871 | if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL() && sps->getUsePC()) |
---|
872 | { |
---|
873 | TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr()); |
---|
874 | assert(pcTextureCU->getDepth(uiAbsPartIdx) >= uiDepth); |
---|
875 | bParseSplitFlag = (pcTextureCU->getDepth(uiAbsPartIdx) > uiDepth); |
---|
876 | } |
---|
877 | |
---|
878 | if(bParseSplitFlag) |
---|
879 | { |
---|
880 | #endif |
---|
881 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSplitFlagSCModel.get( 0, 0, pcCU->getCtxSplitFlag( uiAbsPartIdx, uiDepth ) ) ); |
---|
882 | #if H_MV_ENC_DEC_TRAC |
---|
883 | DTRACE_CU("split_cu_flag", uiSymbol); |
---|
884 | #else |
---|
885 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
886 | DTRACE_CABAC_T( "\tSplitFlag\n" ) |
---|
887 | #endif |
---|
888 | #if H_3D_QTLPC |
---|
889 | } |
---|
890 | else |
---|
891 | { |
---|
892 | uiSymbol = 0; |
---|
893 | } |
---|
894 | #endif |
---|
895 | pcCU->setDepthSubParts( uiDepth + uiSymbol, uiAbsPartIdx ); |
---|
896 | |
---|
897 | return; |
---|
898 | } |
---|
899 | |
---|
900 | /** parse partition size |
---|
901 | * \param pcCU |
---|
902 | * \param uiAbsPartIdx |
---|
903 | * \param uiDepth |
---|
904 | * \returns Void |
---|
905 | */ |
---|
906 | Void TDecSbac::parsePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
907 | { |
---|
908 | UInt uiSymbol, uiMode = 0; |
---|
909 | PartSize eMode; |
---|
910 | |
---|
911 | #if H_3D_QTLPC |
---|
912 | Bool bParsePartSize = true; |
---|
913 | TComSPS *sps = pcCU->getPic()->getSlice(0)->getSPS(); |
---|
914 | TComPic *pcTexture = pcCU->getSlice()->getTexturePic(); |
---|
915 | Bool bDepthMapDetect = (pcTexture != NULL); |
---|
916 | Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE); |
---|
917 | |
---|
918 | Bool rapPic = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA); |
---|
919 | |
---|
920 | if(bDepthMapDetect && !bIntraSliceDetect && !rapPic && sps->getUseQTL() && sps->getUsePC()) |
---|
921 | { |
---|
922 | TComDataCU *pcTextureCU = pcTexture->getCU(pcCU->getAddr()); |
---|
923 | assert(pcTextureCU->getDepth(uiAbsPartIdx) >= uiDepth); |
---|
924 | if (pcTextureCU->getDepth(uiAbsPartIdx) == uiDepth && pcTextureCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN) |
---|
925 | { |
---|
926 | bParsePartSize = false; |
---|
927 | eMode = SIZE_2Nx2N; |
---|
928 | } |
---|
929 | } |
---|
930 | #endif |
---|
931 | |
---|
932 | |
---|
933 | if ( pcCU->isIntra( uiAbsPartIdx ) ) |
---|
934 | { |
---|
935 | #if H_3D_QTLPC |
---|
936 | if(bParsePartSize) |
---|
937 | { |
---|
938 | #endif |
---|
939 | uiSymbol = 1; |
---|
940 | if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth ) |
---|
941 | { |
---|
942 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 0) ); |
---|
943 | #if H_MV_ENC_DEC_TRAC |
---|
944 | DTRACE_CU("part_mode", uiSymbol) |
---|
945 | #endif |
---|
946 | } |
---|
947 | eMode = uiSymbol ? SIZE_2Nx2N : SIZE_NxN; |
---|
948 | #if H_3D_QTLPC |
---|
949 | } |
---|
950 | #endif |
---|
951 | UInt uiTrLevel = 0; |
---|
952 | UInt uiWidthInBit = g_aucConvertToBit[pcCU->getWidth(uiAbsPartIdx)]+2; |
---|
953 | UInt uiTrSizeInBit = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxTrSize()]+2; |
---|
954 | uiTrLevel = uiWidthInBit >= uiTrSizeInBit ? uiWidthInBit - uiTrSizeInBit : 0; |
---|
955 | if( eMode == SIZE_NxN ) |
---|
956 | { |
---|
957 | pcCU->setTrIdxSubParts( 1+uiTrLevel, uiAbsPartIdx, uiDepth ); |
---|
958 | } |
---|
959 | else |
---|
960 | { |
---|
961 | pcCU->setTrIdxSubParts( uiTrLevel, uiAbsPartIdx, uiDepth ); |
---|
962 | } |
---|
963 | } |
---|
964 | else |
---|
965 | { |
---|
966 | #if H_3D_QTLPC |
---|
967 | if(bParsePartSize) |
---|
968 | { |
---|
969 | #endif |
---|
970 | UInt uiMaxNumBits = 2; |
---|
971 | if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( (g_uiMaxCUWidth>>uiDepth) == 8 && (g_uiMaxCUHeight>>uiDepth) == 8 ) ) |
---|
972 | { |
---|
973 | uiMaxNumBits ++; |
---|
974 | } |
---|
975 | for ( UInt ui = 0; ui < uiMaxNumBits; ui++ ) |
---|
976 | { |
---|
977 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) ); |
---|
978 | if ( uiSymbol ) |
---|
979 | { |
---|
980 | break; |
---|
981 | } |
---|
982 | uiMode++; |
---|
983 | } |
---|
984 | eMode = (PartSize) uiMode; |
---|
985 | if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) ) |
---|
986 | { |
---|
987 | if (eMode == SIZE_2NxN) |
---|
988 | { |
---|
989 | m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 )); |
---|
990 | if (uiSymbol == 0) |
---|
991 | { |
---|
992 | m_pcTDecBinIf->decodeBinEP(uiSymbol); |
---|
993 | eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD); |
---|
994 | } |
---|
995 | } |
---|
996 | else if (eMode == SIZE_Nx2N) |
---|
997 | { |
---|
998 | m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 )); |
---|
999 | if (uiSymbol == 0) |
---|
1000 | { |
---|
1001 | m_pcTDecBinIf->decodeBinEP(uiSymbol); |
---|
1002 | eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N); |
---|
1003 | } |
---|
1004 | } |
---|
1005 | } |
---|
1006 | #if H_MV_ENC_DEC_TRAC |
---|
1007 | DTRACE_CU("part_mode", eMode ) |
---|
1008 | #endif |
---|
1009 | #if H_3D_QTLPC |
---|
1010 | } |
---|
1011 | #endif |
---|
1012 | } |
---|
1013 | pcCU->setPartSizeSubParts( eMode, uiAbsPartIdx, uiDepth ); |
---|
1014 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
1015 | } |
---|
1016 | |
---|
1017 | /** parse prediction mode |
---|
1018 | * \param pcCU |
---|
1019 | * \param uiAbsPartIdx |
---|
1020 | * \param uiDepth |
---|
1021 | * \returns Void |
---|
1022 | */ |
---|
1023 | Void TDecSbac::parsePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1024 | { |
---|
1025 | if( pcCU->getSlice()->isIntra() ) |
---|
1026 | { |
---|
1027 | pcCU->setPredModeSubParts( MODE_INTRA, uiAbsPartIdx, uiDepth ); |
---|
1028 | return; |
---|
1029 | } |
---|
1030 | |
---|
1031 | UInt uiSymbol; |
---|
1032 | Int iPredMode = MODE_INTER; |
---|
1033 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPredModeSCModel.get( 0, 0, 0 ) ); |
---|
1034 | iPredMode += uiSymbol; |
---|
1035 | #if H_MV_ENC_DEC_TRAC |
---|
1036 | DTRACE_CU("pred_mode_flag", uiSymbol) |
---|
1037 | #endif |
---|
1038 | pcCU->setPredModeSubParts( (PredMode)iPredMode, uiAbsPartIdx, uiDepth ); |
---|
1039 | } |
---|
1040 | |
---|
1041 | Void TDecSbac::parseIntraDirLumaAng ( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) |
---|
1042 | { |
---|
1043 | PartSize mode = pcCU->getPartitionSize( absPartIdx ); |
---|
1044 | UInt partNum = mode==SIZE_NxN?4:1; |
---|
1045 | UInt partOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth(absPartIdx) << 1 ) ) >> 2; |
---|
1046 | UInt mpmPred[4],symbol; |
---|
1047 | Int j,intraPredMode; |
---|
1048 | if (mode==SIZE_NxN) |
---|
1049 | { |
---|
1050 | depth++; |
---|
1051 | } |
---|
1052 | for (j=0;j<partNum;j++) |
---|
1053 | { |
---|
1054 | #if H_3D_DIM |
---|
1055 | if( pcCU->getSlice()->getVpsDepthModesFlag() ) |
---|
1056 | { |
---|
1057 | parseIntraDepth( pcCU, absPartIdx+partOffset*j, depth ); |
---|
1058 | } |
---|
1059 | if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE ) |
---|
1060 | #if H_3D_DIM_SDC |
---|
1061 | if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) ) |
---|
1062 | #endif |
---|
1063 | { |
---|
1064 | #endif |
---|
1065 | m_pcTDecBinIf->decodeBin( symbol, m_cCUIntraPredSCModel.get( 0, 0, 0) ); |
---|
1066 | mpmPred[j] = symbol; |
---|
1067 | #if H_MV_ENC_DEC_TRAC |
---|
1068 | DTRACE_CU("prev_intra_luma_pred_flag", symbol) |
---|
1069 | #endif |
---|
1070 | #if H_3D_DIM |
---|
1071 | } |
---|
1072 | #endif |
---|
1073 | } |
---|
1074 | for (j=0;j<partNum;j++) |
---|
1075 | { |
---|
1076 | #if H_3D_DIM |
---|
1077 | if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE ) |
---|
1078 | #if H_3D_DIM_SDC |
---|
1079 | if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) ) |
---|
1080 | #endif |
---|
1081 | { |
---|
1082 | #endif |
---|
1083 | Int preds[3] = {-1, -1, -1}; |
---|
1084 | Int predNum = pcCU->getIntraDirLumaPredictor(absPartIdx+partOffset*j, preds); |
---|
1085 | if (mpmPred[j]) |
---|
1086 | { |
---|
1087 | m_pcTDecBinIf->decodeBinEP( symbol ); |
---|
1088 | if (symbol) |
---|
1089 | { |
---|
1090 | m_pcTDecBinIf->decodeBinEP( symbol ); |
---|
1091 | symbol++; |
---|
1092 | } |
---|
1093 | #if H_MV_ENC_DEC_TRAC |
---|
1094 | DTRACE_CU("mpm_idx", symbol) |
---|
1095 | #endif |
---|
1096 | intraPredMode = preds[symbol]; |
---|
1097 | } |
---|
1098 | else |
---|
1099 | { |
---|
1100 | m_pcTDecBinIf->decodeBinsEP( symbol, 5 ); |
---|
1101 | intraPredMode = symbol; |
---|
1102 | #if H_MV_ENC_DEC_TRAC |
---|
1103 | DTRACE_CU("rem_intra_luma_pred_mode", symbol) |
---|
1104 | #endif |
---|
1105 | //postponed sorting of MPMs (only in remaining branch) |
---|
1106 | if (preds[0] > preds[1]) |
---|
1107 | { |
---|
1108 | std::swap(preds[0], preds[1]); |
---|
1109 | } |
---|
1110 | if (preds[0] > preds[2]) |
---|
1111 | { |
---|
1112 | std::swap(preds[0], preds[2]); |
---|
1113 | } |
---|
1114 | if (preds[1] > preds[2]) |
---|
1115 | { |
---|
1116 | std::swap(preds[1], preds[2]); |
---|
1117 | } |
---|
1118 | for ( Int i = 0; i < predNum; i++ ) |
---|
1119 | { |
---|
1120 | intraPredMode += ( intraPredMode >= preds[i] ); |
---|
1121 | } |
---|
1122 | } |
---|
1123 | pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, absPartIdx+partOffset*j, depth ); |
---|
1124 | #if H_3D_DIM |
---|
1125 | } |
---|
1126 | #endif |
---|
1127 | } |
---|
1128 | } |
---|
1129 | |
---|
1130 | Void TDecSbac::parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1131 | { |
---|
1132 | UInt uiSymbol; |
---|
1133 | |
---|
1134 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUChromaPredSCModel.get( 0, 0, 0 ) ); |
---|
1135 | |
---|
1136 | if( uiSymbol == 0 ) |
---|
1137 | { |
---|
1138 | #if H_MV_ENC_DEC_TRAC |
---|
1139 | DTRACE_CU("intra_chroma_pred_mode", uiSymbol ) |
---|
1140 | #endif |
---|
1141 | uiSymbol = DM_CHROMA_IDX; |
---|
1142 | } |
---|
1143 | else |
---|
1144 | { |
---|
1145 | { |
---|
1146 | UInt uiIPredMode; |
---|
1147 | m_pcTDecBinIf->decodeBinsEP( uiIPredMode, 2 ); |
---|
1148 | #if H_MV_ENC_DEC_TRAC |
---|
1149 | DTRACE_CU("intra_chroma_pred_mode", uiIPredMode ) |
---|
1150 | #endif |
---|
1151 | UInt uiAllowedChromaDir[ NUM_CHROMA_MODE ]; |
---|
1152 | pcCU->getAllowedChromaDir( uiAbsPartIdx, uiAllowedChromaDir ); |
---|
1153 | uiSymbol = uiAllowedChromaDir[ uiIPredMode ]; |
---|
1154 | } |
---|
1155 | } |
---|
1156 | pcCU->setChromIntraDirSubParts( uiSymbol, uiAbsPartIdx, uiDepth ); |
---|
1157 | return; |
---|
1158 | } |
---|
1159 | |
---|
1160 | #if H_3D_DIM |
---|
1161 | Void TDecSbac::parseIntraDepth( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) |
---|
1162 | { |
---|
1163 | parseIntraDepthMode( pcCU, absPartIdx, depth ); |
---|
1164 | |
---|
1165 | UInt dir = pcCU->getLumaIntraDir( absPartIdx ); |
---|
1166 | UInt dimType = getDimType( dir ); |
---|
1167 | |
---|
1168 | switch( dimType ) |
---|
1169 | { |
---|
1170 | #if H_3D_DIM_DMM |
---|
1171 | case( DMM1_IDX ): |
---|
1172 | { |
---|
1173 | UInt uiTabIdx = 0; |
---|
1174 | xParseDmm1WedgeIdx( uiTabIdx, g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] ); |
---|
1175 | pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, absPartIdx, depth ); |
---|
1176 | } break; |
---|
1177 | #if !SEC_DMM2_E0146_HHIFIX |
---|
1178 | case( DMM2_IDX ): |
---|
1179 | { |
---|
1180 | Int iOffset = 0; |
---|
1181 | xParseDmm2Offset( iOffset ); |
---|
1182 | pcCU->setDmm2DeltaEndSubParts( iOffset, absPartIdx, depth ); |
---|
1183 | } break; |
---|
1184 | #endif |
---|
1185 | case( DMM3_IDX ): |
---|
1186 | { |
---|
1187 | UInt uiIntraIdx = 0; |
---|
1188 | xParseDmm3WedgeIdx( uiIntraIdx, g_dmm3IntraTabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] ); |
---|
1189 | pcCU->setDmm3IntraTabIdxSubParts( uiIntraIdx, absPartIdx, depth ); |
---|
1190 | } break; |
---|
1191 | case( DMM4_IDX ): break; |
---|
1192 | #endif |
---|
1193 | #if H_3D_DIM_RBC |
---|
1194 | case( RBC_IDX ): |
---|
1195 | { |
---|
1196 | xParseRbcEdge( pcCU, absPartIdx, depth ); |
---|
1197 | } break; |
---|
1198 | #endif |
---|
1199 | default: break; |
---|
1200 | } |
---|
1201 | |
---|
1202 | #if H_3D_DIM_SDC |
---|
1203 | if( pcCU->getSDCFlag(absPartIdx) ) |
---|
1204 | { |
---|
1205 | assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N); |
---|
1206 | pcCU->setTrIdxSubParts(0, absPartIdx, depth); |
---|
1207 | pcCU->setCbfSubParts(1, 1, 1, absPartIdx, depth); |
---|
1208 | |
---|
1209 | UInt uiNumSegments = ( dir == DC_IDX || dir == PLANAR_IDX )? 1 : 2; |
---|
1210 | for (UInt uiSeg=0; uiSeg<uiNumSegments; uiSeg++) |
---|
1211 | { |
---|
1212 | xParseSDCResidualData(pcCU, absPartIdx, depth, uiSeg); |
---|
1213 | } |
---|
1214 | } |
---|
1215 | else |
---|
1216 | { |
---|
1217 | #endif |
---|
1218 | if( dimType < DIM_NUM_TYPE ) |
---|
1219 | { |
---|
1220 | UInt symbol; |
---|
1221 | m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) ); |
---|
1222 | if( symbol ) |
---|
1223 | { |
---|
1224 | dir += symbol; |
---|
1225 | for( UInt segment = 0; segment < 2; segment++ ) |
---|
1226 | { |
---|
1227 | Pel valDeltaDC = 0; |
---|
1228 | xParseDimDeltaDC( valDeltaDC, dimType ); |
---|
1229 | pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC ); |
---|
1230 | } |
---|
1231 | } |
---|
1232 | } |
---|
1233 | #if H_3D_DIM_SDC |
---|
1234 | } |
---|
1235 | #endif |
---|
1236 | |
---|
1237 | pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth ); |
---|
1238 | } |
---|
1239 | |
---|
1240 | Void TDecSbac::parseIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx, UInt depth ) |
---|
1241 | { |
---|
1242 | UInt puIdx = (pcCU->getWidth(absPartIdx) == 64) ? 2 : ( (pcCU->getPartitionSize(absPartIdx) == SIZE_NxN && pcCU->getWidth(absPartIdx) == 8) ? 0 : 1 ); |
---|
1243 | UInt dir = 0; |
---|
1244 | Bool sdcFlag = 0; |
---|
1245 | UInt symbol = 1; |
---|
1246 | UInt modeCode = 0 ; |
---|
1247 | UInt binNum = 0; |
---|
1248 | UInt ctxDepthMode = 0; |
---|
1249 | |
---|
1250 | if( puIdx == 2 ) |
---|
1251 | { |
---|
1252 | #if !LGE_SDC_REMOVE_DC_E0158 |
---|
1253 | while( binNum < 2 && symbol ) |
---|
1254 | #endif |
---|
1255 | { |
---|
1256 | ctxDepthMode = puIdx*3 + binNum; |
---|
1257 | m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); |
---|
1258 | modeCode = (modeCode<<1) + symbol; |
---|
1259 | binNum++; |
---|
1260 | } |
---|
1261 | if( modeCode == 0 ) { dir = PLANAR_IDX; sdcFlag = 1;} |
---|
1262 | #if LGE_SDC_REMOVE_DC_E0158 |
---|
1263 | else if( modeCode == 1 ) { dir = 0; sdcFlag = 0;} |
---|
1264 | #else |
---|
1265 | else if( modeCode == 2 ) { dir = 0; sdcFlag = 0;} |
---|
1266 | else if( modeCode == 3 ) { dir = DC_IDX; sdcFlag = 1;} |
---|
1267 | #endif |
---|
1268 | } |
---|
1269 | else if( puIdx == 0 ) |
---|
1270 | { |
---|
1271 | while( binNum < 3 && symbol ) |
---|
1272 | { |
---|
1273 | ctxDepthMode = puIdx*3 + ((binNum >= 2) ? 2 : binNum); |
---|
1274 | m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); |
---|
1275 | modeCode = (modeCode<<1) + symbol; |
---|
1276 | binNum++; |
---|
1277 | } |
---|
1278 | if( modeCode == 0 ) { dir = 0; sdcFlag = 0;} |
---|
1279 | else if( modeCode == 2 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1280 | else if( modeCode == 6 ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1281 | else if( modeCode == 7 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1282 | } |
---|
1283 | else |
---|
1284 | { |
---|
1285 | #if ZJU_DEPTH_INTRA_MODE_E0204 |
---|
1286 | UInt maxBinNum = 0; |
---|
1287 | m_pcTDecBinIf->decodeBinEP(symbol); |
---|
1288 | if( symbol == 1 ) |
---|
1289 | { |
---|
1290 | maxBinNum = 3; |
---|
1291 | } |
---|
1292 | else |
---|
1293 | { |
---|
1294 | maxBinNum = 2; |
---|
1295 | symbol = 1; |
---|
1296 | } |
---|
1297 | while( binNum<maxBinNum && symbol ) |
---|
1298 | { |
---|
1299 | ctxDepthMode = puIdx*3 + ( binNum >= 2 ? 2 : binNum ); |
---|
1300 | m_pcTDecBinIf->decodeBin(symbol,m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode)); |
---|
1301 | modeCode = (modeCode<<1)+symbol; |
---|
1302 | binNum++; |
---|
1303 | } |
---|
1304 | if( maxBinNum == 3 ) |
---|
1305 | { |
---|
1306 | if ( modeCode == 0 ) { dir = PLANAR_IDX; sdcFlag = 1;} |
---|
1307 | else if ( modeCode == 2 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1308 | else if ( modeCode == 6 ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1309 | else if ( modeCode == 7 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1310 | } |
---|
1311 | else |
---|
1312 | { |
---|
1313 | if ( modeCode == 0 ) { dir = 5; sdcFlag = 0;} |
---|
1314 | else if ( modeCode == 2 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 1;} |
---|
1315 | else if ( modeCode == 3 ) { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1316 | } |
---|
1317 | #else |
---|
1318 | ctxDepthMode = puIdx*3 ; |
---|
1319 | m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); |
---|
1320 | modeCode = (modeCode<<1) + symbol; |
---|
1321 | if( !symbol ) |
---|
1322 | { |
---|
1323 | ctxDepthMode = puIdx*3 + 1; |
---|
1324 | m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); |
---|
1325 | modeCode = (modeCode<<1) + symbol; |
---|
1326 | if( symbol ) |
---|
1327 | { |
---|
1328 | ctxDepthMode = puIdx*3 + 2; |
---|
1329 | m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); |
---|
1330 | modeCode = (modeCode<<1) + symbol; |
---|
1331 | } |
---|
1332 | } |
---|
1333 | else |
---|
1334 | { |
---|
1335 | ctxDepthMode = puIdx*3 + 1; |
---|
1336 | m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); |
---|
1337 | modeCode = (modeCode<<1) + symbol; |
---|
1338 | if( !symbol ) |
---|
1339 | { |
---|
1340 | ctxDepthMode = puIdx*3 + 2; |
---|
1341 | m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); |
---|
1342 | modeCode = (modeCode<<1) + symbol; |
---|
1343 | } |
---|
1344 | else |
---|
1345 | { |
---|
1346 | binNum = 0; |
---|
1347 | #if LGE_SDC_REMOVE_DC_E0158 |
---|
1348 | #if !SEC_DMM2_E0146_HHIFIX |
---|
1349 | while( symbol && binNum < 2 ) |
---|
1350 | #endif |
---|
1351 | #else |
---|
1352 | #if SEC_DMM2_E0146_HHIFIX |
---|
1353 | while( symbol && binNum < 2 ) |
---|
1354 | #else |
---|
1355 | while( symbol && binNum < 3 ) |
---|
1356 | #endif |
---|
1357 | #endif |
---|
1358 | { |
---|
1359 | ctxDepthMode = puIdx*3 + 2; |
---|
1360 | m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) ); |
---|
1361 | modeCode = (modeCode<<1) + symbol; |
---|
1362 | binNum++; |
---|
1363 | } |
---|
1364 | } |
---|
1365 | } |
---|
1366 | if( modeCode == 0 ) { dir = PLANAR_IDX; sdcFlag = 1;} |
---|
1367 | else if( modeCode == 2 ) { dir = 5; sdcFlag = 0;} |
---|
1368 | else if( modeCode == 3 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 1;} |
---|
1369 | else if( modeCode == 4 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1370 | else if( modeCode == 5 ) { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1371 | else if( modeCode == 6 ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1372 | #if LGE_SDC_REMOVE_DC_E0158 |
---|
1373 | #if SEC_DMM2_E0146_HHIFIX |
---|
1374 | else if( modeCode == 7 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1375 | #else |
---|
1376 | else if( modeCode == 14 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1377 | else if( modeCode == 15 ) { dir = (2*DMM2_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1378 | #endif |
---|
1379 | #else |
---|
1380 | else if( modeCode == 14 ) { dir = DC_IDX; sdcFlag = 1;} |
---|
1381 | #if SEC_DMM2_E0146_HHIFIX |
---|
1382 | else if( modeCode == 15 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1383 | #else |
---|
1384 | else if( modeCode == 30 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1385 | else if( modeCode == 31 ) { dir = (2*DMM2_IDX+DIM_OFFSET); sdcFlag = 0;} |
---|
1386 | #endif |
---|
1387 | #endif |
---|
1388 | #endif |
---|
1389 | } |
---|
1390 | pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth ); |
---|
1391 | #if H_3D_DIM_SDC |
---|
1392 | pcCU->setSDCFlagSubParts( sdcFlag, absPartIdx, depth ); |
---|
1393 | #endif |
---|
1394 | } |
---|
1395 | #endif |
---|
1396 | |
---|
1397 | Void TDecSbac::parseInterDir( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx ) |
---|
1398 | { |
---|
1399 | UInt uiSymbol; |
---|
1400 | const UInt uiCtx = pcCU->getCtxInterDir( uiAbsPartIdx ); |
---|
1401 | ContextModel *pCtx = m_cCUInterDirSCModel.get( 0 ); |
---|
1402 | uiSymbol = 0; |
---|
1403 | if (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N || pcCU->getHeight(uiAbsPartIdx) != 8 ) |
---|
1404 | { |
---|
1405 | m_pcTDecBinIf->decodeBin( uiSymbol, *( pCtx + uiCtx ) ); |
---|
1406 | } |
---|
1407 | |
---|
1408 | if( uiSymbol ) |
---|
1409 | { |
---|
1410 | uiSymbol = 2; |
---|
1411 | } |
---|
1412 | else |
---|
1413 | { |
---|
1414 | m_pcTDecBinIf->decodeBin( uiSymbol, *( pCtx + 4 ) ); |
---|
1415 | assert(uiSymbol == 0 || uiSymbol == 1); |
---|
1416 | } |
---|
1417 | |
---|
1418 | uiSymbol++; |
---|
1419 | ruiInterDir = uiSymbol; |
---|
1420 | #if H_MV_ENC_DEC_TRAC |
---|
1421 | DTRACE_PU("inter_pred_idc", ruiInterDir - 1 ) |
---|
1422 | #endif |
---|
1423 | |
---|
1424 | return; |
---|
1425 | } |
---|
1426 | |
---|
1427 | Void TDecSbac::parseRefFrmIdx( TComDataCU* pcCU, Int& riRefFrmIdx, RefPicList eRefList ) |
---|
1428 | { |
---|
1429 | UInt uiSymbol; |
---|
1430 | { |
---|
1431 | ContextModel *pCtx = m_cCURefPicSCModel.get( 0 ); |
---|
1432 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
1433 | |
---|
1434 | if( uiSymbol ) |
---|
1435 | { |
---|
1436 | UInt uiRefNum = pcCU->getSlice()->getNumRefIdx( eRefList ) - 2; |
---|
1437 | pCtx++; |
---|
1438 | UInt ui; |
---|
1439 | for( ui = 0; ui < uiRefNum; ++ui ) |
---|
1440 | { |
---|
1441 | if( ui == 0 ) |
---|
1442 | { |
---|
1443 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
1444 | } |
---|
1445 | else |
---|
1446 | { |
---|
1447 | m_pcTDecBinIf->decodeBinEP( uiSymbol ); |
---|
1448 | } |
---|
1449 | if( uiSymbol == 0 ) |
---|
1450 | { |
---|
1451 | break; |
---|
1452 | } |
---|
1453 | } |
---|
1454 | uiSymbol = ui + 1; |
---|
1455 | } |
---|
1456 | riRefFrmIdx = uiSymbol; |
---|
1457 | } |
---|
1458 | |
---|
1459 | #if H_MV_ENC_DEC_TRAC |
---|
1460 | #if ENC_DEC_TRACE |
---|
1461 | if ( eRefList == REF_PIC_LIST_0 ) |
---|
1462 | { |
---|
1463 | DTRACE_PU("ref_idx_l0", uiSymbol) |
---|
1464 | } |
---|
1465 | else |
---|
1466 | { |
---|
1467 | DTRACE_PU("ref_idx_l1", uiSymbol) |
---|
1468 | } |
---|
1469 | #endif |
---|
1470 | #endif |
---|
1471 | return; |
---|
1472 | } |
---|
1473 | |
---|
1474 | Void TDecSbac::parseMvd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth, RefPicList eRefList ) |
---|
1475 | { |
---|
1476 | UInt uiSymbol; |
---|
1477 | UInt uiHorAbs; |
---|
1478 | UInt uiVerAbs; |
---|
1479 | UInt uiHorSign = 0; |
---|
1480 | UInt uiVerSign = 0; |
---|
1481 | ContextModel *pCtx = m_cCUMvdSCModel.get( 0 ); |
---|
1482 | |
---|
1483 | if(pcCU->getSlice()->getMvdL1ZeroFlag() && eRefList == REF_PIC_LIST_1 && pcCU->getInterDir(uiAbsPartIdx)==3) |
---|
1484 | { |
---|
1485 | uiHorAbs=0; |
---|
1486 | uiVerAbs=0; |
---|
1487 | } |
---|
1488 | else |
---|
1489 | { |
---|
1490 | m_pcTDecBinIf->decodeBin( uiHorAbs, *pCtx ); |
---|
1491 | m_pcTDecBinIf->decodeBin( uiVerAbs, *pCtx ); |
---|
1492 | |
---|
1493 | const Bool bHorAbsGr0 = uiHorAbs != 0; |
---|
1494 | const Bool bVerAbsGr0 = uiVerAbs != 0; |
---|
1495 | pCtx++; |
---|
1496 | |
---|
1497 | if( bHorAbsGr0 ) |
---|
1498 | { |
---|
1499 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
1500 | uiHorAbs += uiSymbol; |
---|
1501 | } |
---|
1502 | |
---|
1503 | if( bVerAbsGr0 ) |
---|
1504 | { |
---|
1505 | m_pcTDecBinIf->decodeBin( uiSymbol, *pCtx ); |
---|
1506 | uiVerAbs += uiSymbol; |
---|
1507 | } |
---|
1508 | |
---|
1509 | if( bHorAbsGr0 ) |
---|
1510 | { |
---|
1511 | if( 2 == uiHorAbs ) |
---|
1512 | { |
---|
1513 | xReadEpExGolomb( uiSymbol, 1 ); |
---|
1514 | uiHorAbs += uiSymbol; |
---|
1515 | } |
---|
1516 | |
---|
1517 | m_pcTDecBinIf->decodeBinEP( uiHorSign ); |
---|
1518 | } |
---|
1519 | |
---|
1520 | if( bVerAbsGr0 ) |
---|
1521 | { |
---|
1522 | if( 2 == uiVerAbs ) |
---|
1523 | { |
---|
1524 | xReadEpExGolomb( uiSymbol, 1 ); |
---|
1525 | uiVerAbs += uiSymbol; |
---|
1526 | } |
---|
1527 | |
---|
1528 | m_pcTDecBinIf->decodeBinEP( uiVerSign ); |
---|
1529 | } |
---|
1530 | |
---|
1531 | } |
---|
1532 | |
---|
1533 | const TComMv cMv( uiHorSign ? -Int( uiHorAbs ): uiHorAbs, uiVerSign ? -Int( uiVerAbs ) : uiVerAbs ); |
---|
1534 | pcCU->getCUMvField( eRefList )->setAllMvd( cMv, pcCU->getPartitionSize( uiAbsPartIdx ), uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
1535 | return; |
---|
1536 | } |
---|
1537 | |
---|
1538 | |
---|
1539 | Void TDecSbac::parseTransformSubdivFlag( UInt& ruiSubdivFlag, UInt uiLog2TransformBlockSize ) |
---|
1540 | { |
---|
1541 | m_pcTDecBinIf->decodeBin( ruiSubdivFlag, m_cCUTransSubdivFlagSCModel.get( 0, 0, uiLog2TransformBlockSize ) ); |
---|
1542 | #if !H_MV_ENC_DEC_TRAC |
---|
1543 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
1544 | DTRACE_CABAC_T( "\tparseTransformSubdivFlag()" ) |
---|
1545 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
1546 | DTRACE_CABAC_V( ruiSubdivFlag ) |
---|
1547 | DTRACE_CABAC_T( "\tctx=" ) |
---|
1548 | DTRACE_CABAC_V( uiLog2TransformBlockSize ) |
---|
1549 | DTRACE_CABAC_T( "\n" ) |
---|
1550 | #endif |
---|
1551 | } |
---|
1552 | |
---|
1553 | Void TDecSbac::parseQtRootCbf( UInt uiAbsPartIdx, UInt& uiQtRootCbf ) |
---|
1554 | { |
---|
1555 | UInt uiSymbol; |
---|
1556 | const UInt uiCtx = 0; |
---|
1557 | m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtRootCbfSCModel.get( 0, 0, uiCtx ) ); |
---|
1558 | #if !H_MV_ENC_DEC_TRAC |
---|
1559 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
1560 | DTRACE_CABAC_T( "\tparseQtRootCbf()" ) |
---|
1561 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
1562 | DTRACE_CABAC_V( uiSymbol ) |
---|
1563 | DTRACE_CABAC_T( "\tctx=" ) |
---|
1564 | DTRACE_CABAC_V( uiCtx ) |
---|
1565 | DTRACE_CABAC_T( "\tuiAbsPartIdx=" ) |
---|
1566 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
1567 | DTRACE_CABAC_T( "\n" ) |
---|
1568 | #else |
---|
1569 | DTRACE_CU( "rqt_root_cbf", uiSymbol ) |
---|
1570 | #endif |
---|
1571 | |
---|
1572 | uiQtRootCbf = uiSymbol; |
---|
1573 | } |
---|
1574 | |
---|
1575 | Void TDecSbac::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1576 | { |
---|
1577 | Int qp; |
---|
1578 | UInt uiDQp; |
---|
1579 | Int iDQp; |
---|
1580 | |
---|
1581 | UInt uiSymbol; |
---|
1582 | |
---|
1583 | xReadUnaryMaxSymbol (uiDQp, &m_cCUDeltaQpSCModel.get( 0, 0, 0 ), 1, CU_DQP_TU_CMAX); |
---|
1584 | |
---|
1585 | if( uiDQp >= CU_DQP_TU_CMAX) |
---|
1586 | { |
---|
1587 | xReadEpExGolomb( uiSymbol, CU_DQP_EG_k ); |
---|
1588 | uiDQp+=uiSymbol; |
---|
1589 | } |
---|
1590 | |
---|
1591 | if ( uiDQp > 0 ) |
---|
1592 | { |
---|
1593 | UInt uiSign; |
---|
1594 | Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY(); |
---|
1595 | m_pcTDecBinIf->decodeBinEP(uiSign); |
---|
1596 | iDQp = uiDQp; |
---|
1597 | if(uiSign) |
---|
1598 | { |
---|
1599 | iDQp = -iDQp; |
---|
1600 | } |
---|
1601 | qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+qpBdOffsetY)) - qpBdOffsetY; |
---|
1602 | } |
---|
1603 | else |
---|
1604 | { |
---|
1605 | qp = pcCU->getRefQP(uiAbsPartIdx); |
---|
1606 | } |
---|
1607 | pcCU->setQPSubParts(qp, uiAbsPartIdx, uiDepth); |
---|
1608 | pcCU->setCodedQP(qp); |
---|
1609 | } |
---|
1610 | |
---|
1611 | Void TDecSbac::parseQtCbf( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiDepth ) |
---|
1612 | { |
---|
1613 | UInt uiSymbol; |
---|
1614 | const UInt uiCtx = pcCU->getCtxQtCbf( eType, uiTrDepth ); |
---|
1615 | m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtCbfSCModel.get( 0, eType ? TEXT_CHROMA: eType, uiCtx ) ); |
---|
1616 | #if !H_MV_ENC_DEC_TRAC |
---|
1617 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
1618 | DTRACE_CABAC_T( "\tparseQtCbf()" ) |
---|
1619 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
1620 | DTRACE_CABAC_V( uiSymbol ) |
---|
1621 | DTRACE_CABAC_T( "\tctx=" ) |
---|
1622 | DTRACE_CABAC_V( uiCtx ) |
---|
1623 | DTRACE_CABAC_T( "\tetype=" ) |
---|
1624 | DTRACE_CABAC_V( eType ) |
---|
1625 | DTRACE_CABAC_T( "\tuiAbsPartIdx=" ) |
---|
1626 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
1627 | DTRACE_CABAC_T( "\n" ) |
---|
1628 | #endif |
---|
1629 | |
---|
1630 | pcCU->setCbfSubParts( uiSymbol << uiTrDepth, eType, uiAbsPartIdx, uiDepth ); |
---|
1631 | } |
---|
1632 | |
---|
1633 | void TDecSbac::parseTransformSkipFlags (TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, UInt uiDepth, TextType eTType) |
---|
1634 | { |
---|
1635 | if (pcCU->getCUTransquantBypass(uiAbsPartIdx)) |
---|
1636 | { |
---|
1637 | return; |
---|
1638 | } |
---|
1639 | if(width != 4 || height != 4) |
---|
1640 | { |
---|
1641 | return; |
---|
1642 | } |
---|
1643 | |
---|
1644 | UInt useTransformSkip; |
---|
1645 | m_pcTDecBinIf->decodeBin( useTransformSkip , m_cTransformSkipSCModel.get( 0, eTType? TEXT_CHROMA: TEXT_LUMA, 0 ) ); |
---|
1646 | if(eTType!= TEXT_LUMA) |
---|
1647 | { |
---|
1648 | const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()] + 2 - uiDepth; |
---|
1649 | if(uiLog2TrafoSize == 2) |
---|
1650 | { |
---|
1651 | uiDepth --; |
---|
1652 | } |
---|
1653 | } |
---|
1654 | #if !H_MV_ENC_DEC_TRAC |
---|
1655 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
1656 | DTRACE_CABAC_T("\tparseTransformSkip()"); |
---|
1657 | DTRACE_CABAC_T( "\tsymbol=" ) |
---|
1658 | DTRACE_CABAC_V( useTransformSkip ) |
---|
1659 | DTRACE_CABAC_T( "\tAddr=" ) |
---|
1660 | DTRACE_CABAC_V( pcCU->getAddr() ) |
---|
1661 | DTRACE_CABAC_T( "\tetype=" ) |
---|
1662 | DTRACE_CABAC_V( eTType ) |
---|
1663 | DTRACE_CABAC_T( "\tuiAbsPartIdx=" ) |
---|
1664 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
1665 | DTRACE_CABAC_T( "\n" ) |
---|
1666 | #endif |
---|
1667 | |
---|
1668 | pcCU->setTransformSkipSubParts( useTransformSkip, eTType, uiAbsPartIdx, uiDepth); |
---|
1669 | } |
---|
1670 | |
---|
1671 | /** Parse (X,Y) position of the last significant coefficient |
---|
1672 | * \param uiPosLastX reference to X component of last coefficient |
---|
1673 | * \param uiPosLastY reference to Y component of last coefficient |
---|
1674 | * \param width Block width |
---|
1675 | * \param height Block height |
---|
1676 | * \param eTType plane type / luminance or chrominance |
---|
1677 | * \param uiScanIdx scan type (zig-zag, hor, ver) |
---|
1678 | * |
---|
1679 | * This method decodes the X and Y component within a block of the last significant coefficient. |
---|
1680 | */ |
---|
1681 | Void TDecSbac::parseLastSignificantXY( UInt& uiPosLastX, UInt& uiPosLastY, Int width, Int height, TextType eTType, UInt uiScanIdx ) |
---|
1682 | { |
---|
1683 | UInt uiLast; |
---|
1684 | ContextModel *pCtxX = m_cCuCtxLastX.get( 0, eTType ); |
---|
1685 | ContextModel *pCtxY = m_cCuCtxLastY.get( 0, eTType ); |
---|
1686 | |
---|
1687 | Int blkSizeOffsetX, blkSizeOffsetY, shiftX, shiftY; |
---|
1688 | blkSizeOffsetX = eTType ? 0: (g_aucConvertToBit[ width ] *3 + ((g_aucConvertToBit[ width ] +1)>>2)); |
---|
1689 | blkSizeOffsetY = eTType ? 0: (g_aucConvertToBit[ height ]*3 + ((g_aucConvertToBit[ height ]+1)>>2)); |
---|
1690 | shiftX= eTType ? g_aucConvertToBit[ width ] :((g_aucConvertToBit[ width ]+3)>>2); |
---|
1691 | shiftY= eTType ? g_aucConvertToBit[ height ] :((g_aucConvertToBit[ height ]+3)>>2); |
---|
1692 | // posX |
---|
1693 | for( uiPosLastX = 0; uiPosLastX < g_uiGroupIdx[ width - 1 ]; uiPosLastX++ ) |
---|
1694 | { |
---|
1695 | m_pcTDecBinIf->decodeBin( uiLast, *( pCtxX + blkSizeOffsetX + (uiPosLastX >>shiftX) ) ); |
---|
1696 | if( !uiLast ) |
---|
1697 | { |
---|
1698 | break; |
---|
1699 | } |
---|
1700 | } |
---|
1701 | |
---|
1702 | // posY |
---|
1703 | for( uiPosLastY = 0; uiPosLastY < g_uiGroupIdx[ height - 1 ]; uiPosLastY++ ) |
---|
1704 | { |
---|
1705 | m_pcTDecBinIf->decodeBin( uiLast, *( pCtxY + blkSizeOffsetY + (uiPosLastY >>shiftY)) ); |
---|
1706 | if( !uiLast ) |
---|
1707 | { |
---|
1708 | break; |
---|
1709 | } |
---|
1710 | } |
---|
1711 | if ( uiPosLastX > 3 ) |
---|
1712 | { |
---|
1713 | UInt uiTemp = 0; |
---|
1714 | UInt uiCount = ( uiPosLastX - 2 ) >> 1; |
---|
1715 | for ( Int i = uiCount - 1; i >= 0; i-- ) |
---|
1716 | { |
---|
1717 | m_pcTDecBinIf->decodeBinEP( uiLast ); |
---|
1718 | uiTemp += uiLast << i; |
---|
1719 | } |
---|
1720 | uiPosLastX = g_uiMinInGroup[ uiPosLastX ] + uiTemp; |
---|
1721 | } |
---|
1722 | if ( uiPosLastY > 3 ) |
---|
1723 | { |
---|
1724 | UInt uiTemp = 0; |
---|
1725 | UInt uiCount = ( uiPosLastY - 2 ) >> 1; |
---|
1726 | for ( Int i = uiCount - 1; i >= 0; i-- ) |
---|
1727 | { |
---|
1728 | m_pcTDecBinIf->decodeBinEP( uiLast ); |
---|
1729 | uiTemp += uiLast << i; |
---|
1730 | } |
---|
1731 | uiPosLastY = g_uiMinInGroup[ uiPosLastY ] + uiTemp; |
---|
1732 | } |
---|
1733 | |
---|
1734 | if( uiScanIdx == SCAN_VER ) |
---|
1735 | { |
---|
1736 | swap( uiPosLastX, uiPosLastY ); |
---|
1737 | } |
---|
1738 | } |
---|
1739 | |
---|
1740 | Void TDecSbac::parseCoeffNxN( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ) |
---|
1741 | { |
---|
1742 | #if !H_MV_ENC_DEC_TRAC |
---|
1743 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
1744 | DTRACE_CABAC_T( "\tparseCoeffNxN()\teType=" ) |
---|
1745 | DTRACE_CABAC_V( eTType ) |
---|
1746 | DTRACE_CABAC_T( "\twidth=" ) |
---|
1747 | DTRACE_CABAC_V( uiWidth ) |
---|
1748 | DTRACE_CABAC_T( "\theight=" ) |
---|
1749 | DTRACE_CABAC_V( uiHeight ) |
---|
1750 | DTRACE_CABAC_T( "\tdepth=" ) |
---|
1751 | DTRACE_CABAC_V( uiDepth ) |
---|
1752 | DTRACE_CABAC_T( "\tabspartidx=" ) |
---|
1753 | DTRACE_CABAC_V( uiAbsPartIdx ) |
---|
1754 | DTRACE_CABAC_T( "\ttoCU-X=" ) |
---|
1755 | DTRACE_CABAC_V( pcCU->getCUPelX() ) |
---|
1756 | DTRACE_CABAC_T( "\ttoCU-Y=" ) |
---|
1757 | DTRACE_CABAC_V( pcCU->getCUPelY() ) |
---|
1758 | DTRACE_CABAC_T( "\tCU-addr=" ) |
---|
1759 | DTRACE_CABAC_V( pcCU->getAddr() ) |
---|
1760 | DTRACE_CABAC_T( "\tinCU-X=" ) |
---|
1761 | DTRACE_CABAC_V( g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ] ) |
---|
1762 | DTRACE_CABAC_T( "\tinCU-Y=" ) |
---|
1763 | DTRACE_CABAC_V( g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ] ) |
---|
1764 | DTRACE_CABAC_T( "\tpredmode=" ) |
---|
1765 | DTRACE_CABAC_V( pcCU->getPredictionMode( uiAbsPartIdx ) ) |
---|
1766 | DTRACE_CABAC_T( "\n" ) |
---|
1767 | #endif |
---|
1768 | |
---|
1769 | if( uiWidth > pcCU->getSlice()->getSPS()->getMaxTrSize() ) |
---|
1770 | { |
---|
1771 | uiWidth = pcCU->getSlice()->getSPS()->getMaxTrSize(); |
---|
1772 | uiHeight = pcCU->getSlice()->getSPS()->getMaxTrSize(); |
---|
1773 | } |
---|
1774 | if(pcCU->getSlice()->getPPS()->getUseTransformSkip()) |
---|
1775 | { |
---|
1776 | parseTransformSkipFlags( pcCU, uiAbsPartIdx, uiWidth, uiHeight, uiDepth, eTType); |
---|
1777 | } |
---|
1778 | |
---|
1779 | eTType = eTType == TEXT_LUMA ? TEXT_LUMA : ( eTType == TEXT_NONE ? TEXT_NONE : TEXT_CHROMA ); |
---|
1780 | |
---|
1781 | //----- parse significance map ----- |
---|
1782 | const UInt uiLog2BlockSize = g_aucConvertToBit[ uiWidth ] + 2; |
---|
1783 | const UInt uiMaxNumCoeff = uiWidth * uiHeight; |
---|
1784 | const UInt uiMaxNumCoeffM1 = uiMaxNumCoeff - 1; |
---|
1785 | UInt uiScanIdx = pcCU->getCoefScanIdx(uiAbsPartIdx, uiWidth, eTType==TEXT_LUMA, pcCU->isIntra(uiAbsPartIdx)); |
---|
1786 | |
---|
1787 | //===== decode last significant ===== |
---|
1788 | UInt uiPosLastX, uiPosLastY; |
---|
1789 | parseLastSignificantXY( uiPosLastX, uiPosLastY, uiWidth, uiHeight, eTType, uiScanIdx ); |
---|
1790 | UInt uiBlkPosLast = uiPosLastX + (uiPosLastY<<uiLog2BlockSize); |
---|
1791 | pcCoef[ uiBlkPosLast ] = 1; |
---|
1792 | |
---|
1793 | //===== decode significance flags ===== |
---|
1794 | UInt uiScanPosLast; |
---|
1795 | const UInt *scan = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize-1 ]; |
---|
1796 | for( uiScanPosLast = 0; uiScanPosLast < uiMaxNumCoeffM1; uiScanPosLast++ ) |
---|
1797 | { |
---|
1798 | UInt uiBlkPos = scan[ uiScanPosLast ]; |
---|
1799 | if( uiBlkPosLast == uiBlkPos ) |
---|
1800 | { |
---|
1801 | break; |
---|
1802 | } |
---|
1803 | } |
---|
1804 | |
---|
1805 | ContextModel * const baseCoeffGroupCtx = m_cCUSigCoeffGroupSCModel.get( 0, eTType ); |
---|
1806 | ContextModel * const baseCtx = (eTType==TEXT_LUMA) ? m_cCUSigSCModel.get( 0, 0 ) : m_cCUSigSCModel.get( 0, 0 ) + NUM_SIG_FLAG_CTX_LUMA; |
---|
1807 | |
---|
1808 | const Int iLastScanSet = uiScanPosLast >> LOG2_SCAN_SET_SIZE; |
---|
1809 | UInt c1 = 1; |
---|
1810 | UInt uiGoRiceParam = 0; |
---|
1811 | |
---|
1812 | Bool beValid; |
---|
1813 | if (pcCU->getCUTransquantBypass(uiAbsPartIdx)) |
---|
1814 | { |
---|
1815 | beValid = false; |
---|
1816 | } |
---|
1817 | else |
---|
1818 | { |
---|
1819 | beValid = pcCU->getSlice()->getPPS()->getSignHideFlag() > 0; |
---|
1820 | } |
---|
1821 | UInt absSum = 0; |
---|
1822 | |
---|
1823 | UInt uiSigCoeffGroupFlag[ MLS_GRP_NUM ]; |
---|
1824 | ::memset( uiSigCoeffGroupFlag, 0, sizeof(UInt) * MLS_GRP_NUM ); |
---|
1825 | const UInt uiNumBlkSide = uiWidth >> (MLS_CG_SIZE >> 1); |
---|
1826 | const UInt * scanCG; |
---|
1827 | { |
---|
1828 | scanCG = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize > 3 ? uiLog2BlockSize-2-1 : 0 ]; |
---|
1829 | if( uiLog2BlockSize == 3 ) |
---|
1830 | { |
---|
1831 | scanCG = g_sigLastScan8x8[ uiScanIdx ]; |
---|
1832 | } |
---|
1833 | else if( uiLog2BlockSize == 5 ) |
---|
1834 | { |
---|
1835 | scanCG = g_sigLastScanCG32x32; |
---|
1836 | } |
---|
1837 | } |
---|
1838 | Int iScanPosSig = (Int) uiScanPosLast; |
---|
1839 | for( Int iSubSet = iLastScanSet; iSubSet >= 0; iSubSet-- ) |
---|
1840 | { |
---|
1841 | Int iSubPos = iSubSet << LOG2_SCAN_SET_SIZE; |
---|
1842 | uiGoRiceParam = 0; |
---|
1843 | Int numNonZero = 0; |
---|
1844 | |
---|
1845 | Int lastNZPosInCG = -1, firstNZPosInCG = SCAN_SET_SIZE; |
---|
1846 | |
---|
1847 | Int pos[SCAN_SET_SIZE]; |
---|
1848 | if( iScanPosSig == (Int) uiScanPosLast ) |
---|
1849 | { |
---|
1850 | lastNZPosInCG = iScanPosSig; |
---|
1851 | firstNZPosInCG = iScanPosSig; |
---|
1852 | iScanPosSig--; |
---|
1853 | pos[ numNonZero ] = uiBlkPosLast; |
---|
1854 | numNonZero = 1; |
---|
1855 | } |
---|
1856 | |
---|
1857 | // decode significant_coeffgroup_flag |
---|
1858 | Int iCGBlkPos = scanCG[ iSubSet ]; |
---|
1859 | Int iCGPosY = iCGBlkPos / uiNumBlkSide; |
---|
1860 | Int iCGPosX = iCGBlkPos - (iCGPosY * uiNumBlkSide); |
---|
1861 | if( iSubSet == iLastScanSet || iSubSet == 0) |
---|
1862 | { |
---|
1863 | uiSigCoeffGroupFlag[ iCGBlkPos ] = 1; |
---|
1864 | } |
---|
1865 | else |
---|
1866 | { |
---|
1867 | UInt uiSigCoeffGroup; |
---|
1868 | UInt uiCtxSig = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight ); |
---|
1869 | m_pcTDecBinIf->decodeBin( uiSigCoeffGroup, baseCoeffGroupCtx[ uiCtxSig ] ); |
---|
1870 | uiSigCoeffGroupFlag[ iCGBlkPos ] = uiSigCoeffGroup; |
---|
1871 | } |
---|
1872 | |
---|
1873 | // decode significant_coeff_flag |
---|
1874 | Int patternSigCtx = TComTrQuant::calcPatternSigCtx( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight ); |
---|
1875 | UInt uiBlkPos, uiPosY, uiPosX, uiSig, uiCtxSig; |
---|
1876 | for( ; iScanPosSig >= iSubPos; iScanPosSig-- ) |
---|
1877 | { |
---|
1878 | uiBlkPos = scan[ iScanPosSig ]; |
---|
1879 | uiPosY = uiBlkPos >> uiLog2BlockSize; |
---|
1880 | uiPosX = uiBlkPos - ( uiPosY << uiLog2BlockSize ); |
---|
1881 | uiSig = 0; |
---|
1882 | |
---|
1883 | if( uiSigCoeffGroupFlag[ iCGBlkPos ] ) |
---|
1884 | { |
---|
1885 | if( iScanPosSig > iSubPos || iSubSet == 0 || numNonZero ) |
---|
1886 | { |
---|
1887 | uiCtxSig = TComTrQuant::getSigCtxInc( patternSigCtx, uiScanIdx, uiPosX, uiPosY, uiLog2BlockSize, eTType ); |
---|
1888 | m_pcTDecBinIf->decodeBin( uiSig, baseCtx[ uiCtxSig ] ); |
---|
1889 | } |
---|
1890 | else |
---|
1891 | { |
---|
1892 | uiSig = 1; |
---|
1893 | } |
---|
1894 | } |
---|
1895 | pcCoef[ uiBlkPos ] = uiSig; |
---|
1896 | if( uiSig ) |
---|
1897 | { |
---|
1898 | pos[ numNonZero ] = uiBlkPos; |
---|
1899 | numNonZero ++; |
---|
1900 | if( lastNZPosInCG == -1 ) |
---|
1901 | { |
---|
1902 | lastNZPosInCG = iScanPosSig; |
---|
1903 | } |
---|
1904 | firstNZPosInCG = iScanPosSig; |
---|
1905 | } |
---|
1906 | } |
---|
1907 | |
---|
1908 | if( numNonZero ) |
---|
1909 | { |
---|
1910 | Bool signHidden = ( lastNZPosInCG - firstNZPosInCG >= SBH_THRESHOLD ); |
---|
1911 | absSum = 0; |
---|
1912 | UInt uiCtxSet = (iSubSet > 0 && eTType==TEXT_LUMA) ? 2 : 0; |
---|
1913 | UInt uiBin; |
---|
1914 | if( c1 == 0 ) |
---|
1915 | { |
---|
1916 | uiCtxSet++; |
---|
1917 | } |
---|
1918 | c1 = 1; |
---|
1919 | ContextModel *baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUOneSCModel.get( 0, 0 ) + 4 * uiCtxSet : m_cCUOneSCModel.get( 0, 0 ) + NUM_ONE_FLAG_CTX_LUMA + 4 * uiCtxSet; |
---|
1920 | Int absCoeff[SCAN_SET_SIZE]; |
---|
1921 | |
---|
1922 | for ( Int i = 0; i < numNonZero; i++) absCoeff[i] = 1; |
---|
1923 | Int numC1Flag = min(numNonZero, C1FLAG_NUMBER); |
---|
1924 | Int firstC2FlagIdx = -1; |
---|
1925 | |
---|
1926 | for( Int idx = 0; idx < numC1Flag; idx++ ) |
---|
1927 | { |
---|
1928 | m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[c1] ); |
---|
1929 | if( uiBin == 1 ) |
---|
1930 | { |
---|
1931 | c1 = 0; |
---|
1932 | if (firstC2FlagIdx == -1) |
---|
1933 | { |
---|
1934 | firstC2FlagIdx = idx; |
---|
1935 | } |
---|
1936 | } |
---|
1937 | else if( (c1 < 3) && (c1 > 0) ) |
---|
1938 | { |
---|
1939 | c1++; |
---|
1940 | } |
---|
1941 | absCoeff[ idx ] = uiBin + 1; |
---|
1942 | } |
---|
1943 | |
---|
1944 | if (c1 == 0) |
---|
1945 | { |
---|
1946 | baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUAbsSCModel.get( 0, 0 ) + uiCtxSet : m_cCUAbsSCModel.get( 0, 0 ) + NUM_ABS_FLAG_CTX_LUMA + uiCtxSet; |
---|
1947 | if ( firstC2FlagIdx != -1) |
---|
1948 | { |
---|
1949 | m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[0] ); |
---|
1950 | absCoeff[ firstC2FlagIdx ] = uiBin + 2; |
---|
1951 | } |
---|
1952 | } |
---|
1953 | |
---|
1954 | UInt coeffSigns; |
---|
1955 | if ( signHidden && beValid ) |
---|
1956 | { |
---|
1957 | m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero-1 ); |
---|
1958 | coeffSigns <<= 32 - (numNonZero-1); |
---|
1959 | } |
---|
1960 | else |
---|
1961 | { |
---|
1962 | m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero ); |
---|
1963 | coeffSigns <<= 32 - numNonZero; |
---|
1964 | } |
---|
1965 | |
---|
1966 | Int iFirstCoeff2 = 1; |
---|
1967 | if (c1 == 0 || numNonZero > C1FLAG_NUMBER) |
---|
1968 | { |
---|
1969 | for( Int idx = 0; idx < numNonZero; idx++ ) |
---|
1970 | { |
---|
1971 | UInt baseLevel = (idx < C1FLAG_NUMBER)? (2 + iFirstCoeff2) : 1; |
---|
1972 | |
---|
1973 | if( absCoeff[ idx ] == baseLevel) |
---|
1974 | { |
---|
1975 | UInt uiLevel; |
---|
1976 | xReadCoefRemainExGolomb( uiLevel, uiGoRiceParam ); |
---|
1977 | absCoeff[ idx ] = uiLevel + baseLevel; |
---|
1978 | if(absCoeff[idx]>3*(1<<uiGoRiceParam)) |
---|
1979 | { |
---|
1980 | uiGoRiceParam = min<UInt>(uiGoRiceParam+ 1, 4); |
---|
1981 | } |
---|
1982 | } |
---|
1983 | |
---|
1984 | if(absCoeff[ idx ] >= 2) |
---|
1985 | { |
---|
1986 | iFirstCoeff2 = 0; |
---|
1987 | } |
---|
1988 | } |
---|
1989 | } |
---|
1990 | |
---|
1991 | for( Int idx = 0; idx < numNonZero; idx++ ) |
---|
1992 | { |
---|
1993 | Int blkPos = pos[ idx ]; |
---|
1994 | // Signs applied later. |
---|
1995 | pcCoef[ blkPos ] = absCoeff[ idx ]; |
---|
1996 | absSum += absCoeff[ idx ]; |
---|
1997 | |
---|
1998 | if ( idx == numNonZero-1 && signHidden && beValid ) |
---|
1999 | { |
---|
2000 | // Infer sign of 1st element. |
---|
2001 | if (absSum&0x1) |
---|
2002 | { |
---|
2003 | pcCoef[ blkPos ] = -pcCoef[ blkPos ]; |
---|
2004 | } |
---|
2005 | } |
---|
2006 | else |
---|
2007 | { |
---|
2008 | Int sign = static_cast<Int>( coeffSigns ) >> 31; |
---|
2009 | pcCoef[ blkPos ] = ( pcCoef[ blkPos ] ^ sign ) - sign; |
---|
2010 | coeffSigns <<= 1; |
---|
2011 | } |
---|
2012 | } |
---|
2013 | } |
---|
2014 | } |
---|
2015 | |
---|
2016 | return; |
---|
2017 | } |
---|
2018 | |
---|
2019 | |
---|
2020 | Void TDecSbac::parseSaoMaxUvlc ( UInt& val, UInt maxSymbol ) |
---|
2021 | { |
---|
2022 | if (maxSymbol == 0) |
---|
2023 | { |
---|
2024 | val = 0; |
---|
2025 | return; |
---|
2026 | } |
---|
2027 | |
---|
2028 | UInt code; |
---|
2029 | Int i; |
---|
2030 | m_pcTDecBinIf->decodeBinEP( code ); |
---|
2031 | if ( code == 0 ) |
---|
2032 | { |
---|
2033 | val = 0; |
---|
2034 | return; |
---|
2035 | } |
---|
2036 | |
---|
2037 | i=1; |
---|
2038 | while (1) |
---|
2039 | { |
---|
2040 | m_pcTDecBinIf->decodeBinEP( code ); |
---|
2041 | if ( code == 0 ) |
---|
2042 | { |
---|
2043 | break; |
---|
2044 | } |
---|
2045 | i++; |
---|
2046 | if (i == maxSymbol) |
---|
2047 | { |
---|
2048 | break; |
---|
2049 | } |
---|
2050 | } |
---|
2051 | |
---|
2052 | val = i; |
---|
2053 | } |
---|
2054 | Void TDecSbac::parseSaoUflc (UInt uiLength, UInt& riVal) |
---|
2055 | { |
---|
2056 | m_pcTDecBinIf->decodeBinsEP ( riVal, uiLength ); |
---|
2057 | } |
---|
2058 | Void TDecSbac::parseSaoMerge (UInt& ruiVal) |
---|
2059 | { |
---|
2060 | UInt uiCode; |
---|
2061 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoMergeSCModel.get( 0, 0, 0 ) ); |
---|
2062 | ruiVal = (Int)uiCode; |
---|
2063 | } |
---|
2064 | Void TDecSbac::parseSaoTypeIdx (UInt& ruiVal) |
---|
2065 | { |
---|
2066 | UInt uiCode; |
---|
2067 | m_pcTDecBinIf->decodeBin( uiCode, m_cSaoTypeIdxSCModel.get( 0, 0, 0 ) ); |
---|
2068 | if (uiCode == 0) |
---|
2069 | { |
---|
2070 | ruiVal = 0; |
---|
2071 | } |
---|
2072 | else |
---|
2073 | { |
---|
2074 | m_pcTDecBinIf->decodeBinEP( uiCode ); |
---|
2075 | if (uiCode == 0) |
---|
2076 | { |
---|
2077 | ruiVal = 5; |
---|
2078 | } |
---|
2079 | else |
---|
2080 | { |
---|
2081 | ruiVal = 1; |
---|
2082 | } |
---|
2083 | } |
---|
2084 | } |
---|
2085 | |
---|
2086 | inline Void copySaoOneLcuParam(SaoLcuParam* psDst, SaoLcuParam* psSrc) |
---|
2087 | { |
---|
2088 | Int i; |
---|
2089 | psDst->partIdx = psSrc->partIdx; |
---|
2090 | psDst->typeIdx = psSrc->typeIdx; |
---|
2091 | if (psDst->typeIdx != -1) |
---|
2092 | { |
---|
2093 | psDst->subTypeIdx = psSrc->subTypeIdx ; |
---|
2094 | psDst->length = psSrc->length; |
---|
2095 | for (i=0;i<psDst->length;i++) |
---|
2096 | { |
---|
2097 | psDst->offset[i] = psSrc->offset[i]; |
---|
2098 | } |
---|
2099 | } |
---|
2100 | else |
---|
2101 | { |
---|
2102 | psDst->length = 0; |
---|
2103 | for (i=0;i<SAO_BO_LEN;i++) |
---|
2104 | { |
---|
2105 | psDst->offset[i] = 0; |
---|
2106 | } |
---|
2107 | } |
---|
2108 | } |
---|
2109 | |
---|
2110 | Void TDecSbac::parseSaoOffset(SaoLcuParam* psSaoLcuParam, UInt compIdx) |
---|
2111 | { |
---|
2112 | UInt uiSymbol; |
---|
2113 | static Int iTypeLength[MAX_NUM_SAO_TYPE] = |
---|
2114 | { |
---|
2115 | SAO_EO_LEN, |
---|
2116 | SAO_EO_LEN, |
---|
2117 | SAO_EO_LEN, |
---|
2118 | SAO_EO_LEN, |
---|
2119 | SAO_BO_LEN |
---|
2120 | }; |
---|
2121 | |
---|
2122 | if (compIdx==2) |
---|
2123 | { |
---|
2124 | uiSymbol = (UInt)( psSaoLcuParam->typeIdx + 1); |
---|
2125 | } |
---|
2126 | else |
---|
2127 | { |
---|
2128 | parseSaoTypeIdx(uiSymbol); |
---|
2129 | } |
---|
2130 | psSaoLcuParam->typeIdx = (Int)uiSymbol - 1; |
---|
2131 | if (uiSymbol) |
---|
2132 | { |
---|
2133 | psSaoLcuParam->length = iTypeLength[psSaoLcuParam->typeIdx]; |
---|
2134 | |
---|
2135 | Int bitDepth = compIdx ? g_bitDepthC : g_bitDepthY; |
---|
2136 | Int offsetTh = 1 << min(bitDepth - 5,5); |
---|
2137 | |
---|
2138 | if( psSaoLcuParam->typeIdx == SAO_BO ) |
---|
2139 | { |
---|
2140 | for(Int i=0; i< psSaoLcuParam->length; i++) |
---|
2141 | { |
---|
2142 | parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); |
---|
2143 | psSaoLcuParam->offset[i] = uiSymbol; |
---|
2144 | } |
---|
2145 | for(Int i=0; i< psSaoLcuParam->length; i++) |
---|
2146 | { |
---|
2147 | if (psSaoLcuParam->offset[i] != 0) |
---|
2148 | { |
---|
2149 | m_pcTDecBinIf->decodeBinEP ( uiSymbol); |
---|
2150 | if (uiSymbol) |
---|
2151 | { |
---|
2152 | psSaoLcuParam->offset[i] = -psSaoLcuParam->offset[i] ; |
---|
2153 | } |
---|
2154 | } |
---|
2155 | } |
---|
2156 | parseSaoUflc(5, uiSymbol ); |
---|
2157 | psSaoLcuParam->subTypeIdx = uiSymbol; |
---|
2158 | } |
---|
2159 | else if( psSaoLcuParam->typeIdx < 4 ) |
---|
2160 | { |
---|
2161 | parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[0] = uiSymbol; |
---|
2162 | parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[1] = uiSymbol; |
---|
2163 | parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[2] = -(Int)uiSymbol; |
---|
2164 | parseSaoMaxUvlc(uiSymbol, offsetTh -1 ); psSaoLcuParam->offset[3] = -(Int)uiSymbol; |
---|
2165 | if (compIdx != 2) |
---|
2166 | { |
---|
2167 | parseSaoUflc(2, uiSymbol ); |
---|
2168 | psSaoLcuParam->subTypeIdx = uiSymbol; |
---|
2169 | psSaoLcuParam->typeIdx += psSaoLcuParam->subTypeIdx; |
---|
2170 | } |
---|
2171 | } |
---|
2172 | } |
---|
2173 | else |
---|
2174 | { |
---|
2175 | psSaoLcuParam->length = 0; |
---|
2176 | } |
---|
2177 | } |
---|
2178 | |
---|
2179 | Void TDecSbac::parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp) |
---|
2180 | { |
---|
2181 | Int iAddr = pcCU->getAddr(); |
---|
2182 | UInt uiSymbol; |
---|
2183 | for (Int iCompIdx=0; iCompIdx<3; iCompIdx++) |
---|
2184 | { |
---|
2185 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = 0; |
---|
2186 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = 0; |
---|
2187 | pSaoParam->saoLcuParam[iCompIdx][iAddr].subTypeIdx = 0; |
---|
2188 | pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx = -1; |
---|
2189 | pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[0] = 0; |
---|
2190 | pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[1] = 0; |
---|
2191 | pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[2] = 0; |
---|
2192 | pSaoParam->saoLcuParam[iCompIdx][iAddr].offset[3] = 0; |
---|
2193 | |
---|
2194 | } |
---|
2195 | if (pSaoParam->bSaoFlag[0] || pSaoParam->bSaoFlag[1] ) |
---|
2196 | { |
---|
2197 | if (rx>0 && iCUAddrInSlice!=0 && allowMergeLeft) |
---|
2198 | { |
---|
2199 | parseSaoMerge(uiSymbol); |
---|
2200 | pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag = (Bool)uiSymbol; |
---|
2201 | } |
---|
2202 | if (pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag==0) |
---|
2203 | { |
---|
2204 | if ((ry > 0) && (iCUAddrUpInSlice>=0) && allowMergeUp) |
---|
2205 | { |
---|
2206 | parseSaoMerge(uiSymbol); |
---|
2207 | pSaoParam->saoLcuParam[0][iAddr].mergeUpFlag = (Bool)uiSymbol; |
---|
2208 | } |
---|
2209 | } |
---|
2210 | } |
---|
2211 | |
---|
2212 | for (Int iCompIdx=0; iCompIdx<3; iCompIdx++) |
---|
2213 | { |
---|
2214 | if ((iCompIdx == 0 && pSaoParam->bSaoFlag[0]) || (iCompIdx > 0 && pSaoParam->bSaoFlag[1]) ) |
---|
2215 | { |
---|
2216 | if (rx>0 && iCUAddrInSlice!=0 && allowMergeLeft) |
---|
2217 | { |
---|
2218 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = pSaoParam->saoLcuParam[0][iAddr].mergeLeftFlag; |
---|
2219 | } |
---|
2220 | else |
---|
2221 | { |
---|
2222 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag = 0; |
---|
2223 | } |
---|
2224 | |
---|
2225 | if (pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeLeftFlag==0) |
---|
2226 | { |
---|
2227 | if ((ry > 0) && (iCUAddrUpInSlice>=0) && allowMergeUp) |
---|
2228 | { |
---|
2229 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = pSaoParam->saoLcuParam[0][iAddr].mergeUpFlag; |
---|
2230 | } |
---|
2231 | else |
---|
2232 | { |
---|
2233 | pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag = 0; |
---|
2234 | } |
---|
2235 | if (!pSaoParam->saoLcuParam[iCompIdx][iAddr].mergeUpFlag) |
---|
2236 | { |
---|
2237 | pSaoParam->saoLcuParam[2][iAddr].typeIdx = pSaoParam->saoLcuParam[1][iAddr].typeIdx; |
---|
2238 | parseSaoOffset(&(pSaoParam->saoLcuParam[iCompIdx][iAddr]), iCompIdx); |
---|
2239 | } |
---|
2240 | else |
---|
2241 | { |
---|
2242 | copySaoOneLcuParam(&pSaoParam->saoLcuParam[iCompIdx][iAddr], &pSaoParam->saoLcuParam[iCompIdx][iAddr-pSaoParam->numCuInWidth]); |
---|
2243 | } |
---|
2244 | } |
---|
2245 | else |
---|
2246 | { |
---|
2247 | copySaoOneLcuParam(&pSaoParam->saoLcuParam[iCompIdx][iAddr], &pSaoParam->saoLcuParam[iCompIdx][iAddr-1]); |
---|
2248 | } |
---|
2249 | } |
---|
2250 | else |
---|
2251 | { |
---|
2252 | pSaoParam->saoLcuParam[iCompIdx][iAddr].typeIdx = -1; |
---|
2253 | pSaoParam->saoLcuParam[iCompIdx][iAddr].subTypeIdx = 0; |
---|
2254 | } |
---|
2255 | } |
---|
2256 | } |
---|
2257 | |
---|
2258 | /** |
---|
2259 | - Initialize our contexts from the nominated source. |
---|
2260 | . |
---|
2261 | \param pSrc Contexts to be copied. |
---|
2262 | */ |
---|
2263 | Void TDecSbac::xCopyContextsFrom( TDecSbac* pSrc ) |
---|
2264 | { |
---|
2265 | memcpy(m_contextModels, pSrc->m_contextModels, m_numContextModels*sizeof(m_contextModels[0])); |
---|
2266 | } |
---|
2267 | |
---|
2268 | Void TDecSbac::xCopyFrom( TDecSbac* pSrc ) |
---|
2269 | { |
---|
2270 | m_pcTDecBinIf->copyState( pSrc->m_pcTDecBinIf ); |
---|
2271 | |
---|
2272 | m_uiLastQp = pSrc->m_uiLastQp; |
---|
2273 | xCopyContextsFrom( pSrc ); |
---|
2274 | |
---|
2275 | } |
---|
2276 | |
---|
2277 | Void TDecSbac::load ( TDecSbac* pScr ) |
---|
2278 | { |
---|
2279 | xCopyFrom(pScr); |
---|
2280 | } |
---|
2281 | |
---|
2282 | Void TDecSbac::loadContexts ( TDecSbac* pScr ) |
---|
2283 | { |
---|
2284 | xCopyContextsFrom(pScr); |
---|
2285 | } |
---|
2286 | |
---|
2287 | #if H_3D_ARP |
---|
2288 | Void TDecSbac::parseARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2289 | { |
---|
2290 | UInt uiMaxW = pcCU->getSlice()->getARPStepNum() - 1; |
---|
2291 | UInt uiW = 0; |
---|
2292 | UInt uiOffset = pcCU->getCTXARPWFlag(uiAbsPartIdx); |
---|
2293 | UInt uiCode = 0; |
---|
2294 | |
---|
2295 | assert ( uiMaxW > 0 ); |
---|
2296 | |
---|
2297 | m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 0 + uiOffset ) ); |
---|
2298 | |
---|
2299 | uiW = uiCode; |
---|
2300 | if( 1 == uiW ) |
---|
2301 | { |
---|
2302 | m_pcTDecBinIf->decodeBin( uiCode , m_cCUPUARPWSCModel.get( 0, 0, 3 ) ); |
---|
2303 | uiW += ( 1 == uiCode ? 1 : 0 ); |
---|
2304 | } |
---|
2305 | #if H_MV_ENC_DEC_TRAC |
---|
2306 | DTRACE_CU("iv_res_pred_weight_idx", uiW ) |
---|
2307 | #endif |
---|
2308 | pcCU->setARPWSubParts( ( UChar )( uiW ) , uiAbsPartIdx, uiDepth ); |
---|
2309 | } |
---|
2310 | #endif |
---|
2311 | |
---|
2312 | #if H_3D_IC |
---|
2313 | /** parse illumination compensation flag |
---|
2314 | * \param pcCU |
---|
2315 | * \param uiAbsPartIdx |
---|
2316 | * \param uiDepth |
---|
2317 | * \returns Void |
---|
2318 | */ |
---|
2319 | Void TDecSbac::parseICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2320 | { |
---|
2321 | UInt uiSymbol = 0; |
---|
2322 | UInt uiCtxIC = pcCU->getCtxICFlag( uiAbsPartIdx ); |
---|
2323 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) ); |
---|
2324 | #if !H_MV_ENC_DEC_TRAC |
---|
2325 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
2326 | DTRACE_CABAC_T( "\tICFlag" ); |
---|
2327 | DTRACE_CABAC_T( "\tuiCtxIC: "); |
---|
2328 | DTRACE_CABAC_V( uiCtxIC ); |
---|
2329 | DTRACE_CABAC_T( "\tuiSymbol: "); |
---|
2330 | DTRACE_CABAC_V( uiSymbol ); |
---|
2331 | DTRACE_CABAC_T( "\n"); |
---|
2332 | #else |
---|
2333 | DTRACE_CU("ic_flag", uiSymbol) |
---|
2334 | #endif |
---|
2335 | |
---|
2336 | pcCU->setICFlagSubParts( uiSymbol ? true : false , uiAbsPartIdx, 0, uiDepth ); |
---|
2337 | } |
---|
2338 | #endif |
---|
2339 | |
---|
2340 | #if LGE_INTER_SDC_E0156 |
---|
2341 | Void TDecSbac::parseInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
2342 | { |
---|
2343 | UInt uiSymbol = 0; |
---|
2344 | UInt uiCtxInterSDCFlag = pcCU->getCtxInterSDCFlag( uiAbsPartIdx ); |
---|
2345 | |
---|
2346 | m_pcTDecBinIf->decodeBin( uiSymbol, m_cInterSDCFlagSCModel.get( 0, 0, uiCtxInterSDCFlag ) ); |
---|
2347 | |
---|
2348 | if( uiSymbol ) |
---|
2349 | { |
---|
2350 | pcCU->setInterSDCFlagSubParts( true, uiAbsPartIdx, 0, uiDepth ); |
---|
2351 | pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth ); |
---|
2352 | pcCU->setCbfSubParts( 1, 1, 1, uiAbsPartIdx, uiDepth ); |
---|
2353 | } |
---|
2354 | else |
---|
2355 | { |
---|
2356 | pcCU->setInterSDCFlagSubParts( false, uiAbsPartIdx, 0, uiDepth); |
---|
2357 | } |
---|
2358 | } |
---|
2359 | |
---|
2360 | Void TDecSbac::parseInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment ) |
---|
2361 | { |
---|
2362 | UInt uiAbsIdx = 0; |
---|
2363 | UInt uiSign = 0; |
---|
2364 | Int iIdx = 0; |
---|
2365 | |
---|
2366 | xReadExGolombLevel( uiAbsIdx, m_cInterSDCResidualSCModel.get( 0, 0, 0 ) ); |
---|
2367 | |
---|
2368 | uiAbsIdx++; |
---|
2369 | m_pcTDecBinIf->decodeBin( uiSign, m_cInterSDCResidualSignFlagSCModel.get( 0, 0, 0 ) ); |
---|
2370 | iIdx = (Int)( uiSign ? -1 : 1 ) * uiAbsIdx; |
---|
2371 | |
---|
2372 | pcCU->setInterSDCSegmentDCOffset( iIdx, uiSegment, uiAbsPartIdx ); |
---|
2373 | } |
---|
2374 | #endif |
---|
2375 | |
---|
2376 | //! \} |
---|