Changeset 540 in SHVCSoftware for trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/SHM-4.1-dev (added) merged: 501-539 /trunk merged: 499
- Property svn:mergeinfo changed
-
trunk/source
- Property svn:mergeinfo changed
/branches/SHM-4.1-dev/source (added) merged: 502-522,524-533,535,537-539
- Property svn:mergeinfo changed
-
trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.h
r313 r540 53 53 // Class definition 54 54 // ==================================================================================================================== 55 56 #if HM_CLEANUP_SAO 57 enum 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 67 struct 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 98 class TEncSampleAdaptiveOffset : public TComSampleAdaptiveOffset 99 { 100 public: 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 ); 117 public: //methods 118 #if SAO_ENCODE_ALLOW_USE_PREDEBLOCK 119 Void getPreDBFStatistics(TComPic* pPic); 120 #endif 121 private: //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 143 private: //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 55 163 56 164 class TEncSampleAdaptiveOffset : public TComSampleAdaptiveOffset … … 95 203 Void endSaoEnc(); 96 204 Void resetStats(); 97 #if SAO_CHROMA_LAMBDA98 205 #if SAO_ENCODING_CHOICE 99 206 Void SAOProcess(SAOParam *pcSaoParam, Double dLambda, Double dLambdaChroma, Int depth); 100 207 #else 101 208 Void SAOProcess(SAOParam *pcSaoParam, Double dLambda, Double dLambdaChroma); 102 #endif103 #else104 Void SAOProcess(SAOParam *pcSaoParam, Double dLambda);105 209 #endif 106 210 … … 131 235 Int getMaxNumOffsetsPerPic() {return m_maxNumOffsetsPerPic; } 132 236 }; 133 237 #endif 134 238 //! \} 135 239
Note: See TracChangeset for help on using the changeset viewer.