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

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

Merged 9.3-dev0@831.

  • Property svn:eol-style set to native
File size: 33.8 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-2013, 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/TComSampleAdaptiveOffset.h"
49
50Void TDecEntropy::decodeSkipFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
51{
52  m_pcEntropyDecoderIf->parseSkipFlag( pcCU, uiAbsPartIdx, uiDepth );
53}
54
55Void TDecEntropy::decodeCUTransquantBypassFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
56{
57  m_pcEntropyDecoderIf->parseCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth );
58}
59
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{ 
69  // at least one merge candidate exists
70  m_pcEntropyDecoderIf->parseMergeFlag( pcSubCU, uiAbsPartIdx, uiDepth, uiPUIdx );
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 */
82Void TDecEntropy::decodeMergeIndex( TComDataCU* pcCU, UInt uiPartIdx, UInt uiAbsPartIdx, UInt uiDepth )
83{
84  UInt uiMergeIndex = 0;
85  m_pcEntropyDecoderIf->parseMergeIndex( pcCU, uiMergeIndex );
86  pcCU->setMergeIndexSubParts( uiMergeIndex, uiAbsPartIdx, uiPartIdx, uiDepth );
87}
88
89#if H_3D_ARP
90Void TDecEntropy::decodeARPW( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
91{
92  if( !pcCU->getSlice()->getARPStepNum() || pcCU->isIntra( uiAbsPartIdx ) )
93  {
94    return;
95  }
96
97  if( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N )
98  {
99    pcCU->setARPWSubParts( 0 , uiAbsPartIdx, uiDepth );
100  }
101  else
102  {
103    m_pcEntropyDecoderIf->parseARPW( pcCU , uiAbsPartIdx , uiDepth );
104  }
105}
106#endif
107
108#if H_3D_IC
109Void TDecEntropy::decodeICFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
110{
111  pcCU->setICFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );
112
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
116  if ( pcCU->isIntra( uiAbsPartIdx ) || ( pcCU->getSlice()->getViewIndex() == 0 ) || pcCU->getSlice()->getIsDepth() )
117#endif
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
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 );
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
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  {
176    decodeIntraDirModeLuma  ( pcCU, uiAbsPartIdx, uiDepth );
177#if H_3D_DIM_SDC
178    if(!pcCU->getSDCFlag(uiAbsPartIdx))
179#endif
180    decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth );
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 */
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;
201  }
202#if H_3D_DIM_SDC
203  if( pcCU->getSDCFlag(uiAbsPartIdx) )
204  {
205    return;
206  }
207#endif
208 
209  m_pcEntropyDecoderIf->parseIPCMInfo( pcCU, uiAbsPartIdx, uiDepth );
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
222/** decode motion information for every PU block.
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
235#if H_3D_IV_MERGE
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
242#if H_3D_SPIVMP
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
249  for ( UInt ui = 0; ui < pcCU->getSlice()->getMaxNumMergeCand(); ui++ )
250  {
251    uhInterDirNeighbours[ui] = 0;
252  }
253  Int numValidMergeCand = 0;
254  Bool isMerged = false;
255
256  pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 );
257  pcSubCU->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 );
258#if H_3D_IV_MERGE
259  pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx);
260#endif
261  for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )
262  {
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)
268#endif
269    decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx );
270    if ( pcCU->getMergeFlag( uiSubPartIdx ) )
271    {
272      decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth );
273      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
274#if !SEC_IC_ARP_SIG_G0072
275#if H_3D_IC
276      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
277#endif
278#endif
279#if H_3D_ARP
280      decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
281#endif
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
290      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) 
291#endif
292      {
293        pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
294        if ( !isMerged )
295        {
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];
300#if H_3D_SPIVMP
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
306#if H_3D_SPIVMP
307            , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
308#endif
309            , numValidMergeCand );
310          pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
311
312          if(vspFlag[uiMergeIndex])
313          {
314            pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth);
315          }
316#else
317#if H_3D
318          pcSubCU->initAvailableFlags();
319          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
320          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
321
322#else
323          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
324#endif
325#endif
326          isMerged = true;
327        }
328        pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth );
329      }
330      else
331      {
332        uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
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];
337#if H_3D_SPIVMP
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
343#if H_3D_SPIVMP
344          , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
345#endif
346          ,numValidMergeCand, uiMergeIndex );
347        pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
348        if(vspFlag[uiMergeIndex])
349        {
350          pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiSubPartIdx, uiPartIdx, uiDepth);
351        }
352#else
353#if H_3D
354        pcSubCU->initAvailableFlags();
355        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
356        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
357#else
358        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
359#endif
360#endif
361      }
362      pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
363
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
377      TComMv cTmpMv( 0, 0 );
378      for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
379      {       
380        if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
381        {
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 );
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
404        }
405      }
406#if H_3D_SPIVMP
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
429    }
430    else
431    {
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      }
442#if !SEC_IC_ARP_SIG_G0072
443#if H_3D_IC
444      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
445#endif
446#endif
447#if H_3D_ARP
448      decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
449#endif
450#if SEC_IC_ARP_SIG_G0072
451#if H_3D_IC
452      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
453#endif
454#endif
455    }
456#if H_3D_VSP
457#if NTT_STORE_SPDV_VSP_G0148
458    if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) && (pcCU->getVSPFlag(uiSubPartIdx) == 0))
459#else
460    if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) && (pcCU->getVSPFlag(uiSubPartIdx) == false))
461#endif
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    }
470  }
471#if H_3D_SPIVMP
472  delete[] pcMvFieldSP;
473  delete[] puhInterDirSP;
474#endif
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  {
495    m_pcEntropyDecoderIf->parseInterDir( pcCU, uiInterDir, uiAbsPartIdx );
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{
503  Int iRefFrmIdx = 0;
504  Int iParseRefFrmIdx = pcCU->getInterDir( uiAbsPartIdx ) & ( 1 << eRefList );
505
506  if ( pcCU->getSlice()->getNumRefIdx( eRefList ) > 1 && iParseRefFrmIdx )
507  {
508    m_pcEntropyDecoderIf->parseRefFrmIdx( pcCU, iRefFrmIdx, eRefList );
509  }
510  else if ( !iParseRefFrmIdx )
511  {
512    iRefFrmIdx = NOT_VALID;
513  }
514  else
515  {
516    iRefFrmIdx = 0;
517  }
518
519  PartSize ePartSize = pcCU->getPartitionSize( uiAbsPartIdx );
520  pcCU->getCUMvField( eRefList )->setAllRefIdx( iRefFrmIdx, ePartSize, uiAbsPartIdx, uiDepth, uiPartIdx );
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{
541  Int iMVPIdx = -1;
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;
552
553  if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) )
554  {
555    m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx );
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    }
566#endif
567#endif
568  }
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  {
574    m_pcPrediction->getMvPredAMVP( pcSubCU, uiPartIdx, uiPartAddr, eRefList, cMv);
575    cMv += pcSubCUMvField->getMvd( uiPartAddr );
576  }
577
578  PartSize ePartSize = pcSubCU->getPartitionSize( uiPartAddr );
579  pcSubCU->getCUMvField( eRefList )->setAllMv(cMv, ePartSize, uiPartAddr, 0, uiPartIdx);
580}
581
582Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP)
583{
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) );
623    m_pcEntropyDecoderIf->parseTransformSubdivFlag( uiSubdiv, 5 - uiLog2TrafoSize );
624  }
625 
626  const UInt uiTrDepth = uiDepth - pcCU->getDepth( uiAbsPartIdx );
627  {
628    const Bool bFirstCbfOfCU = uiTrDepth == 0;
629    if( bFirstCbfOfCU )
630    {
631      pcCU->setCbfSubParts( 0, TEXT_CHROMA_U, uiAbsPartIdx, uiDepth );
632      pcCU->setCbfSubParts( 0, TEXT_CHROMA_V, uiAbsPartIdx, uiDepth );
633    }
634    if( bFirstCbfOfCU || uiLog2TrafoSize > 2 )
635    {
636      if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) )
637      {
638        m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth, uiDepth );
639      }
640      if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) )
641      {
642        m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth, uiDepth );
643      }
644    }
645    else
646    {
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 );
649    }
650  }
651 
652  if( uiSubdiv )
653  {
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++ )
667    {
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 );
672      uiAbsPartIdx += uiQPartNum;
673      offsetLuma += size;  offsetChroma += (size>>2);
674    }
675   
676    for( UInt ui = 0; ui < 4 * uiQPartNum; ++ui )
677    {
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;
681    }
682  }
683  else
684  {
685    assert( uiDepth >= pcCU->getDepth( uiAbsPartIdx ) );
686    pcCU->setTrIdxSubParts( uiTrDepth, uiAbsPartIdx, uiDepth );
687   
688#if !H_MV_ENC_DEC_TRAC
689    {
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" );
698    }
699#endif
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 ) )
703    {
704      pcCU->setCbfSubParts( 1 << uiTrDepth, TEXT_LUMA, uiAbsPartIdx, uiDepth );
705    }
706    else
707    {
708      m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_LUMA, uiTrDepth, uiDepth );
709    }
710
711
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 )
717    {
718      UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
719      if( ( uiAbsPartIdx % partNum ) == (partNum - 1) )
720      {
721        cbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
722        cbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
723      }
724    }
725    if ( cbfY || cbfU || cbfV )
726    {
727      // dQP: only for LCU
728      if ( pcCU->getSlice()->getPPS()->getUseDQP() )
729      {
730        if ( bCodeDQP )
731        {
732          decodeQP( pcCU, m_bakAbsPartIdxCU);
733          bCodeDQP = false;
734        }
735      }
736    }
737    if( cbfY )
738    {
739      Int trWidth = width;
740      Int trHeight = height;
741      m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+offsetLuma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA );
742    }
743    if( uiLog2TrafoSize > 2 )
744    {
745      Int trWidth = width >> 1;
746      Int trHeight = height >> 1;
747      if( cbfU )
748      {
749        m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
750      }
751      if( cbfV )
752      {
753        m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+offsetChroma), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
754      }
755    }
756    else
757    {
758      UInt partNum = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
759      if( ( uiAbsPartIdx % partNum ) == (partNum - 1) )
760      {
761        Int trWidth = width;
762        Int trHeight = height;
763        if( cbfU )
764        {
765          m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
766        }
767        if( cbfV )
768        {
769          m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
770        }
771      }
772    }
773    // transform_unit end
774  }
775}
776
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}
784
785
786/** decode coefficients
787 * \param pcCU
788 * \param uiAbsPartIdx
789 * \param uiDepth
790 * \param uiWidth
791 * \param uiHeight
792 * \returns Void
793 */
794Void TDecEntropy::decodeCoeff( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP )
795{
796  UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight();
797  UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
798  UInt uiChromaOffset = uiLumaOffset>>2;
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;
827 
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
845#if H_3D_DIM_SDC
846  if( pcCU->getSDCFlag( uiAbsPartIdx ) )
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 );
853    return;
854  }
855#endif
856 
857#if H_3D_INTER_SDC
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 );
865    return;
866  }
867#endif
868#endif
869
870  if( pcCU->isIntra(uiAbsPartIdx) )
871  {
872  }
873  else
874  {
875    UInt uiQtRootCbf = 1;
876    if( !( pcCU->getPartitionSize( uiAbsPartIdx) == SIZE_2Nx2N && pcCU->getMergeFlag( uiAbsPartIdx ) ) )
877    {
878      m_pcEntropyDecoderIf->parseQtRootCbf( uiAbsPartIdx, uiQtRootCbf );
879    }
880    if ( !uiQtRootCbf )
881    {
882      pcCU->setCbfSubParts( 0, 0, 0, uiAbsPartIdx, uiDepth );
883      pcCU->setTrIdxSubParts( 0 , uiAbsPartIdx, uiDepth );
884      return;
885    }
886   
887  }
888  xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, bCodeDQP );
889}
890
891#if H_3D_INTER_SDC
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
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() ) )
927  {
928    return;
929  }
930
931  if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( uiAbsPartIdx ) || pcCU->isSkipped( uiAbsPartIdx ) )
932  {
933    return;
934  }
935
936  m_pcEntropyDecoderIf->parseInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
937}
938
939Void TDecEntropy::decodeInterSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
940{
941  if( !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) )
942  {
943    return;
944  }
945
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
953  // decode residual data for each segment
954  for( UInt uiSeg = 0; uiSeg < uiNumSegments; uiSeg++ )
955  {
956    m_pcEntropyDecoderIf->parseInterSDCResidualData( pcCU, uiAbsPartIdx, uiDepth, uiSeg );
957  }
958}
959#endif
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
967
968//! \}
Note: See TracBrowser for help on using the repository browser.