00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "../dsputil.h"
00020 #include "../mpegvideo.h"
00021 #include <time.h>
00022
00023 #ifdef HAVE_ALTIVEC
00024 #include "dsputil_altivec.h"
00025 #endif
00026
00027 extern int dct_quantize_altivec(MpegEncContext *s,
00028 DCTELEM *block, int n,
00029 int qscale, int *overflow);
00030 extern void dct_unquantize_h263_altivec(MpegEncContext *s,
00031 DCTELEM *block, int n, int qscale);
00032
00033 extern void idct_put_altivec(uint8_t *dest, int line_size, int16_t *block);
00034 extern void idct_add_altivec(uint8_t *dest, int line_size, int16_t *block);
00035
00036
00037 void MPV_common_init_ppc(MpegEncContext *s)
00038 {
00039 #ifdef HAVE_ALTIVEC
00040 if (has_altivec())
00041 {
00042 if (s->avctx->lowres==0)
00043 {
00044 if ((s->avctx->idct_algo == FF_IDCT_AUTO) ||
00045 (s->avctx->idct_algo == FF_IDCT_ALTIVEC))
00046 {
00047 s->dsp.idct_put = idct_put_altivec;
00048 s->dsp.idct_add = idct_add_altivec;
00049 #ifndef ALTIVEC_USE_REFERENCE_C_CODE
00050 s->dsp.idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
00051 #else
00052 s->dsp.idct_permutation_type = FF_NO_IDCT_PERM;
00053 #endif
00054 }
00055 }
00056
00057
00058 if ((((long)(s->q_intra_matrix) & 0x0f) != 0) ||
00059 (((long)(s->q_inter_matrix) & 0x0f) != 0))
00060 {
00061 av_log(s->avctx, AV_LOG_INFO, "Internal Error: q-matrix blocks must be 16-byte aligned "
00062 "to use Altivec DCT. Reverting to non-altivec version.\n");
00063 return;
00064 }
00065
00066 if (((long)(s->intra_scantable.inverse) & 0x0f) != 0)
00067 {
00068 av_log(s->avctx, AV_LOG_INFO, "Internal Error: scan table blocks must be 16-byte aligned "
00069 "to use Altivec DCT. Reverting to non-altivec version.\n");
00070 return;
00071 }
00072
00073
00074 if ((s->avctx->dct_algo == FF_DCT_AUTO) ||
00075 (s->avctx->dct_algo == FF_DCT_ALTIVEC))
00076 {
00077 #if 0
00078 s->dct_quantize = dct_quantize_altivec;
00079 #endif
00080 s->dct_unquantize_h263_intra = dct_unquantize_h263_altivec;
00081 s->dct_unquantize_h263_inter = dct_unquantize_h263_altivec;
00082 }
00083 } else
00084 #endif
00085 {
00086
00087 }
00088 }
00089