diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2008-10-27 19:07:39 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2008-10-27 19:07:39 +0000 |
commit | 2ee054c2153c32790851cc1095c50d3a89cf2dcc (patch) | |
tree | 0410a75a581568d48eb250ced91fd34be6def27d /libavcodec/rv34.c | |
parent | 782fc0c36f933048372554aa3c4a28851b929a8c (diff) | |
download | ffmpeg-streaming-2ee054c2153c32790851cc1095c50d3a89cf2dcc.zip ffmpeg-streaming-2ee054c2153c32790851cc1095c50d3a89cf2dcc.tar.gz |
Fix chroma motion compensation for RV30
Originally committed as revision 15731 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/rv34.c')
-rw-r--r-- | libavcodec/rv34.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index cf791dc..de1ce52 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -557,7 +557,7 @@ static void rv34_pred_mv_b(RV34DecContext *r, int block_type, int dir) fill_rectangle(cur_pic->motion_val[!dir][mv_pos], 2, 2, s->b8_stride, 0, 4); } -static const int chroma_coeffs[3] = { 8, 5, 3 }; +static const int chroma_coeffs[3] = { 0, 3, 5 }; /** * generic motion compensation function @@ -579,22 +579,29 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, { MpegEncContext *s = &r->s; uint8_t *Y, *U, *V, *srcY, *srcU, *srcV; - int dxy, mx, my, lx, ly, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; + int dxy, mx, my, umx, umy, lx, ly, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride + mv_off; int is16x16 = 1; if(thirdpel){ + int chroma_mx, chroma_my; mx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) / 3 - (1 << 24); my = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) / 3 - (1 << 24); lx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) % 3; ly = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) % 3; - uvmx = chroma_coeffs[(3*(mx&1) + lx) >> 1]; - uvmy = chroma_coeffs[(3*(my&1) + ly) >> 1]; + chroma_mx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + 1) >> 1; + chroma_my = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + 1) >> 1; + umx = (chroma_mx + (3 << 24)) / 3 - (1 << 24); + umy = (chroma_my + (3 << 24)) / 3 - (1 << 24); + uvmx = chroma_coeffs[(chroma_mx + (3 << 24)) % 3]; + uvmy = chroma_coeffs[(chroma_my + (3 << 24)) % 3]; }else{ mx = s->current_picture_ptr->motion_val[dir][mv_pos][0] >> 2; my = s->current_picture_ptr->motion_val[dir][mv_pos][1] >> 2; lx = s->current_picture_ptr->motion_val[dir][mv_pos][0] & 3; ly = s->current_picture_ptr->motion_val[dir][mv_pos][1] & 3; + umx = mx >> 1; + umy = my >> 1; uvmx = mx & 6; uvmy = my & 6; } @@ -604,8 +611,8 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, srcV = dir ? s->next_picture_ptr->data[2] : s->last_picture_ptr->data[2]; src_x = s->mb_x * 16 + xoff + mx; src_y = s->mb_y * 16 + yoff + my; - uvsrc_x = s->mb_x * 8 + (xoff >> 1) + (mx >> 1); - uvsrc_y = s->mb_y * 8 + (yoff >> 1) + (my >> 1); + uvsrc_x = s->mb_x * 8 + (xoff >> 1) + umx; + uvsrc_y = s->mb_y * 8 + (yoff >> 1) + umy; srcY += src_y * s->linesize + src_x; srcU += uvsrc_y * s->uvlinesize + uvsrc_x; srcV += uvsrc_y * s->uvlinesize + uvsrc_x; |