aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-04-28 13:33:49 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-06-12 10:51:16 +0200
commit55e81306bfdecda915184bd970198dbe4f678e8d (patch)
tree8810c76bec0f33281c761dcfe45c3976d7b349b3
parent5f505995db8f80867bd70f7b632ec0bb9879a3d5 (diff)
downloadffmpeg-55e81306bfdecda915184bd970198dbe4f678e8d.tar.gz
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@outlook.com>
-rw-r--r--libavcodec/mpegvideo_motion.c8
1 files changed, 7 insertions, 1 deletions
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