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