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

Last change on this file since 455 was 455, checked in by zhang, 11 years ago

NBDV for 3D-HEVC

  • Property svn:eol-style set to native
File size: 34.4 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()->getSPS()->getUseDVPRefine())  //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    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists
323    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
324    Int numValidMergeCand = 0;
325    for( UInt ui = 0; ui < m_ppcCU[uiDepth]->getSlice()->getMaxNumMergeCand(); ++ui )
326    {
327      uhInterDirNeighbours[ui] = 0;
328    }
329    m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth );
330    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
331    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
332    pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
333
334    TComMv cTmpMv( 0, 0 );
335    for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
336    {       
337      if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
338      {
339        pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth);
340        pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiAbsPartIdx, 0, uiDepth);
341        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
342        pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
343      }
344    }
345    xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
346    return;
347  }
348
349  m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth );
350  m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
351
352  if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
353  {
354    m_pcEntropyDecoder->decodeIPCMInfo( pcCU, uiAbsPartIdx, uiDepth );
355
356    if(pcCU->getIPCMFlag(uiAbsPartIdx))
357    {
358      xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
359      return;
360    }
361  }
362
363  UInt uiCurrWidth      = pcCU->getWidth ( uiAbsPartIdx );
364  UInt uiCurrHeight     = pcCU->getHeight( uiAbsPartIdx );
365 
366  // prediction mode ( Intra : direction mode, Inter : Mv, reference idx )
367  m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]);
368 
369  // Coefficient decoding
370  Bool bCodeDQP = getdQPFlag();
371  m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, uiCurrWidth, uiCurrHeight, bCodeDQP );
372  setdQPFlag( bCodeDQP );
373  xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
374}
375
376Void TDecCu::xFinishDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast)
377{
378  if(  pcCU->getSlice()->getPPS()->getUseDQP())
379  {
380    pcCU->setQPSubParts( getdQPFlag()?pcCU->getRefQP(uiAbsPartIdx):pcCU->getCodedQP(), uiAbsPartIdx, uiDepth ); // set QP
381  }
382
383  ruiIsLast = xDecodeSliceEnd( pcCU, uiAbsPartIdx, uiDepth);
384}
385
386Void TDecCu::xDecompressCU( TComDataCU* pcCU, UInt uiAbsPartIdx,  UInt uiDepth )
387{
388  TComPic* pcPic = pcCU->getPic();
389 
390  Bool bBoundary = false;
391  UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
392  UInt uiRPelX   = uiLPelX + (g_uiMaxCUWidth>>uiDepth)  - 1;
393  UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
394  UInt uiBPelY   = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;
395 
396  UInt uiCurNumParts    = pcPic->getNumPartInCU() >> (uiDepth<<1);
397  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
398  Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr();
399  if(bStartInCU||( uiRPelX >= pcSlice->getSPS()->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
400  {
401    bBoundary = true;
402  }
403 
404  if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary )
405  {
406    UInt uiNextDepth = uiDepth + 1;
407    UInt uiQNumParts = pcCU->getTotalNumPart() >> (uiNextDepth<<1);
408    UInt uiIdx = uiAbsPartIdx;
409    for ( UInt uiPartIdx = 0; uiPartIdx < 4; uiPartIdx++ )
410    {
411      uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ];
412      uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
413     
414      Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getSliceSegmentCurEndCUAddr());
415      if(binSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
416      {
417        xDecompressCU(pcCU, uiIdx, uiNextDepth );
418      }
419     
420      uiIdx += uiQNumParts;
421    }
422    return;
423  }
424 
425  // Residual reconstruction
426  m_ppcYuvResi[uiDepth]->clear();
427 
428  m_ppcCU[uiDepth]->copySubCU( pcCU, uiAbsPartIdx, uiDepth );
429 
430  switch( m_ppcCU[uiDepth]->getPredictionMode(0) )
431  {
432    case MODE_INTER:
433      xReconInter( m_ppcCU[uiDepth], uiDepth );
434      break;
435    case MODE_INTRA:
436      xReconIntraQT( m_ppcCU[uiDepth], uiDepth );
437      break;
438    default:
439      assert(0);
440      break;
441  }
442  if ( m_ppcCU[uiDepth]->isLosslessCoded(0) && (m_ppcCU[uiDepth]->getIPCMFlag(0) == false))
443  {
444    xFillPCMBuffer(m_ppcCU[uiDepth], uiDepth);
445  }
446 
447  xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth );
448}
449
450Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiDepth )
451{
452 
453  // inter prediction
454  m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
455 
456  // inter recon
457  xDecodeInterTexture( pcCU, 0, uiDepth );
458 
459  // clip for only non-zero cbp case
460  if  ( ( pcCU->getCbf( 0, TEXT_LUMA ) ) || ( pcCU->getCbf( 0, TEXT_CHROMA_U ) ) || ( pcCU->getCbf(0, TEXT_CHROMA_V ) ) )
461  {
462    m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) );
463  }
464  else
465  {
466    m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 ));
467  }
468}
469
470Void
471TDecCu::xIntraRecLumaBlk( TComDataCU* pcCU,
472                         UInt        uiTrDepth,
473                         UInt        uiAbsPartIdx,
474                         TComYuv*    pcRecoYuv,
475                         TComYuv*    pcPredYuv, 
476                         TComYuv*    pcResiYuv )
477{
478  UInt    uiWidth           = pcCU     ->getWidth   ( 0 ) >> uiTrDepth;
479  UInt    uiHeight          = pcCU     ->getHeight  ( 0 ) >> uiTrDepth;
480  UInt    uiStride          = pcRecoYuv->getStride  ();
481  Pel*    piReco            = pcRecoYuv->getLumaAddr( uiAbsPartIdx );
482  Pel*    piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
483  Pel*    piResi            = pcResiYuv->getLumaAddr( uiAbsPartIdx );
484 
485  UInt    uiNumCoeffInc     = ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 );
486  TCoeff* pcCoeff           = pcCU->getCoeffY() + ( uiNumCoeffInc * uiAbsPartIdx );
487 
488  UInt    uiLumaPredMode    = pcCU->getLumaIntraDir     ( uiAbsPartIdx );
489 
490  UInt    uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
491  Pel*    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
492  UInt    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
493  Bool    useTransformSkip  = pcCU->getTransformSkip(uiAbsPartIdx, TEXT_LUMA);
494  //===== init availability pattern =====
495  Bool  bAboveAvail = false;
496  Bool  bLeftAvail  = false;
497  pcCU->getPattern()->initPattern   ( pcCU, uiTrDepth, uiAbsPartIdx );
498  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, 
499                                     m_pcPrediction->getPredicBuf       (),
500                                     m_pcPrediction->getPredicBufWidth  (),
501                                     m_pcPrediction->getPredicBufHeight (),
502                                     bAboveAvail, bLeftAvail );
503 
504  //===== get prediction signal =====
505  m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
506 
507  //===== inverse transform =====
508  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
509
510  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA];
511  assert(scalingListType < 6);
512  m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkip );
513
514 
515  //===== reconstruction =====
516  Pel* pPred      = piPred;
517  Pel* pResi      = piResi;
518  Pel* pReco      = piReco;
519  Pel* pRecIPred  = piRecIPred;
520  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
521  {
522    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
523    {
524      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
525      pRecIPred[ uiX ] = pReco[ uiX ];
526    }
527    pPred     += uiStride;
528    pResi     += uiStride;
529    pReco     += uiStride;
530    pRecIPred += uiRecIPredStride;
531  }
532}
533
534
535Void
536TDecCu::xIntraRecChromaBlk( TComDataCU* pcCU,
537                           UInt        uiTrDepth,
538                           UInt        uiAbsPartIdx,
539                           TComYuv*    pcRecoYuv,
540                           TComYuv*    pcPredYuv, 
541                           TComYuv*    pcResiYuv,
542                           UInt        uiChromaId )
543{
544  UInt uiFullDepth  = pcCU->getDepth( 0 ) + uiTrDepth;
545  UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiFullDepth ] + 2;
546
547  if( uiLog2TrSize == 2 )
548  {
549    assert( uiTrDepth > 0 );
550    uiTrDepth--;
551    UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth( 0 ) + uiTrDepth ) << 1 );
552    Bool bFirstQ = ( ( uiAbsPartIdx % uiQPDiv ) == 0 );
553    if( !bFirstQ )
554    {
555      return;
556    }
557  }
558 
559  TextType  eText             = ( uiChromaId > 0 ? TEXT_CHROMA_V : TEXT_CHROMA_U );
560  UInt      uiWidth           = pcCU     ->getWidth   ( 0 ) >> ( uiTrDepth + 1 );
561  UInt      uiHeight          = pcCU     ->getHeight  ( 0 ) >> ( uiTrDepth + 1 );
562  UInt      uiStride          = pcRecoYuv->getCStride ();
563  Pel*      piReco            = ( uiChromaId > 0 ? pcRecoYuv->getCrAddr( uiAbsPartIdx ) : pcRecoYuv->getCbAddr( uiAbsPartIdx ) );
564  Pel*      piPred            = ( uiChromaId > 0 ? pcPredYuv->getCrAddr( uiAbsPartIdx ) : pcPredYuv->getCbAddr( uiAbsPartIdx ) );
565  Pel*      piResi            = ( uiChromaId > 0 ? pcResiYuv->getCrAddr( uiAbsPartIdx ) : pcResiYuv->getCbAddr( uiAbsPartIdx ) );
566 
567  UInt      uiNumCoeffInc     = ( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() ) >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 ) ) >> 2;
568  TCoeff*   pcCoeff           = ( uiChromaId > 0 ? pcCU->getCoeffCr() : pcCU->getCoeffCb() ) + ( uiNumCoeffInc * uiAbsPartIdx );
569 
570  UInt      uiChromaPredMode  = pcCU->getChromaIntraDir( 0 );
571 
572  UInt      uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
573  Pel*      piRecIPred        = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) );
574  UInt      uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getCStride();
575  Bool      useTransformSkipChroma = pcCU->getTransformSkip(uiAbsPartIdx,eText);
576  //===== init availability pattern =====
577  Bool  bAboveAvail = false;
578  Bool  bLeftAvail  = false;
579  pcCU->getPattern()->initPattern         ( pcCU, uiTrDepth, uiAbsPartIdx );
580
581  pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth,
582                                           m_pcPrediction->getPredicBuf       (),
583                                           m_pcPrediction->getPredicBufWidth  (),
584                                           m_pcPrediction->getPredicBufHeight (),
585                                           bAboveAvail, bLeftAvail );
586  Int* pPatChroma   = ( uiChromaId > 0 ? pcCU->getPattern()->getAdiCrBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) : pcCU->getPattern()->getAdiCbBuf( uiWidth, uiHeight, m_pcPrediction->getPredicBuf() ) );
587 
588  //===== get prediction signal =====
589  {
590    if( uiChromaPredMode == DM_CHROMA_IDX )
591    {
592      uiChromaPredMode = pcCU->getLumaIntraDir( 0 );
593    }
594    m_pcPrediction->predIntraChromaAng( pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 
595  }
596
597  //===== inverse transform =====
598  Int curChromaQpOffset;
599  if(eText == TEXT_CHROMA_U)
600  {
601    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
602  }
603  else
604  {
605    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
606  }
607  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
608
609  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText];
610  assert(scalingListType < 6);
611  m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkipChroma );
612
613  //===== reconstruction =====
614  Pel* pPred      = piPred;
615  Pel* pResi      = piResi;
616  Pel* pReco      = piReco;
617  Pel* pRecIPred  = piRecIPred;
618  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
619  {
620    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
621    {
622      pReco    [ uiX ] = ClipC( pPred[ uiX ] + pResi[ uiX ] );
623      pRecIPred[ uiX ] = pReco[ uiX ];
624    }
625    pPred     += uiStride;
626    pResi     += uiStride;
627    pReco     += uiStride;
628    pRecIPred += uiRecIPredStride;
629  }
630}
631
632
633Void
634TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiDepth )
635{
636  UInt  uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 );
637  UInt  uiNumPart     = pcCU->getNumPartInter();
638  UInt  uiNumQParts   = pcCU->getTotalNumPart() >> 2;
639 
640  if (pcCU->getIPCMFlag(0))
641  {
642    xReconPCM( pcCU, uiDepth );
643    return;
644  }
645
646  for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ )
647  {
648    xIntraLumaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] );
649  } 
650
651  for( UInt uiPU = 0; uiPU < uiNumPart; uiPU++ )
652  {
653    xIntraChromaRecQT( pcCU, uiInitTrDepth, uiPU * uiNumQParts, m_ppcYuvReco[uiDepth], m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth] );
654  }
655
656}
657
658/** Function for deriving recontructed PU/CU Luma sample with QTree structure
659 * \param pcCU pointer of current CU
660 * \param uiTrDepth current tranform split depth
661 * \param uiAbsPartIdx  part index
662 * \param pcRecoYuv pointer to reconstructed sample arrays
663 * \param pcPredYuv pointer to prediction sample arrays
664 * \param pcResiYuv pointer to residue sample arrays
665 *
666 \ This function dervies recontructed PU/CU Luma sample with recursive QTree structure
667 */
668Void
669TDecCu::xIntraLumaRecQT( TComDataCU* pcCU,
670                     UInt        uiTrDepth,
671                     UInt        uiAbsPartIdx,
672                     TComYuv*    pcRecoYuv,
673                     TComYuv*    pcPredYuv, 
674                     TComYuv*    pcResiYuv )
675{
676  UInt uiFullDepth  = pcCU->getDepth(0) + uiTrDepth;
677  UInt uiTrMode     = pcCU->getTransformIdx( uiAbsPartIdx );
678  if( uiTrMode == uiTrDepth )
679  {
680    xIntraRecLumaBlk  ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv );
681  }
682  else
683  {
684    UInt uiNumQPart  = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 );
685    for( UInt uiPart = 0; uiPart < 4; uiPart++ )
686    {
687      xIntraLumaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv );
688    }
689  }
690}
691
692/** Function for deriving recontructed PU/CU chroma samples with QTree structure
693 * \param pcCU pointer of current CU
694 * \param uiTrDepth current tranform split depth
695 * \param uiAbsPartIdx  part index
696 * \param pcRecoYuv pointer to reconstructed sample arrays
697 * \param pcPredYuv pointer to prediction sample arrays
698 * \param pcResiYuv pointer to residue sample arrays
699 *
700 \ This function dervies recontructed PU/CU chroma samples with QTree recursive structure
701 */
702Void
703TDecCu::xIntraChromaRecQT( TComDataCU* pcCU,
704                     UInt        uiTrDepth,
705                     UInt        uiAbsPartIdx,
706                     TComYuv*    pcRecoYuv,
707                     TComYuv*    pcPredYuv, 
708                     TComYuv*    pcResiYuv )
709{
710  UInt uiFullDepth  = pcCU->getDepth(0) + uiTrDepth;
711  UInt uiTrMode     = pcCU->getTransformIdx( uiAbsPartIdx );
712  if( uiTrMode == uiTrDepth )
713  {
714    xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 );
715    xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 );
716  }
717  else
718  {
719    UInt uiNumQPart  = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 );
720    for( UInt uiPart = 0; uiPart < 4; uiPart++ )
721    {
722      xIntraChromaRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv );
723    }
724  }
725}
726
727Void TDecCu::xCopyToPic( TComDataCU* pcCU, TComPic* pcPic, UInt uiZorderIdx, UInt uiDepth )
728{
729  UInt uiCUAddr = pcCU->getAddr();
730 
731  m_ppcYuvReco[uiDepth]->copyToPicYuv  ( pcPic->getPicYuvRec (), uiCUAddr, uiZorderIdx );
732 
733  return;
734}
735
736Void TDecCu::xDecodeInterTexture ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
737{
738  UInt    uiWidth    = pcCU->getWidth ( uiAbsPartIdx );
739  UInt    uiHeight   = pcCU->getHeight( uiAbsPartIdx );
740  TCoeff* piCoeff;
741 
742  Pel*    pResi;
743  UInt    trMode = pcCU->getTransformIdx( uiAbsPartIdx );
744 
745  // Y
746  piCoeff = pcCU->getCoeffY();
747  pResi = m_ppcYuvResi[uiDepth]->getLumaAddr();
748
749  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
750
751  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
752 
753  // Cb and Cr
754  Int curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
755  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
756
757  uiWidth  >>= 1;
758  uiHeight >>= 1;
759  piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr();
760  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
761
762  curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
763  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
764
765  piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr();
766  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
767}
768
769/** Function for deriving reconstructed luma/chroma samples of a PCM mode CU.
770 * \param pcCU pointer to current CU
771 * \param uiPartIdx part index
772 * \param piPCM pointer to PCM code arrays
773 * \param piReco pointer to reconstructed sample arrays
774 * \param uiStride stride of reconstructed sample arrays
775 * \param uiWidth CU width
776 * \param uiHeight CU height
777 * \param ttText texture component type
778 * \returns Void
779 */
780Void TDecCu::xDecodePCMTexture( TComDataCU* pcCU, UInt uiPartIdx, Pel *piPCM, Pel* piReco, UInt uiStride, UInt uiWidth, UInt uiHeight, TextType ttText)
781{
782  UInt uiX, uiY;
783  Pel* piPicReco;
784  UInt uiPicStride;
785  UInt uiPcmLeftShiftBit; 
786
787  if( ttText == TEXT_LUMA )
788  {
789    uiPicStride   = pcCU->getPic()->getPicYuvRec()->getStride();
790    piPicReco = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
791    uiPcmLeftShiftBit = g_bitDepthY - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();
792  }
793  else
794  {
795    uiPicStride = pcCU->getPic()->getPicYuvRec()->getCStride();
796
797    if( ttText == TEXT_CHROMA_U )
798    {
799      piPicReco = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
800    }
801    else
802    {
803      piPicReco = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
804    }
805    uiPcmLeftShiftBit = g_bitDepthC - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
806  }
807
808  for( uiY = 0; uiY < uiHeight; uiY++ )
809  {
810    for( uiX = 0; uiX < uiWidth; uiX++ )
811    {
812      piReco[uiX] = (piPCM[uiX] << uiPcmLeftShiftBit);
813      piPicReco[uiX] = piReco[uiX];
814    }
815    piPCM += uiWidth;
816    piReco += uiStride;
817    piPicReco += uiPicStride;
818  }
819}
820
821/** Function for reconstructing a PCM mode CU.
822 * \param pcCU pointer to current CU
823 * \param uiDepth CU Depth
824 * \returns Void
825 */
826Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiDepth )
827{
828  // Luma
829  UInt uiWidth  = (g_uiMaxCUWidth >> uiDepth);
830  UInt uiHeight = (g_uiMaxCUHeight >> uiDepth);
831
832  Pel* piPcmY = pcCU->getPCMSampleY();
833  Pel* piRecoY = m_ppcYuvReco[uiDepth]->getLumaAddr(0, uiWidth);
834
835  UInt uiStride = m_ppcYuvResi[uiDepth]->getStride();
836
837  xDecodePCMTexture( pcCU, 0, piPcmY, piRecoY, uiStride, uiWidth, uiHeight, TEXT_LUMA);
838
839  // Cb and Cr
840  UInt uiCWidth  = (uiWidth>>1);
841  UInt uiCHeight = (uiHeight>>1);
842
843  Pel* piPcmCb = pcCU->getPCMSampleCb();
844  Pel* piPcmCr = pcCU->getPCMSampleCr();
845  Pel* pRecoCb = m_ppcYuvReco[uiDepth]->getCbAddr();
846  Pel* pRecoCr = m_ppcYuvReco[uiDepth]->getCrAddr();
847
848  UInt uiCStride = m_ppcYuvReco[uiDepth]->getCStride();
849
850  xDecodePCMTexture( pcCU, 0, piPcmCb, pRecoCb, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_U);
851  xDecodePCMTexture( pcCU, 0, piPcmCr, pRecoCr, uiCStride, uiCWidth, uiCHeight, TEXT_CHROMA_V);
852}
853
854/** Function for filling the PCM buffer of a CU using its reconstructed sample array
855 * \param pcCU pointer to current CU
856 * \param uiDepth CU Depth
857 * \returns Void
858 */
859Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt depth)
860{
861  // Luma
862  UInt width  = (g_uiMaxCUWidth >> depth);
863  UInt height = (g_uiMaxCUHeight >> depth);
864
865  Pel* pPcmY = pCU->getPCMSampleY();
866  Pel* pRecoY = m_ppcYuvReco[depth]->getLumaAddr(0, width);
867
868  UInt stride = m_ppcYuvReco[depth]->getStride();
869
870  for(Int y = 0; y < height; y++ )
871  {
872    for(Int x = 0; x < width; x++ )
873    {
874      pPcmY[x] = pRecoY[x];
875    }
876    pPcmY += width;
877    pRecoY += stride;
878  }
879
880  // Cb and Cr
881  UInt widthC  = (width>>1);
882  UInt heightC = (height>>1);
883
884  Pel* pPcmCb = pCU->getPCMSampleCb();
885  Pel* pPcmCr = pCU->getPCMSampleCr();
886  Pel* pRecoCb = m_ppcYuvReco[depth]->getCbAddr();
887  Pel* pRecoCr = m_ppcYuvReco[depth]->getCrAddr();
888
889  UInt strideC = m_ppcYuvReco[depth]->getCStride();
890
891  for(Int y = 0; y < heightC; y++ )
892  {
893    for(Int x = 0; x < widthC; x++ )
894    {
895      pPcmCb[x] = pRecoCb[x];
896      pPcmCr[x] = pRecoCr[x];
897    }
898    pPcmCr += widthC;
899    pPcmCb += widthC;
900    pRecoCb += strideC;
901    pRecoCr += strideC;
902  }
903
904}
905
906//! \}
Note: See TracBrowser for help on using the repository browser.