[XviD-devel] bug found in src/utils/x86_64_asm/cpuid.asm
gdj jdg
gdjjdg at gmail.com
Sat Feb 17 13:30:30 CET 2007
Hello,
I was doing some profiling on libxvidcore when I noticed it was not using
hardware
acceleration. I tracked down the problem to src/utils/x86_64_asm/cpuid.asm.
The function check_cpu_features does not return the correct features.
I use gentoo with a 64-bit kernel on an Athlon64 X2. I use mencoder and
libxvidcore-1.1.2
for testing. With gentoo a patch is installed which changes 'if (cpu_flags &
XVID_CPU_ASM)'
to 'if (cpu_flags & XVID_CPU_3DNOW)' in xvid.c. This is not a problem except
that check_cpu_features
does not return the correct flags.
The following piece of code is the culprit:
mov rax, 0x80000000
cpuid
cmp rax, 0x80000000
jbe near .cpu_quit
Using gdb I see the following happening:
0x00002b7914f89ec3 in check_cpu_features () from /usr/lib/libxvidcore.so.4
1: x/i $pc 0x2b7914f89ec3 <check_cpu_features+147>: cmp
$0xffffffff80000000,%rax
It seems the compiler treats 0x80000000 as signed. As I could not figure out
how to tell
the compiler 0x80000000 is unsigned I changed the instruction to:
cmp eax, 0x80000000
This is not the correct fix, but it works for me.
Could someone please fix this code the correct way (informing the compiler
that 0x80000000 is unsigned)?
In my testcase xvid runs about 4 times faster with hardware acceleration
enabled.
Thanx,
J.D. Gerlings
More information about the XviD-devel
mailing list