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

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/mpegvideo_motion.c+7−1
@@ -114,13 +114,16 @@ void mpeg_motion_internal(MpegEncContext *s, · 113 unmodified lines
114114 uvsrc_y = src_y >> 1;
115115 }
116116 // 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);
118120 mx = motion_x / 4;
119121 my = motion_y / 4;
120122 uvdxy = 0;
121123 uvsrc_x = s->mb_x * 8 + mx;
122124 uvsrc_y = mb_y * 8 + my;
123125 } else {
126+ av_assert2(s->out_format == FMT_MPEG1);
124127 if (s->chroma_y_shift) {
125128 mx = motion_x / 2;
126129 my = motion_y / 2;
@@ -820,6 +823,9 @@ void ff_mpv_motion(MpegEncContext *s, · 693 unmodified lines
820823 op_pixels_func (*pix_op)[4],
821824 qpel_mc_func (*qpix_op)[16])
822825 {
826+ av_assert2(s->out_format == FMT_MPEG1 ||
827+ s->out_format == FMT_H263 ||
828+ s->out_format == FMT_H261);
823829 prefetch_motion(s, ref_picture, dir);
824830
825831 #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