📄 umc_h264_segment_decoder_deblocking_mbaff.cpp
字号:
(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);
/*pParams->pChroma[0] += pParams->pitch * 4*chroma_pixel_sz;
pParams->pChroma[1] += pParams->pitch * 4*chroma_pixel_sz;
(this->*pFunc)(HORIZONTAL_DEBLOCKING, pParams);
pParams->pChroma[0] += pParams->pitch * 4*chroma_pixel_sz;
pParams->pChroma[1] += pParams->pitch * 4*chroma_pixel_sz;
(this->*pFunc)(HORIZONTAL_DEBLOCKING, pParams);
pParams->pChroma[0] -= pParams->pitch * 8*chroma_pixel_sz;
pParams->pChroma[1] -= pParams->pitch * 8*chroma_pixel_sz;*/
// restore strength
pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 1;
CopyEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 0, bTmp + 0);
}
} // void H264SegmentDecoder::DeblockChromaHorizontalMBAFF422(DeblockingParametersMBAFF *pParams)
void H264SegmentDecoder::DeblockChromaHorizontalMBAFF444(DeblockingParametersMBAFF * /*pParams*/)
{
/* the function is under development */
} // void H264SegmentDecoder::DeblockChromaHorizontalMBAFF444(DeblockingParametersMBAFF *pParams)
void H264SegmentDecoder::PrepareDeblockingParametersISliceMBAFF(DeblockingParametersMBAFF *pParams)
{
// set deblocking flag(s)
pParams->DeblockingFlag[VERTICAL_DEBLOCKING] = 1;
pParams->DeblockingFlag[HORIZONTAL_DEBLOCKING] = 1;
// fill "complex deblocking" strength
if (pParams->UseComplexVerticalDeblocking)
{
SetEdgeStrength(pParams->StrengthComplex + 0, 4);
SetEdgeStrength(pParams->StrengthComplex + 4, 4);
}
// calculate strengths
if (pParams->ExternalEdgeFlag[VERTICAL_DEBLOCKING])
{
// deblocking with strong deblocking of external edge
SetEdgeStrength(pParams->Strength[VERTICAL_DEBLOCKING] + 0, 4);
}
SetEdgeStrength(pParams->Strength[VERTICAL_DEBLOCKING] + 4, 3);
SetEdgeStrength(pParams->Strength[VERTICAL_DEBLOCKING] + 8, 3);
SetEdgeStrength(pParams->Strength[VERTICAL_DEBLOCKING] + 12, 3);
if (pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING])
{
if ((GetMBFieldDecodingFlag(m_gmbinfo->mbs[pParams->nMBAddr])) ||
(pParams->ExtraHorizontalEdge))
{
// deblocking field macroblock with external edge
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 0, 3);
}
else
{
// deblocking with strong deblocking of external edge
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 0, 4);
}
}
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 4, 3);
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 8, 3);
SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 12, 3);
if (pParams->ExtraHorizontalEdge)
{
// set extra edge strength
SetEdgeStrength(pParams->StrengthExtra + 0, 3);
SetEdgeStrength(pParams->StrengthExtra + 4, 0);
SetEdgeStrength(pParams->StrengthExtra + 8, 0);
SetEdgeStrength(pParams->StrengthExtra + 12, 0);
}
} // void H264SegmentDecoder::PrepareDeblockingParametersISliceMBAFF(DeblockingParametersMBAFF *pParams)
void H264SegmentDecoder::PrepareDeblockingParametersPSliceMBAFF(DeblockingParametersMBAFF *pParams)
{
Ipp32s mbtype = (m_gmbinfo->mbs + pParams->nMBAddr)->mbtype;
Ipp32s nAboveMBFieldCoded = 0;
// when this macroblock is intra coded
if (IS_INTRA_MBTYPE(mbtype))
{
PrepareDeblockingParametersISliceMBAFF(pParams);
return;
}
if (pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING])
nAboveMBFieldCoded = GetMBFieldDecodingFlag(m_gmbinfo->mbs[pParams->nNeighbour[HORIZONTAL_DEBLOCKING]]);
// when there are no special cases
if ((0 == nAboveMBFieldCoded) &&
(0 == pParams->MBFieldCoded) &&
(0 == pParams->UseComplexVerticalDeblocking))
{
// prepare whole macroblock parameters
PrepareDeblockingParametersPSlice(pParams);
return;
}
// when current macroblock is frame coded
if (0 == pParams->MBFieldCoded)
{
// prepare "complex vertical deblocking" parameters
if (pParams->UseComplexVerticalDeblocking)
PrepareDeblockingParametersPSlice4MBAFFComplexFrameExternalEdge(pParams);
// fill vertical edges parameters
PrepareDeblockingParametersPSlice4(VERTICAL_DEBLOCKING, pParams);
// fill extra edge parameters
if (pParams->ExtraHorizontalEdge)
{
// set correct above neighbour
pParams->nNeighbour[HORIZONTAL_DEBLOCKING] += 1;
// obtain parameters
PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(pParams);
// restore above neighbour
pParams->nNeighbour[HORIZONTAL_DEBLOCKING] -= 1;
// copy parameters to right place
CopyEdgeStrength(pParams->StrengthExtra, pParams->Strength[HORIZONTAL_DEBLOCKING]);
// fill horizontal edges parameters
PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(pParams);
pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 0;
PrepareDeblockingParametersPSlice4(HORIZONTAL_DEBLOCKING, pParams);
pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 1;
}
else
PrepareDeblockingParametersPSlice4(HORIZONTAL_DEBLOCKING, pParams);
}
// when current macroblock is field coded
else
{
// prepare "complex vertical deblocking" parameters
if (pParams->UseComplexVerticalDeblocking)
PrepareDeblockingParametersPSlice4MBAFFComplexFieldExternalEdge(pParams);
// fill vertical edges parameters
PrepareDeblockingParametersPSlice4MBAFFField(VERTICAL_DEBLOCKING, pParams);
// when above macroblock is frame coded
if ((nAboveMBFieldCoded != pParams->MBFieldCoded) &&
(pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING]))
{
PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(pParams);
pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 0;
PrepareDeblockingParametersPSlice4MBAFFField(HORIZONTAL_DEBLOCKING, pParams);
pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 1;
}
else
PrepareDeblockingParametersPSlice4MBAFFField(HORIZONTAL_DEBLOCKING, pParams);
}
} // void H264SegmentDecoder::PrepareDeblockingParametersPSliceMBAFF(DeblockingParametersMBAFF *pParams)
void H264SegmentDecoder::PrepareDeblockingParametersBSliceMBAFF(DeblockingParametersMBAFF *pParams)
{
Ipp32s mbtype = (m_gmbinfo->mbs + pParams->nMBAddr)->mbtype;
Ipp32s nAboveMBFieldCoded = 0;
// when this macroblock is intra coded
if (IS_INTRA_MBTYPE(mbtype))
{
PrepareDeblockingParametersISliceMBAFF(pParams);
return;
}
if (pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING])
nAboveMBFieldCoded = GetMBFieldDecodingFlag(m_gmbinfo->mbs[pParams->nNeighbour[HORIZONTAL_DEBLOCKING]]);
// when there are no special cases
if ((0 == nAboveMBFieldCoded) &&
(0 == pParams->MBFieldCoded) &&
(0 == pParams->UseComplexVerticalDeblocking))
{
// prepare whole macroblock parameters
PrepareDeblockingParametersBSlice(pParams);
return;
}
// when current macroblock is frame coded
if (0 == pParams->MBFieldCoded)
{
// prepare "complex vertical deblocking" parameters
if (pParams->UseComplexVerticalDeblocking)
PrepareDeblockingParametersPSlice4MBAFFComplexFrameExternalEdge(pParams);
// fill vertical edges parameters
PrepareDeblockingParametersBSlice4(VERTICAL_DEBLOCKING, pParams);
// fill extra edge parameters
if (pParams->ExtraHorizontalEdge)
{
// set correct above neighbour
pParams->nNeighbour[HORIZONTAL_DEBLOCKING] += 1;
// obtain parameters
PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(pParams);
// restore above neighbour
pParams->nNeighbour[HORIZONTAL_DEBLOCKING] -= 1;
// copy parameters to right place
CopyEdgeStrength(pParams->StrengthExtra, pParams->Strength[HORIZONTAL_DEBLOCKING]);
// fill horizontal edges parameters
PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(pParams);
pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 0;
PrepareDeblockingParametersBSlice4(HORIZONTAL_DEBLOCKING, pParams);
pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 1;
}
else
PrepareDeblockingParametersBSlice4(HORIZONTAL_DEBLOCKING, pParams);
}
// when current macroblock is field coded
else
{
// prepare "complex vertical deblocking" parameters
if (pParams->UseComplexVerticalDeblocking)
PrepareDeblockingParametersPSlice4MBAFFComplexFieldExternalEdge(pParams);
// fill vertical edges parameters
PrepareDeblockingParametersBSlice4MBAFFField(VERTICAL_DEBLOCKING, pParams);
// when above macroblock is frame coded
if ((nAboveMBFieldCoded != pParams->MBFieldCoded) &&
(pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING]))
{
PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(pParams);
pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 0;
PrepareDeblockingParametersBSlice4MBAFFField(HORIZONTAL_DEBLOCKING, pParams);
pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 1;
}
else
PrepareDeblockingParametersBSlice4MBAFFField(HORIZONTAL_DEBLOCKING, pParams);
}
} // void H264SegmentDecoder::PrepareDeblockingParametersBSliceMBAFF(DeblockingParametersMBAFF *pParams)
void H264SegmentDecoder::PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(DeblockingParameters *pParams)
{
Ipp32s MBAddr = pParams->nMBAddr;
Ipp32u cbp4x4_luma = (m_mbinfo.mbs + MBAddr)->cbp4x4_luma;
Ipp8u *pStrength = pParams->Strength[HORIZONTAL_DEBLOCKING];
Ipp32s nNeighbour;
//
// external edge
//
// mixed edge is always deblocked
{
Ipp32s *pDeblockingFlag = &(pParams->DeblockingFlag[HORIZONTAL_DEBLOCKING]);
*pDeblockingFlag = 1;
}
// select neighbour addres
nNeighbour = pParams->nNeighbour[HORIZONTAL_DEBLOCKING];
// when neighbour macroblock isn't intra
if (!IS_INTRA_MBTYPE((m_gmbinfo->mbs + nNeighbour)->mbtype))
{
H264DecoderMacroblockLocalInfo *pNeighbour;
Ipp32s idx;
// select neighbour
pNeighbour = m_mbinfo.mbs + nNeighbour;
// cicle on blocks
for (idx = 0;idx < 4;idx += 1)
{
Ipp32s blkQ, blkP;
blkQ = EXTERNAL_BLOCK_MASK[HORIZONTAL_DEBLOCKING][CURRENT_BLOCK][idx];
blkP = EXTERNAL_BLOCK_MASK[HORIZONTAL_DEBLOCKING][NEIGHBOUR_BLOCK][idx];
// when one of couple of blocks has coeffs
if ((cbp4x4_luma & blkQ) ||
(pNeighbour->cbp4x4_luma & blkP))
pStrength[idx] = 2;
// when blocks nave no coeffs
// we set strength is 1 in mixed mode
else
pStrength[idx] = 1;
}
}
// external edge required in strong filtering
else
SetEdgeStrength(pStrength + 0, 3);
} // void H264SegmentDecoder::PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(DeblockingParameters *pParams)
void H264SegmentDecoder::PrepareDeblockingParametersPSlice4MBAFFComplexFrameExternalEdge(DeblockingParametersMBAFF *pParams)
{
Ipp32s MBAddr = pParams->nMBAddr;
Ipp32u cbp4x4_luma = (m_mbinfo.mbs + MBAddr)->cbp4x4_luma;
Ipp8u *pStrength = pParams->StrengthComplex;
Ipp32s i, nNeighbourBlockInc;
// mixed edge is always deblocked
{
Ipp32s *pDeblockingFlag = &(pParams->DeblockingFlag[VERTICAL_DEBLOCKING]);
*pDeblockingFlag = 1;
}
// calculate neighbour block addition
nNeighbourBlockInc = (pParams->nMBAddr & 1) ? 2 : 0;
// we fill parameters using 2 passes
for (i = 0;i < 2;i += 1)
{
Ipp32s nNeighbour;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -