source: 3DVCSoftware/branches/HTM-9.0r1-F0122/source/Lib/TLibCommon/TComPic.h @ 747

Last change on this file since 747 was 747, checked in by qualcomm, 10 years ago

MV-HEVC+D support based on JCT3V-F0122

  • Property svn:eol-style set to native
File size: 13.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
39#ifndef __TCOMPIC__
40#define __TCOMPIC__
41
42// Include files
43#include "CommonDef.h"
44#include "TComPicSym.h"
45#include "TComPicYuv.h"
46#include "TComBitStream.h"
47#include "SEI.h"
48
49//! \ingroup TLibCommon
50//! \{
51
52// ====================================================================================================================
53// Class definition
54// ====================================================================================================================
55
56/// picture class (symbol + YUV buffers)
57class TComPic
58{
59private:
60  UInt                  m_uiTLayer;               //  Temporal layer
61  Bool                  m_bUsedByCurr;            //  Used by current picture
62  Bool                  m_bIsLongTerm;            //  IS long term picture
63  TComPicSym*           m_apcPicSym;              //  Symbol
64 
65  TComPicYuv*           m_apcPicYuv[2];           //  Texture,  0:org / 1:rec
66 
67  TComPicYuv*           m_pcPicYuvPred;           //  Prediction
68  TComPicYuv*           m_pcPicYuvResi;           //  Residual
69  Bool                  m_bReconstructed;
70  Bool                  m_bNeededForOutput;
71  UInt                  m_uiCurrSliceIdx;         // Index of current slice
72  Int*                  m_pSliceSUMap;
73  Bool*                 m_pbValidSlice;
74  Int                   m_sliceGranularityForNDBFilter;
75  Bool                  m_bIndependentSliceBoundaryForNDBFilter;
76  Bool                  m_bIndependentTileBoundaryForNDBFilter;
77  TComPicYuv*           m_pNDBFilterYuvTmp;    //!< temporary picture buffer when non-cross slice/tile boundary in-loop filtering is enabled
78  Bool                  m_bCheckLTMSB;
79 
80  Int                   m_numReorderPics[MAX_TLAYER];
81  Window                m_conformanceWindow;
82  Window                m_defaultDisplayWindow;
83
84  bool                  m_isTop;
85  bool                  m_isField;
86 
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 H_MV
92  Int                   m_layerId;
93  Int                   m_viewId;
94#if H_3D
95  Int                   m_viewIndex;
96  Bool                  m_isDepth;
97  Int**                 m_aaiCodedScale;
98  Int**                 m_aaiCodedOffset;
99#endif
100#endif
101#if H_3D_QTLPC
102  Bool                  m_bReduceBitsQTL;
103#endif
104#if H_3D_NBDV
105  UInt        m_uiRapRefIdx;
106  RefPicList  m_eRapRefList;
107  Int         m_iNumDdvCandPics;
108  Bool        m_abTIVRINCurrRL  [2][2][MAX_NUM_REF]; //whether an inter-view reference picture with the same view index of the inter-view reference picture of temporal reference picture of current picture exists in current reference picture lists
109  Int         m_aiTexToDepRef  [2][MAX_NUM_REF];
110#endif
111public:
112  TComPic();
113  virtual ~TComPic();
114 
115  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow, 
116                        Int *numReorderPics, Bool bIsVirtual = false );
117                       
118  virtual Void  destroy();
119 
120  UInt          getTLayer()                { return m_uiTLayer;   }
121  Void          setTLayer( UInt uiTLayer ) { m_uiTLayer = uiTLayer; }
122
123#if H_MV
124  Void          setLayerId            ( Int layerId )    { m_layerId      = layerId; }
125  Int           getLayerId            ()                 { return m_layerId;    }
126  Void          setViewId             ( Int viewId )     { m_viewId = viewId;   }
127  Int           getViewId             ()                 { return m_viewId;     }
128#if H_3D
129  Void          setViewIndex          ( Int viewIndex )  { m_viewIndex = viewIndex;   }
130  Int           getViewIndex          ()                 { return m_viewIndex;     }
131
132  Void          setIsDepth            ( Bool isDepth )   { m_isDepth = isDepth; }
133  Bool          getIsDepth            ()                 { return m_isDepth; }
134
135  Void          setScaleOffset( Int** pS, Int** pO )  { m_aaiCodedScale = pS; m_aaiCodedOffset = pO; }
136  Int**         getCodedScale ()                      { return m_aaiCodedScale;  }
137  Int**         getCodedOffset()                      { return m_aaiCodedOffset; }
138#endif
139#endif
140#if H_3D_QTLPC
141  Bool          getReduceBitsFlag ()             { return m_bReduceBitsQTL;     }
142  Void          setReduceBitsFlag ( Bool bFlag ) { m_bReduceBitsQTL = bFlag;    }
143#endif
144  Bool          getUsedByCurr()             { return m_bUsedByCurr; }
145  Void          setUsedByCurr( Bool bUsed ) { m_bUsedByCurr = bUsed; }
146  Bool          getIsLongTerm()             { return m_bIsLongTerm; }
147  Void          setIsLongTerm( Bool lt ) { m_bIsLongTerm = lt; }
148  Void          setCheckLTMSBPresent     (Bool b ) {m_bCheckLTMSB=b;}
149  Bool          getCheckLTMSBPresent     () { return m_bCheckLTMSB;}
150
151  TComPicSym*   getPicSym()           { return  m_apcPicSym;    }
152  TComSlice*    getSlice(Int i)       { return  m_apcPicSym->getSlice(i);  }
153  Int           getPOC()              { return  m_apcPicSym->getSlice(m_uiCurrSliceIdx)->getPOC();  }
154  TComDataCU*&  getCU( UInt uiCUAddr )  { return  m_apcPicSym->getCU( uiCUAddr ); }
155 
156  TComPicYuv*   getPicYuvOrg()        { return  m_apcPicYuv[0]; }
157  TComPicYuv*   getPicYuvRec()        { return  m_apcPicYuv[1]; }
158 
159  TComPicYuv*   getPicYuvPred()       { return  m_pcPicYuvPred; }
160  TComPicYuv*   getPicYuvResi()       { return  m_pcPicYuvResi; }
161  Void          setPicYuvPred( TComPicYuv* pcPicYuv )       { m_pcPicYuvPred = pcPicYuv; }
162  Void          setPicYuvResi( TComPicYuv* pcPicYuv )       { m_pcPicYuvResi = pcPicYuv; }
163 
164  UInt          getNumCUsInFrame()      { return m_apcPicSym->getNumberOfCUsInFrame(); }
165  UInt          getNumPartInWidth()     { return m_apcPicSym->getNumPartInWidth();     }
166  UInt          getNumPartInHeight()    { return m_apcPicSym->getNumPartInHeight();    }
167  UInt          getNumPartInCU()        { return m_apcPicSym->getNumPartition();       }
168  UInt          getFrameWidthInCU()     { return m_apcPicSym->getFrameWidthInCU();     }
169  UInt          getFrameHeightInCU()    { return m_apcPicSym->getFrameHeightInCU();    }
170  UInt          getMinCUWidth()         { return m_apcPicSym->getMinCUWidth();         }
171  UInt          getMinCUHeight()        { return m_apcPicSym->getMinCUHeight();        }
172 
173  UInt          getParPelX(UChar uhPartIdx) { return getParPelX(uhPartIdx); }
174  UInt          getParPelY(UChar uhPartIdx) { return getParPelX(uhPartIdx); }
175 
176  Int           getStride()           { return m_apcPicYuv[1]->getStride(); }
177  Int           getCStride()          { return m_apcPicYuv[1]->getCStride(); }
178 
179  Void          setReconMark (Bool b) { m_bReconstructed = b;     }
180  Bool          getReconMark ()       { return m_bReconstructed;  }
181  Void          setOutputMark (Bool b) { m_bNeededForOutput = b;     }
182  Bool          getOutputMark ()       { return m_bNeededForOutput;  }
183 
184  Void          setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i;    }
185  Int           getNumReorderPics(UInt tlayer)        { return m_numReorderPics[tlayer]; }
186#if H_3DV
187  Void          compressMotion(Int scale); 
188#else   
189  Void          compressMotion(); 
190#endif
191  UInt          getCurrSliceIdx()            { return m_uiCurrSliceIdx;                }
192  Void          setCurrSliceIdx(UInt i)      { m_uiCurrSliceIdx = i;                   }
193  UInt          getNumAllocatedSlice()       {return m_apcPicSym->getNumAllocatedSlice();}
194  Void          allocateNewSlice()           {m_apcPicSym->allocateNewSlice();         }
195  Void          clearSliceBuffer()           {m_apcPicSym->clearSliceBuffer();         }
196
197  Window&       getConformanceWindow()  { return m_conformanceWindow; }
198  Window&       getDefDisplayWindow()   { return m_defaultDisplayWindow; }
199
200  Void          createNonDBFilterInfo   (std::vector<Int> sliceStartAddress, Int sliceGranularityDepth
201                                        ,std::vector<Bool>* LFCrossSliceBoundary
202                                        ,Int  numTiles = 1
203                                        ,Bool bNDBFilterCrossTileBoundary = true);
204  Void          createNonDBFilterInfoLCU(Int tileID, Int sliceID, TComDataCU* pcCU, UInt startSU, UInt endSU, Int sliceGranularyDepth, UInt picWidth, UInt picHeight);
205  Void          destroyNonDBFilterInfo();
206
207  Bool          getValidSlice                                  (Int sliceID)  {return m_pbValidSlice[sliceID];}
208  Bool          getIndependentSliceBoundaryForNDBFilter        ()             {return m_bIndependentSliceBoundaryForNDBFilter;}
209  Bool          getIndependentTileBoundaryForNDBFilter         ()             {return m_bIndependentTileBoundaryForNDBFilter; }
210  TComPicYuv*   getYuvPicBufferForIndependentBoundaryProcessing()             {return m_pNDBFilterYuvTmp;}
211  std::vector<TComDataCU*>& getOneSliceCUDataForNDBFilter      (Int sliceID) { return m_vSliceCUDataLink[sliceID];}
212
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#if H_MV
222  Void          print( Bool legend );
223#endif
224#if H_3D_NBDV
225  Int           getNumDdvCandPics()                    {return m_iNumDdvCandPics;   }
226  Int           getDisCandRefPictures(Int iColPOC);
227  Void          setRapRefIdx(UInt uiRapRefIdx)         {m_uiRapRefIdx = uiRapRefIdx;}
228  Void          setRapRefList(RefPicList eRefPicList)  {m_eRapRefList = eRefPicList;}
229  Void          setNumDdvCandPics (Int i)              {m_iNumDdvCandPics = i;       }
230  UInt          getRapRefIdx()                         {return m_uiRapRefIdx;       }
231  RefPicList    getRapRefList()                        {return m_eRapRefList;       }
232  Void          checkTemporalIVRef();
233  Bool          isTempIVRefValid(Int currCandPic, Int iTempRefDir, Int iTempRefIdx);
234  Void          checkTextureRef(  );
235  Int           isTextRefValid(Int iTextRefDir, Int iTextRefIdx);
236#endif
237  /** transfer ownership of seis to this picture */
238  void setSEIs(SEIMessages& seis) { m_SEIs = seis; }
239
240  /**
241   * return the current list of SEI messages associated with this picture.
242   * Pointer is valid until this->destroy() is called */
243  SEIMessages& getSEIs() { return m_SEIs; }
244
245  /**
246   * return the current list of SEI messages associated with this picture.
247   * Pointer is valid until this->destroy() is called */
248  const SEIMessages& getSEIs() const { return m_SEIs; }
249
250};// END CLASS DEFINITION TComPic
251
252#if H_MV
253class TComPicLists
254{
255private: 
256  TComList<TComList<TComPic*>*> m_lists; 
257#if H_3D
258  TComVPS*                     m_vps; 
259#endif
260public: 
261  Void        push_back( TComList<TComPic*>* list ) { m_lists.push_back( list );   }
262  Int         size     ()                           { return (Int) m_lists.size(); } 
263#if H_3D_ARP
264  TComList<TComPic*>*  getPicList   ( Int layerIdInNuh );
265#endif
266  TComPic*    getPic   ( Int layerIdInNuh,              Int poc );   
267  TComPicYuv* getPicYuv( Int layerIdInNuh,              Int poc, Bool recon ); 
268#if H_3D
269  Void        setVPS   ( TComVPS* vps ) { m_vps = vps;  }; 
270  TComPic*    getPic   ( Int viewIndex, Bool depthFlag, Int poc );
271  TComPicYuv* getPicYuv( Int viewIndex, Bool depthFlag, Int poc, Bool recon );
272#endif 
273
274  Void print( ); 
275
276}; // END CLASS DEFINITION TComPicLists
277
278#endif
279//! \}
280
281#endif // __TCOMPIC__
Note: See TracBrowser for help on using the repository browser.