diff --git a/src/dec/frame.c b/src/dec/frame.c index efe886b1..93847a5c 100644 --- a/src/dec/frame.c +++ b/src/dec/frame.c @@ -15,7 +15,8 @@ #include "./vp8i.h" #include "../utils/utils.h" -#define ALIGN_MASK (32 - 1) +#define ALIGN_CST (32 - 1) +#define DO_ALIGN(PTR) ((uintptr_t)((PTR) + ALIGN_CST) & ~ALIGN_CST) static void ReconstructRow(const VP8Decoder* const dec, const VP8ThreadContext* ctx); // TODO(skal): remove @@ -552,7 +553,7 @@ static int AllocateMemory(VP8Decoder* const dec) { const uint64_t needed = (uint64_t)intra_pred_mode_size + top_size + mb_info_size + f_info_size + yuv_size + mb_data_size - + cache_size + alpha_size + ALIGN_MASK; + + cache_size + alpha_size + ALIGN_CST; uint8_t* mem; if (needed != (size_t)needed) return 0; // check for overflow @@ -589,8 +590,8 @@ static int AllocateMemory(VP8Decoder* const dec) { dec->thread_ctx_.f_info_ += mb_w; } - mem = (uint8_t*)((uintptr_t)(mem + ALIGN_MASK) & ~ALIGN_MASK); - assert((yuv_size & ALIGN_MASK) == 0); + mem = (uint8_t*)DO_ALIGN(mem); + assert((yuv_size & ALIGN_CST) == 0); dec->yuv_b_ = (uint8_t*)mem; mem += yuv_size;