[FFmpeg-devel] [PATCH] move fast dct and trellis quantize function pointers initialization

Måns Rullgård mans
Wed Jun 20 10:14:50 CEST 2007

Michael Niedermayer <michaelni at gmx.at> writes:

> Hi
> On Wed, Jun 20, 2007 at 08:38:06AM +0100, M?ns Rullg?rd wrote:
>> Benoit Fouet <benoit.fouet at purplelabs.com> writes:
>> > Hi,
>> >
>> > the patch moves the encoder specific part of DCT_common_init under the
>> > same ifdef.
>> > it also removes the comment telling to do so :)
>> OK with me.
> the 
> s->fast_dct_quantize= s->dct_quantize;
> is currently done after dct_quantize is set up (possibly to a mmx optimized
> variant) but after the patch its just set to the c variant ...

Dang, I didn't notice that.  On second inspection, this code isn't
really good at all.  If we added a new field, dct_quantize_trellis,
and initialised that to dct_quantize_trellis_c in the first #ifdef
block, then the second #ifdef block could be changed to

    s->fast_dct_quantize= s->dct_quantize;

        s->dct_quantize= dct_quantize_trellis;

allowing the arch init code to set an optimised quantiser, which is
currently not possible.  This second part doesn't strictly need the
ifdef either.  A few useless assignments during init is better than
code clutter IMHO.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list