Changeset 1386 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComWeightPrediction.cpp
- Timestamp:
- 13 Nov 2015, 16:29:39 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibCommon/TComWeightPrediction.cpp
r1313 r1386 55 55 } 56 56 57 static inline Pel noWeightUnidir( Pel P0, Int round, Int shift, Int offset, Int clipBD) 58 { 59 return ClipBD( ( ((P0 + IF_INTERNAL_OFFS) + round) >> shift ) + offset, clipBD ); 60 } 61 62 static inline Pel noWeightOffsetUnidir( Pel P0, Int round, Int shift, Int clipBD) 63 { 64 return ClipBD( ( ((P0 + IF_INTERNAL_OFFS) + round) >> shift ), clipBD ); 65 } 66 67 57 68 // ==================================================================================================================== 58 69 // Class definition … … 154 165 const Int shiftNum = std::max<Int>(2, (IF_INTERNAL_PREC - clipBD)); 155 166 const Int shift = wp0[compID].shift + shiftNum; 156 const Int round = (shift > 0) ? (1<<(shift-1)) : 0;157 167 const UInt iSrc0Stride = pcYuvSrc0->getStride(compID); 158 168 const UInt iDstStride = pcYuvDst->getStride(compID); … … 162 172 const Int iWidth = uiWidth>>csx; 163 173 174 if (w0 != 1 << wp0[compID].shift) 175 { 176 const Int round = (shift > 0) ? (1<<(shift-1)) : 0; 164 177 for (Int y = iHeight-1; y >= 0; y-- ) 165 178 { … … 178 191 pSrc0 += iSrc0Stride; 179 192 pDst += iDstStride; 193 } 194 } 195 else 196 { 197 const Int round = (shiftNum > 0) ? (1<<(shiftNum-1)) : 0; 198 if (offset == 0) 199 { 200 for (Int y = iHeight-1; y >= 0; y-- ) 201 { 202 Int x = iWidth-1; 203 for ( ; x >= 3; ) 204 { 205 pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--; 206 pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--; 207 pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--; 208 pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); x--; 209 } 210 for( ; x >= 0; x--) 211 { 212 pDst[x] = noWeightOffsetUnidir(pSrc0[x], round, shiftNum, clipBD); 213 } 214 pSrc0 += iSrc0Stride; 215 pDst += iDstStride; 216 } 217 } 218 else 219 { 220 for (Int y = iHeight-1; y >= 0; y-- ) 221 { 222 Int x = iWidth-1; 223 for ( ; x >= 3; ) 224 { 225 pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--; 226 pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--; 227 pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--; 228 pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); x--; 229 } 230 for( ; x >= 0; x--) 231 { 232 pDst[x] = noWeightUnidir(pSrc0[x], round, shiftNum, offset, clipBD); 233 } 234 pSrc0 += iSrc0Stride; 235 pDst += iDstStride; 236 } 237 } 180 238 } 181 239 } … … 197 255 TComSlice *const pcSlice = pcCU->getSlice(); 198 256 const Bool wpBiPred = pcCU->getSlice()->getPPS()->getWPBiPred(); 199 const Bool bBi Dir= (iRefIdx0>=0 && iRefIdx1>=0);200 const Bool bUni Dir = !bBiDir;201 202 if ( bUni Dir|| wpBiPred )257 const Bool bBiPred = (iRefIdx0>=0 && iRefIdx1>=0); 258 const Bool bUniPred = !bBiPred; 259 260 if ( bUniPred || wpBiPred ) 203 261 { // explicit -------------------- 204 262 if ( iRefIdx0 >= 0 ) … … 228 286 const Bool bUseHighPrecisionPredictionWeighting = pcSlice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag(); 229 287 230 if ( bBi Dir)231 { // Bi- Dircase288 if ( bBiPred ) 289 { // Bi-predictive case 232 290 for ( Int yuv=0 ; yuv<numValidComponent ; yuv++ ) 233 291 { … … 248 306 } 249 307 else 250 { // Uni dir308 { // UniPred 251 309 WPScalingParam *const pwp = (iRefIdx0>=0) ? wp0 : wp1 ; 252 310
Note: See TracChangeset for help on using the changeset viewer.