30 #define REPT4(...) { __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__ } 35 REPT4( -6, 123, 12, -1),
36 REPT4(-11, 108, 36, -8),
37 REPT4( -9, 93, 50, -6),
38 REPT4(-16, 77, 77, -16),
39 REPT4( -6, 50, 93, -9),
40 REPT4( -8, 36, 108, -11),
41 REPT4( -1, 12, 123, -6),
54 #define LOAD_H_SUBPEL_FILTER(i) \ 55 vec_s8 filter_inner = h_subpel_filters_inner[i]; \ 56 vec_s8 filter_outerh = h_subpel_filters_outer[(i)>>1]; \ 57 vec_s8 filter_outerl = vec_sld(filter_outerh, filter_outerh, 2) 59 #define FILTER_H(dstv, off) \ 60 a = vec_ld((off)-is6tap-1, src); \ 61 b = vec_ld((off)-is6tap-1+15, src); \ 63 pixh = vec_perm(a, b, permh##off); \ 64 pixl = vec_perm(a, b, perml##off); \ 65 filth = vec_msum(filter_inner, pixh, c64); \ 66 filtl = vec_msum(filter_inner, pixl, c64); \ 69 outer = vec_perm(a, b, perm_6tap##off); \ 70 filth = vec_msum(filter_outerh, outer, filth); \ 71 filtl = vec_msum(filter_outerl, outer, filtl); \ 75 dstv = vec_packs(filth, filtl); \ 76 dstv = vec_sra(dstv, c7) 81 int h,
int mx,
int w,
int is6tap)
84 vec_u8 align_vec0, align_vec8, permh0, permh8,
filt;
85 vec_u8 perm_6tap0, perm_6tap8, perml0, perml8;
90 vec_u8 perm_inner6 = { 1,2,3,4, 2,3,4,5, 3,4,5,6, 4,5,6,7 };
91 vec_u8 perm_inner4 = { 0,1,2,3, 1,2,3,4, 2,3,4,5, 3,4,5,6 };
92 vec_u8 perm_inner = is6tap ? perm_inner6 : perm_inner4;
93 vec_u8 perm_outer = { 4,9, 0,5, 5,10, 1,6, 6,11, 2,7, 7,12, 3,8 };
94 vec_s32 c64 = vec_sl(vec_splat_s32(1), vec_splat_u32(6));
97 align_vec0 = vec_lvsl( -is6tap-1, src);
98 align_vec8 = vec_lvsl(8-is6tap-1, src);
100 permh0 = vec_perm(align_vec0, align_vec0, perm_inner);
101 permh8 = vec_perm(align_vec8, align_vec8, perm_inner);
102 perm_inner = vec_add(perm_inner, vec_splat_u8(4));
103 perml0 = vec_perm(align_vec0, align_vec0, perm_inner);
104 perml8 = vec_perm(align_vec8, align_vec8, perm_inner);
105 perm_6tap0 = vec_perm(align_vec0, align_vec0, perm_outer);
106 perm_6tap8 = vec_perm(align_vec8, align_vec8, perm_outer);
113 filt = vec_packsu(f16h, f16l);
114 vec_st(filt, 0, dst);
116 filt = vec_packsu(f16h, f16h);
117 vec_ste((
vec_u32)filt, 0, (uint32_t*)dst);
119 vec_ste((
vec_u32)filt, 4, (uint32_t*)dst);
129 { 0, 6, 123, 12, 1, 0 },
130 { 2, 11, 108, 36, 8, 1 },
131 { 0, 9, 93, 50, 6, 0 },
132 { 3, 16, 77, 77, 16, 3 },
133 { 0, 6, 50, 93, 9, 0 },
134 { 1, 8, 36, 108, 11, 2 },
135 { 0, 1, 12, 123, 6, 0 },
138 #define LOAD_V_SUBPEL_FILTER(i) \ 139 vec_u8 subpel_filter = v_subpel_filters[i]; \ 140 vec_u8 f0 = vec_splat(subpel_filter, 0); \ 141 vec_u8 f1 = vec_splat(subpel_filter, 1); \ 142 vec_u8 f2 = vec_splat(subpel_filter, 2); \ 143 vec_u8 f3 = vec_splat(subpel_filter, 3); \ 144 vec_u8 f4 = vec_splat(subpel_filter, 4); \ 145 vec_u8 f5 = vec_splat(subpel_filter, 5) 147 #define FILTER_V(dstv, vec_mul) \ 148 s1f = (vec_s16)vec_mul(s1, f1); \ 149 s2f = (vec_s16)vec_mul(s2, f2); \ 150 s3f = (vec_s16)vec_mul(s3, f3); \ 151 s4f = (vec_s16)vec_mul(s4, f4); \ 152 s2f = vec_subs(s2f, s1f); \ 153 s3f = vec_subs(s3f, s4f); \ 155 s0f = (vec_s16)vec_mul(s0, f0); \ 156 s5f = (vec_s16)vec_mul(s5, f5); \ 157 s2f = vec_adds(s2f, s0f); \ 158 s3f = vec_adds(s3f, s5f); \ 160 dstv = vec_adds(s2f, s3f); \ 161 dstv = vec_adds(dstv, c64); \ 162 dstv = vec_sra(dstv, c7) 167 int h,
int my,
int w,
int is6tap)
171 vec_s16 s0f, s1f, s2f, s3f, s4f, s5f, f16h, f16l;
172 vec_s16 c64 = vec_sl(vec_splat_s16(1), vec_splat_u16(6));
177 align_vech = vec_lvsl(0, src);
178 align_vecl = vec_sld(align_vech, align_vech, 8);
180 perm_vec = vec_mergeh(align_vech, align_vecl);
182 perm_vec = vec_mergeh(align_vech, align_vech);
192 src += (2+is6tap)*src_stride;
204 filt = vec_packsu(f16h, f16l);
205 vec_st(filt, 0, dst);
207 filt = vec_packsu(f16h, f16h);
211 vec_ste((
vec_u32)filt, 4, (uint32_t*)dst);
212 vec_ste((
vec_u32)filt, 0, (uint32_t*)dst);
228 #define EPEL_FUNCS(WIDTH, TAPS) \ 230 void put_vp8_epel ## WIDTH ## _h ## TAPS ## _altivec(uint8_t *dst, ptrdiff_t dst_stride, uint8_t *src, ptrdiff_t src_stride, int h, int mx, int my) \ 232 put_vp8_epel_h_altivec_core(dst, dst_stride, src, src_stride, h, mx, WIDTH, TAPS == 6); \ 236 void put_vp8_epel ## WIDTH ## _v ## TAPS ## _altivec(uint8_t *dst, ptrdiff_t dst_stride, uint8_t *src, ptrdiff_t src_stride, int h, int mx, int my) \ 238 put_vp8_epel_v_altivec_core(dst, dst_stride, src, src_stride, h, my, WIDTH, TAPS == 6); \ 241 #define EPEL_HV(WIDTH, HTAPS, VTAPS) \ 242 static void put_vp8_epel ## WIDTH ## _h ## HTAPS ## v ## VTAPS ## _altivec(uint8_t *dst, ptrdiff_t stride, uint8_t *src, ptrdiff_t s, int h, int mx, int my) \ 244 DECLARE_ALIGNED(16, uint8_t, tmp)[(2*WIDTH+5)*16]; \ 246 put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16, src-2*stride, stride, h+5, mx, my); \ 247 put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, stride, tmp+2*16, 16, h, mx, my); \ 249 put_vp8_epel ## WIDTH ## _h ## HTAPS ## _altivec(tmp, 16, src-stride, stride, h+4, mx, my); \ 250 put_vp8_epel ## WIDTH ## _v ## VTAPS ## _altivec(dst, stride, tmp+16, 16, h, mx, my); \ #define LOAD_H_SUBPEL_FILTER(i)
#define AV_CPU_FLAG_ALTIVEC
standard
memory handling functions
static const vec_s8 h_subpel_filters_inner[7]
#define EPEL_FUNCS(WIDTH, TAPS)
static const vec_u8 v_subpel_filters[7]
static av_always_inline void put_vp8_epel_v_altivec_core(uint8_t *dst, ptrdiff_t dst_stride, uint8_t *src, ptrdiff_t src_stride, int h, int my, int w, int is6tap)
static const vec_s8 h_subpel_filters_outer[3]
static vec_u8 load_with_perm_vec(int offset, uint8_t *src, vec_u8 perm_vec)
loads vector known misalignment
output residual component w
vp8_mc_func put_vp8_epel_pixels_tab[3][3][3]
first dimension: width>>3, height is assumed equal to width second dimension: 0 if no vertical interp...
av_cold void ff_vp8dsp_init_altivec(VP8DSPContext *c)
VP8 compatible video decoder.
#define EPEL_HV(WIDTH, HTAPS, VTAPS)
static av_always_inline void put_vp8_epel_h_altivec_core(uint8_t *dst, ptrdiff_t dst_stride, uint8_t *src, ptrdiff_t src_stride, int h, int mx, int w, int is6tap)
#define LOAD_V_SUBPEL_FILTER(i)
void ff_put_pixels16_altivec(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
#define FILTER_H(dstv, off)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Contains misc utility macros and inline functions.
static const int8_t filt[NUMTAPS]
#define FILTER_V(dstv, vec_mul)
else dst[i][x+y *dst_stride[i]]
static void put_vp8_pixels16_altivec(uint8_t *dst, ptrdiff_t stride, uint8_t *src, ptrdiff_t s, int h, int mx, int my)