MotionEstContext contains pointers (to function pointers) that have been set on a per-frame basis depending upon no_rounding in ff_me_init_pic() to avoid branches like these. Also makes MotionEstContext more independent of MpegEncContext.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -661,18 +661,12 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) · 660 unmodified lines | ||
| 661 | 661 | const uint8_t *ref = c->ref[block][0] + (mx4>>2) + (my4>>2)*stride; |
| 662 | 662 | dxy = ((my4 & 3) << 2) | (mx4 & 3); |
| 663 | 663 | |
| 664 | − if(s->no_rounding) | |
| 665 | − s->qdsp.put_no_rnd_qpel_pixels_tab[1][dxy](dest_y, ref, stride); | |
| 666 | − else | |
| 667 | − s->qdsp.put_qpel_pixels_tab[1][dxy](dest_y, ref, stride); | |
| 664 | + c->qpel_put[1][dxy](dest_y, ref, stride); | |
| 668 | 665 | }else{ |
| 669 | 666 | const uint8_t *ref = c->ref[block][0] + (mx4>>1) + (my4>>1)*stride; |
| 670 | 667 | dxy = ((my4 & 1) << 1) | (mx4 & 1); |
| 671 | 668 | |
| 672 | − if(s->no_rounding) | |
| 673 | − s->hdsp.put_no_rnd_pixels_tab[1][dxy](dest_y , ref , stride, h); | |
| 674 | − else | |
| 675 | − s->hdsp.put_pixels_tab [1][dxy](dest_y , ref , stride, h); | |
| 669 | + c->hpel_put[1][dxy](dest_y, ref, stride, h); | |
| 676 | 670 | } |
| 677 | 671 | dmin_sum+= (mv_penalty[mx4-pred_x4] + mv_penalty[my4-pred_y4])*c->mb_penalty_factor; |
| 678 | 672 | }else |
| @@ -713,13 +707,8 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) · 34 unmodified lines | ||
| 713 | 707 | |
| 714 | 708 | offset= (s->mb_x*8 + (mx>>1)) + (s->mb_y*8 + (my>>1))*s->uvlinesize; |
| 715 | 709 | |
| 716 | − if(s->no_rounding){ | |
| 717 | − s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad , s->last_pic.data[1] + offset, s->uvlinesize, 8); | |
| 718 | − s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_pic.data[2] + offset, s->uvlinesize, 8); | |
| 719 | − }else{ | |
| 720 | − s->hdsp.put_pixels_tab [1][dxy](c->scratchpad , s->last_pic.data[1] + offset, s->uvlinesize, 8); | |
| 721 | − s->hdsp.put_pixels_tab [1][dxy](c->scratchpad + 8, s->last_pic.data[2] + offset, s->uvlinesize, 8); | |
| 722 | − } | |
| 710 | + c->hpel_put[1][dxy](c->scratchpad , s->last_pic.data[1] + offset, s->uvlinesize, 8); | |
| 711 | + c->hpel_put[1][dxy](c->scratchpad + 8, s->last_pic.data[2] + offset, s->uvlinesize, 8); | |
| 723 | 712 | |
| 724 | 713 | dmin_sum += c->mb_cmp[1](s, s->new_pic->data[1] + s->mb_x * 8 + s->mb_y * 8 * s->uvlinesize, c->scratchpad, s->uvlinesize, 8); |
| 725 | 714 | dmin_sum += c->mb_cmp[1](s, s->new_pic->data[2] + s->mb_x * 8 + s->mb_y * 8 * s->uvlinesize, c->scratchpad + 8, s->uvlinesize, 8); |
| @@ -825,11 +814,7 @@ static int interlaced_search(MpegEncContext *s, int ref_index, · 99 unmodified lines | ||
| 825 | 814 | const uint8_t *ref = c->ref[field_select+ref_index][0] + (mx_i>>1) + (my_i>>1)*stride; |
| 826 | 815 | dxy = ((my_i & 1) << 1) | (mx_i & 1); |
| 827 | 816 | |
| 828 | − if(s->no_rounding){ | |
| 829 | − s->hdsp.put_no_rnd_pixels_tab[size][dxy](c->scratchpad, ref , stride, h); | |
| 830 | − }else{ | |
| 831 | − s->hdsp.put_pixels_tab [size][dxy](c->scratchpad, ref , stride, h); | |
| 832 | − } | |
| 817 | + c->hpel_put[size][dxy](c->scratchpad, ref, stride, h); | |
| 833 | 818 | dmin = c->mb_cmp[size](s, c->src[block][0], c->scratchpad, stride, h); |
| 834 | 819 | dmin+= (mv_penalty[mx_i-c->pred_x] + mv_penalty[my_i-c->pred_y] + 1)*c->mb_penalty_factor; |
| 835 | 820 | }else |