source: 3DVCSoftware/branches/HTM-6.2-dev3-RWTH-Fix/source/Lib/TLibEncoder/TEncGOP.h @ 713

Last change on this file since 713 was 296, checked in by tech, 12 years ago

Reintegrated branch 5.1-dev0 rev. 295.

  • Property svn:eol-style set to native
File size: 6.9 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-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     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 "TLibCommon/TComDepthMapGenerator.h"
51#include "TLibCommon/TComResidualGenerator.h"
52#include "TEncAdaptiveLoopFilter.h"
53#include "TEncSampleAdaptiveOffset.h"
54#include "TEncSlice.h"
55#include "TEncEntropy.h"
56#include "TEncCavlc.h"
57#include "TEncSbac.h"
58
59#include "TEncAnalyze.h"
60
61#include <vector>
62
63//! \ingroup TLibEncoder
64//! \{
65
66class TEncTop;
67
68// ====================================================================================================================
69// Class definition
70// ====================================================================================================================
71
72/// GOP encoder class
73class TEncGOP
74{
75private:
76  //  Data
77  Bool                    m_bLongtermTestPictureHasBeenCoded;
78  Bool                    m_bLongtermTestPictureHasBeenCoded2;
79  Int                     m_iLastIDR;
80  Int                     m_iGopSize;
81  Int                     m_iNumPicCoded;
82  Bool                    m_bFirst;
83 
84  //  Access channel
85  TEncTop*                m_pcEncTop;
86  TEncCfg*                m_pcCfg;
87  TEncSlice*              m_pcSliceEncoder;
88  TComList<TComPic*>*     m_pcListPic;
89 
90  TEncEntropy*            m_pcEntropyCoder;
91  TEncCavlc*              m_pcCavlcCoder;
92  TEncSbac*               m_pcSbacCoder;
93  TEncBinCABAC*           m_pcBinCABAC;
94  TComLoopFilter*         m_pcLoopFilter;
95 
96#if DEPTH_MAP_GENERATION
97  TComDepthMapGenerator*  m_pcDepthMapGenerator;
98#endif
99#if H3D_IVRP
100  TComResidualGenerator*  m_pcResidualGenerator;
101#endif
102  Int                     m_pocLastCoded;
103
104  // Adaptive Loop filter
105  TEncAdaptiveLoopFilter* m_pcAdaptiveLoopFilter;
106  //--Adaptive Loop filter
107  TEncSampleAdaptiveOffset*  m_pcSAO;
108  TComBitCounter*         m_pcBitCounter;
109  TComRdCost*             m_pcRdCost;                           ///< RD cost computation
110  // indicate sequence first
111  Bool                    m_bSeqFirst;
112 
113  // clean decoding refresh
114  Bool                    m_bRefreshPending;
115  Int                     m_pocCRA;
116  UInt*                   m_uiStoredStartCUAddrForEncodingSlice;
117  UInt*                   m_uiStoredStartCUAddrForEncodingEntropySlice;
118
119  std::vector<Int> m_vRVM_RP;
120
121public:
122  TEncGOP();
123  virtual ~TEncGOP();
124 
125  Void  create      ( Int iWidth, Int iHeight, UInt iMaxCUWidth, UInt iMaxCUHeight );
126  Void  destroy     ();
127 
128  Void  init        ( TEncTop* pcTEncTop );
129  Void  initGOP     ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, std::list<AccessUnit>& accessUnitsInGOP);
130  Void  compressPicInGOP ( Int iPOCLast, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRec, std::list<AccessUnit>& accessUnitsInGOP, Int iGOPid );
131  Void  xWriteTileLocationToSliceHeader (OutputNALUnit& rNalu, TComOutputBitstream*& rpcBitstreamRedirect, TComSlice*& rpcSlice);
132
133  Int   getPocLastCoded()       { return  m_pocLastCoded; }
134  Int   getGOPSize()          { return  m_iGopSize;  }
135 
136  TComList<TComPic*>*   getListPic()      { return m_pcListPic; }
137 
138  Void  preLoopFilterPicAll  ( TComPic* pcPic, UInt64& ruiDist, UInt64& ruiBits );
139  TEncTop* getEncTop() { return m_pcEncTop; }
140 
141  TEncSlice*  getSliceEncoder()   { return m_pcSliceEncoder; }
142  NalUnitType getNalUnitType( UInt uiPOCCurr );
143  NalUnitType getNalUnitTypeBaseViewMvc( UInt uiPOCCurr );
144  Void freeAPS     (TComAPS* pAPS, TComSPS* pSPS);
145  Void allocAPS    (TComAPS* pAPS, TComSPS* pSPS);
146protected:
147  Void encodeAPS   (TComAPS* pcAPS, TComOutputBitstream& APSbs, TComSlice* pcSlice);            //!< encode APS syntax elements
148  Void assignNewAPS(TComAPS& cAPS, Int apsID, std::vector<TComAPS>& vAPS, TComSlice* pcSlice);  //!< Assign APS object into APS container
149 
150
151protected:
152  Void  xInitGOP          ( Int iPOC, Int iNumPicRcvd, TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut );
153  Void  xGetBuffer        ( TComList<TComPic*>& rcListPic, TComList<TComPicYuv*>& rcListPicYuvRecOut, Int iNumPicRcvd, Int iTimeOffset, TComPic*& rpcPic, TComPicYuv*& rpcPicYuvRecOut, UInt uiPOCCurr );
154 
155  Void  xCalculateAddPSNR ( TComPic* pcPic, TComPicYuv* pcPicD, const AccessUnit&, Double dEncTime );
156 
157  UInt64 xFindDistortionFrame (TComPicYuv* pcPic0, TComPicYuv* pcPic1);
158
159  Double xCalculateRVM();
160
161  Void  xSetRefPicListModificationsMvc( TComSlice* pcSlice, UInt uiPOCCurr, UInt iGOPid );
162};// END CLASS DEFINITION TEncGOP
163
164// ====================================================================================================================
165// Enumeration
166// ====================================================================================================================
167enum PROCESSING_STATE
168{
169  EXECUTE_INLOOPFILTER,
170  ENCODE_APS,
171  ENCODE_SLICE
172};
173
174enum SCALING_LIST_PARAMETER
175{
176  SCALING_LIST_OFF,
177  SCALING_LIST_DEFAULT,
178  SCALING_LIST_FILE_READ
179};
180
181//! \}
182
183#endif // __TENCGOP__
184
Note: See TracBrowser for help on using the repository browser.