aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-04 08:56:54 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-11 09:07:10 +0100
commitb681680d294a796c2270860e82564aa694675b05 (patch)
tree268da663b5fa4eda9aa2e002c298d27014bae074
parent16c09b465972b5221811a0f05da8a744966a702a (diff)
downloadffmpeg-b681680d294a796c2270860e82564aa694675b05.tar.gz
avcodec/mpegvideo_motion: Improve check to remove dead code
Several compile-time checks can be improved because mcsel is not used for MPEG-1/2 (it is only used for MPEG-4) and because MPEG-1/2 is the only user of ff_mpv_motion that uses MV_TYPE_16X8 and MV_TYPE_DMV. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r--libavcodec/mpegvideo_motion.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 58cdecf83b..79785df8f8 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -306,9 +306,9 @@ void mpeg_motion_internal(MpegEncContext *s,
if ((unsigned)src_x >= FFMAX(s->h_edge_pos - (motion_x & 1) - 15 , 0) ||
(unsigned)src_y >= FFMAX( v_edge_pos - (motion_y & 1) - h + 1, 0)) {
- if (is_mpeg12 ||
- s->codec_id == AV_CODEC_ID_MPEG2VIDEO ||
- s->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
+ if (is_mpeg12 || (CONFIG_SMALL &&
+ (s->codec_id == AV_CODEC_ID_MPEG2VIDEO ||
+ s->codec_id == AV_CODEC_ID_MPEG1VIDEO))) {
av_log(s->avctx, AV_LOG_DEBUG,
"MPEG motion vector out of boundary (%d %d)\n", src_x,
src_y);
@@ -853,7 +853,7 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s,
switch (s->mv_type) {
case MV_TYPE_16X16:
- if (s->mcsel) {
+ if (!is_mpeg12 && s->mcsel) {
if (s->real_sprite_warping_points == 1) {
gmc1_motion(s, dest_y, dest_cb, dest_cr,
ref_picture);
@@ -915,6 +915,7 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s,
}
break;
case MV_TYPE_16X8:
+ if (CONFIG_SMALL || is_mpeg12) {
for (i = 0; i < 2; i++) {
uint8_t **ref2picture;
@@ -936,7 +937,9 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s,
dest_cr += (16 >> s->chroma_y_shift) * s->uvlinesize;
}
break;
+ }
case MV_TYPE_DMV:
+ if (CONFIG_SMALL || is_mpeg12) {
if (s->picture_structure == PICT_FRAME) {
for (i = 0; i < 2; i++) {
int j;
@@ -969,6 +972,7 @@ static av_always_inline void mpv_motion_internal(MpegEncContext *s,
}
}
break;
+ }
default: av_assert2(0);
}
}