Call memcpy() in aom_[highbd_]convolve_copy_*() Call memcpy() instead of memmove() in avm_convolve_copy_*() and avm_highbd_convolve_copy_*(). aom_convolve_copy_neon() and aom_highbd_convolve_copy_neon() do not handle overlapping src and dst rows for some widths. Also, running test_libaom under AddressSanitizer does not trigger any memcpy-param-overlap errors on Linux x86_64 and macOS (Arm) in both the regular and -DAOM_TARGET_CPU=generic builds, so it is not necessary to call memmove(). Bug: 545708791 Change-Id: Iecc6fc1b13308f865d7c53a360cff76748740ee6
diff --git a/aom_dsp/aom_convolve.c b/aom_dsp/aom_convolve.c index 99594de..65adfb8 100644 --- a/aom_dsp/aom_convolve.c +++ b/aom_dsp/aom_convolve.c
@@ -148,7 +148,7 @@ void aom_convolve_copy_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, ptrdiff_t dst_stride, int w, int h) { for (int r = h; r > 0; --r) { - memmove(dst, src, w); + memcpy(dst, src, w); src += src_stride; dst += dst_stride; } @@ -245,7 +245,7 @@ uint16_t *dst, ptrdiff_t dst_stride, int w, int h) { for (int y = 0; y < h; ++y) { - memmove(dst, src, w * sizeof(src[0])); + memcpy(dst, src, w * sizeof(src[0])); src += src_stride; dst += dst_stride; }
diff --git a/aom_dsp/arm/aom_convolve_copy_neon.c b/aom_dsp/arm/aom_convolve_copy_neon.c index a60f37f..2cfb9f6 100644 --- a/aom_dsp/arm/aom_convolve_copy_neon.c +++ b/aom_dsp/arm/aom_convolve_copy_neon.c
@@ -59,11 +59,11 @@ int h) { if (w < 4) { // copy2 do { - memmove(dst, src, 2 * sizeof(*src)); + memcpy(dst, src, 2 * sizeof(*src)); src += src_stride; dst += dst_stride; - memmove(dst, src, 2 * sizeof(*src)); + memcpy(dst, src, 2 * sizeof(*src)); src += src_stride; dst += dst_stride; h -= 2;
diff --git a/aom_dsp/x86/aom_convolve_copy_avx2.c b/aom_dsp/x86/aom_convolve_copy_avx2.c index efce154..86d396c 100644 --- a/aom_dsp/x86/aom_convolve_copy_avx2.c +++ b/aom_dsp/x86/aom_convolve_copy_avx2.c
@@ -10,6 +10,7 @@ */ #include <immintrin.h> +#include <string.h> #include "config/aom_dsp_rtcd.h" @@ -36,20 +37,20 @@ if (w == 2) { do { - memmove(dst, src, 2 * sizeof(*src)); + memcpy(dst, src, 2 * sizeof(*src)); src += src_stride; dst += dst_stride; - memmove(dst, src, 2 * sizeof(*src)); + memcpy(dst, src, 2 * sizeof(*src)); src += src_stride; dst += dst_stride; h -= 2; } while (h); } else if (w == 4) { do { - memmove(dst, src, 4 * sizeof(*src)); + memcpy(dst, src, 4 * sizeof(*src)); src += src_stride; dst += dst_stride; - memmove(dst, src, 4 * sizeof(*src)); + memcpy(dst, src, 4 * sizeof(*src)); src += src_stride; dst += dst_stride; h -= 2; @@ -170,10 +171,10 @@ if (w == 2) { do { - memmove(dst, src, 2 * sizeof(*src)); + memcpy(dst, src, 2 * sizeof(*src)); src += src_stride; dst += dst_stride; - memmove(dst, src, 2 * sizeof(*src)); + memcpy(dst, src, 2 * sizeof(*src)); src += src_stride; dst += dst_stride; h -= 2;
diff --git a/aom_dsp/x86/aom_convolve_copy_sse2.c b/aom_dsp/x86/aom_convolve_copy_sse2.c index 223b404..871f53e 100644 --- a/aom_dsp/x86/aom_convolve_copy_sse2.c +++ b/aom_dsp/x86/aom_convolve_copy_sse2.c
@@ -10,6 +10,7 @@ */ #include <immintrin.h> +#include <string.h> #include "config/aom_dsp_rtcd.h" @@ -44,20 +45,20 @@ if (w == 2) { do { - memmove(dst, src, 2 * sizeof(*src)); + memcpy(dst, src, 2 * sizeof(*src)); src += src_stride; dst += dst_stride; - memmove(dst, src, 2 * sizeof(*src)); + memcpy(dst, src, 2 * sizeof(*src)); src += src_stride; dst += dst_stride; h -= 2; } while (h); } else if (w == 4) { do { - memmove(dst, src, 4 * sizeof(*src)); + memcpy(dst, src, 4 * sizeof(*src)); src += src_stride; dst += dst_stride; - memmove(dst, src, 4 * sizeof(*src)); + memcpy(dst, src, 4 * sizeof(*src)); src += src_stride; dst += dst_stride; h -= 2;