diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2003-07-29 02:09:12 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2003-07-29 02:09:12 +0000 |
commit | 7d1c3fc1d683d53982a1dec14f0f9749a07ae48d (patch) | |
tree | 23a9984eef372f9710641e2cb6f302ea9af1727f /libavcodec/h263.c | |
parent | 80adda8efd35c920c7ba0c43d530102a2fd22bc3 (diff) | |
download | ffmpeg-7d1c3fc1d683d53982a1dec14f0f9749a07ae48d.tar.gz |
rate distortion mb decision support
fix decoding of old %16!=0 divx
fix assertion failure in motion_est.c
Originally committed as revision 2094 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h263.c')
-rw-r--r-- | libavcodec/h263.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/libavcodec/h263.c b/libavcodec/h263.c index b48c86648e..67321cf3f8 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -512,6 +512,53 @@ int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my){ } } +void ff_h263_update_motion_val(MpegEncContext * s){ + const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; + //FIXME a lot of thet is only needed for !low_delay + const int wrap = s->block_wrap[0]; + const int xy = s->block_index[0]; + + s->current_picture.mbskip_table[mb_xy]= s->mb_skiped; + + if(s->mv_type != MV_TYPE_8X8){ + int motion_x, motion_y; + if (s->mb_intra) { + motion_x = 0; + motion_y = 0; + } else if (s->mv_type == MV_TYPE_16X16) { + motion_x = s->mv[0][0][0]; + motion_y = s->mv[0][0][1]; + } else /*if (s->mv_type == MV_TYPE_FIELD)*/ { + int i; + motion_x = s->mv[0][0][0] + s->mv[0][1][0]; + motion_y = s->mv[0][0][1] + s->mv[0][1][1]; + motion_x = (motion_x>>1) | (motion_x&1); + for(i=0; i<2; i++){ + s->field_mv_table[mb_xy][i][0]= s->mv[0][i][0]; + s->field_mv_table[mb_xy][i][1]= s->mv[0][i][1]; + s->field_select_table[mb_xy][i]= s->field_select[0][i]; + } + } + + /* no update if 8X8 because it has been done during parsing */ + s->motion_val[xy][0] = motion_x; + s->motion_val[xy][1] = motion_y; + s->motion_val[xy + 1][0] = motion_x; + s->motion_val[xy + 1][1] = motion_y; + s->motion_val[xy + wrap][0] = motion_x; + s->motion_val[xy + wrap][1] = motion_y; + s->motion_val[xy + 1 + wrap][0] = motion_x; + s->motion_val[xy + 1 + wrap][1] = motion_y; + } + + if(s->encoding){ //FIXME encoding MUST be cleaned up + if (s->mv_type == MV_TYPE_8X8) + s->current_picture.mb_type[mb_xy]= MB_TYPE_L0 | MB_TYPE_8x8; + else + s->current_picture.mb_type[mb_xy]= MB_TYPE_L0 | MB_TYPE_16x16; + } +} + #ifdef CONFIG_ENCODERS void mpeg4_encode_mb(MpegEncContext * s, DCTELEM block[6][64], |