diff options
author | wm4 <wm4@nowhere> | 2020-05-01 00:55:13 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-05-01 00:59:57 +0200 |
commit | 008faa3d7fd62c9e8af00281a04ed76db1b41391 (patch) | |
tree | 743eb383362e47200d7fd142b6d7470e8ce562db /video/zimg.c | |
parent | 4f0206ab045e65798eef7e6e1efe0d862fe7b7f7 (diff) | |
download | mpv-008faa3d7fd62c9e8af00281a04ed76db1b41391.tar.bz2 mpv-008faa3d7fd62c9e8af00281a04ed76db1b41391.tar.xz |
zimg: remove C11 aligned_alloc() requirement
It's not available on Windows because MinGW is fucking horrible and
Microsoft are fucking assholes.
Diffstat (limited to 'video/zimg.c')
-rw-r--r-- | video/zimg.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/video/zimg.c b/video/zimg.c index b478ccbd1d..22f1a1a1b1 100644 --- a/video/zimg.c +++ b/video/zimg.c @@ -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) || |