[Ffmpeg-devel] [PATCH] H264 cabac vlc reading code

Uoti Urpala uoti.urpala
Sun Oct 15 23:14:36 CEST 2006

On Sun, 2006-10-15 at 21:05 +0300, Uoti Urpala wrote:
> At least for the specific case of decode_cabac_residual() I think you
> could do better by making a copy of h->cabac on the stack, using that in
> the get_cabac* calls and writing it back at the end of the function.

I tested this by creating a separate get_cabac version for use in
decode_cabac_residual with constraints
        :"=&a"(bit), [range]"+m"(c->range), [low]"+m"(c->low), [bytestream]"+m"(c->bytestream)
        : "%ecx", "%ebx", "%edx", "%esi"
and used that on a CABACContext on stack with .low, .range
and .bytestream copied.
(technically the constraints fail to mention that *state can change, but
I suspect gcc would generate worse code if it was an output argument -
haven't verified).

This sped up timing for decode_cabac_residual from about 4650 dezicycles
to 4550. C version with asm disabled sped up more significantly, to
4710. This asm also compiles without -fomit-frame-pointer; disabling asm
in the general get_cabac version doesn't seem to hurt performance much
(in fact it gave better overall performance in my test) and allows
compiling the whole file without -fomit-frame-pointer.

I'll post a patch for that later once I clean up the code a bit and
include the latest committed cabac.h change.

More information about the ffmpeg-devel mailing list