Changeset 1398 in SHVCSoftware for branches/SHM-dev
- Timestamp:
- 4 Aug 2015, 03:28:56 (9 years ago)
- Location:
- branches/SHM-dev/source/Lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibCommon/Debug.cpp
r1387 r1398 180 180 181 181 PRINT_CONSTANT(ME_ENABLE_ROUNDING_OF_MVS, settingNameWidth, settingValueWidth); 182 PRINT_CONSTANT(U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING, settingNameWidth, settingValueWidth); 182 183 183 184 //------------------------------------------------ -
branches/SHM-dev/source/Lib/TLibCommon/TComRdCost.h
r1397 r1398 79 79 80 80 Bool bApplyWeight; // whether weighted prediction is used or not 81 Bool bIsBiPred; 82 81 83 const WPScalingParam *wpCur; // weighted prediction scaling parameters for current ref 82 84 ComponentID compIdx; … … 98 100 bitDepth(0), 99 101 bApplyWeight(false), 102 bIsBiPred(false), 100 103 wpCur(NULL), 101 104 compIdx(MAX_NUM_COMPONENT), -
branches/SHM-dev/source/Lib/TLibCommon/TComRdCostWeightPrediction.cpp
r1397 r1398 74 74 Distortion uiSum = 0; 75 75 76 #if !U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING 76 77 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 77 78 { … … 91 92 92 93 pcDtParam->compIdx = MAX_NUM_COMPONENT; // reset for DEBUG (assert test) 94 #else 95 // Default weight 96 if (w0 == 1 << shift) 97 { 98 // no offset 99 if (offset == 0) 100 { 101 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 102 { 103 for (Int n = 0; n < iCols; n++ ) 104 { 105 uiSum += abs( piOrg[n] - piCur[n] ); 106 } 107 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 108 { 109 return uiSum >> distortionShift; 110 } 111 piOrg += iStrideOrg; 112 piCur += iStrideCur; 113 } 114 } 115 else 116 { 117 // Lets not clip for the bipredictive case since clipping should be done after 118 // combining both elements. Unfortunately the code uses the suboptimal "subtraction" 119 // method, which is faster but introduces the clipping issue (therefore Bipred is suboptimal). 120 if (pcDtParam->bIsBiPred) 121 { 122 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 123 { 124 for (Int n = 0; n < iCols; n++ ) 125 { 126 uiSum += abs( piOrg[n] - (piCur[n] + offset) ); 127 } 128 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 129 { 130 return uiSum >> distortionShift; 131 } 132 133 piOrg += iStrideOrg; 134 piCur += iStrideCur; 135 } 136 } 137 else 138 { 139 const Pel iMaxValue = (Pel) ((1 << pcDtParam->bitDepth) - 1); 140 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 141 { 142 for (Int n = 0; n < iCols; n++ ) 143 { 144 const Pel pred = Clip3((Pel) 0, iMaxValue, (Pel) (piCur[n] + offset)) ; 145 146 uiSum += abs( piOrg[n] - pred ); 147 } 148 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 149 { 150 return uiSum >> distortionShift; 151 } 152 piOrg += iStrideOrg; 153 piCur += iStrideCur; 154 } 155 } 156 } 157 } 158 else 159 { 160 // Lets not clip for the bipredictive case since clipping should be done after 161 // combining both elements. Unfortunately the code uses the suboptimal "subtraction" 162 // method, which is faster but introduces the clipping issue (therefore Bipred is suboptimal). 163 if (pcDtParam->bIsBiPred) 164 { 165 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 166 { 167 for (Int n = 0; n < iCols; n++ ) 168 { 169 const Pel pred = ( (w0*piCur[n] + round) >> shift ) + offset ; 170 uiSum += abs( piOrg[n] - pred ); 171 } 172 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 173 { 174 return uiSum >> distortionShift; 175 } 176 177 piOrg += iStrideOrg; 178 piCur += iStrideCur; 179 } 180 } 181 else 182 { 183 const Pel iMaxValue = (Pel) ((1 << pcDtParam->bitDepth) - 1); 184 185 if (offset == 0) 186 { 187 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 188 { 189 for (Int n = 0; n < iCols; n++ ) 190 { 191 const Pel pred = Clip3((Pel) 0, iMaxValue, (Pel) (( (w0*piCur[n] + round) >> shift ))) ; 192 193 uiSum += abs( piOrg[n] - pred ); 194 } 195 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 196 { 197 return uiSum >> distortionShift; 198 } 199 piOrg += iStrideOrg; 200 piCur += iStrideCur; 201 } 202 } 203 else 204 { 205 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 206 { 207 for (Int n = 0; n < iCols; n++ ) 208 { 209 const Pel pred = Clip3((Pel) 0, iMaxValue, (Pel) (( (w0*piCur[n] + round) >> shift ) + offset)) ; 210 211 uiSum += abs( piOrg[n] - pred ); 212 } 213 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 214 { 215 return uiSum >> distortionShift; 216 } 217 piOrg += iStrideOrg; 218 piCur += iStrideCur; 219 } 220 } 221 } 222 } 223 //pcDtParam->compIdx = MAX_NUM_COMPONENT; // reset for DEBUG (assert test) 224 #endif 93 225 94 226 return uiSum >> distortionShift; … … 124 256 Distortion sum = 0; 125 257 258 #if !U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING 126 259 for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- ) 127 260 { … … 137 270 138 271 pcDtParam->compIdx = MAX_NUM_COMPONENT; // reset for DEBUG (assert test) 272 #else 273 if (pcDtParam->bIsBiPred) 274 { 275 for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- ) 276 { 277 for (Int n = 0; n < iCols; n++ ) 278 { 279 const Pel pred = ( (w0*piCur[n] + round) >> shift ) + offset ; 280 const Pel residual = piOrg[n] - pred; 281 sum += ( Distortion(residual) * Distortion(residual) ) >> distortionShift; 282 } 283 piOrg += iStrideOrg; 284 piCur += iStrideCur; 285 } 286 } 287 else 288 { 289 const Pel iMaxValue = (Pel) ((1 << pcDtParam->bitDepth) - 1); 290 291 for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- ) 292 { 293 for (Int n = 0; n < iCols; n++ ) 294 { 295 const Pel pred = Clip3((Pel) 0, iMaxValue, (Pel) (( (w0*piCur[n] + round) >> shift ) + offset)) ; 296 const Pel residual = piOrg[n] - pred; 297 sum += ( Distortion(residual) * Distortion(residual) ) >> distortionShift; 298 } 299 piOrg += iStrideOrg; 300 piCur += iStrideCur; 301 } 302 } 303 304 //pcDtParam->compIdx = MAX_NUM_COMPONENT; // reset for DEBUG (assert test) 305 #endif 139 306 140 307 return sum; -
branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
r1387 r1398 165 165 #define DECODER_CHECK_SUBSTREAM_AND_SLICE_TRAILING_BYTES 1 ///< TODO: integrate this macro into a broader conformance checking system. 166 166 #define T0196_SELECTIVE_RDOQ 1 ///< selective RDOQ 167 #define U0040_MODIFIED_WEIGHTEDPREDICTION_WITH_BIPRED_AND_CLIPPING 1 167 168 168 169 // ==================================================================================================================== -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r1397 r1398 3903 3903 fWeight = 0.5; 3904 3904 } 3905 m_cDistParam.bIsBiPred = bBi; 3905 3906 3906 3907 // Search key pattern initialization
Note: See TracChangeset for help on using the changeset viewer.