]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit '4fb311c804098d78e5ce5f527f9a9c37536d3a08'
authorClément Bœsch <u@pkh.me>
Mon, 20 Mar 2017 07:52:07 +0000 (08:52 +0100)
committerClément Bœsch <u@pkh.me>
Mon, 20 Mar 2017 07:54:44 +0000 (08:54 +0100)
* commit '4fb311c804098d78e5ce5f527f9a9c37536d3a08':
  Drop memalign hack

Merged, as this may indeed be uneeded since
46e3936fb04d06550151e667357065e3f646da1a.

Merged-by: Clément Bœsch <u@pkh.me>
1  2 
configure
libavutil/mem.c

diff --cc configure
index 967f3d622c4fbdfa9397265d1cb4bb2d1fffaf43,80f39f378031a94560075ed890e8235311a89a14..9529d50b1fa0caa90dd4707fe89045f0a2d4ba6b
+++ b/configure
@@@ -371,8 -294,7 +371,7 @@@ Advanced options (experts only)
    --disable-safe-bitstream-reader
                             disable buffer boundary checking in bitreaders
                             (faster, but may crash)
-   --enable-memalign-hack   emulate memalign, interferes with memory debuggers
 -  --enable-sram            allow use of on-chip SRAM
 +  --sws-max-filter-size=N  the max filter size swscale uses [$sws_max_filter_size_default]
  
  Optimization options (experts only):
    --disable-asm            disable all assembly optimizations
@@@ -1699,9 -1353,6 +1698,8 @@@ CONFIG_LIST=
      $LIBRARY_LIST
      $PROGRAM_LIST
      $SUBSYSTEM_LIST
-     memalign_hack
 +    fontconfig
 +    memory_poisoning
      neon_clobber_test
      pic
      pod2man
@@@ -6398,48 -5033,10 +6394,45 @@@ check_deps $CONFIG_LIST       
             $HAVE_LIST         \
             $ALL_COMPONENTS    \
  
 -enabled_all dxva2 CoTaskMemFree &&
 -    prepend avconv_libs $($ldflags_filter "-lole32") &&
 +enabled threads && ! enabled pthreads && ! enabled atomics_native && die "non pthread threading without atomics not supported, try adding --enable-pthreads or --cpu=i486 or higher if you are on x86"
 +
 +
 +if test $target_os = "haiku"; then
 +    disable memalign
 +    disable posix_memalign
 +fi
 +
 +enabled_all dxva2 dxva2api_cobj CoTaskMemFree &&
 +    prepend ffmpeg_libs $($ldflags_filter "-lole32") &&
      enable dxva2_lib
  
- ! enabled_any memalign posix_memalign aligned_malloc &&
-     enabled simd_align && enable memalign_hack
 +# add_dep lib dep
 +# -> enable ${lib}_deps_${dep}
 +# -> add $dep to ${lib}_deps only once
 +add_dep() {
 +    lib=$1
 +    dep=$2
 +    enabled "${lib}_deps_${dep}" && return 0
 +    enable  "${lib}_deps_${dep}"
 +    prepend "${lib}_deps" $dep
 +}
 +
 +# merge deps lib components
 +# merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
 +merge_deps() {
 +    lib=$1
 +    shift
 +    for comp in $*; do
 +        enabled $comp || continue
 +        eval "dep=\"\$${comp}_deps\""
 +        for d in $dep; do
 +            add_dep $lib $d
 +        done
 +    done
 +}
 +
 +merge_deps libavfilter $FILTER_LIST
 +
  map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
  
  for thread in $THREADS_LIST; do
diff --cc libavutil/mem.c
index 1a8fc21e98f97731482b1eb706d757569edb58f5,0f506d360468c2d6750c384a4723b8e013c5fa9d..36740f1154bf20d29c270b33ecbff2b87ea699c0
@@@ -77,33 -62,18 +77,23 @@@ void av_max_alloc(size_t max)
  void *av_malloc(size_t size)
  {
      void *ptr = NULL;
- #if CONFIG_MEMALIGN_HACK
-     long diff;
- #endif
  
      /* let's disallow possibly ambiguous cases */
 -    if (size > (INT_MAX - 32) || !size)
 +    if (size > (max_alloc_size - 32))
          return NULL;
  
- #if CONFIG_MEMALIGN_HACK
-     ptr = malloc(size + ALIGN);
-     if (!ptr)
-         return ptr;
-     diff              = ((~(long)ptr)&(ALIGN - 1)) + 1;
-     ptr               = (char *)ptr + diff;
-     ((char *)ptr)[-1] = diff;
- #elif HAVE_POSIX_MEMALIGN
+ #if HAVE_POSIX_MEMALIGN
 -    if (posix_memalign(&ptr, 32, size))
 +    if (size) //OS X on SDK 10.6 has a broken posix_memalign implementation
 +    if (posix_memalign(&ptr, ALIGN, size))
          ptr = NULL;
  #elif HAVE_ALIGNED_MALLOC
 -    ptr = _aligned_malloc(size, 32);
 +    ptr = _aligned_malloc(size, ALIGN);
  #elif HAVE_MEMALIGN
 -    ptr = memalign(32, size);
 +#ifndef __DJGPP__
 +    ptr = memalign(ALIGN, size);
 +#else
 +    ptr = memalign(size, ALIGN);
 +#endif
      /* Why 64?
       * Indeed, we should align it:
       *   on  4 for 386
  
  void *av_realloc(void *ptr, size_t size)
  {
- #if CONFIG_MEMALIGN_HACK
-     int diff;
- #endif
      /* let's disallow possibly ambiguous cases */
 -    if (size > (INT_MAX - 16))
 +    if (size > (max_alloc_size - 32))
          return NULL;
  
- #if CONFIG_MEMALIGN_HACK
-     //FIXME this isn't aligned correctly, though it probably isn't needed
-     if (!ptr)
-         return av_malloc(size);
-     diff = ((char *)ptr)[-1];
-     av_assert0(diff>0 && diff<=ALIGN);
-     ptr = realloc((char *)ptr - diff, size + diff);
-     if (ptr)
-         ptr = (char *)ptr + diff;
-     return ptr;
- #elif HAVE_ALIGNED_MALLOC
+ #if HAVE_ALIGNED_MALLOC
 -    return _aligned_realloc(ptr, size, 32);
 +    return _aligned_realloc(ptr, size + !size, ALIGN);
  #else
 -    return realloc(ptr, size);
 +    return realloc(ptr, size + !size);
  #endif
  }