1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-10-30 23:18:11 +02:00

avcodec/vp3: Optimize alignment check away when possible

Check only on arches that need said check.

(Btw: I do not see how h_loop_filter benefits from alignment
at all and why h_loop_filter_unaligned exists.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-10-10 15:49:04 +02:00
parent 5823ab347a
commit 31f0749cd4
3 changed files with 7 additions and 3 deletions

View File

@@ -2031,7 +2031,7 @@ static int vp4_mc_loop_filter(Vp3DecodeContext *s, int plane, int motion_x, int
plane_height);
#define safe_loop_filter(name, ptr, stride, bounding_values) \
if ((uintptr_t)(ptr) & 7) \
if (VP3_LOOP_FILTER_NO_UNALIGNED_SUPPORT && (uintptr_t)(ptr) & 7) \
s->vp3dsp.name##_unaligned(ptr, stride, bounding_values); \
else \
s->vp3dsp.name(ptr, stride, bounding_values);

View File

@@ -22,6 +22,10 @@
#include <stddef.h>
#include <stdint.h>
// If this is one, {v,h}_loop_filter expect src to be aligned on eight bytes;
// otherwise they don't have any alignment requirements for src.
#define VP3_LOOP_FILTER_NO_UNALIGNED_SUPPORT (ARCH_ARM || ARCH_MIPS)
typedef struct VP3DSPContext {
/**
* Copy 8xH pixels from source to destination buffer using a bilinear

View File

@@ -68,8 +68,8 @@ static void vp3_check_loop_filter(void)
#define TEST(NAME) .name = #NAME, .offset = offsetof(VP3DSPContext, NAME)
{ TEST(v_loop_filter_unaligned), 2, 1, 0, 7, 1, 0 },
{ TEST(h_loop_filter_unaligned), 0, 7, 2, 1, 1, 1 },
{ TEST(v_loop_filter), 2, 1, 0, 7, 8, 0 },
{ TEST(h_loop_filter), 0, 7, 2, 1, 8, 1 },
{ TEST(v_loop_filter), 2, 1, 0, 7, VP3_LOOP_FILTER_NO_UNALIGNED_SUPPORT ? 8 : 1, 0 },
{ TEST(h_loop_filter), 0, 7, 2, 1, VP3_LOOP_FILTER_NO_UNALIGNED_SUPPORT ? 8 : 1, 1 },
};
declare_func(void, uint8_t *src, ptrdiff_t stride, int *bounding_values);