Mercurial > libavcodec.hg
comparison ppc/mpegvideo_ppc.c @ 828:ace3ccd18dd2 libavcodec
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
author | michaelni |
---|---|
date | Sat, 02 Nov 2002 11:28:08 +0000 |
parents | |
children | 5c4cefa5d068 |
comparison
equal
deleted
inserted
replaced
827:770578c6c300 | 828:ace3ccd18dd2 |
---|---|
1 /* | |
2 * Copyright (c) 2002 Dieter Shirley | |
3 * | |
4 * This library is free software; you can redistribute it and/or | |
5 * modify it under the terms of the GNU Lesser General Public | |
6 * License as published by the Free Software Foundation; either | |
7 * version 2 of the License, or (at your option) any later version. | |
8 * | |
9 * This library is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 * Lesser General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU Lesser General Public | |
15 * License along with this library; if not, write to the Free Software | |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 */ | |
18 | |
19 #include <time.h> | |
20 #include "../../config.h" | |
21 #include "../dsputil.h" | |
22 #include "../mpegvideo.h" | |
23 | |
24 #ifdef HAVE_ALTIVEC | |
25 #include "dsputil_altivec.h" | |
26 #endif | |
27 | |
28 extern int dct_quantize_altivec(MpegEncContext *s, | |
29 DCTELEM *block, int n, | |
30 int qscale, int *overflow); | |
31 | |
32 extern void idct_put_altivec(UINT8 *dest, int line_size, INT16 *block); | |
33 extern void idct_add_altivec(UINT8 *dest, int line_size, INT16 *block); | |
34 | |
35 | |
36 void MPV_common_init_ppc(MpegEncContext *s) | |
37 { | |
38 #if HAVE_ALTIVEC | |
39 if (has_altivec()) | |
40 { | |
41 if ((s->avctx->idct_algo == FF_IDCT_AUTO) || | |
42 (s->avctx->idct_algo == FF_IDCT_ALTIVEC)) | |
43 { | |
44 s->idct_put = idct_put_altivec; | |
45 s->idct_add = idct_add_altivec; | |
46 s->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; | |
47 } | |
48 | |
49 // Test to make sure that the dct required alignments are met. | |
50 if ((((long)(s->q_intra_matrix) & 0x0f) != 0) || | |
51 (((long)(s->q_inter_matrix) & 0x0f) != 0)) | |
52 { | |
53 fprintf(stderr, "Internal Error: q-matrix blocks must be 16-byte aligned " | |
54 "to use Altivec DCT. Reverting to non-altivec version.\n"); | |
55 return; | |
56 } | |
57 | |
58 if (((long)(s->intra_scantable.inverse) & 0x0f) != 0) | |
59 { | |
60 fprintf(stderr, "Internal Error: scan table blocks must be 16-byte aligned " | |
61 "to use Altivec DCT. Reverting to non-altivec version.\n"); | |
62 return; | |
63 } | |
64 | |
65 | |
66 if ((s->avctx->dct_algo == FF_DCT_AUTO) || | |
67 (s->avctx->dct_algo == FF_DCT_ALTIVEC)) | |
68 { | |
69 s->dct_quantize = dct_quantize_altivec; | |
70 } | |
71 } else | |
72 #endif | |
73 { | |
74 /* Non-AltiVec PPC optimisations here */ | |
75 } | |
76 } | |
77 |