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>
This commit is contained in:
Michael Niedermayer 2015-05-24 17:07:51 +02:00
parent b71dc29729
commit 404fe63e23
3 changed files with 9 additions and 9 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}
}

View File

@ -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]);