avcodec/mpegvideo: remove redundant workaround to recalculate last nonzero coefficient
The x86 optimized dct_quantize only calculates the last nonzero coefficient correctly if the zigzag scan order is used. For the alternate scan order, this value is incorrect. To work around this, the dct_unquantize functions process the entire block if the alternate scan order is used. But a second workaround (bb198e198ab) was added that recalculates the last nonzero coefficient after dct_quantize is called if the alternate scan order is used. This commit removes the first workaround, which became redundant.
This commit is contained in:
parent
b6f7271fa9
commit
4f7aeffd8c
@ -110,8 +110,7 @@ static void dct_unquantize_mpeg2_intra_c(MpegEncContext *s,
|
|||||||
if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
|
if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
|
||||||
else qscale <<= 1;
|
else qscale <<= 1;
|
||||||
|
|
||||||
if(s->alternate_scan) nCoeffs= 63;
|
nCoeffs= s->block_last_index[n];
|
||||||
else nCoeffs= s->block_last_index[n];
|
|
||||||
|
|
||||||
block[0] *= n < 4 ? s->y_dc_scale : s->c_dc_scale;
|
block[0] *= n < 4 ? s->y_dc_scale : s->c_dc_scale;
|
||||||
quant_matrix = s->intra_matrix;
|
quant_matrix = s->intra_matrix;
|
||||||
@ -141,8 +140,7 @@ static void dct_unquantize_mpeg2_intra_bitexact(MpegEncContext *s,
|
|||||||
if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
|
if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
|
||||||
else qscale <<= 1;
|
else qscale <<= 1;
|
||||||
|
|
||||||
if(s->alternate_scan) nCoeffs= 63;
|
nCoeffs= s->block_last_index[n];
|
||||||
else nCoeffs= s->block_last_index[n];
|
|
||||||
|
|
||||||
block[0] *= n < 4 ? s->y_dc_scale : s->c_dc_scale;
|
block[0] *= n < 4 ? s->y_dc_scale : s->c_dc_scale;
|
||||||
sum += block[0];
|
sum += block[0];
|
||||||
@ -175,8 +173,7 @@ static void dct_unquantize_mpeg2_inter_c(MpegEncContext *s,
|
|||||||
if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
|
if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
|
||||||
else qscale <<= 1;
|
else qscale <<= 1;
|
||||||
|
|
||||||
if(s->alternate_scan) nCoeffs= 63;
|
nCoeffs= s->block_last_index[n];
|
||||||
else nCoeffs= s->block_last_index[n];
|
|
||||||
|
|
||||||
quant_matrix = s->inter_matrix;
|
quant_matrix = s->inter_matrix;
|
||||||
for(i=0; i<=nCoeffs; i++) {
|
for(i=0; i<=nCoeffs; i++) {
|
||||||
|
@ -312,8 +312,7 @@ static void dct_unquantize_mpeg2_intra_mmx(MpegEncContext *s,
|
|||||||
if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
|
if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
|
||||||
else qscale <<= 1;
|
else qscale <<= 1;
|
||||||
|
|
||||||
if(s->alternate_scan) nCoeffs= 63; //FIXME
|
nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
|
||||||
else nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
|
|
||||||
|
|
||||||
if (n < 4)
|
if (n < 4)
|
||||||
block0 = block[0] * s->y_dc_scale;
|
block0 = block[0] * s->y_dc_scale;
|
||||||
@ -380,8 +379,7 @@ static void dct_unquantize_mpeg2_inter_mmx(MpegEncContext *s,
|
|||||||
if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
|
if (s->q_scale_type) qscale = ff_mpeg2_non_linear_qscale[qscale];
|
||||||
else qscale <<= 1;
|
else qscale <<= 1;
|
||||||
|
|
||||||
if(s->alternate_scan) nCoeffs= 63; //FIXME
|
nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
|
||||||
else nCoeffs= s->intra_scantable.raster_end[ s->block_last_index[n] ];
|
|
||||||
|
|
||||||
quant_matrix = s->inter_matrix;
|
quant_matrix = s->inter_matrix;
|
||||||
__asm__ volatile(
|
__asm__ volatile(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user