[FFmpeg-devel] [PATCH] Heavy optimization of IFF decoder

Ronald S. Bultje rsbultje
Tue Apr 27 16:47:41 CEST 2010


Hi,

On Mon, Apr 26, 2010 at 7:39 PM, Sebastian Vater
<cdgs.basty at googlemail.com> wrote:
> This one is the original decodeplane8 high speed patch patched against
> git HEAD.

> +        const uint32_t v = lut[get_bits(&gb, 4)];
> +        AV_WN32A(dst+i, AV_RN32A(dst+i) | v);

The v isn't really needed, just write this over one line.

> +    for(i = b32; i < b; i++) {

the i = b32 is unneeded.

> +    const uint32_t lut[] = {0x0000000,
> +                            0x1000000 << plane,
> +                            0x0010000 << plane,
> +                            0x1010000 << plane,
> +                            0x0000100 << plane,
> +                            0x1000100 << plane,
> +                            0x0010100 << plane,
> +                            0x1010100 << plane,
> +                            0x0000001 << plane,
> +                            0x1000001 << plane,
> +                            0x0010001 << plane,
> +                            0x1010001 << plane,
> +                            0x0000101 << plane,
> +                            0x1000101 << plane,
> +                            0x0010101 << plane,
> +                            0x1010101 << plane};

I really can't imagine that a static const lut[][] isn't faster. which
file did you use to test this? (Is it on mphq/samples?)

Also, I'd like to restate here (as previously said) that such
optimizations are great, but the function itself should (in a comment,
or so) still state the original (slow, but easy-to-read)
implementation for those of us reading the code.

Ronald



More information about the ffmpeg-devel mailing list