From e9273902f1dd1e90c995f963773217268dcc7e3e Mon Sep 17 00:00:00 2001 From: Pascal Massimino Date: Thu, 5 May 2011 19:32:38 -0700 Subject: [PATCH] align buffer for double too sometimes, gcc insert sse2 storeu instructions (like in VP8InitFilter()) with aligment requirements. Bug was visible 'sometimes' in non-debug mode, when trying to use -af. Change-Id: If3ec282bbbb9f9d0d33ca4b2c4bed46cd26fe495 --- src/enc/webpenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/enc/webpenc.c b/src/enc/webpenc.c index 19ef0b77..8b0fe935 100644 --- a/src/enc/webpenc.c +++ b/src/enc/webpenc.c @@ -155,7 +155,8 @@ static VP8Encoder* InitEncoder(const WebPConfig* const config, 16 + 16 + 16 + 8 + 1 + // left y/u/v 2 * ALIGN_CST) // align all * sizeof(uint8_t); - const size_t lf_stats_size = config->autofilter ? sizeof(LFStats) : 0; + const size_t lf_stats_size = + config->autofilter ? sizeof(LFStats) + ALIGN_CST : 0; VP8Encoder* enc; uint8_t* mem; size_t size = sizeof(VP8Encoder) + ALIGN_CST // main struct @@ -215,7 +216,7 @@ static VP8Encoder* InitEncoder(const WebPConfig* const config, mem += preds_w * preds_h * sizeof(uint8_t); enc->nz_ = 1 + (uint32_t*)mem; mem += nz_size; - enc->lf_stats_ = lf_stats_size ? (LFStats*)mem : NULL; + enc->lf_stats_ = lf_stats_size ? (LFStats*)DO_ALIGN(mem) : NULL; mem += lf_stats_size; // top samples (all 16-aligned)