Ignore:
Timestamp:
9 Jan 2014, 05:04:17 (11 years ago)
Author:
seregin
Message:

merge SHM-4.1-dev branch

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h

    r313 r540  
    5353// Class definition
    5454// ====================================================================================================================
     55
     56#if HM_CLEANUP_SAO
     57enum SAOCabacStateLablesRDO //CABAC state labels
     58{
     59  SAO_CABACSTATE_PIC_INIT =0,
     60  SAO_CABACSTATE_BLK_CUR,
     61  SAO_CABACSTATE_BLK_NEXT,
     62  SAO_CABACSTATE_BLK_MID,
     63  SAO_CABACSTATE_BLK_TEMP,
     64  NUM_SAO_CABACSTATE_LABELS
     65};
     66
     67struct SAOStatData //data structure for SAO statistics
     68{
     69  Int64 diff[MAX_NUM_SAO_CLASSES];
     70  Int64 count[MAX_NUM_SAO_CLASSES];
     71
     72  SAOStatData(){}
     73  ~SAOStatData(){}
     74  Void reset()
     75  {
     76    ::memset(diff, 0, sizeof(Int64)*MAX_NUM_SAO_CLASSES);
     77    ::memset(count, 0, sizeof(Int64)*MAX_NUM_SAO_CLASSES);
     78  }
     79  const SAOStatData& operator=(const SAOStatData& src)
     80  {
     81    ::memcpy(diff, src.diff, sizeof(Int64)*MAX_NUM_SAO_CLASSES);
     82    ::memcpy(count, src.count, sizeof(Int64)*MAX_NUM_SAO_CLASSES);
     83    return *this;
     84  }
     85#if SAO_ENCODE_ALLOW_USE_PREDEBLOCK
     86  const SAOStatData& operator+= (const SAOStatData& src)
     87  {
     88    for(Int i=0; i< MAX_NUM_SAO_CLASSES; i++)
     89    {
     90      diff[i] += src.diff[i];
     91      count[i] += src.count[i];
     92    }
     93    return *this;
     94  }
     95#endif
     96};
     97
     98class TEncSampleAdaptiveOffset : public TComSampleAdaptiveOffset
     99{
     100public:
     101  TEncSampleAdaptiveOffset();
     102  virtual ~TEncSampleAdaptiveOffset();
     103
     104  //interface
     105#if SAO_ENCODE_ALLOW_USE_PREDEBLOCK
     106  Void createEncData(Bool isPreDBFSamplesUsed);
     107#else
     108  Void createEncData();
     109#endif
     110  Void destroyEncData();
     111  Void initRDOCabacCoder(TEncSbac* pcRDGoOnSbacCoder, TComSlice* pcSlice) ;
     112  Void SAOProcess(TComPic* pPic, Bool* sliceEnabled, const Double *lambdas
     113#if SAO_ENCODE_ALLOW_USE_PREDEBLOCK
     114                , Bool isPreDBFSamplesUsed
     115#endif
     116                );
     117public: //methods
     118#if SAO_ENCODE_ALLOW_USE_PREDEBLOCK
     119  Void getPreDBFStatistics(TComPic* pPic);
     120#endif
     121private: //methods
     122  Void getStatistics(SAOStatData*** blkStats, TComPicYuv* orgYuv, TComPicYuv* srcYuv,TComPic* pPic
     123#if SAO_ENCODE_ALLOW_USE_PREDEBLOCK
     124                   , Bool isCalculatePreDeblockSamples = false
     125#endif
     126                   );
     127  Void decidePicParams(Bool* sliceEnabled, Int picTempLayer);
     128  Void decideBlkParams(TComPic* pic, Bool* sliceEnabled, SAOStatData*** blkStats, TComPicYuv* srcYuv, TComPicYuv* resYuv, SAOBlkParam* reconParams, SAOBlkParam* codedParams);
     129  Void getBlkStats(Int compIdx, SAOStatData* statsDataTypes, Pel* srcBlk, Pel* orgBlk, Int srcStride, Int orgStride, Int width, Int height, Bool isLeftAvail,  Bool isRightAvail, Bool isAboveAvail, Bool isBelowAvail, Bool isAboveLeftAvail, Bool isAboveRightAvail, Bool isBelowLeftAvail, Bool isBelowRightAvail
     130#if SAO_ENCODE_ALLOW_USE_PREDEBLOCK
     131                  , Bool isCalculatePreDeblockSamples
     132#endif
     133                  );
     134  Void deriveModeNewRDO(Int ctu, std::vector<SAOBlkParam*>& mergeList, Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel);
     135  Void deriveModeMergeRDO(Int ctu, std::vector<SAOBlkParam*>& mergeList, Bool* sliceEnabled, SAOStatData*** blkStats, SAOBlkParam& modeParam, Double& modeNormCost, TEncSbac** cabacCoderRDO, Int inCabacLabel);
     136  Int64 getDistortion(Int ctu, Int compIdx, Int typeIdc, Int typeAuxInfo, Int* offsetVal, SAOStatData& statData);
     137  Void deriveOffsets(Int ctu, Int compIdx, Int typeIdc, SAOStatData& statData, Int* quantOffsets, Int& typeAuxInfo);
     138  inline Int64 estSaoDist(Int64 count, Int64 offset, Int64 diffSum, Int shift);
     139  inline Int estIterOffset(Int typeIdx, Int classIdx, Double lambda, Int offsetInput, Int64 count, Int64 diffSum, Int shift, Int bitIncrease, Int64& bestDist, Double& bestCost, Int offsetTh );
     140#if SAO_ENCODE_ALLOW_USE_PREDEBLOCK
     141  Void addPreDBFStatistics(SAOStatData*** blkStats);
     142#endif
     143private: //members
     144  //for RDO
     145  TEncSbac**             m_pppcRDSbacCoder;           
     146  TEncSbac*              m_pcRDGoOnSbacCoder;
     147  TEncBinCABACCounter**  m_pppcBinCoderCABAC;   
     148  Double                 m_labmda[NUM_SAO_COMPONENTS];
     149
     150  //statistics
     151  SAOStatData***         m_statData; //[ctu][comp][classes]
     152#if SAO_ENCODE_ALLOW_USE_PREDEBLOCK
     153  SAOStatData***         m_preDBFstatData;
     154#endif
     155#if SAO_ENCODING_CHOICE
     156  Double                 m_saoDisabledRate[NUM_SAO_COMPONENTS][MAX_TLAYER];
     157#endif
     158  Int                    m_skipLinesR[NUM_SAO_COMPONENTS][NUM_SAO_NEW_TYPES];
     159  Int                    m_skipLinesB[NUM_SAO_COMPONENTS][NUM_SAO_NEW_TYPES];
     160};
     161#else
     162
    55163
    56164class TEncSampleAdaptiveOffset : public TComSampleAdaptiveOffset
     
    95203  Void endSaoEnc();
    96204  Void resetStats();
    97 #if SAO_CHROMA_LAMBDA
    98205#if SAO_ENCODING_CHOICE
    99206  Void SAOProcess(SAOParam *pcSaoParam, Double dLambda, Double dLambdaChroma, Int depth);
    100207#else
    101208  Void SAOProcess(SAOParam *pcSaoParam, Double dLambda, Double dLambdaChroma);
    102 #endif
    103 #else
    104   Void SAOProcess(SAOParam *pcSaoParam, Double dLambda);
    105209#endif
    106210
     
    131235  Int  getMaxNumOffsetsPerPic() {return m_maxNumOffsetsPerPic; }
    132236};
    133 
     237#endif
    134238//! \}
    135239
Note: See TracChangeset for help on using the changeset viewer.