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

Last change on this file since 1497 was 47, checked in by seregin, 12 years ago

REUSE_BLKMAPPING: using the base layer get co-located block function for motion mapping

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