1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2012, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file TDecEntropy.cpp |
---|
35 | \brief entropy decoder class |
---|
36 | */ |
---|
37 | |
---|
38 | #include "TDecEntropy.h" |
---|
39 | |
---|
40 | //! \ingroup TLibDecoder |
---|
41 | //! \{ |
---|
42 | |
---|
43 | Void TDecEntropy::setEntropyDecoder ( TDecEntropyIf* p ) |
---|
44 | { |
---|
45 | m_pcEntropyDecoderIf = p; |
---|
46 | } |
---|
47 | |
---|
48 | #include "TLibCommon/TComAdaptiveLoopFilter.h" |
---|
49 | #include "TLibCommon/TComSampleAdaptiveOffset.h" |
---|
50 | |
---|
51 | Void TDecEntropy::decodeSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
52 | { |
---|
53 | m_pcEntropyDecoderIf->parseSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
54 | } |
---|
55 | |
---|
56 | /** decode merge flag |
---|
57 | * \param pcSubCU |
---|
58 | * \param uiAbsPartIdx |
---|
59 | * \param uiDepth |
---|
60 | * \param uiPUIdx |
---|
61 | * \returns Void |
---|
62 | */ |
---|
63 | Void TDecEntropy::decodeMergeFlag( TComDataCU* pcSubCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) |
---|
64 | { |
---|
65 | // at least one merge candidate exists |
---|
66 | m_pcEntropyDecoderIf->parseMergeFlag( pcSubCU, uiAbsPartIdx, uiDepth, uiPUIdx ); |
---|
67 | } |
---|
68 | |
---|
69 | #if LGE_ILLUCOMP_B0045 |
---|
70 | Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
71 | { |
---|
72 | pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth ); |
---|
73 | |
---|
74 | if (pcCU->isIntra(uiAbsPartIdx) || (pcCU->getSlice()->getViewId() == 0) |
---|
75 | #if !LGE_ILLUCOMP_DEPTH_C0046 |
---|
76 | || pcCU->getSlice()->getSPS()->isDepth() |
---|
77 | #endif |
---|
78 | ) |
---|
79 | { |
---|
80 | return; |
---|
81 | } |
---|
82 | |
---|
83 | if(!pcCU->getSlice()->getApplyIC()) |
---|
84 | return; |
---|
85 | |
---|
86 | #if LGE_ILLUCOMP_DEPTH_C0046 |
---|
87 | if(pcCU->isICFlagRequired(uiAbsPartIdx, uiDepth)) //This modification is not needed after integrating JCT3V-C0137 |
---|
88 | #else |
---|
89 | if(pcCU->isICFlagRequired(uiAbsPartIdx)) |
---|
90 | #endif |
---|
91 | m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
92 | } |
---|
93 | #endif |
---|
94 | /** decode merge index |
---|
95 | * \param pcCU |
---|
96 | * \param uiPartIdx |
---|
97 | * \param uiAbsPartIdx |
---|
98 | * \param puhInterDirNeighbours pointer to list of inter direction from the casual neighbours |
---|
99 | * \param pcMvFieldNeighbours pointer to list of motion vector field from the casual neighbours |
---|
100 | * \param uiDepth |
---|
101 | * \returns Void |
---|
102 | */ |
---|
103 | Void TDecEntropy::decodeMergeIndex( TComDataCU* pcCU, UInt uiPartIdx, UInt uiAbsPartIdx, PartSize eCUMode, UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, UInt uiDepth ) |
---|
104 | { |
---|
105 | UInt uiMergeIndex = 0; |
---|
106 | m_pcEntropyDecoderIf->parseMergeIndex( pcCU, uiMergeIndex, uiAbsPartIdx, uiDepth ); |
---|
107 | pcCU->setMergeIndexSubParts( uiMergeIndex, uiAbsPartIdx, uiPartIdx, uiDepth ); |
---|
108 | } |
---|
109 | |
---|
110 | #if HHI_INTER_VIEW_RESIDUAL_PRED |
---|
111 | Void |
---|
112 | TDecEntropy::decodeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU, UInt uiPUIdx ) |
---|
113 | { |
---|
114 | Bool bResPredAvailable = false; |
---|
115 | Bool bResPredFlag = false; |
---|
116 | |
---|
117 | Bool bResPredAllowed = (!pcCU->getSlice()->getSPS()->isDepth () ); |
---|
118 | bResPredAllowed = bResPredAllowed && ( pcCU->getSlice()->getSPS()->getViewId () ); |
---|
119 | bResPredAllowed = bResPredAllowed && ( pcCU->getSlice()->getSPS()->getMultiviewResPredMode() ); |
---|
120 | bResPredAllowed = bResPredAllowed && (!pcCU->isIntra ( uiAbsPartIdx ) ); |
---|
121 | |
---|
122 | // check if supported |
---|
123 | if( bResPredAllowed ) |
---|
124 | { |
---|
125 | bResPredAvailable = pcSubCU->getResidualSamples( uiPUIdx |
---|
126 | #if QC_SIMPLIFIEDIVRP_M24938 |
---|
127 | , false |
---|
128 | #endif |
---|
129 | ); |
---|
130 | } |
---|
131 | |
---|
132 | // read from bitstream |
---|
133 | if( bResPredAvailable ) |
---|
134 | { |
---|
135 | #if LG_RESTRICTEDRESPRED_M24766 |
---|
136 | Int iPUResiPredShift[4]; |
---|
137 | pcCU->getPUResiPredShift(iPUResiPredShift, uiAbsPartIdx); |
---|
138 | if(iPUResiPredShift[0] >= 0 || iPUResiPredShift[1] >= 0 || iPUResiPredShift[2] >= 0 || iPUResiPredShift[3] >= 0 ) |
---|
139 | #endif |
---|
140 | m_pcEntropyDecoderIf->parseResPredFlag( pcCU, bResPredFlag, uiAbsPartIdx, uiDepth ); |
---|
141 | } |
---|
142 | |
---|
143 | // set data |
---|
144 | pcCU->setResPredAvailSubParts ( bResPredAvailable, uiAbsPartIdx, uiPUIdx, uiDepth ); |
---|
145 | pcCU->setResPredFlagSubParts ( bResPredFlag, uiAbsPartIdx, uiPUIdx, uiDepth ); |
---|
146 | } |
---|
147 | #endif |
---|
148 | |
---|
149 | Void TDecEntropy::decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
150 | { |
---|
151 | m_pcEntropyDecoderIf->parseSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
152 | } |
---|
153 | |
---|
154 | Void TDecEntropy::decodePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
155 | { |
---|
156 | m_pcEntropyDecoderIf->parsePredMode( pcCU, uiAbsPartIdx, uiDepth ); |
---|
157 | |
---|
158 | #if RWTH_SDC_DLT_B0036 |
---|
159 | // if B-Slice, code SDC flag later |
---|
160 | if( !pcCU->getSlice()->isInterB() && pcCU->isIntra(uiAbsPartIdx) && pcCU->getSlice()->getSPS()->isDepth() ) |
---|
161 | { |
---|
162 | // decode SDC flag |
---|
163 | decodeSDCFlag(pcCU, uiAbsPartIdx, uiDepth); |
---|
164 | } |
---|
165 | #endif |
---|
166 | } |
---|
167 | |
---|
168 | Void TDecEntropy::decodePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
169 | { |
---|
170 | #if RWTH_SDC_DLT_B0036 |
---|
171 | if( !pcCU->getSlice()->isInterB() && pcCU->isIntra(uiAbsPartIdx) && pcCU->getSDCFlag(uiAbsPartIdx) ) |
---|
172 | { |
---|
173 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
174 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
175 | return; |
---|
176 | } |
---|
177 | #endif |
---|
178 | |
---|
179 | m_pcEntropyDecoderIf->parsePartSize( pcCU, uiAbsPartIdx, uiDepth ); |
---|
180 | |
---|
181 | #if RWTH_SDC_DLT_B0036 |
---|
182 | if( pcCU->getSlice()->isInterB() && pcCU->getSlice()->getSPS()->isDepth() && pcCU->isIntra(uiAbsPartIdx) ) |
---|
183 | { |
---|
184 | // decode SDC flag |
---|
185 | decodeSDCFlag(pcCU, uiAbsPartIdx, uiDepth); |
---|
186 | |
---|
187 | if( pcCU->getSDCFlag(uiAbsPartIdx) ) |
---|
188 | { |
---|
189 | // part size is also known for SDC intra |
---|
190 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
191 | pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth ); |
---|
192 | } |
---|
193 | } |
---|
194 | #endif |
---|
195 | } |
---|
196 | |
---|
197 | Void TDecEntropy::decodePredInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ) |
---|
198 | { |
---|
199 | #if RWTH_SDC_DLT_B0036 |
---|
200 | if( pcCU->getSDCFlag(uiAbsPartIdx) ) |
---|
201 | { |
---|
202 | decodeSDCPredMode(pcCU, uiAbsPartIdx, uiDepth); |
---|
203 | return; |
---|
204 | } |
---|
205 | #endif |
---|
206 | |
---|
207 | PartSize eMode = pcCU->getPartitionSize( uiAbsPartIdx ); |
---|
208 | |
---|
209 | if( pcCU->isIntra( uiAbsPartIdx ) ) // If it is Intra mode, encode intra prediction mode. |
---|
210 | { |
---|
211 | if( eMode == SIZE_NxN ) // if it is NxN size, encode 4 intra directions. |
---|
212 | { |
---|
213 | UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth(uiAbsPartIdx) << 1 ) ) >> 2; |
---|
214 | // if it is NxN size, this size might be the smallest partition size. // if it is NxN size, this size might be the smallest partition size. |
---|
215 | decodeIntraDirModeLuma( pcCU, uiAbsPartIdx, uiDepth+1 ); |
---|
216 | decodeIntraDirModeLuma( pcCU, uiAbsPartIdx + uiPartOffset, uiDepth+1 ); |
---|
217 | decodeIntraDirModeLuma( pcCU, uiAbsPartIdx + uiPartOffset*2, uiDepth+1 ); |
---|
218 | decodeIntraDirModeLuma( pcCU, uiAbsPartIdx + uiPartOffset*3, uiDepth+1 ); |
---|
219 | decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); |
---|
220 | } |
---|
221 | else // if it is not NxN size, encode 1 intra directions |
---|
222 | { |
---|
223 | decodeIntraDirModeLuma ( pcCU, uiAbsPartIdx, uiDepth ); |
---|
224 | decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); |
---|
225 | } |
---|
226 | } |
---|
227 | else // if it is Inter mode, encode motion vector and reference index |
---|
228 | { |
---|
229 | decodePUWise( pcCU, uiAbsPartIdx, uiDepth, pcSubCU ); |
---|
230 | } |
---|
231 | } |
---|
232 | |
---|
233 | /** Parse I_PCM information. |
---|
234 | * \param pcCU pointer to CUpointer to CU |
---|
235 | * \param uiAbsPartIdx CU index |
---|
236 | * \param uiDepth CU depth |
---|
237 | * \returns Void |
---|
238 | */ |
---|
239 | Void TDecEntropy::decodeIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
240 | { |
---|
241 | if(!pcCU->getSlice()->getSPS()->getUsePCM() |
---|
242 | || pcCU->getWidth(uiAbsPartIdx) > (1<<pcCU->getSlice()->getSPS()->getPCMLog2MaxSize()) |
---|
243 | || pcCU->getWidth(uiAbsPartIdx) < (1<<pcCU->getSlice()->getSPS()->getPCMLog2MinSize()) ) |
---|
244 | { |
---|
245 | return; |
---|
246 | } |
---|
247 | |
---|
248 | #if RWTH_SDC_DLT_B0036 |
---|
249 | if( pcCU->getSDCFlag(uiAbsPartIdx) ) |
---|
250 | { |
---|
251 | return; |
---|
252 | } |
---|
253 | #endif |
---|
254 | |
---|
255 | m_pcEntropyDecoderIf->parseIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); |
---|
256 | } |
---|
257 | |
---|
258 | Void TDecEntropy::decodeIntraDirModeLuma ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
259 | { |
---|
260 | m_pcEntropyDecoderIf->parseIntraDirLumaAng( pcCU, uiAbsPartIdx, uiDepth ); |
---|
261 | } |
---|
262 | |
---|
263 | Void TDecEntropy::decodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
264 | { |
---|
265 | m_pcEntropyDecoderIf->parseIntraDirChroma( pcCU, uiAbsPartIdx, uiDepth ); |
---|
266 | } |
---|
267 | |
---|
268 | /** decode motion information for every PU block. |
---|
269 | * \param pcCU |
---|
270 | * \param uiAbsPartIdx |
---|
271 | * \param uiDepth |
---|
272 | * \param pcSubCU |
---|
273 | * \returns Void |
---|
274 | */ |
---|
275 | Void TDecEntropy::decodePUWise( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ) |
---|
276 | { |
---|
277 | PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); |
---|
278 | UInt uiNumPU = ( ePartSize == SIZE_2Nx2N ? 1 : ( ePartSize == SIZE_NxN ? 4 : 2 ) ); |
---|
279 | UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4; |
---|
280 | |
---|
281 | #if CU_BASED_MRG_CAND_LIST |
---|
282 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
283 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists |
---|
284 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; |
---|
285 | for ( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ui++ ) |
---|
286 | #else |
---|
287 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists |
---|
288 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; |
---|
289 | for ( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ui++ ) |
---|
290 | #endif |
---|
291 | { |
---|
292 | uhInterDirNeighbours[ui] = 0; |
---|
293 | } |
---|
294 | Int numValidMergeCand = 0; |
---|
295 | bool isMerged = false; |
---|
296 | #endif |
---|
297 | |
---|
298 | pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); |
---|
299 | pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); |
---|
300 | for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) |
---|
301 | { |
---|
302 | #if !CU_BASED_MRG_CAND_LIST |
---|
303 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
304 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists |
---|
305 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; |
---|
306 | Int numValidMergeCand = 0; |
---|
307 | for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ++ui ) |
---|
308 | #else |
---|
309 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists |
---|
310 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; |
---|
311 | Int numValidMergeCand = 0; |
---|
312 | for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui ) |
---|
313 | #endif |
---|
314 | { |
---|
315 | uhInterDirNeighbours[ui] = 0; |
---|
316 | } |
---|
317 | #endif |
---|
318 | decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
319 | if ( pcCU->getMergeFlag( uiSubPartIdx ) ) |
---|
320 | { |
---|
321 | decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, ePartSize, uhInterDirNeighbours, cMvFieldNeighbours, uiDepth ); |
---|
322 | #if CU_BASED_MRG_CAND_LIST |
---|
323 | UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
---|
324 | if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) |
---|
325 | { |
---|
326 | pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); |
---|
327 | if ( !isMerged ) |
---|
328 | { |
---|
329 | pcSubCU->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); |
---|
330 | isMerged = true; |
---|
331 | } |
---|
332 | pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); |
---|
333 | } |
---|
334 | else |
---|
335 | { |
---|
336 | #if SIMP_MRG_PRUN |
---|
337 | uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
---|
338 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
---|
339 | #else |
---|
340 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); |
---|
341 | uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
---|
342 | #endif |
---|
343 | } |
---|
344 | #else |
---|
345 | #if SIMP_MRG_PRUN |
---|
346 | UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
---|
347 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
---|
348 | #else |
---|
349 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); |
---|
350 | UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
---|
351 | #endif |
---|
352 | #endif |
---|
353 | pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
354 | |
---|
355 | TComMv cTmpMv( 0, 0 ); |
---|
356 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
357 | { |
---|
358 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
359 | { |
---|
360 | pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
---|
361 | pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
---|
362 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
363 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
364 | |
---|
365 | } |
---|
366 | } |
---|
367 | } |
---|
368 | else |
---|
369 | { |
---|
370 | decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
371 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
372 | { |
---|
373 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
374 | { |
---|
375 | decodeRefFrmIdxPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
376 | decodeMvdPU ( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
377 | decodeMVPIdxPU ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
378 | } |
---|
379 | } |
---|
380 | } |
---|
381 | } |
---|
382 | return; |
---|
383 | } |
---|
384 | |
---|
385 | /** decode inter direction for a PU block |
---|
386 | * \param pcCU |
---|
387 | * \param uiAbsPartIdx |
---|
388 | * \param uiDepth |
---|
389 | * \param uiPartIdx |
---|
390 | * \returns Void |
---|
391 | */ |
---|
392 | Void TDecEntropy::decodeInterDirPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx ) |
---|
393 | { |
---|
394 | UInt uiInterDir; |
---|
395 | |
---|
396 | if ( pcCU->getSlice()->isInterP() ) |
---|
397 | { |
---|
398 | uiInterDir = 1; |
---|
399 | } |
---|
400 | else |
---|
401 | { |
---|
402 | m_pcEntropyDecoderIf->parseInterDir( pcCU, uiInterDir, uiAbsPartIdx, uiDepth ); |
---|
403 | } |
---|
404 | |
---|
405 | pcCU->setInterDirSubParts( uiInterDir, uiAbsPartIdx, uiPartIdx, uiDepth ); |
---|
406 | } |
---|
407 | |
---|
408 | Void TDecEntropy::decodeRefFrmIdxPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
409 | { |
---|
410 | if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getInterDir( uiAbsPartIdx ) != 3) |
---|
411 | { |
---|
412 | if(eRefList == REF_PIC_LIST_1) |
---|
413 | { |
---|
414 | return; |
---|
415 | } |
---|
416 | |
---|
417 | Int iRefFrmIdx = 0; |
---|
418 | Int iRefFrmIdxTemp; |
---|
419 | UInt uiInterDir; |
---|
420 | RefPicList eRefListTemp; |
---|
421 | |
---|
422 | PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); |
---|
423 | |
---|
424 | if ( pcCU->getSlice()->getNumRefIdx ( REF_PIC_LIST_C ) > 1 ) |
---|
425 | { |
---|
426 | m_pcEntropyDecoderIf->parseRefFrmIdx( pcCU, iRefFrmIdx, uiAbsPartIdx, uiDepth, REF_PIC_LIST_C ); |
---|
427 | } |
---|
428 | else |
---|
429 | { |
---|
430 | iRefFrmIdx=0; |
---|
431 | } |
---|
432 | uiInterDir = pcCU->getSlice()->getListIdFromIdxOfLC(iRefFrmIdx) + 1; |
---|
433 | iRefFrmIdxTemp = pcCU->getSlice()->getRefIdxFromIdxOfLC(iRefFrmIdx); |
---|
434 | eRefListTemp = (RefPicList)pcCU->getSlice()->getListIdFromIdxOfLC(iRefFrmIdx); |
---|
435 | |
---|
436 | pcCU->getCUMvField( eRefListTemp )->setAllRefIdx( iRefFrmIdxTemp, ePartSize, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
437 | |
---|
438 | pcCU->setInterDirSubParts( uiInterDir, uiAbsPartIdx, uiPartIdx, uiDepth ); |
---|
439 | } |
---|
440 | else |
---|
441 | { |
---|
442 | Int iRefFrmIdx = 0; |
---|
443 | Int iParseRefFrmIdx = pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList ); |
---|
444 | |
---|
445 | if ( pcCU->getSlice()->getNumRefIdx( eRefList ) > 1 && iParseRefFrmIdx ) |
---|
446 | { |
---|
447 | m_pcEntropyDecoderIf->parseRefFrmIdx( pcCU, iRefFrmIdx, uiAbsPartIdx, uiDepth, eRefList ); |
---|
448 | } |
---|
449 | else if ( !iParseRefFrmIdx ) |
---|
450 | { |
---|
451 | iRefFrmIdx = NOT_VALID; |
---|
452 | } |
---|
453 | else |
---|
454 | { |
---|
455 | iRefFrmIdx = 0; |
---|
456 | } |
---|
457 | |
---|
458 | PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); |
---|
459 | pcCU->getCUMvField( eRefList )->setAllRefIdx( iRefFrmIdx, ePartSize, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
460 | } |
---|
461 | } |
---|
462 | |
---|
463 | /** decode motion vector difference for a PU block |
---|
464 | * \param pcCU |
---|
465 | * \param uiAbsPartIdx |
---|
466 | * \param uiDepth |
---|
467 | * \param uiPartIdx |
---|
468 | * \param eRefList |
---|
469 | * \returns Void |
---|
470 | */ |
---|
471 | Void TDecEntropy::decodeMvdPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
472 | { |
---|
473 | if ( pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList ) ) |
---|
474 | { |
---|
475 | m_pcEntropyDecoderIf->parseMvd( pcCU, uiAbsPartIdx, uiPartIdx, uiDepth, eRefList ); |
---|
476 | } |
---|
477 | } |
---|
478 | |
---|
479 | Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
480 | { |
---|
481 | Int iMVPIdx = -1; |
---|
482 | |
---|
483 | TComMv cZeroMv( 0, 0 ); |
---|
484 | TComMv cMv = cZeroMv; |
---|
485 | Int iRefIdx = -1; |
---|
486 | |
---|
487 | TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList ); |
---|
488 | AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo(); |
---|
489 | |
---|
490 | iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr); |
---|
491 | cMv = cZeroMv; |
---|
492 | |
---|
493 | if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) && (pcSubCU->getAMVPMode(uiPartAddr) == AM_EXPL) ) |
---|
494 | { |
---|
495 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
496 | const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + ( pcSubCU->getSlice()->getSPS()->getMultiviewMvPredMode() ? 1 : 0 ); |
---|
497 | m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx, iNumAMVPCands ); |
---|
498 | #else |
---|
499 | m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx ); |
---|
500 | #endif |
---|
501 | } |
---|
502 | #if SHARP_INTERVIEW_DECOUPLE_B0111 |
---|
503 | pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo, iMVPIdx); |
---|
504 | #else |
---|
505 | pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo); |
---|
506 | #endif |
---|
507 | pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth); |
---|
508 | pcSubCU->setMVPIdxSubParts( iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth ); |
---|
509 | if ( iRefIdx >= 0 ) |
---|
510 | { |
---|
511 | m_pcPrediction->getMvPredAMVP( pcSubCU, uiPartIdx, uiPartAddr, eRefList, iRefIdx, cMv); |
---|
512 | cMv += pcSubCUMvField->getMvd( uiPartAddr ); |
---|
513 | } |
---|
514 | |
---|
515 | PartSize ePartSize = pcSubCU->getPartitionSize( uiPartAddr ); |
---|
516 | pcSubCU->getCUMvField( eRefList )->setAllMv(cMv, ePartSize, uiPartAddr, 0, uiPartIdx); |
---|
517 | } |
---|
518 | |
---|
519 | #if UNIFIED_TRANSFORM_TREE |
---|
520 | Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP ) |
---|
521 | #else |
---|
522 | Void TDecEntropy::xDecodeTransformSubdiv( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 ) |
---|
523 | #endif |
---|
524 | { |
---|
525 | UInt uiSubdiv; |
---|
526 | const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth; |
---|
527 | |
---|
528 | #if UNIFIED_TRANSFORM_TREE |
---|
529 | if(uiTrIdx==0) |
---|
530 | { |
---|
531 | m_bakAbsPartIdxCU = uiAbsPartIdx; |
---|
532 | } |
---|
533 | if( uiLog2TrafoSize == 2 ) |
---|
534 | { |
---|
535 | UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
---|
536 | if( ( uiAbsPartIdx % partNum ) == 0 ) |
---|
537 | { |
---|
538 | m_uiBakAbsPartIdx = uiAbsPartIdx; |
---|
539 | m_uiBakChromaOffset = offsetChroma; |
---|
540 | } |
---|
541 | } |
---|
542 | #endif // UNIFIED_TRANSFORM_TREE |
---|
543 | if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) ) |
---|
544 | { |
---|
545 | uiSubdiv = 1; |
---|
546 | } |
---|
547 | #if G519_TU_AMP_NSQT_HARMONIZATION |
---|
548 | else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) ) |
---|
549 | #else |
---|
550 | else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) ) |
---|
551 | #endif |
---|
552 | { |
---|
553 | uiSubdiv = (uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx)); |
---|
554 | } |
---|
555 | else if( uiLog2TrafoSize > pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) |
---|
556 | { |
---|
557 | uiSubdiv = 1; |
---|
558 | } |
---|
559 | else if( uiLog2TrafoSize == pcCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) |
---|
560 | { |
---|
561 | uiSubdiv = 0; |
---|
562 | } |
---|
563 | else if( uiLog2TrafoSize == pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ) |
---|
564 | { |
---|
565 | uiSubdiv = 0; |
---|
566 | } |
---|
567 | else |
---|
568 | { |
---|
569 | assert( uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) ); |
---|
570 | m_pcEntropyDecoderIf->parseTransformSubdivFlag( uiSubdiv, uiDepth ); |
---|
571 | } |
---|
572 | |
---|
573 | const UInt uiTrDepth = uiDepth - pcCU->getDepth( uiAbsPartIdx ); |
---|
574 | |
---|
575 | if( uiLog2TrafoSize <= pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) |
---|
576 | { |
---|
577 | const Bool bFirstCbfOfCU = uiLog2TrafoSize == pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() || uiTrDepth == 0; |
---|
578 | if( bFirstCbfOfCU ) |
---|
579 | { |
---|
580 | pcCU->setCbfSubParts( 0, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth ); |
---|
581 | pcCU->setCbfSubParts( 0, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth ); |
---|
582 | } |
---|
583 | if( bFirstCbfOfCU || uiLog2TrafoSize > 2 ) |
---|
584 | { |
---|
585 | if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) ) |
---|
586 | { |
---|
587 | if ( uiInnerQuadIdx == 3 && uiUCbfFront3 == 0 && uiLog2TrafoSize < pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) |
---|
588 | { |
---|
589 | uiUCbfFront3++; |
---|
590 | pcCU->setCbfSubParts( 1 << uiTrDepth, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth ); |
---|
591 | //printf( " \nsave bits, U Cbf"); |
---|
592 | } |
---|
593 | else |
---|
594 | { |
---|
595 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth, uiDepth ); |
---|
596 | uiUCbfFront3 += pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth ); |
---|
597 | } |
---|
598 | } |
---|
599 | if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) ) |
---|
600 | { |
---|
601 | if ( uiInnerQuadIdx == 3 && uiVCbfFront3 == 0 && uiLog2TrafoSize < pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) |
---|
602 | { |
---|
603 | uiVCbfFront3++; |
---|
604 | pcCU->setCbfSubParts( 1 << uiTrDepth, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth ); |
---|
605 | //printf( " \nsave bits, V Cbf"); |
---|
606 | } |
---|
607 | else |
---|
608 | { |
---|
609 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth, uiDepth ); |
---|
610 | uiVCbfFront3 += pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth ); |
---|
611 | } |
---|
612 | } |
---|
613 | } |
---|
614 | else |
---|
615 | { |
---|
616 | pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth ); |
---|
617 | pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth ); |
---|
618 | if ( uiLog2TrafoSize == 2 ) |
---|
619 | { |
---|
620 | uiUCbfFront3 += pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth ); |
---|
621 | uiVCbfFront3 += pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth ); |
---|
622 | } |
---|
623 | } |
---|
624 | } |
---|
625 | |
---|
626 | if( uiSubdiv ) |
---|
627 | { |
---|
628 | #if UNIFIED_TRANSFORM_TREE |
---|
629 | UInt size; |
---|
630 | width >>= 1; |
---|
631 | height >>= 1; |
---|
632 | size = width*height; |
---|
633 | uiTrIdx++; |
---|
634 | #endif |
---|
635 | ++uiDepth; |
---|
636 | const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); |
---|
637 | const UInt uiStartAbsPartIdx = uiAbsPartIdx; |
---|
638 | UInt uiLumaTrMode, uiChromaTrMode; |
---|
639 | pcCU->convertTransIdx( uiStartAbsPartIdx, uiTrDepth+1, uiLumaTrMode, uiChromaTrMode ); |
---|
640 | UInt uiYCbf = 0; |
---|
641 | UInt uiUCbf = 0; |
---|
642 | UInt uiVCbf = 0; |
---|
643 | |
---|
644 | UInt uiCurrentCbfY = 0; |
---|
645 | UInt uiCurrentCbfU = 0; |
---|
646 | UInt uiCurrentCbfV = 0; |
---|
647 | |
---|
648 | for( Int i = 0; i < 4; i++ ) |
---|
649 | { |
---|
650 | #if UNIFIED_TRANSFORM_TREE |
---|
651 | UInt nsAddr = 0; |
---|
652 | nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, i, uiTrDepth+1 ); |
---|
653 | xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, nsAddr, uiDepth, width, height, uiTrIdx, i, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV, bCodeDQP ); |
---|
654 | #else |
---|
655 | UInt nsAddr = 0; |
---|
656 | nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, i, uiTrDepth+1 ); |
---|
657 | xDecodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, i, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV ); |
---|
658 | #endif |
---|
659 | uiYCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiLumaTrMode ); |
---|
660 | uiUCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiChromaTrMode ); |
---|
661 | uiVCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiChromaTrMode ); |
---|
662 | uiAbsPartIdx += uiQPartNum; |
---|
663 | #if UNIFIED_TRANSFORM_TREE |
---|
664 | offsetLuma += size; offsetChroma += (size>>2); |
---|
665 | #endif |
---|
666 | } |
---|
667 | |
---|
668 | uiYCbfFront3 += uiCurrentCbfY; |
---|
669 | uiUCbfFront3 += uiCurrentCbfU; |
---|
670 | uiVCbfFront3 += uiCurrentCbfV; |
---|
671 | |
---|
672 | pcCU->convertTransIdx( uiStartAbsPartIdx, uiTrDepth, uiLumaTrMode, uiChromaTrMode ); |
---|
673 | for( UInt ui = 0; ui < 4 * uiQPartNum; ++ui ) |
---|
674 | { |
---|
675 | pcCU->getCbf( TEXT_LUMA )[uiStartAbsPartIdx + ui] |= uiYCbf << uiLumaTrMode; |
---|
676 | pcCU->getCbf( TEXT_CHROMA_U )[uiStartAbsPartIdx + ui] |= uiUCbf << uiChromaTrMode; |
---|
677 | pcCU->getCbf( TEXT_CHROMA_V )[uiStartAbsPartIdx + ui] |= uiVCbf << uiChromaTrMode; |
---|
678 | } |
---|
679 | } |
---|
680 | else |
---|
681 | { |
---|
682 | assert( uiDepth >= pcCU->getDepth( uiAbsPartIdx ) ); |
---|
683 | pcCU->setTrIdxSubParts( uiTrDepth, uiAbsPartIdx, uiDepth ); |
---|
684 | |
---|
685 | { |
---|
686 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
687 | DTRACE_CABAC_T( "\tTrIdx: abspart=" ); |
---|
688 | DTRACE_CABAC_V( uiAbsPartIdx ); |
---|
689 | DTRACE_CABAC_T( "\tdepth=" ); |
---|
690 | DTRACE_CABAC_V( uiDepth ); |
---|
691 | DTRACE_CABAC_T( "\ttrdepth=" ); |
---|
692 | DTRACE_CABAC_V( uiTrDepth ); |
---|
693 | DTRACE_CABAC_T( "\n" ); |
---|
694 | } |
---|
695 | |
---|
696 | UInt uiLumaTrMode, uiChromaTrMode; |
---|
697 | pcCU->convertTransIdx( uiAbsPartIdx, uiTrDepth, uiLumaTrMode, uiChromaTrMode ); |
---|
698 | if(pcCU->getPredictionMode( uiAbsPartIdx ) == MODE_INTER && pcCU->useNonSquarePU( uiAbsPartIdx ) ) |
---|
699 | { |
---|
700 | pcCU->setNSQTIdxSubParts( uiLog2TrafoSize, uiAbsPartIdx, absTUPartIdx, uiLumaTrMode ); |
---|
701 | } |
---|
702 | pcCU->setCbfSubParts ( 0, TEXT_LUMA, uiAbsPartIdx, uiDepth ); |
---|
703 | if( pcCU->getPredictionMode(uiAbsPartIdx) != MODE_INTRA && uiDepth == pcCU->getDepth( uiAbsPartIdx ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, 0 ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, 0 ) ) |
---|
704 | { |
---|
705 | pcCU->setCbfSubParts( 1 << uiLumaTrMode, TEXT_LUMA, uiAbsPartIdx, uiDepth ); |
---|
706 | } |
---|
707 | else |
---|
708 | { |
---|
709 | const UInt uiLog2CUSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()] + 2 - pcCU->getDepth( uiAbsPartIdx ); |
---|
710 | if ( pcCU->getPredictionMode( uiAbsPartIdx ) != MODE_INTRA && uiInnerQuadIdx == 3 && uiYCbfFront3 == 0 && uiUCbfFront3 == 0 && uiVCbfFront3 == 0 |
---|
711 | && ( uiLog2CUSize <= pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() + 1 || uiLog2TrafoSize < pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) ) |
---|
712 | { |
---|
713 | pcCU->setCbfSubParts( 1 << uiLumaTrMode, TEXT_LUMA, uiAbsPartIdx, uiDepth ); |
---|
714 | //printf( " \nsave bits, Y Cbf"); |
---|
715 | uiYCbfFront3++; |
---|
716 | } |
---|
717 | else |
---|
718 | { |
---|
719 | m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiLumaTrMode, uiDepth ); |
---|
720 | uiYCbfFront3 += pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiLumaTrMode ); |
---|
721 | } |
---|
722 | } |
---|
723 | #if UNIFIED_TRANSFORM_TREE |
---|
724 | // transform_unit begin |
---|
725 | UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA , uiTrIdx ); |
---|
726 | UInt cbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); |
---|
727 | UInt cbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); |
---|
728 | if( uiLog2TrafoSize == 2 ) |
---|
729 | { |
---|
730 | UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
---|
731 | if( ( uiAbsPartIdx % partNum ) == (partNum - 1) ) |
---|
732 | { |
---|
733 | cbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); |
---|
734 | cbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); |
---|
735 | } |
---|
736 | } |
---|
737 | if ( cbfY || cbfU || cbfV ) |
---|
738 | { |
---|
739 | // dQP: only for LCU |
---|
740 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
---|
741 | { |
---|
742 | if ( bCodeDQP ) |
---|
743 | { |
---|
744 | decodeQP( pcCU, m_bakAbsPartIdxCU); |
---|
745 | bCodeDQP = false; |
---|
746 | } |
---|
747 | } |
---|
748 | } |
---|
749 | if( cbfY ) |
---|
750 | { |
---|
751 | Int trWidth = width; |
---|
752 | Int trHeight = height; |
---|
753 | pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight ); |
---|
754 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+offsetLuma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA ); |
---|
755 | } |
---|
756 | if( uiLog2TrafoSize > 2 ) |
---|
757 | { |
---|
758 | Int trWidth = width >> 1; |
---|
759 | Int trHeight = height >> 1; |
---|
760 | pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight ); |
---|
761 | if( cbfU ) |
---|
762 | { |
---|
763 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); |
---|
764 | } |
---|
765 | if( cbfV ) |
---|
766 | { |
---|
767 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); |
---|
768 | } |
---|
769 | } |
---|
770 | else |
---|
771 | { |
---|
772 | UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
---|
773 | if( ( uiAbsPartIdx % partNum ) == (partNum - 1) ) |
---|
774 | { |
---|
775 | Int trWidth = width; |
---|
776 | Int trHeight = height; |
---|
777 | pcCU->getNSQTSize( uiTrIdx - 1, uiAbsPartIdx, trWidth, trHeight ); |
---|
778 | if( cbfU ) |
---|
779 | { |
---|
780 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); |
---|
781 | } |
---|
782 | if( cbfV ) |
---|
783 | { |
---|
784 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); |
---|
785 | } |
---|
786 | } |
---|
787 | } |
---|
788 | // transform_unit end |
---|
789 | #endif // UNIFIED_TRANSFORM_TREE |
---|
790 | } |
---|
791 | } |
---|
792 | |
---|
793 | #if !UNIFIED_TRANSFORM_TREE |
---|
794 | Void TDecEntropy::decodeTransformIdx( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
795 | { |
---|
796 | DTRACE_CABAC_VL( g_nSymbolCounter++ ) |
---|
797 | DTRACE_CABAC_T( "\tdecodeTransformIdx()\tCUDepth=" ) |
---|
798 | DTRACE_CABAC_V( uiDepth ) |
---|
799 | DTRACE_CABAC_T( "\n" ) |
---|
800 | UInt temp = 0; |
---|
801 | UInt temp1 = 0; |
---|
802 | UInt temp2 = 0; |
---|
803 | xDecodeTransformSubdiv( pcCU, uiAbsPartIdx, uiAbsPartIdx, uiDepth, 0, temp, temp1, temp2 ); |
---|
804 | } |
---|
805 | #endif // UNIFIED_TRANSFORM_TREE |
---|
806 | |
---|
807 | #if UNIFIED_TRANSFORM_TREE |
---|
808 | Void TDecEntropy::decodeQP ( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
809 | { |
---|
810 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
---|
811 | { |
---|
812 | m_pcEntropyDecoderIf->parseDeltaQP( pcCU, uiAbsPartIdx, pcCU->getDepth( uiAbsPartIdx ) ); |
---|
813 | } |
---|
814 | } |
---|
815 | #else |
---|
816 | Void TDecEntropy::decodeQP ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
817 | { |
---|
818 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
---|
819 | { |
---|
820 | m_pcEntropyDecoderIf->parseDeltaQP( pcCU, uiAbsPartIdx, uiDepth ); |
---|
821 | } |
---|
822 | } |
---|
823 | #endif |
---|
824 | |
---|
825 | #if !UNIFIED_TRANSFORM_TREE |
---|
826 | Void TDecEntropy::xDecodeCoeff( TComDataCU* pcCU, UInt uiLumaOffset, UInt uiChromaOffset, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, Bool& bCodeDQP ) |
---|
827 | { |
---|
828 | UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiDepth ] + 2; |
---|
829 | UInt uiCbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx ); |
---|
830 | UInt uiCbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); |
---|
831 | UInt uiCbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); |
---|
832 | if( uiLog2TrSize == 2 ) |
---|
833 | { |
---|
834 | UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
---|
835 | if( ( uiAbsPartIdx % uiQPDiv ) == 0 ) |
---|
836 | { |
---|
837 | m_uiBakAbsPartIdx = uiAbsPartIdx; |
---|
838 | m_uiBakChromaOffset = uiChromaOffset; |
---|
839 | } |
---|
840 | else if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) ) |
---|
841 | { |
---|
842 | uiCbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ); |
---|
843 | uiCbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ); |
---|
844 | } |
---|
845 | } |
---|
846 | |
---|
847 | if ( uiCbfY || uiCbfU || uiCbfV ) |
---|
848 | { |
---|
849 | // dQP: only for LCU |
---|
850 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
---|
851 | { |
---|
852 | if ( bCodeDQP ) |
---|
853 | { |
---|
854 | decodeQP( pcCU, uiAbsPartIdx, uiDepth); |
---|
855 | bCodeDQP = false; |
---|
856 | } |
---|
857 | } |
---|
858 | UInt uiLumaTrMode, uiChromaTrMode; |
---|
859 | pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode ); |
---|
860 | const UInt uiStopTrMode = uiLumaTrMode; |
---|
861 | |
---|
862 | if( uiTrIdx == uiStopTrMode ) |
---|
863 | { |
---|
864 | if( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx ) ) |
---|
865 | { |
---|
866 | Int trWidth = uiWidth; |
---|
867 | Int trHeight = uiHeight; |
---|
868 | pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight ); |
---|
869 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+uiLumaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA ); |
---|
870 | } |
---|
871 | |
---|
872 | uiWidth >>= 1; |
---|
873 | uiHeight >>= 1; |
---|
874 | |
---|
875 | if( uiLog2TrSize == 2 ) |
---|
876 | { |
---|
877 | UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 ); |
---|
878 | if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) ) |
---|
879 | { |
---|
880 | uiWidth <<= 1; |
---|
881 | uiHeight <<= 1; |
---|
882 | Int trWidth = uiWidth; |
---|
883 | Int trHeight = uiHeight; |
---|
884 | pcCU->getNSQTSize( uiTrIdx-1, uiAbsPartIdx, trWidth, trHeight ); |
---|
885 | if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) ) |
---|
886 | { |
---|
887 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); |
---|
888 | } |
---|
889 | if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) ) |
---|
890 | { |
---|
891 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); |
---|
892 | } |
---|
893 | } |
---|
894 | } |
---|
895 | else |
---|
896 | { |
---|
897 | Int trWidth = uiWidth; |
---|
898 | Int trHeight = uiHeight; |
---|
899 | pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight ); |
---|
900 | if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) ) |
---|
901 | { |
---|
902 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U ); |
---|
903 | } |
---|
904 | if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) ) |
---|
905 | { |
---|
906 | m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V ); |
---|
907 | } |
---|
908 | } |
---|
909 | } |
---|
910 | else |
---|
911 | { |
---|
912 | { |
---|
913 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
914 | DTRACE_CABAC_T( "\tgoing down\tdepth=" ); |
---|
915 | DTRACE_CABAC_V( uiDepth ); |
---|
916 | DTRACE_CABAC_T( "\ttridx=" ); |
---|
917 | DTRACE_CABAC_V( uiTrIdx ); |
---|
918 | DTRACE_CABAC_T( "\n" ); |
---|
919 | } |
---|
920 | if( uiCurrTrIdx <= uiTrIdx ) |
---|
921 | { |
---|
922 | assert(1); |
---|
923 | } |
---|
924 | UInt uiSize; |
---|
925 | uiWidth >>= 1; |
---|
926 | uiHeight >>= 1; |
---|
927 | uiSize = uiWidth*uiHeight; |
---|
928 | uiDepth++; |
---|
929 | uiTrIdx++; |
---|
930 | |
---|
931 | UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1); |
---|
932 | UInt uiIdx = uiAbsPartIdx; |
---|
933 | |
---|
934 | xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP ); |
---|
935 | uiLumaOffset += uiSize; uiChromaOffset += (uiSize>>2); uiIdx += uiQPartNum; |
---|
936 | |
---|
937 | xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP ); |
---|
938 | uiLumaOffset += uiSize; uiChromaOffset += (uiSize>>2); uiIdx += uiQPartNum; |
---|
939 | |
---|
940 | xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP ); |
---|
941 | uiLumaOffset += uiSize; uiChromaOffset += (uiSize>>2); uiIdx += uiQPartNum; |
---|
942 | |
---|
943 | xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP ); |
---|
944 | { |
---|
945 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
946 | DTRACE_CABAC_T( "\tgoing up\n" ); |
---|
947 | } |
---|
948 | } |
---|
949 | } |
---|
950 | } |
---|
951 | #endif // !UNIFIED_TRANSFORM_TREE |
---|
952 | |
---|
953 | /** decode coefficients |
---|
954 | * \param pcCU |
---|
955 | * \param uiAbsPartIdx |
---|
956 | * \param uiDepth |
---|
957 | * \param uiWidth |
---|
958 | * \param uiHeight |
---|
959 | * \returns Void |
---|
960 | */ |
---|
961 | Void TDecEntropy::decodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP ) |
---|
962 | { |
---|
963 | UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight(); |
---|
964 | UInt uiLumaOffset = uiMinCoeffSize*uiAbsPartIdx; |
---|
965 | UInt uiChromaOffset = uiLumaOffset>>2; |
---|
966 | #if UNIFIED_TRANSFORM_TREE |
---|
967 | UInt temp = 0; |
---|
968 | UInt temp1 = 0; |
---|
969 | UInt temp2 = 0; |
---|
970 | #else |
---|
971 | UInt uiLumaTrMode, uiChromaTrMode; |
---|
972 | #endif |
---|
973 | |
---|
974 | #if RWTH_SDC_DLT_B0036 |
---|
975 | if( pcCU->getSDCAvailable(uiAbsPartIdx) && pcCU->getSDCFlag( uiAbsPartIdx ) ) |
---|
976 | { |
---|
977 | assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); |
---|
978 | assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 ); |
---|
979 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 ); |
---|
980 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 ); |
---|
981 | assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 ); |
---|
982 | |
---|
983 | decodeSDCResidualData(pcCU, uiAbsPartIdx, uiDepth); |
---|
984 | return; |
---|
985 | } |
---|
986 | #endif |
---|
987 | |
---|
988 | if( pcCU->isIntra(uiAbsPartIdx) ) |
---|
989 | { |
---|
990 | #if !UNIFIED_TRANSFORM_TREE |
---|
991 | decodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) ); |
---|
992 | |
---|
993 | pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx(uiAbsPartIdx), uiLumaTrMode, uiChromaTrMode ); |
---|
994 | |
---|
995 | #endif // !UNIFIED_TRANSFORM_TREE |
---|
996 | } |
---|
997 | else |
---|
998 | { |
---|
999 | UInt uiQtRootCbf = 1; |
---|
1000 | #if HHI_MPI |
---|
1001 | if( !(pcCU->getMergeFlag( uiAbsPartIdx ) && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N && |
---|
1002 | ( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth == pcCU->getTextureModeDepth( uiAbsPartIdx ) ) ) ) |
---|
1003 | #else |
---|
1004 | if( !( pcCU->getPartitionSize( uiAbsPartIdx) == SIZE_2Nx2N && pcCU->getMergeFlag( uiAbsPartIdx ) ) ) |
---|
1005 | #endif |
---|
1006 | { |
---|
1007 | m_pcEntropyDecoderIf->parseQtRootCbf( pcCU, uiAbsPartIdx, uiDepth, uiQtRootCbf ); |
---|
1008 | } |
---|
1009 | if ( !uiQtRootCbf ) |
---|
1010 | { |
---|
1011 | pcCU->setCbfSubParts( 0, 0, 0, uiAbsPartIdx, uiDepth ); |
---|
1012 | pcCU->setTrIdxSubParts( 0 , uiAbsPartIdx, uiDepth ); |
---|
1013 | pcCU->setNSQTIdxSubParts( uiAbsPartIdx, uiDepth ); |
---|
1014 | return; |
---|
1015 | } |
---|
1016 | |
---|
1017 | #if !UNIFIED_TRANSFORM_TREE |
---|
1018 | decodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) ); |
---|
1019 | |
---|
1020 | pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx(uiAbsPartIdx), uiLumaTrMode, uiChromaTrMode ); |
---|
1021 | #endif // !UNIFIED_TRANSFORM_TREE |
---|
1022 | } |
---|
1023 | |
---|
1024 | #if FIX_MPI_B0065 |
---|
1025 | if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER && pcCU->getMergeFlag( uiAbsPartIdx ) && pcCU->getMergeIndex( uiAbsPartIdx ) == 0 && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N && pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1 ) |
---|
1026 | { |
---|
1027 | TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() ); |
---|
1028 | if( uiDepth == pcTextureCU->getDepth(uiAbsPartIdx)) |
---|
1029 | { |
---|
1030 | PartSize partSize = pcTextureCU->getPartitionSize(uiAbsPartIdx); |
---|
1031 | pcCU->setPartSizeSubParts( partSize, uiAbsPartIdx, uiDepth ); |
---|
1032 | } |
---|
1033 | else |
---|
1034 | { |
---|
1035 | pcCU->setPartSizeSubParts( SIZE_NxN, uiAbsPartIdx, uiDepth ); |
---|
1036 | } |
---|
1037 | } |
---|
1038 | #endif |
---|
1039 | |
---|
1040 | #if UNIFIED_TRANSFORM_TREE |
---|
1041 | xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, 0, temp, temp1, temp2, bCodeDQP ); |
---|
1042 | #else // UNIFIED_TRANSFORM_TREE |
---|
1043 | xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, uiLumaTrMode, bCodeDQP ); |
---|
1044 | #endif // UNIFIED_TRANSFORM_TREE |
---|
1045 | |
---|
1046 | #if FIX_MPI_B0065 |
---|
1047 | if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER && pcCU->getMergeFlag( uiAbsPartIdx ) && pcCU->getMergeIndex( uiAbsPartIdx ) == 0 && pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N && pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1 ) |
---|
1048 | { |
---|
1049 | pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth ); |
---|
1050 | } |
---|
1051 | #endif |
---|
1052 | } |
---|
1053 | |
---|
1054 | #if RWTH_SDC_DLT_B0036 |
---|
1055 | Void TDecEntropy::decodeSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1056 | { |
---|
1057 | assert( pcCU->getSlice()->getSPS()->isDepth() ); |
---|
1058 | assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); |
---|
1059 | |
---|
1060 | m_pcEntropyDecoderIf->parseSDCPredMode(pcCU, uiAbsPartIdx, uiDepth ); |
---|
1061 | } |
---|
1062 | |
---|
1063 | Void TDecEntropy::decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1064 | { |
---|
1065 | assert( pcCU->getSlice()->getSPS()->isDepth() ); |
---|
1066 | |
---|
1067 | m_pcEntropyDecoderIf->parseSDCFlag(pcCU, uiAbsPartIdx, uiDepth ); |
---|
1068 | } |
---|
1069 | |
---|
1070 | Void TDecEntropy::decodeSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1071 | { |
---|
1072 | assert( pcCU->getSlice()->getSPS()->isDepth() ); |
---|
1073 | assert( pcCU->getSDCFlag(uiAbsPartIdx) ); |
---|
1074 | |
---|
1075 | // number of segments depends on prediction mode for INTRA |
---|
1076 | UInt uiNumSegments = 2; |
---|
1077 | UInt uiLumaPredMode = pcCU->getLumaIntraDir( uiAbsPartIdx ); |
---|
1078 | if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && (uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX) ) |
---|
1079 | uiNumSegments = 1; |
---|
1080 | |
---|
1081 | // decode residual data for each segment |
---|
1082 | for( UInt uiSeg = 0; uiSeg < uiNumSegments; uiSeg++ ) |
---|
1083 | m_pcEntropyDecoderIf->parseSDCResidualData(pcCU, uiAbsPartIdx, uiDepth, uiSeg); |
---|
1084 | } |
---|
1085 | #endif |
---|
1086 | |
---|
1087 | //! \} |
---|