[FFmpeg-cvslog] avcodec/wavpack: Move transient variable from context to stack

Andreas Rheinhardt git at videolan.org
Fri Apr 19 14:53:48 EEST 2024


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Mar 24 18:14:42 2024 +0100| [d74102e325f1b3fbc983bf2eac54615de8d3dff3] | committer: Andreas Rheinhardt

avcodec/wavpack: Move transient variable from context to stack

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

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

 libavcodec/wavpack.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 6ab9088213..d4cf489c0f 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -103,7 +103,6 @@ typedef struct WavpackContext {
     WavpackFrameContext **fdec;
     int fdec_num;
 
-    int block;
     int samples;
     int ch_offset;
 
@@ -1638,14 +1637,13 @@ static int wavpack_decode_frame(AVCodecContext *avctx, AVFrame *frame,
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     int frame_size, ret, frame_flags;
-    int new_progress = 0;
+    int block = 0, new_progress = 0;
 
     av_assert1(!s->curr_progress || s->dsdctx);
 
     if (avpkt->size <= WV_HEADER_SIZE)
         return AVERROR_INVALIDDATA;
 
-    s->block     = 0;
     s->ch_offset = 0;
 
     /* determine number of samples */
@@ -1666,14 +1664,15 @@ static int wavpack_decode_frame(AVCodecContext *avctx, AVFrame *frame,
         if (frame_size <= 0 || frame_size > buf_size) {
             av_log(avctx, AV_LOG_ERROR,
                    "Block %d has invalid size (size %d vs. %d bytes left)\n",
-                   s->block, frame_size, buf_size);
+                   block, frame_size, buf_size);
             ret = AVERROR_INVALIDDATA;
             goto error;
         }
-        ret = wavpack_decode_block(avctx, frame, s->block, buf, frame_size, &new_progress);
+        ret = wavpack_decode_block(avctx, frame, block, buf,
+                                   frame_size, &new_progress);
         if (ret < 0)
             goto error;
-        s->block++;
+        block++;
         buf      += frame_size;
         buf_size -= frame_size;
     }



More information about the ffmpeg-cvslog mailing list