diff mbox series

[FFmpeg-devel,v2,29/71] avcodec/h263: Move setting mbskip_table to decoder/encoders

Message ID GV1P250MB07374276492BFF6598710E428FE02@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State New
Headers show
Series [FFmpeg-devel,v2,01/71] avcodec/ratecontrol: Fix double free on error | expand

Commit Message

Andreas Rheinhardt May 11, 2024, 8:50 p.m. UTC
This removes a branch from H.263 based decoders.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/h263.c          | 3 ---
 libavcodec/ituh263enc.c    | 3 +++
 libavcodec/mpeg4videodec.c | 4 ++++
 3 files changed, 7 insertions(+), 3 deletions(-)
diff mbox series

Patch

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 6a7a37e817..482bc48f89 100644
--- a/libavcodec/mpeg4videodec.c
+++ b/libavcodec/mpeg4videodec.c
@@ -1592,9 +1592,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]);
@@ -1676,6 +1678,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  |
@@ -1684,6 +1687,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;