?? mc.cpp
字號(hào):
blkX = x + BLOCK_SIZE *2;
blkY = y + BLOCK_SIZE *2;
motionComp(pc_block16x16, ppxlcRefLeftTop,
(BLOCK_SIZE *2),
x * 2 + pmv8->trueMVHalfPel_x2 ().x,
y * 2 + pmv8->trueMVHalfPel_x2 ().y,
m_vopmd.iRoundingControl,
prctMVLimit);
writeCubicRct(BLOCK_SIZE *2, MB_SIZE *2,
pc_block16x16, ppxlcPredMB);
pmv8++;
motionComp(pc_block16x16, ppxlcRefLeftTop,
(BLOCK_SIZE *2),
blkX * 2 + pmv8->trueMVHalfPel_x2 ().x,
y * 2 + pmv8->trueMVHalfPel_x2 ().y,
m_vopmd.iRoundingControl,
prctMVLimit);
writeCubicRct(BLOCK_SIZE *2, MB_SIZE *2,
pc_block16x16, ppxlcPredMB +(BLOCK_SIZE *2));
pmv8++;
motionComp(pc_block16x16, ppxlcRefLeftTop,
(BLOCK_SIZE *2),
x * 2 + pmv8->trueMVHalfPel_x2 ().x,
blkY * 2 + pmv8->trueMVHalfPel_x2 ().y,
m_vopmd.iRoundingControl,
prctMVLimit);
writeCubicRct(BLOCK_SIZE *2, MB_SIZE *2,
pc_block16x16, ppxlcPredMB +(MB_SIZE * MB_SIZE *2));
pmv8++;
motionComp(pc_block16x16, ppxlcRefLeftTop,
(BLOCK_SIZE *2),
blkX * 2 + pmv8->trueMVHalfPel_x2 ().x,
blkY * 2 + pmv8->trueMVHalfPel_x2 ().y,
m_vopmd.iRoundingControl,
prctMVLimit);
writeCubicRct(BLOCK_SIZE *2, MB_SIZE *2,
pc_block16x16, ppxlcPredMB +(MB_SIZE * MB_SIZE *2) +(BLOCK_SIZE *2));
}
else // !RRV
{
blkX = x + BLOCK_SIZE;
blkY = y + BLOCK_SIZE;
if (pmbmd->m_rgTranspStatus [Y_BLOCK1] != ALL)
if (m_volmd.bQuarterSample) // Quarter sample
motionCompQuarterSample (ppxlcPredMB, ppxlcRefLeftTop, BLOCK_SIZE,
x * 4 + 2 * pmv8->iMVX + pmv8->iHalfX,
y * 4 + 2 * pmv8->iMVY + pmv8->iHalfY,
m_vopmd.iRoundingControl, prctMVLimit);
else
motionComp (
ppxlcPredMB, ppxlcRefLeftTop,
BLOCK_SIZE,
x * 2 + pmv8->trueMVHalfPel ().x,
y * 2 + pmv8->trueMVHalfPel ().y,
m_vopmd.iRoundingControl,
prctMVLimit
);
pmv8++;
if (pmbmd->m_rgTranspStatus [Y_BLOCK2] != ALL)
if (m_volmd.bQuarterSample) // Quarter sample
motionCompQuarterSample (ppxlcPredMB + OFFSET_BLK1,
ppxlcRefLeftTop, BLOCK_SIZE,
blkX * 4 + 2 * pmv8->iMVX + pmv8->iHalfX,
y * 4 + 2 * pmv8->iMVY + pmv8->iHalfY,
m_vopmd.iRoundingControl, prctMVLimit);
else
motionComp (
ppxlcPredMB + OFFSET_BLK1, ppxlcRefLeftTop,
BLOCK_SIZE,
blkX * 2 + pmv8->trueMVHalfPel ().x,
y * 2 + pmv8->trueMVHalfPel ().y,
m_vopmd.iRoundingControl,
prctMVLimit
);
pmv8++;
if (pmbmd->m_rgTranspStatus [Y_BLOCK3] != ALL)
if (m_volmd.bQuarterSample) // Quarter sample
motionCompQuarterSample (ppxlcPredMB + OFFSET_BLK2,
ppxlcRefLeftTop, BLOCK_SIZE,
x * 4 + 2 * pmv8->iMVX + pmv8->iHalfX,
blkY * 4 + 2 * pmv8->iMVY + pmv8->iHalfY,
m_vopmd.iRoundingControl, prctMVLimit);
else
motionComp (
ppxlcPredMB + OFFSET_BLK2, ppxlcRefLeftTop,
BLOCK_SIZE,
x * 2 + pmv8->trueMVHalfPel ().x,
blkY * 2 + pmv8->trueMVHalfPel ().y,
m_vopmd.iRoundingControl,
prctMVLimit
);
pmv8++;
if (pmbmd->m_rgTranspStatus [Y_BLOCK4] != ALL)
if (m_volmd.bQuarterSample) // Quarter sample
motionCompQuarterSample (ppxlcPredMB + OFFSET_BLK3,
ppxlcRefLeftTop, BLOCK_SIZE,
blkX * 4 + 2 * pmv8->iMVX + pmv8->iHalfX,
blkY * 4 + 2 * pmv8->iMVY + pmv8->iHalfY,
m_vopmd.iRoundingControl, prctMVLimit);
else
motionComp (
ppxlcPredMB + OFFSET_BLK3, ppxlcRefLeftTop,
BLOCK_SIZE,
blkX * 2 + pmv8->trueMVHalfPel ().x,
blkY * 2 + pmv8->trueMVHalfPel ().y,
m_vopmd.iRoundingControl,
prctMVLimit
);
}
// CoordI blkX = x + BLOCK_SIZE;
// CoordI blkY = y + BLOCK_SIZE;
// if (pmbmd->m_rgTranspStatus [Y_BLOCK1] != ALL)
// if (m_volmd.bQuarterSample) // Quarter sample
// motionCompQuarterSample (ppxlcPredMB, ppxlcRefLeftTop, BLOCK_SIZE,
// x * 4 + 2 * pmv8->iMVX + pmv8->iHalfX,
// y * 4 + 2 * pmv8->iMVY + pmv8->iHalfY,
// m_vopmd.iRoundingControl, prctMVLimit);
// else
// motionComp (
// ppxlcPredMB, ppxlcRefLeftTop,
// BLOCK_SIZE,
// x * 2 + pmv8->trueMVHalfPel ().x,
// y * 2 + pmv8->trueMVHalfPel ().y,
// m_vopmd.iRoundingControl,
// prctMVLimit
// );
// pmv8++;
// if (pmbmd->m_rgTranspStatus [Y_BLOCK2] != ALL)
// if (m_volmd.bQuarterSample) // Quarter sample
// motionCompQuarterSample (ppxlcPredMB + OFFSET_BLK1,
// ppxlcRefLeftTop, BLOCK_SIZE,
// blkX * 4 + 2 * pmv8->iMVX + pmv8->iHalfX,
// y * 4 + 2 * pmv8->iMVY + pmv8->iHalfY,
// m_vopmd.iRoundingControl, prctMVLimit);
// else
// motionComp (
// ppxlcPredMB + OFFSET_BLK1, ppxlcRefLeftTop,
// BLOCK_SIZE,
// blkX * 2 + pmv8->trueMVHalfPel ().x,
// y * 2 + pmv8->trueMVHalfPel ().y,
// m_vopmd.iRoundingControl,
// prctMVLimit
// );
// pmv8++;
// if (pmbmd->m_rgTranspStatus [Y_BLOCK3] != ALL)
// if (m_volmd.bQuarterSample) // Quarter sample
// motionCompQuarterSample (ppxlcPredMB + OFFSET_BLK2,
// ppxlcRefLeftTop, BLOCK_SIZE,
// x * 4 + 2 * pmv8->iMVX + pmv8->iHalfX,
// blkY * 4 + 2 * pmv8->iMVY + pmv8->iHalfY,
// m_vopmd.iRoundingControl, prctMVLimit);
// else
// motionComp (
// ppxlcPredMB + OFFSET_BLK2, ppxlcRefLeftTop,
// BLOCK_SIZE,
// x * 2 + pmv8->trueMVHalfPel ().x,
// blkY * 2 + pmv8->trueMVHalfPel ().y,
// m_vopmd.iRoundingControl,
// prctMVLimit
// );
// pmv8++;
// if (pmbmd->m_rgTranspStatus [Y_BLOCK4] != ALL)
// if (m_volmd.bQuarterSample) // Quarter sample
// motionCompQuarterSample (ppxlcPredMB + OFFSET_BLK3,
// ppxlcRefLeftTop, BLOCK_SIZE,
// blkX * 4 + 2 * pmv8->iMVX + pmv8->iHalfX,
// blkY * 4 + 2 * pmv8->iMVY + pmv8->iHalfY,
// m_vopmd.iRoundingControl, prctMVLimit);
// else
// motionComp (
// ppxlcPredMB + OFFSET_BLK3, ppxlcRefLeftTop,
// BLOCK_SIZE,
// blkX * 2 + pmv8->trueMVHalfPel ().x,
// blkY * 2 + pmv8->trueMVHalfPel ().y,
// m_vopmd.iRoundingControl,
// prctMVLimit
// );
// ~RRV
}
}
// RRV insertion
if(m_vopmd.RRVmode.iRRVOnOff == 1)
{
delete pc_block16x16;
}
// ~RRV
}
Void CVideoObject::motionComp (
PixelC* ppxlcPred, // can be either Y or A
const PixelC* ppxlcRefLeftTop, // point to left-top of the frame
Int iSize, // either MB or BLOCK size
CoordI xRef, CoordI yRef, // x + mvX, in half pel unit
Int iRoundingControl,
CRct *prctMVLimit // extended bounding box
)
{
CoordI ix, iy;
limitMVRangeToExtendedBBHalfPel(xRef,yRef,prctMVLimit,iSize);
const PixelC* ppxlcRef =
ppxlcRefLeftTop +
((yRef >> 1) + EXPANDY_REF_FRAME) * m_iFrameWidthY + (xRef >> 1) + EXPANDY_REF_FRAME;
if(iSize==8 || iSize==16)
{
// optimisation
if (!(yRef & 1)) {
if (!(xRef & 1)) {
Int iSz = iSize * sizeof(PixelC);
for(iy = 0; iy < iSize; iy+=8)
{
memcpy (ppxlcPred, ppxlcRef, iSz);
ppxlcRef += m_iFrameWidthY; ppxlcPred += MB_SIZE;
memcpy (ppxlcPred, ppxlcRef, iSz);
ppxlcRef += m_iFrameWidthY; ppxlcPred += MB_SIZE;
memcpy (ppxlcPred, ppxlcRef, iSz);
ppxlcRef += m_iFrameWidthY; ppxlcPred += MB_SIZE;
memcpy (ppxlcPred, ppxlcRef, iSz);
ppxlcRef += m_iFrameWidthY; ppxlcPred += MB_SIZE;
memcpy (ppxlcPred, ppxlcRef, iSz);
ppxlcRef += m_iFrameWidthY; ppxlcPred += MB_SIZE;
memcpy (ppxlcPred, ppxlcRef, iSz);
ppxlcRef += m_iFrameWidthY; ppxlcPred += MB_SIZE;
memcpy (ppxlcPred, ppxlcRef, iSz);
ppxlcRef += m_iFrameWidthY; ppxlcPred += MB_SIZE;
memcpy (ppxlcPred, ppxlcRef, iSz);
ppxlcRef += m_iFrameWidthY; ppxlcPred += MB_SIZE;
}
}
else {
PixelC pxlcT1,pxlcT2, *ppxlcDst;
const PixelC *ppxlcSrc;
Int iRndCtrl = 1 - iRoundingControl;
for (iy = 0; iy < iSize; iy++){
ppxlcDst = ppxlcPred;
ppxlcSrc = ppxlcRef;
for (ix = 0; ix < iSize; ix+=8) {
ppxlcDst [0] = (ppxlcSrc[0] + (pxlcT1=ppxlcSrc[1]) + iRndCtrl) >> 1;
ppxlcDst [1] = (pxlcT1 + (pxlcT2=ppxlcSrc[2]) + iRndCtrl) >> 1;
ppxlcDst [2] = (pxlcT2 + (pxlcT1=ppxlcSrc[3]) + iRndCtrl) >> 1;
ppxlcDst [3] = (pxlcT1 + (pxlcT2=ppxlcSrc[4]) + iRndCtrl) >> 1;
ppxlcDst [4] = (pxlcT2 + (pxlcT1=ppxlcSrc[5]) + iRndCtrl) >> 1;
ppxlcDst [5] = (pxlcT1 + (pxlcT2=ppxlcSrc[6]) + iRndCtrl) >> 1;
ppxlcDst [6] = (pxlcT2 + (pxlcT1=ppxlcSrc[7]) + iRndCtrl) >> 1;
ppxlcDst [7] = (pxlcT1 + ppxlcSrc[8] + iRndCtrl) >> 1;
ppxlcDst += 8;
ppxlcSrc += 8;
}
ppxlcRef += m_iFrameWidthY;
ppxlcPred += MB_SIZE;
}
}
}
else {
if (!(xRef & 1)) {
Int iRndCtrl = 1 - iRoundingControl;
const PixelC *ppxlcSrc, *ppxlcSrc2;
PixelC *ppxlcDst;
for (iy = 0; iy < iSize; iy++) {
ppxlcDst = ppxlcPred;
ppxlcSrc = ppxlcRef;
ppxlcSrc2 = ppxlcRef + m_iFrameWidthY;
for (ix = 0; ix < iSize; ix+=8) {
ppxlcDst [0] = (ppxlcSrc [0] + ppxlcSrc2 [0] + iRndCtrl) >> 1;
ppxlcDst [1] = (ppxlcSrc [1] + ppxlcSrc2 [1] + iRndCtrl) >> 1;
ppxlcDst [2] = (ppxlcSrc [2] + ppxlcSrc2 [2] + iRndCtrl) >> 1;
ppxlcDst [3] = (ppxlcSrc [3] + ppxlcSrc2 [3] + iRndCtrl) >> 1;
ppxlcDst [4] = (ppxlcSrc [4] + ppxlcSrc2 [4] + iRndCtrl) >> 1;
ppxlcDst [5] = (ppxlcSrc [5] + ppxlcSrc2 [5] + iRndCtrl) >> 1;
ppxlcDst [6] = (ppxlcSrc [6] + ppxlcSrc2 [6] + iRndCtrl) >> 1;
ppxlcDst [7] = (ppxlcSrc [7] + ppxlcSrc2 [7] + iRndCtrl) >> 1;
ppxlcDst += 8;
ppxlcSrc += 8;
ppxlcSrc2 += 8;
}
ppxlcRef += m_iFrameWidthY;
ppxlcPred += MB_SIZE;
}
}
else {
Int iRndCtrl = 2 - iRoundingControl;
PixelC pxlcT1, pxlcT2, pxlcT3, pxlcT4, *ppxlcDst;
const PixelC *ppxlcSrc, *ppxlcSrc2;
for (iy = 0; iy < iSize; iy++) {
ppxlcDst = ppxlcPred;
ppxlcSrc = ppxlcRef;
ppxlcSrc2 = ppxlcRef + m_iFrameWidthY;
for (ix = 0; ix < iSize; ix+=8) {
ppxlcDst [0] = (ppxlcSrc[0] + (pxlcT1=ppxlcSrc[1]) + ppxlcSrc2[0] + (pxlcT3=ppxlcSrc2[1]) + iRndCtrl) >> 2;
ppxlcDst [1] = (pxlcT1 + (pxlcT2=ppxlcSrc[2]) + pxlcT3 + (pxlcT4=ppxlcSrc2[2]) + iRndCtrl) >> 2;
ppxlcDst [2] = (pxlcT2 + (pxlcT1=ppxlcSrc[3]) + pxlcT4 + (pxlcT3=ppxlcSrc2[3]) + iRndCtrl) >> 2;
ppxlcDst [3] = (pxlcT1 + (pxlcT2=ppxlcSrc[4]) + pxlcT3 + (pxlcT4=ppxlcSrc2[4]) + iRndCtrl) >> 2;
ppxlcDst [4] = (pxlcT2 + (pxlcT1=ppxlcSrc[5]) + pxlcT4 + (pxlcT3=ppxlcSrc2[5]) + iRndCtrl) >> 2;
ppxlcDst [5] = (pxlcT1 + (pxlcT2=ppxlcSrc[6]) + pxlcT3 + (pxlcT4=ppxlcSrc2[6]) + iRndCtrl) >> 2;
ppxlcDst [6] = (pxlcT2 + (pxlcT1=ppxlcSrc[7]) + pxlcT4 + (pxlcT3=ppxlcSrc2[7]) + iRndCtrl) >> 2;
ppxlcDst [7] = (pxlcT1 + ppxlcSrc[8] + pxlcT3 + ppxlcSrc2[8] + iRndCtrl) >> 2;
ppxlcDst += 8;
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -