39 |
* MinChen <chenm001@163.com> |
* MinChen <chenm001@163.com> |
40 |
* 14.04.2002 added FrameCodeB() |
* 14.04.2002 added FrameCodeB() |
41 |
* |
* |
42 |
* $Id: encoder.c,v 1.76.2.1 2002-09-23 20:36:01 chl Exp $ |
* $Id: encoder.c,v 1.76.2.2 2002-09-26 01:54:54 h Exp $ |
43 |
* |
* |
44 |
****************************************************************************/ |
****************************************************************************/ |
45 |
|
|
1100 |
pEnc->current->ticks = pEnc->mbParam.m_ticks; |
pEnc->current->ticks = pEnc->mbParam.m_ticks; |
1101 |
pEnc->mbParam.hint = &pFrame->hint; |
pEnc->mbParam.hint = &pFrame->hint; |
1102 |
|
|
1103 |
|
/* disable alternate scan flag if interlacing is not enabled */ |
1104 |
|
if ((pEnc->current->global_flags & XVID_ALTERNATESCAN) && |
1105 |
|
!(pEnc->current->global_flags & XVID_INTERLACING)) |
1106 |
|
{ |
1107 |
|
pEnc->current->global_flags -= XVID_ALTERNATESCAN; |
1108 |
|
} |
1109 |
|
|
1110 |
start_timer(); |
start_timer(); |
1111 |
if (image_input |
if (image_input |
1112 |
(&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height, |
(&pEnc->current->image, pEnc->mbParam.width, pEnc->mbParam.height, |
1567 |
|
|
1568 |
start_timer(); |
start_timer(); |
1569 |
image_setedges(pRef, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height, |
image_setedges(pRef, pEnc->mbParam.edged_width, pEnc->mbParam.edged_height, |
1570 |
pEnc->mbParam.width, pEnc->mbParam.height, |
pEnc->mbParam.width, pEnc->mbParam.height); |
|
pEnc->current->global_flags & XVID_INTERLACING); |
|
1571 |
stop_edges_timer(); |
stop_edges_timer(); |
1572 |
|
|
1573 |
pEnc->mbParam.m_rounding_type = 1 - pEnc->mbParam.m_rounding_type; |
pEnc->mbParam.m_rounding_type = 1 - pEnc->mbParam.m_rounding_type; |
1815 |
// forward |
// forward |
1816 |
image_setedges(f_ref, pEnc->mbParam.edged_width, |
image_setedges(f_ref, pEnc->mbParam.edged_width, |
1817 |
pEnc->mbParam.edged_height, pEnc->mbParam.width, |
pEnc->mbParam.edged_height, pEnc->mbParam.width, |
1818 |
pEnc->mbParam.height, |
pEnc->mbParam.height); |
|
frame->global_flags & XVID_INTERLACING); |
|
1819 |
start_timer(); |
start_timer(); |
1820 |
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, |
1821 |
pEnc->mbParam.edged_width, pEnc->mbParam.edged_height, |
pEnc->mbParam.edged_width, pEnc->mbParam.edged_height, |
1825 |
// backward |
// backward |
1826 |
image_setedges(b_ref, pEnc->mbParam.edged_width, |
image_setedges(b_ref, pEnc->mbParam.edged_width, |
1827 |
pEnc->mbParam.edged_height, pEnc->mbParam.width, |
pEnc->mbParam.edged_height, pEnc->mbParam.width, |
1828 |
pEnc->mbParam.height, |
pEnc->mbParam.height); |
|
frame->global_flags & XVID_INTERLACING); |
|
1829 |
start_timer(); |
start_timer(); |
1830 |
image_interpolate(b_ref, &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV, |
image_interpolate(b_ref, &pEnc->vInterH, &pEnc->vInterV, &pEnc->vInterHV, |
1831 |
pEnc->mbParam.edged_width, pEnc->mbParam.edged_height, |
pEnc->mbParam.edged_width, pEnc->mbParam.edged_height, |
1863 |
for (y = 0; y < pEnc->mbParam.mb_height; y++) { |
for (y = 0; y < pEnc->mbParam.mb_height; y++) { |
1864 |
for (x = 0; x < pEnc->mbParam.mb_width; x++) { |
for (x = 0; x < pEnc->mbParam.mb_width; x++) { |
1865 |
MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width]; |
MACROBLOCK * const mb = &frame->mbs[x + y * pEnc->mbParam.mb_width]; |
1866 |
|
int direction = pEnc->global & XVID_ALTERNATESCAN ? 2 : 0; |
1867 |
|
|
1868 |
// decoder ignores mb when refence block is INTER(0,0), CBP=0 |
// decoder ignores mb when refence block is INTER(0,0), CBP=0 |
1869 |
if (mb->mode == MODE_NOT_CODED) { |
if (mb->mode == MODE_NOT_CODED) { |
1895 |
#endif |
#endif |
1896 |
start_timer(); |
start_timer(); |
1897 |
MBCodingBVOP(mb, qcoeff, frame->fcode, frame->bcode, bs, |
MBCodingBVOP(mb, qcoeff, frame->fcode, frame->bcode, bs, |
1898 |
&pEnc->sStat); |
&pEnc->sStat, direction); |
1899 |
stop_coding_timer(); |
stop_coding_timer(); |
1900 |
} |
} |
1901 |
} |
} |