source: 3DVCSoftware/trunk/source/Lib/TLibDecoder/TDecEntropy.cpp @ 840

Last change on this file since 840 was 833, checked in by tech, 11 years ago

Merged 9.3-dev0@831.

  • Property svn:eol-style set to native
File size: 33.8 KB
RevLine 
[5]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
[56]4 * granted under this license. 
[5]5 *
[608]6 * Copyright (c) 2010-2013, ITU/ISO/IEC
[5]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.
[56]17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
[5]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 */
[2]33
34/** \file     TDecEntropy.cpp
35    \brief    entropy decoder class
36*/
37
38#include "TDecEntropy.h"
39
[56]40//! \ingroup TLibDecoder
41//! \{
42
[2]43Void TDecEntropy::setEntropyDecoder         ( TDecEntropyIf* p )
44{
45  m_pcEntropyDecoderIf = p;
46}
47
[56]48#include "TLibCommon/TComSampleAdaptiveOffset.h"
[2]49
50Void TDecEntropy::decodeSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
51{
52  m_pcEntropyDecoderIf->parseSkipFlag( pcCU, uiAbsPartIdx, uiDepth );
53}
54
[608]55Void TDecEntropy::decodeCUTransquantBypassFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
56{
57  m_pcEntropyDecoderIf->parseCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth );
58}
59
[2]60/** decode merge flag
61 * \param pcSubCU
62 * \param uiAbsPartIdx
63 * \param uiDepth
64 * \param uiPUIdx
65 * \returns Void
66 */
67Void TDecEntropy::decodeMergeFlag( TComDataCU* pcSubCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx )
68{ 
[56]69  // at least one merge candidate exists
70  m_pcEntropyDecoderIf->parseMergeFlag( pcSubCU, uiAbsPartIdx, uiDepth, uiPUIdx );
[2]71}
72
73/** decode merge index
74 * \param pcCU
75 * \param uiPartIdx
76 * \param uiAbsPartIdx
77 * \param puhInterDirNeighbours pointer to list of inter direction from the casual neighbours
78 * \param pcMvFieldNeighbours pointer to list of motion vector field from the casual neighbours
79 * \param uiDepth
80 * \returns Void
81 */
[608]82Void TDecEntropy::decodeMergeIndex( TComDataCU* pcCU, UInt uiPartIdx, UInt uiAbsPartIdx, UInt uiDepth )
[2]83{
84  UInt uiMergeIndex = 0;
[608]85  m_pcEntropyDecoderIf->parseMergeIndex( pcCU, uiMergeIndex );
[2]86  pcCU->setMergeIndexSubParts( uiMergeIndex, uiAbsPartIdx, uiPartIdx, uiDepth );
87}
88
[608]89#if H_3D_ARP
90Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
[443]91{
[608]92  if( !pcCU->getSlice()->getARPStepNum() || pcCU->isIntra( uiAbsPartIdx ) )
93  {
[443]94    return;
[608]95  }
96
97  if( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N )
98  {
99    pcCU->setARPWSubParts( 0 , uiAbsPartIdx, uiDepth );
100  }
[443]101  else
[608]102  {
[443]103    m_pcEntropyDecoderIf->parseARPW( pcCU , uiAbsPartIdx , uiDepth );
[608]104  }
[443]105}
106#endif
[608]107
108#if H_3D_IC
109Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
110{
111  pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );
112
[833]113#if SEC_IC_ARP_SIG_G0072
114  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() || pcCU->getARPW( uiAbsPartIdx ) > 0 )
115#else
[724]116  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() )
[833]117#endif
[608]118  {
119    return;
120  }
121
122  if( !pcCU->getSlice()->getApplyIC() )
123    return;
124
125  if( pcCU->isICFlagRequired( uiAbsPartIdx ) )
126    m_pcEntropyDecoderIf->parseICFlag( pcCU, uiAbsPartIdx, uiDepth );
127}
128#endif
129
[2]130Void TDecEntropy::decodeSplitFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
131{
132  m_pcEntropyDecoderIf->parseSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
133}
134
135Void TDecEntropy::decodePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
136{
137  m_pcEntropyDecoderIf->parsePredMode( pcCU, uiAbsPartIdx, uiDepth );
138}
139
140Void TDecEntropy::decodePartSize( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
141{
142  m_pcEntropyDecoderIf->parsePartSize( pcCU, uiAbsPartIdx, uiDepth );
[833]143 
144#if H_3D_DBBP
145  if( pcCU->getSlice()->getVPS()->getUseDBBP(pcCU->getSlice()->getLayerIdInVps()) && pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE )
146  {
147    decodeDBBPFlag(pcCU, uiAbsPartIdx, uiDepth);
148   
149    if( pcCU->getDBBPFlag(uiAbsPartIdx) )
150    {
151      AOF( pcCU->getPartitionSize(uiAbsPartIdx) == RWTH_DBBP_PACK_MODE );
152     
153      // get collocated depth block
154      UInt uiDepthStride = 0;
155      Pel* pDepthPels = NULL;
156      pDepthPels = pcCU->getVirtualDepthBlock(uiAbsPartIdx, pcCU->getWidth(uiAbsPartIdx), pcCU->getHeight(uiAbsPartIdx), uiDepthStride);
157     
158      AOF( pDepthPels != NULL );
159      AOF( uiDepthStride != 0 );
160     
161      // derive true partitioning for this CU based on depth
162      // (needs to be done in parsing process as motion vector predictors are also derived during parsing)
163      PartSize eVirtualPartSize = m_pcPrediction->getPartitionSizeFromDepth(pDepthPels, uiDepthStride, pcCU->getWidth(uiAbsPartIdx));
164      AOF( eVirtualPartSize != SIZE_NONE );
165     
166      pcCU->setPartSizeSubParts(eVirtualPartSize, uiAbsPartIdx, uiDepth);
167    }
168  }
169#endif
[2]170}
171
172Void TDecEntropy::decodePredInfo    ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU )
173{
174  if( pcCU->isIntra( uiAbsPartIdx ) )                                 // If it is Intra mode, encode intra prediction mode.
175  {
[608]176    decodeIntraDirModeLuma  ( pcCU, uiAbsPartIdx, uiDepth );
177#if H_3D_DIM_SDC
178    if(!pcCU->getSDCFlag(uiAbsPartIdx))
[443]179#endif
[608]180    decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth );
[2]181  }
182  else                                                                // if it is Inter mode, encode motion vector and reference index
183  {
[56]184    decodePUWise( pcCU, uiAbsPartIdx, uiDepth, pcSubCU );
185  }
186}
[2]187
[56]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 */
194Void 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;
[2]201  }
[608]202#if H_3D_DIM_SDC
[189]203  if( pcCU->getSDCFlag(uiAbsPartIdx) )
204  {
205    return;
206  }
207#endif
208 
[56]209  m_pcEntropyDecoderIf->parseIPCMInfo( pcCU, uiAbsPartIdx, uiDepth );
[2]210}
211
212Void TDecEntropy::decodeIntraDirModeLuma  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
213{
214  m_pcEntropyDecoderIf->parseIntraDirLumaAng( pcCU, uiAbsPartIdx, uiDepth );
215}
216
217Void TDecEntropy::decodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
218{
219  m_pcEntropyDecoderIf->parseIntraDirChroma( pcCU, uiAbsPartIdx, uiDepth );
220}
221
[56]222/** decode motion information for every PU block.
[2]223 * \param pcCU
224 * \param uiAbsPartIdx
225 * \param uiDepth
226 * \param pcSubCU
227 * \returns Void
228 */
229Void TDecEntropy::decodePUWise( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, TComDataCU* pcSubCU )
230{
231  PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
232  UInt uiNumPU = ( ePartSize == SIZE_2Nx2N ? 1 : ( ePartSize == SIZE_NxN ? 4 : 2 ) );
233  UInt uiPUOffset = ( g_auiPUOffset[UInt( ePartSize )] << ( ( pcCU->getSlice()->getSPS()->getMaxCUDepth() - uiDepth ) << 1 ) ) >> 4;
234
[608]235#if H_3D_IV_MERGE
[56]236  TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
237  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
238#else
239  TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists
240  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
241#endif
[773]242#if H_3D_SPIVMP
[724]243  Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
244  TComMvField*  pcMvFieldSP;
245  UChar* puhInterDirSP;
246  pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2]; 
247  puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()]; 
248#endif
[608]249  for ( UInt ui = 0; ui < pcCU->getSlice()->getMaxNumMergeCand(); ui++ )
[56]250  {
251    uhInterDirNeighbours[ui] = 0;
252  }
253  Int numValidMergeCand = 0;
[608]254  Bool isMerged = false;
[56]255
[2]256  pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 );
257  pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 );
[608]258#if H_3D_IV_MERGE
259  pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx);
260#endif
[2]261  for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )
262  {
[608]263#if H_MV_ENC_DEC_TRAC
264    DTRACE_PU_S("=========== prediction_unit ===========\n")
265    // ToDo:
266    //DTRACE_PU("x0", uiLPelX)
267    //DTRACE_PU("x1", uiTPelY)
[56]268#endif
[2]269    decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx );
270    if ( pcCU->getMergeFlag( uiSubPartIdx ) )
271    {
[608]272      decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth );
[56]273      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
[833]274#if !SEC_IC_ARP_SIG_G0072
[724]275#if H_3D_IC
276      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
277#endif
[833]278#endif
[724]279#if H_3D_ARP
280      decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
281#endif
[833]282#if SEC_IC_ARP_SIG_G0072
283#if H_3D_IC
284      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
285#endif
286#endif
287#if H_3D_DBBP
288      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false )
289#else
[56]290      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) 
[833]291#endif
[2]292      {
[56]293        pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
294        if ( !isMerged )
[2]295        {
[608]296#if H_3D_VSP
297          Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
298          memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
299          InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
[773]300#if H_3D_SPIVMP
[724]301          memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
302#endif
303          pcSubCU->initAvailableFlags();
304          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
305          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
[773]306#if H_3D_SPIVMP
[724]307            , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
308#endif
309            , numValidMergeCand );
[608]310          pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
[622]311
[608]312          if(vspFlag[uiMergeIndex])
313          {
314            pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth);
315          }
316#else
[773]317#if H_3D
[724]318          pcSubCU->initAvailableFlags();
319          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
320          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
321
322#else
[608]323          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
324#endif
[724]325#endif
[56]326          isMerged = true;
[2]327        }
[56]328        pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth );
329      }
330      else
331      {
[622]332        uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
[608]333#if H_3D_VSP
334        Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
335        memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
336        InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
[773]337#if H_3D_SPIVMP
[724]338        memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
339#endif
340        pcSubCU->initAvailableFlags();
341        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
342        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
[773]343#if H_3D_SPIVMP
[724]344          , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
345#endif
346          ,numValidMergeCand, uiMergeIndex );
[608]347        pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
348        if(vspFlag[uiMergeIndex])
[296]349        {
[608]350          pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth);
[296]351        }
[443]352#else
[773]353#if H_3D
[724]354        pcSubCU->initAvailableFlags();
[608]355        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
[724]356        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
357#else
358        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
[443]359#endif
[724]360#endif
[56]361      }
362      pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
363
[833]364#if MTK_DDD_G0063
365      if( uiMergeIndex == pcSubCU->getUseDDDCandIdx() )
366      {
367          assert( pcCU->getSlice()->getViewIndex() != 0 );
368          pcCU->setUseDDD( true, uiSubPartIdx, uiPartIdx, uiDepth );
369          pcCU->setDDDepthSubParts( pcSubCU->getDDTmpDepth(),uiSubPartIdx, uiPartIdx, uiDepth );
370      }
371      else
372      {
373          pcCU->setUseDDD( false, uiSubPartIdx, uiPartIdx, uiDepth );
374      }
375#endif
376
[56]377      TComMv cTmpMv( 0, 0 );
378      for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
379      {       
380        if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
[2]381        {
[56]382          pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth);
383          pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth);
384          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
385          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
[833]386#if NTT_STORE_SPDV_VSP_G0148
387#if H_3D_DBBP
388          if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 && !pcCU->getDBBPFlag( uiAbsPartIdx ) )
389#else
390          if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 )
391#endif
392          {
393            if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )
394            {
395              UInt dummy;
396              Int vspSize;
397              Int width, height;
398              pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 );
399              pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize );
400              pcCU->setVSPFlag( uiSubPartIdx, vspSize );
401            }
402          }
403#endif
[2]404        }
405      }
[773]406#if H_3D_SPIVMP
[724]407      pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth ); 
408      if (bSPIVMPFlag[uiMergeIndex] != 0)
409      {
410        Int iWidth, iHeight;
411        UInt uiIdx;
412        pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true );
413
414        UInt uiSPAddr;
415
416        Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
417
418        pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
419
420        for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
421        {
422          pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
423          pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
424          pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
425          pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
426        }
427      }
428#endif
[56]429    }
430    else
431    {
[2]432      decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx );
433      for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
434      {       
435        if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
436        {
437          decodeRefFrmIdxPU( pcCU,    uiSubPartIdx,              uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );
438          decodeMvdPU      ( pcCU,    uiSubPartIdx,              uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );
439          decodeMVPIdxPU   ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );
440        }
441      }
[833]442#if !SEC_IC_ARP_SIG_G0072
[724]443#if H_3D_IC
444      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
445#endif
[833]446#endif
[724]447#if H_3D_ARP
448      decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
449#endif
[833]450#if SEC_IC_ARP_SIG_G0072
451#if H_3D_IC
452      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
453#endif
454#endif
[2]455    }
[622]456#if H_3D_VSP
[833]457#if NTT_STORE_SPDV_VSP_G0148
458    if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) && (pcCU->getVSPFlag(uiSubPartIdx) == 0))
459#else
[608]460    if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) && (pcCU->getVSPFlag(uiSubPartIdx) == false))
[833]461#endif
[608]462#else
463    if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) )
464#endif
465    {
466      pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( TComMv(0,0), ePartSize, uiSubPartIdx, uiDepth, uiPartIdx);
467      pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( -1, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx);
468      pcCU->setInterDirSubParts( 1, uiSubPartIdx, uiPartIdx, uiDepth);
469    }
[2]470  }
[773]471#if H_3D_SPIVMP
[735]472  delete[] pcMvFieldSP;
473  delete[] puhInterDirSP;
[724]474#endif
[2]475  return;
476}
477
478/** decode inter direction for a PU block
479 * \param pcCU
480 * \param uiAbsPartIdx
481 * \param uiDepth
482 * \param uiPartIdx
483 * \returns Void
484 */
485Void TDecEntropy::decodeInterDirPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx )
486{
487  UInt uiInterDir;
488
489  if ( pcCU->getSlice()->isInterP() )
490  {
491    uiInterDir = 1;
492  }
493  else
494  {
[608]495    m_pcEntropyDecoderIf->parseInterDir( pcCU, uiInterDir, uiAbsPartIdx );
[2]496  }
497
498  pcCU->setInterDirSubParts( uiInterDir, uiAbsPartIdx, uiPartIdx, uiDepth );
499}
500
501Void TDecEntropy::decodeRefFrmIdxPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList )
502{
[608]503  Int iRefFrmIdx = 0;
504  Int iParseRefFrmIdx = pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList );
505
506  if ( pcCU->getSlice()->getNumRefIdx( eRefList ) > 1 && iParseRefFrmIdx )
[2]507  {
[608]508    m_pcEntropyDecoderIf->parseRefFrmIdx( pcCU, iRefFrmIdx, eRefList );
[2]509  }
[608]510  else if ( !iParseRefFrmIdx )
511  {
512    iRefFrmIdx = NOT_VALID;
513  }
[2]514  else
515  {
[608]516    iRefFrmIdx = 0;
517  }
[2]518
[608]519  PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
520  pcCU->getCUMvField( eRefList )->setAllRefIdx( iRefFrmIdx, ePartSize, uiAbsPartIdx, uiDepth, uiPartIdx );
[2]521}
522
523/** decode motion vector difference for a PU block
524 * \param pcCU
525 * \param uiAbsPartIdx
526 * \param uiDepth
527 * \param uiPartIdx
528 * \param eRefList
529 * \returns Void
530 */
531Void TDecEntropy::decodeMvdPU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList )
532{
533  if ( pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList ) )
534  {
535    m_pcEntropyDecoderIf->parseMvd( pcCU, uiAbsPartIdx, uiPartIdx, uiDepth, eRefList );
536  }
537}
538
539Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList )
540{
[56]541  Int iMVPIdx = -1;
[2]542
543  TComMv cZeroMv( 0, 0 );
544  TComMv cMv     = cZeroMv;
545  Int    iRefIdx = -1;
546
547  TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList );
548  AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo();
549
550  iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr);
551  cMv = cZeroMv;
[56]552
[608]553  if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) )
[56]554  {
555    m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx );
[608]556#if H_MV_ENC_DEC_TRAC
557#if ENC_DEC_TRACE
558    if ( eRefList == REF_PIC_LIST_0 )
559    {
560      DTRACE_PU("mvp_l0_flag", iMVPIdx)
561    }
562    else
563    {
564      DTRACE_PU("mvp_l1_flag", iMVPIdx)
565    }
[56]566#endif
[608]567#endif
[56]568  }
[2]569  pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo);
570  pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth);
571  pcSubCU->setMVPIdxSubParts( iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth );
572  if ( iRefIdx >= 0 )
573  {
[608]574    m_pcPrediction->getMvPredAMVP( pcSubCU, uiPartIdx, uiPartAddr, eRefList, cMv);
[2]575    cMv += pcSubCUMvField->getMvd( uiPartAddr );
576  }
577
578  PartSize ePartSize = pcSubCU->getPartitionSize( uiPartAddr );
[56]579  pcSubCU->getCUMvField( eRefList )->setAllMv(cMv, ePartSize, uiPartAddr, 0, uiPartIdx);
[2]580}
581
[608]582Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP)
[2]583{
[56]584  UInt uiSubdiv;
585  const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth;
586
587  if(uiTrIdx==0)
588  {
589    m_bakAbsPartIdxCU = uiAbsPartIdx;
590  }
591  if( uiLog2TrafoSize == 2 )
592  {
593    UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
594    if( ( uiAbsPartIdx % partNum ) == 0 )
595    {
596      m_uiBakAbsPartIdx   = uiAbsPartIdx;
597      m_uiBakChromaOffset = offsetChroma;
598    }
599  }
600  if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) )
601  {
602    uiSubdiv = 1;
603  }
604  else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) )
605  {
606    uiSubdiv = (uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx));
607  }
608  else if( uiLog2TrafoSize > pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() )
609  {
610    uiSubdiv = 1;
611  }
612  else if( uiLog2TrafoSize == pcCU->getSlice()->getSPS()->getQuadtreeTULog2MinSize() )
613  {
614    uiSubdiv = 0;
615  }
616  else if( uiLog2TrafoSize == pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) )
617  {
618    uiSubdiv = 0;
619  }
620  else
621  {
622    assert( uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx) );
[608]623    m_pcEntropyDecoderIf->parseTransformSubdivFlag( uiSubdiv, 5 - uiLog2TrafoSize );
[56]624  }
[2]625 
[56]626  const UInt uiTrDepth = uiDepth - pcCU->getDepth( uiAbsPartIdx );
[2]627  {
[608]628    const Bool bFirstCbfOfCU = uiTrDepth == 0;
[56]629    if( bFirstCbfOfCU )
[2]630    {
[56]631      pcCU->setCbfSubParts( 0, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth );
632      pcCU->setCbfSubParts( 0, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth );
[2]633    }
[56]634    if( bFirstCbfOfCU || uiLog2TrafoSize > 2 )
[2]635    {
[56]636      if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) )
[2]637      {
[608]638        m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth, uiDepth );
[2]639      }
[56]640      if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) )
[2]641      {
[608]642        m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth, uiDepth );
[2]643      }
644    }
[56]645    else
[2]646    {
[56]647      pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth );
648      pcCU->setCbfSubParts( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) << uiTrDepth, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth );
[2]649    }
650  }
651 
[56]652  if( uiSubdiv )
[2]653  {
[56]654    UInt size;
655    width  >>= 1;
656    height >>= 1;
657    size = width*height;
658    uiTrIdx++;
659    ++uiDepth;
660    const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
661    const UInt uiStartAbsPartIdx = uiAbsPartIdx;
662    UInt uiYCbf = 0;
663    UInt uiUCbf = 0;
664    UInt uiVCbf = 0;
665   
666    for( Int i = 0; i < 4; i++ )
[2]667    {
[608]668      xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, uiDepth, width, height, uiTrIdx, bCodeDQP );
669      uiYCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth+1 );
670      uiUCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth+1 );
671      uiVCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth+1 );
[56]672      uiAbsPartIdx += uiQPartNum;
673      offsetLuma += size;  offsetChroma += (size>>2);
[2]674    }
[56]675   
676    for( UInt ui = 0; ui < 4 * uiQPartNum; ++ui )
677    {
[608]678      pcCU->getCbf( TEXT_LUMA     )[uiStartAbsPartIdx + ui] |= uiYCbf << uiTrDepth;
679      pcCU->getCbf( TEXT_CHROMA_U )[uiStartAbsPartIdx + ui] |= uiUCbf << uiTrDepth;
680      pcCU->getCbf( TEXT_CHROMA_V )[uiStartAbsPartIdx + ui] |= uiVCbf << uiTrDepth;
[56]681    }
[2]682  }
683  else
684  {
[56]685    assert( uiDepth >= pcCU->getDepth( uiAbsPartIdx ) );
686    pcCU->setTrIdxSubParts( uiTrDepth, uiAbsPartIdx, uiDepth );
687   
[608]688#if !H_MV_ENC_DEC_TRAC
[2]689    {
[56]690      DTRACE_CABAC_VL( g_nSymbolCounter++ );
691      DTRACE_CABAC_T( "\tTrIdx: abspart=" );
692      DTRACE_CABAC_V( uiAbsPartIdx );
693      DTRACE_CABAC_T( "\tdepth=" );
694      DTRACE_CABAC_V( uiDepth );
695      DTRACE_CABAC_T( "\ttrdepth=" );
696      DTRACE_CABAC_V( uiTrDepth );
697      DTRACE_CABAC_T( "\n" );
[2]698    }
[608]699#endif
[56]700   
701    pcCU->setCbfSubParts ( 0, TEXT_LUMA, uiAbsPartIdx, uiDepth );
702    if( pcCU->getPredictionMode(uiAbsPartIdx) != MODE_INTRA && uiDepth == pcCU->getDepth( uiAbsPartIdx ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, 0 ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, 0 ) )
[2]703    {
[608]704      pcCU->setCbfSubParts( 1 << uiTrDepth, TEXT_LUMA, uiAbsPartIdx, uiDepth );
[2]705    }
[56]706    else
[2]707    {
[608]708      m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrDepth, uiDepth );
[2]709    }
[608]710
711
[56]712    // transform_unit begin
713    UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA    , uiTrIdx );
714    UInt cbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
715    UInt cbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
716    if( uiLog2TrafoSize == 2 )
[2]717    {
[56]718      UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
719      if( ( uiAbsPartIdx % partNum ) == (partNum - 1) )
[2]720      {
[56]721        cbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
722        cbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
[2]723      }
724    }
[56]725    if ( cbfY || cbfU || cbfV )
[2]726    {
[56]727      // dQP: only for LCU
728      if ( pcCU->getSlice()->getPPS()->getUseDQP() )
[2]729      {
[56]730        if ( bCodeDQP )
[2]731        {
[56]732          decodeQP( pcCU, m_bakAbsPartIdxCU);
733          bCodeDQP = false;
[2]734        }
735      }
736    }
[56]737    if( cbfY )
[2]738    {
[56]739      Int trWidth = width;
740      Int trHeight = height;
741      m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+offsetLuma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA );
[2]742    }
[56]743    if( uiLog2TrafoSize > 2 )
[2]744    {
[56]745      Int trWidth = width >> 1;
746      Int trHeight = height >> 1;
747      if( cbfU )
[2]748      {
[56]749        m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
[2]750      }
[56]751      if( cbfV )
[2]752      {
[56]753        m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
[2]754      }
755    }
756    else
757    {
[56]758      UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
759      if( ( uiAbsPartIdx % partNum ) == (partNum - 1) )
[2]760      {
[56]761        Int trWidth = width;
762        Int trHeight = height;
763        if( cbfU )
[2]764        {
[56]765          m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
[2]766        }
[56]767        if( cbfV )
[2]768        {
[56]769          m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
[2]770        }
771      }
772    }
[56]773    // transform_unit end
[2]774  }
775}
776
[56]777Void TDecEntropy::decodeQP          ( TComDataCU* pcCU, UInt uiAbsPartIdx )
778{
779  if ( pcCU->getSlice()->getPPS()->getUseDQP() )
780  {
781    m_pcEntropyDecoderIf->parseDeltaQP( pcCU, uiAbsPartIdx, pcCU->getDepth( uiAbsPartIdx ) );
782  }
783}
[2]784
785
786/** decode coefficients
787 * \param pcCU
788 * \param uiAbsPartIdx
789 * \param uiDepth
790 * \param uiWidth
791 * \param uiHeight
792 * \returns Void
793 */
[56]794Void TDecEntropy::decodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP )
[2]795{
796  UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight();
797  UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
798  UInt uiChromaOffset = uiLumaOffset>>2;
[833]799#if QC_SDC_UNIFY_G0130
800#if H_3D_DIM_SDC
801  if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx) )
802  {
803    assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
804    assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 );
805    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 );
806    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );
807    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 );
808  }
809#endif
810
811#if H_3D_INTER_SDC
812  if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx) )
813  {
814    assert( !pcCU->isSkipped( uiAbsPartIdx ) );
815    assert( !pcCU->isIntra( uiAbsPartIdx) );
816    assert( pcCU->getSlice()->getIsDepth() );
817  }
818#endif
819#if QC_SDC_UNIFY_G0130_FIX
820  if( pcCU->getSlice()->getIsDepth() && ( pcCU->getSDCFlag( uiAbsPartIdx ) || pcCU->isIntra( uiAbsPartIdx ) ) )
821#else
822  if( pcCU->getSDCFlag( uiAbsPartIdx ) || pcCU->isIntra( uiAbsPartIdx ) )
823#endif
824  {
825    Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1;
826    UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2;
[2]827 
[833]828    if( !pcCU->getSDCFlag( uiAbsPartIdx ) )
829    {
830      for( Int iPart = 0; iPart < iPartNum; iPart++ )
831      {
832        if( getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx + uiPartOffset*iPart ) ) < DIM_NUM_TYPE ) 
833        {
834          m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart, uiDepth + ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) );
835        }
836      }
837    }
838    else
839    {
840      m_pcEntropyDecoderIf->parseDeltaDC( pcCU, uiAbsPartIdx, uiDepth );
841      return;
842    }
843  }
844#else
[608]845#if H_3D_DIM_SDC
846  if( pcCU->getSDCFlag( uiAbsPartIdx ) )
[189]847  {
848    assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
849    assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 );
850    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 );
851    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );
852    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 );
[608]853    return;
854  }
[443]855#endif
[608]856 
[655]857#if H_3D_INTER_SDC
[608]858  if( pcCU->getInterSDCFlag( uiAbsPartIdx ) )
859  {
860    assert( !pcCU->isSkipped( uiAbsPartIdx ) );
861    assert( !pcCU->isIntra( uiAbsPartIdx) );
862    assert( pcCU->getSlice()->getIsDepth() );
863
864    decodeInterSDCResidualData( pcCU, uiAbsPartIdx, uiDepth );
[189]865    return;
866  }
867#endif
[833]868#endif
[608]869
[2]870  if( pcCU->isIntra(uiAbsPartIdx) )
871  {
872  }
873  else
874  {
[56]875    UInt uiQtRootCbf = 1;
876    if( !( pcCU->getPartitionSize( uiAbsPartIdx) == SIZE_2Nx2N && pcCU->getMergeFlag( uiAbsPartIdx ) ) )
877    {
[608]878      m_pcEntropyDecoderIf->parseQtRootCbf( uiAbsPartIdx, uiQtRootCbf );
[2]879    }
[56]880    if ( !uiQtRootCbf )
881    {
882      pcCU->setCbfSubParts( 0, 0, 0, uiAbsPartIdx, uiDepth );
883      pcCU->setTrIdxSubParts( 0 , uiAbsPartIdx, uiDepth );
884      return;
885    }
[2]886   
887  }
[608]888  xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, bCodeDQP );
889}
[189]890
[655]891#if H_3D_INTER_SDC
[833]892#if QC_SDC_UNIFY_G0130
893Void TDecEntropy::decodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
894{
895  pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth );
896
897  if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) ) || 
898    ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getVpsDepthModesFlag( pcCU->getSlice()->getLayerIdInVps() ) ) )
899  {
900    return;
901  }
902
903#if SEC_INTER_SDC_G0101
904  if( !pcCU->getSlice()->getIsDepth() || pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N || pcCU->isSkipped( uiAbsPartIdx ) )
905#else
906  if( !pcCU->getSlice()->getIsDepth() || ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N ) || pcCU->isSkipped( uiAbsPartIdx ) )
907#endif
908  {
909    return;
910  }
911
912#if SEC_INTER_SDC_G0101
913  assert( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) );
914#else
915  assert( ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) );
916#endif
917
918  m_pcEntropyDecoderIf->parseSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
919}
920
921#else
[608]922Void TDecEntropy::decodeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
923{
924  pcCU->setInterSDCFlagSubParts( false, uiAbsPartIdx, 0, uiDepth);
925
926  if( !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) )
[189]927  {
[608]928    return;
[189]929  }
930
[608]931  if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( uiAbsPartIdx ) || pcCU->isSkipped( uiAbsPartIdx ) )
[189]932  {
[608]933    return;
[189]934  }
[608]935
936  m_pcEntropyDecoderIf->parseInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
[2]937}
938
[608]939Void TDecEntropy::decodeInterSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
[189]940{
[608]941  if( !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) )
942  {
943    return;
944  }
[189]945
[608]946  if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( uiAbsPartIdx ) || !pcCU->getInterSDCFlag( uiAbsPartIdx ) )
947  {
948    return;
949  }
950
951  UInt uiNumSegments = ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) ? 1 : ( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ? 4 : 2 );
952
[189]953  // decode residual data for each segment
954  for( UInt uiSeg = 0; uiSeg < uiNumSegments; uiSeg++ )
[608]955  {
956    m_pcEntropyDecoderIf->parseInterSDCResidualData( pcCU, uiAbsPartIdx, uiDepth, uiSeg );
957  }
[189]958}
959#endif
[833]960#endif
961#if H_3D_DBBP
962Void TDecEntropy::decodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
963{
964  m_pcEntropyDecoderIf->parseDBBPFlag( pcCU, uiAbsPartIdx, uiDepth );
965}
966#endif
[189]967
[56]968//! \}
Note: See TracBrowser for help on using the repository browser.