[FFmpeg-devel] [PATCH 3/3] h264: new assembly version of get_cabac for x86_64 with PIC

Roland Scheidegger rscheidegger_lists at hispeed.ch
Fri Apr 27 21:54:27 CEST 2012

Am 27.04.2012 21:06, schrieb Michael Niedermayer:
> On Fri, Apr 27, 2012 at 03:45:26AM +0200, Roland Scheidegger wrote:
>> This adds a hand-optimized assembly version for get_cabac much like the
>> existing one, but it works if the table offsets are RIP-relative.
>> Compared to the non-RIP-relative version this adds 2 lea instructions
>> and it needs one extra register.
>> There is a surprisingly large performance improvement over the c version (more
>> so than the generated assembly seems to suggest) just in get_cabac, I measured
>> roughly 40% faster for get_cabac on a K8. However, overall the difference is
>> not that big, I measured roughly 5% on a test clip on a K8 and a Core2.
>> Hopefully it still compiles on x86 32bit...
>> Now that only one table is used, there's some chance even darwin as compiles
>> this (apparently the label arithmetic used previously doesn't work if it
>> involves symbols defined in a different file, thanks to Ronald S. Bultje for
>> helping me with this).
> with the 3 patches applied i get
> In file included from libavcodec/cabac_functions.h:36:0,
>                  from libavcodec/cabac.c:32:
> libavcodec/x86/cabac.h: In function ‘get_cabac_inline_x86’:
> libavcodec/x86/cabac.h:169:79: error: macro "BRANCHLESS_GET_CABAC_UPDATE" passed 5 arguments, but takes just 4
> libavcodec/x86/cabac.h:167:9: error: expected ‘;’ before string constant
> libavcodec/x86/cabac.h:156:14: warning: unused variable ‘tmp’ [-Wunused-variable]

Ahh that must be non-pic case.

That was an accident happening when splitting up the patch into multiple
ones, had to trim macro arguments and inadvertently trimmed arguments
for BRANCHLESS_GET_CABAC_UPDATE too (which indeed did have a unnecessary
I can respin the series either way (with the argument removed or just
left as is as that's not really a related change).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: cabac_x86_nonpicfix.diff
Type: text/x-patch
Size: 823 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120427/2866da92/attachment.bin>

More information about the ffmpeg-devel mailing list