| 4405 | #if G212_CROSS9x9_VB && G1023_FIX_NPASS_ALF |
| 4406 | Int64 iEstimateDistBeforeFilter; |
| 4407 | Int* coeffNoFilter[NUM_ALF_FILTER_SHAPE][NO_VAR_BINS]; |
| 4408 | for(Int filter_shape = 0; filter_shape < NUM_ALF_FILTER_SHAPE; filter_shape++) |
| 4409 | { |
| 4410 | for(Int i=0; i< NO_VAR_BINS; i++) |
| 4411 | { |
| 4412 | coeffNoFilter[filter_shape][i]= new Int[ALF_MAX_NUM_COEF]; |
| 4413 | ::memset(coeffNoFilter[filter_shape][i], 0, sizeof(Int)*ALF_MAX_NUM_COEF); |
| 4414 | #if ALF_DC_OFFSET_REMOVAL |
| 4415 | coeffNoFilter[filter_shape][i][ m_sqrFiltLengthTab[filter_shape]-1 ] = (1 << ((Int)ALF_NUM_BIT_SHIFT)); |
| 4416 | #else |
| 4417 | coeffNoFilter[filter_shape][i][ m_sqrFiltLengthTab[filter_shape]-2 ] = (1 << ((Int)ALF_NUM_BIT_SHIFT)); |
| 4418 | #endif |
| 4419 | } |
| 4420 | } |
| 4421 | #endif |
| 4521 | #if G212_CROSS9x9_VB && G1023_FIX_NPASS_ALF |
| 4522 | // if ALF_STAR5x5 is selected, the distortion of 2 skipped lines per LCU should be added. |
| 4523 | if(pcAlfSaved->filter_shape == ALF_STAR5x5) |
| 4524 | { |
| 4525 | Int iPelDiff; |
| 4526 | UInt64 uiSkipPelsDistortion = 0; |
| 4527 | Pel *pOrgTemp, *pDecTemp; |
| 4528 | for(Int y= m_lineIdxPadTop-1; y< m_img_height - m_lcuHeight ; y += m_lcuHeight) |
| 4529 | { |
| 4530 | pOrgTemp = ImgOrg + y*Stride; |
| 4531 | pDecTemp = ImgDec + y*Stride; |
| 4532 | for(Int x=0; x< m_img_width; x++) |
| 4533 | { |
| 4534 | if(m_maskImg[y][x] == 1) |
| 4535 | { |
| 4536 | iPelDiff = pOrgTemp[x] - pDecTemp[x]; |
| 4537 | uiSkipPelsDistortion += (UInt64)( (iPelDiff*iPelDiff) >> uiBitShift ); |
| 4538 | } |
| 4539 | } |
| 4540 | |
| 4541 | pOrgTemp += Stride; |
| 4542 | pDecTemp += Stride; |
| 4543 | for(Int x=0; x< m_img_width; x++) |
| 4544 | { |
| 4545 | if(m_maskImg[y+1][x] == 1) |
| 4546 | { |
| 4547 | iPelDiff = pOrgTemp[x] - pDecTemp[x]; |
| 4548 | uiSkipPelsDistortion += (UInt64)( (iPelDiff*iPelDiff) >> uiBitShift ); |
| 4549 | } |
| 4550 | } |
| 4551 | } |
| 4552 | ruiDist += uiSkipPelsDistortion; |
| 4553 | rdCost += (Double)uiSkipPelsDistortion; |
| 4554 | } |
| 4555 | |
| 4556 | for(Int filter_shape = 0; filter_shape < NUM_ALF_FILTER_SHAPE; filter_shape++) |
| 4557 | { |
| 4558 | for(Int i=0; i< NO_VAR_BINS; i++) |
| 4559 | { |
| 4560 | delete[] coeffNoFilter[filter_shape][i]; |
| 4561 | } |
| 4562 | } |
| 4563 | #endif |
| 4564 | |