aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-11-07 23:45:00 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2022-11-11 12:24:23 +0100
commitf56ca21dd4a8061875ac736356ac142bb3163e3b (patch)
tree29219988ef6ab8b597fcdcf76bcd25c60892333c
parente559f8428faee13f4dd28ad2163d124c3288a11f (diff)
downloadffmpeg-f56ca21dd4a8061875ac736356ac142bb3163e3b.tar.gz
avcodec/h261dec: Don't update block_index unnecessarily
block_index is write-only for the H.261 decoder, so don't update it by calling ff_update_block_index(). Instead use a function of our own to set/update dest. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/h261dec.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 5e4f298291..57f7e8bf35 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -101,6 +101,15 @@ static av_cold int h261_decode_init(AVCodecContext *avctx)
return 0;
}
+static inline void h261_init_dest(MpegEncContext *s)
+{
+ const unsigned block_size = 8 >> s->avctx->lowres;
+ ff_init_block_index(s);
+ s->dest[0] += 2 * block_size;
+ s->dest[1] += block_size;
+ s->dest[2] += block_size;
+}
+
/**
* Decode the group of blocks header or slice header.
* @return <0 if an error occurred
@@ -213,8 +222,7 @@ static int h261_decode_mb_skipped(H261DecContext *h, int mba1, int mba2)
s->mb_x = ((h->gob_number - 1) % 2) * 11 + i % 11;
s->mb_y = ((h->gob_number - 1) / 2) * 3 + i / 11;
xy = s->mb_x + s->mb_y * s->mb_stride;
- ff_init_block_index(s);
- ff_update_block_index(s, 8, s->avctx->lowres, 1);
+ h261_init_dest(s);
for (j = 0; j < 6; j++)
s->block_last_index[j] = -1;
@@ -399,8 +407,7 @@ static int h261_decode_mb(H261DecContext *h)
s->mb_x = ((h->gob_number - 1) % 2) * 11 + ((h->current_mba - 1) % 11);
s->mb_y = ((h->gob_number - 1) / 2) * 3 + ((h->current_mba - 1) / 11);
xy = s->mb_x + s->mb_y * s->mb_stride;
- ff_init_block_index(s);
- ff_update_block_index(s, 8, s->avctx->lowres, 1);
+ h261_init_dest(s);
// Read mtype
com->mtype = get_vlc2(&s->gb, h261_mtype_vlc.table, H261_MTYPE_VLC_BITS, 2);