diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-06-19 15:50:32 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-07-03 20:34:51 +0200 |
commit | 91e9578025f8b251e2f56a8d06297344ae89464e (patch) | |
tree | e8cfffbd2c83d0456d3495770a34743d2f7f378f | |
parent | 273de7f60c04cab886a18a136b47f35297f6b472 (diff) | |
download | ffmpeg-91e9578025f8b251e2f56a8d06297344ae89464e.tar.gz |
avcodec/mpeg4videodec: Avoid unnecessary indirections
This basically reverts d4967c04e040b3b2f937cad88599af825147ec94.
Said commit was based on the false premise that it would
be an aliasing violation to upcast a pointer to structure
to a pointer to a bigger structure containing the original
structure as its first element, but this is just not true.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavcodec/mpeg4videodec.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 34f383bbbd..c61fd23c48 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1647,12 +1647,10 @@ not_coded: */ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64]) { - Mpeg4DecContext *ctx = s->avctx->priv_data; + Mpeg4DecContext *const ctx = (Mpeg4DecContext*)s; int cbp, mb_type, use_intra_dc_vlc; const int xy = s->mb_x + s->mb_y * s->mb_stride; - av_assert2(s == (void*)ctx); - mb_type = s->cur_pic.mb_type[xy]; cbp = s->cbp_table[xy]; @@ -1737,13 +1735,12 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64]) static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) { - Mpeg4DecContext *ctx = s->avctx->priv_data; + Mpeg4DecContext *const ctx = (Mpeg4DecContext*)s; int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant; static const int8_t quant_tab[4] = { -1, -2, 1, 2 }; const int xy = s->mb_x + s->mb_y * s->mb_stride; int next; - av_assert2(s == (void*)ctx); av_assert2(s->h263_pred); if (s->pict_type == AV_PICTURE_TYPE_P || @@ -2153,7 +2150,7 @@ static const uint8_t ac_state_tab[22][2] = static int mpeg4_decode_studio_block(MpegEncContext *s, int32_t block[64], int n) { - Mpeg4DecContext *ctx = s->avctx->priv_data; + Mpeg4DecContext *const ctx = (Mpeg4DecContext*)s; int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0, run = 0, additional_code_len, sign, mismatch; |