📄 umc_h264_segment_decoder_mt_reconstruct_mv.cpp
字号:
void H264SegmentDecoderMultiThreaded::ReconstructMVPredictorLeftBlock(Ipp32s iListNum,
Ipp32s iRowNum,
H264DecoderBlockLocation mbAddrC,
H264DecoderMotionVector *pPred)
{
H264DecoderBlockLocation mbAddrA;
// get neighbouring addresses
mbAddrA = m_cur_mb.CurrentBlockNeighbours.mbs_left[iRowNum];
if (-1 == mbAddrC.mb_num)
mbAddrC = m_cur_mb.CurrentBlockNeighbours.mbs_left[iRowNum - 1];
// if one and only on of the reference indixes is equal to
// the current reference index, use owning it partition
{
H264DecoderMacroblockRefIdxs *pRefIdcs = m_gmbinfo->RefIdxs[iListNum];
Ipp8s *pCurRefIdcs = m_cur_mb.RefIdxs[iListNum]->RefIdxs;
Ipp32s curRefIdx = pCurRefIdcs[iRowNum * 4];
Ipp32s refIdxA, refIdxB, refIdxC;
Ipp32s iEqual;
refIdxA = (-1 != mbAddrA.mb_num) ? (pRefIdcs[mbAddrA.mb_num].RefIdxs[mbAddrA.block_num]) : (-1);
refIdxB = pCurRefIdcs[iRowNum * 4 - 4];
refIdxC = (-1 != mbAddrC.mb_num) ? (pRefIdcs[mbAddrC.mb_num].RefIdxs[mbAddrC.block_num]) : (-1);
iEqual = 0;
iEqual += (curRefIdx == refIdxA) ? (1) : (0);
iEqual += (curRefIdx == refIdxB) ? (1) : (0);
iEqual += (curRefIdx == refIdxC) ? (1) : (0);
if (1 == iEqual)
{
H264DecoderMacroblockMVs *pMVs;
pMVs = m_gmbinfo->MV[iListNum];
if (curRefIdx == refIdxA)
*pPred = pMVs[mbAddrA.mb_num].MotionVectors[mbAddrA.block_num];
else if (curRefIdx == refIdxB)
*pPred = pMVs[m_CurMBAddr].MotionVectors[iRowNum * 4 - 4];
else
*pPred = pMVs[mbAddrC.mb_num].MotionVectors[mbAddrC.block_num];
return;
}
}
// there is true median of A, B and C partition
{
H264DecoderMotionVector mvA, mvB, mvC;
{
H264DecoderMacroblockMVs *pMVs = m_gmbinfo->MV[iListNum];
static H264DecoderMotionVector mvZero = {0, 0};
mvA = (-1 != mbAddrA.mb_num) ? (pMVs[mbAddrA.mb_num].MotionVectors[mbAddrA.block_num]) : (mvZero);
mvB = m_cur_mb.MVs[iListNum]->MotionVectors[iRowNum * 4 - 4];
mvC = (-1 != mbAddrC.mb_num) ? (pMVs[mbAddrC.mb_num].MotionVectors[mbAddrC.block_num]) : (mvZero);
}
pPred->mvx = MEDIAN_OF_3(mvA.mvx, mvB.mvx, mvC.mvx);
pPred->mvy = MEDIAN_OF_3(mvA.mvy, mvB.mvy, mvC.mvy);
}
} // void H264SegmentDecoderMultiThreaded::ReconstructMVPredictorLeftBlock(Ipp32s iListNum,
void H264SegmentDecoderMultiThreaded::ReconstructMVPredictorLeftBlockFewCheckRef(Ipp32s iListNum,
Ipp32s iRowNum,
H264DecoderMotionVector *pPred)
{
H264DecoderBlockLocation mbAddrA;
// get neighbouring addresses
mbAddrA = m_cur_mb.CurrentBlockNeighbours.mbs_left[iRowNum];
// if one and only on of the reference indixes is equal to
// the current reference index, use owning it partition
{
H264DecoderMacroblockRefIdxs *pRefIdcs = m_gmbinfo->RefIdxs[iListNum];
Ipp8s *pCurRefIdcs = m_cur_mb.RefIdxs[iListNum]->RefIdxs;
Ipp32s curRefIdx = pCurRefIdcs[iRowNum * 4];
Ipp32s refIdxA, refIdxB;
refIdxA = (-1 != mbAddrA.mb_num) ? (pRefIdcs[mbAddrA.mb_num].RefIdxs[mbAddrA.block_num]) : (-1);
refIdxB = pCurRefIdcs[iRowNum * 4 - 4];
// we check only A reference for equality, because of
// both upper references have the same reference
if ((refIdxA == curRefIdx) &&
(refIdxB != curRefIdx))
{
H264DecoderMacroblockMVs *pMVs;
pMVs = m_gmbinfo->MV[iListNum];
*pPred = pMVs[mbAddrA.mb_num].MotionVectors[mbAddrA.block_num];
return;
}
}
// there is true median of A, B and C partition
{
H264DecoderMotionVector mvA, mvB, mvC;
{
H264DecoderMacroblockMVs *pMVs = m_gmbinfo->MV[iListNum];
static H264DecoderMotionVector mvZero = {0, 0};
mvA = (-1 != mbAddrA.mb_num) ? (pMVs[mbAddrA.mb_num].MotionVectors[mbAddrA.block_num]) : (mvZero);
mvB = m_cur_mb.MVs[iListNum]->MotionVectors[iRowNum * 4 - 4];
mvC = m_cur_mb.MVs[iListNum]->MotionVectors[iRowNum * 4 - 3];
}
pPred->mvx = MEDIAN_OF_3(mvA.mvx, mvB.mvx, mvC.mvx);
pPred->mvy = MEDIAN_OF_3(mvA.mvy, mvB.mvy, mvC.mvy);
}
} // void H264SegmentDecoderMultiThreaded::ReconstructMVPredictorLeftBlockFewCheckRef(Ipp32s iListNum,
void H264SegmentDecoderMultiThreaded::ReconstructMVPredictorInternalBlock(Ipp32s iListNum,
Ipp32s iBlockNum,
Ipp32s iAddrC,
H264DecoderMotionVector *pPred)
{
// if one and only on of the reference indixes is equal to
// the current reference index, use owning it partition
{
Ipp8s *pCurRefIdcs = m_cur_mb.RefIdxs[iListNum]->RefIdxs;
Ipp32s curRefIdx = pCurRefIdcs[iBlockNum];
Ipp32s refIdxA, refIdxB, refIdxC;
Ipp32s iEqual;
refIdxA = pCurRefIdcs[iBlockNum - 1];
refIdxB = pCurRefIdcs[iBlockNum - 4];
refIdxC = pCurRefIdcs[iAddrC];
iEqual = 0;
iEqual += (curRefIdx == refIdxA) ? (1) : (0);
iEqual += (curRefIdx == refIdxB) ? (1) : (0);
iEqual += (curRefIdx == refIdxC) ? (1) : (0);
if (1 == iEqual)
{
H264DecoderMotionVector *pMVs;
pMVs = m_cur_mb.MVs[iListNum]->MotionVectors;
if (curRefIdx == refIdxA)
*pPred = pMVs[iBlockNum - 1];
else if (curRefIdx == refIdxB)
*pPred = pMVs[iBlockNum - 4];
else
*pPred = pMVs[iAddrC];
return;
}
}
// there is true median of A, B and C partition
{
H264DecoderMotionVector mvA, mvB, mvC;
{
H264DecoderMotionVector *pMVs = m_cur_mb.MVs[iListNum]->MotionVectors;
mvA = pMVs[iBlockNum - 1];
mvB = pMVs[iBlockNum - 4];
mvC = pMVs[iAddrC];
}
pPred->mvx = MEDIAN_OF_3(mvA.mvx, mvB.mvx, mvC.mvx);
pPred->mvy = MEDIAN_OF_3(mvA.mvy, mvB.mvy, mvC.mvy);
}
} // void H264SegmentDecoderMultiThreaded::ReconstructMVPredictorInternalBlock(Ipp32s iListNum,
void H264SegmentDecoderMultiThreaded::ReconstructMVPredictorInternalBlockFewCheckRef(Ipp32s iListNum,
Ipp32s iBlockNum,
Ipp32s iAddrC,
H264DecoderMotionVector *pPred)
{
// if one and only on of the reference indixes is equal to
// the current reference index, use owning it partition
{
Ipp8s *pCurRefIdcs = m_cur_mb.RefIdxs[iListNum]->RefIdxs;
Ipp32s curRefIdx = pCurRefIdcs[iBlockNum];
Ipp32s refIdxA, refIdxB;
refIdxA = pCurRefIdcs[iBlockNum - 1];
refIdxB = pCurRefIdcs[iBlockNum - 4];
// we check only A reference for equality, because of
// both upper references have the same reference
if ((refIdxA == curRefIdx) &&
(refIdxB != curRefIdx))
{
H264DecoderMotionVector *pMVs;
pMVs = m_cur_mb.MVs[iListNum]->MotionVectors;
*pPred = pMVs[iBlockNum - 1];
return;
}
}
// there is true median of A, B and C partition
{
H264DecoderMotionVector mvA, mvB, mvC;
{
H264DecoderMotionVector *pMVs = m_cur_mb.MVs[iListNum]->MotionVectors;
mvA = pMVs[iBlockNum - 1];
mvB = pMVs[iBlockNum - 4];
mvC = pMVs[iAddrC];
}
pPred->mvx = MEDIAN_OF_3(mvA.mvx, mvB.mvx, mvC.mvx);
pPred->mvy = MEDIAN_OF_3(mvA.mvy, mvB.mvy, mvC.mvy);
}
} // void H264SegmentDecoderMultiThreaded::ReconstructMVPredictorInternalBlockFewCheckRef(Ipp32s iListNum,
void H264SegmentDecoderMultiThreaded::ReconstructMVPredictorInternalBlockNoCheckRef(Ipp32s iListNum,
Ipp32s iBlockNum,
H264DecoderMotionVector *pPred)
{
// there is true median of A, B and C partition
{
H264DecoderMotionVector mvA, mvB, mvC;
{
H264DecoderMotionVector *pMVs = m_cur_mb.MVs[iListNum]->MotionVectors;
mvA = pMVs[iBlockNum - 1];
mvB = pMVs[iBlockNum - 4];
mvC = pMVs[iBlockNum - 5];
}
pPred->mvx = MEDIAN_OF_3(mvA.mvx, mvB.mvx, mvC.mvx);
pPred->mvy = MEDIAN_OF_3(mvA.mvy, mvB.mvy, mvC.mvy);
}
} // void H264SegmentDecoderMultiThreaded::ReconstructMVPredictorInternalBlockNoCheckRef(Ipp32s iListNum,
void H264SegmentDecoderMultiThreaded::ReconstructMVPredictor16x16(Ipp32s iListNum,
H264DecoderMotionVector *pPred)
{
H264DecoderBlockLocation mbAddrC;
mbAddrC = m_cur_mb.CurrentBlockNeighbours.mb_above_right;
ReconstructMVPredictorExternalBlock(iListNum, mbAddrC, pPred);
} // void H264SegmentDecoderMultiThreaded::ReconstructMVPredictor16x16(Ipp32s iListNum,
void H264SegmentDecoderMultiThreaded::ReconstructMVPredictor16x8(Ipp32s iListNum,
Ipp32s iSubBlockNum,
H264DecoderMotionVector *pPred)
{
// check the fast condition
if (0 == iSubBlockNum)
{
// do special case of prediction
{
H264DecoderBlockLocation mbAddrB;
mbAddrB = m_cur_mb.CurrentBlockNeighbours.mb_above;
if (-1 != mbAddrB.mb_num)
{
H264DecoderMacroblockRefIdxs *pRefIdcs = m_gmbinfo->RefIdxs[iListNum];
Ipp32s refIdxB = pRefIdcs[mbAddrB.mb_num].RefIdxs[mbAddrB.block_num];
Ipp32s curRefIdx = m_cur_mb.RefIdxs[iListNum]->RefIdxs[0];
if (refIdxB == curRefIdx)
{
H264DecoderMacroblockMVs *pMVs;
pMVs = m_gmbinfo->MV[iListNum];
*pPred = pMVs[mbAddrB.mb_num].MotionVectors[mbAddrB.block_num];
return;
}
}
}
// do common median prediction
{
H264DecoderBlockLocation mbAddrC;
mbAddrC = m_cur_mb.CurrentBlockNeighbours.mb_above_right;
ReconstructMVPredictorExternalBlock(iListNum,
mbAddrC,
pPred);
}
}
else
{
// do special case of prediction
{
H264DecoderBlockLocation mbAddrA;
mbAddrA = m_cur_mb.CurrentBlockNeighbours.mbs_left[2];
if (-1 != mbAddrA.mb_num)
{
H264DecoderMacroblockRefIdxs *pRefIdcs = m_gmbinfo->RefIdxs[iListNum];
Ipp32s refIdxA = pRefIdcs[mbAddrA.mb_num].RefIdxs[mbAddrA.block_num];
Ipp32s curRefIdx = m_cur_mb.RefIdxs[iListNum]->RefIdxs[8];
if (refIdxA == curRefIdx)
{
H264DecoderMacroblockMVs *pMVs;
pMVs = m_gmbinfo->MV[iListNum];
*pPred = pMVs[mbAddrA.mb_num].MotionVectors[mbAddrA.block_num];
return;
}
}
}
// do common median prediction
{
H264DecoderBlockLocation mbAddrC;
mbAddrC.mb_num = -1;/*m_cur_mb.CurrentBlockNeighbours.mbs_left[1];*/
ReconstructMVPredictorLeftBlock(iListNum,
2,
mbAddrC,
pPred);
}
}
} // void H264SegmentDecoderMultiThreaded::ReconstructMVPredictor16x8(Ipp32s iListNum,
void H264SegmentDecoderMultiThreaded::ReconstructMVPredictor8x16(Ipp32s iListNum,
Ipp32s iSubBlockNum,
H264DecoderMotionVector *pPred)
{
// check the fast condition
if (0 == iSubBlockNum)
{
// do special case of prediction
{
H264DecoderBlockLocation mbAddrA;
mbAddrA = m_cur_mb.CurrentBlockNeighbours.mbs_left[0];
if (-1 != mbAddrA.mb_num)
{
H264DecoderMacroblockRefIdxs *pRefIdcs = m_gmbinfo->RefIdxs[iListNum];
Ipp32s refIdxA = pRefIdcs[mbAddrA.mb_num].RefIdxs[mbAddrA.block_num];
Ipp32s curRefIdx = m_cur_mb.RefIdxs[iListNum]->RefIdxs[0];
if (refIdxA == curRefIdx)
{
H264DecoderMacroblockMVs *pMVs;
pMVs = m_gmbinfo->MV[iListNum];
*pPred = pMVs[mbAddrA.mb_num].MotionVectors[mbAddrA.block_num];
return;
}
}
}
// do common media prediction
{
H264DecoderBlockLocation mbAddrC;
mbAddrC = m_cur_mb.CurrentBlockNeighbours.mb_above;
mbAddrC.block_num += 2;
ReconstructMVPredictorExternalBlock(iListNum,
mbAddrC,
pPred);
}
}
else
{
H264DecoderBlockLocation mbAddrC;
mbAddrC = m_cur_mb.CurrentBlockNeighbours.mb_above_right;
if (-1 == mbAddrC.mb_num)
{
mbAddrC = m_cur_mb.CurrentBlockNeighbours.mb_above;
mbAddrC.block_num += 1;
}
if (-1 != mbAddrC.mb_num)
{
H264DecoderMacroblockRefIdxs *pRefIdcs = m_gmbinfo->RefIdxs[iListNum];
Ipp32s refIdxC = pRefIdcs[mbAddrC.mb_num].RefIdxs[mbAddrC.block_num];
Ipp32s curRefIdx = m_cur_mb.RefIdxs[iListNum]->RefIdxs[2];
if (refIdxC == curRefIdx)
{
H264DecoderMacroblockMVs *pMVs;
pMVs = m_gmbinfo->MV[iListNum];
*pPred = pMVs[mbAddrC.mb_num].MotionVectors[mbAddrC.block_num];
return;
}
}
ReconstructMVPredictorTopBlock(iListNum,
2,
mbAddrC,
pPred);
}
} // void H264SegmentDecoderMultiThreaded::ReconstructMVPredictor8x16(Ipp32s iListNum,
} // namespace UMC
#endif // UMC_ENABLE_H264_VIDEO_DECODER
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -