comparison alpha/dsputil_alpha.c @ 548:3f05be811b5a libavcodec

Remove support for variable BSIZE and INCR, as sub_pixels_* is no longer needed.
author mellum
date Sat, 13 Jul 2002 16:29:11 +0000
parents 8cefba09f2e8
children 54b1c94977d5
comparison
equal deleted inserted replaced
547:31be0f0b0792 548:3f05be811b5a
149 + BYTE_VEC(0x02)) >> 2) & BYTE_VEC(0x03); 149 + BYTE_VEC(0x02)) >> 2) & BYTE_VEC(0x03);
150 return r1 + r2; 150 return r1 + r2;
151 } 151 }
152 #endif 152 #endif
153 153
154 #define OP(LOAD, STORE, INCR) \ 154 #define OP(LOAD, STORE) \
155 do { \ 155 do { \
156 STORE(LOAD(pixels), block); \ 156 STORE(LOAD(pixels), block); \
157 pixels += line_size; \ 157 pixels += line_size; \
158 block += INCR; \ 158 block += line_size; \
159 } while (--h) 159 } while (--h)
160 160
161 #define OP_X2(LOAD, STORE, INCR) \ 161 #define OP_X2(LOAD, STORE) \
162 do { \ 162 do { \
163 uint64_t pix1, pix2; \ 163 uint64_t pix1, pix2; \
164 \ 164 \
165 pix1 = LOAD(pixels); \ 165 pix1 = LOAD(pixels); \
166 pix2 = pix1 >> 8 | ((uint64_t) pixels[8] << 56); \ 166 pix2 = pix1 >> 8 | ((uint64_t) pixels[8] << 56); \
167 STORE(AVG2(pix1, pix2), block); \ 167 STORE(AVG2(pix1, pix2), block); \
168 pixels += line_size; \ 168 pixels += line_size; \
169 block += INCR; \ 169 block += line_size; \
170 } while (--h) 170 } while (--h)
171 171
172 #define OP_Y2(LOAD, STORE, INCR) \ 172 #define OP_Y2(LOAD, STORE) \
173 do { \ 173 do { \
174 uint64_t pix = LOAD(pixels); \ 174 uint64_t pix = LOAD(pixels); \
175 do { \ 175 do { \
176 uint64_t next_pix; \ 176 uint64_t next_pix; \
177 \ 177 \
178 pixels += line_size; \ 178 pixels += line_size; \
179 next_pix = LOAD(pixels); \ 179 next_pix = LOAD(pixels); \
180 STORE(AVG2(pix, next_pix), block); \ 180 STORE(AVG2(pix, next_pix), block); \
181 block += INCR; \ 181 block += line_size; \
182 pix = next_pix; \ 182 pix = next_pix; \
183 } while (--h); \ 183 } while (--h); \
184 } while (0) 184 } while (0)
185 185
186 #define OP_XY2(LOAD, STORE, INCR) \ 186 #define OP_XY2(LOAD, STORE) \
187 do { \ 187 do { \
188 uint64_t pix1 = LOAD(pixels); \ 188 uint64_t pix1 = LOAD(pixels); \
189 uint64_t pix2 = pix1 >> 8 | ((uint64_t) pixels[8] << 56); \ 189 uint64_t pix2 = pix1 >> 8 | ((uint64_t) pixels[8] << 56); \
190 uint64_t pix_l = (pix1 & BYTE_VEC(0x03)) \ 190 uint64_t pix_l = (pix1 & BYTE_VEC(0x03)) \
191 + (pix2 & BYTE_VEC(0x03)); \ 191 + (pix2 & BYTE_VEC(0x03)); \
206 + ((npix2 & ~BYTE_VEC(0x03)) >> 2); \ 206 + ((npix2 & ~BYTE_VEC(0x03)) >> 2); \
207 avg = (((pix_l + npix_l + AVG4_ROUNDER) >> 2) & BYTE_VEC(0x03)) \ 207 avg = (((pix_l + npix_l + AVG4_ROUNDER) >> 2) & BYTE_VEC(0x03)) \
208 + pix_h + npix_h; \ 208 + pix_h + npix_h; \
209 STORE(avg, block); \ 209 STORE(avg, block); \
210 \ 210 \
211 block += INCR; \ 211 block += line_size; \
212 pix_l = npix_l; \ 212 pix_l = npix_l; \
213 pix_h = npix_h; \ 213 pix_h = npix_h; \
214 } while (--h); \ 214 } while (--h); \
215 } while (0) 215 } while (0)
216 216
217 #define MAKE_OP(BTYPE, OPNAME, SUFF, OPKIND, STORE, INCR) \ 217 #define MAKE_OP(OPNAME, SUFF, OPKIND, STORE) \
218 static void OPNAME ## _pixels ## SUFF ## _axp \ 218 static void OPNAME ## _pixels ## SUFF ## _axp \
219 (BTYPE *restrict block, const uint8_t *restrict pixels, \ 219 (uint8_t *restrict block, const uint8_t *restrict pixels, \
220 int line_size, int h) \ 220 int line_size, int h) \
221 { \ 221 { \
222 if ((size_t) pixels & 0x7) { \ 222 if ((size_t) pixels & 0x7) { \
223 OPKIND(uldq, STORE, INCR); \ 223 OPKIND(uldq, STORE); \
224 } else { \ 224 } else { \
225 OPKIND(ldq, STORE, INCR); \ 225 OPKIND(ldq, STORE); \
226 } \ 226 } \
227 } 227 }
228 228
229 #define PIXOP(BTYPE, OPNAME, STORE, INCR) \ 229 #define PIXOP(OPNAME, STORE) \
230 MAKE_OP(BTYPE, OPNAME, , OP, STORE, INCR); \ 230 MAKE_OP(OPNAME, , OP, STORE) \
231 MAKE_OP(BTYPE, OPNAME, _x2, OP_X2, STORE, INCR); \ 231 MAKE_OP(OPNAME, _x2, OP_X2, STORE) \
232 MAKE_OP(BTYPE, OPNAME, _y2, OP_Y2, STORE, INCR); \ 232 MAKE_OP(OPNAME, _y2, OP_Y2, STORE) \
233 MAKE_OP(BTYPE, OPNAME, _xy2, OP_XY2, STORE, INCR); 233 MAKE_OP(OPNAME, _xy2, OP_XY2, STORE)
234 234
235 /* Rounding primitives. */ 235 /* Rounding primitives. */
236 #define AVG2 avg2 236 #define AVG2 avg2
237 #define AVG4 avg4 237 #define AVG4 avg4
238 #define AVG4_ROUNDER BYTE_VEC(0x02) 238 #define AVG4_ROUNDER BYTE_VEC(0x02)
239 #define STORE(l, b) stq(l, b) 239 #define STORE(l, b) stq(l, b)
240 PIXOP(uint8_t, put, STORE, line_size); 240 PIXOP(put, STORE);
241 241
242 #undef STORE 242 #undef STORE
243 #define STORE(l, b) stq(AVG2(l, ldq(b)), b); 243 #define STORE(l, b) stq(AVG2(l, ldq(b)), b);
244 PIXOP(uint8_t, avg, STORE, line_size); 244 PIXOP(avg, STORE);
245 245
246 /* Not rounding primitives. */ 246 /* Not rounding primitives. */
247 #undef AVG2 247 #undef AVG2
248 #undef AVG4 248 #undef AVG4
249 #undef AVG4_ROUNDER 249 #undef AVG4_ROUNDER
250 #undef STORE 250 #undef STORE
251 #define AVG2 avg2_no_rnd 251 #define AVG2 avg2_no_rnd
252 #define AVG4 avg4_no_rnd 252 #define AVG4 avg4_no_rnd
253 #define AVG4_ROUNDER BYTE_VEC(0x01) 253 #define AVG4_ROUNDER BYTE_VEC(0x01)
254 #define STORE(l, b) stq(l, b) 254 #define STORE(l, b) stq(l, b)
255 PIXOP(uint8_t, put_no_rnd, STORE, line_size); 255 PIXOP(put_no_rnd, STORE);
256 256
257 #undef STORE 257 #undef STORE
258 #define STORE(l, b) stq(AVG2(l, ldq(b)), b); 258 #define STORE(l, b) stq(AVG2(l, ldq(b)), b);
259 PIXOP(uint8_t, avg_no_rnd, STORE, line_size); 259 PIXOP(avg_no_rnd, STORE);
260 260
261 void dsputil_init_alpha(void) 261 void dsputil_init_alpha(void)
262 { 262 {
263 put_pixels_tab[0] = put_pixels_axp_asm; 263 put_pixels_tab[0] = put_pixels_axp_asm;
264 put_pixels_tab[1] = put_pixels_x2_axp; 264 put_pixels_tab[1] = put_pixels_x2_axp;