source: 3DVCSoftware/branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibCommon/TComPic.cpp

Last change on this file was 213, checked in by mitsubishi-htm, 12 years ago

A final release, as planned

  • Migrate to HTM 5.1
  • For VC project files, only VC9 file is updated
  • To be used as an additional anchor for CE1.h for 3rd JCTVC meeting at Geneva
  • Property svn:eol-style set to native
File size: 22.5 KB
Line 
1/* The copyright in this software is being made available under the BSD
2 * License, included below. This software may be subject to other third party
3 * and contributor rights, including patent rights, and no such rights are
4 * granted under this license. 
5 *
6 * Copyright (c) 2010-2012, 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     TComPic.cpp
35    \brief    picture class
36*/
37
38#include "TComPic.h"
39#include "SEI.h"
40
41//! \ingroup TLibCommon
42//! \{
43
44// ====================================================================================================================
45// Constructor / destructor / create / destroy
46// ====================================================================================================================
47
48TComPic::TComPic()
49{
50  m_uiTLayer          = 0;
51
52  m_apcPicSym         = NULL;
53  m_apcPicYuv[0]      = NULL;
54  m_apcPicYuv[1]      = NULL;
55#if VSP_N
56  m_apcPicYuvAvail     = NULL;
57  m_apcPicYuvSynth     = NULL;
58  m_bIsVsp             = false;
59#endif
60#if DEPTH_MAP_GENERATION
61  m_pcPredDepthMap    = NULL;
62#if PDM_REMOVE_DEPENDENCE
63  m_pcPredDepthMap_temp    = NULL;
64#endif
65#endif
66#if HHI_INTER_VIEW_MOTION_PRED
67  m_pcOrgDepthMap     = NULL;
68#endif
69#if HHI_INTER_VIEW_RESIDUAL_PRED
70  m_pcResidual        = NULL;
71#endif
72  m_pcPicYuvPred      = NULL;
73  m_pcPicYuvResi      = NULL;
74  m_bIsLongTerm       = false;
75  m_bReconstructed    = false;
76  m_usedForTMVP       = true;
77  m_bNeededForOutput  = false;
78  m_pSliceSUMap       = NULL;
79  m_uiCurrSliceIdx    = 0; 
80#if HHI_INTERVIEW_SKIP
81  m_pcUsedPelsMap     = NULL;
82#endif
83#if SONY_COLPIC_AVAILABILITY
84  m_iViewOrderIdx     = 0;
85#endif
86  m_aaiCodedScale     = 0;
87  m_aaiCodedOffset    = 0;
88#if OL_QTLIMIT_PREDCODING_B0068
89  m_bReduceBitsQTL    = 0;
90#endif
91#if QC_SIMPLE_NBDV_B0047
92  m_bRapCheck = false;
93  m_eRapRefList = REF_PIC_LIST_0;
94  m_uiRapRefIdx = 0;
95#endif
96
97}
98
99TComPic::~TComPic()
100{
101}
102
103Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Bool bIsVirtual )
104{
105  m_apcPicSym     = new TComPicSym;  m_apcPicSym   ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
106  if (!bIsVirtual)
107  {
108    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
109  }
110  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
111 
112  /* there are no SEI messages associated with this picture initially */
113  m_SEIs = NULL;
114  m_bUsedByCurr = false;
115  return;
116}
117
118Void TComPic::destroy()
119{
120  if (m_apcPicSym)
121  {
122    m_apcPicSym->destroy();
123    delete m_apcPicSym;
124    m_apcPicSym = NULL;
125  }
126 
127  if (m_apcPicYuv[0])
128  {
129    m_apcPicYuv[0]->destroy();
130    delete m_apcPicYuv[0];
131    m_apcPicYuv[0]  = NULL;
132  }
133 
134  if (m_apcPicYuv[1])
135  {
136    m_apcPicYuv[1]->destroy();
137    delete m_apcPicYuv[1];
138    m_apcPicYuv[1]  = NULL;
139  }
140#if HHI_INTERVIEW_SKIP
141  if( m_pcUsedPelsMap )
142  {
143    m_pcUsedPelsMap->destroy();
144    delete m_pcUsedPelsMap;
145    m_pcUsedPelsMap = NULL;
146  }
147#endif
148#if DEPTH_MAP_GENERATION
149  if( m_pcPredDepthMap )
150  {
151    m_pcPredDepthMap->destroy();
152    delete m_pcPredDepthMap;
153    m_pcPredDepthMap = NULL;
154  }
155#if PDM_REMOVE_DEPENDENCE
156  if( m_pcPredDepthMap_temp )         //  estimated depth map
157  {
158    m_pcPredDepthMap_temp->destroy();
159    delete m_pcPredDepthMap_temp;
160    m_pcPredDepthMap_temp = NULL;
161  }                     
162#endif
163#endif
164#if HHI_INTER_VIEW_MOTION_PRED
165  if( m_pcOrgDepthMap )
166  {
167    m_pcOrgDepthMap->destroy();
168    delete m_pcOrgDepthMap;
169    m_pcOrgDepthMap = NULL;
170  }
171#endif
172#if HHI_INTER_VIEW_RESIDUAL_PRED
173  if( m_pcResidual )
174  {
175    m_pcResidual->destroy();
176    delete m_pcResidual;
177    m_pcResidual = NULL;
178  }
179#endif
180  delete m_SEIs;
181}
182
183Void TComPic::compressMotion()
184{
185  TComPicSym* pPicSym = getPicSym(); 
186  for ( UInt uiCUAddr = 0; uiCUAddr < pPicSym->getFrameHeightInCU()*pPicSym->getFrameWidthInCU(); uiCUAddr++ )
187  {
188    TComDataCU* pcCU = pPicSym->getCU(uiCUAddr);
189    pcCU->compressMV(); 
190  } 
191}
192
193#if DEPTH_MAP_GENERATION
194Void
195TComPic::addPrdDepthMapBuffer( UInt uiSubSampExpX, UInt uiSubSampExpY )
196{
197  AOT( m_pcPredDepthMap );
198  AOF( m_apcPicYuv[1]   );
199  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
200  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
201  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
202  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
203  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
204  m_pcPredDepthMap    = new TComPicYuv;
205  m_pcPredDepthMap    ->create( iWidth >> uiSubSampExpX, iHeight >> uiSubSampExpY, uiMaxCuWidth >> uiSubSampExpX, uiMaxCuHeight >> uiSubSampExpY, uiMaxCuDepth );
206#if PDM_REMOVE_DEPENDENCE
207  m_pcPredDepthMap_temp    = new TComPicYuv;
208  m_pcPredDepthMap_temp    ->create( iWidth >> uiSubSampExpX, iHeight >> uiSubSampExpY, uiMaxCuWidth >> uiSubSampExpX, uiMaxCuHeight >> uiSubSampExpY, uiMaxCuDepth );
209#endif
210}
211#endif
212
213#if HHI_INTER_VIEW_MOTION_PRED
214Void
215TComPic::addOrgDepthMapBuffer()
216{
217  AOT( m_pcOrgDepthMap );
218  AOF( m_apcPicYuv[1]  );
219  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
220  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
221  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
222  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
223  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
224  m_pcOrgDepthMap     = new TComPicYuv;
225  m_pcOrgDepthMap     ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
226}
227#endif
228
229#if HHI_INTER_VIEW_RESIDUAL_PRED
230Void
231TComPic::addResidualBuffer()
232{
233  AOT( m_pcResidual   );
234  AOF( m_apcPicYuv[1] );
235  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
236  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
237  UInt  uiMaxCuWidth  = m_apcPicYuv[1]->getMaxCuWidth ();
238  UInt  uiMaxCuHeight = m_apcPicYuv[1]->getMaxCuHeight();
239  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
240  m_pcResidual        = new TComPicYuv;
241  m_pcResidual        ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
242}
243#endif
244
245#if DEPTH_MAP_GENERATION
246Void
247TComPic::removePrdDepthMapBuffer()
248{
249  if( m_pcPredDepthMap )
250  {
251    m_pcPredDepthMap->destroy();
252    delete m_pcPredDepthMap;
253    m_pcPredDepthMap = NULL;
254  }
255#if PDM_REMOVE_DEPENDENCE
256  if(m_pcPredDepthMap_temp)
257  {
258    m_pcPredDepthMap_temp->destroy();
259    delete m_pcPredDepthMap_temp;
260    m_pcPredDepthMap_temp = NULL;
261  }
262#endif
263}
264#endif
265
266#if HHI_INTER_VIEW_MOTION_PRED
267Void
268TComPic::removeOrgDepthMapBuffer()
269{
270  if( m_pcOrgDepthMap )
271  {
272    m_pcOrgDepthMap->destroy();
273    delete m_pcOrgDepthMap;
274    m_pcOrgDepthMap = NULL;
275  }
276}
277#endif
278
279#if HHI_INTER_VIEW_RESIDUAL_PRED
280Void
281TComPic::removeResidualBuffer()
282{
283  if( m_pcResidual )
284  {
285    m_pcResidual->destroy();
286    delete m_pcResidual;
287    m_pcResidual = NULL;
288  }
289}
290#endif
291
292/** Create non-deblocked filter information
293 * \param pSliceStartAddress array for storing slice start addresses
294 * \param numSlices number of slices in picture
295 * \param sliceGranularityDepth slice granularity
296 * \param bNDBFilterCrossSliceBoundary cross-slice-boundary in-loop filtering; true for "cross".
297 * \param numTiles number of tiles in picture
298 * \param bNDBFilterCrossTileBoundary cross-tile-boundary in-loop filtering; true for "cross".
299 */
300Void TComPic::createNonDBFilterInfo(UInt* pSliceStartAddress, Int numSlices, Int sliceGranularityDepth
301                                    ,Bool bNDBFilterCrossSliceBoundary
302                                    ,Int numTiles
303                                    ,Bool bNDBFilterCrossTileBoundary)
304{
305  UInt maxNumSUInLCU = getNumPartInCU();
306  UInt numLCUInPic   = getNumCUsInFrame();
307  UInt picWidth      = getSlice(0)->getSPS()->getPicWidthInLumaSamples();
308  UInt picHeight     = getSlice(0)->getSPS()->getPicHeightInLumaSamples();
309  Int  numLCUsInPicWidth = getFrameWidthInCU();
310  Int  numLCUsInPicHeight= getFrameHeightInCU();
311  UInt maxNumSUInLCUWidth = getNumPartInWidth();
312  UInt maxNumSUInLCUHeight= getNumPartInHeight();
313
314  m_bIndependentSliceBoundaryForNDBFilter = (bNDBFilterCrossSliceBoundary)?(false):((numSlices > 1)?(true):(false)) ;
315  m_sliceGranularityForNDBFilter = sliceGranularityDepth;
316  m_bIndependentTileBoundaryForNDBFilter  = (bNDBFilterCrossTileBoundary)?(false) :((numTiles > 1)?(true):(false));
317
318  m_pbValidSlice = new Bool[numSlices];
319  for(Int s=0; s< numSlices; s++)
320  {
321    m_pbValidSlice[s] = true;
322  }
323#if !LCU_SYNTAX_ALF
324  if( pSliceStartAddress == NULL || (numSlices == 1 && numTiles == 1) )
325  {
326    return;
327  }
328#endif
329  m_pSliceSUMap = new Int[maxNumSUInLCU * numLCUInPic];
330
331  //initialization
332  for(UInt i=0; i< (maxNumSUInLCU * numLCUInPic); i++ )
333  {
334    m_pSliceSUMap[i] = -1;
335  }
336  for( UInt CUAddr = 0; CUAddr < numLCUInPic ; CUAddr++ )
337  {
338    TComDataCU* pcCU = getCU( CUAddr );
339    pcCU->setSliceSUMap(m_pSliceSUMap + (CUAddr* maxNumSUInLCU)); 
340    pcCU->getNDBFilterBlocks()->clear();
341  }
342  m_vSliceCUDataLink.clear();
343
344  m_vSliceCUDataLink.resize(numSlices);
345
346  UInt startAddr, endAddr, firstCUInStartLCU, startLCU, endLCU, lastCUInEndLCU, uiAddr;
347  UInt LPelX, TPelY, LCUX, LCUY;
348  UInt currSU;
349  UInt startSU, endSU;
350
351  for(Int s=0; s< numSlices; s++)
352  {
353    //1st step: decide the real start address
354    startAddr = pSliceStartAddress[s];
355    endAddr   = pSliceStartAddress[s+1] -1;
356
357    startLCU            = startAddr / maxNumSUInLCU;
358    firstCUInStartLCU   = startAddr % maxNumSUInLCU;
359
360    endLCU              = endAddr   / maxNumSUInLCU;
361    lastCUInEndLCU      = endAddr   % maxNumSUInLCU;   
362
363    uiAddr = m_apcPicSym->getCUOrderMap(startLCU);
364
365    LCUX      = getCU(uiAddr)->getCUPelX();
366    LCUY      = getCU(uiAddr)->getCUPelY();
367    LPelX     = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[firstCUInStartLCU] ];
368    TPelY     = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[firstCUInStartLCU] ];
369    currSU    = firstCUInStartLCU;
370
371    Bool bMoveToNextLCU = false;
372    Bool bSliceInOneLCU = (startLCU == endLCU);
373
374    while(!( LPelX < picWidth ) || !( TPelY < picHeight ))
375    {
376      currSU ++;
377
378      if(bSliceInOneLCU)
379      {
380        if(currSU > lastCUInEndLCU)
381        {
382          m_pbValidSlice[s] = false;
383          break;
384        }
385      }
386
387      if(currSU >= maxNumSUInLCU )
388      {
389        bMoveToNextLCU = true;
390        break;
391      }
392
393      LPelX = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[currSU] ];
394      TPelY = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[currSU] ];
395
396    }
397
398
399    if(!m_pbValidSlice[s])
400    {
401      continue;
402    }
403
404    if(currSU != firstCUInStartLCU)
405    {
406      if(!bMoveToNextLCU)
407      {
408        firstCUInStartLCU = currSU;
409      }
410      else
411      {
412        startLCU++;
413        firstCUInStartLCU = 0;
414        assert( startLCU < getNumCUsInFrame());
415      }
416      assert(startLCU*maxNumSUInLCU + firstCUInStartLCU < endAddr);
417    }
418
419
420    //2nd step: assign NonDBFilterInfo to each processing block
421    for(UInt i= startLCU; i <= endLCU; i++)
422    {
423      startSU = (i == startLCU)?(firstCUInStartLCU):(0);
424      endSU   = (i == endLCU  )?(lastCUInEndLCU   ):(maxNumSUInLCU -1);
425
426      uiAddr = m_apcPicSym->getCUOrderMap(i);
427      Int iTileID= m_apcPicSym->getTileIdxMap(uiAddr);
428
429      TComDataCU* pcCU = getCU(uiAddr);
430      m_vSliceCUDataLink[s].push_back(pcCU);
431
432      createNonDBFilterInfoLCU(iTileID, s, pcCU, startSU, endSU, m_sliceGranularityForNDBFilter, picWidth, picHeight);
433    }
434  }
435
436  //step 3: border availability
437  for(Int s=0; s< numSlices; s++)
438  {
439    if(!m_pbValidSlice[s])
440    {
441      continue;
442    }
443
444    for(Int i=0; i< m_vSliceCUDataLink[s].size(); i++)
445    {
446      TComDataCU* pcCU = m_vSliceCUDataLink[s][i];
447      uiAddr = pcCU->getAddr();
448
449      if(pcCU->getPic()==0)
450      {
451        continue;
452      }
453      Int iTileID= m_apcPicSym->getTileIdxMap(uiAddr);
454      Bool bTopTileBoundary = false, bDownTileBoundary= false, bLeftTileBoundary= false, bRightTileBoundary= false;
455
456      if(m_bIndependentTileBoundaryForNDBFilter)
457      {
458        //left
459        if( uiAddr % numLCUsInPicWidth != 0)
460        {
461          bLeftTileBoundary = ( m_apcPicSym->getTileIdxMap(uiAddr -1) != iTileID )?true:false;
462        }
463        //right
464        if( (uiAddr % numLCUsInPicWidth) != (numLCUsInPicWidth -1) )
465        {
466          bRightTileBoundary = ( m_apcPicSym->getTileIdxMap(uiAddr +1) != iTileID)?true:false;
467        }
468        //top
469        if( uiAddr >= numLCUsInPicWidth)
470        {
471          bTopTileBoundary = (m_apcPicSym->getTileIdxMap(uiAddr - numLCUsInPicWidth) !=  iTileID )?true:false;
472        }
473        //down
474        if( uiAddr + numLCUsInPicWidth < numLCUInPic )
475        {
476          bDownTileBoundary = (m_apcPicSym->getTileIdxMap(uiAddr + numLCUsInPicWidth) != iTileID)?true:false;
477        }
478
479      }
480
481      pcCU->setNDBFilterBlockBorderAvailability(numLCUsInPicWidth, numLCUsInPicHeight, maxNumSUInLCUWidth, maxNumSUInLCUHeight,picWidth, picHeight
482        ,m_bIndependentSliceBoundaryForNDBFilter
483        ,bTopTileBoundary, bDownTileBoundary, bLeftTileBoundary, bRightTileBoundary
484        ,m_bIndependentTileBoundaryForNDBFilter);
485
486    }
487
488  }
489
490  if( m_bIndependentSliceBoundaryForNDBFilter || m_bIndependentTileBoundaryForNDBFilter)
491  {
492    m_pNDBFilterYuvTmp = new TComPicYuv();
493    m_pNDBFilterYuvTmp->create(picWidth, picHeight, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth);
494  }
495}
496#if QC_SIMPLE_NBDV_B0047
497Bool TComPic::getDisCandRefPictures(Int iColPOC)
498{
499  UInt uiTempLayerCurr=7;
500  TComSlice* currSlice = getCurrSlice();
501  UInt iPOCCurr=currSlice->getPOC();
502  UInt iPOCDiff = 255;
503  Bool  bRAP=false;
504  Bool bCheck = false;
505  Int MaxRef = currSlice->getNumRefIdx(RefPicList(0));
506  RefPicList eRefPicList = REF_PIC_LIST_0 ;
507  if(currSlice->isInterB())
508  {
509    if(currSlice->getNumRefIdx(RefPicList(0))< currSlice->getNumRefIdx(RefPicList(1)))
510      MaxRef = currSlice->getNumRefIdx(RefPicList(1));
511  }
512  for(Int lpRef = 0; lpRef < MaxRef; lpRef++)
513  {
514    for(Int lpNr = 0; lpNr < (currSlice->isInterB() ? 2: 1); lpNr ++)
515    {
516      eRefPicList = RefPicList(0);
517      if(currSlice->isInterB())
518        eRefPicList = RefPicList(lpNr==0 ? (currSlice->getColDir()): (1-currSlice->getColDir()));
519      if(iColPOC == currSlice->getRefPOC(eRefPicList, lpRef))
520        continue;
521      if(lpRef >= currSlice->getNumRefIdx(eRefPicList)||(currSlice->getViewId() != currSlice->getRefPic( eRefPicList, lpRef)->getViewId()))
522        continue;
523      Int iTempPoc = currSlice->getRefPic(eRefPicList, lpRef)->getPOC();
524      UInt uiTempLayer = currSlice->getRefPic(eRefPicList, lpRef)->getCurrSlice()->getTLayer(); 
525      Int iTempDiff = (iTempPoc > iPOCCurr) ? (iTempPoc - iPOCCurr): (iPOCCurr - iTempPoc);
526#if QC_REM_IDV_B0046
527      TComSlice* refSlice = currSlice->getRefPic(eRefPicList, lpRef)->getCurrSlice();
528      bRAP = (refSlice->getSPS()->getViewId() && (refSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR || refSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA))? 1: 0;     
529#else
530      bRAP = (currSlice->getRefPic(eRefPicList, lpRef)->getCurrSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDV? 1:0);
531#endif
532      if( bRAP)
533      {
534         bCheck = true;
535         this->setRapRefIdx(lpRef);
536         this->setRapRefList(eRefPicList);
537         return bCheck;
538      }
539      if(uiTempLayerCurr > uiTempLayer)
540      {
541        bCheck = true;
542        if(uiTempLayerCurr == uiTempLayer)
543        {
544          if(iPOCDiff > iTempDiff)
545          {
546            iPOCDiff=iTempDiff;
547            if(iPOCDiff < 255)
548            {
549              this->setRapRefIdx(lpRef);
550              this->setRapRefList(eRefPicList);
551            }
552          }
553        }
554        else
555        {
556          iPOCDiff=iTempDiff;
557          uiTempLayerCurr = uiTempLayer;
558          this->setRapRefIdx(lpRef);
559          this->setRapRefList(eRefPicList);
560        } 
561      }
562    }
563  }
564  return bCheck;
565}
566#endif
567
568#if HHI_INTERVIEW_SKIP
569Void TComPic::addUsedPelsMapBuffer()
570{
571  AOT( m_pcUsedPelsMap );
572  AOF( m_apcPicYuv[1]  );
573  Int   iWidth        = m_apcPicYuv[1]->getWidth      ();
574  Int   iHeight       = m_apcPicYuv[1]->getHeight     ();
575  UInt  uiMaxCuWidth  = m_apcPicSym->getMaxCUWidth();
576  UInt  uiMaxCuHeight = m_apcPicSym->getMaxCUHeight();
577  UInt  uiMaxCuDepth  = m_apcPicSym->getMaxCUDepth ();
578  m_pcUsedPelsMap     = new TComPicYuv;
579  m_pcUsedPelsMap     ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
580
581}
582Void
583TComPic::removeUsedPelsMapBuffer()
584{
585  if( m_pcUsedPelsMap )
586  {
587    m_pcUsedPelsMap->destroy();
588    delete m_pcUsedPelsMap;
589    m_pcUsedPelsMap = NULL;
590  }
591}
592#endif
593
594/** Create non-deblocked filter information for LCU
595 * \param tileID tile index
596 * \param sliceID slice index
597 * \param pcCU CU data pointer
598 * \param startSU start SU index in LCU
599 * \param endSU end SU index in LCU
600 * \param sliceGranularyDepth slice granularity
601 * \param picWidth picture width
602 * \param picHeight picture height
603 */
604Void TComPic::createNonDBFilterInfoLCU(Int tileID, Int sliceID, TComDataCU* pcCU, UInt startSU, UInt endSU, Int sliceGranularyDepth, UInt picWidth, UInt picHeight)
605{
606  UInt LCUX          = pcCU->getCUPelX();
607  UInt LCUY          = pcCU->getCUPelY();
608  Int* pCUSliceMap    = pcCU->getSliceSUMap();
609  UInt maxNumSUInLCU = getNumPartInCU();
610  UInt maxNumSUInSGU = maxNumSUInLCU >> (sliceGranularyDepth << 1);
611  UInt maxNumSUInLCUWidth = getNumPartInWidth();
612  UInt LPelX, TPelY;
613  UInt currSU;
614
615
616  //get the number of valid NBFilterBLock
617  currSU   = startSU;
618  while(currSU <= endSU)
619  {
620    LPelX = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[currSU] ];
621    TPelY = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[currSU] ];
622
623    while(!( LPelX < picWidth ) || !( TPelY < picHeight ))
624    {
625      currSU += maxNumSUInSGU;
626      if(currSU >= maxNumSUInLCU || currSU > endSU)
627      {
628        break;
629      }
630      LPelX = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[currSU] ];
631      TPelY = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[currSU] ];
632    }
633
634    if(currSU >= maxNumSUInLCU || currSU > endSU)
635    {
636      break;
637    }
638
639    NDBFBlockInfo NDBFBlock;
640
641    NDBFBlock.tileID  = tileID;
642    NDBFBlock.sliceID = sliceID;
643    NDBFBlock.posY    = TPelY;
644    NDBFBlock.posX    = LPelX;
645    NDBFBlock.startSU = currSU;
646
647    UInt uiLastValidSU  = currSU;
648    UInt uiIdx, uiLPelX_su, uiTPelY_su;
649    for(uiIdx = currSU; uiIdx < currSU + maxNumSUInSGU; uiIdx++)
650    {
651      if(uiIdx > endSU)
652      {
653        break;       
654      }
655      uiLPelX_su   = LCUX + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ];
656      uiTPelY_su   = LCUY + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
657      if( !(uiLPelX_su < picWidth ) || !( uiTPelY_su < picHeight ))
658      {
659        continue;
660      }
661      pCUSliceMap[uiIdx] = sliceID;
662      uiLastValidSU = uiIdx;
663    }
664    NDBFBlock.endSU = uiLastValidSU;
665
666    UInt rTLSU = g_auiZscanToRaster[ NDBFBlock.startSU ];
667    UInt rBRSU = g_auiZscanToRaster[ NDBFBlock.endSU   ];
668    NDBFBlock.widthSU  = (rBRSU % maxNumSUInLCUWidth) - (rTLSU % maxNumSUInLCUWidth)+ 1;
669    NDBFBlock.heightSU = (UInt)(rBRSU / maxNumSUInLCUWidth) - (UInt)(rTLSU / maxNumSUInLCUWidth)+ 1;
670    NDBFBlock.width    = NDBFBlock.widthSU  * getMinCUWidth();
671    NDBFBlock.height   = NDBFBlock.heightSU * getMinCUHeight();
672
673    pcCU->getNDBFilterBlocks()->push_back(NDBFBlock);
674
675    currSU += maxNumSUInSGU;
676  }
677
678}
679
680/** destroy non-deblocked filter information for LCU
681 */
682Void TComPic::destroyNonDBFilterInfo()
683{
684  if(m_pbValidSlice != NULL)
685  {
686    delete[] m_pbValidSlice;
687    m_pbValidSlice = NULL;
688  }
689
690  if(m_pSliceSUMap != NULL)
691  {
692    delete[] m_pSliceSUMap;
693    m_pSliceSUMap = NULL;
694  }
695  for( UInt CUAddr = 0; CUAddr < getNumCUsInFrame() ; CUAddr++ )
696  {
697    TComDataCU* pcCU = getCU( CUAddr );
698    pcCU->getNDBFilterBlocks()->clear();
699  }
700
701  if( m_bIndependentSliceBoundaryForNDBFilter || m_bIndependentTileBoundaryForNDBFilter)
702  {
703    m_pNDBFilterYuvTmp->destroy();
704    delete m_pNDBFilterYuvTmp;
705    m_pNDBFilterYuvTmp = NULL;
706  }
707
708}
709
710#if VSP_N
711Void TComPic::checkSynthesisAvailability( /*TComDataCU*& rpcCU, */UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, Bool *&rpbCUSynthesied )
712{ 
713  rpbCUSynthesied[0] = true;
714  rpbCUSynthesied[1] = true;
715  rpbCUSynthesied[2] = true;
716  rpbCUSynthesied[3] = true;
717
718  if (!getPicYuvAvail())
719  {
720    rpbCUSynthesied[0] = false;
721    rpbCUSynthesied[1] = false;
722    rpbCUSynthesied[2] = false;
723    rpbCUSynthesied[3] = false;
724    return;   
725  }
726 
727  Int x, y;
728  Pel* pAvail  = getPicYuvAvail()->getLumaAddr ( iCuAddr, uiAbsZorderIdx );
729  Int CUHeight = g_uiMaxCUHeight >> uiPartDepth; //rpcCU->getHeight(uiAbsZorderIdx);
730  Int CUWidth  = g_uiMaxCUWidth  >> uiPartDepth; //rpcCU->getWidth(uiAbsZorderIdx);
731 
732  Int  iStride  = getPicYuvAvail()->getStride();
733  for ( y = ((CUHeight - 1) >> 1); y >= 0; y-- )
734  {
735    for ( x = ((CUWidth - 1) >> 1); x >= 0; x-- )
736    {
737      rpbCUSynthesied[0] &= (pAvail[x] != 0);
738    }
739    for ( x = CUWidth - 1; x >= ((CUWidth) >> 1); x-- )
740    {
741      rpbCUSynthesied[1] &= (pAvail[x] != 0);
742    }
743    pAvail += iStride;
744  }
745  //for ( y = CUHeight - 1; y >= ((CUHeight) >> 1); y-- )
746  for ( y = ((CUHeight - 1) >> 1); y >= 0; y-- ) //Owieczka
747  {
748    for ( x = ((CUWidth - 1) >> 1); x >= 0; x-- )
749    {
750      rpbCUSynthesied[2] &= (pAvail[x] != 0);
751    }
752    for ( x = CUWidth - 1; x >= ((CUWidth) >> 1); x-- )
753    {
754      rpbCUSynthesied[3] &= (pAvail[x] != 0);
755    }
756    pAvail += iStride;
757  }
758
759  //rpbCUSynthesied[0] = !rpbCUSynthesied[0];
760  //rpbCUSynthesied[1] = !rpbCUSynthesied[1];
761  //rpbCUSynthesied[2] = !rpbCUSynthesied[2];
762  //rpbCUSynthesied[3] = !rpbCUSynthesied[3];
763}
764#endif
765
766//! \}
Note: See TracBrowser for help on using the repository browser.