1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

avcodec/ppc/vp8dsp: store the 16 pixel wide rows at any alignment

(cherry picked from commit 4be657ffd8)
This commit is contained in:
Michael Niedermayer
2026-08-12 05:38:19 +02:00
parent 88da77b90d
commit 71cb25decd
2 changed files with 24 additions and 6 deletions

View File

@@ -136,7 +136,7 @@ void put_vp8_epel_h_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
if (w == 16) {
FILTER_H(f16l, 8);
filt = vec_packsu(f16h, f16l);
vec_st(filt, 0, dst);
unaligned_store(filt, dst);
} else {
filt = vec_packsu(f16h, f16h);
vec_ste((vec_u32)filt, 0, (uint32_t*)dst);
@@ -235,7 +235,7 @@ void put_vp8_epel_v_altivec_core(uint8_t *dst, ptrdiff_t dst_stride,
if (w == 16) {
FILTER_V(f16l, vec_mulo);
filt = vec_packsu(f16h, f16l);
vec_st(filt, 0, dst);
unaligned_store(filt, dst);
} else {
filt = vec_packsu(f16h, f16h);
if (w == 4)
@@ -317,10 +317,10 @@ static void put_vp8_pixels16_altivec(uint8_t *dst, ptrdiff_t dstride, const uint
// -funroll-loops w/ this is bad - 74 cycles again.
// all this is on a 7450, tuning for the 7450
for (i = 0; i < h; i += 4) {
vec_st(load_with_perm_vec(0, src, perm), 0, dst);
vec_st(load_with_perm_vec(sstride, src, perm), dstride, dst);
vec_st(load_with_perm_vec(sstride2, src, perm), dstride2, dst);
vec_st(load_with_perm_vec(sstride3, src, perm), dstride3, dst);
unaligned_store(load_with_perm_vec(0, src, perm), dst);
unaligned_store(load_with_perm_vec(sstride, src, perm), dst + dstride);
unaligned_store(load_with_perm_vec(sstride2, src, perm), dst + dstride2);
unaligned_store(load_with_perm_vec(sstride3, src, perm), dst + dstride3);
src += sstride4;
dst += dstride4;
}

View File

@@ -144,6 +144,24 @@ static inline vec_u8 load_with_perm_vec(int offset, const uint8_t *src, vec_u8 p
#define load_with_perm_vec(a,b,c) VEC_LD(a,b)
#endif
#if HAVE_BIGENDIAN
static inline void unaligned_store(vec_u8 v, uint8_t *dst)
{
vec_u8 lo = vec_ld(0, dst);
vec_u8 hi = vec_ld(15, dst);
vec_u8 edges = vec_perm(hi, lo, vec_lvsl(0, dst));
vec_u8 align = vec_lvsr(0, dst);
vec_st(vec_perm(v, edges, align), 15, dst);
vec_st(vec_perm(edges, v, align), 0, dst);
}
#else
static inline void unaligned_store(vec_u8 v, uint8_t *dst)
{
vec_vsx_st(v, 0, dst);
}
#endif
/**
* loads vector known misalignment