Commit 9f73b88c authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/h261enc: fix dquant encoding

Fixes Ticket4111
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent f5722ba2
...@@ -250,12 +250,13 @@ void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64], ...@@ -250,12 +250,13 @@ void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64],
/* mvd indicates if this block is motion compensated */ /* mvd indicates if this block is motion compensated */
mvd = motion_x | motion_y; mvd = motion_x | motion_y;
if ((cbp | mvd | s->dquant) == 0) { if ((cbp | mvd) == 0) {
/* skip macroblock */ /* skip macroblock */
s->skip_count++; s->skip_count++;
s->mb_skip_run++; s->mb_skip_run++;
s->last_mv[0][0][0] = 0; s->last_mv[0][0][0] = 0;
s->last_mv[0][0][1] = 0; s->last_mv[0][0][1] = 0;
s->qscale -= s->dquant;
return; return;
} }
} }
...@@ -274,13 +275,15 @@ void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64], ...@@ -274,13 +275,15 @@ void ff_h261_encode_mb(MpegEncContext *s, int16_t block[6][64],
h->mtype += 3; h->mtype += 3;
if (s->loop_filter) if (s->loop_filter)
h->mtype += 3; h->mtype += 3;
if (cbp || s->dquant) if (cbp)
h->mtype++; h->mtype++;
av_assert1(h->mtype > 1); av_assert1(h->mtype > 1);
} }
if (s->dquant) if (s->dquant && cbp) {
h->mtype++; h->mtype++;
} else
s->qscale -= s->dquant;
put_bits(&s->pb, put_bits(&s->pb,
ff_h261_mtype_bits[h->mtype], ff_h261_mtype_bits[h->mtype],
......
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