From 47e43c19cb50083bf55ea48e4caabc20ca2a8c33 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Fri, 3 May 2024 18:22:59 +0200 Subject: [PATCH] avcodec/h263: Move setting mbskip_table to decoder/encoders This removes a branch from H.263 based decoders. Signed-off-by: Andreas Rheinhardt --- libavcodec/h263.c | 3 --- libavcodec/ituh263enc.c | 3 +++ libavcodec/mpeg4videodec.c | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libavcodec/h263.c b/libavcodec/h263.c index b4cf5ee0de..9849f651cb 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -56,9 +56,6 @@ void ff_h263_update_motion_val(MpegEncContext * s){ const int wrap = s->b8_stride; const int xy = s->block_index[0]; - if (s->current_picture.mbskip_table) - s->current_picture.mbskip_table[mb_xy] = s->mb_skipped; - if(s->mv_type != MV_TYPE_8X8){ int motion_x, motion_y; if (s->mb_intra) { diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c index 87689e5f5b..e27bd258d7 100644 --- a/libavcodec/ituh263enc.c +++ b/libavcodec/ituh263enc.c @@ -692,6 +692,9 @@ void ff_h263_update_mb(MpegEncContext *s) { const int mb_xy = s->mb_y * s->mb_stride + s->mb_x; + if (s->current_picture.mbskip_table) + s->current_picture.mbskip_table[mb_xy] = s->mb_skipped; + if (s->mv_type == MV_TYPE_8X8) s->current_picture.mb_type[mb_xy] = MB_TYPE_L0 | MB_TYPE_8x8; else if(s->mb_intra) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index df1e22207d..153a9371e0 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -1594,9 +1594,11 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64]) && ctx->vol_sprite_usage == GMC_SPRITE) { s->mcsel = 1; s->mb_skipped = 0; + s->current_picture.mbskip_table[xy] = 0; } else { s->mcsel = 0; s->mb_skipped = 1; + s->current_picture.mbskip_table[xy] = 1; } } else if (s->mb_intra) { s->ac_pred = IS_ACPRED(s->current_picture.mb_type[xy]); @@ -1678,6 +1680,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->mcsel = 1; s->mv[0][0][0] = get_amv(ctx, 0); s->mv[0][0][1] = get_amv(ctx, 1); + s->current_picture.mbskip_table[xy] = 0; s->mb_skipped = 0; } else { s->current_picture.mb_type[xy] = MB_TYPE_SKIP | @@ -1686,6 +1689,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) s->mcsel = 0; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; + s->current_picture.mbskip_table[xy] = 1; s->mb_skipped = 1; } goto end;