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

Last change on this file since 753 was 735, checked in by tech, 12 years ago

Merged HTM-9.0-Fix@734.

  • Property svn:eol-style set to native
File size: 47.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
783        if( (isDimMode( uiLumaPredMode ) || uiLumaPredMode == HOR_IDX || uiLumaPredMode == VER_IDX || uiLumaPredMode == DC_IDX) && pcCU->getSlice()->getIsDepth() && pcCU->getSlice()->getVPS()->getUseDLTFlag(pcCU->getSlice()->getLayerIdInVps()) )
784        {
785            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 ] ) );
786        }
787        else
788        {
[608]789      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
[724]790        }
791#else
792      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
793#endif
[56]794      pRecIPred[ uiX ] = pReco[ uiX ];
[2]795    }
[56]796    pPred     += uiStride;
797    pResi     += uiStride;
798    pReco     += uiStride;
799    pRecIPred += uiRecIPredStride;
[2]800  }
801}
802
803
804Void
805TDecCu::xIntraRecChromaBlk( TComDataCU* pcCU,
806                           UInt        uiTrDepth,
807                           UInt        uiAbsPartIdx,
808                           TComYuv*    pcRecoYuv,
809                           TComYuv*    pcPredYuv, 
810                           TComYuv*    pcResiYuv,
811                           UInt        uiChromaId )
812{
813  UInt uiFullDepth  = pcCU->getDepth( 0 ) + uiTrDepth;
814  UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiFullDepth ] + 2;
[56]815
816  if( uiLog2TrSize == 2 )
[2]817  {
818    assert( uiTrDepth > 0 );
819    uiTrDepth--;
820    UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth( 0 ) + uiTrDepth ) << 1 );
821    Bool bFirstQ = ( ( uiAbsPartIdx % uiQPDiv ) == 0 );
822    if( !bFirstQ )
823    {
824      return;
825    }
826  }
827 
828  TextType  eText             = ( uiChromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U );
829  UInt      uiWidth           = pcCU     ->getWidth   ( 0 ) >> ( uiTrDepth + 1 );
830  UInt      uiHeight          = pcCU     ->getHeight  ( 0 ) >> ( uiTrDepth + 1 );
831  UInt      uiStride          = pcRecoYuv->getCStride ();
832  Pel*      piReco            = ( uiChromaId > 0 ? pcRecoYuv->getCrAddr( uiAbsPartIdx ) : pcRecoYuv->getCbAddr( uiAbsPartIdx ) );
833  Pel*      piPred            = ( uiChromaId > 0 ? pcPredYuv->getCrAddr( uiAbsPartIdx ) : pcPredYuv->getCbAddr( uiAbsPartIdx ) );
834  Pel*      piResi            = ( uiChromaId > 0 ? pcResiYuv->getCrAddr( uiAbsPartIdx ) : pcResiYuv->getCbAddr( uiAbsPartIdx ) );
835 
836  UInt      uiNumCoeffInc     = ( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ) ) >> 2;
837  TCoeff*   pcCoeff           = ( uiChromaId > 0 ? pcCU->getCoeffCr() : pcCU->getCoeffCb() ) + ( uiNumCoeffInc * uiAbsPartIdx );
838 
839  UInt      uiChromaPredMode  = pcCU->getChromaIntraDir( 0 );
840 
841  UInt      uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
842  Pel*      piRecIPred        = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) );
843  UInt      uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getCStride();
[608]844  Bool      useTransformSkipChroma = pcCU->getTransformSkip(uiAbsPartIdx,eText);
[2]845  //===== init availability pattern =====
846  Bool  bAboveAvail = false;
847  Bool  bLeftAvail  = false;
848  pcCU->getPattern()->initPattern         ( pcCU, uiTrDepth, uiAbsPartIdx );
[56]849
[608]850  pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth,
[2]851                                           m_pcPrediction->getPredicBuf       (),
852                                           m_pcPrediction->getPredicBufWidth  (),
853                                           m_pcPrediction->getPredicBufHeight (),
854                                           bAboveAvail, bLeftAvail );
855  Int* pPatChroma   = ( uiChromaId > 0 ? pcCU->getPattern()->getAdiCrBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) : pcCU->getPattern()->getAdiCbBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) );
856 
857  //===== get prediction signal =====
858  {
[56]859    if( uiChromaPredMode == DM_CHROMA_IDX )
[2]860    {
[56]861      uiChromaPredMode = pcCU->getLumaIntraDir( 0 );
[608]862#if H_3D_DIM
863      mapDepthModeToIntraDir( uiChromaPredMode );
[56]864#endif
[2]865    }
[608]866    m_pcPrediction->predIntraChromaAng( pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 
[2]867  }
868
869  //===== inverse transform =====
[608]870  Int curChromaQpOffset;
[56]871  if(eText == TEXT_CHROMA_U)
872  {
[608]873    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
[56]874  }
875  else
876  {
[608]877    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
[56]878  }
[608]879  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
[2]880
[56]881  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText];
882  assert(scalingListType < 6);
[608]883  m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkipChroma );
[56]884
[2]885  //===== reconstruction =====
[56]886  Pel* pPred      = piPred;
887  Pel* pResi      = piResi;
888  Pel* pReco      = piReco;
889  Pel* pRecIPred  = piRecIPred;
890  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
[2]891  {
[56]892    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
[2]893    {
[608]894      pReco    [ uiX ] = ClipC( pPred[ uiX ] + pResi[ uiX ] );
[56]895      pRecIPred[ uiX ] = pReco[ uiX ];
[2]896    }
[56]897    pPred     += uiStride;
898    pResi     += uiStride;
899    pReco     += uiStride;
900    pRecIPred += uiRecIPredStride;
[2]901  }
902}
903
904
905Void
[608]906TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiDepth )
[2]907{
908  UInt  uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 );
909  UInt  uiNumPart     = pcCU->getNumPartInter();
910  UInt  uiNumQParts   = pcCU->getTotalNumPart() >> 2;
911 
[56]912  if (pcCU->getIPCMFlag(0))
913  {
[608]914    xReconPCM( pcCU, uiDepth );
[56]915    return;
916  }
917
[2]918  for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ )
919  {
920    xIntraLumaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] );
921  } 
922
923  for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ )
924  {
925    xIntraChromaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] );
926  }
927
928}
929
[608]930#if H_3D_DIM_SDC
[189]931Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
932{
933  UInt uiWidth        = pcCU->getWidth  ( 0 );
934  UInt uiHeight       = pcCU->getHeight ( 0 );
935 
936  TComYuv* pcRecoYuv  = m_ppcYuvReco[uiDepth];
937  TComYuv* pcPredYuv  = m_ppcYuvReco[uiDepth];
938  TComYuv* pcResiYuv  = m_ppcYuvResi[uiDepth];
939 
940  UInt    uiStride    = pcRecoYuv->getStride  ();
941  Pel*    piReco      = pcRecoYuv->getLumaAddr( uiAbsPartIdx );
942  Pel*    piPred      = pcPredYuv->getLumaAddr( uiAbsPartIdx );
943  Pel*    piResi      = pcResiYuv->getLumaAddr( uiAbsPartIdx );
944 
945  UInt    uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
946  Pel*    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
947  UInt    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
948 
949  UInt    uiLumaPredMode    = pcCU->getLumaIntraDir     ( uiAbsPartIdx );
950 
951  AOF( uiWidth == uiHeight );
952  AOF( uiAbsPartIdx == 0 );
953  AOF( pcCU->getSDCAvailable(uiAbsPartIdx) );
954  AOF( pcCU->getSDCFlag(uiAbsPartIdx) );
955 
956  //===== init availability pattern =====
957  Bool  bAboveAvail = false;
958  Bool  bLeftAvail  = false;
959  pcCU->getPattern()->initPattern   ( pcCU, 0, uiAbsPartIdx );
960  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail );
961 
962  //===== get prediction signal =====
[608]963#if H_3D_DIM
964  if( isDimMode( uiLumaPredMode ) )
[189]965  {
[608]966    m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight );
[189]967  }
968  else
969  {
970#endif
[608]971    m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
972#if H_3D_DIM
[189]973  }
974#endif
975 
976  // number of segments depends on prediction mode
[608]977  UInt uiNumSegments = 1;
[189]978  Bool* pbMask = NULL;
979  UInt uiMaskStride = 0;
980 
[608]981  if( getDimType( uiLumaPredMode ) == DMM1_IDX )
[189]982  {
[608]983    Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx);
[189]984   
[608]985    WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];
[189]986    TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx ));
987   
988    uiNumSegments = 2;
989    pbMask = pcWedgelet->getPattern();
990    uiMaskStride = pcWedgelet->getStride();
991  }
992 
993  // get DC prediction for each segment
994  Pel apDCPredValues[2];
[608]995  m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode);
[189]996 
997  // reconstruct residual based on mask + DC residuals
998  Pel apDCResiValues[2];
[608]999  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
[189]1000  {
[608]1001#if H_3D_DIM_DLT
1002    Pel   pPredIdx    = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
1003    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
1004    Pel   pRecoValue  = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
[189]1005   
[608]1006    apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
1007#else
1008    apDCResiValues[uiSegment]  = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
[443]1009#endif
[189]1010  }
1011 
1012  //===== reconstruction =====
1013  Bool*pMask      = pbMask;
1014  Pel* pPred      = piPred;
1015  Pel* pResi      = piResi;
1016  Pel* pReco      = piReco;
1017  Pel* pRecIPred  = piRecIPred;
1018 
1019  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
1020  {
1021    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
1022    {
1023      UChar ucSegment = pMask?(UChar)pMask[uiX]:0;
1024      assert( ucSegment < uiNumSegments );
1025     
1026      Pel pResiDC = apDCResiValues[ucSegment];
1027     
[608]1028      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResiDC );
[189]1029      pRecIPred[ uiX ] = pReco[ uiX ];
1030    }
1031    pPred     += uiStride;
1032    pResi     += uiStride;
1033    pReco     += uiStride;
1034    pRecIPred += uiRecIPredStride;
1035    pMask     += uiMaskStride;
1036  }
1037 
1038  // clear UV
1039  UInt  uiStrideC     = pcPredYuv->getCStride();
1040  Pel   *pRecCb       = pcPredYuv->getCbAddr();
1041  Pel   *pRecCr       = pcPredYuv->getCrAddr();
1042 
1043  for (Int y=0; y<uiHeight/2; y++)
1044  {
1045    for (Int x=0; x<uiWidth/2; x++)
1046    {
[608]1047      pRecCb[x] = 128;
1048      pRecCr[x] = 128;
[189]1049    }
1050   
1051    pRecCb += uiStrideC;
1052    pRecCr += uiStrideC;
1053  }
1054}
1055#endif
1056
[56]1057/** Function for deriving recontructed PU/CU Luma sample with QTree structure
[2]1058 * \param pcCU pointer of current CU
1059 * \param uiTrDepth current tranform split depth
1060 * \param uiAbsPartIdx  part index
1061 * \param pcRecoYuv pointer to reconstructed sample arrays
1062 * \param pcPredYuv pointer to prediction sample arrays
1063 * \param pcResiYuv pointer to residue sample arrays
1064 *
1065 \ This function dervies recontructed PU/CU Luma sample with recursive QTree structure
1066 */
1067Void
1068TDecCu::xIntraLumaRecQT( TComDataCU* pcCU,
1069                     UInt        uiTrDepth,
1070                     UInt        uiAbsPartIdx,
1071                     TComYuv*    pcRecoYuv,
1072                     TComYuv*    pcPredYuv, 
1073                     TComYuv*    pcResiYuv )
1074{
1075  UInt uiFullDepth  = pcCU->getDepth(0) + uiTrDepth;
1076  UInt uiTrMode     = pcCU->getTransformIdx( uiAbsPartIdx );
1077  if( uiTrMode == uiTrDepth )
1078  {
1079    xIntraRecLumaBlk  ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv );
1080  }
1081  else
1082  {
1083    UInt uiNumQPart  = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 );
1084    for( UInt uiPart = 0; uiPart < 4; uiPart++ )
1085    {
1086      xIntraLumaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv );
1087    }
1088  }
1089}
1090
[56]1091/** Function for deriving recontructed PU/CU chroma samples with QTree structure
[2]1092 * \param pcCU pointer of current CU
1093 * \param uiTrDepth current tranform split depth
1094 * \param uiAbsPartIdx  part index
1095 * \param pcRecoYuv pointer to reconstructed sample arrays
1096 * \param pcPredYuv pointer to prediction sample arrays
1097 * \param pcResiYuv pointer to residue sample arrays
1098 *
1099 \ This function dervies recontructed PU/CU chroma samples with QTree recursive structure
1100 */
1101Void
1102TDecCu::xIntraChromaRecQT( TComDataCU* pcCU,
1103                     UInt        uiTrDepth,
1104                     UInt        uiAbsPartIdx,
1105                     TComYuv*    pcRecoYuv,
1106                     TComYuv*    pcPredYuv, 
1107                     TComYuv*    pcResiYuv )
1108{
1109  UInt uiFullDepth  = pcCU->getDepth(0) + uiTrDepth;
1110  UInt uiTrMode     = pcCU->getTransformIdx( uiAbsPartIdx );
1111  if( uiTrMode == uiTrDepth )
1112  {
1113    xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 );
1114    xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 );
1115  }
1116  else
1117  {
1118    UInt uiNumQPart  = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 );
1119    for( UInt uiPart = 0; uiPart < 4; uiPart++ )
1120    {
1121      xIntraChromaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv );
1122    }
1123  }
1124}
1125
1126Void TDecCu::xCopyToPic( TComDataCU* pcCU, TComPic* pcPic, UInt uiZorderIdx, UInt uiDepth )
1127{
1128  UInt uiCUAddr = pcCU->getAddr();
1129 
1130  m_ppcYuvReco[uiDepth]->copyToPicYuv  ( pcPic->getPicYuvRec (), uiCUAddr, uiZorderIdx );
1131 
1132  return;
1133}
1134
1135Void TDecCu::xDecodeInterTexture ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
1136{
1137  UInt    uiWidth    = pcCU->getWidth ( uiAbsPartIdx );
1138  UInt    uiHeight   = pcCU->getHeight( uiAbsPartIdx );
1139  TCoeff* piCoeff;
1140 
1141  Pel*    pResi;
[608]1142  UInt    trMode = pcCU->getTransformIdx( uiAbsPartIdx );
[2]1143 
1144  // Y
1145  piCoeff = pcCU->getCoeffY();
1146  pResi = m_ppcYuvResi[uiDepth]->getLumaAddr();
[56]1147
[608]1148  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
[56]1149
[608]1150  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
[2]1151 
1152  // Cb and Cr
[608]1153  Int curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
1154  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
[56]1155
[2]1156  uiWidth  >>= 1;
1157  uiHeight >>= 1;
1158  piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr();
[608]1159  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
[56]1160
[608]1161  curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
1162  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
[56]1163
[2]1164  piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr();
[608]1165  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
[2]1166}
1167
[56]1168/** Function for deriving reconstructed luma/chroma samples of a PCM mode CU.
1169 * \param pcCU pointer to current CU
1170 * \param uiPartIdx part index
1171 * \param piPCM pointer to PCM code arrays
1172 * \param piReco pointer to reconstructed sample arrays
1173 * \param uiStride stride of reconstructed sample arrays
1174 * \param uiWidth CU width
1175 * \param uiHeight CU height
1176 * \param ttText texture component type
1177 * \returns Void
1178 */
1179Void TDecCu::xDecodePCMTexture( TComDataCU* pcCU, UInt uiPartIdx, Pel *piPCM, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType ttText)
1180{
1181  UInt uiX, uiY;
1182  Pel* piPicReco;
1183  UInt uiPicStride;
1184  UInt uiPcmLeftShiftBit; 
1185
1186  if( ttText == TEXT_LUMA )
1187  {
1188    uiPicStride   = pcCU->getPic()->getPicYuvRec()->getStride();
1189    piPicReco = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
[608]1190    uiPcmLeftShiftBit = g_bitDepthY - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();
[56]1191  }
1192  else
1193  {
1194    uiPicStride = pcCU->getPic()->getPicYuvRec()->getCStride();
1195
1196    if( ttText == TEXT_CHROMA_U )
1197    {
1198      piPicReco = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
1199    }
1200    else
1201    {
1202      piPicReco = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
1203    }
[608]1204    uiPcmLeftShiftBit = g_bitDepthC - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
[56]1205  }
1206
1207  for( uiY = 0; uiY < uiHeight; uiY++ )
1208  {
1209    for( uiX = 0; uiX < uiWidth; uiX++ )
1210    {
1211      piReco[uiX] = (piPCM[uiX] << uiPcmLeftShiftBit);
1212      piPicReco[uiX] = piReco[uiX];
1213    }
1214    piPCM += uiWidth;
1215    piReco += uiStride;
1216    piPicReco += uiPicStride;
1217  }
1218}
1219
1220/** Function for reconstructing a PCM mode CU.
1221 * \param pcCU pointer to current CU
1222 * \param uiDepth CU Depth
1223 * \returns Void
1224 */
[608]1225Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiDepth )
[56]1226{
1227  // Luma
1228  UInt uiWidth  = (g_uiMaxCUWidth >> uiDepth);
1229  UInt uiHeight = (g_uiMaxCUHeight >> uiDepth);
1230
1231  Pel* piPcmY = pcCU->getPCMSampleY();
1232  Pel* piRecoY = m_ppcYuvReco[uiDepth]->getLumaAddr(0, uiWidth);
1233
1234  UInt uiStride = m_ppcYuvResi[uiDepth]->getStride();
1235
1236  xDecodePCMTexture( pcCU, 0, piPcmY, piRecoY, uiStride, uiWidth, uiHeight, TEXT_LUMA);
1237
1238  // Cb and Cr
1239  UInt uiCWidth  = (uiWidth>>1);
1240  UInt uiCHeight = (uiHeight>>1);
1241
1242  Pel* piPcmCb = pcCU->getPCMSampleCb();
1243  Pel* piPcmCr = pcCU->getPCMSampleCr();
1244  Pel* pRecoCb = m_ppcYuvReco[uiDepth]->getCbAddr();
1245  Pel* pRecoCr = m_ppcYuvReco[uiDepth]->getCrAddr();
1246
1247  UInt uiCStride = m_ppcYuvReco[uiDepth]->getCStride();
1248
1249  xDecodePCMTexture( pcCU, 0, piPcmCb, pRecoCb, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_U);
1250  xDecodePCMTexture( pcCU, 0, piPcmCr, pRecoCr, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_V);
1251}
1252
1253/** Function for filling the PCM buffer of a CU using its reconstructed sample array
1254 * \param pcCU pointer to current CU
1255 * \param uiDepth CU Depth
1256 * \returns Void
1257 */
[608]1258Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt depth)
[56]1259{
1260  // Luma
1261  UInt width  = (g_uiMaxCUWidth >> depth);
1262  UInt height = (g_uiMaxCUHeight >> depth);
1263
1264  Pel* pPcmY = pCU->getPCMSampleY();
1265  Pel* pRecoY = m_ppcYuvReco[depth]->getLumaAddr(0, width);
1266
1267  UInt stride = m_ppcYuvReco[depth]->getStride();
1268
1269  for(Int y = 0; y < height; y++ )
1270  {
1271    for(Int x = 0; x < width; x++ )
1272    {
1273      pPcmY[x] = pRecoY[x];
1274    }
1275    pPcmY += width;
1276    pRecoY += stride;
1277  }
1278
1279  // Cb and Cr
1280  UInt widthC  = (width>>1);
1281  UInt heightC = (height>>1);
1282
1283  Pel* pPcmCb = pCU->getPCMSampleCb();
1284  Pel* pPcmCr = pCU->getPCMSampleCr();
1285  Pel* pRecoCb = m_ppcYuvReco[depth]->getCbAddr();
1286  Pel* pRecoCr = m_ppcYuvReco[depth]->getCrAddr();
1287
1288  UInt strideC = m_ppcYuvReco[depth]->getCStride();
1289
1290  for(Int y = 0; y < heightC; y++ )
1291  {
1292    for(Int x = 0; x < widthC; x++ )
1293    {
1294      pPcmCb[x] = pRecoCb[x];
1295      pPcmCr[x] = pRecoCr[x];
1296    }
1297    pPcmCr += widthC;
1298    pPcmCb += widthC;
1299    pRecoCb += strideC;
1300    pRecoCr += strideC;
1301  }
1302
1303}
1304
1305//! \}
Note: See TracBrowser for help on using the repository browser.