source: SHVCSoftware/branches/SHM-4.1-dev/source/Lib/TLibCommon/TComPic.h @ 1505

Last change on this file since 1505 was 532, checked in by seregin, 11 years ago

update to HM-12.1 base

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