Changeset 1399 in SHVCSoftware
- Timestamp:
- 4 Aug 2015, 03:30:53 (9 years ago)
- Location:
- branches/SHM-dev/source/Lib/TLibCommon
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibCommon/TComRdCostWeightPrediction.cpp
r1398 r1399 588 588 const ComponentID compIdx = pcDtParam->compIdx; 589 589 assert(compIdx<MAX_NUM_COMPONENT); 590 const WPScalingParam wpCur= pcDtParam->wpCur[compIdx];590 const WPScalingParam &wpCur = pcDtParam->wpCur[compIdx]; 591 591 592 592 Distortion uiSum = 0; -
branches/SHM-dev/source/Lib/TLibCommon/TComWeightPrediction.cpp
r1316 r1399 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 164 for (Int y = iHeight-1; y >= 0; y--)165 { 166 Int x = iWidth-1;167 for ( ; x >= 3;)174 if (w0 != 1 << wp0[compID].shift) 175 { 176 const Int round = (shift > 0) ? (1<<(shift-1)) : 0; 177 for (Int y = iHeight-1; y >= 0; y-- ) 168 178 { 169 pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--; 170 pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--; 171 pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--; 172 pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--; 179 Int x = iWidth-1; 180 for ( ; x >= 3; ) 181 { 182 pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--; 183 pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--; 184 pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--; 185 pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); x--; 186 } 187 for( ; x >= 0; x--) 188 { 189 pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); 190 } 191 pSrc0 += iSrc0Stride; 192 pDst += iDstStride; 173 193 } 174 for( ; x >= 0; x--) 194 } 195 else 196 { 197 const Int round = (shiftNum > 0) ? (1<<(shiftNum-1)) : 0; 198 if (offset == 0) 175 199 { 176 pDst[x] = weightUnidir(w0, pSrc0[x], round, shift, offset, clipBD); 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 } 177 217 } 178 pSrc0 += iSrc0Stride; 179 pDst += iDstStride; 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 { … … 252 310 } 253 311 else 254 { // Uni dir312 { // UniPred 255 313 WPScalingParam *const pwp = (iRefIdx0>=0) ? wp0 : wp1 ; 256 314
Note: See TracChangeset for help on using the changeset viewer.