Ignore:
Timestamp:
13 Jul 2013, 15:51:26 (11 years ago)
Author:
tech
Message:

Update to HM 11.0.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncRateCtrl.h

    r324 r537  
    6565const Double g_RCWeightPicTargetBitInGOP    = 0.9;
    6666const Double g_RCWeightPicRargetBitInBuffer = 1.0 - g_RCWeightPicTargetBitInGOP;
     67#if M0036_RC_IMPROVEMENT
     68const Int g_RCIterationNum = 20;
     69const Double g_RCWeightHistoryLambda = 0.5;
     70const Double g_RCWeightCurrentLambda = 1.0 - g_RCWeightHistoryLambda;
     71const Int g_RCLCUSmoothWindowSize = 4;
     72const Double g_RCAlphaMinValue = 0.05;
     73const Double g_RCAlphaMaxValue = 500.0;
     74const Double g_RCBetaMinValue  = -3.0;
     75const Double g_RCBetaMaxValue  = -0.1;
     76#endif
     77
     78#if RATE_CONTROL_INTRA
     79#define ALPHA     6.7542;
     80#define BETA1     1.2517
     81#define BETA2     1.7860
     82#endif
    6783
    6884struct TRCLCU
     
    7288  Int m_targetBits;
    7389  Double m_lambda;
     90#if M0036_RC_IMPROVEMENT
     91  Double m_bitWeight;
     92#else
    7493  Double m_MAD;
     94#endif
    7595  Int m_numberOfPixel;
     96#if RATE_CONTROL_INTRA
     97  Double m_costIntra;
     98  Int m_targetBitsLeft;
     99#endif
    76100};
    77101
     
    89113
    90114public:
     115#if M0036_RC_IMPROVEMENT
     116  Void create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel, Int adaptiveBit );
     117#else
    91118  Void create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel );
     119#endif
    92120  Void destroy();
    93121  Void initBitsRatio( Int bitsRatio[] );
     
    96124  Void initLCUPara( TRCParameter** LCUPara = NULL );    // NULL to initial with default value
    97125  Void updateAfterPic ( Int bits );
     126#if !RATE_CONTROL_INTRA
    98127  Int  getRefineBitsForIntra( Int orgBits );
     128#endif
     129#if M0036_RC_IMPROVEMENT
     130  Void setAllBitRatio( Double basicLambda, Double* equaCoeffA, Double* equaCoeffB );
     131#endif
    99132
    100133public:
     
    134167  Double getBetaUpdate()                { return m_betaUpdate; }
    135168
     169#if M0036_RC_IMPROVEMENT
     170  Int    getAdaptiveBits()              { return m_adaptiveBit;  }
     171  Double getLastLambda()                { return m_lastLambda;   }
     172  Void   setLastLambda( Double lamdba ) { m_lastLambda = lamdba; }
     173#endif
     174
    136175private:
    137176  Int m_totalFrames;
     
    160199  Double m_betaUpdate;
    161200  Bool m_useLCUSeparateModel;
     201
     202#if M0036_RC_IMPROVEMENT
     203  Int m_adaptiveBit;
     204  Double m_lastLambda;
     205#endif
    162206};
    163207
     
    175219private:
    176220  Int  xEstGOPTargetBits( TEncRCSeq* encRCSeq, Int GOPSize );
     221#if M0036_RC_IMPROVEMENT
     222  Void   xCalEquaCoeff( TEncRCSeq* encRCSeq, Double* lambdaRatio, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize );
     223  Double xSolveEqua( Double targetBpp, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize );
     224#endif
    177225
    178226public:
     
    203251  Void destroy();
    204252
     253#if !RATE_CONTROL_INTRA
    205254  Double estimatePicLambda( list<TEncRCPic*>& listPreviousPictures );
     255#endif
    206256  Int    estimatePicQP    ( Double lambda, list<TEncRCPic*>& listPreviousPictures );
     257#if RATE_CONTROL_INTRA
     258  Int    getRefineBitsForIntra(Int orgBits);
     259  Double calculateLambdaIntra(double alpha, double beta, double MADPerPixel, double bitsPerPixel);
     260  Double estimatePicLambda( list<TEncRCPic*>& listPreviousPictures, SliceType eSliceType);
     261
     262  Void   updateAlphaBetaIntra(double *alpha, double *beta);
     263
     264  Double getLCUTargetBpp(SliceType eSliceType);
     265  Double getLCUEstLambdaAndQP(Double bpp, Int clipPicQP, Int *estQP);
     266#else
    207267  Double getLCUTargetBpp();
     268#endif
    208269  Double getLCUEstLambda( Double bpp );
    209270  Int    getLCUEstQP( Double lambda, Int clipPicQP );
    210271
    211272  Void updateAfterLCU( Int LCUIdx, Int bits, Int QP, Double lambda, Bool updateLCUParameter = true );
     273#if M0036_RC_IMPROVEMENT
     274#if RATE_CONTROL_INTRA
     275  Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, SliceType eSliceType);
     276#else
     277  Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda );
     278#endif
     279#else
    212280  Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, Double effectivePercentage );
     281#endif
    213282
    214283  Void addToPictureLsit( list<TEncRCPic*>& listPreviousPictures );
     284#if !M0036_RC_IMPROVEMENT
    215285  Double getEffectivePercentage();
     286#endif
    216287  Double calAverageQP();
    217288  Double calAverageLambda();
     
    229300  Int  getNumberOfLCU()                                   { return m_numberOfLCU; }
    230301  Int  getTargetBits()                                    { return m_targetBits; }
     302#if !RATE_CONTROL_INTRA
    231303  Void setTargetBits( Int bits )                          { m_targetBits = bits; }
     304#endif
    232305  Int  getEstHeaderBits()                                 { return m_estHeaderBits; }
    233306  Int  getLCULeft()                                       { return m_LCULeft; }
     
    239312  TRCLCU& getLCU( Int LCUIdx )                            { return m_LCUs[LCUIdx]; }
    240313  Int  getPicActualHeaderBits()                           { return m_picActualHeaderBits; }
     314#if !M0036_RC_IMPROVEMENT
    241315  Double getTotalMAD()                                    { return m_totalMAD; }
    242316  Void   setTotalMAD( Double MAD )                        { m_totalMAD = MAD; }
     317#endif
     318#if RATE_CONTROL_INTRA
     319  Void setTargetBits( Int bits )                          { m_targetBits = bits; m_bitsLeft = bits;}
     320  Void setTotalIntraCost(Double cost)                     { m_totalCostIntra = cost; }
     321  Void getLCUInitTargetBits();
     322#endif
     323
    243324  Int  getPicActualBits()                                 { return m_picActualBits; }
    244325  Int  getPicActualQP()                                   { return m_picQP; }
     
    267348  TRCLCU* m_LCUs;
    268349  Int m_picActualHeaderBits;    // only SH and potential APS
     350#if !M0036_RC_IMPROVEMENT
    269351  Double m_totalMAD;
     352#endif
     353#if RATE_CONTROL_INTRA
     354  Double m_totalCostIntra;
     355  Double m_remainingCostIntra;
     356#endif
    270357  Int m_picActualBits;          // the whole picture, including header
    271358  Int m_picQP;                  // in integer form
    272359  Double m_picLambda;
     360#if !M0036_RC_IMPROVEMENT
    273361  TEncRCPic* m_lastPicture;
     362#endif
    274363};
    275364
     
    281370
    282371public:
     372#if M0036_RC_IMPROVEMENT
     373  Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] );
     374#else
    283375  Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] );
     376#endif
    284377  Void destroy();
    285378  Void initRCPic( Int frameLevel );
Note: See TracChangeset for help on using the changeset viewer.