# HG changeset patch # User michael # Date 1085964175 0 # Node ID 533717e2910f6db3d81593964fbf40e7fe39a2aa # Parent 541686b38a5e785d3f1f7dbafd1fdb6537c875f0 h261 dequant fix diff -r 541686b38a5e -r 533717e2910f mpegvideo.c --- a/mpegvideo.c Sun May 30 22:29:15 2004 +0000 +++ b/mpegvideo.c Mon May 31 00:42:55 2004 +0000 @@ -5800,7 +5800,7 @@ static void dct_unquantize_h261_intra_c(MpegEncContext *s, DCTELEM *block, int n, int qscale) { - int i, level, odd; + int i, level, even; int nCoeffs; assert(s->block_last_index[n]>=0); @@ -5809,16 +5809,16 @@ block[0] = block[0] * s->y_dc_scale; else block[0] = block[0] * s->c_dc_scale; - odd = qscale & 0x1; + even = (qscale & 1)^1; nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; for(i=1; i<=nCoeffs; i++){ level = block[i]; if (level){ if (level < 0){ - level = qscale * ((level << 1) - 1) + (~odd); + level = qscale * ((level << 1) - 1) + even; }else{ - level = qscale * ((level << 1) + 1) - (~odd); + level = qscale * ((level << 1) + 1) - even; } } block[i] = level; @@ -5828,12 +5828,12 @@ static void dct_unquantize_h261_inter_c(MpegEncContext *s, DCTELEM *block, int n, int qscale) { - int i, level, odd; + int i, level, even; int nCoeffs; assert(s->block_last_index[n]>=0); - - odd = qscale & 0x1; + + even = (qscale & 1)^1; nCoeffs= s->inter_scantable.raster_end[ s->block_last_index[n] ]; @@ -5841,9 +5841,9 @@ level = block[i]; if (level){ if (level < 0){ - level = qscale * ((level << 1) - 1) + (~odd); + level = qscale * ((level << 1) - 1) + even; }else{ - level = qscale * ((level << 1) + 1) - (~odd); + level = qscale * ((level << 1) + 1) - even; } } block[i] = level;