[FFmpeg-cvslog] avcodec/mpegvideo_dec: Remove unnecessary FFMIN
Andreas Rheinhardt
git at videolan.org
Thu Jun 20 20:00:59 EEST 2024
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Jun 11 14:05:20 2024 +0200| [66709df4036b51c29d451de9621e76dfb898caf0] | committer: Andreas Rheinhardt
avcodec/mpegvideo_dec: Remove unnecessary FFMIN
No mpegvideo-based decoder supports lowres > 3,
so the FFMIN here are unnecessary.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=66709df4036b51c29d451de9621e76dfb898caf0
---
libavcodec/mpegvideo_dec.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 4e279d9fa8..684f31947c 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -483,11 +483,13 @@ static inline int hpel_motion_lowres(MpegEncContext *s,
int motion_x, int motion_y)
{
const int lowres = s->avctx->lowres;
- const int op_index = FFMIN(lowres, 3);
+ const int op_index = lowres;
const int s_mask = (2 << lowres) - 1;
int emu = 0;
int sx, sy;
+ av_assert2(op_index <= 3);
+
if (s->quarter_sample) {
motion_x /= 2;
motion_y /= 2;
@@ -536,12 +538,15 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, sx, sy, uvsx, uvsy;
ptrdiff_t uvlinesize, linesize;
const int lowres = s->avctx->lowres;
- const int op_index = FFMIN(lowres - 1 + s->chroma_x_shift, 3);
+ const int op_index = lowres - 1 + s->chroma_x_shift;
const int block_s = 8 >> lowres;
const int s_mask = (2 << lowres) - 1;
const int h_edge_pos = s->h_edge_pos >> lowres;
const int v_edge_pos = s->v_edge_pos >> lowres;
int hc = s->chroma_y_shift ? (h+1-bottom_field)>>1 : h;
+
+ av_assert2(op_index <= 3);
+
linesize = s->cur_pic.linesize[0] << field_based;
uvlinesize = s->cur_pic.linesize[1] << field_based;
@@ -666,7 +671,7 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s,
int mx, int my)
{
const int lowres = s->avctx->lowres;
- const int op_index = FFMIN(lowres, 3);
+ const int op_index = lowres;
const int block_s = 8 >> lowres;
const int s_mask = (2 << lowres) - 1;
const int h_edge_pos = s->h_edge_pos >> lowres + 1;
@@ -675,6 +680,8 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s,
ptrdiff_t offset;
const uint8_t *ptr;
+ av_assert2(op_index <= 3);
+
if (s->quarter_sample) {
mx /= 2;
my /= 2;
More information about the ffmpeg-cvslog
mailing list