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

Last change on this file since 1140 was 1057, checked in by seregin, 10 years ago

revert back using layerIdx for m_ppcTEncTop, fix RefLayerId settings and related

  • Property svn:eol-style set to native
File size: 11.6 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 *
[595]6 * Copyright (c) 2010-2014, 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
70  TComPicSym*           m_apcPicSym;              //  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
[313]80  Int                   m_numReorderPics[MAX_TLAYER];
81  Window                m_conformanceWindow;
82  Window                m_defaultDisplayWindow;
83
[442]84  Bool                  m_isTop;
85  Bool                  m_isField;
[1029]86
[313]87  std::vector<std::vector<TComDataCU*> > m_vSliceCUDataLink;
88
89  SEIMessages  m_SEIs; ///< Any SEI messages that have been received.  If !NULL we own the object.
90#if SVC_EXTENSION
[595]91  UInt                  m_layerId;              //  Layer ID
[313]92  Bool                  m_bSpatialEnhLayer[MAX_LAYERS];       // whether current layer is a spatial enhancement layer,
93  TComPicYuv*           m_pcFullPelBaseRec[MAX_LAYERS];    // upsampled base layer recontruction for difference domain inter prediction
[901]94#if REF_IDX_MFM
95  Bool                  m_equalPictureSizeAndOffsetFlag[MAX_LAYERS]; 
[313]96#endif
[901]97#endif
[713]98#if Q0048_CGS_3D_ASYMLUT
99  Int                   m_nFrameBit;
100#endif
[815]101#if POC_RESET_IDC_DECODER
102  Bool                  m_currAuFlag;
103#endif
[313]104public:
105  TComPic();
106  virtual ~TComPic();
107 
[815]108#if SVC_EXTENSION
[494]109  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormatIDC, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, 
110                        Int *numReorderPics, TComSPS* pcSps = NULL, Bool bIsVirtual = false );
111#else
[1029]112  Void          create( Int iWidth, Int iHeight, ChromaFormat chromaFormatIDC, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
113                        Int *numReorderPics,Bool bIsVirtual /*= false*/ );
[815]114#endif //SVC_EXTENSION
115
[313]116  virtual Void  destroy();
[1029]117
118  UInt          getTLayer() const               { return m_uiTLayer;   }
[313]119  Void          setTLayer( UInt uiTLayer ) { m_uiTLayer = uiTLayer; }
[713]120
[1029]121  Bool          getUsedByCurr() const            { return m_bUsedByCurr; }
[313]122  Void          setUsedByCurr( Bool bUsed ) { m_bUsedByCurr = bUsed; }
[1029]123  Bool          getIsLongTerm() const            { return m_bIsLongTerm; }
[313]124  Void          setIsLongTerm( Bool lt ) { m_bIsLongTerm = lt; }
125  Void          setCheckLTMSBPresent     (Bool b ) {m_bCheckLTMSB=b;}
126  Bool          getCheckLTMSBPresent     () { return m_bCheckLTMSB;}
127
128  TComPicSym*   getPicSym()           { return  m_apcPicSym;    }
129  TComSlice*    getSlice(Int i)       { return  m_apcPicSym->getSlice(i);  }
[1029]130  Int           getPOC() const        { return  m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getPOC();  }
131  TComDataCU*   getCtu( UInt ctuRsAddr )           { return  m_apcPicSym->getCtu( ctuRsAddr ); }
132  const TComDataCU* getCtu( UInt ctuRsAddr ) const { return  m_apcPicSym->getCtu( ctuRsAddr ); }
133
134  TComPicYuv*   getPicYuvOrg()        { return  m_apcPicYuv[PIC_YUV_ORG]; }
135  TComPicYuv*   getPicYuvRec()        { return  m_apcPicYuv[PIC_YUV_REC]; }
136
[313]137  TComPicYuv*   getPicYuvPred()       { return  m_pcPicYuvPred; }
138  TComPicYuv*   getPicYuvResi()       { return  m_pcPicYuvResi; }
139  Void          setPicYuvPred( TComPicYuv* pcPicYuv )       { m_pcPicYuvPred = pcPicYuv; }
140  Void          setPicYuvResi( TComPicYuv* pcPicYuv )       { m_pcPicYuvResi = pcPicYuv; }
[1029]141
142  UInt          getNumberOfCtusInFrame() const     { return m_apcPicSym->getNumberOfCtusInFrame(); }
143  UInt          getNumPartInCtuWidth() const       { return m_apcPicSym->getNumPartInCtuWidth();   }
144  UInt          getNumPartInCtuHeight() const      { return m_apcPicSym->getNumPartInCtuHeight();  }
145  UInt          getNumPartitionsInCtu() const      { return m_apcPicSym->getNumPartitionsInCtu();  }
146  UInt          getFrameWidthInCtus() const        { return m_apcPicSym->getFrameWidthInCtus();    }
147  UInt          getFrameHeightInCtus() const       { return m_apcPicSym->getFrameHeightInCtus();   }
148  UInt          getMinCUWidth() const              { return m_apcPicSym->getMinCUWidth();          }
149  UInt          getMinCUHeight() const             { return m_apcPicSym->getMinCUHeight();         }
150
151  Int           getStride(const ComponentID id) const          { return m_apcPicYuv[PIC_YUV_REC]->getStride(id); }
152  Int           getComponentScaleX(const ComponentID id) const    { return m_apcPicYuv[PIC_YUV_REC]->getComponentScaleX(id); }
153  Int           getComponentScaleY(const ComponentID id) const    { return m_apcPicYuv[PIC_YUV_REC]->getComponentScaleY(id); }
154  ChromaFormat  getChromaFormat() const                           { return m_apcPicYuv[PIC_YUV_REC]->getChromaFormat(); }
155  Int           getNumberValidComponents() const                  { return m_apcPicYuv[PIC_YUV_REC]->getNumberValidComponents(); }
156
[313]157  Void          setReconMark (Bool b) { m_bReconstructed = b;     }
[1029]158  Bool          getReconMark () const      { return m_bReconstructed;  }
[313]159  Void          setOutputMark (Bool b) { m_bNeededForOutput = b;     }
[1029]160  Bool          getOutputMark () const      { return m_bNeededForOutput;  }
161
[313]162  Void          setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i;    }
163  Int           getNumReorderPics(UInt tlayer)        { return m_numReorderPics[tlayer]; }
164
[1029]165  Void          compressMotion();
166  UInt          getCurrSliceIdx() const           { return m_uiCurrSliceIdx;                }
[313]167  Void          setCurrSliceIdx(UInt i)      { m_uiCurrSliceIdx = i;                   }
[1029]168  UInt          getNumAllocatedSlice() const      {return m_apcPicSym->getNumAllocatedSlice();}
[313]169  Void          allocateNewSlice()           {m_apcPicSym->allocateNewSlice();         }
170  Void          clearSliceBuffer()           {m_apcPicSym->clearSliceBuffer();         }
171
172  Window&       getConformanceWindow()  { return m_conformanceWindow; }
173  Window&       getDefDisplayWindow()   { return m_defaultDisplayWindow; }
174
[540]175  Bool          getSAOMergeAvailability(Int currAddr, Int mergeAddr);
[313]176
[1029]177  UInt          getSubstreamForCtuAddr(const UInt ctuAddr, const Bool bAddressInRaster, TComSlice *pcSlice);
178
[442]179  /* field coding parameters*/
180
[1029]181   Void              setTopField(Bool b)                  {m_isTop = b;}
182   Bool              isTopField()                         {return m_isTop;}
183   Void              setField(Bool b)                     {m_isField = b;}
184   Bool              isField()                            {return m_isField;}
[442]185
[313]186  /** transfer ownership of seis to this picture */
[1029]187  Void setSEIs(SEIMessages& seis) { m_SEIs = seis; }
[313]188
189  /**
190   * return the current list of SEI messages associated with this picture.
191   * Pointer is valid until this->destroy() is called */
192  SEIMessages& getSEIs() { return m_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  const SEIMessages& getSEIs() const { return m_SEIs; }
198
[442]199#if SVC_EXTENSION
[1043]200  Void          setLayerId (UInt layerId)   { m_layerId = layerId; }
[595]201  UInt          getLayerId ()               { return m_layerId; }
[1057]202  UInt          getLayerIdx()               { return getSlice(0)->getVPS()->getLayerIdxInVps(m_layerId); }
[595]203  Bool          isSpatialEnhLayer(UInt refLayerIdc)             { return m_bSpatialEnhLayer[refLayerIdc]; }
204  Void          setSpatialEnhLayerFlag (UInt refLayerIdc, Bool b) { m_bSpatialEnhLayer[refLayerIdc] = b; }
205  Void          setFullPelBaseRec   (UInt refLayerIdc, TComPicYuv* p) { m_pcFullPelBaseRec[refLayerIdc] = p; }
206  TComPicYuv*   getFullPelBaseRec   (UInt refLayerIdc)  { return  m_pcFullPelBaseRec[refLayerIdc];  }
207#if REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM
[815]208  Bool          isILR( UInt currLayerId )   { return ( m_bIsLongTerm && m_layerId < currLayerId ); }
[595]209#endif
210#if REF_IDX_MFM
[901]211  Bool          equalPictureSizeAndOffsetFlag(UInt refLayerIdc)             { return m_equalPictureSizeAndOffsetFlag[refLayerIdc]; }
212  Void          setEqualPictureSizeAndOffsetFlag(UInt refLayerIdc, Bool b)  { m_equalPictureSizeAndOffsetFlag[refLayerIdc] = b;    }
[595]213  Void          copyUpsampledMvField  ( UInt refLayerIdc, TComPic* pcPicBase );
214  Void          initUpsampledMvField  ();
215#endif
216#if MFM_ENCCONSTRAINT
217  Bool          checkSameRefInfo();
218#endif
[1029]219  Void          copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut); 
[713]220#if Q0048_CGS_3D_ASYMLUT
[1029]221  Void          setFrameBit( Int n )  { m_nFrameBit = n;    }
222  Int           getFrameBit()         { return m_nFrameBit; }
[713]223#endif
[815]224#if POC_RESET_IDC_DECODER
[1029]225  Bool          isCurrAu() { return m_currAuFlag; }
226  Void          setCurrAuFlag(Bool x) {m_currAuFlag = x; }
[815]227#endif
[1029]228#endif //SVC_EXTENSION
[313]229};// END CLASS DEFINITION TComPic
230
231//! \}
232
233#endif // __TCOMPIC__
Note: See TracBrowser for help on using the repository browser.