aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-09-17 12:54:53 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-09-20 18:32:28 +0200
commit353108bfab46903b06343fb6f0e4d32fb0fdfb1e (patch)
tree6c9e154afef28fd77400751ca747dc5d9452e8ce
parent6a8b3e7eb1ac05b539740c5c1e9f9d41d22c7f76 (diff)
downloadffmpeg-353108bfab46903b06343fb6f0e4d32fb0fdfb1e.tar.gz
avcodec/smc: Move transient GetByteContext from context to stack
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/smc.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/libavcodec/smc.c b/libavcodec/smc.c
index e6d01791c2..2b10e74386 100644
--- a/libavcodec/smc.c
+++ b/libavcodec/smc.c
@@ -46,8 +46,6 @@ typedef struct SmcContext {
AVCodecContext *avctx;
AVFrame *frame;
- GetByteContext gb;
-
/* SMC color tables */
uint8_t color_pairs[COLORS_PER_TABLE * CPAIR];
uint8_t color_quads[COLORS_PER_TABLE * CQUAD];
@@ -75,9 +73,8 @@ typedef struct SmcContext {
} \
}
-static int smc_decode_stream(SmcContext *s)
+static int smc_decode_stream(SmcContext *s, GetByteContext *gb)
{
- GetByteContext *gb = &s->gb;
int width = s->avctx->width;
int height = s->avctx->height;
int stride = s->frame->linesize[0];
@@ -430,20 +427,20 @@ static int smc_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
SmcContext *s = avctx->priv_data;
+ GetByteContext gb;
int ret;
int total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4);
if (total_blocks / 1024 > avpkt->size)
return AVERROR_INVALIDDATA;
- bytestream2_init(&s->gb, buf, buf_size);
-
if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
return ret;
s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx);
- ret = smc_decode_stream(s);
+ bytestream2_init(&gb, buf, buf_size);
+ ret = smc_decode_stream(s, &gb);
if (ret < 0)
return ret;