source: SHVCSoftware/branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComPic.h @ 824

Last change on this file since 824 was 95, checked in by seregin, 12 years ago

rename getIsILR to isILR

File size: 11.3 KB
RevLine 
[51]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     TComPic.h
35    \brief    picture class (header)
36*/
37
38#ifndef __TCOMPIC__
39#define __TCOMPIC__
40
41// Include files
42#include "CommonDef.h"
43#include "TComPicSym.h"
44#include "TComPicYuv.h"
45#include "TComBitStream.h"
46#include "SEI.h"
[54]47#if AVC_BASE || SYNTAX_OUTPUT
48#include <fstream>
49#endif
[51]50
51//! \ingroup TLibCommon
52//! \{
53
54// ====================================================================================================================
55// Class definition
56// ====================================================================================================================
57
58/// picture class (symbol + YUV buffers)
59class TComPic
60{
61private:
62  UInt                  m_uiTLayer;               //  Temporal layer
[54]63#if SVC_EXTENSION
64  UInt                  m_layerId;              //  Layer ID
65#endif
[51]66  Bool                  m_bUsedByCurr;            //  Used by current picture
67  Bool                  m_bIsLongTerm;            //  IS long term picture
68  Bool                  m_bIsUsedAsLongTerm;      //  long term picture is used as reference before
69  TComPicSym*           m_apcPicSym;              //  Symbol
70 
71  TComPicYuv*           m_apcPicYuv[2];           //  Texture,  0:org / 1:rec
72 
73  TComPicYuv*           m_pcPicYuvPred;           //  Prediction
74  TComPicYuv*           m_pcPicYuvResi;           //  Residual
75  Bool                  m_bReconstructed;
76  Bool                  m_bNeededForOutput;
77  UInt                  m_uiCurrSliceIdx;         // Index of current slice
78  Int*                  m_pSliceSUMap;
79  Bool*                 m_pbValidSlice;
80  Int                   m_sliceGranularityForNDBFilter;
81  Bool                  m_bIndependentSliceBoundaryForNDBFilter;
82  Bool                  m_bIndependentTileBoundaryForNDBFilter;
83  TComPicYuv*           m_pNDBFilterYuvTmp;    //!< temporary picture buffer when non-cross slice/tile boundary in-loop filtering is enabled
84  Bool                  m_bCheckLTMSB;
85 
86  Int                   m_numReorderPics[MAX_TLAYER];
87  Window                m_conformanceWindow;
88  Window                m_defaultDisplayWindow;
89
90  std::vector<std::vector<TComDataCU*> > m_vSliceCUDataLink;
91
92  SEIMessages  m_SEIs; ///< Any SEI messages that have been received.  If !NULL we own the object.
[54]93#if SVC_EXTENSION
94  Bool                  m_bSpatialEnhLayer;       // whether current layer is a spatial enhancement layer,
95  TComPicYuv*           m_pcFullPelBaseRec;    // upsampled base layer recontruction for difference domain inter prediction
96#endif
[51]97
98public:
99  TComPic();
100  virtual ~TComPic();
101 
[54]102#if SVC_UPSAMPLING
[51]103  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, 
[54]104                        Int *numReorderPics, TComSPS* pcSps = NULL, Bool bIsVirtual = false );
105#if REF_IDX_FRAMEWORK
106  Void          createWithOutYuv( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, TComSPS* pcSps = NULL, Bool bIsVirtual = false ); 
107  Void          setPicYuvRec(TComPicYuv *pPicYuv) { m_apcPicYuv[1]=pPicYuv; }
108#endif
109#else
110  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, 
111                        Int *numReorderPics, Bool bIsVirtual = false );                       
112#endif
[51]113  virtual Void  destroy();
114 
115  UInt          getTLayer()                { return m_uiTLayer;   }
116  Void          setTLayer( UInt uiTLayer ) { m_uiTLayer = uiTLayer; }
[54]117#if SVC_EXTENSION
118  Void          setLayerId (UInt layerId) { m_layerId = layerId; }
119  UInt          getLayerId ()               { return m_layerId; }
120  Bool          isSpatialEnhLayer()             { return m_bSpatialEnhLayer; }
121  Void          setSpatialEnhLayerFlag (Bool b) { m_bSpatialEnhLayer = b; }
122  Void          setFullPelBaseRec   ( TComPicYuv* p) { m_pcFullPelBaseRec = p; }
123  TComPicYuv*   getFullPelBaseRec   ()  { return  m_pcFullPelBaseRec;  }
124#endif
[74]125#if REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM
[95]126  Bool          isILR( UInt refLayer = 0 )   {return (getIsLongTerm() && m_layerId == refLayer);}
[54]127#endif
[51]128
[54]129#if REF_IDX_MFM
130  Void          copyUpsampledMvField  (  TComPic* pcPicBase );
131#if !REUSE_BLKMAPPING
[71]132  Void          deriveUnitIdxBase     (  UInt upsamplePelX, UInt upsamplePelY, UInt ratio, UInt& baseCUAddr, UInt& baseAbsPartIdx );
[54]133#endif
[86]134#if RAP_MFM_INIT
135  Void          initUpsampledMvField  ();
[54]136#endif
[86]137#endif
[54]138
[51]139  Bool          getUsedByCurr()             { return m_bUsedByCurr; }
140  Void          setUsedByCurr( Bool bUsed ) { m_bUsedByCurr = bUsed; }
141  Bool          getIsLongTerm()             { return m_bIsLongTerm; }
142  Void          setIsLongTerm( Bool lt ) { m_bIsLongTerm = lt; }
143  Void          setCheckLTMSBPresent     (Bool b ) {m_bCheckLTMSB=b;}
144  Bool          getCheckLTMSBPresent     () { return m_bCheckLTMSB;}
145
146  TComPicSym*   getPicSym()           { return  m_apcPicSym;    }
147  TComSlice*    getSlice(Int i)       { return  m_apcPicSym->getSlice(i);  }
148  Int           getPOC()              { return  m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getPOC();  }
149  TComDataCU*&  getCU( UInt uiCUAddr )  { return  m_apcPicSym->getCU( uiCUAddr ); }
150 
151  TComPicYuv*   getPicYuvOrg()        { return  m_apcPicYuv[0]; }
152  TComPicYuv*   getPicYuvRec()        { return  m_apcPicYuv[1]; }
153 
154  TComPicYuv*   getPicYuvPred()       { return  m_pcPicYuvPred; }
155  TComPicYuv*   getPicYuvResi()       { return  m_pcPicYuvResi; }
156  Void          setPicYuvPred( TComPicYuv* pcPicYuv )       { m_pcPicYuvPred = pcPicYuv; }
157  Void          setPicYuvResi( TComPicYuv* pcPicYuv )       { m_pcPicYuvResi = pcPicYuv; }
158 
159  UInt          getNumCUsInFrame()      { return m_apcPicSym->getNumberOfCUsInFrame(); }
160  UInt          getNumPartInWidth()     { return m_apcPicSym->getNumPartInWidth();     }
161  UInt          getNumPartInHeight()    { return m_apcPicSym->getNumPartInHeight();    }
162  UInt          getNumPartInCU()        { return m_apcPicSym->getNumPartition();       }
163  UInt          getFrameWidthInCU()     { return m_apcPicSym->getFrameWidthInCU();     }
164  UInt          getFrameHeightInCU()    { return m_apcPicSym->getFrameHeightInCU();    }
165  UInt          getMinCUWidth()         { return m_apcPicSym->getMinCUWidth();         }
166  UInt          getMinCUHeight()        { return m_apcPicSym->getMinCUHeight();        }
167 
168  UInt          getParPelX(UChar uhPartIdx) { return getParPelX(uhPartIdx); }
169  UInt          getParPelY(UChar uhPartIdx) { return getParPelX(uhPartIdx); }
170 
171  Int           getStride()           { return m_apcPicYuv[1]->getStride(); }
172  Int           getCStride()          { return m_apcPicYuv[1]->getCStride(); }
173 
174  Void          setReconMark (Bool b) { m_bReconstructed = b;     }
175  Bool          getReconMark ()       { return m_bReconstructed;  }
176  Void          setOutputMark (Bool b) { m_bNeededForOutput = b;     }
177  Bool          getOutputMark ()       { return m_bNeededForOutput;  }
178 
179  Void          setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i;    }
180  Int           getNumReorderPics(UInt tlayer)        { return m_numReorderPics[tlayer]; }
181
182  Void          compressMotion(); 
183  UInt          getCurrSliceIdx()            { return m_uiCurrSliceIdx;                }
184  Void          setCurrSliceIdx(UInt i)      { m_uiCurrSliceIdx = i;                   }
185  UInt          getNumAllocatedSlice()       {return m_apcPicSym->getNumAllocatedSlice();}
186  Void          allocateNewSlice()           {m_apcPicSym->allocateNewSlice();         }
187  Void          clearSliceBuffer()           {m_apcPicSym->clearSliceBuffer();         }
188
189  Window&       getConformanceWindow()  { return m_conformanceWindow; }
190  Window&       getDefDisplayWindow()   { return m_defaultDisplayWindow; }
191
192  Void          createNonDBFilterInfo   (std::vector<Int> sliceStartAddress, Int sliceGranularityDepth
193                                        ,std::vector<Bool>* LFCrossSliceBoundary
194                                        ,Int  numTiles = 1
195                                        ,Bool bNDBFilterCrossTileBoundary = true);
196  Void          createNonDBFilterInfoLCU(Int tileID, Int sliceID, TComDataCU* pcCU, UInt startSU, UInt endSU, Int sliceGranularyDepth, UInt picWidth, UInt picHeight);
197  Void          destroyNonDBFilterInfo();
198
199  Bool          getValidSlice                                  (Int sliceID)  {return m_pbValidSlice[sliceID];}
200  Bool          getIndependentSliceBoundaryForNDBFilter        ()             {return m_bIndependentSliceBoundaryForNDBFilter;}
201  Bool          getIndependentTileBoundaryForNDBFilter         ()             {return m_bIndependentTileBoundaryForNDBFilter; }
202  TComPicYuv*   getYuvPicBufferForIndependentBoundaryProcessing()             {return m_pNDBFilterYuvTmp;}
203  std::vector<TComDataCU*>& getOneSliceCUDataForNDBFilter      (Int sliceID) { return m_vSliceCUDataLink[sliceID];}
204
205  /** transfer ownership of seis to this picture */
206  void setSEIs(SEIMessages& seis) { m_SEIs = seis; }
207
208  /**
209   * return the current list of SEI messages associated with this picture.
210   * Pointer is valid until this->destroy() is called */
211  SEIMessages& getSEIs() { return m_SEIs; }
212
213  /**
214   * return the current list of SEI messages associated with this picture.
215   * Pointer is valid until this->destroy() is called */
216  const SEIMessages& getSEIs() const { return m_SEIs; }
217
[54]218#if REF_IDX_FRAMEWORK
219  Void  copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut); 
220#endif
221#if AVC_SYNTAX
222  Void readBLSyntax( fstream* filestream, UInt numBytes );
223#endif
224#if SYNTAX_OUTPUT
225  Void wrireBLSyntax( fstream* filestream, UInt numBytes );
226#endif
227
[51]228};// END CLASS DEFINITION TComPic
229
230//! \}
231
232#endif // __TCOMPIC__
Note: See TracBrowser for help on using the repository browser.