diff mbox series

[FFmpeg-devel,07/14] avcodec/mpegvideo_motion: Remove dead checks for existence of reference

Message ID GV1SPRMB0021A47F437A46C6C3B2E7B78F1B2@GV1SPRMB0021.EURP250.PROD.OUTLOOK.COM
State New
Headers show
Series [FFmpeg-devel,01/14] avcodec/get_buffer: Remove redundant check | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Andreas Rheinhardt April 29, 2024, 12:35 a.m. UTC
These references now always exist due to dummy frames.
Also remove the corresponding checks in the lowres code
in mpegvideo_dec.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpegvideo_dec.c    | 12 ++++--------
 libavcodec/mpegvideo_motion.c | 12 ++++--------
 2 files changed, 8 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index bf274e0c48..c1f49bce14 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -862,8 +862,8 @@  static inline void MPV_motion_lowres(MpegEncContext *s,
                                s->mv[dir][1][0], s->mv[dir][1][1],
                                block_s, mb_y);
         } else {
-            if (   s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field
-                || !ref_picture[0]) {
+            if (s->picture_structure != s->field_select[dir][0] + 1 &&
+                s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) {
                 ref_picture = s->current_picture_ptr->f->data;
             }
             mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
@@ -877,9 +877,8 @@  static inline void MPV_motion_lowres(MpegEncContext *s,
         for (int i = 0; i < 2; i++) {
             uint8_t *const *ref2picture;
 
-            if ((s->picture_structure == s->field_select[dir][i] + 1 ||
-                 s->pict_type == AV_PICTURE_TYPE_B || s->first_field) &&
-                ref_picture[0]) {
+            if (s->picture_structure == s->field_select[dir][i] + 1 ||
+                s->pict_type == AV_PICTURE_TYPE_B || s->first_field) {
                 ref2picture = ref_picture;
             } else {
                 ref2picture = s->current_picture_ptr->f->data;
@@ -910,9 +909,6 @@  static inline void MPV_motion_lowres(MpegEncContext *s,
                 pix_op = s->h264chroma.avg_h264_chroma_pixels_tab;
             }
         } else {
-            if (!ref_picture[0]) {
-                ref_picture = s->current_picture_ptr->f->data;
-            }
             for (int i = 0; i < 2; i++) {
                 mpeg_motion_lowres(s, dest_y, dest_cb, dest_cr,
                                    0, 0, s->picture_structure != i + 1,
diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 8922f5b1a5..01c8d82e98 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -739,8 +739,8 @@  static av_always_inline void mpv_motion_internal(MpegEncContext *s,
                                   s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y);
             }
         } else {
-            if (   s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field
-                || !ref_picture[0]) {
+            if (s->picture_structure != s->field_select[dir][0] + 1 &&
+                s->pict_type != AV_PICTURE_TYPE_B && !s->first_field) {
                 ref_picture = s->current_picture_ptr->f->data;
             }
 
@@ -755,9 +755,8 @@  static av_always_inline void mpv_motion_internal(MpegEncContext *s,
             for (i = 0; i < 2; i++) {
                 uint8_t *const *ref2picture;
 
-                if ((s->picture_structure == s->field_select[dir][i] + 1 ||
-                     s->pict_type == AV_PICTURE_TYPE_B || s->first_field) &&
-                    ref_picture[0]) {
+                if (s->picture_structure == s->field_select[dir][i] + 1 ||
+                    s->pict_type == AV_PICTURE_TYPE_B || s->first_field) {
                     ref2picture = ref_picture;
                 } else {
                     ref2picture = s->current_picture_ptr->f->data;
@@ -787,9 +786,6 @@  static av_always_inline void mpv_motion_internal(MpegEncContext *s,
                     pix_op = s->hdsp.avg_pixels_tab;
                 }
             } else {
-                if (!ref_picture[0]) {
-                    ref_picture = s->current_picture_ptr->f->data;
-                }
                 for (i = 0; i < 2; i++) {
                     mpeg_motion(s, dest_y, dest_cb, dest_cr,
                                 s->picture_structure != i + 1,