Commit 404fe63e authored by Michael Niedermayer's avatar Michael Niedermayer

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: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent b71dc297
......@@ -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);
}
}
......
......@@ -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);
}
}
}
......
......@@ -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]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment