[FFmpeg-cvslog] h264: use struct offsets in get_cabac_bypass_sign_x86().
Aurélien Nephtali
aurelien.nephtali at gmail.com
Mon Apr 2 20:42:11 CEST 2012
On Sun, Apr 1, 2012 at 11:57 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sun, Apr 01, 2012 at 02:07:56PM +0200, Aurélien Nephtali wrote:
>> Hi,
>>
>> On Sun, Apr 1, 2012 at 1:09 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
>> > On Sun, Apr 01, 2012 at 12:30:26PM +0200, Aurélien Nephtali wrote:
>> >> Hi,
>> >>
>> >> On Thu, Mar 29, 2012 at 4:32 AM, Ronald S. Bultje <git at videolan.org> wrote:
>> >> > ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Fri Mar 16 22:41:17 2012 -0700| [db025929f202bc32459a1278ee06920a06564762] | committer: Ronald S. Bultje
>> >> >
>> >> > h264: use struct offsets in get_cabac_bypass_sign_x86().
>> >> >
>> >> >> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=db025929f202bc32459a1278ee06920a06564762
>> >> > ---
>> >> >
>> >> > libavcodec/x86/cabac.h | 19 +++++++++++--------
>> >> > 1 files changed, 11 insertions(+), 8 deletions(-)
>> >> >
>> >>
>> >> This change makes libavcodec crash when decoding H.264 streams involving CABAC.
>> >>
>> >> (test done on Mac OS X 10.7.3 with : gcc version 4.2.1 (Based on Apple
>> >> Inc. build 5658) (LLVM build 2336.1.00))
>> > [...]
>> >> 0x0000000100797b8e <get_cabac_bypass_sign_x86+30>: mov 0x4(%rsi),%edx
>> >> 0x0000000100797b91 <get_cabac_bypass_sign_x86+33>: mov (%rsi),%eax
>> >> 0x0000000100797b93 <get_cabac_bypass_sign_x86+35>: shl $0x11,%edx
>> >> 0x0000000100797b96 <get_cabac_bypass_sign_x86+38>: add %eax,%eax
>> >> 0x0000000100797b98 <get_cabac_bypass_sign_x86+40>: sub %edx,%eax
>> > [...]
>> > + "movl %a5(%2), %k1 \n\t"
>> > + "movl %a3(%2), %%eax \n\t"
>> > "shl $17, %k1 \n\t"
>> > "add %%eax, %%eax \n\t"
>> > "sub %k1, %%eax \n\t"
>> > [...]
>> > + : "+c"(val), "=&r"(tmp)
>> > + : "r"(c),
>> > + "i"(offsetof(CABACContext, low)),
>> > + "i"(offsetof(CABACContext, bytestream)),
>> > + "i"(offsetof(CABACContext, range))
>> > + : "%eax", "%edx", "memory"
>> >
>> > your compiler is violating the clobber list constraint for edx
>> >
>>
>> I trust you on that but what should I do then ?
>
> several options
> 1. revert these changes
> 2. use a different compiler
> 3. fix the compiler
> 4. something else i didnt think of
>
> Is there an easily available alternative without disadvantages on OSX
> to this compiler version ?
>
I read that Apple is discouraging the use of llvm-gcc in favor of
clang (shipped with Xcode)
I tested with it and there is no crash so I guess there is no need to revert.
FYI, here is what it produces :
Dump of assembler code for function get_cabac_bypass_sign_x86:
0x0051eb851e471ad0 <get_cabac_bypass_sign_x86+0>: push %rbp
0x0051eb851e471ad1 <get_cabac_bypass_sign_x86+1>: mov %rsp,%rbp
0x0051eb851e471ad4 <get_cabac_bypass_sign_x86+4>: mov %rdi,-0x8(%rbp)
0x0051eb851e471ad8 <get_cabac_bypass_sign_x86+8>: mov %esi,-0xc(%rbp)
0x0051eb851e471adb <get_cabac_bypass_sign_x86+11>: mov -0x8(%rbp),%rax
0x0051eb851e471adf <get_cabac_bypass_sign_x86+15>: mov -0x8(%rbp),%rcx
0x0051eb851e471ae3 <get_cabac_bypass_sign_x86+19>: mov $0x18,%rdx
0x0051eb851e471aed <get_cabac_bypass_sign_x86+29>: add %rdx,%rcx
0x0051eb851e471af0 <get_cabac_bypass_sign_x86+32>: mov -0x8(%rbp),%rdx
0x0051eb851e471af4 <get_cabac_bypass_sign_x86+36>: mov $0x4,%rsi
0x0051eb851e471afe <get_cabac_bypass_sign_x86+46>: add %rsi,%rdx
0x0051eb851e471b01 <get_cabac_bypass_sign_x86+49>: mov -0xc(%rbp),%esi
0x0051eb851e471b04 <get_cabac_bypass_sign_x86+52>: mov %rcx,-0x28(%rbp)
0x0051eb851e471b08 <get_cabac_bypass_sign_x86+56>: mov %esi,%ecx
0x0051eb851e471b0a <get_cabac_bypass_sign_x86+58>: mov %rdx,-0x30(%rbp)
0x0051eb851e471b0e <get_cabac_bypass_sign_x86+62>: mov %rax,-0x38(%rbp)
0x0051eb851e471b12 <get_cabac_bypass_sign_x86+66>: mov -0x38(%rbp),%rdi
0x0051eb851e471b16 <get_cabac_bypass_sign_x86+70>: mov -0x28(%rbp),%r8
0x0051eb851e471b1a <get_cabac_bypass_sign_x86+74>: mov -0x30(%rbp),%r9
0x0051eb851e471b1e <get_cabac_bypass_sign_x86+78>: mov (%r9),%esi
0x0051eb851e471b21 <get_cabac_bypass_sign_x86+81>: mov (%rdi),%eax
0x0051eb851e471b23 <get_cabac_bypass_sign_x86+83>: shl $0x11,%esi
0x0051eb851e471b26 <get_cabac_bypass_sign_x86+86>: add %eax,%eax
0x0051eb851e471b28 <get_cabac_bypass_sign_x86+88>: sub %esi,%eax
0x0051eb851e471b2a <get_cabac_bypass_sign_x86+90>: cltd
0x0051eb851e471b2b <get_cabac_bypass_sign_x86+91>: and %edx,%esi
0x0051eb851e471b2d <get_cabac_bypass_sign_x86+93>: add %esi,%eax
0x0051eb851e471b2f <get_cabac_bypass_sign_x86+95>: xor %edx,%ecx
0x0051eb851e471b31 <get_cabac_bypass_sign_x86+97>: sub %edx,%ecx
0x0051eb851e471b33 <get_cabac_bypass_sign_x86+99>: test %ax,%ax
0x0051eb851e471b36 <get_cabac_bypass_sign_x86+102>: jne
0x51eb851e471b51 <get_cabac_bypass_sign_x86+129>
0x0051eb851e471b38 <get_cabac_bypass_sign_x86+104>: mov (%r8),%rsi
0x0051eb851e471b3b <get_cabac_bypass_sign_x86+107>: sub $0xffff,%eax
0x0051eb851e471b40 <get_cabac_bypass_sign_x86+112>: movzwl (%rsi),%edx
0x0051eb851e471b43 <get_cabac_bypass_sign_x86+115>: bswap %edx
0x0051eb851e471b45 <get_cabac_bypass_sign_x86+117>: shr $0xf,%edx
0x0051eb851e471b48 <get_cabac_bypass_sign_x86+120>: add $0x2,%rsi
0x0051eb851e471b4c <get_cabac_bypass_sign_x86+124>: add %edx,%eax
0x0051eb851e471b4e <get_cabac_bypass_sign_x86+126>: mov %rsi,(%r8)
0x0051eb851e471b51 <get_cabac_bypass_sign_x86+129>: mov %eax,(%rdi)
0x0051eb851e471b53 <get_cabac_bypass_sign_x86+131>: mov %ecx,-0xc(%rbp)
0x0051eb851e471b56 <get_cabac_bypass_sign_x86+134>: mov %rsi,-0x20(%rbp)
0x0051eb851e471b5a <get_cabac_bypass_sign_x86+138>: mov -0xc(%rbp),%eax
0x0051eb851e471b5d <get_cabac_bypass_sign_x86+141>: mov %eax,-0x14(%rbp)
0x0051eb851e471b60 <get_cabac_bypass_sign_x86+144>: mov %eax,-0x10(%rbp)
0x0051eb851e471b63 <get_cabac_bypass_sign_x86+147>: mov -0x10(%rbp),%eax
0x0051eb851e471b66 <get_cabac_bypass_sign_x86+150>: pop %rbp
0x0051eb851e471b67 <get_cabac_bypass_sign_x86+151>: retq
--
Aurélien Nephtali
More information about the ffmpeg-cvslog
mailing list