ref: 07f818fb12abb444651af71eaedf48da01131bba
parent: 1cec875c1feb82dc91469a7cfefaf1ff1dcb63b7
author: Ronald S. Bultje <rsbultje@gmail.com>
date: Wed Feb 20 11:42:43 EST 2019
Make allocation of frame_thread.pal aligned Allows aligned accesses to this array in SIMD. Fixes #246.
--- a/src/decode.c
+++ b/src/decode.c
@@ -2700,11 +2700,12 @@
freep(&f->frame_thread.cbi);
dav1d_freep_aligned(&f->frame_thread.cf);
dav1d_freep_aligned(&f->frame_thread.pal_idx);
- freep(&f->frame_thread.pal);
+ dav1d_freep_aligned(&f->frame_thread.pal);
f->frame_thread.b = malloc(sizeof(*f->frame_thread.b) *
f->sb128w * f->sb128h * 32 * 32);
- f->frame_thread.pal = malloc(sizeof(*f->frame_thread.pal) *
- f->sb128w * f->sb128h * 16 * 16);
+ f->frame_thread.pal =
+ dav1d_alloc_aligned(sizeof(*f->frame_thread.pal) *
+ f->sb128w * f->sb128h * 16 * 16, 32);
f->frame_thread.pal_idx =
dav1d_alloc_aligned(sizeof(*f->frame_thread.pal_idx) *
f->sb128w * f->sb128h * 128 * 128 * 2, 32);
--- a/src/lib.c
+++ b/src/lib.c
@@ -458,7 +458,7 @@
dav1d_freep_aligned(&f->frame_thread.pal_idx);
dav1d_freep_aligned(&f->frame_thread.cf);
freep(&f->frame_thread.tile_start_off);
- freep(&f->frame_thread.pal);
+ dav1d_freep_aligned(&f->frame_thread.pal);
freep(&f->frame_thread.cbi);
pthread_mutex_destroy(&f->frame_thread.td.lock);
pthread_cond_destroy(&f->frame_thread.td.cond);