summaryrefslogtreecommitdiff
path: root/vpx_dsp/x86/variance_sse2.c
diff options
context:
space:
mode:
authorMatthias Räncker <theonetruecamper@gmx.de>2018-09-20 20:20:39 +0200
committerMatthias Räncker <theonetruecamper@gmx.de>2018-09-20 22:37:42 +0200
commita93705f7f9c15cdc2a1e62f6142e99f794923826 (patch)
tree8cd6bfae1ce7c998e8c733727bb1701d2fc95b7e /vpx_dsp/x86/variance_sse2.c
parent0aa83d61a18fbdd5921247e0401b0fbba443cf35 (diff)
downloadlibvpx-a93705f7f9c15cdc2a1e62f6142e99f794923826.tar
libvpx-a93705f7f9c15cdc2a1e62f6142e99f794923826.tar.gz
libvpx-a93705f7f9c15cdc2a1e62f6142e99f794923826.tar.bz2
libvpx-a93705f7f9c15cdc2a1e62f6142e99f794923826.zip
sanitizer: fix unaligned load/stores
When built with -fsanitizer=address,undefined a number of tests, such as ByteAlignmentTest.SwitchByteAlignment or ByteAlignmentTest.SwitchByteAlignment produce runtime errors about unaligned 4-byte loads/stores. While normally not really a problem, this does technically violate the language and it is eays to fix in a standard conforming way using memcpy which does not produce inferior code. Signed-off-by: Matthias Räncker <theonetruecamper@gmx.de> Change-Id: Ie1e97ab25fe874f864df48b473569f00563181ae
Diffstat (limited to 'vpx_dsp/x86/variance_sse2.c')
-rw-r--r--vpx_dsp/x86/variance_sse2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/vpx_dsp/x86/variance_sse2.c b/vpx_dsp/x86/variance_sse2.c
index a2a13a68b..027905255 100644
--- a/vpx_dsp/x86/variance_sse2.c
+++ b/vpx_dsp/x86/variance_sse2.c
@@ -14,6 +14,7 @@
#include "./vpx_config.h"
#include "./vpx_dsp_rtcd.h"
#include "vpx_ports/mem.h"
+#include "vpx_dsp/x86/mem_sse2.h"
static INLINE unsigned int add32x4_sse2(__m128i val) {
val = _mm_add_epi32(val, _mm_srli_si128(val, 8));
@@ -35,8 +36,8 @@ unsigned int vpx_get_mb_ss_sse2(const int16_t *src) {
}
static INLINE __m128i load4x2_sse2(const uint8_t *const p, const int stride) {
- const __m128i p0 = _mm_cvtsi32_si128(*(const uint32_t *)(p + 0 * stride));
- const __m128i p1 = _mm_cvtsi32_si128(*(const uint32_t *)(p + 1 * stride));
+ const __m128i p0 = _mm_cvtsi32_si128(loadu_uint32(p + 0 * stride));
+ const __m128i p1 = _mm_cvtsi32_si128(loadu_uint32(p + 1 * stride));
const __m128i p01 = _mm_unpacklo_epi32(p0, p1);
return _mm_unpacklo_epi8(p01, _mm_setzero_si128());
}