33 #define PUT_OP_U8_ALTIVEC(d, s, dst) d = s
34 #define AVG_OP_U8_ALTIVEC(d, s, dst) d = vec_avg(dst, s)
36 #define OP_U8_ALTIVEC PUT_OP_U8_ALTIVEC
37 #define PREFIX_h264_qpel16_h_lowpass_altivec put_h264_qpel16_h_lowpass_altivec
38 #define PREFIX_h264_qpel16_h_lowpass_num altivec_put_h264_qpel16_h_lowpass_num
39 #define PREFIX_h264_qpel16_v_lowpass_altivec put_h264_qpel16_v_lowpass_altivec
40 #define PREFIX_h264_qpel16_v_lowpass_num altivec_put_h264_qpel16_v_lowpass_num
41 #define PREFIX_h264_qpel16_hv_lowpass_altivec put_h264_qpel16_hv_lowpass_altivec
42 #define PREFIX_h264_qpel16_hv_lowpass_num altivec_put_h264_qpel16_hv_lowpass_num
43 #include "h264qpel_template.c"
45 #undef PREFIX_h264_qpel16_h_lowpass_altivec
46 #undef PREFIX_h264_qpel16_h_lowpass_num
47 #undef PREFIX_h264_qpel16_v_lowpass_altivec
48 #undef PREFIX_h264_qpel16_v_lowpass_num
49 #undef PREFIX_h264_qpel16_hv_lowpass_altivec
50 #undef PREFIX_h264_qpel16_hv_lowpass_num
52 #define OP_U8_ALTIVEC AVG_OP_U8_ALTIVEC
53 #define PREFIX_h264_qpel16_h_lowpass_altivec avg_h264_qpel16_h_lowpass_altivec
54 #define PREFIX_h264_qpel16_h_lowpass_num altivec_avg_h264_qpel16_h_lowpass_num
55 #define PREFIX_h264_qpel16_v_lowpass_altivec avg_h264_qpel16_v_lowpass_altivec
56 #define PREFIX_h264_qpel16_v_lowpass_num altivec_avg_h264_qpel16_v_lowpass_num
57 #define PREFIX_h264_qpel16_hv_lowpass_altivec avg_h264_qpel16_hv_lowpass_altivec
58 #define PREFIX_h264_qpel16_hv_lowpass_num altivec_avg_h264_qpel16_hv_lowpass_num
59 #include "h264qpel_template.c"
61 #undef PREFIX_h264_qpel16_h_lowpass_altivec
62 #undef PREFIX_h264_qpel16_h_lowpass_num
63 #undef PREFIX_h264_qpel16_v_lowpass_altivec
64 #undef PREFIX_h264_qpel16_v_lowpass_num
65 #undef PREFIX_h264_qpel16_hv_lowpass_altivec
66 #undef PREFIX_h264_qpel16_hv_lowpass_num
68 #define H264_MC(OPNAME, SIZE, CODETYPE) \
69 static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## CODETYPE (uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
71 ff_ ## OPNAME ## pixels ## SIZE ## _ ## CODETYPE(dst, src, stride, SIZE);\
74 static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
76 DECLARE_ALIGNED(16, uint8_t, half)[SIZE*SIZE];\
77 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
78 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, stride, stride, SIZE);\
81 static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
83 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(dst, src, stride, stride);\
86 static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
88 DECLARE_ALIGNED(16, uint8_t, half)[SIZE*SIZE];\
89 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
90 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+1, half, stride, stride, SIZE);\
93 static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
95 DECLARE_ALIGNED(16, uint8_t, half)[SIZE*SIZE];\
96 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
97 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, stride, stride, SIZE);\
100 static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
102 OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(dst, src, stride, stride);\
105 static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
107 DECLARE_ALIGNED(16, uint8_t, half)[SIZE*SIZE];\
108 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
109 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+stride, half, stride, stride, SIZE);\
112 static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
114 DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
115 DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
116 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\
117 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\
118 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
121 static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
123 DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
124 DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
125 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\
126 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\
127 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
130 static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
132 DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
133 DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
134 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\
135 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\
136 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
139 static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
141 DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
142 DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
143 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\
144 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\
145 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
148 static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
150 DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
151 OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(dst, tmp, src, stride, SIZE, stride);\
154 static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
156 DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
157 DECLARE_ALIGNED(16, uint8_t, halfHV)[SIZE*SIZE];\
158 DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
159 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\
160 put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
161 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, stride, SIZE, SIZE);\
164 static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
166 DECLARE_ALIGNED(16, uint8_t, halfH)[SIZE*SIZE];\
167 DECLARE_ALIGNED(16, uint8_t, halfHV)[SIZE*SIZE];\
168 DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
169 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\
170 put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
171 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, stride, SIZE, SIZE);\
174 static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
176 DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
177 DECLARE_ALIGNED(16, uint8_t, halfHV)[SIZE*SIZE];\
178 DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
179 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\
180 put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
181 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, stride, SIZE, SIZE);\
184 static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## CODETYPE(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)\
186 DECLARE_ALIGNED(16, uint8_t, halfV)[SIZE*SIZE];\
187 DECLARE_ALIGNED(16, uint8_t, halfHV)[SIZE*SIZE];\
188 DECLARE_ALIGNED(16, int16_t, tmp)[SIZE*(SIZE+8)];\
189 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\
190 put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
191 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, stride, SIZE, SIZE);\
195 #define put_unligned_store(s, dest) { \
196 tmp1 = vec_ld(0, dest); \
197 mask = vec_lvsl(0, dest); \
198 tmp2 = vec_ld(15, dest); \
199 edges = vec_perm(tmp2, tmp1, mask); \
200 align = vec_lvsr(0, dest); \
201 tmp2 = vec_perm(s, edges, align); \
202 tmp1 = vec_perm(edges, s, align); \
203 vec_st(tmp2, 15, dest); \
204 vec_st(tmp1, 0 , dest); \
207 #define put_unligned_store(s, dest) vec_vsx_st(s, 0, dest);
211 const uint8_t * src2,
int dst_stride,
212 int src_stride1,
int h)
218 mask_ = vec_lvsl(0, src2);
221 for (i = 0; i <
h; i++) {
222 a = unaligned_load(i * src_stride1, src1);
223 b = load_with_perm_vec(i * 16, src2, mask_);
225 put_unligned_store(d, dst);
231 #define avg_unligned_store(s, dest){ \
232 tmp1 = vec_ld(0, dest); \
233 mask = vec_lvsl(0, dest); \
234 tmp2 = vec_ld(15, dest); \
235 a = vec_avg(vec_perm(tmp1, tmp2, mask), s); \
236 edges = vec_perm(tmp2, tmp1, mask); \
237 align = vec_lvsr(0, dest); \
238 tmp2 = vec_perm(a, edges, align); \
239 tmp1 = vec_perm(edges, a, align); \
240 vec_st(tmp2, 15, dest); \
241 vec_st(tmp1, 0 , dest); \
244 #define avg_unligned_store(s, dest){ \
245 a = vec_avg(vec_vsx_ld(0, dst), s); \
246 vec_vsx_st(a, 0, dst); \
250 static inline void avg_pixels16_l2_altivec(
uint8_t * dst,
const uint8_t * src1,
251 const uint8_t * src2,
int dst_stride,
252 int src_stride1,
int h)
259 mask_ = vec_lvsl(0, src2);
262 for (i = 0; i <
h; i++) {
263 a = unaligned_load(i * src_stride1, src1);
264 b = load_with_perm_vec(i * 16, src2, mask_);
266 avg_unligned_store(d, dst);
283 const int high_bit_depth = bit_depth > 8;
288 if (!high_bit_depth) {
289 #define dspfunc(PFX, IDX, NUM) \
290 c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_altivec; \
291 c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_altivec; \
292 c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_altivec; \
293 c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_altivec; \
294 c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_altivec; \
295 c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_altivec; \
296 c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_altivec; \
297 c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_altivec; \
298 c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_altivec; \
299 c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_altivec; \
300 c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_altivec; \
301 c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_altivec; \
302 c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_altivec; \
303 c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_altivec; \
304 c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_altivec; \
305 c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_altivec
Macro definitions for various function/variable attributes.
av_cold void ff_h264qpel_init_ppc(H264QpelContext *c, int bit_depth)
static const uint16_t mask[17]
#define PPC_ALTIVEC(flags)
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
const AVS_VideoInfo int align
#define dspfunc(PFX, IDX, NUM)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Contains misc utility macros and inline functions.
#define H264_MC(OPNAME, SIZE)