ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Sun Apr 28 12:36:58 2024 +0200| [5f505995db8f80867bd70f7b632ec0bb9879a3d5] | 
committer: Andreas Rheinhardt

avcodec/mpegvideo_motion: Optimize check away

Only MPEG-2 can have field motion vectors with coded fields.

Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5f505995db8f80867bd70f7b632ec0bb9879a3d5
---

 libavcodec/mpegvideo_motion.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 01c8d82e98..5b72196395 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -719,7 +719,11 @@ static av_always_inline void 
mpv_motion_internal(MpegEncContext *s,
                       dir, ref_picture, qpix_op, pix_op);
         break;
     case MV_TYPE_FIELD:
-        if (s->picture_structure == PICT_FRAME) {
+        // Only MPEG-1/2 can have a picture_structure != PICT_FRAME here.
+        if (!CONFIG_SMALL)
+            av_assert2(is_mpeg12 || s->picture_structure == PICT_FRAME);
+        if ((!CONFIG_SMALL && !is_mpeg12) ||
+            s->picture_structure == PICT_FRAME) {
             if (!is_mpeg12 && s->quarter_sample) {
                 for (i = 0; i < 2; i++)
                     qpel_motion(s, dest_y, dest_cb, dest_cr,
@@ -739,6 +743,7 @@ static av_always_inline void 
mpv_motion_internal(MpegEncContext *s,
                                   s->mv[dir][1][0], s->mv[dir][1][1], 8, mb_y);
             }
         } else {
+            av_assert2(s->out_format == FMT_MPEG1);
             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;

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to