mirror of
https://github.com/mpv-player/mpv
synced 2025-01-14 02:51:26 +00:00
vf_fingerprint: use aligned_alloc instead of posix_memalign
I was assuming posix_memalign was the most portable function to use, but MinGW does not provide it for some reason. Switch to C11 aligned_alloc() which someone suggested was provided by MinGW (but actually isn't, someone probably confused it with the incompatible _aligned_malloc), and add a configure check. Even though it turned out that MinGW doesn't provide it, the function is slightly more elegant than posix_memalign(), so stay with it.
This commit is contained in:
parent
d75bdf070f
commit
7000d91cf8
@ -136,8 +136,8 @@ static void reinit_fmt(struct mp_filter *f, struct mp_image *mpi)
|
||||
|
||||
size_t tmp_size;
|
||||
if (!zimg_filter_graph_get_tmp_size(p->zimg_graph, &tmp_size)) {
|
||||
if (posix_memalign(&p->zimg_tmp, ZIMG_ALIGN, tmp_size))
|
||||
p->zimg_tmp = NULL;
|
||||
tmp_size = MP_ALIGN_UP(tmp_size, ZIMG_ALIGN);
|
||||
p->zimg_tmp = aligned_alloc(ZIMG_ALIGN, tmp_size);
|
||||
}
|
||||
|
||||
if (!p->zimg_tmp) {
|
||||
|
6
wscript
6
wscript
@ -213,6 +213,11 @@ main_dependencies = [
|
||||
check_statement('stdatomic.h',
|
||||
'atomic_int_least64_t test = ATOMIC_VAR_INIT(123);'
|
||||
'atomic_fetch_add(&test, 1)'))
|
||||
}, {
|
||||
# C11; technically we still support C99
|
||||
'name': 'aligned_alloc',
|
||||
'desc': 'C11 aligned_alloc()',
|
||||
'func': check_statement('stdlib.h', 'aligned_alloc(1, 1)'),
|
||||
}, {
|
||||
'name': 'atomics',
|
||||
'desc': 'stdatomic.h support or slow emulation',
|
||||
@ -386,6 +391,7 @@ iconv support use --disable-iconv.",
|
||||
'func': check_pkg_config('rubberband', '>= 1.8.0'),
|
||||
}, {
|
||||
'name': '--zimg',
|
||||
'deps': 'aligned_alloc',
|
||||
'desc': 'libzimg support (for vf_fingerprint)',
|
||||
'func': check_pkg_config('zimg', '>= 2.9'),
|
||||
}, {
|
||||
|
Loading…
Reference in New Issue
Block a user