Mercurial > libavcodec.hg
changeset 6121:bc59962f70b9 libavcodec
Fractional parts of motion vectors should be accounted separately too
author | kostya |
---|---|
date | Sun, 06 Jan 2008 11:47:53 +0000 |
parents | 6d52514f9c41 |
children | 61f95f3a62e0 |
files | rv34.c |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/rv34.c Sat Jan 05 21:23:57 2008 +0000 +++ b/rv34.c Sun Jan 06 11:47:53 2008 +0000 @@ -581,27 +581,26 @@ { MpegEncContext *s = &r->s; uint8_t *Y, *U, *V, *srcY, *srcU, *srcV; - int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; + int dxy, mx, my, 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 lx, ly; - 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; - dxy = ly*4 + lx; uvmx = chroma_coeffs[(3*(mx&1) + lx) >> 1]; uvmy = chroma_coeffs[(3*(my&1) + ly) >> 1]; }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; - dxy = ((my & 3) << 2) | (mx & 3); + lx = s->current_picture_ptr->motion_val[dir][mv_pos][0] & 3; + ly = s->current_picture_ptr->motion_val[dir][mv_pos][1] & 3; uvmx = mx & 6; uvmy = my & 6; } + dxy = ly*4 + lx; srcY = dir ? s->next_picture_ptr->data[0] : s->last_picture_ptr->data[0]; srcU = dir ? s->next_picture_ptr->data[1] : s->last_picture_ptr->data[1]; srcV = dir ? s->next_picture_ptr->data[2] : s->last_picture_ptr->data[2]; @@ -612,8 +611,8 @@ srcY += src_y * s->linesize + src_x; srcU += uvsrc_y * s->uvlinesize + uvsrc_x; srcV += uvsrc_y * s->uvlinesize + uvsrc_x; - if( (unsigned)(src_x - !!(mx&3)*2) > s->h_edge_pos - !!(mx&3)*2 - (width <<3) - 3 - || (unsigned)(src_y - !!(my&3)*2) > s->v_edge_pos - !!(my&3)*2 - (height<<3) - 3){ + if( (unsigned)(src_x - !!lx*2) > s->h_edge_pos - !!lx*2 - (width <<3) - 3 + || (unsigned)(src_y - !!ly*2) > s->v_edge_pos - !!ly*2 - (height<<3) - 3){ uint8_t *uvbuf= s->edge_emu_buffer + 20 * s->linesize; srcY -= 2 + 2*s->linesize;