From 7908f5821efce294e149572f75d34ce3c76731ce Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Sun, 23 Feb 2025 21:32:57 +0100 Subject: [PATCH 2/2] avcodec/intrax8dsp: Copy several bytes at once Signed-off-by: Andreas Rheinhardt --- libavcodec/intrax8dsp.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/libavcodec/intrax8dsp.c b/libavcodec/intrax8dsp.c index ff22aecae2..2673316369 100644 --- a/libavcodec/intrax8dsp.c +++ b/libavcodec/intrax8dsp.c @@ -23,6 +23,7 @@ #include "intrax8dsp.h" #include "libavutil/common.h" +#include "libavutil/intreadwrite.h" /* * area positions, #3 is 1 pixel only, other are 8 pixels @@ -226,22 +227,16 @@ static void spatial_compensation_1(const uint8_t *restrict src, uint8_t *restric static void spatial_compensation_2(const uint8_t *restrict src, uint8_t *restrict dst, ptrdiff_t stride) { - int x, y; - - for (y = 0; y < 8; y++) { - for (x = 0; x < 8; x++) - dst[x] = src[area4 + 1 + y + x]; + for (int y = 0; y < 8; y++) { + AV_COPY64U(dst, src + area4 + 1 + y); dst += stride; } } static void spatial_compensation_3(const uint8_t *restrict src, uint8_t *restrict dst, ptrdiff_t stride) { - int x, y; - - for (y = 0; y < 8; y++) { - for (x = 0; x < 8; x++) - dst[x] = src[area4 + ((y + 1) >> 1) + x]; + for (int y = 0; y < 8; y++) { + AV_COPY64U(dst, src + area4 + ((y + 1) >> 1)); dst += stride; } } @@ -274,11 +269,8 @@ static void spatial_compensation_5(const uint8_t *restrict src, uint8_t *restric static void spatial_compensation_6(const uint8_t *restrict src, uint8_t *restrict dst, ptrdiff_t stride) { - int x, y; - - for (y = 0; y < 8; y++) { - for (x = 0; x < 8; x++) - dst[x] = src[area3 + x - y]; + for (int y = 0; y < 8; y++) { + AV_COPY64U(dst, src + area3 - y); dst += stride; } } -- 2.45.2