comparison ppc/h264_altivec.c @ 10961:34a65026fa06 libavcodec

Move array specifiers outside DECLARE_ALIGNED() invocations
author mru
date Fri, 22 Jan 2010 03:25:11 +0000
parents fe17033a79ed
children 98970e51365a
comparison
equal deleted inserted replaced
10960:10759fd39860 10961:34a65026fa06
77 static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## CODETYPE (uint8_t *dst, uint8_t *src, int stride){\ 77 static void OPNAME ## h264_qpel ## SIZE ## _mc00_ ## CODETYPE (uint8_t *dst, uint8_t *src, int stride){\
78 OPNAME ## pixels ## SIZE ## _ ## CODETYPE(dst, src, stride, SIZE);\ 78 OPNAME ## pixels ## SIZE ## _ ## CODETYPE(dst, src, stride, SIZE);\
79 }\ 79 }\
80 \ 80 \
81 static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){ \ 81 static void OPNAME ## h264_qpel ## SIZE ## _mc10_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){ \
82 DECLARE_ALIGNED_16(uint8_t, half[SIZE*SIZE]);\ 82 DECLARE_ALIGNED_16(uint8_t, half)[SIZE*SIZE];\
83 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, SIZE, stride);\ 83 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
84 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, stride, stride, SIZE);\ 84 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, stride, stride, SIZE);\
85 }\ 85 }\
86 \ 86 \
87 static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 87 static void OPNAME ## h264_qpel ## SIZE ## _mc20_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
88 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(dst, src, stride, stride);\ 88 OPNAME ## h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(dst, src, stride, stride);\
89 }\ 89 }\
90 \ 90 \
91 static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 91 static void OPNAME ## h264_qpel ## SIZE ## _mc30_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
92 DECLARE_ALIGNED_16(uint8_t, half[SIZE*SIZE]);\ 92 DECLARE_ALIGNED_16(uint8_t, half)[SIZE*SIZE];\
93 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, SIZE, stride);\ 93 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
94 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+1, half, stride, stride, SIZE);\ 94 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+1, half, stride, stride, SIZE);\
95 }\ 95 }\
96 \ 96 \
97 static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 97 static void OPNAME ## h264_qpel ## SIZE ## _mc01_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
98 DECLARE_ALIGNED_16(uint8_t, half[SIZE*SIZE]);\ 98 DECLARE_ALIGNED_16(uint8_t, half)[SIZE*SIZE];\
99 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, SIZE, stride);\ 99 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
100 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, stride, stride, SIZE);\ 100 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src, half, stride, stride, SIZE);\
101 }\ 101 }\
102 \ 102 \
103 static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 103 static void OPNAME ## h264_qpel ## SIZE ## _mc02_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
104 OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(dst, src, stride, stride);\ 104 OPNAME ## h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(dst, src, stride, stride);\
105 }\ 105 }\
106 \ 106 \
107 static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 107 static void OPNAME ## h264_qpel ## SIZE ## _mc03_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
108 DECLARE_ALIGNED_16(uint8_t, half[SIZE*SIZE]);\ 108 DECLARE_ALIGNED_16(uint8_t, half)[SIZE*SIZE];\
109 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, SIZE, stride);\ 109 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(half, src, SIZE, stride);\
110 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+stride, half, stride, stride, SIZE);\ 110 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, src+stride, half, stride, stride, SIZE);\
111 }\ 111 }\
112 \ 112 \
113 static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 113 static void OPNAME ## h264_qpel ## SIZE ## _mc11_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
114 DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\ 114 DECLARE_ALIGNED_16(uint8_t, halfH)[SIZE*SIZE];\
115 DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\ 115 DECLARE_ALIGNED_16(uint8_t, halfV)[SIZE*SIZE];\
116 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\ 116 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\
117 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, 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);\ 118 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
119 }\ 119 }\
120 \ 120 \
121 static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 121 static void OPNAME ## h264_qpel ## SIZE ## _mc31_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
122 DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\ 122 DECLARE_ALIGNED_16(uint8_t, halfH)[SIZE*SIZE];\
123 DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\ 123 DECLARE_ALIGNED_16(uint8_t, halfV)[SIZE*SIZE];\
124 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\ 124 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\
125 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\ 125 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\
126 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\ 126 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
127 }\ 127 }\
128 \ 128 \
129 static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 129 static void OPNAME ## h264_qpel ## SIZE ## _mc13_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
130 DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\ 130 DECLARE_ALIGNED_16(uint8_t, halfH)[SIZE*SIZE];\
131 DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\ 131 DECLARE_ALIGNED_16(uint8_t, halfV)[SIZE*SIZE];\
132 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\ 132 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\
133 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\ 133 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\
134 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\ 134 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
135 }\ 135 }\
136 \ 136 \
137 static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 137 static void OPNAME ## h264_qpel ## SIZE ## _mc33_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
138 DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\ 138 DECLARE_ALIGNED_16(uint8_t, halfH)[SIZE*SIZE];\
139 DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\ 139 DECLARE_ALIGNED_16(uint8_t, halfV)[SIZE*SIZE];\
140 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\ 140 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\
141 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\ 141 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\
142 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\ 142 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfV, stride, SIZE, SIZE);\
143 }\ 143 }\
144 \ 144 \
145 static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 145 static void OPNAME ## h264_qpel ## SIZE ## _mc22_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
146 DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\ 146 DECLARE_ALIGNED_16(int16_t, tmp)[SIZE*(SIZE+8)];\
147 OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(dst, tmp, src, stride, SIZE, stride);\ 147 OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(dst, tmp, src, stride, SIZE, stride);\
148 }\ 148 }\
149 \ 149 \
150 static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 150 static void OPNAME ## h264_qpel ## SIZE ## _mc21_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
151 DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\ 151 DECLARE_ALIGNED_16(uint8_t, halfH)[SIZE*SIZE];\
152 DECLARE_ALIGNED_16(uint8_t, halfHV[SIZE*SIZE]);\ 152 DECLARE_ALIGNED_16(uint8_t, halfHV)[SIZE*SIZE];\
153 DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\ 153 DECLARE_ALIGNED_16(int16_t, tmp)[SIZE*(SIZE+8)];\
154 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\ 154 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src, SIZE, stride);\
155 put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\ 155 put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
156 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, stride, SIZE, SIZE);\ 156 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, stride, SIZE, SIZE);\
157 }\ 157 }\
158 \ 158 \
159 static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 159 static void OPNAME ## h264_qpel ## SIZE ## _mc23_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
160 DECLARE_ALIGNED_16(uint8_t, halfH[SIZE*SIZE]);\ 160 DECLARE_ALIGNED_16(uint8_t, halfH)[SIZE*SIZE];\
161 DECLARE_ALIGNED_16(uint8_t, halfHV[SIZE*SIZE]);\ 161 DECLARE_ALIGNED_16(uint8_t, halfHV)[SIZE*SIZE];\
162 DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\ 162 DECLARE_ALIGNED_16(int16_t, tmp)[SIZE*(SIZE+8)];\
163 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\ 163 put_h264_qpel ## SIZE ## _h_lowpass_ ## CODETYPE(halfH, src + stride, SIZE, stride);\
164 put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\ 164 put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
165 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, stride, SIZE, SIZE);\ 165 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfH, halfHV, stride, SIZE, SIZE);\
166 }\ 166 }\
167 \ 167 \
168 static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 168 static void OPNAME ## h264_qpel ## SIZE ## _mc12_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
169 DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\ 169 DECLARE_ALIGNED_16(uint8_t, halfV)[SIZE*SIZE];\
170 DECLARE_ALIGNED_16(uint8_t, halfHV[SIZE*SIZE]);\ 170 DECLARE_ALIGNED_16(uint8_t, halfHV)[SIZE*SIZE];\
171 DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\ 171 DECLARE_ALIGNED_16(int16_t, tmp)[SIZE*(SIZE+8)];\
172 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\ 172 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src, SIZE, stride);\
173 put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\ 173 put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
174 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, stride, SIZE, SIZE);\ 174 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, stride, SIZE, SIZE);\
175 }\ 175 }\
176 \ 176 \
177 static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\ 177 static void OPNAME ## h264_qpel ## SIZE ## _mc32_ ## CODETYPE(uint8_t *dst, uint8_t *src, int stride){\
178 DECLARE_ALIGNED_16(uint8_t, halfV[SIZE*SIZE]);\ 178 DECLARE_ALIGNED_16(uint8_t, halfV)[SIZE*SIZE];\
179 DECLARE_ALIGNED_16(uint8_t, halfHV[SIZE*SIZE]);\ 179 DECLARE_ALIGNED_16(uint8_t, halfHV)[SIZE*SIZE];\
180 DECLARE_ALIGNED_16(int16_t, tmp[SIZE*(SIZE+8)]);\ 180 DECLARE_ALIGNED_16(int16_t, tmp)[SIZE*(SIZE+8)];\
181 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\ 181 put_h264_qpel ## SIZE ## _v_lowpass_ ## CODETYPE(halfV, src+1, SIZE, stride);\
182 put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\ 182 put_h264_qpel ## SIZE ## _hv_lowpass_ ## CODETYPE(halfHV, tmp, src, SIZE, SIZE, stride);\
183 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, stride, SIZE, SIZE);\ 183 OPNAME ## pixels ## SIZE ## _l2_ ## CODETYPE(dst, halfV, halfHV, stride, SIZE, SIZE);\
184 }\ 184 }\
185 185
588 } 588 }
589 589
590 static inline void write16x4(uint8_t *dst, int dst_stride, 590 static inline void write16x4(uint8_t *dst, int dst_stride,
591 register vec_u8 r0, register vec_u8 r1, 591 register vec_u8 r0, register vec_u8 r1,
592 register vec_u8 r2, register vec_u8 r3) { 592 register vec_u8 r2, register vec_u8 r3) {
593 DECLARE_ALIGNED_16(unsigned char, result[64]); 593 DECLARE_ALIGNED_16(unsigned char, result)[64];
594 uint32_t *src_int = (uint32_t *)result, *dst_int = (uint32_t *)dst; 594 uint32_t *src_int = (uint32_t *)result, *dst_int = (uint32_t *)dst;
595 int int_dst_stride = dst_stride/4; 595 int int_dst_stride = dst_stride/4;
596 596
597 vec_st(r0, 0, result); 597 vec_st(r0, 0, result);
598 vec_st(r1, 16, result); 598 vec_st(r1, 16, result);
768 p0 = vec_adds(p0, delta); \ 768 p0 = vec_adds(p0, delta); \
769 q0 = vec_adds(q0, deltaneg); \ 769 q0 = vec_adds(q0, deltaneg); \
770 } 770 }
771 771
772 #define h264_loop_filter_luma_altivec(p2, p1, p0, q0, q1, q2, alpha, beta, tc0) { \ 772 #define h264_loop_filter_luma_altivec(p2, p1, p0, q0, q1, q2, alpha, beta, tc0) { \
773 DECLARE_ALIGNED_16(unsigned char, temp[16]); \ 773 DECLARE_ALIGNED_16(unsigned char, temp)[16]; \
774 register vec_u8 alphavec; \ 774 register vec_u8 alphavec; \
775 register vec_u8 betavec; \ 775 register vec_u8 betavec; \
776 register vec_u8 mask; \ 776 register vec_u8 mask; \
777 register vec_u8 p1mask; \ 777 register vec_u8 p1mask; \
778 register vec_u8 q1mask; \ 778 register vec_u8 q1mask; \
848 { 848 {
849 int y, aligned; 849 int y, aligned;
850 vec_u8 vblock; 850 vec_u8 vblock;
851 vec_s16 vtemp, vweight, voffset, v0, v1; 851 vec_s16 vtemp, vweight, voffset, v0, v1;
852 vec_u16 vlog2_denom; 852 vec_u16 vlog2_denom;
853 DECLARE_ALIGNED_16(int32_t, temp[4]); 853 DECLARE_ALIGNED_16(int32_t, temp)[4];
854 LOAD_ZERO; 854 LOAD_ZERO;
855 855
856 offset <<= log2_denom; 856 offset <<= log2_denom;
857 if(log2_denom) offset += 1<<(log2_denom-1); 857 if(log2_denom) offset += 1<<(log2_denom-1);
858 temp[0] = log2_denom; 858 temp[0] = log2_denom;
894 { 894 {
895 int y, dst_aligned, src_aligned; 895 int y, dst_aligned, src_aligned;
896 vec_u8 vsrc, vdst; 896 vec_u8 vsrc, vdst;
897 vec_s16 vtemp, vweights, vweightd, voffset, v0, v1, v2, v3; 897 vec_s16 vtemp, vweights, vweightd, voffset, v0, v1, v2, v3;
898 vec_u16 vlog2_denom; 898 vec_u16 vlog2_denom;
899 DECLARE_ALIGNED_16(int32_t, temp[4]); 899 DECLARE_ALIGNED_16(int32_t, temp)[4];
900 LOAD_ZERO; 900 LOAD_ZERO;
901 901
902 offset = ((offset + 1) | 1) << log2_denom; 902 offset = ((offset + 1) | 1) << log2_denom;
903 temp[0] = log2_denom+1; 903 temp[0] = log2_denom+1;
904 temp[1] = weights; 904 temp[1] = weights;