source: SHVCSoftware/branches/SHM-4.0-dev/source/Lib/TLibCommon/TComPic.h @ 854

Last change on this file since 854 was 475, checked in by nokia, 11 years ago

Integrate auxiliary picture layers (JCTVC-O0041)

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