source: 3DVCSoftware/branches/HTM-9.1-dev0-ZTE/source/Lib/TLibDecoder/TDecCu.cpp @ 750

Last change on this file since 750 was 748, checked in by zte, 11 years ago

JCT3V-F0131, JCT3V-F0139

  • Property svn:eol-style set to native
File size: 48.5 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     TDecCu.cpp
35    \brief    CU decoder class
36*/
37
38#include "TDecCu.h"
39
[56]40//! \ingroup TLibDecoder
41//! \{
42
[2]43// ====================================================================================================================
44// Constructor / destructor / create / destroy
45// ====================================================================================================================
46
47TDecCu::TDecCu()
48{
[56]49  m_ppcYuvResi = NULL;
50  m_ppcYuvReco = NULL;
51  m_ppcCU      = NULL;
[2]52}
53
54TDecCu::~TDecCu()
55{
56}
57
58Void TDecCu::init( TDecEntropy* pcEntropyDecoder, TComTrQuant* pcTrQuant, TComPrediction* pcPrediction)
59{
60  m_pcEntropyDecoder  = pcEntropyDecoder;
61  m_pcTrQuant         = pcTrQuant;
62  m_pcPrediction      = pcPrediction;
63}
64
65/**
66 \param    uiMaxDepth    total number of allowable depth
67 \param    uiMaxWidth    largest CU width
68 \param    uiMaxHeight   largest CU height
69 */
70Void TDecCu::create( UInt uiMaxDepth, UInt uiMaxWidth, UInt uiMaxHeight )
71{
72  m_uiMaxDepth = uiMaxDepth+1;
73 
[56]74  m_ppcYuvResi = new TComYuv*[m_uiMaxDepth-1];
75  m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1];
76  m_ppcCU      = new TComDataCU*[m_uiMaxDepth-1];
[2]77 
78  UInt uiNumPartitions;
79  for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ )
80  {
81    uiNumPartitions = 1<<( ( m_uiMaxDepth - ui - 1 )<<1 );
82    UInt uiWidth  = uiMaxWidth  >> ui;
83    UInt uiHeight = uiMaxHeight >> ui;
84   
[56]85    m_ppcYuvResi[ui] = new TComYuv;    m_ppcYuvResi[ui]->create( uiWidth, uiHeight );
86    m_ppcYuvReco[ui] = new TComYuv;    m_ppcYuvReco[ui]->create( uiWidth, uiHeight );
87    m_ppcCU     [ui] = new TComDataCU; m_ppcCU     [ui]->create( uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) );
[2]88  }
89 
[56]90  m_bDecodeDQP = false;
91
[2]92  // initialize partition order.
93  UInt* piTmp = &g_auiZscanToRaster[0];
94  initZscanToRaster(m_uiMaxDepth, 1, 0, piTmp);
95  initRasterToZscan( uiMaxWidth, uiMaxHeight, m_uiMaxDepth );
96 
97  // initialize conversion matrix from partition index to pel
98  initRasterToPelXY( uiMaxWidth, uiMaxHeight, m_uiMaxDepth );
99}
100
101Void TDecCu::destroy()
102{
103  for ( UInt ui = 0; ui < m_uiMaxDepth-1; ui++ )
104  {
[56]105    m_ppcYuvResi[ui]->destroy(); delete m_ppcYuvResi[ui]; m_ppcYuvResi[ui] = NULL;
106    m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL;
107    m_ppcCU     [ui]->destroy(); delete m_ppcCU     [ui]; m_ppcCU     [ui] = NULL;
[2]108  }
109 
[56]110  delete [] m_ppcYuvResi; m_ppcYuvResi = NULL;
111  delete [] m_ppcYuvReco; m_ppcYuvReco = NULL;
112  delete [] m_ppcCU     ; m_ppcCU      = NULL;
[2]113}
114
115// ====================================================================================================================
116// Public member functions
117// ====================================================================================================================
118
119/** \param    pcCU        pointer of CU data
120 \param    ruiIsLast   last data?
121 */
122Void TDecCu::decodeCU( TComDataCU* pcCU, UInt& ruiIsLast )
123{
[56]124  if ( pcCU->getSlice()->getPPS()->getUseDQP() )
[2]125  {
[56]126    setdQPFlag(true);
[2]127  }
[56]128
[2]129  // start from the top level CU
[56]130  xDecodeCU( pcCU, 0, 0, ruiIsLast);
[2]131}
132
133/** \param    pcCU        pointer of CU data
134 */
135Void TDecCu::decompressCU( TComDataCU* pcCU )
136{
[724]137#if !QC_DEPTH_IV_MRG_F0125
[608]138  xDecompressCU( pcCU, 0,  0 );
[724]139#endif
[2]140}
141
142// ====================================================================================================================
143// Protected member functions
144// ====================================================================================================================
145
[56]146/**decode end-of-slice flag
147 * \param pcCU
148 * \param uiAbsPartIdx
149 * \param uiDepth
150 * \returns Bool
151 */
[608]152Bool TDecCu::xDecodeSliceEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth)
153{
[56]154  UInt uiIsLast;
155  TComPic* pcPic = pcCU->getPic();
156  TComSlice * pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx());
157  UInt uiCurNumParts    = pcPic->getNumPartInCU() >> (uiDepth<<1);
158  UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples();
159  UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples();
[608]160  UInt uiGranularityWidth = g_uiMaxCUWidth;
[56]161  UInt uiPosX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
162  UInt uiPosY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
163
164  if(((uiPosX+pcCU->getWidth(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosX+pcCU->getWidth(uiAbsPartIdx)==uiWidth))
165    &&((uiPosY+pcCU->getHeight(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosY+pcCU->getHeight(uiAbsPartIdx)==uiHeight)))
166  {
167    m_pcEntropyDecoder->decodeTerminatingBit( uiIsLast );
168  }
169  else
170  {
171    uiIsLast=0;
172  }
173 
174  if(uiIsLast) 
175  {
[608]176    if(pcSlice->isNextSliceSegment()&&!pcSlice->isNextSlice()) 
[56]177    {
[608]178      pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
[56]179    }
180    else 
181    {
182      pcSlice->setSliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
[608]183      pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
[56]184    }
185  }
186
187  return uiIsLast>0;
188}
189
[2]190/** decode CU block recursively
191 * \param pcCU
192 * \param uiAbsPartIdx
193 * \param uiDepth
194 * \returns Void
195 */
[56]196
197Void TDecCu::xDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast)
[2]198{
199  TComPic* pcPic = pcCU->getPic();
200  UInt uiCurNumParts    = pcPic->getNumPartInCU() >> (uiDepth<<1);
201  UInt uiQNumParts      = uiCurNumParts>>2;
202 
203  Bool bBoundary = false;
204  UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
205  UInt uiRPelX   = uiLPelX + (g_uiMaxCUWidth>>uiDepth)  - 1;
206  UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
207  UInt uiBPelY   = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;
[608]208#if H_MV_ENC_DEC_TRAC
209  DTRACE_CU_S("=========== coding_quadtree ===========\n")
210  DTRACE_CU("x0", uiLPelX)
211  DTRACE_CU("x1", uiTPelY)
212  DTRACE_CU("log2CbSize", g_uiMaxCUWidth>>uiDepth)
213  DTRACE_CU("cqtDepth"  , uiDepth)
214#endif
[56]215  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
[608]216  Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr();
[56]217  if((!bStartInCU) && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
[2]218  {
[608]219    m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
[2]220  }
221  else
222  {
223    bBoundary = true;
224  }
225 
226  if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary )
227  {
228    UInt uiIdx = uiAbsPartIdx;
[56]229    if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
230    {
231      setdQPFlag(true);
232      pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP
233    }
234
[2]235    for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ )
236    {
237      uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ];
238      uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
239     
[608]240      Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr();
[56]241      if ( bSubInSlice )
242      {
[608]243        if ( !ruiIsLast && ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )
[56]244        {
245          xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast );
246        }
247        else
248        {
249          pcCU->setOutsideCUPart( uiIdx, uiDepth+1 );
250        }
251      }
[2]252     
253      uiIdx += uiQNumParts;
254    }
[56]255    if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
256    {
257      if ( getdQPFlag() )
258      {
259        UInt uiQPSrcPartIdx;
[608]260        if ( pcPic->getCU( pcCU->getAddr() )->getSliceSegmentStartCU(uiAbsPartIdx) != pcSlice->getSliceSegmentCurStartCUAddr() )
[56]261        {
[608]262          uiQPSrcPartIdx = pcSlice->getSliceSegmentCurStartCUAddr() % pcPic->getNumPartInCU();
[56]263        }
264        else
265        {
266          uiQPSrcPartIdx = uiAbsPartIdx;
267        }
268        pcCU->setQPSubParts( pcCU->getRefQP( uiQPSrcPartIdx ), uiAbsPartIdx, uiDepth ); // set QP to default QP
269      }
270    }
[2]271    return;
272  }
273 
[608]274#if H_MV_ENC_DEC_TRAC
275  DTRACE_CU_S("=========== coding_unit ===========\n")
276#endif
277
[56]278  if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
279  {
280    setdQPFlag(true);
281    pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP
282  }
[608]283#if H_3D_NBDV
284  DisInfo DvInfo; 
285  DvInfo.bDV = false;
286  DvInfo.m_acNBDV.setZero();
287  DvInfo.m_aVIdxCan = 0;
288#if H_3D_NBDV_REF 
289  DvInfo.m_acDoNBDV.setZero();
290#endif
291 
292 
293  if(!pcCU->getSlice()->isIntra())
294  {
295#if H_3D_ARP && H_3D_IV_MERGE
296    if( pcCU->getSlice()->getVPS()->getUseAdvRP( pcCU->getSlice()->getLayerId() ) || pcCU->getSlice()->getVPS()->getIvMvPredFlag( pcCU->getSlice()->getLayerId() ))
297#else
298#if H_3D_ARP
299    if( pcCU->getSlice()->getVPS()->getUseAdvRP(pcCU->getSlice()->getLayerId()) )
[443]300#else
[608]301#if H_3D_IV_MERGE
302    if( pcCU->getSlice()->getVPS()->getIvMvPredFlag(pcCU->getSlice()->getLayerId()) )
303#else
304    if (0)
[443]305#endif
306#endif
307#endif
[608]308    {
309      m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true );
310      m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx);
311      PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0);
312      UChar cWidTemp     = m_ppcCU[uiDepth]->getWidth(0);
313      UChar cHeightTemp  = m_ppcCU[uiDepth]->getHeight(0);
314      m_ppcCU[uiDepth]->setWidth  ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth)  );
315      m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth)  );
316      m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );     
[724]317#if QC_DEPTH_IV_MRG_F0125
318      if( pcCU->getSlice()->getIsDepth())
319      {
320        DvInfo.bDV = m_ppcCU[uiDepth]->getDispNeighBlocks(0, 0, &DvInfo);
321      }
322      else
323      {
324#endif
[608]325#if H_3D_NBDV_REF
326      if(pcCU->getSlice()->getVPS()->getDepthRefinementFlag( pcCU->getSlice()->getLayerIdInVps() ))  //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done.
[622]327      {
[608]328        DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true);
[622]329      }
[608]330      else
[56]331#endif
[622]332      {
[608]333        DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo);
[622]334      }
[724]335#if QC_DEPTH_IV_MRG_F0125
336      }
337#endif
[622]338#if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC   
339      if ( g_decTraceDispDer )
340      {
341        DTRACE_CU( "RefViewIdx",  DvInfo.m_aVIdxCan );       
342        DTRACE_CU( "MvDisp[x]", DvInfo.m_acNBDV.getHor() );
343        DTRACE_CU( "MvDisp[y]", DvInfo.m_acNBDV.getVer() );
344        DTRACE_CU( "MvRefinedDisp[x]", DvInfo.m_acDoNBDV.getHor() );
345        DTRACE_CU( "MvRefinedDisp[y]", DvInfo.m_acDoNBDV.getVer() );
346      }
347#endif
348
[608]349      pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth);
350      m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth );
351      m_ppcCU[uiDepth]->setWidth  ( 0, cWidTemp );
352      m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp );
353     }
354  }
355#endif
356  if (pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
[2]357  {
[608]358    m_pcEntropyDecoder->decodeCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth );
359  }
360 
361  // decode CU mode and the partition size
362  if( !pcCU->getSlice()->isIntra())
363  {
[2]364    m_pcEntropyDecoder->decodeSkipFlag( pcCU, uiAbsPartIdx, uiDepth );
365  }
[56]366 
[2]367  if( pcCU->isSkipped(uiAbsPartIdx) )
368  {
[608]369#if H_MV_ENC_DEC_TRAC
370    DTRACE_PU_S("=========== prediction_unit ===========\n")
371    DTRACE_PU("x0", uiLPelX)
372    DTRACE_PU("x1", uiTPelY)
373#endif
[2]374    m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 );
375    m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 );
[608]376#if H_3D_IV_MERGE
377    m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx);
[56]378    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
379    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
380#else
[2]381    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists
382    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
[608]383#endif
[56]384    Int numValidMergeCand = 0;
[608]385    for( UInt ui = 0; ui < m_ppcCU[uiDepth]->getSlice()->getMaxNumMergeCand(); ++ui )
[2]386    {
387      uhInterDirNeighbours[ui] = 0;
388    }
[608]389    m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth );
390    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
[2]391
[724]392#if LGE_SHARP_VSP_INHERIT_F0104
393#if H_3D_IC
394    m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
395#endif
396#if H_3D_ARP
397    m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth );
398#endif
399#endif
400
[608]401#if H_3D_VSP
402    Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
403    memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
404    InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
[724]405#if MTK_SPIVMP_F0110
406    Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
407    memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
408    TComMvField*  pcMvFieldSP;
409    UChar* puhInterDirSP;
410    pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2]; 
411    puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()]; 
412#endif
413#if ETRIKHU_MERGE_REUSE_F0093
414    m_ppcCU[uiDepth]->initAvailableFlags();
415    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
416    m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo
417#if MTK_SPIVMP_F0110
418      , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP
419#endif
420      , numValidMergeCand, uiMergeIndex );
421#else
[608]422    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand, uiMergeIndex );
[724]423#endif
[608]424    pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
[443]425#else
[724]426#if ETRIKHU_MERGE_REUSE_F0093
427    m_ppcCU[uiDepth]->initAvailableFlags();
[608]428    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
[724]429    m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
430#else
431    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
[443]432#endif
[724]433#endif
[622]434#if H_3D_VSP
[608]435    if(vspFlag[uiMergeIndex])
[296]436    {
[608]437      pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiAbsPartIdx, 0, uiDepth);
[443]438    }
439#endif
[56]440    pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
441
442    TComMv cTmpMv( 0, 0 );
443    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
444    {       
445      if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
446      {
447        pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth);
448        pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth);
449        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
450        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
[622]451#if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC   
452        if ( g_decTraceMvFromMerge )
453        {       
454          if ( uiRefListIdx == 0 )
455          {
456            DTRACE_PU( "mvL0[0]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getHor());
457            DTRACE_PU( "mvL0[1]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getVer());
458            DTRACE_PU( "refIdxL0   ", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx());
459          }
460          else
461          {
462            DTRACE_PU( "mvL1[0]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getHor());
463            DTRACE_PU( "mvL1[1]", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getVer());
464            DTRACE_PU( "refIdxL1", cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx());
465          }
466        }
467#endif
[56]468      }
469    }
[724]470#if MTK_SPIVMP_F0110
471    pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth ); 
472    if (bSPIVMPFlag[uiMergeIndex])
473    {
474      UInt uiSPAddr;
475      Int iWidth = pcCU->getWidth(uiAbsPartIdx);
476      Int iHeight = pcCU->getHeight(uiAbsPartIdx);
477
478      Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
479
480      pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
481
482      for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
483      {
484        pcCU->getSPAbsPartIdx(uiAbsPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
485        pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
486        pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
487        pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
488      }
489    }
[735]490#if MTK_F0110_FIX
491    delete[] pcMvFieldSP;
492    delete[] puhInterDirSP;
493#else
[724]494    delete pcMvFieldSP;
495    delete puhInterDirSP;
496#endif
[735]497#endif
[724]498#if !LGE_SHARP_VSP_INHERIT_F0104
[608]499#if H_3D_IC
[189]500    m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
501#endif
[608]502#if H_3D_ARP
503    m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth );
[56]504#endif
[724]505#endif
506
[56]507    xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
[724]508#if QC_DEPTH_IV_MRG_F0125
509    xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
510#endif
[2]511    return;
512  }
513
[608]514  m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth );
515  m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
[2]516
[56]517  if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
518  {
519    m_pcEntropyDecoder->decodeIPCMInfo( pcCU, uiAbsPartIdx, uiDepth );
[2]520
[56]521    if(pcCU->getIPCMFlag(uiAbsPartIdx))
[2]522    {
[56]523      xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
[724]524#if QC_DEPTH_IV_MRG_F0125
525      xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
526#endif
[56]527      return;
528    }
529  }
530
531  UInt uiCurrWidth      = pcCU->getWidth ( uiAbsPartIdx );
532  UInt uiCurrHeight     = pcCU->getHeight( uiAbsPartIdx );
533 
534  // prediction mode ( Intra : direction mode, Inter : Mv, reference idx )
535  m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]);
[724]536#if !LGE_SHARP_VSP_INHERIT_F0104
[608]537#if H_3D_IC
[189]538  m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
539#endif
[608]540#if H_3D_ARP
541  m_pcEntropyDecoder->decodeARPW    ( pcCU , uiAbsPartIdx , uiDepth ); 
542#endif 
[724]543#endif
[655]544#if H_3D_INTER_SDC
[608]545  m_pcEntropyDecoder->decodeInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
[296]546#endif
[2]547  // Coefficient decoding
[56]548  Bool bCodeDQP = getdQPFlag();
549  m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, uiCurrWidth, uiCurrHeight, bCodeDQP );
550  setdQPFlag( bCodeDQP );
551  xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
[724]552#if QC_DEPTH_IV_MRG_F0125
553  xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
554#endif
[2]555}
556
[56]557Void TDecCu::xFinishDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast)
558{
[608]559  if(  pcCU->getSlice()->getPPS()->getUseDQP())
[56]560  {
[608]561    pcCU->setQPSubParts( getdQPFlag()?pcCU->getRefQP(uiAbsPartIdx):pcCU->getCodedQP(), uiAbsPartIdx, uiDepth ); // set QP
[56]562  }
563
564  ruiIsLast = xDecodeSliceEnd( pcCU, uiAbsPartIdx, uiDepth);
565}
566
[608]567Void TDecCu::xDecompressCU( TComDataCU* pcCU, UInt uiAbsPartIdx,  UInt uiDepth )
[2]568{
569  TComPic* pcPic = pcCU->getPic();
[724]570#if !QC_DEPTH_IV_MRG_F0125 
[2]571  Bool bBoundary = false;
572  UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
573  UInt uiRPelX   = uiLPelX + (g_uiMaxCUWidth>>uiDepth)  - 1;
574  UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
575  UInt uiBPelY   = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;
576 
[56]577  UInt uiCurNumParts    = pcPic->getNumPartInCU() >> (uiDepth<<1);
578  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
[608]579  Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr();
[56]580  if(bStartInCU||( uiRPelX >= pcSlice->getSPS()->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
[2]581  {
582    bBoundary = true;
583  }
584 
585  if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary )
586  {
587    UInt uiNextDepth = uiDepth + 1;
588    UInt uiQNumParts = pcCU->getTotalNumPart() >> (uiNextDepth<<1);
589    UInt uiIdx = uiAbsPartIdx;
590    for ( UInt uiPartIdx = 0; uiPartIdx < 4; uiPartIdx++ )
591    {
592      uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ];
593      uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
594     
[608]595      Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getSliceSegmentCurEndCUAddr());
[56]596      if(binSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
597      {
[608]598        xDecompressCU(pcCU, uiIdx, uiNextDepth );
[56]599      }
[2]600     
601      uiIdx += uiQNumParts;
602    }
603    return;
604  }
[724]605#endif 
[2]606  // Residual reconstruction
607  m_ppcYuvResi[uiDepth]->clear();
608 
609  m_ppcCU[uiDepth]->copySubCU( pcCU, uiAbsPartIdx, uiDepth );
610 
611  switch( m_ppcCU[uiDepth]->getPredictionMode(0) )
612  {
613    case MODE_INTER:
[655]614#if H_3D_INTER_SDC
[608]615      if( m_ppcCU[uiDepth]->getInterSDCFlag( 0 ) )
616      {
617        xReconInterSDC( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
618      }
619      else
620      {
621#endif
622      xReconInter( m_ppcCU[uiDepth], uiDepth );
[655]623#if H_3D_INTER_SDC
[608]624      }
625#endif
[2]626      break;
627    case MODE_INTRA:
[608]628#if H_3D_DIM_SDC
[189]629      if( m_ppcCU[uiDepth]->getSDCFlag(0) )
630        xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );
631      else
632#endif
[608]633      xReconIntraQT( m_ppcCU[uiDepth], uiDepth );
[2]634      break;
635    default:
636      assert(0);
637      break;
638  }
[56]639  if ( m_ppcCU[uiDepth]->isLosslessCoded(0) && (m_ppcCU[uiDepth]->getIPCMFlag(0) == false))
640  {
[608]641    xFillPCMBuffer(m_ppcCU[uiDepth], uiDepth);
[56]642  }
[2]643 
644  xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth );
645}
646
[608]647Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiDepth )
[2]648{
649 
650  // inter prediction
651  m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
[608]652 
[2]653  // inter recon
654  xDecodeInterTexture( pcCU, 0, uiDepth );
655 
656  // clip for only non-zero cbp case
657  if  ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) )
658  {
659    m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) );
660  }
661  else
662  {
[608]663    m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 ));
664  }
665}
666
[655]667#if H_3D_INTER_SDC
[608]668Void TDecCu::xReconInterSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
669{
670  // inter prediction
671  m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
672
673  UInt  uiWidth      = pcCU->getWidth ( 0 );
674  UInt  uiHeight     = pcCU->getHeight( 0 );
675  UChar* pMask       = pcCU->getInterSDCMask();
676
677  memset( pMask, 0, uiWidth*uiHeight );
678  pcCU->xSetInterSDCCUMask( pcCU, pMask );
679
680  Pel  *pResi;
681  UInt uiPelX, uiPelY;
682  UInt uiResiStride = m_ppcYuvResi[uiDepth]->getStride();
683
684  pResi = m_ppcYuvResi[uiDepth]->getLumaAddr( 0 );
685  for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ )
686  {
687    for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
[2]688    {
[608]689      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
690
691      pResi[ uiPelX ] = pcCU->getInterSDCSegmentDCOffset( uiSeg, 0 );;
[2]692    }
[608]693    pResi += uiResiStride;
[2]694  }
[608]695
696  m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) );
697
698  // clear UV
699  UInt  uiStrideC     = m_ppcYuvReco[uiDepth]->getCStride();
700  Pel   *pRecCb       = m_ppcYuvReco[uiDepth]->getCbAddr();
701  Pel   *pRecCr       = m_ppcYuvReco[uiDepth]->getCrAddr();
702
703  for (Int y = 0; y < uiHeight/2; y++)
704  {
705    for (Int x = 0; x < uiWidth/2; x++)
706    {
707      pRecCb[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) );
708      pRecCr[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) );
709    }
710
711    pRecCb += uiStrideC;
712    pRecCr += uiStrideC;
713  }
[2]714}
[608]715#endif
[2]716
717Void
718TDecCu::xIntraRecLumaBlk( TComDataCU* pcCU,
719                         UInt        uiTrDepth,
720                         UInt        uiAbsPartIdx,
721                         TComYuv*    pcRecoYuv,
722                         TComYuv*    pcPredYuv, 
723                         TComYuv*    pcResiYuv )
724{
725  UInt    uiWidth           = pcCU     ->getWidth   ( 0 ) >> uiTrDepth;
726  UInt    uiHeight          = pcCU     ->getHeight  ( 0 ) >> uiTrDepth;
727  UInt    uiStride          = pcRecoYuv->getStride  ();
728  Pel*    piReco            = pcRecoYuv->getLumaAddr( uiAbsPartIdx );
729  Pel*    piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
730  Pel*    piResi            = pcResiYuv->getLumaAddr( uiAbsPartIdx );
731 
732  UInt    uiNumCoeffInc     = ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 );
733  TCoeff* pcCoeff           = pcCU->getCoeffY() + ( uiNumCoeffInc * uiAbsPartIdx );
734 
735  UInt    uiLumaPredMode    = pcCU->getLumaIntraDir     ( uiAbsPartIdx );
736 
737  UInt    uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
738  Pel*    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
739  UInt    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
[608]740  Bool    useTransformSkip  = pcCU->getTransformSkip(uiAbsPartIdx, TEXT_LUMA);
[2]741  //===== init availability pattern =====
742  Bool  bAboveAvail = false;
743  Bool  bLeftAvail  = false;
744  pcCU->getPattern()->initPattern   ( pcCU, uiTrDepth, uiAbsPartIdx );
745  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, 
746                                     m_pcPrediction->getPredicBuf       (),
747                                     m_pcPrediction->getPredicBufWidth  (),
748                                     m_pcPrediction->getPredicBufHeight (),
749                                     bAboveAvail, bLeftAvail );
750 
[56]751  //===== get prediction signal =====
[608]752#if H_3D_DIM
753  if( isDimMode( uiLumaPredMode ) )
[2]754  {
[608]755    m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight );
756  }
[2]757  else
[56]758  {
[2]759#endif
[608]760  m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
761#if H_3D_DIM
[2]762  }
[56]763#endif
764 
[2]765  //===== inverse transform =====
[608]766  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
[2]767
[56]768  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA];
769  assert(scalingListType < 6);
[608]770  m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkip );
[56]771
[2]772 
773  //===== reconstruction =====
[56]774  Pel* pPred      = piPred;
775  Pel* pResi      = piResi;
776  Pel* pReco      = piReco;
777  Pel* pRecIPred  = piRecIPred;
778  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
[2]779  {
[56]780    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
[2]781    {
[724]782#if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
[748]783#if DLT_DIFF_CODING_IN_PPS
784      if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getPPS()->getDLT()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
785#else
786      if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
787#endif
[724]788        {
[748]789#if DLT_DIFF_CODING_IN_PPS
790          pReco    [ uiX ] = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
791#else
792          pReco    [ uiX ] = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), Clip3( 0, pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) - 1, pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pPred[ uiX ] ) + pResi[ uiX ] ) );
793#endif
[724]794        }
795        else
796        {
[608]797      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
[724]798        }
799#else
800      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
801#endif
[56]802      pRecIPred[ uiX ] = pReco[ uiX ];
[2]803    }
[56]804    pPred     += uiStride;
805    pResi     += uiStride;
806    pReco     += uiStride;
807    pRecIPred += uiRecIPredStride;
[2]808  }
809}
810
811
812Void
813TDecCu::xIntraRecChromaBlk( TComDataCU* pcCU,
814                           UInt        uiTrDepth,
815                           UInt        uiAbsPartIdx,
816                           TComYuv*    pcRecoYuv,
817                           TComYuv*    pcPredYuv, 
818                           TComYuv*    pcResiYuv,
819                           UInt        uiChromaId )
820{
821  UInt uiFullDepth  = pcCU->getDepth( 0 ) + uiTrDepth;
822  UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiFullDepth ] + 2;
[56]823
824  if( uiLog2TrSize == 2 )
[2]825  {
826    assert( uiTrDepth > 0 );
827    uiTrDepth--;
828    UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth( 0 ) + uiTrDepth ) << 1 );
829    Bool bFirstQ = ( ( uiAbsPartIdx % uiQPDiv ) == 0 );
830    if( !bFirstQ )
831    {
832      return;
833    }
834  }
835 
836  TextType  eText             = ( uiChromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U );
837  UInt      uiWidth           = pcCU     ->getWidth   ( 0 ) >> ( uiTrDepth + 1 );
838  UInt      uiHeight          = pcCU     ->getHeight  ( 0 ) >> ( uiTrDepth + 1 );
839  UInt      uiStride          = pcRecoYuv->getCStride ();
840  Pel*      piReco            = ( uiChromaId > 0 ? pcRecoYuv->getCrAddr( uiAbsPartIdx ) : pcRecoYuv->getCbAddr( uiAbsPartIdx ) );
841  Pel*      piPred            = ( uiChromaId > 0 ? pcPredYuv->getCrAddr( uiAbsPartIdx ) : pcPredYuv->getCbAddr( uiAbsPartIdx ) );
842  Pel*      piResi            = ( uiChromaId > 0 ? pcResiYuv->getCrAddr( uiAbsPartIdx ) : pcResiYuv->getCbAddr( uiAbsPartIdx ) );
843 
844  UInt      uiNumCoeffInc     = ( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ) ) >> 2;
845  TCoeff*   pcCoeff           = ( uiChromaId > 0 ? pcCU->getCoeffCr() : pcCU->getCoeffCb() ) + ( uiNumCoeffInc * uiAbsPartIdx );
846 
847  UInt      uiChromaPredMode  = pcCU->getChromaIntraDir( 0 );
848 
849  UInt      uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
850  Pel*      piRecIPred        = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) );
851  UInt      uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getCStride();
[608]852  Bool      useTransformSkipChroma = pcCU->getTransformSkip(uiAbsPartIdx,eText);
[2]853  //===== init availability pattern =====
854  Bool  bAboveAvail = false;
855  Bool  bLeftAvail  = false;
856  pcCU->getPattern()->initPattern         ( pcCU, uiTrDepth, uiAbsPartIdx );
[56]857
[608]858  pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth,
[2]859                                           m_pcPrediction->getPredicBuf       (),
860                                           m_pcPrediction->getPredicBufWidth  (),
861                                           m_pcPrediction->getPredicBufHeight (),
862                                           bAboveAvail, bLeftAvail );
863  Int* pPatChroma   = ( uiChromaId > 0 ? pcCU->getPattern()->getAdiCrBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) : pcCU->getPattern()->getAdiCbBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) );
864 
865  //===== get prediction signal =====
866  {
[56]867    if( uiChromaPredMode == DM_CHROMA_IDX )
[2]868    {
[56]869      uiChromaPredMode = pcCU->getLumaIntraDir( 0 );
[608]870#if H_3D_DIM
871      mapDepthModeToIntraDir( uiChromaPredMode );
[56]872#endif
[2]873    }
[608]874    m_pcPrediction->predIntraChromaAng( pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 
[2]875  }
876
877  //===== inverse transform =====
[608]878  Int curChromaQpOffset;
[56]879  if(eText == TEXT_CHROMA_U)
880  {
[608]881    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
[56]882  }
883  else
884  {
[608]885    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
[56]886  }
[608]887  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
[2]888
[56]889  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText];
890  assert(scalingListType < 6);
[608]891  m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkipChroma );
[56]892
[2]893  //===== reconstruction =====
[56]894  Pel* pPred      = piPred;
895  Pel* pResi      = piResi;
896  Pel* pReco      = piReco;
897  Pel* pRecIPred  = piRecIPred;
898  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
[2]899  {
[56]900    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
[2]901    {
[608]902      pReco    [ uiX ] = ClipC( pPred[ uiX ] + pResi[ uiX ] );
[56]903      pRecIPred[ uiX ] = pReco[ uiX ];
[2]904    }
[56]905    pPred     += uiStride;
906    pResi     += uiStride;
907    pReco     += uiStride;
908    pRecIPred += uiRecIPredStride;
[2]909  }
910}
911
912
913Void
[608]914TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiDepth )
[2]915{
916  UInt  uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 );
917  UInt  uiNumPart     = pcCU->getNumPartInter();
918  UInt  uiNumQParts   = pcCU->getTotalNumPart() >> 2;
919 
[56]920  if (pcCU->getIPCMFlag(0))
921  {
[608]922    xReconPCM( pcCU, uiDepth );
[56]923    return;
924  }
925
[2]926  for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ )
927  {
928    xIntraLumaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] );
929  } 
930
931  for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ )
932  {
933    xIntraChromaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] );
934  }
935
936}
937
[608]938#if H_3D_DIM_SDC
[189]939Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
940{
941  UInt uiWidth        = pcCU->getWidth  ( 0 );
942  UInt uiHeight       = pcCU->getHeight ( 0 );
943 
944  TComYuv* pcRecoYuv  = m_ppcYuvReco[uiDepth];
945  TComYuv* pcPredYuv  = m_ppcYuvReco[uiDepth];
946  TComYuv* pcResiYuv  = m_ppcYuvResi[uiDepth];
947 
948  UInt    uiStride    = pcRecoYuv->getStride  ();
949  Pel*    piReco      = pcRecoYuv->getLumaAddr( uiAbsPartIdx );
950  Pel*    piPred      = pcPredYuv->getLumaAddr( uiAbsPartIdx );
951  Pel*    piResi      = pcResiYuv->getLumaAddr( uiAbsPartIdx );
952 
953  UInt    uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
954  Pel*    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
955  UInt    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
956 
957  UInt    uiLumaPredMode    = pcCU->getLumaIntraDir     ( uiAbsPartIdx );
958 
959  AOF( uiWidth == uiHeight );
960  AOF( uiAbsPartIdx == 0 );
961  AOF( pcCU->getSDCAvailable(uiAbsPartIdx) );
962  AOF( pcCU->getSDCFlag(uiAbsPartIdx) );
963 
964  //===== init availability pattern =====
965  Bool  bAboveAvail = false;
966  Bool  bLeftAvail  = false;
967  pcCU->getPattern()->initPattern   ( pcCU, 0, uiAbsPartIdx );
968  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail );
969 
970  //===== get prediction signal =====
[608]971#if H_3D_DIM
972  if( isDimMode( uiLumaPredMode ) )
[189]973  {
[608]974    m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight );
[189]975  }
976  else
977  {
978#endif
[608]979    m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
980#if H_3D_DIM
[189]981  }
982#endif
983 
984  // number of segments depends on prediction mode
[608]985  UInt uiNumSegments = 1;
[189]986  Bool* pbMask = NULL;
987  UInt uiMaskStride = 0;
988 
[608]989  if( getDimType( uiLumaPredMode ) == DMM1_IDX )
[189]990  {
[608]991    Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx);
[189]992   
[608]993    WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];
[189]994    TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx ));
995   
996    uiNumSegments = 2;
997    pbMask = pcWedgelet->getPattern();
998    uiMaskStride = pcWedgelet->getStride();
999  }
1000 
1001  // get DC prediction for each segment
1002  Pel apDCPredValues[2];
[608]1003  m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode);
[189]1004 
1005  // reconstruct residual based on mask + DC residuals
1006  Pel apDCResiValues[2];
[608]1007  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
[189]1008  {
[608]1009#if H_3D_DIM_DLT
[748]1010#if DLT_DIFF_CODING_IN_PPS
1011    Pel   pPredIdx    = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
1012    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
1013    Pel   pRecoValue  = pcCU->getSlice()->getPPS()->getDLT()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
1014#else
[608]1015    Pel   pPredIdx    = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
1016    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
1017    Pel   pRecoValue  = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
[748]1018#endif
1019
[608]1020    apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
1021#else
1022    apDCResiValues[uiSegment]  = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
[443]1023#endif
[189]1024  }
1025 
1026  //===== reconstruction =====
1027  Bool*pMask      = pbMask;
1028  Pel* pPred      = piPred;
1029  Pel* pResi      = piResi;
1030  Pel* pReco      = piReco;
1031  Pel* pRecIPred  = piRecIPred;
1032 
1033  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
1034  {
1035    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
1036    {
1037      UChar ucSegment = pMask?(UChar)pMask[uiX]:0;
1038      assert( ucSegment < uiNumSegments );
1039     
1040      Pel pResiDC = apDCResiValues[ucSegment];
1041     
[608]1042      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResiDC );
[189]1043      pRecIPred[ uiX ] = pReco[ uiX ];
1044    }
1045    pPred     += uiStride;
1046    pResi     += uiStride;
1047    pReco     += uiStride;
1048    pRecIPred += uiRecIPredStride;
1049    pMask     += uiMaskStride;
1050  }
1051 
1052  // clear UV
1053  UInt  uiStrideC     = pcPredYuv->getCStride();
1054  Pel   *pRecCb       = pcPredYuv->getCbAddr();
1055  Pel   *pRecCr       = pcPredYuv->getCrAddr();
1056 
1057  for (Int y=0; y<uiHeight/2; y++)
1058  {
1059    for (Int x=0; x<uiWidth/2; x++)
1060    {
[608]1061      pRecCb[x] = 128;
1062      pRecCr[x] = 128;
[189]1063    }
1064   
1065    pRecCb += uiStrideC;
1066    pRecCr += uiStrideC;
1067  }
1068}
1069#endif
1070
[56]1071/** Function for deriving recontructed PU/CU Luma sample with QTree structure
[2]1072 * \param pcCU pointer of current CU
1073 * \param uiTrDepth current tranform split depth
1074 * \param uiAbsPartIdx  part index
1075 * \param pcRecoYuv pointer to reconstructed sample arrays
1076 * \param pcPredYuv pointer to prediction sample arrays
1077 * \param pcResiYuv pointer to residue sample arrays
1078 *
1079 \ This function dervies recontructed PU/CU Luma sample with recursive QTree structure
1080 */
1081Void
1082TDecCu::xIntraLumaRecQT( TComDataCU* pcCU,
1083                     UInt        uiTrDepth,
1084                     UInt        uiAbsPartIdx,
1085                     TComYuv*    pcRecoYuv,
1086                     TComYuv*    pcPredYuv, 
1087                     TComYuv*    pcResiYuv )
1088{
1089  UInt uiFullDepth  = pcCU->getDepth(0) + uiTrDepth;
1090  UInt uiTrMode     = pcCU->getTransformIdx( uiAbsPartIdx );
1091  if( uiTrMode == uiTrDepth )
1092  {
1093    xIntraRecLumaBlk  ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv );
1094  }
1095  else
1096  {
1097    UInt uiNumQPart  = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 );
1098    for( UInt uiPart = 0; uiPart < 4; uiPart++ )
1099    {
1100      xIntraLumaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv );
1101    }
1102  }
1103}
1104
[56]1105/** Function for deriving recontructed PU/CU chroma samples with QTree structure
[2]1106 * \param pcCU pointer of current CU
1107 * \param uiTrDepth current tranform split depth
1108 * \param uiAbsPartIdx  part index
1109 * \param pcRecoYuv pointer to reconstructed sample arrays
1110 * \param pcPredYuv pointer to prediction sample arrays
1111 * \param pcResiYuv pointer to residue sample arrays
1112 *
1113 \ This function dervies recontructed PU/CU chroma samples with QTree recursive structure
1114 */
1115Void
1116TDecCu::xIntraChromaRecQT( TComDataCU* pcCU,
1117                     UInt        uiTrDepth,
1118                     UInt        uiAbsPartIdx,
1119                     TComYuv*    pcRecoYuv,
1120                     TComYuv*    pcPredYuv, 
1121                     TComYuv*    pcResiYuv )
1122{
1123  UInt uiFullDepth  = pcCU->getDepth(0) + uiTrDepth;
1124  UInt uiTrMode     = pcCU->getTransformIdx( uiAbsPartIdx );
1125  if( uiTrMode == uiTrDepth )
1126  {
1127    xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 );
1128    xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 );
1129  }
1130  else
1131  {
1132    UInt uiNumQPart  = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 );
1133    for( UInt uiPart = 0; uiPart < 4; uiPart++ )
1134    {
1135      xIntraChromaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv );
1136    }
1137  }
1138}
1139
1140Void TDecCu::xCopyToPic( TComDataCU* pcCU, TComPic* pcPic, UInt uiZorderIdx, UInt uiDepth )
1141{
1142  UInt uiCUAddr = pcCU->getAddr();
1143 
1144  m_ppcYuvReco[uiDepth]->copyToPicYuv  ( pcPic->getPicYuvRec (), uiCUAddr, uiZorderIdx );
1145 
1146  return;
1147}
1148
1149Void TDecCu::xDecodeInterTexture ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
1150{
1151  UInt    uiWidth    = pcCU->getWidth ( uiAbsPartIdx );
1152  UInt    uiHeight   = pcCU->getHeight( uiAbsPartIdx );
1153  TCoeff* piCoeff;
1154 
1155  Pel*    pResi;
[608]1156  UInt    trMode = pcCU->getTransformIdx( uiAbsPartIdx );
[2]1157 
1158  // Y
1159  piCoeff = pcCU->getCoeffY();
1160  pResi = m_ppcYuvResi[uiDepth]->getLumaAddr();
[56]1161
[608]1162  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
[56]1163
[608]1164  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
[2]1165 
1166  // Cb and Cr
[608]1167  Int curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
1168  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
[56]1169
[2]1170  uiWidth  >>= 1;
1171  uiHeight >>= 1;
1172  piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr();
[608]1173  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
[56]1174
[608]1175  curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
1176  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
[56]1177
[2]1178  piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr();
[608]1179  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
[2]1180}
1181
[56]1182/** Function for deriving reconstructed luma/chroma samples of a PCM mode CU.
1183 * \param pcCU pointer to current CU
1184 * \param uiPartIdx part index
1185 * \param piPCM pointer to PCM code arrays
1186 * \param piReco pointer to reconstructed sample arrays
1187 * \param uiStride stride of reconstructed sample arrays
1188 * \param uiWidth CU width
1189 * \param uiHeight CU height
1190 * \param ttText texture component type
1191 * \returns Void
1192 */
1193Void TDecCu::xDecodePCMTexture( TComDataCU* pcCU, UInt uiPartIdx, Pel *piPCM, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType ttText)
1194{
1195  UInt uiX, uiY;
1196  Pel* piPicReco;
1197  UInt uiPicStride;
1198  UInt uiPcmLeftShiftBit; 
1199
1200  if( ttText == TEXT_LUMA )
1201  {
1202    uiPicStride   = pcCU->getPic()->getPicYuvRec()->getStride();
1203    piPicReco = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
[608]1204    uiPcmLeftShiftBit = g_bitDepthY - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();
[56]1205  }
1206  else
1207  {
1208    uiPicStride = pcCU->getPic()->getPicYuvRec()->getCStride();
1209
1210    if( ttText == TEXT_CHROMA_U )
1211    {
1212      piPicReco = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
1213    }
1214    else
1215    {
1216      piPicReco = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
1217    }
[608]1218    uiPcmLeftShiftBit = g_bitDepthC - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
[56]1219  }
1220
1221  for( uiY = 0; uiY < uiHeight; uiY++ )
1222  {
1223    for( uiX = 0; uiX < uiWidth; uiX++ )
1224    {
1225      piReco[uiX] = (piPCM[uiX] << uiPcmLeftShiftBit);
1226      piPicReco[uiX] = piReco[uiX];
1227    }
1228    piPCM += uiWidth;
1229    piReco += uiStride;
1230    piPicReco += uiPicStride;
1231  }
1232}
1233
1234/** Function for reconstructing a PCM mode CU.
1235 * \param pcCU pointer to current CU
1236 * \param uiDepth CU Depth
1237 * \returns Void
1238 */
[608]1239Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiDepth )
[56]1240{
1241  // Luma
1242  UInt uiWidth  = (g_uiMaxCUWidth >> uiDepth);
1243  UInt uiHeight = (g_uiMaxCUHeight >> uiDepth);
1244
1245  Pel* piPcmY = pcCU->getPCMSampleY();
1246  Pel* piRecoY = m_ppcYuvReco[uiDepth]->getLumaAddr(0, uiWidth);
1247
1248  UInt uiStride = m_ppcYuvResi[uiDepth]->getStride();
1249
1250  xDecodePCMTexture( pcCU, 0, piPcmY, piRecoY, uiStride, uiWidth, uiHeight, TEXT_LUMA);
1251
1252  // Cb and Cr
1253  UInt uiCWidth  = (uiWidth>>1);
1254  UInt uiCHeight = (uiHeight>>1);
1255
1256  Pel* piPcmCb = pcCU->getPCMSampleCb();
1257  Pel* piPcmCr = pcCU->getPCMSampleCr();
1258  Pel* pRecoCb = m_ppcYuvReco[uiDepth]->getCbAddr();
1259  Pel* pRecoCr = m_ppcYuvReco[uiDepth]->getCrAddr();
1260
1261  UInt uiCStride = m_ppcYuvReco[uiDepth]->getCStride();
1262
1263  xDecodePCMTexture( pcCU, 0, piPcmCb, pRecoCb, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_U);
1264  xDecodePCMTexture( pcCU, 0, piPcmCr, pRecoCr, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_V);
1265}
1266
1267/** Function for filling the PCM buffer of a CU using its reconstructed sample array
1268 * \param pcCU pointer to current CU
1269 * \param uiDepth CU Depth
1270 * \returns Void
1271 */
[608]1272Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt depth)
[56]1273{
1274  // Luma
1275  UInt width  = (g_uiMaxCUWidth >> depth);
1276  UInt height = (g_uiMaxCUHeight >> depth);
1277
1278  Pel* pPcmY = pCU->getPCMSampleY();
1279  Pel* pRecoY = m_ppcYuvReco[depth]->getLumaAddr(0, width);
1280
1281  UInt stride = m_ppcYuvReco[depth]->getStride();
1282
1283  for(Int y = 0; y < height; y++ )
1284  {
1285    for(Int x = 0; x < width; x++ )
1286    {
1287      pPcmY[x] = pRecoY[x];
1288    }
1289    pPcmY += width;
1290    pRecoY += stride;
1291  }
1292
1293  // Cb and Cr
1294  UInt widthC  = (width>>1);
1295  UInt heightC = (height>>1);
1296
1297  Pel* pPcmCb = pCU->getPCMSampleCb();
1298  Pel* pPcmCr = pCU->getPCMSampleCr();
1299  Pel* pRecoCb = m_ppcYuvReco[depth]->getCbAddr();
1300  Pel* pRecoCr = m_ppcYuvReco[depth]->getCrAddr();
1301
1302  UInt strideC = m_ppcYuvReco[depth]->getCStride();
1303
1304  for(Int y = 0; y < heightC; y++ )
1305  {
1306    for(Int x = 0; x < widthC; x++ )
1307    {
1308      pPcmCb[x] = pRecoCb[x];
1309      pPcmCr[x] = pRecoCr[x];
1310    }
1311    pPcmCr += widthC;
1312    pPcmCb += widthC;
1313    pRecoCb += strideC;
1314    pRecoCr += strideC;
1315  }
1316
1317}
1318
1319//! \}
Note: See TracBrowser for help on using the repository browser.