43 vector
unsigned char perm =
44 (vector
unsigned char) {0x00,0x10, 0x01,0x11,0x02,0x12,0x03,0x13,\
45 0x04,0x14,0x05,0x15,0x06,0x16,0x07,0x17};
46 const vector
unsigned char zero =
47 (
const vector
unsigned char) vec_splat_u8(0);
49 for (i = 0; i < 8; i++) {
53 vector
unsigned char bytes = vec_vsx_ld(0, pixels);
57 vector
signed short shorts = (vector
signed short) vec_perm(bytes, zero, perm);
60 vec_vsx_st(shorts, i * 16, (vector
signed short *) block);
66 static void get_pixels_altivec(int16_t *restrict block,
const uint8_t *pixels,
72 for (i = 0; i < 8; i++) {
73 vec_u8 perm = vec_lvsl(0, pixels);
77 vec_u8 pixl = vec_ld(0, pixels);
78 vec_u8 pixr = vec_ld(7, pixels);
79 vec_u8 bytes = vec_perm(pixl, pixr, perm);
85 vec_st(shorts, i * 16, (
vec_s16 *)block);
94 static void diff_pixels_altivec(int16_t *restrict block,
const uint8_t *
s1,
98 const vector
unsigned char zero =
99 (
const vector
unsigned char) vec_splat_u8(0);
100 vector
signed short shorts1, shorts2;
102 for (i = 0; i < 4; i++) {
106 vector
unsigned char bytes = vec_vsx_ld(0, s1);
109 shorts1 = (vector
signed short) vec_mergeh(bytes, zero);
112 bytes =vec_vsx_ld(0, s2);
115 shorts2 = (vector
signed short) vec_mergeh(bytes, zero);
118 shorts1 = vec_sub(shorts1, shorts2);
121 vec_vsx_st(shorts1, 0, (vector
signed short *) block);
133 bytes = vec_vsx_ld(0, s1);
136 shorts1 = (vector
signed short) vec_mergeh(bytes, zero);
139 bytes = vec_vsx_ld(0, s2);
142 shorts2 = (vector
signed short) vec_mergeh(bytes, zero);
145 shorts1 = vec_sub(shorts1, shorts2);
148 vec_vsx_st(shorts1, 0, (vector
signed short *) block);
156 static void diff_pixels_altivec(int16_t *restrict block,
const uint8_t *s1,
157 const uint8_t *s2, ptrdiff_t stride)
164 for (i = 0; i < 4; i++) {
168 perm = vec_lvsl(0, s1);
169 vec_u8 pixl = vec_ld(0, s1);
170 vec_u8 pixr = vec_ld(15, s1);
171 vec_u8 bytes = vec_perm(pixl, pixr, perm);
174 shorts1 = (
vec_s16)vec_mergeh(zero, bytes);
177 perm = vec_lvsl(0, s2);
178 pixl = vec_ld(0, s2);
179 pixr = vec_ld(15, s2);
180 bytes = vec_perm(pixl, pixr, perm);
183 shorts2 = (
vec_s16)vec_mergeh(zero, bytes);
186 shorts1 = vec_sub(shorts1, shorts2);
189 vec_st(shorts1, 0, (
vec_s16 *)block);
201 perm = vec_lvsl(0, s1);
202 pixl = vec_ld(0, s1);
203 pixr = vec_ld(15, s1);
204 bytes = vec_perm(pixl, pixr, perm);
207 shorts1 = (
vec_s16)vec_mergeh(zero, bytes);
210 perm = vec_lvsl(0, s2);
211 pixl = vec_ld(0, s2);
212 pixr = vec_ld(15, s2);
213 bytes = vec_perm(pixl, pixr, perm);
216 shorts2 = (
vec_s16)vec_mergeh(zero, bytes);
219 shorts1 = vec_sub(shorts1, shorts2);
222 vec_st(shorts1, 0, (
vec_s16 *)block);
235 static void get_pixels_vsx(int16_t *restrict block,
const uint8_t *pixels,
239 for (i = 0; i < 8; i++) {
240 vec_s16 shorts = vsx_ld_u8_s16(0, pixels);
242 vec_vsx_st(shorts, i * 16, block);
248 static void diff_pixels_vsx(int16_t *restrict block,
const uint8_t *s1,
249 const uint8_t *s2, ptrdiff_t stride)
253 for (i = 0; i < 8; i++) {
254 shorts1 = vsx_ld_u8_s16(0, s1);
255 shorts2 = vsx_ld_u8_s16(0, s2);
257 shorts1 = vec_sub(shorts1, shorts2);
259 vec_vsx_st(shorts1, 0, block);
270 unsigned high_bit_depth)
278 if (!high_bit_depth) {
Macro definitions for various function/variable attributes.
void(* diff_pixels)(int16_t *av_restrict block, const uint8_t *s1, const uint8_t *s2, ptrdiff_t stride)
#define PPC_ALTIVEC(flags)
void(* get_pixels)(int16_t *av_restrict block, const uint8_t *pixels, ptrdiff_t stride)
Libavcodec external API header.
main external API structure.
av_cold void ff_pixblockdsp_init_ppc(PixblockDSPContext *c, AVCodecContext *avctx, unsigned high_bit_depth)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
Contains misc utility macros and inline functions.
GLint GLenum GLboolean GLsizei stride