source: SHVCSoftware/branches/0.1.1-bugfix/source/Lib/TLibCommon/TComPic.h @ 1263

Last change on this file since 1263 was 6, checked in by seregin, 12 years ago

Correct IntraBL cost and fix for couple of compiler warnings.

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