[FFmpeg-devel] Fix MMX dct_quantize for non zigzag_direct scans
Tue May 13 05:39:39 CEST 2008
If I use dct_quantize_c for the mimic encoder, all goes well. But if I
use MMX dct_quantize, it doesn't work the same. The last_non_zero value
returned is wrong. There is a note about it in
libavcodec/mpegvideo_enc.c and it searches again for the last_non_zero
coeff after all calls to dct_quantize if they're not dct_quantize_c.
MMX dct_quantize uses inv_zigzag_direct16 independing of the scantable,
so that's why (I think) it returns the wrong value. If I change
ScanTable to also have an inverse table on MMX and use that instead,
it returns the right value. But MMX dct_quantize uses custom code to
permute the block in the end, and with this new last_non_zero value
(from inverse) it doesn't copy the blocks correctly. If I add
non-optimized block permuting code for the cases of alternate scan, it
I thought maybe the current code always returned a larger last_non_zero
value, but it doesn't happen all the time (although it happens most of
But then I got confused... Isn't that custom permute code only good for
ff_zigzag_direct? Shouldn't it copy the wrong values for alternate
scans? Or are the values being permuted somewhere else again?
Anyways, attached patch gives same resulting file for tempete.cif
encoded in mpeg4 with -flags +alt.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4564 bytes
Desc: not available
More information about the ffmpeg-devel