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

Last change on this file since 1263 was 1259, checked in by seregin, 9 years ago

port rev 4256

  • Property svn:eol-style set to native
File size: 11.0 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
[1029]4 * granted under this license.
[313]5 *
[1259]6 * Copyright (c) 2010-2015, ITU/ISO/IEC
[313]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"
[820]46#if AVC_BASE
[313]47#include <fstream>
48#endif
49
50//! \ingroup TLibCommon
51//! \{
52
53// ====================================================================================================================
54// Class definition
55// ====================================================================================================================
56
57/// picture class (symbol + YUV buffers)
[1029]58
[313]59class TComPic
60{
[1029]61public:
62  typedef enum { PIC_YUV_ORG=0, PIC_YUV_REC=1, PIC_YUV_TRUE_ORG=2, NUM_PIC_YUV=3 } PIC_YUV_T;
63     // TRUE_ORG is the input file without any pre-encoder colour space conversion (but with possible bit depth increment)
64  TComPicYuv*   getPicYuvTrueOrg()        { return  m_apcPicYuv[PIC_YUV_TRUE_ORG]; }
65
[313]66private:
67  UInt                  m_uiTLayer;               //  Temporal layer
68  Bool                  m_bUsedByCurr;            //  Used by current picture
69  Bool                  m_bIsLongTerm;            //  IS long term picture
[1235]70  TComPicSym            m_picSym;                 //  Symbol
[1029]71  TComPicYuv*           m_apcPicYuv[NUM_PIC_YUV];
72
[313]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  Bool                  m_bCheckLTMSB;
[1029]79
[442]80  Bool                  m_isTop;
81  Bool                  m_isField;
[1029]82
[313]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#if SVC_EXTENSION
[595]87  UInt                  m_layerId;              //  Layer ID
[313]88  Bool                  m_bSpatialEnhLayer[MAX_LAYERS];       // whether current layer is a spatial enhancement layer,
89  TComPicYuv*           m_pcFullPelBaseRec[MAX_LAYERS];    // upsampled base layer recontruction for difference domain inter prediction
[901]90  Bool                  m_equalPictureSizeAndOffsetFlag[MAX_LAYERS]; 
[1212]91#if CGS_3D_ASYMLUT
[713]92  Int                   m_nFrameBit;
93#endif
[815]94  Bool                  m_currAuFlag;
95#endif
[313]96public:
97  TComPic();
98  virtual ~TComPic();
[1235]99
[815]100#if SVC_EXTENSION
[1235]101  Void          create( const TComVPS& vps, const TComSPS &sps, const TComPPS &pps, const UInt uiMaxWidth, const UInt uiMaxHeight, const UInt uiMaxDepth, const Bool bIsVirtual /*= false*/, const UInt layerId );
[494]102#else
[1235]103  Void          create( const TComSPS &sps, const TComPPS &pps, const UInt uiMaxWidth, const UInt uiMaxHeight, const UInt uiMaxDepth, const Bool bIsVirtual /*= false*/ );
104#endif
[815]105
[313]106  virtual Void  destroy();
[1029]107
108  UInt          getTLayer() const               { return m_uiTLayer;   }
[313]109  Void          setTLayer( UInt uiTLayer ) { m_uiTLayer = uiTLayer; }
[713]110
[1029]111  Bool          getUsedByCurr() const            { return m_bUsedByCurr; }
[313]112  Void          setUsedByCurr( Bool bUsed ) { m_bUsedByCurr = bUsed; }
[1029]113  Bool          getIsLongTerm() const            { return m_bIsLongTerm; }
[313]114  Void          setIsLongTerm( Bool lt ) { m_bIsLongTerm = lt; }
115  Void          setCheckLTMSBPresent     (Bool b ) {m_bCheckLTMSB=b;}
116  Bool          getCheckLTMSBPresent     () { return m_bCheckLTMSB;}
117
[1235]118  TComPicSym*   getPicSym()           { return  &m_picSym;    }
119  TComSlice*    getSlice(Int i)       { return  m_picSym.getSlice(i);  }
120  Int           getPOC() const        { return  m_picSym.getSlice(m_uiCurrSliceIdx)->getPOC();  }
121  TComDataCU*   getCtu( UInt ctuRsAddr )           { return  m_picSym.getCtu( ctuRsAddr ); }
122  const TComDataCU* getCtu( UInt ctuRsAddr ) const { return  m_picSym.getCtu( ctuRsAddr ); }
[1029]123
[1235]124
[1029]125  TComPicYuv*   getPicYuvOrg()        { return  m_apcPicYuv[PIC_YUV_ORG]; }
126  TComPicYuv*   getPicYuvRec()        { return  m_apcPicYuv[PIC_YUV_REC]; }
127
[313]128  TComPicYuv*   getPicYuvPred()       { return  m_pcPicYuvPred; }
129  TComPicYuv*   getPicYuvResi()       { return  m_pcPicYuvResi; }
130  Void          setPicYuvPred( TComPicYuv* pcPicYuv )       { m_pcPicYuvPred = pcPicYuv; }
131  Void          setPicYuvResi( TComPicYuv* pcPicYuv )       { m_pcPicYuvResi = pcPicYuv; }
[1029]132
[1235]133  UInt          getNumberOfCtusInFrame() const     { return m_picSym.getNumberOfCtusInFrame(); }
134  UInt          getNumPartInCtuWidth() const       { return m_picSym.getNumPartInCtuWidth();   }
135  UInt          getNumPartInCtuHeight() const      { return m_picSym.getNumPartInCtuHeight();  }
136  UInt          getNumPartitionsInCtu() const      { return m_picSym.getNumPartitionsInCtu();  }
137  UInt          getFrameWidthInCtus() const        { return m_picSym.getFrameWidthInCtus();    }
138  UInt          getFrameHeightInCtus() const       { return m_picSym.getFrameHeightInCtus();   }
139  UInt          getMinCUWidth() const              { return m_picSym.getMinCUWidth();          }
140  UInt          getMinCUHeight() const             { return m_picSym.getMinCUHeight();         }
[1029]141
142  Int           getStride(const ComponentID id) const          { return m_apcPicYuv[PIC_YUV_REC]->getStride(id); }
143  Int           getComponentScaleX(const ComponentID id) const    { return m_apcPicYuv[PIC_YUV_REC]->getComponentScaleX(id); }
144  Int           getComponentScaleY(const ComponentID id) const    { return m_apcPicYuv[PIC_YUV_REC]->getComponentScaleY(id); }
145  ChromaFormat  getChromaFormat() const                           { return m_apcPicYuv[PIC_YUV_REC]->getChromaFormat(); }
146  Int           getNumberValidComponents() const                  { return m_apcPicYuv[PIC_YUV_REC]->getNumberValidComponents(); }
147
[313]148  Void          setReconMark (Bool b) { m_bReconstructed = b;     }
[1029]149  Bool          getReconMark () const      { return m_bReconstructed;  }
[313]150  Void          setOutputMark (Bool b) { m_bNeededForOutput = b;     }
[1029]151  Bool          getOutputMark () const      { return m_bNeededForOutput;  }
152
153  Void          compressMotion();
154  UInt          getCurrSliceIdx() const           { return m_uiCurrSliceIdx;                }
[313]155  Void          setCurrSliceIdx(UInt i)      { m_uiCurrSliceIdx = i;                   }
[1235]156  UInt          getNumAllocatedSlice() const      {return m_picSym.getNumAllocatedSlice();}
157  Void          allocateNewSlice()           {m_picSym.allocateNewSlice();         }
158  Void          clearSliceBuffer()           {m_picSym.clearSliceBuffer();         }
[313]159
[1235]160  const Window& getConformanceWindow() const { return m_picSym.getSPS().getConformanceWindow(); }
161  Window        getDefDisplayWindow() const  { return m_picSym.getSPS().getVuiParametersPresentFlag() ? m_picSym.getSPS().getVuiParameters()->getDefaultDisplayWindow() : Window(); }
[313]162
[540]163  Bool          getSAOMergeAvailability(Int currAddr, Int mergeAddr);
[313]164
[1029]165  UInt          getSubstreamForCtuAddr(const UInt ctuAddr, const Bool bAddressInRaster, TComSlice *pcSlice);
166
[442]167  /* field coding parameters*/
168
[1029]169   Void              setTopField(Bool b)                  {m_isTop = b;}
170   Bool              isTopField()                         {return m_isTop;}
171   Void              setField(Bool b)                     {m_isField = b;}
172   Bool              isField()                            {return m_isField;}
[442]173
[313]174  /** transfer ownership of seis to this picture */
[1029]175  Void setSEIs(SEIMessages& seis) { m_SEIs = seis; }
[313]176
177  /**
178   * return the current list of SEI messages associated with this picture.
179   * Pointer is valid until this->destroy() is called */
180  SEIMessages& getSEIs() { return m_SEIs; }
181
182  /**
183   * return the current list of SEI messages associated with this picture.
184   * Pointer is valid until this->destroy() is called */
185  const SEIMessages& getSEIs() const { return m_SEIs; }
186
[442]187#if SVC_EXTENSION
[1043]188  Void          setLayerId (UInt layerId)   { m_layerId = layerId; }
[595]189  UInt          getLayerId ()               { return m_layerId; }
[1057]190  UInt          getLayerIdx()               { return getSlice(0)->getVPS()->getLayerIdxInVps(m_layerId); }
[595]191  Bool          isSpatialEnhLayer(UInt refLayerIdc)             { return m_bSpatialEnhLayer[refLayerIdc]; }
192  Void          setSpatialEnhLayerFlag (UInt refLayerIdc, Bool b) { m_bSpatialEnhLayer[refLayerIdc] = b; }
193  Void          setFullPelBaseRec   (UInt refLayerIdc, TComPicYuv* p) { m_pcFullPelBaseRec[refLayerIdc] = p; }
194  TComPicYuv*   getFullPelBaseRec   (UInt refLayerIdc)  { return  m_pcFullPelBaseRec[refLayerIdc];  }
[815]195  Bool          isILR( UInt currLayerId )   { return ( m_bIsLongTerm && m_layerId < currLayerId ); }
[901]196  Bool          equalPictureSizeAndOffsetFlag(UInt refLayerIdc)             { return m_equalPictureSizeAndOffsetFlag[refLayerIdc]; }
197  Void          setEqualPictureSizeAndOffsetFlag(UInt refLayerIdc, Bool b)  { m_equalPictureSizeAndOffsetFlag[refLayerIdc] = b;    }
[595]198  Void          copyUpsampledMvField  ( UInt refLayerIdc, TComPic* pcPicBase );
199  Void          initUpsampledMvField  ();
200  Bool          checkSameRefInfo();
[1029]201  Void          copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut); 
[1212]202#if CGS_3D_ASYMLUT
[1029]203  Void          setFrameBit( Int n )  { m_nFrameBit = n;    }
204  Int           getFrameBit()         { return m_nFrameBit; }
[713]205#endif
[1029]206  Bool          isCurrAu() { return m_currAuFlag; }
207  Void          setCurrAuFlag(Bool x) {m_currAuFlag = x; }
208#endif //SVC_EXTENSION
[313]209};// END CLASS DEFINITION TComPic
210
211//! \}
212
213#endif // __TCOMPIC__
Note: See TracBrowser for help on using the repository browser.