Mercurial > libavcodec.hg
comparison rv34.c @ 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 | 7185e3bb0614 |
children | a425bdc70ac5 |
comparison
equal
deleted
inserted
replaced
6120:6d52514f9c41 | 6121:bc59962f70b9 |
---|---|
579 qpel_mc_func (*qpel_mc)[16], | 579 qpel_mc_func (*qpel_mc)[16], |
580 h264_chroma_mc_func (*chroma_mc)) | 580 h264_chroma_mc_func (*chroma_mc)) |
581 { | 581 { |
582 MpegEncContext *s = &r->s; | 582 MpegEncContext *s = &r->s; |
583 uint8_t *Y, *U, *V, *srcY, *srcU, *srcV; | 583 uint8_t *Y, *U, *V, *srcY, *srcU, *srcV; |
584 int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; | 584 int dxy, mx, my, lx, ly, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y; |
585 int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride + mv_off; | 585 int mv_pos = s->mb_x * 2 + s->mb_y * 2 * s->b8_stride + mv_off; |
586 int is16x16 = 1; | 586 int is16x16 = 1; |
587 | 587 |
588 if(thirdpel){ | 588 if(thirdpel){ |
589 int lx, ly; | |
590 | |
591 mx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) / 3 - (1 << 24); | 589 mx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) / 3 - (1 << 24); |
592 my = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) / 3 - (1 << 24); | 590 my = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) / 3 - (1 << 24); |
593 lx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) % 3; | 591 lx = (s->current_picture_ptr->motion_val[dir][mv_pos][0] + (3 << 24)) % 3; |
594 ly = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) % 3; | 592 ly = (s->current_picture_ptr->motion_val[dir][mv_pos][1] + (3 << 24)) % 3; |
595 dxy = ly*4 + lx; | |
596 uvmx = chroma_coeffs[(3*(mx&1) + lx) >> 1]; | 593 uvmx = chroma_coeffs[(3*(mx&1) + lx) >> 1]; |
597 uvmy = chroma_coeffs[(3*(my&1) + ly) >> 1]; | 594 uvmy = chroma_coeffs[(3*(my&1) + ly) >> 1]; |
598 }else{ | 595 }else{ |
599 mx = s->current_picture_ptr->motion_val[dir][mv_pos][0] >> 2; | 596 mx = s->current_picture_ptr->motion_val[dir][mv_pos][0] >> 2; |
600 my = s->current_picture_ptr->motion_val[dir][mv_pos][1] >> 2; | 597 my = s->current_picture_ptr->motion_val[dir][mv_pos][1] >> 2; |
601 dxy = ((my & 3) << 2) | (mx & 3); | 598 lx = s->current_picture_ptr->motion_val[dir][mv_pos][0] & 3; |
599 ly = s->current_picture_ptr->motion_val[dir][mv_pos][1] & 3; | |
602 uvmx = mx & 6; | 600 uvmx = mx & 6; |
603 uvmy = my & 6; | 601 uvmy = my & 6; |
604 } | 602 } |
603 dxy = ly*4 + lx; | |
605 srcY = dir ? s->next_picture_ptr->data[0] : s->last_picture_ptr->data[0]; | 604 srcY = dir ? s->next_picture_ptr->data[0] : s->last_picture_ptr->data[0]; |
606 srcU = dir ? s->next_picture_ptr->data[1] : s->last_picture_ptr->data[1]; | 605 srcU = dir ? s->next_picture_ptr->data[1] : s->last_picture_ptr->data[1]; |
607 srcV = dir ? s->next_picture_ptr->data[2] : s->last_picture_ptr->data[2]; | 606 srcV = dir ? s->next_picture_ptr->data[2] : s->last_picture_ptr->data[2]; |
608 src_x = s->mb_x * 16 + xoff + mx; | 607 src_x = s->mb_x * 16 + xoff + mx; |
609 src_y = s->mb_y * 16 + yoff + my; | 608 src_y = s->mb_y * 16 + yoff + my; |
610 uvsrc_x = s->mb_x * 8 + (xoff >> 1) + (mx >> 1); | 609 uvsrc_x = s->mb_x * 8 + (xoff >> 1) + (mx >> 1); |
611 uvsrc_y = s->mb_y * 8 + (yoff >> 1) + (my >> 1); | 610 uvsrc_y = s->mb_y * 8 + (yoff >> 1) + (my >> 1); |
612 srcY += src_y * s->linesize + src_x; | 611 srcY += src_y * s->linesize + src_x; |
613 srcU += uvsrc_y * s->uvlinesize + uvsrc_x; | 612 srcU += uvsrc_y * s->uvlinesize + uvsrc_x; |
614 srcV += uvsrc_y * s->uvlinesize + uvsrc_x; | 613 srcV += uvsrc_y * s->uvlinesize + uvsrc_x; |
615 if( (unsigned)(src_x - !!(mx&3)*2) > s->h_edge_pos - !!(mx&3)*2 - (width <<3) - 3 | 614 if( (unsigned)(src_x - !!lx*2) > s->h_edge_pos - !!lx*2 - (width <<3) - 3 |
616 || (unsigned)(src_y - !!(my&3)*2) > s->v_edge_pos - !!(my&3)*2 - (height<<3) - 3){ | 615 || (unsigned)(src_y - !!ly*2) > s->v_edge_pos - !!ly*2 - (height<<3) - 3){ |
617 uint8_t *uvbuf= s->edge_emu_buffer + 20 * s->linesize; | 616 uint8_t *uvbuf= s->edge_emu_buffer + 20 * s->linesize; |
618 | 617 |
619 srcY -= 2 + 2*s->linesize; | 618 srcY -= 2 + 2*s->linesize; |
620 ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, (width<<3)+4, (height<<3)+4, | 619 ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, (width<<3)+4, (height<<3)+4, |
621 src_x - 2, src_y - 2, s->h_edge_pos, s->v_edge_pos); | 620 src_x - 2, src_y - 2, s->h_edge_pos, s->v_edge_pos); |