[FFmpeg-cvslog] avcodec/mpegvideo_motion: Optimize check away
Andreas Rheinhardt
git at videolan.org
Wed Jun 12 14:14:54 EEST 2024
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Apr 28 13:33:49 2024 +0200| [55e81306bfdecda915184bd970198dbe4f678e8d] | committer: Andreas Rheinhardt
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().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=55e81306bfdecda915184bd970198dbe4f678e8d
---
libavcodec/mpegvideo_motion.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 5b72196395..ccda20c0f1 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -114,13 +114,16 @@ void mpeg_motion_internal(MpegEncContext *s,
uvsrc_y = src_y >> 1;
}
// Even chroma mv's are full pel in H261
- } else if (!is_mpeg12 && s->out_format == FMT_H261) {
+ } else if (!CONFIG_SMALL && !is_mpeg12 ||
+ CONFIG_SMALL && s->out_format == FMT_H261) {
+ av_assert2(s->out_format == FMT_H261);
mx = motion_x / 4;
my = motion_y / 4;
uvdxy = 0;
uvsrc_x = s->mb_x * 8 + mx;
uvsrc_y = mb_y * 8 + my;
} else {
+ av_assert2(s->out_format == FMT_MPEG1);
if (s->chroma_y_shift) {
mx = motion_x / 2;
my = motion_y / 2;
@@ -820,6 +823,9 @@ void ff_mpv_motion(MpegEncContext *s,
op_pixels_func (*pix_op)[4],
qpel_mc_func (*qpix_op)[16])
{
+ av_assert2(s->out_format == FMT_MPEG1 ||
+ s->out_format == FMT_H263 ||
+ s->out_format == FMT_H261);
prefetch_motion(s, ref_picture, dir);
#if !CONFIG_SMALL
More information about the ffmpeg-cvslog
mailing list