changeset 5542:b0a566346fb1 libavcodec

Add attribute that forces alignment of stack to functions that need it. Necessary for systems that don't align by default to 16 bytes, required by some SSE instructions. Requires GCC >= 4.2. Based on patch by Ga¸«³l Chardon.
author ramiro
date Mon, 13 Aug 2007 15:28:29 +0000
parents 6c385356e61f
children 56bc8fbd9aee
files dsputil.c pthread.c utils.c w32thread.c
diffstat 4 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/dsputil.c	Mon Aug 13 14:16:20 2007 +0000
+++ b/dsputil.c	Mon Aug 13 15:28:29 2007 +0000
@@ -3833,7 +3833,8 @@
             av_log(NULL, AV_LOG_ERROR,
                 "Compiler did not align stack variables. Libavcodec has been miscompiled\n"
                 "and may be very slow or crash. This is not a bug in libavcodec,\n"
-                "but in the compiler. Do not report crashes to FFmpeg developers.\n");
+                "but in the compiler. You may try recompiling using gcc >= 4.2.\n"
+                "Do not report crashes to FFmpeg developers.\n");
 #endif
             did_fail=1;
         }
--- a/pthread.c	Mon Aug 13 14:16:20 2007 +0000
+++ b/pthread.c	Mon Aug 13 15:28:29 2007 +0000
@@ -42,7 +42,7 @@
     int done;
 } ThreadContext;
 
-static void* worker(void *v)
+static void* attribute_align_arg worker(void *v)
 {
     AVCodecContext *avctx = v;
     ThreadContext *c = avctx->thread_opaque;
--- a/utils.c	Mon Aug 13 14:16:20 2007 +0000
+++ b/utils.c	Mon Aug 13 15:28:29 2007 +0000
@@ -829,7 +829,7 @@
     return pic;
 }
 
-int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
+int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
 {
     int ret= -1;
 
@@ -880,7 +880,7 @@
     return ret;
 }
 
-int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
+int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
                          const short *samples)
 {
     if(buf_size < FF_MIN_BUFFER_SIZE && 0){
@@ -895,7 +895,7 @@
         return 0;
 }
 
-int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
+int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
                          const AVFrame *pict)
 {
     if(buf_size < FF_MIN_BUFFER_SIZE){
@@ -923,7 +923,7 @@
     return ret;
 }
 
-int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
+int attribute_align_arg avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
                          int *got_picture_ptr,
                          uint8_t *buf, int buf_size)
 {
@@ -946,7 +946,7 @@
     return ret;
 }
 
-int avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
+int attribute_align_arg avcodec_decode_audio2(AVCodecContext *avctx, int16_t *samples,
                          int *frame_size_ptr,
                          uint8_t *buf, int buf_size)
 {
--- a/w32thread.c	Mon Aug 13 14:16:20 2007 +0000
+++ b/w32thread.c	Mon Aug 13 15:28:29 2007 +0000
@@ -36,7 +36,7 @@
 }ThreadContext;
 
 
-static unsigned __stdcall thread_func(void *v){
+static unsigned __stdcall attribute_align_arg thread_func(void *v){
     ThreadContext *c= v;
 
     for(;;){