* commit '4fb311c804098d78e5ce5f527f9a9c37536d3a08':
Drop memalign hack
Merged, as this may indeed be uneeded since
46e3936fb0
.
Merged-by: Clément Bœsch <u@pkh.me>
tags/n3.3
@@ -371,7 +371,6 @@ Advanced options (experts only): | |||||
--disable-safe-bitstream-reader | --disable-safe-bitstream-reader | ||||
disable buffer boundary checking in bitreaders | disable buffer boundary checking in bitreaders | ||||
(faster, but may crash) | (faster, but may crash) | ||||
--enable-memalign-hack emulate memalign, interferes with memory debuggers | |||||
--sws-max-filter-size=N the max filter size swscale uses [$sws_max_filter_size_default] | --sws-max-filter-size=N the max filter size swscale uses [$sws_max_filter_size_default] | ||||
Optimization options (experts only): | Optimization options (experts only): | ||||
@@ -1700,7 +1699,6 @@ CONFIG_LIST=" | |||||
$PROGRAM_LIST | $PROGRAM_LIST | ||||
$SUBSYSTEM_LIST | $SUBSYSTEM_LIST | ||||
fontconfig | fontconfig | ||||
memalign_hack | |||||
memory_poisoning | memory_poisoning | ||||
neon_clobber_test | neon_clobber_test | ||||
pic | pic | ||||
@@ -1835,7 +1833,6 @@ ARCH_FEATURES=" | |||||
local_aligned_8 | local_aligned_8 | ||||
local_aligned_16 | local_aligned_16 | ||||
local_aligned_32 | local_aligned_32 | ||||
simd_align | |||||
simd_align_16 | simd_align_16 | ||||
simd_align_32 | simd_align_32 | ||||
" | " | ||||
@@ -2335,7 +2332,6 @@ aligned_stack_if_any="aarch64 ppc x86" | |||||
fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64" | fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64" | ||||
fast_clz_if_any="aarch64 alpha avr32 mips ppc x86" | fast_clz_if_any="aarch64 alpha avr32 mips ppc x86" | ||||
fast_unaligned_if_any="aarch64 ppc x86" | fast_unaligned_if_any="aarch64 ppc x86" | ||||
simd_align_if_any="simd_align_16 simd_align_32" | |||||
simd_align_16_if_any="altivec neon sse" | simd_align_16_if_any="altivec neon sse" | ||||
simd_align_32_if_any="avx" | simd_align_32_if_any="avx" | ||||
@@ -6410,9 +6406,6 @@ enabled_all dxva2 dxva2api_cobj CoTaskMemFree && | |||||
prepend ffmpeg_libs $($ldflags_filter "-lole32") && | prepend ffmpeg_libs $($ldflags_filter "-lole32") && | ||||
enable dxva2_lib | enable dxva2_lib | ||||
! enabled_any memalign posix_memalign aligned_malloc && | |||||
enabled simd_align && enable memalign_hack | |||||
# add_dep lib dep | # add_dep lib dep | ||||
# -> enable ${lib}_deps_${dep} | # -> enable ${lib}_deps_${dep} | ||||
# -> add $dep to ${lib}_deps only once | # -> add $dep to ${lib}_deps only once | ||||
@@ -77,22 +77,12 @@ void av_max_alloc(size_t max){ | |||||
void *av_malloc(size_t size) | void *av_malloc(size_t size) | ||||
{ | { | ||||
void *ptr = NULL; | void *ptr = NULL; | ||||
#if CONFIG_MEMALIGN_HACK | |||||
long diff; | |||||
#endif | |||||
/* let's disallow possibly ambiguous cases */ | /* let's disallow possibly ambiguous cases */ | ||||
if (size > (max_alloc_size - 32)) | if (size > (max_alloc_size - 32)) | ||||
return NULL; | 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 (size) //OS X on SDK 10.6 has a broken posix_memalign implementation | if (size) //OS X on SDK 10.6 has a broken posix_memalign implementation | ||||
if (posix_memalign(&ptr, ALIGN, size)) | if (posix_memalign(&ptr, ALIGN, size)) | ||||
ptr = NULL; | ptr = NULL; | ||||
@@ -144,25 +134,11 @@ void *av_malloc(size_t size) | |||||
void *av_realloc(void *ptr, size_t size) | void *av_realloc(void *ptr, size_t size) | ||||
{ | { | ||||
#if CONFIG_MEMALIGN_HACK | |||||
int diff; | |||||
#endif | |||||
/* let's disallow possibly ambiguous cases */ | /* let's disallow possibly ambiguous cases */ | ||||
if (size > (max_alloc_size - 32)) | if (size > (max_alloc_size - 32)) | ||||
return NULL; | 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 + !size, ALIGN); | return _aligned_realloc(ptr, size + !size, ALIGN); | ||||
#else | #else | ||||
return realloc(ptr, size + !size); | return realloc(ptr, size + !size); | ||||
@@ -227,13 +203,7 @@ int av_reallocp_array(void *ptr, size_t nmemb, size_t size) | |||||
void av_free(void *ptr) | void av_free(void *ptr) | ||||
{ | { | ||||
#if CONFIG_MEMALIGN_HACK | |||||
if (ptr) { | |||||
int v= ((char *)ptr)[-1]; | |||||
av_assert0(v>0 && v<=ALIGN); | |||||
free((char *)ptr - v); | |||||
} | |||||
#elif HAVE_ALIGNED_MALLOC | |||||
#if HAVE_ALIGNED_MALLOC | |||||
_aligned_free(ptr); | _aligned_free(ptr); | ||||
#else | #else | ||||
free(ptr); | free(ptr); | ||||