[FFmpeg-cvslog] h264: use struct offsets in get_cabac_bypass_sign_x86().

Michael Niedermayer michaelni at gmx.at
Sun Apr 1 13:09:12 CEST 2012


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


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-cvslog/attachments/20120401/732633c7/attachment.asc>


More information about the ffmpeg-cvslog mailing list