History

avcodec/wavpack: Move transient variable from context to stack

Andreas Rheinhardt committed 2 years ago

Commit d74102e1 parent 483c85e1 file · +5 −6Browse files

Unified · Split

libavcodec/wavpack.c+5−6
@@ -103,7 +103,6 @@ typedef struct WavpackContext { · 102 unmodified lines
103103 WavpackFrameContext **fdec;
104104 int fdec_num;
105105
106− int block;
107106 int samples;
108107 int ch_offset;
109108
@@ -1638,14 +1637,13 @@ static int wavpack_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 1528 unmodified lines
16381637 const uint8_t *buf = avpkt->data;
16391638 int buf_size = avpkt->size;
16401639 int frame_size, ret, frame_flags;
1641− int new_progress = 0;
1640+ int block = 0, new_progress = 0;
16421641
16431642 av_assert1(!s->curr_progress || s->dsdctx);
16441643
16451644 if (avpkt->size <= WV_HEADER_SIZE)
16461645 return AVERROR_INVALIDDATA;
16471646
1648− s->block = 0;
16491647 s->ch_offset = 0;
16501648
16511649 /* determine number of samples */
@@ -1666,14 +1664,15 @@ static int wavpack_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 14 unmodified lines
16661664 if (frame_size <= 0 || frame_size > buf_size) {
16671665 av_log(avctx, AV_LOG_ERROR,
16681666 "Block %d has invalid size (size %d vs. %d bytes left)\n",
1669− s->block, frame_size, buf_size);
1667+ block, frame_size, buf_size);
16701668 ret = AVERROR_INVALIDDATA;
16711669 goto error;
16721670 }
1673− ret = wavpack_decode_block(avctx, frame, s->block, buf, frame_size, &new_progress);
1671+ ret = wavpack_decode_block(avctx, frame, block, buf,
1672+ frame_size, &new_progress);
16741673 if (ret < 0)
16751674 goto error;
1676− s->block++;
1675+ block++;
16771676 buf += frame_size;
16781677 buf_size -= frame_size;
16791678 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t