source: 3DVCSoftware/branches/HTM-6.2-dev0-Fix/source/Lib/TLibDecoder/TDecEntropy.cpp

Last change on this file was 441, checked in by mitsubishi-htm, 12 years ago

-Harmonization fixed by MERL. MERL_General_Fix is enabled.

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