diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-24 18:07:51 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-24 18:15:18 +0300 |
commit | 404fe63e23433aa559cee5366cb26f78b425e7e5 (patch) | |
tree | 86eb7880b36ebf79992c2081995e61a543b5e705 /libavcodec | |
parent | b71dc297296a8a659fa7299acb6ebaa95a885ffd (diff) |
avcodec: Pass PutBitContext into ff_h263_encode_motion() instead of MpegEncContext
This avoids the need to dereference MpegEncContext->pb if it is
already available outside ff_h263_encode_motion()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/h263.h | 6 | ||||
-rw-r--r-- | libavcodec/ituh263enc.c | 8 | ||||
-rw-r--r-- | libavcodec/svq1enc.c | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/libavcodec/h263.h b/libavcodec/h263.h index 8b2e0166bb..1f954cdf6f 100644 --- a/libavcodec/h263.h +++ b/libavcodec/h263.h @@ -123,7 +123,7 @@ int av_const h263_get_picture_format(int width, int height); void ff_clean_h263_qscales(MpegEncContext *s); int ff_h263_resync(MpegEncContext *s); -void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code); +void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code); static inline int h263_get_motion_length(int val, int f_code){ @@ -149,8 +149,8 @@ static inline void ff_h263_encode_motion_vector(MpegEncContext * s, int x, int y h263_get_motion_length(x, f_code) +h263_get_motion_length(y, f_code)); }else{ - ff_h263_encode_motion(s, x, f_code); - ff_h263_encode_motion(s, y, f_code); + ff_h263_encode_motion(&s->pb, x, f_code); + ff_h263_encode_motion(&s->pb, y, f_code); } } diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c index aeb2202bc1..cbe8acb7b0 100644 --- a/libavcodec/ituh263enc.c +++ b/libavcodec/ituh263enc.c @@ -642,14 +642,14 @@ void ff_h263_encode_mb(MpegEncContext * s, } } -void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code) +void ff_h263_encode_motion(PutBitContext *pb, int val, int f_code) { int range, bit_size, sign, code, bits; if (val == 0) { /* zero vector */ code = 0; - put_bits(&s->pb, ff_mvtab[code][1], ff_mvtab[code][0]); + put_bits(pb, ff_mvtab[code][1], ff_mvtab[code][0]); } else { bit_size = f_code - 1; range = 1 << bit_size; @@ -663,9 +663,9 @@ void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code) code = (val >> bit_size) + 1; bits = val & (range - 1); - put_bits(&s->pb, ff_mvtab[code][1] + 1, (ff_mvtab[code][0] << 1) | sign); + put_bits(pb, ff_mvtab[code][1] + 1, (ff_mvtab[code][0] << 1) | sign); if (bit_size > 0) { - put_bits(&s->pb, bit_size, bits); + put_bits(pb, bit_size, bits); } } } diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index a1bab4261d..3fc7ecaa52 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -421,8 +421,8 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, av_assert1(my >= -32 && my <= 31); av_assert1(pred_x >= -32 && pred_x <= 31); av_assert1(pred_y >= -32 && pred_y <= 31); - ff_h263_encode_motion(&s->m, mx - pred_x, 1); - ff_h263_encode_motion(&s->m, my - pred_y, 1); + ff_h263_encode_motion(&s->m.pb, mx - pred_x, 1); + ff_h263_encode_motion(&s->m.pb, my - pred_y, 1); s->reorder_pb[5] = s->m.pb; score[1] += lambda * put_bits_count(&s->reorder_pb[5]); |