aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-03-24 18:14:42 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-04-19 13:18:04 +0200
commitd74102e325f1b3fbc983bf2eac54615de8d3dff3 (patch)
tree3bbf87563992e4a8c26f26e3d05cb3cf067dfe63
parent483c85e85e6133a197cd7b0b575fe85afab78cc2 (diff)
downloadffmpeg-d74102e325f1b3fbc983bf2eac54615de8d3dff3.tar.gz
avcodec/wavpack: Move transient variable from context to stack
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/wavpack.c11
1 files 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;
}