Re: [libav-devel] [PATCH 5/5] build: Add define for SIMD extensions requiring 16-byte aligned buffers

2014-07-22 Thread Diego Biurrun
On Mon, Jul 21, 2014 at 08:13:16PM -0300, James Almer wrote:
 On 21/07/14 6:21 PM, Diego Biurrun wrote:
  ---
  
  I'm slightly unsure about this one.  MMX does not require 16-byte aligned
  buffers, nor does PowerPC IIRC, but SSE and AltiVec do, so I believe my
  solution is closer to the original intention.  Please do correct me if I
  am wrong...
  
   configure  | 2 ++
   libavcodec/utils.c | 2 +-
   2 files changed, 3 insertions(+), 1 deletion(-)
  
  --- a/libavcodec/utils.c
  +++ b/libavcodec/utils.c
  @@ -189,7 +189,7 @@ int ff_side_data_update_matrix_encoding(AVFrame *frame,
   
  -#if HAVE_NEON || ARCH_PPC || HAVE_MMX
  +#if HAVE_SIMD_ALIGN_16
   #   define STRIDE_ALIGN 16
   #else
   #   define STRIDE_ALIGN 8
 
 #if HAVE_NEON || HAVE_ALTIVEC || HAVE_SSE
 #   define STRIDE_ALIGN 16
 #else
 #   define STRIDE_ALIGN 8
 #endif
 
 is simpler than adding another HAVE_ define for this single use.

Such system-specific details have no place in the general C code.  configure
is a much better-suited place to deal with such architecture specifics.

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


[libav-devel] [PATCH 5/5] build: Add define for SIMD extensions requiring 16-byte aligned buffers

2014-07-21 Thread Diego Biurrun
---

I'm slightly unsure about this one.  MMX does not require 16-byte aligned
buffers, nor does PowerPC IIRC, but SSE and AltiVec do, so I believe my
solution is closer to the original intention.  Please do correct me if I
am wrong...

 configure  | 2 ++
 libavcodec/utils.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index c74e433..bc6b0b2 100755
--- a/configure
+++ b/configure
@@ -1340,6 +1340,7 @@ ARCH_FEATURES=
 fast_cmov
 local_aligned_8
 local_aligned_16
+simd_align_16
 
 
 BUILTIN_LIST=
@@ -1695,6 +1696,7 @@ aligned_stack_if_any=aarch64 ppc x86
 fast_64bit_if_any=aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64
 fast_clz_if_any=aarch64 alpha avr32 mips ppc x86
 fast_unaligned_if_any=aarch64 ppc x86
+simd_align_16_if_any=altivec neon sse
 
 need_memalign=altivec neon sse
 
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 2abc376..16c30c3 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -189,7 +189,7 @@ int ff_side_data_update_matrix_encoding(AVFrame *frame,
 return 0;
 }
 
-#if HAVE_NEON || ARCH_PPC || HAVE_MMX
+#if HAVE_SIMD_ALIGN_16
 #   define STRIDE_ALIGN 16
 #else
 #   define STRIDE_ALIGN 8
-- 
1.8.3.2

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


Re: [libav-devel] [PATCH 5/5] build: Add define for SIMD extensions requiring 16-byte aligned buffers

2014-07-21 Thread James Almer
On 21/07/14 6:21 PM, Diego Biurrun wrote:
 ---
 
 I'm slightly unsure about this one.  MMX does not require 16-byte aligned
 buffers, nor does PowerPC IIRC, but SSE and AltiVec do, so I believe my
 solution is closer to the original intention.  Please do correct me if I
 am wrong...
 
  configure  | 2 ++
  libavcodec/utils.c | 2 +-
  2 files changed, 3 insertions(+), 1 deletion(-)
 

[...]

 diff --git a/libavcodec/utils.c b/libavcodec/utils.c
 index 2abc376..16c30c3 100644
 --- a/libavcodec/utils.c
 +++ b/libavcodec/utils.c
 @@ -189,7 +189,7 @@ int ff_side_data_update_matrix_encoding(AVFrame *frame,
  return 0;
  }
  
 -#if HAVE_NEON || ARCH_PPC || HAVE_MMX
 +#if HAVE_SIMD_ALIGN_16
  #   define STRIDE_ALIGN 16
  #else
  #   define STRIDE_ALIGN 8

#if HAVE_NEON || HAVE_ALTIVEC || HAVE_SSE
#   define STRIDE_ALIGN 16
#else
#   define STRIDE_ALIGN 8
#endif

is simpler than adding another HAVE_ define for this single use.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel