vec_perm((vector unsigned char)zero, neg1, perms##i);	\
vec_perm((vector unsigned char)zero, (vector unsigned char)neg1, perms##i);	\
static inline void doVertLowPass_altivec(uint8_t *src, int stride, PPContext *c) {  /*    this code makes no assumption on src or stride.    One could remove the recomputation of the perm    vector by assuming (stride % 16) == 0, unfortunately    this is not always true. Quite a lot of load/stores    can be removed by assuming proper alignement of    src & stride :-(  */  uint8_t *src2 = src;  const vector signed int zero = vec_splat_s32(0);  short __attribute__ ((aligned(16))) qp[8];  qp[0] = c->QP;  vector signed short vqp = vec_ld(0, qp);  vqp = vec_splat(vqp, 0);	#define LOAD_LINE(i)                                                    \  const vector unsigned char perml##i =					\    vec_lvsl(i * stride, src2);						\  const vector unsigned char vbA##i =					\    vec_ld(i * stride, src2);						\  const vector unsigned char vbB##i =					\    vec_ld(i * stride + 16, src2);					\  const vector unsigned char vbT##i =					\    vec_perm(vbA##i, vbB##i, perml##i);					\  const vector signed short vb##i =					\    (vector signed short)vec_mergeh((vector unsigned char)zero,		\				    (vector unsigned char)vbT##i)	  src2 += stride*3;  LOAD_LINE(0);  LOAD_LINE(1);  LOAD_LINE(2);  LOAD_LINE(3);  LOAD_LINE(4);  LOAD_LINE(5);  LOAD_LINE(6);  LOAD_LINE(7);  LOAD_LINE(8);  LOAD_LINE(9);#undef LOAD_LINE  const vector unsigned short v_1 = vec_splat_u16(1);  const vector unsigned short v_2 = vec_splat_u16(2);  const vector unsigned short v_4 = vec_splat_u16(4);  const vector signed short v_8 = vec_splat_s16(8);  const vector signed short v_first = vec_sel(vb1, vb0,                                              vec_cmplt(vec_abs(vec_sub(vb0, vb1)),                                                        vqp));  const vector signed short v_last = vec_sel(vb8, vb9,                                             vec_cmplt(vec_abs(vec_sub(vb8, vb9)),                                                       vqp));  const vector signed short v_sums0 = vec_add(v_first, vb1);  const vector signed short v_sums1 = vec_add(vb1, vb2);  const vector signed short v_sums2 = vec_add(vb2, vb3);  const vector signed short v_sums3 = vec_add(vb3, vb4);  const vector signed short v_sums4 = vec_add(vb4, vb5);  const vector signed short v_sums5 = vec_add(vb5, vb6);  const vector signed short v_sums6 = vec_add(vb6, vb7);  const vector signed short v_sums7 = vec_add(vb7, vb8);  const vector signed short v_sums8 = vec_add(vb8, v_last);  const vector signed short vr1 = vec_sra(vec_add(vec_add(vec_sl(v_sums0, v_2),                                                          vec_sl(vec_add(v_first, v_sums2), v_1)),                                                  vec_add(v_sums4, v_8)),                                          v_4);  const vector signed short vr2 = vec_sra(vec_add(vec_add(vec_sl(vb2, v_2),                                                          v_sums5),                                                  vec_add(v_8,                                                          vec_sl(vec_add(v_first,                                                                         vec_add(v_sums0, v_sums3)),                                                                 v_1))),                                          v_4);  const vector signed short vr3 = vec_sra(vec_add(vec_add(vec_sl(vb3, v_2),                                                          v_sums6),                                                  vec_add(v_8,                                                          vec_sl(vec_add(v_first,                                                                         vec_add(v_sums1, v_sums4)),                                                                 v_1))),                                          v_4);  const vector signed short vr4 = vec_sra(vec_add(vec_add(vec_sl(vb4, v_2),                                                          v_sums7),                                                  vec_add(v_8,                                                          vec_add(v_sums0,                                                                  vec_sl(vec_add(v_sums2, v_sums5),                                                                         v_1)))),                                          v_4);  const vector signed short vr5 = vec_sra(vec_add(vec_add(vec_sl(vb5, v_2),                                                          v_sums8),                                                  vec_add(v_8,                                                          vec_add(v_sums1,                                                                  vec_sl(vec_add(v_sums3, v_sums6),                                                                         v_1)))),                                          v_4);  const vector signed short vr6 = vec_sra(vec_add(vec_add(vec_sl(vb6, v_2),                                                          v_sums2),                                                  vec_add(v_8,                                                          vec_sl(vec_add(v_last,                                                                         vec_add(v_sums7, v_sums4)),                                                                 v_1))),                                          v_4);  const vector signed short vr7 = vec_sra(vec_add(vec_add(vec_sl(vec_add(v_last, vb7), v_2),                                                          vec_sl(vec_add(vb8, v_sums5), v_1)),                                                  vec_add(v_8, v_sums3)),                                          v_4);  const vector signed short vr8 = vec_sra(vec_add(vec_add(vec_sl(v_sums8, v_2),                                                          vec_sl(vec_add(v_last, v_sums6), v_1)),                                                  vec_add(v_sums4, v_8)),                                          v_4);  const vector unsigned char neg1 = (vector unsigned char)AVV(-1, -1, -1, -1, -1, -1, -1, -1,							      -1, -1, -1, -1, -1, -1, -1, -1);  const vector unsigned char permHH = (vector unsigned char)AVV(0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,								0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F);#define PACK_AND_STORE(i)					\  const vector unsigned char perms##i =				\    vec_lvsr(i * stride, src2);					\  const vector unsigned char vf##i =				\    vec_packsu(vr##i, (vector signed short)zero);		\  const vector unsigned char vg##i =				\    vec_perm(vf##i, vbT##i, permHH);				\  const vector unsigned char mask##i =				\    vec_perm((vector unsigned char)zero, neg1, perms##i);	\  const vector unsigned char vg2##i =				\    vec_perm(vg##i, vg##i, perms##i);				\  const vector unsigned char svA##i =				\    vec_sel(vbA##i, vg2##i, mask##i);				\  const vector unsigned char svB##i =				\    vec_sel(vg2##i, vbB##i, mask##i);				\  vec_st(svA##i, i * stride, src2);				\  vec_st(svB##i, i * stride + 16, src2)  PACK_AND_STORE(1);  PACK_AND_STORE(2);  PACK_AND_STORE(3);  PACK_AND_STORE(4);  PACK_AND_STORE(5);  PACK_AND_STORE(6);  PACK_AND_STORE(7);  PACK_AND_STORE(8);#undef PACK_AND_STORE}