From 96a39e34a6ed47e53a7bab05a977487b63e3840b Mon Sep 17 00:00:00 2001 From: Roman Lebedev Date: Wed, 19 Oct 2022 00:57:39 +0300 Subject: [PATCH] `RawImageDataU16::scaleValues_SSE2()`: avoid touching padding Now, this is indeed a breaking change, and now up to 7 last columnts may end up being unscaled. This is not good, but we also can't really touch that padding, asan complains. Perhaps there needs to be two types of padding. --- src/librawspeed/common/RawImageDataU16.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librawspeed/common/RawImageDataU16.cpp b/src/librawspeed/common/RawImageDataU16.cpp index f8646c3b2..0156bc841 100644 --- a/src/librawspeed/common/RawImageDataU16.cpp +++ b/src/librawspeed/common/RawImageDataU16.cpp @@ -213,7 +213,6 @@ void RawImageDataU16::scaleValues_SSE2(int start_y, int end_y) { assert(sub_mul != nullptr); - uint32_t gw = pitch / 16; // 10 bit fraction uint32_t mul = static_cast( 1024.0F * 65535.0F / @@ -280,7 +279,8 @@ void RawImageDataU16::scaleValues_SSE2(int start_y, int end_y) { ssescale = _mm_load_si128(reinterpret_cast<__m128i*>(&sub_mul[12])); } - for (uint32_t x = 0; x < gw; x++) { + for (int x = 0; x < static_cast(roundDown(uncropped_dim.x, 8)); + x += 8) { __m128i pix_high; __m128i temp; _mm_prefetch(reinterpret_cast(pixel + 1), _MM_HINT_T0);