source: 3DVCSoftware/branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCu.cpp @ 486

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

Integrated DoNBDV provided by Mediatek and applied clean ups.

  • Property svn:eol-style set to native
File size: 34.6 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  xDecompressCU( pcCU, 0,  0 );
138}
139
140// ====================================================================================================================
141// Protected member functions
142// ====================================================================================================================
143
144/**decode end-of-slice flag
145 * \param pcCU
146 * \param uiAbsPartIdx
147 * \param uiDepth
148 * \returns Bool
149 */
150Bool TDecCu::xDecodeSliceEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth)
151{
152  UInt uiIsLast;
153  TComPic* pcPic = pcCU->getPic();
154  TComSlice * pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx());
155  UInt uiCurNumParts    = pcPic->getNumPartInCU() >> (uiDepth<<1);
156  UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples();
157  UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples();
158  UInt uiGranularityWidth = g_uiMaxCUWidth;
159  UInt uiPosX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
160  UInt uiPosY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
161
162  if(((uiPosX+pcCU->getWidth(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosX+pcCU->getWidth(uiAbsPartIdx)==uiWidth))
163    &&((uiPosY+pcCU->getHeight(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosY+pcCU->getHeight(uiAbsPartIdx)==uiHeight)))
164  {
165    m_pcEntropyDecoder->decodeTerminatingBit( uiIsLast );
166  }
167  else
168  {
169    uiIsLast=0;
170  }
171 
172  if(uiIsLast) 
173  {
174    if(pcSlice->isNextSliceSegment()&&!pcSlice->isNextSlice()) 
175    {
176      pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
177    }
178    else 
179    {
180      pcSlice->setSliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
181      pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
182    }
183  }
184
185  return uiIsLast>0;
186}
187
188/** decode CU block recursively
189 * \param pcCU
190 * \param uiAbsPartIdx
191 * \param uiDepth
192 * \returns Void
193 */
194
195Void TDecCu::xDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast)
196{
197  TComPic* pcPic = pcCU->getPic();
198  UInt uiCurNumParts    = pcPic->getNumPartInCU() >> (uiDepth<<1);
199  UInt uiQNumParts      = uiCurNumParts>>2;
200 
201  Bool bBoundary = false;
202  UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
203  UInt uiRPelX   = uiLPelX + (g_uiMaxCUWidth>>uiDepth)  - 1;
204  UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
205  UInt uiBPelY   = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;
206 
207  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
208  Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr();
209  if((!bStartInCU) && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
210  {
211    m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
212  }
213  else
214  {
215    bBoundary = true;
216  }
217 
218  if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary )
219  {
220    UInt uiIdx = uiAbsPartIdx;
221    if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
222    {
223      setdQPFlag(true);
224      pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP
225    }
226
227    for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ )
228    {
229      uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ];
230      uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
231     
232      Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr();
233      if ( bSubInSlice )
234      {
235        if ( !ruiIsLast && ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )
236        {
237          xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast );
238        }
239        else
240        {
241          pcCU->setOutsideCUPart( uiIdx, uiDepth+1 );
242        }
243      }
244     
245      uiIdx += uiQNumParts;
246    }
247    if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
248    {
249      if ( getdQPFlag() )
250      {
251        UInt uiQPSrcPartIdx;
252        if ( pcPic->getCU( pcCU->getAddr() )->getSliceSegmentStartCU(uiAbsPartIdx) != pcSlice->getSliceSegmentCurStartCUAddr() )
253        {
254          uiQPSrcPartIdx = pcSlice->getSliceSegmentCurStartCUAddr() % pcPic->getNumPartInCU();
255        }
256        else
257        {
258          uiQPSrcPartIdx = uiAbsPartIdx;
259        }
260        pcCU->setQPSubParts( pcCU->getRefQP( uiQPSrcPartIdx ), uiAbsPartIdx, uiDepth ); // set QP to default QP
261      }
262    }
263    return;
264  }
265 
266  if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
267  {
268    setdQPFlag(true);
269    pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP
270  }
271#if H_3D_NBDV
272  DisInfo DvInfo; 
273  DvInfo.bDV = false;
274  DvInfo.m_acNBDV.setZero();
275  DvInfo.m_aVIdxCan = 0;
276#if H_3D_NBDV_REF 
277  DvInfo.m_acDoNBDV.setZero();
278#endif
279 
280 
281  if(!pcCU->getSlice()->isIntra())
282  {
283    if(pcCU->getSlice()->getViewIndex() && !pcCU->getSlice()->getIsDepth()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done.
284    {
285      m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true );
286      m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx);
287      PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0);
288      UChar cWidTemp     = m_ppcCU[uiDepth]->getWidth(0);
289      UChar cHeightTemp  = m_ppcCU[uiDepth]->getHeight(0);
290      m_ppcCU[uiDepth]->setWidth  ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth)  );
291      m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth)  );
292      m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );     
293#if H_3D_NBDV_REF
294      if(pcCU->getSlice()->getVPS()->getDepthRefinementFlag( pcCU->getSlice()->getLayerIdInVps() ))  //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done.
295        DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true);
296      else
297#endif
298        DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo);
299
300      pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth);
301      m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth );
302      m_ppcCU[uiDepth]->setWidth  ( 0, cWidTemp );
303      m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp );
304     }
305  }
306#endif
307  if (pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
308  {
309    m_pcEntropyDecoder->decodeCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth );
310  }
311 
312  // decode CU mode and the partition size
313  if( !pcCU->getSlice()->isIntra())
314  {
315    m_pcEntropyDecoder->decodeSkipFlag( pcCU, uiAbsPartIdx, uiDepth );
316  }
317 
318  if( pcCU->isSkipped(uiAbsPartIdx) )
319  {
320    m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 );
321    m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 );
322#if H_3D_IV_MERGE
323    m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx);
324    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
325    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
326#else
327    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists
328    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
329#endif
330    Int numValidMergeCand = 0;
331    for( UInt ui = 0; ui < m_ppcCU[uiDepth]->getSlice()->getMaxNumMergeCand(); ++ui )
332    {
333      uhInterDirNeighbours[ui] = 0;
334    }
335    m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth );
336    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
337    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
338    pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
339
340    TComMv cTmpMv( 0, 0 );
341    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
342    {       
343      if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
344      {
345        pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth);
346        pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth);
347        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
348        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
349      }
350    }
351    xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
352    return;
353  }
354
355  m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth );
356  m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
357
358  if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
359  {
360    m_pcEntropyDecoder->decodeIPCMInfo( pcCU, uiAbsPartIdx, uiDepth );
361
362    if(pcCU->getIPCMFlag(uiAbsPartIdx))
363    {
364      xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
365      return;
366    }
367  }
368
369  UInt uiCurrWidth      = pcCU->getWidth ( uiAbsPartIdx );
370  UInt uiCurrHeight     = pcCU->getHeight( uiAbsPartIdx );
371 
372  // prediction mode ( Intra : direction mode, Inter : Mv, reference idx )
373  m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]);
374 
375  // Coefficient decoding
376  Bool bCodeDQP = getdQPFlag();
377  m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, uiCurrWidth, uiCurrHeight, bCodeDQP );
378  setdQPFlag( bCodeDQP );
379  xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
380}
381
382Void TDecCu::xFinishDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast)
383{
384  if(  pcCU->getSlice()->getPPS()->getUseDQP())
385  {
386    pcCU->setQPSubParts( getdQPFlag()?pcCU->getRefQP(uiAbsPartIdx):pcCU->getCodedQP(), uiAbsPartIdx, uiDepth ); // set QP
387  }
388
389  ruiIsLast = xDecodeSliceEnd( pcCU, uiAbsPartIdx, uiDepth);
390}
391
392Void TDecCu::xDecompressCU( TComDataCU* pcCU, UInt uiAbsPartIdx,  UInt uiDepth )
393{
394  TComPic* pcPic = pcCU->getPic();
395 
396  Bool bBoundary = false;
397  UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
398  UInt uiRPelX   = uiLPelX + (g_uiMaxCUWidth>>uiDepth)  - 1;
399  UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
400  UInt uiBPelY   = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;
401 
402  UInt uiCurNumParts    = pcPic->getNumPartInCU() >> (uiDepth<<1);
403  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
404  Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr();
405  if(bStartInCU||( uiRPelX >= pcSlice->getSPS()->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
406  {
407    bBoundary = true;
408  }
409 
410  if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary )
411  {
412    UInt uiNextDepth = uiDepth + 1;
413    UInt uiQNumParts = pcCU->getTotalNumPart() >> (uiNextDepth<<1);
414    UInt uiIdx = uiAbsPartIdx;
415    for ( UInt uiPartIdx = 0; uiPartIdx < 4; uiPartIdx++ )
416    {
417      uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ];
418      uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
419     
420      Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getSliceSegmentCurEndCUAddr());
421      if(binSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
422      {
423        xDecompressCU(pcCU, uiIdx, uiNextDepth );
424      }
425     
426      uiIdx += uiQNumParts;
427    }
428    return;
429  }
430 
431  // Residual reconstruction
432  m_ppcYuvResi[uiDepth]->clear();
433 
434  m_ppcCU[uiDepth]->copySubCU( pcCU, uiAbsPartIdx, uiDepth );
435 
436  switch( m_ppcCU[uiDepth]->getPredictionMode(0) )
437  {
438    case MODE_INTER:
439      xReconInter( m_ppcCU[uiDepth], uiDepth );
440      break;
441    case MODE_INTRA:
442      xReconIntraQT( m_ppcCU[uiDepth], uiDepth );
443      break;
444    default:
445      assert(0);
446      break;
447  }
448  if ( m_ppcCU[uiDepth]->isLosslessCoded(0) && (m_ppcCU[uiDepth]->getIPCMFlag(0) == false))
449  {
450    xFillPCMBuffer(m_ppcCU[uiDepth], uiDepth);
451  }
452 
453  xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth );
454}
455
456Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiDepth )
457{
458 
459  // inter prediction
460  m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
461 
462  // inter recon
463  xDecodeInterTexture( pcCU, 0, uiDepth );
464 
465  // clip for only non-zero cbp case
466  if  ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) )
467  {
468    m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) );
469  }
470  else
471  {
472    m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 ));
473  }
474}
475
476Void
477TDecCu::xIntraRecLumaBlk( TComDataCU* pcCU,
478                         UInt        uiTrDepth,
479                         UInt        uiAbsPartIdx,
480                         TComYuv*    pcRecoYuv,
481                         TComYuv*    pcPredYuv, 
482                         TComYuv*    pcResiYuv )
483{
484  UInt    uiWidth           = pcCU     ->getWidth   ( 0 ) >> uiTrDepth;
485  UInt    uiHeight          = pcCU     ->getHeight  ( 0 ) >> uiTrDepth;
486  UInt    uiStride          = pcRecoYuv->getStride  ();
487  Pel*    piReco            = pcRecoYuv->getLumaAddr( uiAbsPartIdx );
488  Pel*    piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
489  Pel*    piResi            = pcResiYuv->getLumaAddr( uiAbsPartIdx );
490 
491  UInt    uiNumCoeffInc     = ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 );
492  TCoeff* pcCoeff           = pcCU->getCoeffY() + ( uiNumCoeffInc * uiAbsPartIdx );
493 
494  UInt    uiLumaPredMode    = pcCU->getLumaIntraDir     ( uiAbsPartIdx );
495 
496  UInt    uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
497  Pel*    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
498  UInt    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
499  Bool    useTransformSkip  = pcCU->getTransformSkip(uiAbsPartIdx, TEXT_LUMA);
500  //===== init availability pattern =====
501  Bool  bAboveAvail = false;
502  Bool  bLeftAvail  = false;
503  pcCU->getPattern()->initPattern   ( pcCU, uiTrDepth, uiAbsPartIdx );
504  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, 
505                                     m_pcPrediction->getPredicBuf       (),
506                                     m_pcPrediction->getPredicBufWidth  (),
507                                     m_pcPrediction->getPredicBufHeight (),
508                                     bAboveAvail, bLeftAvail );
509 
510  //===== get prediction signal =====
511  m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
512 
513  //===== inverse transform =====
514  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
515
516  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA];
517  assert(scalingListType < 6);
518  m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkip );
519
520 
521  //===== reconstruction =====
522  Pel* pPred      = piPred;
523  Pel* pResi      = piResi;
524  Pel* pReco      = piReco;
525  Pel* pRecIPred  = piRecIPred;
526  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
527  {
528    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
529    {
530      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
531      pRecIPred[ uiX ] = pReco[ uiX ];
532    }
533    pPred     += uiStride;
534    pResi     += uiStride;
535    pReco     += uiStride;
536    pRecIPred += uiRecIPredStride;
537  }
538}
539
540
541Void
542TDecCu::xIntraRecChromaBlk( TComDataCU* pcCU,
543                           UInt        uiTrDepth,
544                           UInt        uiAbsPartIdx,
545                           TComYuv*    pcRecoYuv,
546                           TComYuv*    pcPredYuv, 
547                           TComYuv*    pcResiYuv,
548                           UInt        uiChromaId )
549{
550  UInt uiFullDepth  = pcCU->getDepth( 0 ) + uiTrDepth;
551  UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiFullDepth ] + 2;
552
553  if( uiLog2TrSize == 2 )
554  {
555    assert( uiTrDepth > 0 );
556    uiTrDepth--;
557    UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth( 0 ) + uiTrDepth ) << 1 );
558    Bool bFirstQ = ( ( uiAbsPartIdx % uiQPDiv ) == 0 );
559    if( !bFirstQ )
560    {
561      return;
562    }
563  }
564 
565  TextType  eText             = ( uiChromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U );
566  UInt      uiWidth           = pcCU     ->getWidth   ( 0 ) >> ( uiTrDepth + 1 );
567  UInt      uiHeight          = pcCU     ->getHeight  ( 0 ) >> ( uiTrDepth + 1 );
568  UInt      uiStride          = pcRecoYuv->getCStride ();
569  Pel*      piReco            = ( uiChromaId > 0 ? pcRecoYuv->getCrAddr( uiAbsPartIdx ) : pcRecoYuv->getCbAddr( uiAbsPartIdx ) );
570  Pel*      piPred            = ( uiChromaId > 0 ? pcPredYuv->getCrAddr( uiAbsPartIdx ) : pcPredYuv->getCbAddr( uiAbsPartIdx ) );
571  Pel*      piResi            = ( uiChromaId > 0 ? pcResiYuv->getCrAddr( uiAbsPartIdx ) : pcResiYuv->getCbAddr( uiAbsPartIdx ) );
572 
573  UInt      uiNumCoeffInc     = ( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ) ) >> 2;
574  TCoeff*   pcCoeff           = ( uiChromaId > 0 ? pcCU->getCoeffCr() : pcCU->getCoeffCb() ) + ( uiNumCoeffInc * uiAbsPartIdx );
575 
576  UInt      uiChromaPredMode  = pcCU->getChromaIntraDir( 0 );
577 
578  UInt      uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
579  Pel*      piRecIPred        = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) );
580  UInt      uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getCStride();
581  Bool      useTransformSkipChroma = pcCU->getTransformSkip(uiAbsPartIdx,eText);
582  //===== init availability pattern =====
583  Bool  bAboveAvail = false;
584  Bool  bLeftAvail  = false;
585  pcCU->getPattern()->initPattern         ( pcCU, uiTrDepth, uiAbsPartIdx );
586
587  pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth,
588                                           m_pcPrediction->getPredicBuf       (),
589                                           m_pcPrediction->getPredicBufWidth  (),
590                                           m_pcPrediction->getPredicBufHeight (),
591                                           bAboveAvail, bLeftAvail );
592  Int* pPatChroma   = ( uiChromaId > 0 ? pcCU->getPattern()->getAdiCrBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) : pcCU->getPattern()->getAdiCbBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) );
593 
594  //===== get prediction signal =====
595  {
596    if( uiChromaPredMode == DM_CHROMA_IDX )
597    {
598      uiChromaPredMode = pcCU->getLumaIntraDir( 0 );
599    }
600    m_pcPrediction->predIntraChromaAng( pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 
601  }
602
603  //===== inverse transform =====
604  Int curChromaQpOffset;
605  if(eText == TEXT_CHROMA_U)
606  {
607    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
608  }
609  else
610  {
611    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
612  }
613  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
614
615  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText];
616  assert(scalingListType < 6);
617  m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkipChroma );
618
619  //===== reconstruction =====
620  Pel* pPred      = piPred;
621  Pel* pResi      = piResi;
622  Pel* pReco      = piReco;
623  Pel* pRecIPred  = piRecIPred;
624  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
625  {
626    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
627    {
628      pReco    [ uiX ] = ClipC( pPred[ uiX ] + pResi[ uiX ] );
629      pRecIPred[ uiX ] = pReco[ uiX ];
630    }
631    pPred     += uiStride;
632    pResi     += uiStride;
633    pReco     += uiStride;
634    pRecIPred += uiRecIPredStride;
635  }
636}
637
638
639Void
640TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiDepth )
641{
642  UInt  uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 );
643  UInt  uiNumPart     = pcCU->getNumPartInter();
644  UInt  uiNumQParts   = pcCU->getTotalNumPart() >> 2;
645 
646  if (pcCU->getIPCMFlag(0))
647  {
648    xReconPCM( pcCU, uiDepth );
649    return;
650  }
651
652  for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ )
653  {
654    xIntraLumaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] );
655  } 
656
657  for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ )
658  {
659    xIntraChromaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] );
660  }
661
662}
663
664/** Function for deriving recontructed PU/CU Luma sample with QTree structure
665 * \param pcCU pointer of current CU
666 * \param uiTrDepth current tranform split depth
667 * \param uiAbsPartIdx  part index
668 * \param pcRecoYuv pointer to reconstructed sample arrays
669 * \param pcPredYuv pointer to prediction sample arrays
670 * \param pcResiYuv pointer to residue sample arrays
671 *
672 \ This function dervies recontructed PU/CU Luma sample with recursive QTree structure
673 */
674Void
675TDecCu::xIntraLumaRecQT( TComDataCU* pcCU,
676                     UInt        uiTrDepth,
677                     UInt        uiAbsPartIdx,
678                     TComYuv*    pcRecoYuv,
679                     TComYuv*    pcPredYuv, 
680                     TComYuv*    pcResiYuv )
681{
682  UInt uiFullDepth  = pcCU->getDepth(0) + uiTrDepth;
683  UInt uiTrMode     = pcCU->getTransformIdx( uiAbsPartIdx );
684  if( uiTrMode == uiTrDepth )
685  {
686    xIntraRecLumaBlk  ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv );
687  }
688  else
689  {
690    UInt uiNumQPart  = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 );
691    for( UInt uiPart = 0; uiPart < 4; uiPart++ )
692    {
693      xIntraLumaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv );
694    }
695  }
696}
697
698/** Function for deriving recontructed PU/CU chroma samples with QTree structure
699 * \param pcCU pointer of current CU
700 * \param uiTrDepth current tranform split depth
701 * \param uiAbsPartIdx  part index
702 * \param pcRecoYuv pointer to reconstructed sample arrays
703 * \param pcPredYuv pointer to prediction sample arrays
704 * \param pcResiYuv pointer to residue sample arrays
705 *
706 \ This function dervies recontructed PU/CU chroma samples with QTree recursive structure
707 */
708Void
709TDecCu::xIntraChromaRecQT( TComDataCU* pcCU,
710                     UInt        uiTrDepth,
711                     UInt        uiAbsPartIdx,
712                     TComYuv*    pcRecoYuv,
713                     TComYuv*    pcPredYuv, 
714                     TComYuv*    pcResiYuv )
715{
716  UInt uiFullDepth  = pcCU->getDepth(0) + uiTrDepth;
717  UInt uiTrMode     = pcCU->getTransformIdx( uiAbsPartIdx );
718  if( uiTrMode == uiTrDepth )
719  {
720    xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 );
721    xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 );
722  }
723  else
724  {
725    UInt uiNumQPart  = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 );
726    for( UInt uiPart = 0; uiPart < 4; uiPart++ )
727    {
728      xIntraChromaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv );
729    }
730  }
731}
732
733Void TDecCu::xCopyToPic( TComDataCU* pcCU, TComPic* pcPic, UInt uiZorderIdx, UInt uiDepth )
734{
735  UInt uiCUAddr = pcCU->getAddr();
736 
737  m_ppcYuvReco[uiDepth]->copyToPicYuv  ( pcPic->getPicYuvRec (), uiCUAddr, uiZorderIdx );
738 
739  return;
740}
741
742Void TDecCu::xDecodeInterTexture ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
743{
744  UInt    uiWidth    = pcCU->getWidth ( uiAbsPartIdx );
745  UInt    uiHeight   = pcCU->getHeight( uiAbsPartIdx );
746  TCoeff* piCoeff;
747 
748  Pel*    pResi;
749  UInt    trMode = pcCU->getTransformIdx( uiAbsPartIdx );
750 
751  // Y
752  piCoeff = pcCU->getCoeffY();
753  pResi = m_ppcYuvResi[uiDepth]->getLumaAddr();
754
755  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
756
757  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
758 
759  // Cb and Cr
760  Int curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
761  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
762
763  uiWidth  >>= 1;
764  uiHeight >>= 1;
765  piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr();
766  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
767
768  curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
769  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
770
771  piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr();
772  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
773}
774
775/** Function for deriving reconstructed luma/chroma samples of a PCM mode CU.
776 * \param pcCU pointer to current CU
777 * \param uiPartIdx part index
778 * \param piPCM pointer to PCM code arrays
779 * \param piReco pointer to reconstructed sample arrays
780 * \param uiStride stride of reconstructed sample arrays
781 * \param uiWidth CU width
782 * \param uiHeight CU height
783 * \param ttText texture component type
784 * \returns Void
785 */
786Void TDecCu::xDecodePCMTexture( TComDataCU* pcCU, UInt uiPartIdx, Pel *piPCM, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType ttText)
787{
788  UInt uiX, uiY;
789  Pel* piPicReco;
790  UInt uiPicStride;
791  UInt uiPcmLeftShiftBit; 
792
793  if( ttText == TEXT_LUMA )
794  {
795    uiPicStride   = pcCU->getPic()->getPicYuvRec()->getStride();
796    piPicReco = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
797    uiPcmLeftShiftBit = g_bitDepthY - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();
798  }
799  else
800  {
801    uiPicStride = pcCU->getPic()->getPicYuvRec()->getCStride();
802
803    if( ttText == TEXT_CHROMA_U )
804    {
805      piPicReco = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
806    }
807    else
808    {
809      piPicReco = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
810    }
811    uiPcmLeftShiftBit = g_bitDepthC - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
812  }
813
814  for( uiY = 0; uiY < uiHeight; uiY++ )
815  {
816    for( uiX = 0; uiX < uiWidth; uiX++ )
817    {
818      piReco[uiX] = (piPCM[uiX] << uiPcmLeftShiftBit);
819      piPicReco[uiX] = piReco[uiX];
820    }
821    piPCM += uiWidth;
822    piReco += uiStride;
823    piPicReco += uiPicStride;
824  }
825}
826
827/** Function for reconstructing a PCM mode CU.
828 * \param pcCU pointer to current CU
829 * \param uiDepth CU Depth
830 * \returns Void
831 */
832Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiDepth )
833{
834  // Luma
835  UInt uiWidth  = (g_uiMaxCUWidth >> uiDepth);
836  UInt uiHeight = (g_uiMaxCUHeight >> uiDepth);
837
838  Pel* piPcmY = pcCU->getPCMSampleY();
839  Pel* piRecoY = m_ppcYuvReco[uiDepth]->getLumaAddr(0, uiWidth);
840
841  UInt uiStride = m_ppcYuvResi[uiDepth]->getStride();
842
843  xDecodePCMTexture( pcCU, 0, piPcmY, piRecoY, uiStride, uiWidth, uiHeight, TEXT_LUMA);
844
845  // Cb and Cr
846  UInt uiCWidth  = (uiWidth>>1);
847  UInt uiCHeight = (uiHeight>>1);
848
849  Pel* piPcmCb = pcCU->getPCMSampleCb();
850  Pel* piPcmCr = pcCU->getPCMSampleCr();
851  Pel* pRecoCb = m_ppcYuvReco[uiDepth]->getCbAddr();
852  Pel* pRecoCr = m_ppcYuvReco[uiDepth]->getCrAddr();
853
854  UInt uiCStride = m_ppcYuvReco[uiDepth]->getCStride();
855
856  xDecodePCMTexture( pcCU, 0, piPcmCb, pRecoCb, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_U);
857  xDecodePCMTexture( pcCU, 0, piPcmCr, pRecoCr, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_V);
858}
859
860/** Function for filling the PCM buffer of a CU using its reconstructed sample array
861 * \param pcCU pointer to current CU
862 * \param uiDepth CU Depth
863 * \returns Void
864 */
865Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt depth)
866{
867  // Luma
868  UInt width  = (g_uiMaxCUWidth >> depth);
869  UInt height = (g_uiMaxCUHeight >> depth);
870
871  Pel* pPcmY = pCU->getPCMSampleY();
872  Pel* pRecoY = m_ppcYuvReco[depth]->getLumaAddr(0, width);
873
874  UInt stride = m_ppcYuvReco[depth]->getStride();
875
876  for(Int y = 0; y < height; y++ )
877  {
878    for(Int x = 0; x < width; x++ )
879    {
880      pPcmY[x] = pRecoY[x];
881    }
882    pPcmY += width;
883    pRecoY += stride;
884  }
885
886  // Cb and Cr
887  UInt widthC  = (width>>1);
888  UInt heightC = (height>>1);
889
890  Pel* pPcmCb = pCU->getPCMSampleCb();
891  Pel* pPcmCr = pCU->getPCMSampleCr();
892  Pel* pRecoCb = m_ppcYuvReco[depth]->getCbAddr();
893  Pel* pRecoCr = m_ppcYuvReco[depth]->getCrAddr();
894
895  UInt strideC = m_ppcYuvReco[depth]->getCStride();
896
897  for(Int y = 0; y < heightC; y++ )
898  {
899    for(Int x = 0; x < widthC; x++ )
900    {
901      pPcmCb[x] = pRecoCb[x];
902      pPcmCr[x] = pRecoCr[x];
903    }
904    pPcmCr += widthC;
905    pPcmCb += widthC;
906    pRecoCb += strideC;
907    pRecoCr += strideC;
908  }
909
910}
911
912//! \}
Note: See TracBrowser for help on using the repository browser.