Fix segfault with loop-restoration on x86.
The WienerInfo struct requires a 16-byte alignment on x86,
since it contains filter coefficients which are loaded using
SSE aligned load instructions. But on 32-bit x86, the default
alignment of aom_malloc/aom_realloc is only 8 bytes, leading
to occasional segfaults.
To fix this, rather than using aom_realloc to resize WienerInfo
structures, we always free and re-allocate them using aom_memalign
BUG=aomedia:345
Change-Id: Ib1b2a42d4a2fa215dcc81ea481c51271ab068a37
diff --git a/av1/common/alloccommon.c b/av1/common/alloccommon.c
index bd20fcf..e7c7f45 100644
--- a/av1/common/alloccommon.c
+++ b/av1/common/alloccommon.c
@@ -90,10 +90,10 @@
#if CONFIG_LOOP_RESTORATION
void av1_alloc_restoration_buffers(AV1_COMMON *cm) {
int p;
- av1_alloc_restoration_struct(&cm->rst_info[0], cm->width, cm->height);
+ av1_alloc_restoration_struct(cm, &cm->rst_info[0], cm->width, cm->height);
for (p = 1; p < MAX_MB_PLANE; ++p)
av1_alloc_restoration_struct(
- &cm->rst_info[p], ROUND_POWER_OF_TWO(cm->width, cm->subsampling_x),
+ cm, &cm->rst_info[p], ROUND_POWER_OF_TWO(cm->width, cm->subsampling_x),
ROUND_POWER_OF_TWO(cm->height, cm->subsampling_y));
cm->rst_internal.tmpbuf =
(int32_t *)aom_realloc(cm->rst_internal.tmpbuf, RESTORATION_TMPBUF_SIZE);