1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/mpeg4videodec: Avoid unnecessary indirections

This basically reverts d4967c04e0.
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>
This commit is contained in:
Andreas Rheinhardt
2025-06-19 15:50:32 +02:00
parent 273de7f60c
commit 91e9578025

View File

@ -1647,12 +1647,10 @@ not_coded:
*/ */
static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64]) 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; int cbp, mb_type, use_intra_dc_vlc;
const int xy = s->mb_x + s->mb_y * s->mb_stride; 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]; mb_type = s->cur_pic.mb_type[xy];
cbp = s->cbp_table[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]) 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; int cbpc, cbpy, i, cbp, pred_x, pred_y, mx, my, dquant;
static const int8_t quant_tab[4] = { -1, -2, 1, 2 }; static const int8_t quant_tab[4] = { -1, -2, 1, 2 };
const int xy = s->mb_x + s->mb_y * s->mb_stride; const int xy = s->mb_x + s->mb_y * s->mb_stride;
int next; int next;
av_assert2(s == (void*)ctx);
av_assert2(s->h263_pred); av_assert2(s->h263_pred);
if (s->pict_type == AV_PICTURE_TYPE_P || 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) 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, int cc, dct_dc_size, dct_diff, code, j, idx = 1, group = 0, run = 0,
additional_code_len, sign, mismatch; additional_code_len, sign, mismatch;