[FFmpeg-cvslog] avcodec/svq3: Improve returning last picture

Andreas Rheinhardt git at videolan.org
Wed May 21 04:27:49 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu May 15 04:48:54 2025 +0200| [b6f84cd72acd84ba725922bd6a8967b416b2230a] | committer: Andreas Rheinhardt

avcodec/svq3: Improve returning last picture

Use av_frame_move_ref() instead of av_frame_ref().
This allows to remove the separate variable for whether
we have already returned the delayed last pic. It also
makes stream looping work when looping multiple times;
previously the delayed pic was only output the first time,
because last_frame_output was never reset.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/svq3.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index c510d2fb38..4c4f3018c5 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -104,7 +104,6 @@ typedef struct SVQ3Context {
     int adaptive_quant;
     int h_edge_pos;
     int v_edge_pos;
-    int last_frame_output;
     int slice_num;
     int qscale;
     int cbp;
@@ -1398,11 +1397,8 @@ static int svq3_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
 
     /* special case for last picture */
     if (buf_size == 0) {
-        if (s->next_pic->f->data[0] && !s->low_delay && !s->last_frame_output) {
-            ret = av_frame_ref(rframe, s->next_pic->f);
-            if (ret < 0)
-                return ret;
-            s->last_frame_output = 1;
+        if (s->next_pic->f->data[0] && !s->low_delay) {
+            av_frame_move_ref(rframe, s->next_pic->f);
             *got_frame          = 1;
         }
         return 0;



More information about the ffmpeg-cvslog mailing list