From 824acbffe78c83bf85083b1025394737ca921de5 Mon Sep 17 00:00:00 2001 From: William Vinnicombe Date: Mon, 11 Dec 2023 16:55:39 +0000 Subject: [PATCH] common: utils: Respect provided stride When computing stride alignment, don't overwrite a provided stride unless the stride provided is too small. --- src/libpisp/common/pisp_utils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libpisp/common/pisp_utils.cpp b/src/libpisp/common/pisp_utils.cpp index 9ecdb0d..b0cbd73 100644 --- a/src/libpisp/common/pisp_utils.cpp +++ b/src/libpisp/common/pisp_utils.cpp @@ -67,7 +67,9 @@ void compute_stride_align(pisp_image_format_config &config, int align) if (PISP_IMAGE_FORMAT_compressed(config.format)) width = (width + 7) & ~7; // compression uses blocks of 8 samples - config.stride = compute_x_offset(config.format, width); + int32_t computed_stride = compute_x_offset(config.format, width); + if (!config.stride || config.stride < computed_stride) + config.stride = computed_stride; config.stride2 = 0; if (!PISP_IMAGE_FORMAT_HOG(config.format))