History

avcodec/mpegvideo_motion: Optimize check away

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().

Andreas Rheinhardt committed 2 years ago

Commit 55e81301 parent 5f505991 file · +7 −1Browse files

Unified · Split

libavcodec/mpegvideo_motion.c+7−1
@@ -114,13 +114,16 @@ void mpeg_motion_internal(MpegEncContext *s, · 113 unmodified lines
114 uvsrc_y = src_y >> 1;114 uvsrc_y = src_y >> 1;
115 }115 }
116 // Even chroma mv's are full pel in H261116 // 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 mx = motion_x / 4;120 mx = motion_x / 4;
119 my = motion_y / 4;121 my = motion_y / 4;
120 uvdxy = 0;122 uvdxy = 0;
121 uvsrc_x = s->mb_x * 8 + mx;123 uvsrc_x = s->mb_x * 8 + mx;
122 uvsrc_y = mb_y * 8 + my;124 uvsrc_y = mb_y * 8 + my;
123 } else {125 } else {
126 av_assert2(s->out_format == FMT_MPEG1);
124 if (s->chroma_y_shift) {127 if (s->chroma_y_shift) {
125 mx = motion_x / 2;128 mx = motion_x / 2;
126 my = motion_y / 2;129 my = motion_y / 2;
@@ -820,6 +823,9 @@ void ff_mpv_motion(MpegEncContext *s, · 693 unmodified lines
820 op_pixels_func (*pix_op)[4],823 op_pixels_func (*pix_op)[4],
821 qpel_mc_func (*qpix_op)[16])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 prefetch_motion(s, ref_picture, dir);829 prefetch_motion(s, ref_picture, dir);
824 830
825#if !CONFIG_SMALL831#if !CONFIG_SMALL

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t