Commit 9f56ee8cb8 for aom
commit 9f56ee8cb8f86013d84fcd29a4203ec3c271dce3
Author: Wan-Teh Chang <wtc@google.com>
Date: Thu Aug 13 08:26:52 2026 -0700
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 99594de7f4..65adfb8f70 100644
--- a/aom_dsp/aom_convolve.c
+++ b/aom_dsp/aom_convolve.c
@@ -148,7 +148,7 @@ void aom_scaled_2d_c(const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst,
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 @@ void aom_highbd_convolve_copy_c(const uint16_t *src, ptrdiff_t src_stride,
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 a60f37f9e2..2cfb9f6d64 100644
--- a/aom_dsp/arm/aom_convolve_copy_neon.c
+++ b/aom_dsp/arm/aom_convolve_copy_neon.c
@@ -59,11 +59,11 @@ void aom_highbd_convolve_copy_neon(const uint16_t *src, ptrdiff_t src_stride,
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 efce154252..86d396c3b1 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 @@ void aom_convolve_copy_avx2(const uint8_t *src, ptrdiff_t src_stride,
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 @@ void aom_highbd_convolve_copy_avx2(const uint16_t *src, ptrdiff_t src_stride,
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 223b404f62..871f53e9d4 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 @@ void aom_convolve_copy_sse2(const uint8_t *src, ptrdiff_t src_stride,
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;