diff mbox series

[FFmpeg-devel,06/41] avcodec/h261enc: Pass PutBitContext directly in h261_encode_motion()

Message ID AM7PR03MB666029172D71BA32069C154C8F249@AM7PR03MB6660.eurprd03.prod.outlook.com
State Superseded
Headers show
Series [FFmpeg-devel,01/41] avcodec/mpegvideo_enc: Allow slices only for slice-thread-able codecs | expand

Commit Message

Andreas Rheinhardt Jan. 30, 2022, 6:27 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/h261enc.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/h261enc.c b/libavcodec/h261enc.c
index 13fe5bbfb2..7e3af1ff9e 100644
--- a/libavcodec/h261enc.c
+++ b/libavcodec/h261enc.c
@@ -140,13 +140,12 @@  void ff_h261_reorder_mb_index(MpegEncContext *s)
     }
 }
 
-static void h261_encode_motion(H261EncContext *h, int val)
+static void h261_encode_motion(PutBitContext *pb, int val)
 {
-    MpegEncContext *const s = &h->s;
     int sign, code;
     if (val == 0) {
         code = 0;
-        put_bits(&s->pb, ff_h261_mv_tab[code][1], ff_h261_mv_tab[code][0]);
+        put_bits(pb, ff_h261_mv_tab[code][1], ff_h261_mv_tab[code][0]);
     } else {
         if (val > 15)
             val -= 32;
@@ -154,8 +153,8 @@  static void h261_encode_motion(H261EncContext *h, int val)
             val += 32;
         sign = val < 0;
         code = sign ? -val : val;
-        put_bits(&s->pb, ff_h261_mv_tab[code][1], ff_h261_mv_tab[code][0]);
-        put_bits(&s->pb, 1, sign);
+        put_bits(pb, ff_h261_mv_tab[code][1], ff_h261_mv_tab[code][0]);
+        put_bits(pb, 1, sign);
     }
 }
 
@@ -313,8 +312,8 @@  void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64],
         mv_diff_y       = (motion_y >> 1) - s->last_mv[0][0][1];
         s->last_mv[0][0][0] = (motion_x >> 1);
         s->last_mv[0][0][1] = (motion_y >> 1);
-        h261_encode_motion(h, mv_diff_x);
-        h261_encode_motion(h, mv_diff_y);
+        h261_encode_motion(&s->pb, mv_diff_x);
+        h261_encode_motion(&s->pb, mv_diff_y);
     }
 
     if (HAS_CBP(com->mtype)) {