source: 3DVCSoftware/trunk/source/Lib/TLibDecoder/TDecCu.cpp @ 758

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

Merged HTM-9.1-dev0-MediaTek@757. (3D-HEVC HLS)

  • Property svn:eol-style set to native
File size: 48.5 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license. 
5 *
6 * Copyright (c) 2010-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     TDecCu.cpp
35    \brief    CU decoder class
36*/
37
38#include "TDecCu.h"
39
40//! \ingroup TLibDecoder
41//! \{
42
43// ====================================================================================================================
44// Constructor / destructor / create / destroy
45// ====================================================================================================================
46
47TDecCu::TDecCu()
48{
49  m_ppcYuvResi = NULL;
50  m_ppcYuvReco = NULL;
51  m_ppcCU      = NULL;
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 
74  m_ppcYuvResi = new TComYuv*[m_uiMaxDepth-1];
75  m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1];
76  m_ppcCU      = new TComDataCU*[m_uiMaxDepth-1];
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   
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) );
88  }
89 
90  m_bDecodeDQP = false;
91
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  {
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;
108  }
109 
110  delete [] m_ppcYuvResi; m_ppcYuvResi = NULL;
111  delete [] m_ppcYuvReco; m_ppcYuvReco = NULL;
112  delete [] m_ppcCU     ; m_ppcCU      = NULL;
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{
124  if ( pcCU->getSlice()->getPPS()->getUseDQP() )
125  {
126    setdQPFlag(true);
127  }
128
129  // start from the top level CU
130  xDecodeCU( pcCU, 0, 0, ruiIsLast);
131}
132
133/** \param    pcCU        pointer of CU data
134 */
135Void TDecCu::decompressCU( TComDataCU* pcCU )
136{
137#if !QC_DEPTH_IV_MRG_F0125
138  xDecompressCU( pcCU, 0,  0 );
139#endif
140}
141
142// ====================================================================================================================
143// Protected member functions
144// ====================================================================================================================
145
146/**decode end-of-slice flag
147 * \param pcCU
148 * \param uiAbsPartIdx
149 * \param uiDepth
150 * \returns Bool
151 */
152Bool TDecCu::xDecodeSliceEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth)
153{
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();
160  UInt uiGranularityWidth = g_uiMaxCUWidth;
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  {
176    if(pcSlice->isNextSliceSegment()&&!pcSlice->isNextSlice()) 
177    {
178      pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
179    }
180    else 
181    {
182      pcSlice->setSliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
183      pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
184    }
185  }
186
187  return uiIsLast>0;
188}
189
190/** decode CU block recursively
191 * \param pcCU
192 * \param uiAbsPartIdx
193 * \param uiDepth
194 * \returns Void
195 */
196
197Void TDecCu::xDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast)
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;
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
215  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
216  Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr();
217  if((!bStartInCU) && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
218  {
219    m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
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;
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
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     
240      Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr();
241      if ( bSubInSlice )
242      {
243        if ( !ruiIsLast && ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )
244        {
245          xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast );
246        }
247        else
248        {
249          pcCU->setOutsideCUPart( uiIdx, uiDepth+1 );
250        }
251      }
252     
253      uiIdx += uiQNumParts;
254    }
255    if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
256    {
257      if ( getdQPFlag() )
258      {
259        UInt uiQPSrcPartIdx;
260        if ( pcPic->getCU( pcCU->getAddr() )->getSliceSegmentStartCU(uiAbsPartIdx) != pcSlice->getSliceSegmentCurStartCUAddr() )
261        {
262          uiQPSrcPartIdx = pcSlice->getSliceSegmentCurStartCUAddr() % pcPic->getNumPartInCU();
263        }
264        else
265        {
266          uiQPSrcPartIdx = uiAbsPartIdx;
267        }
268        pcCU->setQPSubParts( pcCU->getRefQP( uiQPSrcPartIdx ), uiAbsPartIdx, uiDepth ); // set QP to default QP
269      }
270    }
271    return;
272  }
273 
274#if H_MV_ENC_DEC_TRAC
275  DTRACE_CU_S("=========== coding_unit ===========\n")
276#endif
277
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  }
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()) )
300#else
301#if H_3D_IV_MERGE
302    if( pcCU->getSlice()->getVPS()->getIvMvPredFlag(pcCU->getSlice()->getLayerId()) )
303#else
304    if (0)
305#endif
306#endif
307#endif
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 );     
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
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.
327      {
328        DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true);
329      }
330      else
331#endif
332      {
333        DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo);
334      }
335#if QC_DEPTH_IV_MRG_F0125
336      }
337#endif
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
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())
357  {
358    m_pcEntropyDecoder->decodeCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth );
359  }
360 
361  // decode CU mode and the partition size
362  if( !pcCU->getSlice()->isIntra())
363  {
364    m_pcEntropyDecoder->decodeSkipFlag( pcCU, uiAbsPartIdx, uiDepth );
365  }
366 
367  if( pcCU->isSkipped(uiAbsPartIdx) )
368  {
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
374    m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 );
375    m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 );
376#if H_3D_IV_MERGE
377    m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx);
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
381    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists
382    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
383#endif
384    Int numValidMergeCand = 0;
385    for( UInt ui = 0; ui < m_ppcCU[uiDepth]->getSlice()->getMaxNumMergeCand(); ++ui )
386    {
387      uhInterDirNeighbours[ui] = 0;
388    }
389    m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth );
390    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
391
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
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];
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
422    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand, uiMergeIndex );
423#endif
424    pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
425#else
426#if ETRIKHU_MERGE_REUSE_F0093
427    m_ppcCU[uiDepth]->initAvailableFlags();
428    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
429    m_ppcCU[uiDepth]->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
430#else
431    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
432#endif
433#endif
434#if H_3D_VSP
435    if(vspFlag[uiMergeIndex])
436    {
437      pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiAbsPartIdx, 0, uiDepth);
438    }
439#endif
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 );
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
468      }
469    }
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    }
490#if MTK_F0110_FIX
491    delete[] pcMvFieldSP;
492    delete[] puhInterDirSP;
493#else
494    delete pcMvFieldSP;
495    delete puhInterDirSP;
496#endif
497#endif
498#if !LGE_SHARP_VSP_INHERIT_F0104
499#if H_3D_IC
500    m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
501#endif
502#if H_3D_ARP
503    m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth );
504#endif
505#endif
506
507    xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
508#if QC_DEPTH_IV_MRG_F0125
509    xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
510#endif
511    return;
512  }
513
514  m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth );
515  m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
516
517  if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
518  {
519    m_pcEntropyDecoder->decodeIPCMInfo( pcCU, uiAbsPartIdx, uiDepth );
520
521    if(pcCU->getIPCMFlag(uiAbsPartIdx))
522    {
523      xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
524#if QC_DEPTH_IV_MRG_F0125
525      xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
526#endif
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]);
536#if !LGE_SHARP_VSP_INHERIT_F0104
537#if H_3D_IC
538  m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
539#endif
540#if H_3D_ARP
541  m_pcEntropyDecoder->decodeARPW    ( pcCU , uiAbsPartIdx , uiDepth ); 
542#endif 
543#endif
544#if H_3D_INTER_SDC
545  m_pcEntropyDecoder->decodeInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
546#endif
547  // Coefficient decoding
548  Bool bCodeDQP = getdQPFlag();
549  m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, uiCurrWidth, uiCurrHeight, bCodeDQP );
550  setdQPFlag( bCodeDQP );
551  xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
552#if QC_DEPTH_IV_MRG_F0125
553  xDecompressCU(pcCU, uiAbsPartIdx, uiDepth );
554#endif
555}
556
557Void TDecCu::xFinishDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast)
558{
559  if(  pcCU->getSlice()->getPPS()->getUseDQP())
560  {
561    pcCU->setQPSubParts( getdQPFlag()?pcCU->getRefQP(uiAbsPartIdx):pcCU->getCodedQP(), uiAbsPartIdx, uiDepth ); // set QP
562  }
563
564  ruiIsLast = xDecodeSliceEnd( pcCU, uiAbsPartIdx, uiDepth);
565}
566
567Void TDecCu::xDecompressCU( TComDataCU* pcCU, UInt uiAbsPartIdx,  UInt uiDepth )
568{
569  TComPic* pcPic = pcCU->getPic();
570#if !QC_DEPTH_IV_MRG_F0125 
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 
577  UInt uiCurNumParts    = pcPic->getNumPartInCU() >> (uiDepth<<1);
578  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
579  Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr();
580  if(bStartInCU||( uiRPelX >= pcSlice->getSPS()->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
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     
595      Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getSliceSegmentCurEndCUAddr());
596      if(binSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
597      {
598        xDecompressCU(pcCU, uiIdx, uiNextDepth );
599      }
600     
601      uiIdx += uiQNumParts;
602    }
603    return;
604  }
605#endif 
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:
614#if H_3D_INTER_SDC
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 );
623#if H_3D_INTER_SDC
624      }
625#endif
626      break;
627    case MODE_INTRA:
628#if H_3D_DIM_SDC
629      if( m_ppcCU[uiDepth]->getSDCFlag(0) )
630        xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );
631      else
632#endif
633      xReconIntraQT( m_ppcCU[uiDepth], uiDepth );
634      break;
635    default:
636      assert(0);
637      break;
638  }
639  if ( m_ppcCU[uiDepth]->isLosslessCoded(0) && (m_ppcCU[uiDepth]->getIPCMFlag(0) == false))
640  {
641    xFillPCMBuffer(m_ppcCU[uiDepth], uiDepth);
642  }
643 
644  xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth );
645}
646
647Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiDepth )
648{
649 
650  // inter prediction
651  m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
652 
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  {
663    m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 ));
664  }
665}
666
667#if H_3D_INTER_SDC
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++ )
688    {
689      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
690
691      pResi[ uiPelX ] = pcCU->getInterSDCSegmentDCOffset( uiSeg, 0 );;
692    }
693    pResi += uiResiStride;
694  }
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  }
714}
715#endif
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  ();
740  Bool    useTransformSkip  = pcCU->getTransformSkip(uiAbsPartIdx, TEXT_LUMA);
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 
751  //===== get prediction signal =====
752#if H_3D_DIM
753  if( isDimMode( uiLumaPredMode ) )
754  {
755    m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight );
756  }
757  else
758  {
759#endif
760  m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
761#if H_3D_DIM
762  }
763#endif
764 
765  //===== inverse transform =====
766  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
767
768  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA];
769  assert(scalingListType < 6);
770  m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkip );
771
772 
773  //===== reconstruction =====
774  Pel* pPred      = piPred;
775  Pel* pResi      = piResi;
776  Pel* pReco      = piReco;
777  Pel* pRecIPred  = piRecIPred;
778  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
779  {
780    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
781    {
782#if LGE_PRED_RES_CODING_DLT_DOMAIN_F0159
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
788        {
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
794        }
795        else
796        {
797      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
798        }
799#else
800      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
801#endif
802      pRecIPred[ uiX ] = pReco[ uiX ];
803    }
804    pPred     += uiStride;
805    pResi     += uiStride;
806    pReco     += uiStride;
807    pRecIPred += uiRecIPredStride;
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;
823
824  if( uiLog2TrSize == 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();
852  Bool      useTransformSkipChroma = pcCU->getTransformSkip(uiAbsPartIdx,eText);
853  //===== init availability pattern =====
854  Bool  bAboveAvail = false;
855  Bool  bLeftAvail  = false;
856  pcCU->getPattern()->initPattern         ( pcCU, uiTrDepth, uiAbsPartIdx );
857
858  pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth,
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  {
867    if( uiChromaPredMode == DM_CHROMA_IDX )
868    {
869      uiChromaPredMode = pcCU->getLumaIntraDir( 0 );
870#if H_3D_DIM
871      mapDepthModeToIntraDir( uiChromaPredMode );
872#endif
873    }
874    m_pcPrediction->predIntraChromaAng( pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 
875  }
876
877  //===== inverse transform =====
878  Int curChromaQpOffset;
879  if(eText == TEXT_CHROMA_U)
880  {
881    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
882  }
883  else
884  {
885    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
886  }
887  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
888
889  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText];
890  assert(scalingListType < 6);
891  m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkipChroma );
892
893  //===== reconstruction =====
894  Pel* pPred      = piPred;
895  Pel* pResi      = piResi;
896  Pel* pReco      = piReco;
897  Pel* pRecIPred  = piRecIPred;
898  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
899  {
900    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
901    {
902      pReco    [ uiX ] = ClipC( pPred[ uiX ] + pResi[ uiX ] );
903      pRecIPred[ uiX ] = pReco[ uiX ];
904    }
905    pPred     += uiStride;
906    pResi     += uiStride;
907    pReco     += uiStride;
908    pRecIPred += uiRecIPredStride;
909  }
910}
911
912
913Void
914TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiDepth )
915{
916  UInt  uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 );
917  UInt  uiNumPart     = pcCU->getNumPartInter();
918  UInt  uiNumQParts   = pcCU->getTotalNumPart() >> 2;
919 
920  if (pcCU->getIPCMFlag(0))
921  {
922    xReconPCM( pcCU, uiDepth );
923    return;
924  }
925
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
938#if H_3D_DIM_SDC
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 =====
971#if H_3D_DIM
972  if( isDimMode( uiLumaPredMode ) )
973  {
974    m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight );
975  }
976  else
977  {
978#endif
979    m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
980#if H_3D_DIM
981  }
982#endif
983 
984  // number of segments depends on prediction mode
985  UInt uiNumSegments = 1;
986  Bool* pbMask = NULL;
987  UInt uiMaskStride = 0;
988 
989  if( getDimType( uiLumaPredMode ) == DMM1_IDX )
990  {
991    Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx);
992   
993    WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];
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];
1003  m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode);
1004 
1005  // reconstruct residual based on mask + DC residuals
1006  Pel apDCResiValues[2];
1007  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
1008  {
1009#if H_3D_DIM_DLT
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
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 );
1018#endif
1019
1020    apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
1021#else
1022    apDCResiValues[uiSegment]  = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
1023#endif
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     
1042      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResiDC );
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    {
1061      pRecCb[x] = 128;
1062      pRecCr[x] = 128;
1063    }
1064   
1065    pRecCb += uiStrideC;
1066    pRecCr += uiStrideC;
1067  }
1068}
1069#endif
1070
1071/** Function for deriving recontructed PU/CU Luma sample with QTree structure
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
1105/** Function for deriving recontructed PU/CU chroma samples with QTree structure
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;
1156  UInt    trMode = pcCU->getTransformIdx( uiAbsPartIdx );
1157 
1158  // Y
1159  piCoeff = pcCU->getCoeffY();
1160  pResi = m_ppcYuvResi[uiDepth]->getLumaAddr();
1161
1162  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
1163
1164  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
1165 
1166  // Cb and Cr
1167  Int curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
1168  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
1169
1170  uiWidth  >>= 1;
1171  uiHeight >>= 1;
1172  piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr();
1173  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
1174
1175  curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
1176  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
1177
1178  piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr();
1179  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
1180}
1181
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);
1204    uiPcmLeftShiftBit = g_bitDepthY - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();
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    }
1218    uiPcmLeftShiftBit = g_bitDepthC - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
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 */
1239Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiDepth )
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 */
1272Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt depth)
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.