source: 3DVCSoftware/branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.h @ 476

Last change on this file since 476 was 476, checked in by mediatek-htm, 11 years ago

Integration of 3D-HEVC merge related coding tools:
Inter-view motion merge candidate
HHI_INTER_VIEW_MOTION_PRED
SAIT_IMPROV_MOTION_PRED_M24829, improved inter-view motion vector prediction
QC_MRG_CANS_B0048 , JCT3V-B0048, B0086, B0069
OL_DISMV_POS_B0069 , different pos for disparity MV candidate, B0069
MTK_INTERVIEW_MERGE_A0049 , second part
QC_AMVP_MRG_UNIFY_IVCAN_C0051
TEXTURE MERGING CANDIDATE , JCT3V-C0137

Notes: Two configurations are added:
PredDepthMapGen : 1
MultiviewMvPred : 7

From: yiwen.chen@… (MediaTek)

  • Property svn:eol-style set to native
File size: 9.0 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     TEncGOP.h
35    \brief    GOP encoder class (header)
36*/
37
38#ifndef __TENCGOP__
39#define __TENCGOP__
40
41#include <list>
42
43#include <stdlib.h>
44
45#include "TLibCommon/TComList.h"
46#include "TLibCommon/TComPic.h"
47#include "TLibCommon/TComBitCounter.h"
48#include "TLibCommon/TComLoopFilter.h"
49#include "TLibCommon/AccessUnit.h"
50#include "TEncSampleAdaptiveOffset.h"
51#include "TEncSlice.h"
52#include "TEncEntropy.h"
53#include "TEncCavlc.h"
54#include "TEncSbac.h"
55#include "SEIwrite.h"
56
57#include "TEncAnalyze.h"
58#include "TEncRateCtrl.h"
59#include <vector>
60
61#if H_3D_IV_MERGE
62#include "TLibCommon/TComDepthMapGenerator.h"
63#endif
64//! \ingroup TLibEncoder
65//! \{
66
67class TEncTop;
68
69// ====================================================================================================================
70// Class definition
71// ====================================================================================================================
72
73/// GOP encoder class
74class TEncGOP
75{
76private:
77  //  Data
78  Bool                    m_bLongtermTestPictureHasBeenCoded;
79  Bool                    m_bLongtermTestPictureHasBeenCoded2;
80  UInt            m_numLongTermRefPicSPS;
81  UInt            m_ltRefPicPocLsbSps[33];
82  Bool            m_ltRefPicUsedByCurrPicFlag[33];
83  Int                     m_iLastIDR;
84  Int                     m_iGopSize;
85  Int                     m_iNumPicCoded;
86  Bool                    m_bFirst;
87 
88  //  Access channel
89  TEncTop*                m_pcEncTop;
90  TEncCfg*                m_pcCfg;
91  TEncSlice*              m_pcSliceEncoder;
92  TComList<TComPic*>*     m_pcListPic;
93 
94  TEncEntropy*            m_pcEntropyCoder;
95  TEncCavlc*              m_pcCavlcCoder;
96  TEncSbac*               m_pcSbacCoder;
97  TEncBinCABAC*           m_pcBinCABAC;
98  TComLoopFilter*         m_pcLoopFilter;
99
100  SEIWriter               m_seiWriter;
101 
102#if H_MV
103  TComPicLists*           m_ivPicLists;
104  std::vector<TComPic*>   m_refPicSetInterLayer; 
105
106  Int                     m_pocLastCoded;
107  Int                     m_layerId; 
108  Int                     m_viewId;
109#if H_3D
110  Int                     m_viewIndex; 
111  Bool                    m_isDepth;
112
113#if H_3D_IV_MERGE
114  TComDepthMapGenerator*  m_pcDepthMapGenerator;
115#endif
116
117#endif
118#endif
119  //--Adaptive Loop filter
120  TEncSampleAdaptiveOffset*  m_pcSAO;
121  TComBitCounter*         m_pcBitCounter;
122  TEncRateCtrl*           m_pcRateCtrl;
123  // indicate sequence first
124  Bool                    m_bSeqFirst;
125 
126  // clean decoding refresh
127  Bool                    m_bRefreshPending;
128  Int                     m_pocCRA;
129  std::vector<Int>        m_storedStartCUAddrForEncodingSlice;
130  std::vector<Int>        m_storedStartCUAddrForEncodingSliceSegment;
131
132  std::vector<Int> m_vRVM_RP;
133  UInt                    m_lastBPSEI;
134  UInt                    m_totalCoded;
135  UInt                    m_cpbRemovalDelay;
136  UInt                    m_tl0Idx;
137  UInt                    m_rapIdx;
138#if L0045_NON_NESTED_SEI_RESTRICTIONS
139  Bool                    m_activeParameterSetSEIPresentInAU;
140  Bool                    m_bufferingPeriodSEIPresentInAU;
141  Bool                    m_pictureTimingSEIPresentInAU;
142#if K0180_SCALABLE_NESTING_SEI
143  Bool                    m_nestedBufferingPeriodSEIPresentInAU;
144  Bool                    m_nestedPictureTimingSEIPresentInAU;
145#endif
146#endif
147public:
148  TEncGOP();
149  virtual ~TEncGOP();
150 
151  Void  create      ();
152  Void  destroy     ();
153 
154  Void  init        ( TEncTop* pcTEncTop );
155#if H_MV
156  Void  initGOP     ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP);
157  Void  compressPicInGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid );
158#else
159  Void  compressGOP( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP );
160#endif
161  Void  xAttachSliceDataToNalUnit (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect);
162
163#if H_MV
164  Int       getPocLastCoded  ()                 { return m_pocLastCoded; } 
165  Int       getLayerId       ()                 { return m_layerId;    } 
166  Int       getViewId        ()                 { return m_viewId;    }
167#if H_3D
168  Int       getViewIndex     ()                 { return m_viewIndex;    }
169  Bool      getIsDepth       ()                 { return m_isDepth; }
170#endif
171#endif
172
173  Int   getGOPSize()          { return  m_iGopSize;  }
174 
175  TComList<TComPic*>*   getListPic()      { return m_pcListPic; }
176#if H_3D_IV_MERGE
177  TEncTop* getEncTop() { return m_pcEncTop; }
178#endif
179#if !H_MV
180  Void  printOutSummary      ( UInt uiNumAllPicCoded );
181#endif
182#if H_3D_VSO
183  Void  preLoopFilterPicAll  ( TComPic* pcPic, Dist64& ruiDist, UInt64& ruiBits );
184#else
185  Void  preLoopFilterPicAll  ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits );
186#endif
187 
188  TEncSlice*  getSliceEncoder()   { return m_pcSliceEncoder; }
189  NalUnitType getNalUnitType( Int pocCurr, Int lastIdr );
190  Void arrangeLongtermPicturesInRPS(TComSlice *, TComList<TComPic*>& );
191protected:
192  TEncRateCtrl* getRateCtrl()       { return m_pcRateCtrl;  }
193
194protected:
195  Void  xInitGOP          ( Int iPOC, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut );
196  Void  xGetBuffer        ( TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic*& rpcPic, TComPicYuv*& rpcPicYuvRecOut, Int pocCurr );
197 
198  Void  xCalculateAddPSNR ( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit&, Double dEncTime );
199#if H_3D_VSO
200  Dist64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1);
201#else 
202  UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1);
203#endif
204
205  Double xCalculateRVM();
206
207  SEIActiveParameterSets* xCreateSEIActiveParameterSets (TComSPS *sps);
208  SEIFramePacking*        xCreateSEIFramePacking();
209  SEIDisplayOrientation*  xCreateSEIDisplayOrientation();
210
211#if J0149_TONE_MAPPING_SEI
212  SEIToneMappingInfo*     xCreateSEIToneMappingInfo();
213#endif
214
215  Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps);
216#if L0045_NON_NESTED_SEI_RESTRICTIONS
217  Int xGetFirstSeiLocation (AccessUnit &accessUnit);
218  Void xResetNonNestedSEIPresentFlags()
219  {
220    m_activeParameterSetSEIPresentInAU = false;
221    m_bufferingPeriodSEIPresentInAU    = false;
222    m_pictureTimingSEIPresentInAU      = false;
223  }
224#if K0180_SCALABLE_NESTING_SEI
225  Void xResetNestedSEIPresentFlags()
226  {
227    m_nestedBufferingPeriodSEIPresentInAU    = false;
228    m_nestedPictureTimingSEIPresentInAU      = false;
229  }
230#endif
231#endif
232#if H_MV
233   Void  xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid );
234#endif
235#if L0386_DB_METRIC
236  Void dblMetric( TComPic* pcPic, UInt uiNumSlices );
237#endif
238};// END CLASS DEFINITION TEncGOP
239
240// ====================================================================================================================
241// Enumeration
242// ====================================================================================================================
243enum PROCESSING_STATE
244{
245  EXECUTE_INLOOPFILTER,
246  ENCODE_SLICE
247};
248
249enum SCALING_LIST_PARAMETER
250{
251  SCALING_LIST_OFF,
252  SCALING_LIST_DEFAULT,
253  SCALING_LIST_FILE_READ
254};
255
256//! \}
257
258#endif // __TENCGOP__
259
Note: See TracBrowser for help on using the repository browser.