comparison ppc/mpegvideo_altivec.c @ 5751:3260fa3c89eb libavcodec

Merge mpegvideo AltiVec code into mpegvideo_altivec.c where it belongs.
author diego
date Tue, 02 Oct 2007 12:16:33 +0000
parents 09f99af1db40
children 72b59f7613af
comparison
equal deleted inserted replaced
5750:09f99af1db40 5751:3260fa3c89eb
599 block[0] = backup_0; 599 block[0] = backup_0;
600 } 600 }
601 } 601 }
602 POWERPC_PERF_STOP_COUNT(altivec_dct_unquantize_h263_num, nCoeffs == 63); 602 POWERPC_PERF_STOP_COUNT(altivec_dct_unquantize_h263_num, nCoeffs == 63);
603 } 603 }
604
605
606 extern void idct_put_altivec(uint8_t *dest, int line_size, int16_t *block);
607 extern void idct_add_altivec(uint8_t *dest, int line_size, int16_t *block);
608
609 void MPV_common_init_ppc(MpegEncContext *s)
610 {
611 if (s->avctx->lowres==0)
612 {
613 if ((s->avctx->idct_algo == FF_IDCT_AUTO) ||
614 (s->avctx->idct_algo == FF_IDCT_ALTIVEC))
615 {
616 s->dsp.idct_put = idct_put_altivec;
617 s->dsp.idct_add = idct_add_altivec;
618 s->dsp.idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
619 }
620 }
621
622 // Test to make sure that the dct required alignments are met.
623 if ((((long)(s->q_intra_matrix) & 0x0f) != 0) ||
624 (((long)(s->q_inter_matrix) & 0x0f) != 0))
625 {
626 av_log(s->avctx, AV_LOG_INFO, "Internal Error: q-matrix blocks must be 16-byte aligned "
627 "to use AltiVec DCT. Reverting to non-AltiVec version.\n");
628 return;
629 }
630
631 if (((long)(s->intra_scantable.inverse) & 0x0f) != 0)
632 {
633 av_log(s->avctx, AV_LOG_INFO, "Internal Error: scan table blocks must be 16-byte aligned "
634 "to use AltiVec DCT. Reverting to non-AltiVec version.\n");
635 return;
636 }
637
638
639 if ((s->avctx->dct_algo == FF_DCT_AUTO) ||
640 (s->avctx->dct_algo == FF_DCT_ALTIVEC))
641 {
642 #if 0 /* seems to cause trouble under some circumstances */
643 s->dct_quantize = dct_quantize_altivec;
644 #endif
645 s->dct_unquantize_h263_intra = dct_unquantize_h263_altivec;
646 s->dct_unquantize_h263_inter = dct_unquantize_h263_altivec;
647 }
648 }