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

Uoti Urpala uoti.urpala
Sun Oct 15 20:05:52 CEST 2006

On Sat, 2006-10-14 at 13:17 +0200, Michael Niedermayer wrote:
> todays useless attached cabac patch changes the hardcoded registers into
> more flexible constraints its supposed to be better as gcc should be able
> to reuse registers and avoid a few loads/stores but it isnt faster, instead
> its significantly slower, ive not looked at the asm code gcc generates but
> ive tried a few different gcc versions ...

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.
That would have 2 benefits:
1) free up a register - there's no need for CABACContext *c, all uses of
it could use the stack pointer just as well.
2) gcc would probably be able to generate sane code for accessing stack
variables in asm with "+r". At least adding "=r"(some_local_variable) to
the current cabac.h asm worked in my test while adding "=r"(c->range)
makes it fail with the out of registers error.

More information about the ffmpeg-devel mailing list