188 |
pcreate.zones = pEnc->zones; |
pcreate.zones = pEnc->zones; |
189 |
pcreate.width = pEnc->mbParam.width; |
pcreate.width = pEnc->mbParam.width; |
190 |
pcreate.height = pEnc->mbParam.height; |
pcreate.height = pEnc->mbParam.height; |
191 |
|
pcreate.mb_width = pEnc->mbParam.mb_width; |
192 |
|
pcreate.mb_height = pEnc->mbParam.mb_height; |
193 |
pcreate.fincr = pEnc->mbParam.fincr; |
pcreate.fincr = pEnc->mbParam.fincr; |
194 |
pcreate.fbase = pEnc->mbParam.fbase; |
pcreate.fbase = pEnc->mbParam.fbase; |
195 |
pcreate.param = create->plugins[n].param; |
pcreate.param = create->plugins[n].param; |
650 |
data.mb_height = pEnc->mbParam.mb_height; |
data.mb_height = pEnc->mbParam.mb_height; |
651 |
data.fincr = frame->fincr; |
data.fincr = frame->fincr; |
652 |
data.fbase = pEnc->mbParam.fbase; |
data.fbase = pEnc->mbParam.fbase; |
653 |
|
data.bquant_ratio = pEnc->mbParam.bquant_ratio; |
654 |
|
data.bquant_offset = pEnc->mbParam.bquant_offset; |
655 |
|
|
656 |
for (i=0; i<3; i++) { |
for (i=0; i<3; i++) { |
657 |
data.min_quant[i] = pEnc->mbParam.min_quant[i]; |
data.min_quant[i] = pEnc->mbParam.min_quant[i]; |
1414 |
pEnc->fMvPrevSigma = -1; |
pEnc->fMvPrevSigma = -1; |
1415 |
pEnc->mbParam.m_fcode = 2; |
pEnc->mbParam.m_fcode = 2; |
1416 |
|
|
1417 |
|
pEnc->current->is_edged = 0; /* not edged */ |
1418 |
|
pEnc->current->is_interpolated = -1; /* not interpolated (fake rounding -1) */ |
1419 |
|
|
1420 |
return 1; /* intra */ |
return 1; /* intra */ |
1421 |
} |
} |
1422 |
|
|
1459 |
} |
} |
1460 |
|
|
1461 |
|
|
1462 |
|
if (!reference->is_edged) { |
1463 |
start_timer(); |
start_timer(); |
1464 |
image_setedges(pRef, pParam->edged_width, pParam->edged_height, |
image_setedges(pRef, pParam->edged_width, pParam->edged_height, |
1465 |
pParam->width, pParam->height); |
pParam->width, pParam->height); |
1466 |
stop_edges_timer(); |
stop_edges_timer(); |
1467 |
|
reference->is_edged = 1; |
1468 |
|
} |
1469 |
|
|
1470 |
pParam->m_rounding_type = 1 - pParam->m_rounding_type; |
pParam->m_rounding_type = 1 - pParam->m_rounding_type; |
1471 |
current->rounding_type = pParam->m_rounding_type; |
current->rounding_type = pParam->m_rounding_type; |
1477 |
iLimit = mb_width * mb_height + 1; |
iLimit = mb_width * mb_height + 1; |
1478 |
|
|
1479 |
if ((current->vop_flags & XVID_VOP_HALFPEL)) { |
if ((current->vop_flags & XVID_VOP_HALFPEL)) { |
1480 |
|
if (reference->is_interpolated != current->rounding_type) { |
1481 |
start_timer(); |
start_timer(); |
1482 |
image_interpolate(pRef, &pEnc->vInterH, &pEnc->vInterV, |
image_interpolate(pRef, &pEnc->vInterH, &pEnc->vInterV, |
1483 |
&pEnc->vInterHV, pParam->edged_width, |
&pEnc->vInterHV, pParam->edged_width, |
1485 |
(pParam->vol_flags & XVID_VOL_QUARTERPEL), |
(pParam->vol_flags & XVID_VOL_QUARTERPEL), |
1486 |
current->rounding_type); |
current->rounding_type); |
1487 |
stop_inter_timer(); |
stop_inter_timer(); |
1488 |
|
reference->is_interpolated = current->rounding_type; |
1489 |
|
} |
1490 |
} |
} |
1491 |
|
|
1492 |
current->coding_type = P_VOP; |
current->coding_type = P_VOP; |
1509 |
&pEnc->vInterH, |
&pEnc->vInterH, |
1510 |
&pEnc->vInterV, |
&pEnc->vInterV, |
1511 |
&pEnc->vInterHV); |
&pEnc->vInterHV); |
1512 |
gmcval += /*current->quant */ 2 * (int)(pParam->mb_width*pParam->mb_height); |
} else { |
|
} |
|
|
|
|
1513 |
gmcval = globalSAD(¤t->warp, pParam, current->mbs, |
gmcval = globalSAD(¤t->warp, pParam, current->mbs, |
1514 |
current, |
current, |
1515 |
&reference->image, |
&reference->image, |
1516 |
¤t->image, |
¤t->image, |
1517 |
pEnc->vGMC.y); |
pEnc->vGMC.y); |
1518 |
|
} |
1519 |
|
|
1520 |
gmcval += /*current->quant*/ 2 * (int)(pParam->mb_width*pParam->mb_height); |
gmcval += /*current->quant*/ 2 * (int)(pParam->mb_width*pParam->mb_height); |
1521 |
|
|
1522 |
/* 1st '3': 3 warpoints, 2nd '3': 16th pel res (2<<3) */ |
/* 1st '3': 3 warpoints, 2nd '3': 16th pel res (2<<3) */ |
1794 |
memcpy(current->mbs, reference->mbs, sizeof(MACROBLOCK) * mb_width * mb_height); |
memcpy(current->mbs, reference->mbs, sizeof(MACROBLOCK) * mb_width * mb_height); |
1795 |
} |
} |
1796 |
|
|
1797 |
|
pEnc->current->is_edged = 0; /* not edged */ |
1798 |
|
pEnc->current->is_interpolated = -1; /* not interpolated (fake rounding -1) */ |
1799 |
|
|
1800 |
|
/* what was this frame's interpolated reference will become |
1801 |
|
forward (past) reference in b-frame coding */ |
1802 |
|
|
1803 |
|
image_swap(&pEnc->vInterH, &pEnc->f_refh); |
1804 |
|
image_swap(&pEnc->vInterV, &pEnc->f_refv); |
1805 |
|
image_swap(&pEnc->vInterHV, &pEnc->f_refhv); |
1806 |
|
|
1807 |
|
|
1808 |
/* XXX: debug |
/* XXX: debug |
1809 |
{ |
{ |
1810 |
char s[100]; |
char s[100]; |
1856 |
#endif |
#endif |
1857 |
|
|
1858 |
/* forward */ |
/* forward */ |
1859 |
|
if (!pEnc->reference->is_edged) { |
1860 |
image_setedges(f_ref, pEnc->mbParam.edged_width, |
image_setedges(f_ref, pEnc->mbParam.edged_width, |
1861 |
pEnc->mbParam.edged_height, pEnc->mbParam.width, |
pEnc->mbParam.edged_height, pEnc->mbParam.width, |
1862 |
pEnc->mbParam.height); |
pEnc->mbParam.height); |
1863 |
|
pEnc->current->is_edged = 1; |
1864 |
|
} |
1865 |
|
|
1866 |
|
if (pEnc->reference->is_interpolated != 0) { |
1867 |
start_timer(); |
start_timer(); |
1868 |
image_interpolate(f_ref, &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv, |
image_interpolate(f_ref, &pEnc->f_refh, &pEnc->f_refv, &pEnc->f_refhv, |
1869 |
pEnc->mbParam.edged_width, pEnc->mbParam.edged_height, |
pEnc->mbParam.edged_width, pEnc->mbParam.edged_height, |
1870 |
(pEnc->mbParam.vol_flags & XVID_VOL_QUARTERPEL), 0); |
(pEnc->mbParam.vol_flags & XVID_VOL_QUARTERPEL), 0); |
1871 |
stop_inter_timer(); |
stop_inter_timer(); |
1872 |
|
pEnc->reference->is_interpolated = 0; |
1873 |
|
} |
1874 |
|
|
1875 |
/* backward */ |
/* backward */ |
1876 |
|
if (!pEnc->current->is_edged) { |
1877 |
image_setedges(b_ref, pEnc->mbParam.edged_width, |
image_setedges(b_ref, pEnc->mbParam.edged_width, |
1878 |
pEnc->mbParam.edged_height, pEnc->mbParam.width, |
pEnc->mbParam.edged_height, pEnc->mbParam.width, |
1879 |
pEnc->mbParam.height); |
pEnc->mbParam.height); |
1880 |
|
pEnc->current->is_edged = 1; |
1881 |
|
} |
1882 |
|
|
1883 |
|
if (pEnc->current->is_interpolated != 0) { |
1884 |
start_timer(); |
start_timer(); |
1885 |
image_interpolate(b_ref, &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV, |
image_interpolate(b_ref, &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV, |
1886 |
pEnc->mbParam.edged_width, pEnc->mbParam.edged_height, |
pEnc->mbParam.edged_width, pEnc->mbParam.edged_height, |
1887 |
(pEnc->mbParam.vol_flags & XVID_VOL_QUARTERPEL), 0); |
(pEnc->mbParam.vol_flags & XVID_VOL_QUARTERPEL), 0); |
1888 |
stop_inter_timer(); |
stop_inter_timer(); |
1889 |
|
pEnc->current->is_interpolated = 0; |
1890 |
|
} |
1891 |
|
|
1892 |
start_timer(); |
start_timer(); |
1893 |
MotionEstimationBVOP(&pEnc->mbParam, frame, |
MotionEstimationBVOP(&pEnc->mbParam, frame, |
1917 |
|
|
1918 |
/* decoder ignores mb when refence block is INTER(0,0), CBP=0 */ |
/* decoder ignores mb when refence block is INTER(0,0), CBP=0 */ |
1919 |
if (mb->mode == MODE_NOT_CODED) { |
if (mb->mode == MODE_NOT_CODED) { |
1920 |
/* mb->mvs[0].x = mb->mvs[0].y = mb->cbp = 0; */ |
if (pEnc->mbParam.plugin_flags & XVID_REQORIGINAL) { |
1921 |
|
MBMotionCompensation(mb, x, y, f_ref, NULL, f_ref, NULL, NULL, &frame->image, |
1922 |
|
NULL, 0, 0, pEnc->mbParam.edged_width, 0, 0, 0); |
1923 |
|
} |
1924 |
|
|
1925 |
continue; |
continue; |
1926 |
} |
} |
1927 |
|
|