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-2015, 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 | #include "TLibCommon/TComTU.h" |
---|
40 | #include "TLibCommon/TComPrediction.h" |
---|
41 | |
---|
42 | #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST |
---|
43 | #include "../TLibCommon/Debug.h" |
---|
44 | static const Bool bDebugRQT = DebugOptionList::DebugRQT.getInt()!=0; |
---|
45 | static const Bool bDebugPredEnabled = DebugOptionList::DebugPred.getInt()!=0; |
---|
46 | #endif |
---|
47 | |
---|
48 | //! \ingroup TLibDecoder |
---|
49 | //! \{ |
---|
50 | |
---|
51 | Void TDecEntropy::setEntropyDecoder ( TDecEntropyIf* p ) |
---|
52 | { |
---|
53 | m_pcEntropyDecoderIf = p; |
---|
54 | } |
---|
55 | |
---|
56 | #include "TLibCommon/TComSampleAdaptiveOffset.h" |
---|
57 | |
---|
58 | Void TDecEntropy::decodeSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
59 | { |
---|
60 | m_pcEntropyDecoderIf->parseSkipFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
61 | } |
---|
62 | #if NH_3D_DIS |
---|
63 | Void TDecEntropy::decodeDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
64 | { |
---|
65 | if( !pcCU->getSlice()->getDepthIntraSkipFlag() ) |
---|
66 | { |
---|
67 | return; |
---|
68 | } |
---|
69 | m_pcEntropyDecoderIf->parseDIS( pcCU, uiAbsPartIdx, uiDepth ); |
---|
70 | } |
---|
71 | #endif |
---|
72 | |
---|
73 | Void TDecEntropy::decodeCUTransquantBypassFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
74 | { |
---|
75 | m_pcEntropyDecoderIf->parseCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
76 | } |
---|
77 | |
---|
78 | |
---|
79 | /** decode merge flag |
---|
80 | * \param pcSubCU |
---|
81 | * \param uiAbsPartIdx |
---|
82 | * \param uiDepth |
---|
83 | * \param uiPUIdx |
---|
84 | * \returns Void |
---|
85 | */ |
---|
86 | Void TDecEntropy::decodeMergeFlag( TComDataCU* pcSubCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx ) |
---|
87 | { |
---|
88 | // at least one merge candidate exists |
---|
89 | m_pcEntropyDecoderIf->parseMergeFlag( pcSubCU, uiAbsPartIdx, uiDepth, uiPUIdx ); |
---|
90 | } |
---|
91 | |
---|
92 | /** decode merge index |
---|
93 | * \param pcCU |
---|
94 | * \param uiPartIdx |
---|
95 | * \param uiAbsPartIdx |
---|
96 | * \param uiDepth |
---|
97 | * \returns Void |
---|
98 | */ |
---|
99 | Void TDecEntropy::decodeMergeIndex( TComDataCU* pcCU, UInt uiPartIdx, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
100 | { |
---|
101 | UInt uiMergeIndex = 0; |
---|
102 | m_pcEntropyDecoderIf->parseMergeIndex( pcCU, uiMergeIndex ); |
---|
103 | pcCU->setMergeIndexSubParts( uiMergeIndex, uiAbsPartIdx, uiPartIdx, uiDepth ); |
---|
104 | } |
---|
105 | |
---|
106 | #if NH_3D_ARP |
---|
107 | Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
108 | { |
---|
109 | if( !pcCU->getSlice()->getARPStepNum() || pcCU->isIntra( uiAbsPartIdx ) ) |
---|
110 | { |
---|
111 | return; |
---|
112 | } |
---|
113 | |
---|
114 | if( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) |
---|
115 | { |
---|
116 | pcCU->setARPWSubParts( 0 , uiAbsPartIdx, uiDepth ); |
---|
117 | } |
---|
118 | else |
---|
119 | { |
---|
120 | m_pcEntropyDecoderIf->parseARPW( pcCU , uiAbsPartIdx , uiDepth ); |
---|
121 | } |
---|
122 | } |
---|
123 | #endif |
---|
124 | |
---|
125 | #if NH_3D_IC |
---|
126 | Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
127 | { |
---|
128 | pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth ); |
---|
129 | |
---|
130 | #if NH_3D_ARP |
---|
131 | if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 ) |
---|
132 | #else |
---|
133 | if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() ) |
---|
134 | #endif |
---|
135 | { |
---|
136 | return; |
---|
137 | } |
---|
138 | |
---|
139 | if( !pcCU->getSlice()->getApplyIC() ) |
---|
140 | return; |
---|
141 | |
---|
142 | if( pcCU->isICFlagRequired( uiAbsPartIdx ) ) |
---|
143 | m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
144 | } |
---|
145 | #endif |
---|
146 | |
---|
147 | Void TDecEntropy::decodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
148 | { |
---|
149 | m_pcEntropyDecoderIf->parseSplitFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
150 | } |
---|
151 | |
---|
152 | Void TDecEntropy::decodePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
153 | { |
---|
154 | m_pcEntropyDecoderIf->parsePredMode( pcCU, uiAbsPartIdx, uiDepth ); |
---|
155 | } |
---|
156 | |
---|
157 | Void TDecEntropy::decodePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
158 | { |
---|
159 | m_pcEntropyDecoderIf->parsePartSize( pcCU, uiAbsPartIdx, uiDepth ); |
---|
160 | } |
---|
161 | |
---|
162 | Void TDecEntropy::decodePredInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ) |
---|
163 | { |
---|
164 | if( pcCU->isIntra( uiAbsPartIdx ) ) // If it is Intra mode, encode intra prediction mode. |
---|
165 | { |
---|
166 | decodeIntraDirModeLuma ( pcCU, uiAbsPartIdx, uiDepth ); |
---|
167 | #if NH_3D_SDC_INTRA |
---|
168 | decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth ); |
---|
169 | #endif |
---|
170 | if (pcCU->getPic()->getChromaFormat()!=CHROMA_400) |
---|
171 | { |
---|
172 | decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth ); |
---|
173 | if (enable4ChromaPUsInIntraNxNCU(pcCU->getPic()->getChromaFormat()) && pcCU->getPartitionSize( uiAbsPartIdx )==SIZE_NxN) |
---|
174 | { |
---|
175 | UInt uiPartOffset = ( pcCU->getPic()->getNumPartitionsInCtu() >> ( pcCU->getDepth(uiAbsPartIdx) << 1 ) ) >> 2; |
---|
176 | decodeIntraDirModeChroma( pcCU, uiAbsPartIdx + uiPartOffset, uiDepth+1 ); |
---|
177 | decodeIntraDirModeChroma( pcCU, uiAbsPartIdx + uiPartOffset*2, uiDepth+1 ); |
---|
178 | decodeIntraDirModeChroma( pcCU, uiAbsPartIdx + uiPartOffset*3, uiDepth+1 ); |
---|
179 | } |
---|
180 | } |
---|
181 | } |
---|
182 | else // if it is Inter mode, encode motion vector and reference index |
---|
183 | { |
---|
184 | decodePUWise( pcCU, uiAbsPartIdx, uiDepth, pcSubCU ); |
---|
185 | } |
---|
186 | } |
---|
187 | |
---|
188 | /** Parse I_PCM information. |
---|
189 | * \param pcCU pointer to CUpointer to CU |
---|
190 | * \param uiAbsPartIdx CU index |
---|
191 | * \param uiDepth CU depth |
---|
192 | * \returns Void |
---|
193 | */ |
---|
194 | Void TDecEntropy::decodeIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
195 | { |
---|
196 | if(!pcCU->getSlice()->getSPS()->getUsePCM() |
---|
197 | || pcCU->getWidth(uiAbsPartIdx) > (1<<pcCU->getSlice()->getSPS()->getPCMLog2MaxSize()) |
---|
198 | || pcCU->getWidth(uiAbsPartIdx) < (1<<pcCU->getSlice()->getSPS()->getPCMLog2MinSize()) ) |
---|
199 | { |
---|
200 | return; |
---|
201 | } |
---|
202 | |
---|
203 | m_pcEntropyDecoderIf->parseIPCMInfo( pcCU, uiAbsPartIdx, uiDepth ); |
---|
204 | } |
---|
205 | |
---|
206 | Void TDecEntropy::decodeIntraDirModeLuma ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
207 | { |
---|
208 | m_pcEntropyDecoderIf->parseIntraDirLumaAng( pcCU, uiAbsPartIdx, uiDepth ); |
---|
209 | } |
---|
210 | |
---|
211 | Void TDecEntropy::decodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
212 | { |
---|
213 | m_pcEntropyDecoderIf->parseIntraDirChroma( pcCU, uiAbsPartIdx, uiDepth ); |
---|
214 | #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST |
---|
215 | if (bDebugPredEnabled) |
---|
216 | { |
---|
217 | UInt cdir=pcCU->getIntraDir(CHANNEL_TYPE_CHROMA, uiAbsPartIdx); |
---|
218 | if (cdir==36) |
---|
219 | { |
---|
220 | cdir=pcCU->getIntraDir(CHANNEL_TYPE_LUMA, uiAbsPartIdx); |
---|
221 | } |
---|
222 | printf("coding chroma Intra dir: %d, uiAbsPartIdx: %d, luma dir: %d\n", cdir, uiAbsPartIdx, pcCU->getIntraDir(CHANNEL_TYPE_LUMA, uiAbsPartIdx)); |
---|
223 | } |
---|
224 | #endif |
---|
225 | } |
---|
226 | |
---|
227 | |
---|
228 | /** decode motion information for every PU block. |
---|
229 | * \param pcCU |
---|
230 | * \param uiAbsPartIdx |
---|
231 | * \param uiDepth |
---|
232 | * \param pcSubCU |
---|
233 | * \returns Void |
---|
234 | */ |
---|
235 | Void TDecEntropy::decodePUWise( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU ) |
---|
236 | { |
---|
237 | PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); |
---|
238 | UInt uiNumPU = ( ePartSize == SIZE_2Nx2N ? 1 : ( ePartSize == SIZE_NxN ? 4 : 2 ) ); |
---|
239 | UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxTotalCUDepth() - uiDepth ) << 1 ) ) >> 4; |
---|
240 | |
---|
241 | #if NH_3D_MLC |
---|
242 | //#if H_3D_IV_MERGE |
---|
243 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists |
---|
244 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; |
---|
245 | #else |
---|
246 | TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists |
---|
247 | UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS]; |
---|
248 | #endif |
---|
249 | #if NH_3D_SPIVMP |
---|
250 | Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM]; |
---|
251 | TComMvField* pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()*2]; |
---|
252 | UChar* puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartitionsInCtu()]; |
---|
253 | #endif |
---|
254 | #if NH_3D_IV_MERGE |
---|
255 | pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx); |
---|
256 | #endif |
---|
257 | for ( UInt ui = 0; ui < pcCU->getSlice()->getMaxNumMergeCand(); ui++ ) |
---|
258 | { |
---|
259 | uhInterDirNeighbours[ui] = 0; |
---|
260 | } |
---|
261 | Int numValidMergeCand = 0; |
---|
262 | Bool hasMergedCandList = false; |
---|
263 | |
---|
264 | pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 ); |
---|
265 | pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 ); |
---|
266 | #if NH_3D |
---|
267 | for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) |
---|
268 | { |
---|
269 | #if NH_MV_ENC_DEC_TRAC |
---|
270 | DTRACE_PU_S("=========== prediction_unit ===========\n") |
---|
271 | // ToDo: |
---|
272 | //DTRACE_PU("x0", uiLPelX) |
---|
273 | //DTRACE_PU("x1", uiTPelY) |
---|
274 | #endif |
---|
275 | |
---|
276 | ////// Parse PUs syntax |
---|
277 | decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
278 | if ( pcCU->getMergeFlag( uiSubPartIdx ) ) |
---|
279 | { |
---|
280 | decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth ); |
---|
281 | } |
---|
282 | else |
---|
283 | { |
---|
284 | decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
285 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
286 | { |
---|
287 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
288 | { |
---|
289 | decodeRefFrmIdxPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
290 | decodeMvdPU ( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
291 | decodeMVPIdxPU ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
292 | } |
---|
293 | } |
---|
294 | } |
---|
295 | } |
---|
296 | |
---|
297 | ////// Parse CUs extension syntax |
---|
298 | #if NH_3D_DBBP |
---|
299 | decodeDBBPFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
300 | #endif |
---|
301 | #if NH_3D_SDC_INTER |
---|
302 | decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth ); |
---|
303 | #endif |
---|
304 | #if NH_3D_ARP |
---|
305 | decodeARPW ( pcCU, uiAbsPartIdx, uiDepth ); |
---|
306 | #endif |
---|
307 | #if NH_3D_IC |
---|
308 | decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
309 | #endif |
---|
310 | |
---|
311 | ////// Decode motion vectors |
---|
312 | for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) |
---|
313 | { |
---|
314 | if ( pcCU->getMergeFlag( uiSubPartIdx ) ) |
---|
315 | { |
---|
316 | UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
---|
317 | #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST |
---|
318 | if (bDebugPredEnabled) |
---|
319 | { |
---|
320 | std::cout << "Coded merge flag, CU absPartIdx: " << uiAbsPartIdx << " PU(" << uiPartIdx << ") absPartIdx: " << uiSubPartIdx; |
---|
321 | std::cout << " merge index: " << (UInt)pcCU->getMergeIndex(uiSubPartIdx) << std::endl; |
---|
322 | } |
---|
323 | #endif |
---|
324 | |
---|
325 | #if NH_3D_DBBP |
---|
326 | if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false ) |
---|
327 | #else |
---|
328 | if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) |
---|
329 | #endif |
---|
330 | { |
---|
331 | if ( !hasMergedCandList ) |
---|
332 | { |
---|
333 | pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set. |
---|
334 | |
---|
335 | #if NH_3D_MLC |
---|
336 | #if NH_3D_VSP |
---|
337 | Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; |
---|
338 | memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); |
---|
339 | #endif |
---|
340 | #if NH_3D_SPIVMP |
---|
341 | memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); |
---|
342 | #endif |
---|
343 | pcSubCU->initAvailableFlags(); |
---|
344 | #endif |
---|
345 | pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); |
---|
346 | #if NH_3D_MLC |
---|
347 | pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours |
---|
348 | #if NH_3D_SPIVMP |
---|
349 | , pcMvFieldSP, puhInterDirSP |
---|
350 | #endif |
---|
351 | , numValidMergeCand ); |
---|
352 | pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours |
---|
353 | #if NH_3D_VSP |
---|
354 | , vspFlag |
---|
355 | #endif |
---|
356 | #if NH_3D_SPIVMP |
---|
357 | , bSPIVMPFlag |
---|
358 | #endif |
---|
359 | , numValidMergeCand ); |
---|
360 | #if NH_3D_VSP |
---|
361 | pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
362 | #endif |
---|
363 | #endif |
---|
364 | pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); // restore. |
---|
365 | hasMergedCandList = true; |
---|
366 | } |
---|
367 | } |
---|
368 | else |
---|
369 | { |
---|
370 | #if NH_3D_MLC |
---|
371 | #if NH_3D_VSP |
---|
372 | Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; |
---|
373 | memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); |
---|
374 | #endif |
---|
375 | #if NH_3D_SPIVMP |
---|
376 | memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); |
---|
377 | #endif |
---|
378 | pcSubCU->initAvailableFlags(); |
---|
379 | #endif |
---|
380 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
---|
381 | #if NH_3D_MLC |
---|
382 | pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours |
---|
383 | #if NH_3D_SPIVMP |
---|
384 | , pcMvFieldSP, puhInterDirSP |
---|
385 | #endif |
---|
386 | ,numValidMergeCand, uiMergeIndex ); |
---|
387 | pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours |
---|
388 | #if NH_3D_VSP |
---|
389 | , vspFlag |
---|
390 | #endif |
---|
391 | #if NH_3D_SPIVMP |
---|
392 | , bSPIVMPFlag |
---|
393 | #endif |
---|
394 | ,numValidMergeCand ); |
---|
395 | #if NH_3D_VSP |
---|
396 | pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
397 | #endif |
---|
398 | #endif |
---|
399 | } |
---|
400 | pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
401 | |
---|
402 | TComMv cTmpMv( 0, 0 ); |
---|
403 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
404 | { |
---|
405 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
406 | { |
---|
407 | pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
---|
408 | pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
---|
409 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
410 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
411 | #if NH_3D_VSP |
---|
412 | #if NH_3D_DBBP |
---|
413 | if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 && !pcCU->getDBBPFlag( uiAbsPartIdx ) ) |
---|
414 | #else |
---|
415 | if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 ) |
---|
416 | #endif |
---|
417 | { |
---|
418 | if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) ) |
---|
419 | { |
---|
420 | UInt dummy; |
---|
421 | Int vspSize; |
---|
422 | Int width, height; |
---|
423 | pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 ); |
---|
424 | pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize ); |
---|
425 | pcCU->setVSPFlag( uiSubPartIdx, vspSize ); |
---|
426 | } |
---|
427 | } |
---|
428 | #endif |
---|
429 | } |
---|
430 | } |
---|
431 | #if NH_3D_SPIVMP |
---|
432 | pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
433 | if (bSPIVMPFlag[uiMergeIndex] != 0) |
---|
434 | { |
---|
435 | Int iWidth, iHeight; |
---|
436 | UInt uiIdx; |
---|
437 | pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true ); |
---|
438 | |
---|
439 | UInt uiSPAddr; |
---|
440 | |
---|
441 | Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; |
---|
442 | |
---|
443 | pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); |
---|
444 | |
---|
445 | for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++) |
---|
446 | { |
---|
447 | pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr); |
---|
448 | pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight); |
---|
449 | pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight); |
---|
450 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight); |
---|
451 | } |
---|
452 | } |
---|
453 | #endif |
---|
454 | } |
---|
455 | else |
---|
456 | { |
---|
457 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
458 | { |
---|
459 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
460 | { |
---|
461 | decodeMvsAMVP ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
462 | #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST |
---|
463 | if (bDebugPredEnabled) |
---|
464 | { |
---|
465 | std::cout << "refListIdx: " << uiRefListIdx << std::endl; |
---|
466 | std::cout << "MVD horizontal: " << pcCU->getCUMvField(RefPicList(uiRefListIdx))->getMvd( uiAbsPartIdx ).getHor() << std::endl; |
---|
467 | std::cout << "MVD vertical: " << pcCU->getCUMvField(RefPicList(uiRefListIdx))->getMvd( uiAbsPartIdx ).getVer() << std::endl; |
---|
468 | std::cout << "MVPIdxPU: " << pcCU->getMVPIdx(RefPicList( uiRefListIdx ), uiSubPartIdx) << std::endl; |
---|
469 | std::cout << "InterDir: " << (UInt)pcCU->getInterDir(uiSubPartIdx) << std::endl; |
---|
470 | } |
---|
471 | #endif |
---|
472 | } |
---|
473 | } |
---|
474 | } |
---|
475 | |
---|
476 | if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) ) |
---|
477 | { |
---|
478 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( TComMv(0,0), ePartSize, uiSubPartIdx, uiDepth, uiPartIdx); |
---|
479 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( -1, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx); |
---|
480 | pcCU->setInterDirSubParts( 1, uiSubPartIdx, uiPartIdx, uiDepth); |
---|
481 | } |
---|
482 | } |
---|
483 | #else |
---|
484 | for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset ) |
---|
485 | { |
---|
486 | #if NH_MV_ENC_DEC_TRAC |
---|
487 | DTRACE_PU_S("=========== prediction_unit ===========\n") |
---|
488 | // ToDo: |
---|
489 | //DTRACE_PU("x0", uiLPelX) |
---|
490 | //DTRACE_PU("x1", uiTPelY) |
---|
491 | #endif |
---|
492 | decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
493 | if ( pcCU->getMergeFlag( uiSubPartIdx ) ) |
---|
494 | { |
---|
495 | decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth ); |
---|
496 | #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST |
---|
497 | if (bDebugPredEnabled) |
---|
498 | { |
---|
499 | std::cout << "Coded merge flag, CU absPartIdx: " << uiAbsPartIdx << " PU(" << uiPartIdx << ") absPartIdx: " << uiSubPartIdx; |
---|
500 | std::cout << " merge index: " << (UInt)pcCU->getMergeIndex(uiSubPartIdx) << std::endl; |
---|
501 | } |
---|
502 | #endif |
---|
503 | #if NH_3D_IC |
---|
504 | decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
505 | #endif |
---|
506 | |
---|
507 | const UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx); |
---|
508 | if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) |
---|
509 | { |
---|
510 | if ( !hasMergedCandList ) |
---|
511 | { |
---|
512 | pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set. |
---|
513 | |
---|
514 | #if NH_3D_MLC |
---|
515 | #if NH_3D_VSP |
---|
516 | Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; |
---|
517 | memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); |
---|
518 | #endif |
---|
519 | #if NH_3D_SPIVMP |
---|
520 | memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); |
---|
521 | #endif |
---|
522 | pcSubCU->initAvailableFlags(); |
---|
523 | #endif |
---|
524 | pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); |
---|
525 | #if NH_3D_MLC |
---|
526 | pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours |
---|
527 | #if NH_3D_SPIVMP |
---|
528 | , pcMvFieldSP, puhInterDirSP |
---|
529 | #endif |
---|
530 | , numValidMergeCand ); |
---|
531 | pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours |
---|
532 | #if NH_3D_VSP |
---|
533 | , vspFlag |
---|
534 | #endif |
---|
535 | #if NH_3D_SPIVMP |
---|
536 | , bSPIVMPFlag |
---|
537 | #endif |
---|
538 | , numValidMergeCand ); |
---|
539 | #if NH_3D_VSP |
---|
540 | pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
541 | #endif |
---|
542 | #endif |
---|
543 | pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth ); // restore. |
---|
544 | hasMergedCandList = true; |
---|
545 | } |
---|
546 | } |
---|
547 | else |
---|
548 | { |
---|
549 | |
---|
550 | #if NH_3D_MLC |
---|
551 | #if NH_3D_VSP |
---|
552 | Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; |
---|
553 | memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); |
---|
554 | #endif |
---|
555 | #if NH_3D_SPIVMP |
---|
556 | memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); |
---|
557 | #endif |
---|
558 | pcSubCU->initAvailableFlags(); |
---|
559 | #endif |
---|
560 | pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex ); |
---|
561 | #if NH_3D_MLC |
---|
562 | pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours |
---|
563 | #if NH_3D_SPIVMP |
---|
564 | , pcMvFieldSP, puhInterDirSP |
---|
565 | #endif |
---|
566 | ,numValidMergeCand, uiMergeIndex ); |
---|
567 | pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours |
---|
568 | #if NH_3D_VSP |
---|
569 | , vspFlag |
---|
570 | #endif |
---|
571 | #if NH_3D_SPIVMP |
---|
572 | , bSPIVMPFlag |
---|
573 | #endif |
---|
574 | ,numValidMergeCand ); |
---|
575 | #if NH_3D_VSP |
---|
576 | pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
577 | #endif |
---|
578 | #endif |
---|
579 | } |
---|
580 | |
---|
581 | pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
582 | |
---|
583 | TComMv cTmpMv( 0, 0 ); |
---|
584 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
585 | { |
---|
586 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
587 | { |
---|
588 | pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
---|
589 | pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth); |
---|
590 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
591 | pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
592 | #if NH_3D_VSP |
---|
593 | if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 ) |
---|
594 | { |
---|
595 | if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) ) |
---|
596 | { |
---|
597 | UInt dummy; |
---|
598 | Int vspSize; |
---|
599 | Int width, height; |
---|
600 | pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 ); |
---|
601 | pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize ); |
---|
602 | pcCU->setVSPFlag( uiSubPartIdx, vspSize ); |
---|
603 | } |
---|
604 | } |
---|
605 | #endif |
---|
606 | } |
---|
607 | } |
---|
608 | #if NH_3D_SPIVMP |
---|
609 | pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); |
---|
610 | if (bSPIVMPFlag[uiMergeIndex] != 0) |
---|
611 | { |
---|
612 | Int iWidth, iHeight; |
---|
613 | UInt uiIdx; |
---|
614 | pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true ); |
---|
615 | |
---|
616 | UInt uiSPAddr; |
---|
617 | |
---|
618 | Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight; |
---|
619 | |
---|
620 | pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight); |
---|
621 | |
---|
622 | for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++) |
---|
623 | { |
---|
624 | pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr); |
---|
625 | pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight); |
---|
626 | pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight); |
---|
627 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight); |
---|
628 | } |
---|
629 | } |
---|
630 | #endif |
---|
631 | } |
---|
632 | else |
---|
633 | { |
---|
634 | decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx ); |
---|
635 | for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ ) |
---|
636 | { |
---|
637 | if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 ) |
---|
638 | { |
---|
639 | decodeRefFrmIdxPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
640 | decodeMvdPU ( pcCU, uiSubPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
641 | decodeMVPIdxPU ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) ); |
---|
642 | #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST |
---|
643 | if (bDebugPredEnabled) |
---|
644 | { |
---|
645 | std::cout << "refListIdx: " << uiRefListIdx << std::endl; |
---|
646 | std::cout << "MVD horizontal: " << pcCU->getCUMvField(RefPicList(uiRefListIdx))->getMvd( uiAbsPartIdx ).getHor() << std::endl; |
---|
647 | std::cout << "MVD vertical: " << pcCU->getCUMvField(RefPicList(uiRefListIdx))->getMvd( uiAbsPartIdx ).getVer() << std::endl; |
---|
648 | std::cout << "MVPIdxPU: " << pcCU->getMVPIdx(RefPicList( uiRefListIdx ), uiSubPartIdx) << std::endl; |
---|
649 | std::cout << "InterDir: " << (UInt)pcCU->getInterDir(uiSubPartIdx) << std::endl; |
---|
650 | } |
---|
651 | #endif |
---|
652 | } |
---|
653 | } |
---|
654 | #if NH_3D_IC |
---|
655 | decodeICFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
656 | #endif |
---|
657 | } |
---|
658 | |
---|
659 | if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) ) |
---|
660 | { |
---|
661 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( TComMv(0,0), ePartSize, uiSubPartIdx, uiDepth, uiPartIdx); |
---|
662 | pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( -1, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx); |
---|
663 | pcCU->setInterDirSubParts( 1, uiSubPartIdx, uiPartIdx, uiDepth); |
---|
664 | } |
---|
665 | } |
---|
666 | #endif |
---|
667 | #if NH_3D_SPIVMP |
---|
668 | delete[] pcMvFieldSP; |
---|
669 | delete[] puhInterDirSP; |
---|
670 | #endif |
---|
671 | return; |
---|
672 | } |
---|
673 | |
---|
674 | /** decode inter direction for a PU block |
---|
675 | * \param pcCU |
---|
676 | * \param uiAbsPartIdx |
---|
677 | * \param uiDepth |
---|
678 | * \param uiPartIdx |
---|
679 | * \returns Void |
---|
680 | */ |
---|
681 | Void TDecEntropy::decodeInterDirPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx ) |
---|
682 | { |
---|
683 | UInt uiInterDir; |
---|
684 | |
---|
685 | if ( pcCU->getSlice()->isInterP() ) |
---|
686 | { |
---|
687 | uiInterDir = 1; |
---|
688 | } |
---|
689 | else |
---|
690 | { |
---|
691 | m_pcEntropyDecoderIf->parseInterDir( pcCU, uiInterDir, uiAbsPartIdx ); |
---|
692 | } |
---|
693 | |
---|
694 | pcCU->setInterDirSubParts( uiInterDir, uiAbsPartIdx, uiPartIdx, uiDepth ); |
---|
695 | } |
---|
696 | |
---|
697 | Void TDecEntropy::decodeRefFrmIdxPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
698 | { |
---|
699 | Int iRefFrmIdx = 0; |
---|
700 | Int iParseRefFrmIdx = pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList ); |
---|
701 | |
---|
702 | if ( pcCU->getSlice()->getNumRefIdx( eRefList ) > 1 && iParseRefFrmIdx ) |
---|
703 | { |
---|
704 | m_pcEntropyDecoderIf->parseRefFrmIdx( pcCU, iRefFrmIdx, eRefList ); |
---|
705 | } |
---|
706 | else if ( !iParseRefFrmIdx ) |
---|
707 | { |
---|
708 | iRefFrmIdx = NOT_VALID; |
---|
709 | } |
---|
710 | else |
---|
711 | { |
---|
712 | iRefFrmIdx = 0; |
---|
713 | } |
---|
714 | |
---|
715 | PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx ); |
---|
716 | pcCU->getCUMvField( eRefList )->setAllRefIdx( iRefFrmIdx, ePartSize, uiAbsPartIdx, uiDepth, uiPartIdx ); |
---|
717 | } |
---|
718 | |
---|
719 | /** decode motion vector difference for a PU block |
---|
720 | * \param pcCU |
---|
721 | * \param uiAbsPartIdx |
---|
722 | * \param uiDepth |
---|
723 | * \param uiPartIdx |
---|
724 | * \param eRefList |
---|
725 | * \returns Void |
---|
726 | */ |
---|
727 | Void TDecEntropy::decodeMvdPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
728 | { |
---|
729 | if ( pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList ) ) |
---|
730 | { |
---|
731 | m_pcEntropyDecoderIf->parseMvd( pcCU, uiAbsPartIdx, uiPartIdx, uiDepth, eRefList ); |
---|
732 | } |
---|
733 | } |
---|
734 | |
---|
735 | #if NH_3D |
---|
736 | Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
737 | { |
---|
738 | Int iMVPIdx = -1; |
---|
739 | |
---|
740 | if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) ) |
---|
741 | { |
---|
742 | m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx ); |
---|
743 | #if NH_MV_ENC_DEC_TRAC |
---|
744 | #if ENC_DEC_TRACE |
---|
745 | if ( eRefList == REF_PIC_LIST_0 ) |
---|
746 | { |
---|
747 | DTRACE_PU("mvp_l0_flag", iMVPIdx) |
---|
748 | } |
---|
749 | else |
---|
750 | { |
---|
751 | DTRACE_PU("mvp_l1_flag", iMVPIdx) |
---|
752 | } |
---|
753 | #endif |
---|
754 | #endif |
---|
755 | } |
---|
756 | pcSubCU->setMVPIdxSubParts( iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth ); |
---|
757 | } |
---|
758 | |
---|
759 | Void TDecEntropy::decodeMvsAMVP( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
760 | { |
---|
761 | TComMv cZeroMv( 0, 0 ); |
---|
762 | TComMv cMv = cZeroMv; |
---|
763 | Int iRefIdx = -1; |
---|
764 | |
---|
765 | TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList ); |
---|
766 | AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo(); |
---|
767 | |
---|
768 | iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr); |
---|
769 | cMv = cZeroMv; |
---|
770 | |
---|
771 | pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo); |
---|
772 | pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth); |
---|
773 | if ( iRefIdx >= 0 ) |
---|
774 | { |
---|
775 | m_pcPrediction->getMvPredAMVP( pcSubCU, uiPartIdx, uiPartAddr, eRefList, cMv); |
---|
776 | cMv += pcSubCUMvField->getMvd( uiPartAddr ); |
---|
777 | } |
---|
778 | |
---|
779 | PartSize ePartSize = pcSubCU->getPartitionSize( uiPartAddr ); |
---|
780 | pcSubCU->getCUMvField( eRefList )->setAllMv(cMv, ePartSize, uiPartAddr, 0, uiPartIdx); |
---|
781 | } |
---|
782 | #else |
---|
783 | Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList ) |
---|
784 | { |
---|
785 | Int iMVPIdx = -1; |
---|
786 | |
---|
787 | TComMv cZeroMv( 0, 0 ); |
---|
788 | TComMv cMv = cZeroMv; |
---|
789 | Int iRefIdx = -1; |
---|
790 | |
---|
791 | TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList ); |
---|
792 | AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo(); |
---|
793 | |
---|
794 | iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr); |
---|
795 | cMv = cZeroMv; |
---|
796 | |
---|
797 | if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) ) |
---|
798 | { |
---|
799 | m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx ); |
---|
800 | #if NH_MV_ENC_DEC_TRAC |
---|
801 | #if ENC_DEC_TRACE |
---|
802 | if ( eRefList == REF_PIC_LIST_0 ) |
---|
803 | { |
---|
804 | DTRACE_PU("mvp_l0_flag", iMVPIdx) |
---|
805 | } |
---|
806 | else |
---|
807 | { |
---|
808 | DTRACE_PU("mvp_l1_flag", iMVPIdx) |
---|
809 | } |
---|
810 | #endif |
---|
811 | #endif |
---|
812 | } |
---|
813 | pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo); |
---|
814 | pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth); |
---|
815 | pcSubCU->setMVPIdxSubParts( iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth ); |
---|
816 | if ( iRefIdx >= 0 ) |
---|
817 | { |
---|
818 | m_pcPrediction->getMvPredAMVP( pcSubCU, uiPartIdx, uiPartAddr, eRefList, cMv); |
---|
819 | cMv += pcSubCUMvField->getMvd( uiPartAddr ); |
---|
820 | } |
---|
821 | |
---|
822 | PartSize ePartSize = pcSubCU->getPartitionSize( uiPartAddr ); |
---|
823 | pcSubCU->getCUMvField( eRefList )->setAllMv(cMv, ePartSize, uiPartAddr, 0, uiPartIdx); |
---|
824 | } |
---|
825 | #endif |
---|
826 | |
---|
827 | Void TDecEntropy::xDecodeTransform ( Bool& bCodeDQP, Bool& isChromaQpAdjCoded, TComTU &rTu, const Int quadtreeTULog2MinSizeInCU ) |
---|
828 | { |
---|
829 | |
---|
830 | TComDataCU *pcCU=rTu.getCU(); |
---|
831 | const UInt uiAbsPartIdx=rTu.GetAbsPartIdxTU(); |
---|
832 | const UInt uiDepth=rTu.GetTransformDepthTotal(); |
---|
833 | const UInt uiTrDepth = rTu.GetTransformDepthRel(); |
---|
834 | |
---|
835 | #if NH_MV_ENC_DEC_TRAC |
---|
836 | #if ENC_DEC_TRACE |
---|
837 | UInt uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
838 | UInt uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ]; |
---|
839 | |
---|
840 | DTRACE_TU_S("=========== transform_tree ===========\n") |
---|
841 | DTRACE_TU("x0", uiLPelX) |
---|
842 | DTRACE_TU("x1", uiTPelY) |
---|
843 | |
---|
844 | DTRACE_TU("log2TrafoSize", pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiDepth ) |
---|
845 | DTRACE_TU("trafoDepth" , uiDepth) |
---|
846 | #endif |
---|
847 | #endif |
---|
848 | |
---|
849 | UInt uiSubdiv; |
---|
850 | const UInt numValidComponent = pcCU->getPic()->getNumberValidComponents(); |
---|
851 | const Bool bChroma = isChromaEnabled(pcCU->getPic()->getChromaFormat()); |
---|
852 | |
---|
853 | const UInt uiLog2TrafoSize = rTu.GetLog2LumaTrSize(); |
---|
854 | #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST |
---|
855 | if (bDebugRQT) |
---|
856 | { |
---|
857 | printf("x..codeTransform: offsetLuma=%d offsetChroma=%d absPartIdx=%d, uiDepth=%d\n width=%d, height=%d, uiTrIdx=%d, uiInnerQuadIdx=%d\n", |
---|
858 | rTu.getCoefficientOffset(COMPONENT_Y), rTu.getCoefficientOffset(COMPONENT_Cb), uiAbsPartIdx, uiDepth, rTu.getRect(COMPONENT_Y).width, rTu.getRect(COMPONENT_Y).height, rTu.GetTransformDepthRel(), rTu.GetSectionNumber()); |
---|
859 | fflush(stdout); |
---|
860 | } |
---|
861 | #endif |
---|
862 | |
---|
863 | if( pcCU->isIntra(uiAbsPartIdx) && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) ) |
---|
864 | { |
---|
865 | uiSubdiv = 1; |
---|
866 | } |
---|
867 | else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->isInter(uiAbsPartIdx)) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) ) |
---|
868 | { |
---|
869 | uiSubdiv = (uiLog2TrafoSize >quadtreeTULog2MinSizeInCU); |
---|
870 | } |
---|
871 | else if( uiLog2TrafoSize > pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) |
---|
872 | { |
---|
873 | uiSubdiv = 1; |
---|
874 | } |
---|
875 | else if( uiLog2TrafoSize == pcCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() ) |
---|
876 | { |
---|
877 | uiSubdiv = 0; |
---|
878 | } |
---|
879 | else if( uiLog2TrafoSize == quadtreeTULog2MinSizeInCU ) |
---|
880 | { |
---|
881 | uiSubdiv = 0; |
---|
882 | } |
---|
883 | else |
---|
884 | { |
---|
885 | assert( uiLog2TrafoSize > quadtreeTULog2MinSizeInCU ); |
---|
886 | m_pcEntropyDecoderIf->parseTransformSubdivFlag( uiSubdiv, 5 - uiLog2TrafoSize ); |
---|
887 | } |
---|
888 | |
---|
889 | for(Int chan=COMPONENT_Cb; chan<numValidComponent; chan++) |
---|
890 | { |
---|
891 | const ComponentID compID=ComponentID(chan); |
---|
892 | const UInt trDepthTotalAdj=rTu.GetTransformDepthTotalAdj(compID); |
---|
893 | |
---|
894 | const Bool bFirstCbfOfCU = uiTrDepth == 0; |
---|
895 | |
---|
896 | if( bFirstCbfOfCU ) |
---|
897 | { |
---|
898 | pcCU->setCbfSubParts( 0, compID, rTu.GetAbsPartIdxTU(compID), trDepthTotalAdj); |
---|
899 | } |
---|
900 | if( bFirstCbfOfCU || rTu.ProcessingAllQuadrants(compID) ) |
---|
901 | { |
---|
902 | if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, compID, uiTrDepth - 1 ) ) |
---|
903 | { |
---|
904 | m_pcEntropyDecoderIf->parseQtCbf( rTu, compID, (uiSubdiv == 0) ); |
---|
905 | } |
---|
906 | } |
---|
907 | } |
---|
908 | |
---|
909 | if( uiSubdiv ) |
---|
910 | { |
---|
911 | const UInt uiQPartNum = pcCU->getPic()->getNumPartitionsInCtu() >> ((uiDepth+1) << 1); |
---|
912 | UInt uiYUVCbf[MAX_NUM_COMPONENT] = {0,0,0}; |
---|
913 | |
---|
914 | TComTURecurse tuRecurseChild(rTu, true); |
---|
915 | |
---|
916 | do |
---|
917 | { |
---|
918 | xDecodeTransform( bCodeDQP, isChromaQpAdjCoded, tuRecurseChild, quadtreeTULog2MinSizeInCU ); |
---|
919 | UInt childTUAbsPartIdx=tuRecurseChild.GetAbsPartIdxTU(); |
---|
920 | for(UInt ch=0; ch<numValidComponent; ch++) |
---|
921 | { |
---|
922 | uiYUVCbf[ch] |= pcCU->getCbf(childTUAbsPartIdx , ComponentID(ch), uiTrDepth+1 ); |
---|
923 | } |
---|
924 | } while (tuRecurseChild.nextSection(rTu) ); |
---|
925 | |
---|
926 | for(UInt ch=0; ch<numValidComponent; ch++) |
---|
927 | { |
---|
928 | UChar *pBase = pcCU->getCbf( ComponentID(ch) ) + uiAbsPartIdx; |
---|
929 | const UChar flag = uiYUVCbf[ch] << uiTrDepth; |
---|
930 | |
---|
931 | for( UInt ui = 0; ui < 4 * uiQPartNum; ++ui ) |
---|
932 | { |
---|
933 | pBase[ui] |= flag; |
---|
934 | } |
---|
935 | } |
---|
936 | } |
---|
937 | else |
---|
938 | { |
---|
939 | assert( uiDepth >= pcCU->getDepth( uiAbsPartIdx ) ); |
---|
940 | pcCU->setTrIdxSubParts( uiTrDepth, uiAbsPartIdx, uiDepth ); |
---|
941 | |
---|
942 | #if !NH_MV_ENC_DEC_TRAC |
---|
943 | { |
---|
944 | DTRACE_CABAC_VL( g_nSymbolCounter++ ); |
---|
945 | DTRACE_CABAC_T( "\tTrIdx: abspart=" ); |
---|
946 | DTRACE_CABAC_V( uiAbsPartIdx ); |
---|
947 | DTRACE_CABAC_T( "\tdepth=" ); |
---|
948 | DTRACE_CABAC_V( uiDepth ); |
---|
949 | DTRACE_CABAC_T( "\ttrdepth=" ); |
---|
950 | DTRACE_CABAC_V( uiTrDepth ); |
---|
951 | DTRACE_CABAC_T( "\n" ); |
---|
952 | } |
---|
953 | #endif |
---|
954 | |
---|
955 | pcCU->setCbfSubParts ( 0, COMPONENT_Y, uiAbsPartIdx, uiDepth ); |
---|
956 | |
---|
957 | if( (!pcCU->isIntra(uiAbsPartIdx)) && uiDepth == pcCU->getDepth( uiAbsPartIdx ) && ((!bChroma) || (!pcCU->getCbf( uiAbsPartIdx, COMPONENT_Cb, 0 ) && !pcCU->getCbf( uiAbsPartIdx, COMPONENT_Cr, 0 )) )) |
---|
958 | { |
---|
959 | pcCU->setCbfSubParts( 1 << uiTrDepth, COMPONENT_Y, uiAbsPartIdx, uiDepth ); |
---|
960 | } |
---|
961 | else |
---|
962 | { |
---|
963 | m_pcEntropyDecoderIf->parseQtCbf( rTu, COMPONENT_Y, true ); |
---|
964 | } |
---|
965 | |
---|
966 | |
---|
967 | // transform_unit begin |
---|
968 | UInt cbf[MAX_NUM_COMPONENT]={0,0,0}; |
---|
969 | Bool validCbf = false; |
---|
970 | Bool validChromaCbf = false; |
---|
971 | const UInt uiTrIdx = rTu.GetTransformDepthRel(); |
---|
972 | |
---|
973 | for(UInt ch=0; ch<pcCU->getPic()->getNumberValidComponents(); ch++) |
---|
974 | { |
---|
975 | const ComponentID compID = ComponentID(ch); |
---|
976 | |
---|
977 | cbf[compID] = pcCU->getCbf( uiAbsPartIdx, compID, uiTrIdx ); |
---|
978 | |
---|
979 | if (cbf[compID] != 0) |
---|
980 | { |
---|
981 | validCbf = true; |
---|
982 | if (isChroma(compID)) |
---|
983 | { |
---|
984 | validChromaCbf = true; |
---|
985 | } |
---|
986 | } |
---|
987 | } |
---|
988 | |
---|
989 | if ( validCbf ) |
---|
990 | { |
---|
991 | |
---|
992 | // dQP: only for CTU |
---|
993 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
---|
994 | { |
---|
995 | if ( bCodeDQP ) |
---|
996 | { |
---|
997 | const UInt uiAbsPartIdxCU=rTu.GetAbsPartIdxCU(); |
---|
998 | decodeQP( pcCU, uiAbsPartIdxCU); |
---|
999 | bCodeDQP = false; |
---|
1000 | } |
---|
1001 | } |
---|
1002 | |
---|
1003 | if ( pcCU->getSlice()->getUseChromaQpAdj() ) |
---|
1004 | { |
---|
1005 | if ( validChromaCbf && isChromaQpAdjCoded && !pcCU->getCUTransquantBypass(rTu.GetAbsPartIdxCU()) ) |
---|
1006 | { |
---|
1007 | decodeChromaQpAdjustment( pcCU, rTu.GetAbsPartIdxCU() ); |
---|
1008 | isChromaQpAdjCoded = false; |
---|
1009 | } |
---|
1010 | } |
---|
1011 | |
---|
1012 | const UInt numValidComp=pcCU->getPic()->getNumberValidComponents(); |
---|
1013 | |
---|
1014 | for(UInt ch=COMPONENT_Y; ch<numValidComp; ch++) |
---|
1015 | { |
---|
1016 | const ComponentID compID=ComponentID(ch); |
---|
1017 | |
---|
1018 | if( rTu.ProcessComponentSection(compID) ) |
---|
1019 | { |
---|
1020 | #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST |
---|
1021 | if (bDebugRQT) |
---|
1022 | { |
---|
1023 | printf("Call NxN for chan %d width=%d height=%d cbf=%d\n", compID, rTu.getRect(compID).width, rTu.getRect(compID).height, 1); |
---|
1024 | } |
---|
1025 | #endif |
---|
1026 | |
---|
1027 | if (rTu.getRect(compID).width != rTu.getRect(compID).height) |
---|
1028 | { |
---|
1029 | //code two sub-TUs |
---|
1030 | TComTURecurse subTUIterator(rTu, false, TComTU::VERTICAL_SPLIT, true, compID); |
---|
1031 | |
---|
1032 | do |
---|
1033 | { |
---|
1034 | const UInt subTUCBF = pcCU->getCbf(subTUIterator.GetAbsPartIdxTU(), compID, (uiTrIdx + 1)); |
---|
1035 | |
---|
1036 | if (subTUCBF != 0) |
---|
1037 | { |
---|
1038 | #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST |
---|
1039 | if (bDebugRQT) |
---|
1040 | { |
---|
1041 | printf("Call NxN for chan %d width=%d height=%d cbf=%d\n", compID, subTUIterator.getRect(compID).width, subTUIterator.getRect(compID).height, 1); |
---|
1042 | } |
---|
1043 | #endif |
---|
1044 | m_pcEntropyDecoderIf->parseCoeffNxN( subTUIterator, compID ); |
---|
1045 | } |
---|
1046 | } while (subTUIterator.nextSection(rTu)); |
---|
1047 | } |
---|
1048 | else |
---|
1049 | { |
---|
1050 | if(isChroma(compID) && (cbf[COMPONENT_Y] != 0)) |
---|
1051 | { |
---|
1052 | m_pcEntropyDecoderIf->parseCrossComponentPrediction( rTu, compID ); |
---|
1053 | } |
---|
1054 | |
---|
1055 | if(cbf[compID] != 0) |
---|
1056 | { |
---|
1057 | m_pcEntropyDecoderIf->parseCoeffNxN( rTu, compID ); |
---|
1058 | } |
---|
1059 | } |
---|
1060 | } |
---|
1061 | } |
---|
1062 | } |
---|
1063 | // transform_unit end |
---|
1064 | } |
---|
1065 | } |
---|
1066 | |
---|
1067 | Void TDecEntropy::decodeQP ( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
1068 | { |
---|
1069 | if ( pcCU->getSlice()->getPPS()->getUseDQP() ) |
---|
1070 | { |
---|
1071 | m_pcEntropyDecoderIf->parseDeltaQP( pcCU, uiAbsPartIdx, pcCU->getDepth( uiAbsPartIdx ) ); |
---|
1072 | } |
---|
1073 | } |
---|
1074 | |
---|
1075 | Void TDecEntropy::decodeChromaQpAdjustment( TComDataCU* pcCU, UInt uiAbsPartIdx ) |
---|
1076 | { |
---|
1077 | if ( pcCU->getSlice()->getUseChromaQpAdj() ) |
---|
1078 | { |
---|
1079 | m_pcEntropyDecoderIf->parseChromaQpAdjustment( pcCU, uiAbsPartIdx, pcCU->getDepth( uiAbsPartIdx ) ); |
---|
1080 | } |
---|
1081 | } |
---|
1082 | |
---|
1083 | |
---|
1084 | //! decode coefficients |
---|
1085 | Void TDecEntropy::decodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool& bCodeDQP, Bool& isChromaQpAdjCoded ) |
---|
1086 | { |
---|
1087 | #if NH_3D_SDC_INTRA |
---|
1088 | if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx) ) |
---|
1089 | { |
---|
1090 | assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N ); |
---|
1091 | assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 ); |
---|
1092 | assert( pcCU->getCbf(uiAbsPartIdx, COMPONENT_Y) == 1 ); |
---|
1093 | } |
---|
1094 | #endif |
---|
1095 | #if NH_3D_SDC_INTER |
---|
1096 | if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx) ) |
---|
1097 | { |
---|
1098 | assert( !pcCU->isSkipped( uiAbsPartIdx ) ); |
---|
1099 | assert( !pcCU->isIntra( uiAbsPartIdx) ); |
---|
1100 | assert( pcCU->getSlice()->getIsDepth() ); |
---|
1101 | } |
---|
1102 | #endif |
---|
1103 | #if NH_3D |
---|
1104 | if( pcCU->getSlice()->getIsDepth() ) |
---|
1105 | { |
---|
1106 | #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER |
---|
1107 | if( pcCU->getSDCFlag( uiAbsPartIdx ) ) |
---|
1108 | { |
---|
1109 | m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx, uiDepth ); |
---|
1110 | return; |
---|
1111 | } |
---|
1112 | #endif |
---|
1113 | #if NH_3D_DMM |
---|
1114 | if( pcCU->isIntra( uiAbsPartIdx ) ) |
---|
1115 | { |
---|
1116 | Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1; |
---|
1117 | UInt uiPartOffset = ( pcCU->getPic()->getNumPartitionsInCtu() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2; |
---|
1118 | for( Int iPart = 0; iPart < iPartNum; iPart++ ) |
---|
1119 | { |
---|
1120 | if( isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, uiAbsPartIdx + uiPartOffset*iPart ) ) ) |
---|
1121 | { |
---|
1122 | m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart, uiDepth + ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ); |
---|
1123 | } |
---|
1124 | } |
---|
1125 | } |
---|
1126 | #endif |
---|
1127 | } |
---|
1128 | #endif |
---|
1129 | |
---|
1130 | if( pcCU->isIntra(uiAbsPartIdx) ) |
---|
1131 | { |
---|
1132 | } |
---|
1133 | else |
---|
1134 | { |
---|
1135 | UInt uiQtRootCbf = 1; |
---|
1136 | if( !( pcCU->getPartitionSize( uiAbsPartIdx) == SIZE_2Nx2N && pcCU->getMergeFlag( uiAbsPartIdx ) ) ) |
---|
1137 | { |
---|
1138 | m_pcEntropyDecoderIf->parseQtRootCbf( uiAbsPartIdx, uiQtRootCbf ); |
---|
1139 | } |
---|
1140 | if ( !uiQtRootCbf ) |
---|
1141 | { |
---|
1142 | static const UInt cbfZero[MAX_NUM_COMPONENT]={0,0,0}; |
---|
1143 | pcCU->setCbfSubParts( cbfZero, uiAbsPartIdx, uiDepth ); |
---|
1144 | pcCU->setTrIdxSubParts( 0 , uiAbsPartIdx, uiDepth ); |
---|
1145 | return; |
---|
1146 | } |
---|
1147 | |
---|
1148 | } |
---|
1149 | |
---|
1150 | TComTURecurse tuRecurse(pcCU, uiAbsPartIdx, uiDepth); |
---|
1151 | |
---|
1152 | #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST |
---|
1153 | if (bDebugRQT) |
---|
1154 | { |
---|
1155 | printf("..codeCoeff: uiAbsPartIdx=%d, PU format=%d, 2Nx2N=%d, NxN=%d\n", uiAbsPartIdx, pcCU->getPartitionSize(uiAbsPartIdx), SIZE_2Nx2N, SIZE_NxN); |
---|
1156 | } |
---|
1157 | #endif |
---|
1158 | |
---|
1159 | Int quadtreeTULog2MinSizeInCU = pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx); |
---|
1160 | |
---|
1161 | xDecodeTransform( bCodeDQP, isChromaQpAdjCoded, tuRecurse, quadtreeTULog2MinSizeInCU ); |
---|
1162 | } |
---|
1163 | |
---|
1164 | #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER |
---|
1165 | Void TDecEntropy::decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1166 | { |
---|
1167 | pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth ); |
---|
1168 | if ( pcCU->isSkipped( uiAbsPartIdx ) ) |
---|
1169 | { |
---|
1170 | return; |
---|
1171 | } |
---|
1172 | |
---|
1173 | |
---|
1174 | if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getInterSdcFlag() ) || |
---|
1175 | ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getIntraSdcWedgeFlag() ) ) |
---|
1176 | { |
---|
1177 | return; |
---|
1178 | } |
---|
1179 | |
---|
1180 | if( !pcCU->getSlice()->getIsDepth() || pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N || pcCU->isSkipped( uiAbsPartIdx ) ) |
---|
1181 | { |
---|
1182 | return; |
---|
1183 | } |
---|
1184 | |
---|
1185 | assert( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) ); |
---|
1186 | m_pcEntropyDecoderIf->parseSDCFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
1187 | } |
---|
1188 | #endif |
---|
1189 | #if NH_3D_DBBP |
---|
1190 | Void TDecEntropy::decodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) |
---|
1191 | { |
---|
1192 | if( pcCU->getSlice()->getDepthBasedBlkPartFlag() && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 && pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() ) |
---|
1193 | { |
---|
1194 | m_pcEntropyDecoderIf->parseDBBPFlag( pcCU, uiAbsPartIdx, uiDepth ); |
---|
1195 | } |
---|
1196 | } |
---|
1197 | #endif |
---|
1198 | |
---|
1199 | |
---|
1200 | |
---|
1201 | //! \} |
---|