ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Wed Mar 26 08:38:58 2025 +0100| [114fccc4a5031f6f85b116ea691799a183ed9405] | 
committer: Andreas Rheinhardt

avcodec/mpegvideo_enc: Set b-frame chain length properly

Fixes a regression caused by my desire to use loop-scope
for iterators in 72bf3d3c12ae562fd408603483bc59058757b1a1.

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

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

 libavcodec/mpegvideo_enc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index ea3bc4ee55..5ca45b3e0f 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1726,8 +1726,9 @@ static int set_bframe_chain_length(MPVMainEncContext 
*const m)
                                         s->c.linesize) + 1;
                 }
             }
-            for (int i = 0; i < m->max_b_frames + 1; i++) {
-                if (!m->input_picture[i] ||
+            for (int i = 0;; i++) {
+                if (i >= m->max_b_frames + 1 ||
+                    !m->input_picture[i] ||
                     m->input_picture[i]->b_frame_score - 1 >
                         s->c.mb_num / m->b_sensitivity) {
                     b_frames = FFMAX(0, i - 1);

_______________________________________________
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