📄 umc_h264_segment_decoder_deblocking_mbaff.cpp
字号:
if (0 == GetMBFieldDecodingFlag(m_gmbinfo->mbs[MBAddr]))
{
if (pParams->bitDepthChroma > 8)
{
IppDeblocking16u[9]((Ipp16u*)pParams->pChroma[nPlane],
pParams->pitch_chroma * 4,
&Alpha[0],
&Beta[0],
Clipping,
pStrength,
pParams->bitDepthChroma);
IppDeblocking16u[9]((Ipp16u*)pParams->pChroma[nPlane] + pParams->pitch_chroma,
pParams->pitch_chroma * 4,
&Alpha[1],
&Beta[1],
Clipping + 4,
pStrength + 4,
pParams->bitDepthChroma);
IppDeblocking16u[9]((Ipp16u*)pParams->pChroma[nPlane] + pParams->pitch_chroma * 2,
pParams->pitch_chroma * 4,
&Alpha[0],
&Beta[0],
Clipping,
pStrength,
pParams->bitDepthChroma);
IppDeblocking16u[9]((Ipp16u*)pParams->pChroma[nPlane] + pParams->pitch_chroma * 3,
pParams->pitch_chroma * 4,
&Alpha[1],
&Beta[1],
Clipping + 4,
pStrength + 4,
pParams->bitDepthChroma);
}
else
{
IppDeblocking[9](pParams->pChroma[nPlane],
pParams->pitch_chroma * 4,
&Alpha[0],
&Beta[0],
Clipping,
pStrength,
pParams->bitDepthChroma);
IppDeblocking[9](pParams->pChroma[nPlane] + pParams->pitch_chroma,
pParams->pitch_chroma * 4,
&Alpha[1],
&Beta[1],
Clipping + 4,
pStrength + 4,
pParams->bitDepthChroma);
IppDeblocking[9](pParams->pChroma[nPlane] + pParams->pitch_chroma * 2,
pParams->pitch_chroma * 4,
&Alpha[0],
&Beta[0],
Clipping,
pStrength,
pParams->bitDepthChroma);
IppDeblocking[9](pParams->pChroma[nPlane] + pParams->pitch_chroma * 3,
pParams->pitch_chroma * 4,
&Alpha[1],
&Beta[1],
Clipping + 4,
pStrength + 4,
pParams->bitDepthChroma);
}
}
else
{
if (pParams->bitDepthChroma > 8)
{
IppDeblocking16u[9]((Ipp16u*)pParams->pChroma[nPlane],
pParams->pitch_chroma,
&Alpha[0],
&Beta[0],
Clipping,
pStrength,
pParams->bitDepthChroma);
IppDeblocking16u[9]((Ipp16u*)pParams->pChroma[nPlane] + pParams->pitch_chroma * 4,
pParams->pitch_chroma,
&Alpha[0],
&Beta[0],
Clipping,
pStrength,
pParams->bitDepthChroma);
IppDeblocking16u[9]((Ipp16u*)pParams->pChroma[nPlane] + pParams->pitch_chroma * 8,
pParams->pitch_chroma,
&Alpha[1],
&Beta[1],
Clipping + 4,
pStrength + 4,
pParams->bitDepthChroma);
IppDeblocking16u[9]((Ipp16u*)pParams->pChroma[nPlane] + pParams->pitch_chroma * 12,
pParams->pitch_chroma,
&Alpha[1],
&Beta[1],
Clipping + 4,
pStrength + 4,
pParams->bitDepthChroma);
}
else
{
IppDeblocking[9](pParams->pChroma[nPlane],
pParams->pitch_chroma,
&Alpha[0],
&Beta[0],
Clipping,
pStrength,
pParams->bitDepthChroma);
IppDeblocking[9](pParams->pChroma[nPlane] + pParams->pitch_chroma * 4,
pParams->pitch_chroma,
&Alpha[0],
&Beta[0],
Clipping,
pStrength,
pParams->bitDepthChroma);
IppDeblocking[9](pParams->pChroma[nPlane] + pParams->pitch_chroma * 8,
pParams->pitch_chroma,
&Alpha[1],
&Beta[1],
Clipping + 4,
pStrength + 4,
pParams->bitDepthChroma);
IppDeblocking[9](pParams->pChroma[nPlane] + pParams->pitch_chroma * 12,
pParams->pitch_chroma,
&Alpha[1],
&Beta[1],
Clipping + 4,
pStrength + 4,
pParams->bitDepthChroma);
}
}
}
}
//
// step 2. Perform complex deblocking on internal edges
//
(this->*DeblockChroma[CHROMA_FORMAT_422])(VERTICAL_DEBLOCKING, pParams);
} // void H264SegmentDecoder::DeblockChromaVerticalMBAFF422(DeblockingParametersMBAFF *pParams)
void H264SegmentDecoder::DeblockChromaVerticalMBAFF444(DeblockingParametersMBAFF * /*pParams*/)
{
/* this function is under development */
} // void H264SegmentDecoder::DeblockChromaVerticalMBAFF444(DeblockingParametersMBAFF *pParams)
void H264SegmentDecoder::DeblockLumaHorizontalMBAFF(DeblockingParametersMBAFF *pParams)
{
Ipp8u bTmp[16];
Ipp32s pitch = pParams->pitch_luma;
Ipp32s luma_pixel_sz = pParams->bitDepthLuma > 8 ? 2 : 1;
//
// luma deblocking
//
//
// step 1. Deblock origin external edge
//
{
// save internal edges strength
CopyEdgeStrength(bTmp + 0, pParams->Strength[HORIZONTAL_DEBLOCKING] + 0);
CopyEdgeStrength(bTmp + 4, pParams->Strength[HORIZONTAL_DEBLOCKING] + 4);
CopyEdgeStrength(bTmp + 8, pParams->Strength[HORIZONTAL_DEBLOCKING] + 8);
CopyEdgeStrength(bTmp + 12, pParams->Strength[HORIZONTAL_DEBLOCKING] + 12);
// skip all internal edges
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 4, 0);
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 8, 0);
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 12, 0);
// set pitch
pParams->pitch_luma *= 2;
// perform deblocking
DeblockLuma(HORIZONTAL_DEBLOCKING, pParams);
}
//
// step 2. Deblock extra external edge
//
{
// set extra edge strength
CopyEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING], pParams->StrengthExtra);
// correct neighbour MB info
pParams->nNeighbour[HORIZONTAL_DEBLOCKING] += 1;
// correct Y pointer
pParams->pLuma += pitch*luma_pixel_sz;
// perform deblocking
DeblockLuma(HORIZONTAL_DEBLOCKING, pParams);
// restore values
pParams->nNeighbour[HORIZONTAL_DEBLOCKING] -= 1;
pParams->pLuma -= pitch*luma_pixel_sz;
pParams->pitch_luma = pitch;
}
//
// step 3. Deblock internal edges
//
{
pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 0;
// set internal edge strength
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 0, 0);
CopyEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 4, bTmp + 4);
CopyEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 8, bTmp + 8);
CopyEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 12, bTmp + 12);
// perform deblocking
DeblockLuma(HORIZONTAL_DEBLOCKING, pParams);
// restore strength
pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 1;
CopyEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 0, bTmp + 0);
}
} // void H264SegmentDecoder::DeblockLumaHorizontalMBAFF(DeblockingParametersMBAFF *pParams)
void H264SegmentDecoder::DeblockChromaHorizontalMBAFF400(DeblockingParametersMBAFF *)
{
// there is nothing to do
} // void H264SegmentDecoder::DeblockChromaHorizontalMBAFF400(DeblockingParametersMBAFF *)
void H264SegmentDecoder::DeblockChromaHorizontalMBAFF420(DeblockingParametersMBAFF *pParams)
{
Ipp8u bTmp[16];
Ipp32s pitch = pParams->pitch_chroma;
Ipp32s chroma_pixel_sz = pParams->bitDepthChroma > 8 ? 2 : 1;
ChromaDeblockingFunction pFunc = DeblockChroma[m_pCurrentFrame->m_chroma_format];
//
// chroma deblocking
//
//
// step 1. Deblock origin external edge
//
{
// save internal edges strength
CopyEdgeStrength(bTmp + 0, pParams->Strength[HORIZONTAL_DEBLOCKING] + 0);
CopyEdgeStrength(bTmp + 4, pParams->Strength[HORIZONTAL_DEBLOCKING] + 4);
CopyEdgeStrength(bTmp + 8, pParams->Strength[HORIZONTAL_DEBLOCKING] + 8);
CopyEdgeStrength(bTmp + 12, pParams->Strength[HORIZONTAL_DEBLOCKING] + 12);
// skip all internal edges
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 4, 0);
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 8, 0);
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 12, 0);
// set pitch
pParams->pitch_chroma *= 2;
// perform deblocking
(this->*pFunc)(HORIZONTAL_DEBLOCKING, pParams);
}
//
// step 2. Deblock extra external edge
//
{
// set extra edge strength
CopyEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING], pParams->StrengthExtra);
// correct neighbour MB info
pParams->nNeighbour[HORIZONTAL_DEBLOCKING] += 1;
// correct U & V pointer
pParams->pChroma[0] += pitch*chroma_pixel_sz;
pParams->pChroma[1] += pitch*chroma_pixel_sz;
// perform deblocking
(this->*pFunc)(HORIZONTAL_DEBLOCKING, pParams);
// restore values
pParams->nNeighbour[HORIZONTAL_DEBLOCKING] -= 1;
pParams->pChroma[0] -= pitch*chroma_pixel_sz;
pParams->pChroma[1] -= pitch*chroma_pixel_sz;
pParams->pitch_chroma = pitch;
}
//
// step 3. Deblock internal edges
//
{
pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 0;
// set internal edge strength
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 0, 0);
CopyEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 4, bTmp + 4);
CopyEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 8, bTmp + 8);
CopyEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 12, bTmp + 12);
// perform deblocking
(this->*pFunc)(HORIZONTAL_DEBLOCKING, pParams);
// restore strength
pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 1;
CopyEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 0, bTmp + 0);
}
} // void H264SegmentDecoder::DeblockChromaHorizontalMBAFF420(DeblockingParametersMBAFF *pParams)
void H264SegmentDecoder::DeblockChromaHorizontalMBAFF422(DeblockingParametersMBAFF *pParams)
{
Ipp8u bTmp[16];
Ipp32s pitch = pParams->pitch_chroma;
Ipp32s chroma_pixel_sz = pParams->bitDepthChroma > 8 ? 2 : 1;
ChromaDeblockingFunction pFunc = DeblockChroma[m_pCurrentFrame->m_chroma_format];
//
// chroma deblocking
//
//
// step 1. Deblock origin external edge
//
{
// save internal edges strength
CopyEdgeStrength(bTmp + 0, pParams->Strength[HORIZONTAL_DEBLOCKING] + 0);
CopyEdgeStrength(bTmp + 4, pParams->Strength[HORIZONTAL_DEBLOCKING] + 4);
CopyEdgeStrength(bTmp + 8, pParams->Strength[HORIZONTAL_DEBLOCKING] + 8);
CopyEdgeStrength(bTmp + 12, pParams->Strength[HORIZONTAL_DEBLOCKING] + 12);
// skip all internal edges
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 4, 0);
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 8, 0);
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 12, 0);
// set pitch
pParams->pitch_chroma *= 2;
// perform deblocking
(this->*pFunc)(HORIZONTAL_DEBLOCKING, pParams);
}
//
// step 2. Deblock extra external edge
//
{
// set extra edge strength
CopyEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING], pParams->StrengthExtra);
// correct neighbour MB info
pParams->nNeighbour[HORIZONTAL_DEBLOCKING] += 1;
// correct U & V pointer
pParams->pChroma[0] += pitch*chroma_pixel_sz;
pParams->pChroma[1] += pitch*chroma_pixel_sz;
// perform deblocking
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -