Module: libav
Branch: master
Commit: 9b027c0d0794b50e3b638cca4bed925638ab68bc

Author:    Ronald S. Bultje <[email protected]>
Committer: Ronald S. Bultje <[email protected]>
Date:      Tue Feb  7 14:54:46 2012 -0800

dsputil: set STRIDE_ALIGN to 16 for x86 also.

This fixes crashes in e.g. PNG decoding with SSE2 enabled. In fact, many
x86 optimizations for codecs assume that our buffer strides are 16-byte
aligned.

---

 libavcodec/dsputil.h |   18 ++----------------
 libavcodec/utils.c   |   12 ------------
 2 files changed, 2 insertions(+), 28 deletions(-)

diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 579b54b..cadde7d 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -655,23 +655,9 @@ void ff_intrax8dsp_init(DSPContext* c, AVCodecContext 
*avctx);
 void ff_mlp_init(DSPContext* c, AVCodecContext *avctx);
 void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx);
 
-#if ARCH_ARM
-
-#if HAVE_NEON
+#if (ARCH_ARM && HAVE_NEON) || ARCH_PPC || HAVE_MMI || HAVE_MMX
 #   define STRIDE_ALIGN 16
-#endif
-
-#elif ARCH_PPC
-
-#define STRIDE_ALIGN 16
-
-#elif HAVE_MMI
-
-#define STRIDE_ALIGN 16
-
-#endif
-
-#ifndef STRIDE_ALIGN
+#else
 #   define STRIDE_ALIGN 8
 #endif
 
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 606537b..e85cdfc 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -234,18 +234,6 @@ void avcodec_align_dimensions2(AVCodecContext *s, int 
*width, int *height,
 
     for (i = 0; i < 4; i++)
         linesize_align[i] = STRIDE_ALIGN;
-//STRIDE_ALIGN is 8 for SSE* but this does not work for SVQ1 chroma planes
-//we could change STRIDE_ALIGN to 16 for x86/sse but it would increase the
-//picture size unneccessarily in some cases. The solution here is not
-//pretty and better ideas are welcome!
-#if HAVE_MMX
-    if(s->codec_id == CODEC_ID_SVQ1 || s->codec_id == CODEC_ID_VP5 ||
-       s->codec_id == CODEC_ID_VP6 || s->codec_id == CODEC_ID_VP6F ||
-       s->codec_id == CODEC_ID_VP6A) {
-        for (i = 0; i < 4; i++)
-            linesize_align[i] = 16;
-    }
-#endif
 }
 
 void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){

_______________________________________________
libav-commits mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to