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>
This commit is contained in:
Andreas Rheinhardt 2024-04-28 13:33:49 +02:00
parent 5f505995db
commit 55e81306bf
1 changed files with 7 additions and 1 deletions

View File

@ -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