From a5dbf52da865d7de0fc721744212a324a4391e08 Mon Sep 17 00:00:00 2001 From: bradleys Date: Mon, 16 Feb 2015 21:31:14 +0000 Subject: [PATCH] libhb: Fix memory alignment issue in nlmeans. Solves crash in accelerated code when source dimensions are not mod 16. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6915 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/nlmeans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libhb/nlmeans.c b/libhb/nlmeans.c index 3d096745e..3da7d7721 100644 --- a/libhb/nlmeans.c +++ b/libhb/nlmeans.c @@ -652,7 +652,7 @@ static void nlmeans_plane(NLMeansFunctions *functions, struct PixelSum *tmp_data = calloc(dst_w * dst_h, sizeof(struct PixelSum)); // Allocate integral image - const int integral_stride = dst_w + 2 * 16; + const int integral_stride = ((dst_w + 15) / 16 * 16) + 2 * 16; uint32_t* const integral_mem = calloc(integral_stride * (dst_h+1), sizeof(uint32_t)); uint32_t* const integral = integral_mem + integral_stride + 16; -- 2.40.0