When !CONFIG_SMALL, we create separate functions for FMT_MPEG1 (i.e. for MPEG-1/2); given that there are only three possibilities for out_format (FMT_MPEG1, FMT_H263 and FMT_H261 -- MJPEG and SpeedHQ are both intra-only and do not have motion vectors at all, ergo they don't call this function), one can optimize MPEG-1/2-only code away in mpeg_motion_internal().
Unified · Split
| @@ -114,13 +114,16 @@ void mpeg_motion_internal(MpegEncContext *s, · 113 unmodified lines | ||
| 114 | 114 | uvsrc_y = src_y >> 1; |
| 115 | 115 | } |
| 116 | 116 | // Even chroma mv's are full pel in H261 |
| 117 | − } else if (!is_mpeg12 && s->out_format == FMT_H261) { | |
| 117 | + } else if (!CONFIG_SMALL && !is_mpeg12 || | |
| 118 | + CONFIG_SMALL && s->out_format == FMT_H261) { | |
| 119 | + av_assert2(s->out_format == FMT_H261); | |
| 118 | 120 | mx = motion_x / 4; |
| 119 | 121 | my = motion_y / 4; |
| 120 | 122 | uvdxy = 0; |
| 121 | 123 | uvsrc_x = s->mb_x * 8 + mx; |
| 122 | 124 | uvsrc_y = mb_y * 8 + my; |
| 123 | 125 | } else { |
| 126 | + av_assert2(s->out_format == FMT_MPEG1); | |
| 124 | 127 | if (s->chroma_y_shift) { |
| 125 | 128 | mx = motion_x / 2; |
| 126 | 129 | my = motion_y / 2; |
| @@ -820,6 +823,9 @@ void ff_mpv_motion(MpegEncContext *s, · 693 unmodified lines | ||
| 820 | 823 | op_pixels_func (*pix_op)[4], |
| 821 | 824 | qpel_mc_func (*qpix_op)[16]) |
| 822 | 825 | { |
| 826 | + av_assert2(s->out_format == FMT_MPEG1 || | |
| 827 | + s->out_format == FMT_H263 || | |
| 828 | + s->out_format == FMT_H261); | |
| 823 | 829 | prefetch_motion(s, ref_picture, dir); |
| 824 | 830 | |
| 825 | 831 | #if !CONFIG_SMALL |