comparison ppc/dsputil_ppc.c @ 3546:5f97ba9a4eaa libavcodec

Almost cosmetic changes in dsputil_init_ppc and vorbis_inverse_coupling_altivec: - whitespace consistency 2->4 [dsputil_init_ppc] - reorder struct initialization with dsputil_init_altivec [dsputil_init_ppc] - use casts instead of temp variables [vorbis_inverse_coupling_altivec]
author lu_zero
date Thu, 03 Aug 2006 16:13:50 +0000
parents bdbe52f38868
children e542c9978077
comparison
equal deleted inserted replaced
3545:e2a589e55906 3546:5f97ba9a4eaa
24 24
25 #ifdef HAVE_ALTIVEC 25 #ifdef HAVE_ALTIVEC
26 #include "dsputil_altivec.h" 26 #include "dsputil_altivec.h"
27 27
28 extern void fdct_altivec(int16_t *block); 28 extern void fdct_altivec(int16_t *block);
29 extern void gmc1_altivec(uint8_t *dst, uint8_t *src, int stride, int h,
30 int x16, int y16, int rounder);
29 extern void idct_put_altivec(uint8_t *dest, int line_size, int16_t *block); 31 extern void idct_put_altivec(uint8_t *dest, int line_size, int16_t *block);
30 extern void idct_add_altivec(uint8_t *dest, int line_size, int16_t *block); 32 extern void idct_add_altivec(uint8_t *dest, int line_size, int16_t *block);
31 extern void ff_snow_horizontal_compose97i_altivec(DWTELEM *b, int width); 33 extern void ff_snow_horizontal_compose97i_altivec(DWTELEM *b, int width);
32 extern void ff_snow_vertical_compose97i_altivec(DWTELEM *b0, DWTELEM *b1, 34 extern void ff_snow_vertical_compose97i_altivec(DWTELEM *b0, DWTELEM *b1,
33 DWTELEM *b2, DWTELEM *b3, 35 DWTELEM *b2, DWTELEM *b3,
38 uint8_t * * block, int b_w, 40 uint8_t * * block, int b_w,
39 int b_h, int src_x, int src_y, 41 int b_h, int src_x, int src_y,
40 int src_stride, slice_buffer * sb, 42 int src_stride, slice_buffer * sb,
41 int add, uint8_t * dst8); 43 int add, uint8_t * dst8);
42 44
45 void dsputil_init_altivec(DSPContext* c, AVCodecContext *avctx);
43 void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx); 46 void dsputil_h264_init_ppc(DSPContext* c, AVCodecContext *avctx);
44 void vc1dsp_init_altivec(DSPContext* c, AVCodecContext *avctx); 47 void vc1dsp_init_altivec(DSPContext* c, AVCodecContext *avctx);
45 48
46 #endif 49 #endif
47 50
254 257
255 void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx) 258 void dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx)
256 { 259 {
257 // Common optimizations whether Altivec is available or not 260 // Common optimizations whether Altivec is available or not
258 261
259 switch (check_dcbzl_effect()) { 262 switch (check_dcbzl_effect()) {
260 case 32: 263 case 32:
261 c->clear_blocks = clear_blocks_dcbz32_ppc; 264 c->clear_blocks = clear_blocks_dcbz32_ppc;
262 break; 265 break;
263 case 128: 266 case 128:
264 c->clear_blocks = clear_blocks_dcbz128_ppc; 267 c->clear_blocks = clear_blocks_dcbz128_ppc;
265 break; 268 break;
266 default: 269 default:
267 break; 270 break;
268 } 271 }
269 272
270 #ifdef HAVE_ALTIVEC 273 #ifdef HAVE_ALTIVEC
271 dsputil_h264_init_ppc(c, avctx); 274 dsputil_h264_init_ppc(c, avctx);
272 275
273 if (has_altivec()) { 276 if (has_altivec()) {
274 mm_flags |= MM_ALTIVEC; 277 mm_flags |= MM_ALTIVEC;
275 278
276 // Altivec specific optimisations 279 vc1dsp_init_altivec(c, avctx);
277 c->pix_abs[0][1] = sad16_x2_altivec; 280 dsputil_init_altivec(c, avctx);
278 c->pix_abs[0][2] = sad16_y2_altivec;
279 c->pix_abs[0][3] = sad16_xy2_altivec;
280 c->pix_abs[0][0] = sad16_altivec;
281 c->pix_abs[1][0] = sad8_altivec;
282 c->sad[0]= sad16_altivec;
283 c->sad[1]= sad8_altivec;
284 c->pix_norm1 = pix_norm1_altivec;
285 c->sse[1]= sse8_altivec;
286 c->sse[0]= sse16_altivec;
287 c->pix_sum = pix_sum_altivec;
288 c->diff_pixels = diff_pixels_altivec;
289 c->get_pixels = get_pixels_altivec;
290 // next one disabled as it's untested.
291 #if 0
292 c->add_bytes= add_bytes_altivec;
293 #endif /* 0 */
294 c->put_pixels_tab[0][0] = put_pixels16_altivec;
295 /* the two functions do the same thing, so use the same code */
296 c->put_no_rnd_pixels_tab[0][0] = put_pixels16_altivec;
297 c->avg_pixels_tab[0][0] = avg_pixels16_altivec;
298 c->avg_pixels_tab[1][0] = avg_pixels8_altivec;
299 c->avg_pixels_tab[1][3] = avg_pixels8_xy2_altivec;
300 c->put_pixels_tab[1][3] = put_pixels8_xy2_altivec;
301 c->put_no_rnd_pixels_tab[1][3] = put_no_rnd_pixels8_xy2_altivec;
302 c->put_pixels_tab[0][3] = put_pixels16_xy2_altivec;
303 c->put_no_rnd_pixels_tab[0][3] = put_no_rnd_pixels16_xy2_altivec;
304 281
305 c->gmc1 = gmc1_altivec; 282 c->gmc1 = gmc1_altivec;
306
307 c->hadamard8_diff[0] = hadamard8_diff16_altivec;
308 c->hadamard8_diff[1] = hadamard8_diff8x8_altivec;
309 283
310 c->horizontal_compose97i = ff_snow_horizontal_compose97i_altivec; 284 c->horizontal_compose97i = ff_snow_horizontal_compose97i_altivec;
311 c->vertical_compose97i = ff_snow_vertical_compose97i_altivec; 285 c->vertical_compose97i = ff_snow_vertical_compose97i_altivec;
312 c->inner_add_yblock = ff_snow_inner_add_yblock_altivec; 286 c->inner_add_yblock = ff_snow_inner_add_yblock_altivec;
313 287
314 vc1dsp_init_altivec(c, avctx);
315 #ifdef CONFIG_ENCODERS 288 #ifdef CONFIG_ENCODERS
316 if (avctx->dct_algo == FF_DCT_AUTO || 289 if (avctx->dct_algo == FF_DCT_AUTO ||
317 avctx->dct_algo == FF_DCT_ALTIVEC) 290 avctx->dct_algo == FF_DCT_ALTIVEC)
318 { 291 {
319 c->fdct = fdct_altivec; 292 c->fdct = fdct_altivec;
320 } 293 }
321 #endif //CONFIG_ENCODERS 294 #endif //CONFIG_ENCODERS
322 295
323 if (avctx->lowres==0) 296 if (avctx->lowres==0)
324 { 297 {
325 if ((avctx->idct_algo == FF_IDCT_AUTO) || 298 if ((avctx->idct_algo == FF_IDCT_AUTO) ||
326 (avctx->idct_algo == FF_IDCT_ALTIVEC)) 299 (avctx->idct_algo == FF_IDCT_ALTIVEC))
327 { 300 {
328 c->idct_put = idct_put_altivec; 301 c->idct_put = idct_put_altivec;
329 c->idct_add = idct_add_altivec; 302 c->idct_add = idct_add_altivec;
330 #ifndef ALTIVEC_USE_REFERENCE_C_CODE 303 #ifndef ALTIVEC_USE_REFERENCE_C_CODE
331 c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; 304 c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
332 #else /* ALTIVEC_USE_REFERENCE_C_CODE */ 305 #else /* ALTIVEC_USE_REFERENCE_C_CODE */
333 c->idct_permutation_type = FF_NO_IDCT_PERM; 306 c->idct_permutation_type = FF_NO_IDCT_PERM;
334 #endif /* ALTIVEC_USE_REFERENCE_C_CODE */ 307 #endif /* ALTIVEC_USE_REFERENCE_C_CODE */
335 } 308 }
336 } 309 }
337 310
338 #ifdef POWERPC_PERFORMANCE_REPORT 311 #ifdef POWERPC_PERFORMANCE_REPORT
339 { 312 {
340 int i, j; 313 int i, j;
341 for (i = 0 ; i < powerpc_perf_total ; i++) 314 for (i = 0 ; i < powerpc_perf_total ; i++)