Changeset 56 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncTop.h


Ignore:
Timestamp:
11 May 2012, 21:20:17 (12 years ago)
Author:
hschwarz
Message:

updated trunk (move to HM6.1)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibEncoder/TEncTop.h

    r5 r56  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license.
    5  *
    6  * Copyright (c) 2010-2011, ISO/IEC
     4 * granted under this license. 
     5 *
     6 * Copyright (c) 2010-2012, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    1515 *    this list of conditions and the following disclaimer in the documentation
    1616 *    and/or other materials provided with the distribution.
    17  *  * Neither the name of the ISO/IEC nor the names of its contributors may
     17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
    1818 *    be used to endorse or promote products derived from this software without
    1919 *    specific prior written permission.
     
    3232 */
    3333
    34 
    3534/** \file     TEncTop.h
    3635    \brief    encoder class (header)
     
    4140
    4241// Include files
    43 #include "../TLibCommon/TComList.h"
    44 #include "../TLibCommon/TComPrediction.h"
    45 #include "../TLibCommon/TComTrQuant.h"
    46 #include "../TLibCommon/TComBitStream.h"
    47 #include "../TLibCommon/TComDepthMapGenerator.h"
     42#include "TLibCommon/TComList.h"
     43#include "TLibCommon/TComPrediction.h"
     44#include "TLibCommon/TComTrQuant.h"
     45#include "TLibCommon/AccessUnit.h"
     46#include "TLibCommon/TComDepthMapGenerator.h"
    4847#include "../TLibCommon/TComResidualGenerator.h"
    4948
    50 #include "../TLibVideoIO/TVideoIOYuv.h"
    51 #include "../TLibVideoIO/TVideoIOBits.h"
     49#include "TLibVideoIO/TVideoIOYuv.h"
    5250
    5351#include "TEncCfg.h"
     
    5957#include "TEncSearch.h"
    6058#include "TEncAdaptiveLoopFilter.h"
    61 
    62 #include "TEncSeqStructure.h"
    63 #include <map>
    64 #include "TEncAnalyze.h"
    65 
     59#include "TEncSampleAdaptiveOffset.h"
     60#include "TEncPreanalyzer.h"
     61
     62//! \ingroup TLibEncoder
     63//! \{
    6664
    6765// ====================================================================================================================
     
    6967// ====================================================================================================================
    7068
    71 class TAppEncTop ;
     69class TAppEncTop;
    7270
    7371/// encoder class
     
    8078  UInt                    m_uiNumAllPicCoded;             ///< number of coded pictures
    8179  TComList<TComPic*>      m_cListPic;                     ///< dynamic list of pictures
    82 
    83   Bool                    m_bSeqFirst ;
    84   TEncSeqStructure::Iterator m_cSeqIter;
    85   std::map<Int, TComPic*> m_acInputPicMap;
    86   std::map<PicOrderCnt, TComPicYuv*> m_acOutputPicMap;
    87 
     80 
    8881  // encoder search
    8982  TEncSearch              m_cSearch;                      ///< encoder search class
    90   TEncEntropy*            m_pcEntropyCoder;                     ///< entropy encoder
    91   TEncCavlc*              m_pcCavlcCoder;                       ///< CAVLC encoder
     83  TEncEntropy*            m_pcEntropyCoder;                     ///< entropy encoder 
     84  TEncCavlc*              m_pcCavlcCoder;                       ///< CAVLC encoder 
    9285  // coding tool
    9386  TComTrQuant             m_cTrQuant;                     ///< transform & quantization class
    9487  TComLoopFilter          m_cLoopFilter;                  ///< deblocking filter class
    95 #if MTK_SAO
    96   TEncSampleAdaptiveOffset  m_cEncSAO;                    ///< sample adaptive offset class
    97 #endif
     88  TEncSampleAdaptiveOffset m_cEncSAO;                     ///< sample adaptive offset class
    9889  TEncAdaptiveLoopFilter  m_cAdaptiveLoopFilter;          ///< adaptive loop filter class
    9990  TEncEntropy             m_cEntropyCoder;                ///< entropy encoder
     
    10192  TEncSbac                m_cSbacCoder;                   ///< SBAC encoder
    10293  TEncBinCABAC            m_cBinCoderCABAC;               ///< bin coder CABAC
    103 
     94  TEncSbac*               m_pcSbacCoders;                 ///< SBAC encoders (to encode substreams )
     95  TEncBinCABAC*           m_pcBinCoderCABACs;             ///< bin coders CABAC (one per substream)
     96 
    10497  // processing unit
    105   TEncPic                 m_cPicEncoder;                  ///< Pic encoder
     98  TEncGOP                 m_cGOPEncoder;                  ///< GOP encoder
    10699  TEncSlice               m_cSliceEncoder;                ///< slice encoder
    107100  TEncCu                  m_cCuEncoder;                   ///< CU encoder
     101 
    108102#if DEPTH_MAP_GENERATION
    109103  TComDepthMapGenerator   m_cDepthMapGenerator;           ///< depth map generator
     
    112106  TComResidualGenerator   m_cResidualGenerator;           ///< generator for residual pictures
    113107#endif
    114 
    115108  // SPS
    116109  TComSPS                 m_cSPS;                         ///< SPS
    117110  TComPPS                 m_cPPS;                         ///< PPS
    118 
     111  std::vector<TComAPS>    m_vAPS;  //!< APS container
     112  TComRPSList             m_RPSList;                         ///< RPS
     113 
    119114  // RD cost computation
    120115  TComBitCounter          m_cBitCounter;                  ///< bit counter for RD optimization
     
    122117  TEncSbac***             m_pppcRDSbacCoder;              ///< temporal storage for RD computation
    123118  TEncSbac                m_cRDGoOnSbacCoder;             ///< going on SBAC model for RD stage
     119#if FAST_BIT_EST
     120  TEncBinCABACCounter***  m_pppcBinCoderCABAC;            ///< temporal CABAC state storage for RD computation
     121  TEncBinCABACCounter     m_cRDGoOnBinCoderCABAC;         ///< going on bin coder CABAC for RD stage
     122#else
    124123  TEncBinCABAC***         m_pppcBinCoderCABAC;            ///< temporal CABAC state storage for RD computation
    125124  TEncBinCABAC            m_cRDGoOnBinCoderCABAC;         ///< going on bin coder CABAC for RD stage
     125#endif
     126  Int                     m_iNumSubstreams;                ///< # of top-level elements allocated.
     127  TComBitCounter*         m_pcBitCounters;                 ///< bit counters for RD optimization per substream
     128  TComRdCost*             m_pcRdCosts;                     ///< RD cost computation class per substream
     129  TEncSbac****            m_ppppcRDSbacCoders;             ///< temporal storage for RD computation per substream
     130  TEncSbac*               m_pcRDGoOnSbacCoders;            ///< going on SBAC model for RD stage per substream
     131  TEncBinCABAC****        m_ppppcBinCodersCABAC;           ///< temporal CABAC state storage for RD computation per substream
     132  TEncBinCABAC*           m_pcRDGoOnBinCodersCABAC;        ///< going on bin coder CABAC for RD stage per substream
     133
     134  // quality control
     135  TEncPreanalyzer         m_cPreanalyzer;                 ///< image characteristics analyzer for TM5-step3-like adaptive QP
     136
     137  TComScalingList         m_scalingList;                 ///< quantization matrix information
    126138
    127139  std::vector<TEncTop*>*  m_pacTEncTopList;
    128   TAppEncTop*             m_pcTAppEncTop;                 // SB better: design a new MVTop encoder class, instead of mixing lib and app
    129 
    130   bool                    m_bPicWaitingForCoding;
    131 
    132   PicOrderCnt             m_iFrameNumInCodingOrder;
     140  TAppEncTop*             m_pcTAppEncTop;
     141
     142  TEncAnalyze             m_cAnalyzeAll;
     143  TEncAnalyze             m_cAnalyzeI;
     144  TEncAnalyze             m_cAnalyzeP;
     145  TEncAnalyze             m_cAnalyzeB;
    133146
    134147protected:
    135148  Void  xGetNewPicBuffer  ( TComPic*& rpcPic );           ///< get picture buffer which will be processed
    136149  Void  xInitSPS          ();                             ///< initialize SPS from encoder options
    137 #if CONSTRAINED_INTRA_PRED
    138150  Void  xInitPPS          ();                             ///< initialize PPS from encoder options
    139 #endif
    140   Void  xSetPicProperties( TComPic* pcPic  ) ;
    141   Void  xSetRefPics( TComPic* pcPic, RefPicList eRefPicList );
    142   Void  xCheckSliceType(TComPic* pcPic);
     151 
     152  Void  xInitPPSforTiles  ();
     153  Void  xInitRPS          ();                             ///< initialize PPS from encoder options
     154  Void  xInitSPSforInterViewRefs();
    143155
    144156public:
    145157  TEncTop();
    146158  virtual ~TEncTop();
    147 
     159 
    148160  Void      create          ();
    149161  Void      destroy         ();
     
    151163  Void      deletePicBuffer ();
    152164
     165  UInt      getFrameId          (Int iGOPid)  {
     166    if(m_iPOCLast == 0)
     167    {
     168      return(0 );
     169    }
     170    else
     171    {
     172      return m_iPOCLast -m_iNumPicRcvd+ getGOPEntry(iGOPid).m_POC ;
     173    }
     174  }
     175#if HHI_INTERVIEW_SKIP || HHI_INTER_VIEW_MOTION_PRED || HHI_INTER_VIEW_RESIDUAL_PRED
    153176  Void      deleteExtraPicBuffers   ( Int iPoc );
    154 #if AMVP_BUFFERCOMPRESS
     177#endif
     178
    155179  Void      compressMotion          ( Int iPoc );
    156 #endif
    157 
    158   UInt      getNextFrameId          ()  { return (UInt)m_cSeqIter.getPoc(); }
    159   Bool      currentPocWillBeCoded   ()  { return ( m_acInputPicMap.find( (Int)m_cSeqIter.getPoc() ) != m_acInputPicMap.end() ); }
    160 
    161   TComList<TComPic*>      getCodedPictureStore(){ return m_cListPic;}
    162 
     180
     181  Void      initNewPic(TComPicYuv* pcPicYuvOrg, TComPicYuv* pcOrgPdmDepth = 0);
     182
     183  Void      createWPPCoders(Int iNumSubstreams);
     184 
    163185  // -------------------------------------------------------------------------------------------------------------------
    164186  // member access functions
    165187  // -------------------------------------------------------------------------------------------------------------------
    166 
     188 
    167189  TComList<TComPic*>*     getListPic            () { return  &m_cListPic;             }
    168190  TEncSearch*             getPredSearch         () { return  &m_cSearch;              }
    169 
     191 
    170192  TComTrQuant*            getTrQuant            () { return  &m_cTrQuant;             }
    171193  TComLoopFilter*         getLoopFilter         () { return  &m_cLoopFilter;          }
    172194  TEncAdaptiveLoopFilter* getAdaptiveLoopFilter () { return  &m_cAdaptiveLoopFilter;  }
    173 #if MTK_SAO
    174   TEncSampleAdaptiveOffset* getSAO                () { return  &m_cEncSAO;              }
    175 #endif
    176   TEncPic*                getPicEncoder         () { return  &m_cPicEncoder;          }
     195  TEncSampleAdaptiveOffset* getSAO              () { return  &m_cEncSAO;              }
     196  TEncGOP*                getGOPEncoder         () { return  &m_cGOPEncoder;          }
    177197  TEncSlice*              getSliceEncoder       () { return  &m_cSliceEncoder;        }
    178198  TEncCu*                 getCuEncoder          () { return  &m_cCuEncoder;           }
     
    181201  TEncSbac*               getSbacCoder          () { return  &m_cSbacCoder;           }
    182202  TEncBinCABAC*           getBinCABAC           () { return  &m_cBinCoderCABAC;       }
    183 
     203  TEncSbac*               getSbacCoders     () { return  m_pcSbacCoders;      }
     204  TEncBinCABAC*           getBinCABACs          () { return  m_pcBinCoderCABACs;      }
     205 
    184206  TComBitCounter*         getBitCounter         () { return  &m_cBitCounter;          }
    185207  TComRdCost*             getRdCost             () { return  &m_cRdCost;              }
    186208  TEncSbac***             getRDSbacCoder        () { return  m_pppcRDSbacCoder;       }
    187209  TEncSbac*               getRDGoOnSbacCoder    () { return  &m_cRDGoOnSbacCoder;     }
     210  TComBitCounter*         getBitCounters        () { return  m_pcBitCounters;         }
     211  TComRdCost*             getRdCosts            () { return  m_pcRdCosts;             }
     212  TEncSbac****            getRDSbacCoders       () { return  m_ppppcRDSbacCoders;     }
     213  TEncSbac*               getRDGoOnSbacCoders   () { return  m_pcRDGoOnSbacCoders;   }
     214 
     215  Void                    setTEncTopList        ( std::vector<TEncTop*>* pacTEncTopList );
     216  TAppEncTop*             getEncTop             () { return m_pcTAppEncTop; }
     217  Int                     getNumAllPicCoded     () { return m_uiNumAllPicCoded; }
     218  Void                    printOutSummary       ( UInt uiNumAllPicCoded );
     219
     220  TComSPS*                getSPS                () { return  &m_cSPS;                 }
     221  TComPPS*                getPPS                () { return  &m_cPPS;                 }
     222  std::vector<TComAPS>&   getAPS                () { return m_vAPS; }
     223  TComRPSList*            getRPSList            () { return  &m_RPSList;                 }
     224 
     225  Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid,TComList<TComPic*>& listPic );
     226  TComScalingList*        getScalingList        () { return  &m_scalingList;         }
     227 
     228  TEncAnalyze*            getAnalyzeAll         () { return &m_cAnalyzeAll; }
     229  TEncAnalyze*            getAnalyzeI           () { return &m_cAnalyzeI;   }
     230  TEncAnalyze*            getAnalyzeP           () { return &m_cAnalyzeP;   }
     231  TEncAnalyze*            getAnalyzeB           () { return &m_cAnalyzeB;   }
     232
    188233#if DEPTH_MAP_GENERATION
    189234  TComDepthMapGenerator*  getDepthMapGenerator  () { return  &m_cDepthMapGenerator;   }
     
    193238#endif
    194239
    195   TComSPS*                getSPS                () { return  &m_cSPS;                 }
    196   TComPPS*                getPPS                () { return  &m_cPPS;                 }
    197 
    198   Void                    setTEncTopList        ( std::vector<TEncTop*>* pacTEncTopList );
    199   TAppEncTop*             getEncTop             () { return m_pcTAppEncTop; }
    200 
    201   Int                     getNumAllPicCoded     () { return m_uiNumAllPicCoded; }
    202 
    203   Void                    printOutSummary       ( UInt uiNumAllPicCoded );
    204 
    205   TEncAnalyze             m_cAnalyzeAll;
    206   TEncAnalyze             m_cAnalyzeI;
    207   TEncAnalyze             m_cAnalyzeP;
    208   TEncAnalyze             m_cAnalyzeB;
    209240  // -------------------------------------------------------------------------------------------------------------------
    210241  // encoder function
     
    212243
    213244  /// encode several number of pictures until end-of-sequence
    214 
    215 
    216 //GT PRE LOAD ENC BUFFER
    217   Void encode    ( bool bEos, std::map<PicOrderCnt, TComPicYuv*>& rcMapPicYuvRecOut, TComBitstream* pcBitstreamOut, Bool& bNewPicNeeded );
    218   Void receivePic( bool bEos, TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvRec, TComPicYuv* pcOrgPdmDepth = 0 );
     245  Void encode( bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
     246              std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded, Int gopId );
    219247};
    220248
     249//! \}
     250
    221251#endif // __TENCTOP__
    222 
Note: See TracChangeset for help on using the changeset viewer.