zimg: remove C11 aligned_alloc() requirement

It's not available on Windows because MinGW is fucking horrible and
Microsoft are fucking assholes.
This commit is contained in:
wm4 2020-05-01 00:55:13 +02:00
parent 4f0206ab04
commit 008faa3d7f
3 changed files with 10 additions and 11 deletions

View File

@ -204,8 +204,8 @@ static zimg_color_primaries_e mp_to_z_prim(enum mp_csp_prim prim)
static void destroy_zimg(struct mp_zimg_context *ctx)
{
free(ctx->zimg_tmp);
ctx->zimg_tmp = NULL;
talloc_free(ctx->zimg_tmp_alloc);
ctx->zimg_tmp = ctx->zimg_tmp_alloc = NULL;
zimg_filter_graph_free(ctx->zimg_graph);
ctx->zimg_graph = NULL;
TA_FREEP(&ctx->zimg_src);
@ -1334,11 +1334,15 @@ bool mp_zimg_config(struct mp_zimg_context *ctx)
size_t tmp_size;
if (!zimg_filter_graph_get_tmp_size(ctx->zimg_graph, &tmp_size)) {
tmp_size = MP_ALIGN_UP(tmp_size, ZIMG_ALIGN);
ctx->zimg_tmp = aligned_alloc(ZIMG_ALIGN, tmp_size);
tmp_size = MP_ALIGN_UP(tmp_size, ZIMG_ALIGN) + ZIMG_ALIGN;
ctx->zimg_tmp_alloc = ta_alloc_size(NULL, tmp_size);
if (ctx->zimg_tmp_alloc) {
ctx->zimg_tmp =
(void *)MP_ALIGN_UP((uintptr_t)ctx->zimg_tmp_alloc, ZIMG_ALIGN);
}
}
if (!ctx->zimg_tmp)
if (!ctx->zimg_tmp_alloc)
goto fail;
if (!allocate_buffer(ctx, ctx->zimg_src) ||

View File

@ -40,6 +40,7 @@ struct mp_zimg_context {
struct m_config_cache *opts_cache;
zimg_filter_graph *zimg_graph;
void *zimg_tmp;
void *zimg_tmp_alloc;
struct mp_zimg_repack *zimg_src;
struct mp_zimg_repack *zimg_dst;
};

View File

@ -223,11 +223,6 @@ main_dependencies = [
'atomic_fetch_add(&test, 1)')),
'req': True,
'fmsg': 'C11 atomics are required; you may need a newer compiler',
}, {
# C11; technically we require C11, but aligned_alloc() is not in MinGW
'name': 'aligned_alloc',
'desc': 'C11 aligned_alloc()',
'func': check_statement('stdlib.h', 'aligned_alloc(1, 1)'),
}, {
'name': 'librt',
'desc': 'linking with -lrt',
@ -379,7 +374,6 @@ iconv support use --disable-iconv.",
'func': check_pkg_config('rubberband', '>= 1.8.0'),
}, {
'name': '--zimg',
'deps': 'aligned_alloc',
'desc': 'libzimg support (high quality software scaler)',
'func': check_pkg_config('zimg', '>= 2.9'),
}, {