Changeset 466 in SHVCSoftware for branches/SHM-4.0-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
- Timestamp:
- 13 Nov 2013, 23:25:47 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-4.0-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
r313 r466 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 6 * Copyright (c) 2010-2013, ITU/ISO/IEC … … 51 51 for ( Int iList =0 ; iList<2 ; iList++ ) 52 52 { 53 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 53 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 54 54 { 55 55 for ( Int comp=0 ; comp<3 ;comp++ ) … … 74 74 TComPicYuv* pPic = slice->getPic()->getPicYuvOrg(); 75 75 Int iSample = 0; 76 #if O0194_WEIGHTED_PREDICTION_CGS 77 // Define here to assign the parameter of "iSample" 78 wpACDCParam weightACDCParam[3]; 79 #endif 76 80 77 81 // calculate DC/AC value for Y … … 81 85 pOrg = pPic->getLumaAddr(); 82 86 Int64 iOrgACY = xCalcACValueSlice(slice, pOrg, iOrgNormDCY); 87 #if O0194_WEIGHTED_PREDICTION_CGS 88 weightACDCParam[0].iSamples = iSample; 89 #endif 83 90 84 91 // calculate DC/AC value for Cb … … 88 95 pOrg = pPic->getCbAddr(); 89 96 Int64 iOrgACCb = xCalcACValueUVSlice(slice, pOrg, iOrgNormDCCb); 97 #if O0194_WEIGHTED_PREDICTION_CGS 98 weightACDCParam[1].iSamples = iSample; 99 #endif 90 100 91 101 // calculate DC/AC value for Cr … … 95 105 pOrg = pPic->getCrAddr(); 96 106 Int64 iOrgACCr = xCalcACValueUVSlice(slice, pOrg, iOrgNormDCCr); 97 107 #if O0194_WEIGHTED_PREDICTION_CGS 108 weightACDCParam[2].iSamples = iSample; 109 #endif 110 111 #if !O0194_WEIGHTED_PREDICTION_CGS 98 112 wpACDCParam weightACDCParam[3]; 113 #endif 99 114 weightACDCParam[0].iAC = iOrgACY; 100 115 weightACDCParam[0].iDC = iOrgNormDCY; … … 138 153 for ( Int iList=0 ; iList<2 ; iList++ ) 139 154 { 140 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 141 { 142 for ( Int iComp=0 ; iComp<3 ;iComp++ ) 155 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 156 { 157 for ( Int iComp=0 ; iComp<3 ;iComp++ ) 143 158 { 144 159 wpScalingParam *pwp = &(m_wp[iList][iRefIdx][iComp]); … … 154 169 for ( Int iList=0 ; iList<2 ; iList++ ) 155 170 { 156 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 171 for ( Int iRefIdx=0 ; iRefIdx<MAX_NUM_REF ; iRefIdx++ ) 157 172 { 158 for ( Int iComp=0 ; iComp<3 ;iComp++ ) 173 for ( Int iComp=0 ; iComp<3 ;iComp++ ) 159 174 { 160 175 wpScalingParam *pwp = &(m_wp[iList][iRefIdx][iComp]); … … 195 210 // selecting whether WP is used, or not 196 211 xSelectWP(slice, m_wp, iDenom); 197 212 198 213 slice->setWpScaling( m_wp ); 199 214 … … 216 231 slice->getWpAcDcParam(currWeightACDCParam); 217 232 slice->getRefPic(eRefPicList, refIdxTemp)->getSlice(0)->getWpAcDcParam(refWeightACDCParam); 233 #if O0194_WEIGHTED_PREDICTION_CGS 234 if (slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1)){ 235 refWeightACDCParam = (wpACDCParam *)g_refWeightACDCParam; 236 } 237 #endif 218 238 219 239 for ( Int comp = 0; comp < 3; comp++ ) … … 229 249 Int64 refDC = refWeightACDCParam[comp].iDC; 230 250 Int64 refAC = refWeightACDCParam[comp].iAC; 251 #if O0194_WEIGHTED_PREDICTION_CGS 252 if (slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1)){ 253 refAC *= (double)currWeightACDCParam[comp].iSamples/refWeightACDCParam[comp].iSamples; 254 #if O0194_JOINT_US_BITSHIFT 255 refAC *= (1<<(g_bitDepthYLayer[1]-g_bitDepthYLayer[0])); 256 refDC *= (1<<(g_bitDepthYLayer[1]-g_bitDepthYLayer[0])); 257 #endif 258 } 259 #endif 231 260 232 261 // calculating iWeight and iOffset params … … 234 263 Int weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) ); 235 264 Int offset = (Int)( ((currDC<<log2Denom) - ((Int64)weight * refDC) + (Int64)realOffset) >> realLog2Denom ); 265 #if O0194_WEIGHTED_PREDICTION_CGS 266 if (slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1)){ 267 } 268 else{ 269 dWeight = 1; 270 offset = 0; 271 } 272 weight = (Int)( 0.5 + dWeight * (Double)(1<<log2Denom) ); 273 #endif 236 274 237 275 // Chroma offset range limitation … … 253 291 if(deltaWeight > 127 || deltaWeight < -128) 254 292 return (false); 293 #if O0194_WEIGHTED_PREDICTION_CGS 294 // make sure the reference frames other than ILR are not using weighted prediction 295 if (!(slice->getRefPic(eRefPicList, refIdxTemp)->isILR(1))){ 296 continue; 297 } 298 #endif 255 299 256 300 m_wp[refList][refIdxTemp][comp].bPresentFlag = true; … … 264 308 } 265 309 266 /** select whether weighted pred enables or not. 310 /** select whether weighted pred enables or not. 267 311 * \param TComSlice *slice 268 312 * \param wpScalingParam … … 325 369 } 326 370 327 /** calculate DC value of original image for luma. 371 /** calculate DC value of original image for luma. 328 372 * \param TComSlice *slice 329 373 * \param Pel *pPel … … 345 389 } 346 390 347 /** calculate AC value of original image for luma. 391 /** calculate AC value of original image for luma. 348 392 * \param TComSlice *slice 349 393 * \param Pel *pPel … … 363 407 } 364 408 365 /** calculate DC value of original image for chroma. 409 /** calculate DC value of original image for chroma. 366 410 * \param TComSlice *slice 367 411 * \param Pel *pPel … … 383 427 } 384 428 385 /** calculate AC value of original image for chroma. 429 /** calculate AC value of original image for chroma. 386 430 * \param TComSlice *slice 387 431 * \param Pel *pPel … … 401 445 } 402 446 403 /** calculate DC value. 447 /** calculate DC value. 404 448 * \param Pel *pPel 405 449 * \param Int iWidth … … 423 467 } 424 468 425 /** calculate AC value. 469 /** calculate AC value. 426 470 * \param Pel *pPel 427 471 * \param Int iWidth … … 446 490 } 447 491 448 /** calculate SAD values for both WP version and non-WP version. 492 /** calculate SAD values for both WP version and non-WP version. 449 493 * \param Pel *pOrgPel 450 494 * \param Pel *pRefPel
Note: See TracChangeset for help on using the changeset viewer.