Mercurial > libavcodec.hg
annotate ppc/mpegvideo_ppc.c @ 5373:69eac3e47b9a libavcodec
remove portions of bit allocation which are no longer needed since they are shared with the encoder
author | jbr |
---|---|
date | Thu, 19 Jul 2007 00:50:31 +0000 |
parents | d5ba514e3f4a |
children | ed8e08db68c6 |
rev | line source |
---|---|
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
1 /* |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
2 * Copyright (c) 2002 Dieter Shirley |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
3 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
4 * This file is part of FFmpeg. |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
5 * |
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
6 * FFmpeg is free software; you can redistribute it and/or |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
7 * modify it under the terms of the GNU Lesser General Public |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
8 * License as published by the Free Software Foundation; either |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
9 * version 2.1 of the License, or (at your option) any later version. |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
10 * |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
11 * FFmpeg is distributed in the hope that it will be useful, |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
14 * Lesser General Public License for more details. |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
15 * |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
16 * You should have received a copy of the GNU Lesser General Public |
3947
c8c591fe26f8
Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents:
3036
diff
changeset
|
17 * License along with FFmpeg; if not, write to the Free Software |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2967
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
19 */ |
2967 | 20 |
5010
d5ba514e3f4a
Add libavcodec to compiler include flags in order to simplify header
diego
parents:
3973
diff
changeset
|
21 #include "dsputil.h" |
d5ba514e3f4a
Add libavcodec to compiler include flags in order to simplify header
diego
parents:
3973
diff
changeset
|
22 #include "mpegvideo.h" |
974 | 23 #include <time.h> |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
24 |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
25 #ifdef HAVE_ALTIVEC |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
26 #include "dsputil_altivec.h" |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
27 #endif |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
28 |
2967 | 29 extern int dct_quantize_altivec(MpegEncContext *s, |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
30 DCTELEM *block, int n, |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
31 int qscale, int *overflow); |
1001
95cbffdc98a9
dct_unquantize_h263_altivec by (Romain Dolbeau <dolbeaur at club-internet dot fr>)
michaelni
parents:
974
diff
changeset
|
32 extern void dct_unquantize_h263_altivec(MpegEncContext *s, |
95cbffdc98a9
dct_unquantize_h263_altivec by (Romain Dolbeau <dolbeaur at club-internet dot fr>)
michaelni
parents:
974
diff
changeset
|
33 DCTELEM *block, int n, int qscale); |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
34 |
1064 | 35 extern void idct_put_altivec(uint8_t *dest, int line_size, int16_t *block); |
36 extern void idct_add_altivec(uint8_t *dest, int line_size, int16_t *block); | |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
37 |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
38 |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
39 void MPV_common_init_ppc(MpegEncContext *s) |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
40 { |
1511
587258262aa5
recommit (of patch, as cvslog msg didnt apply cleanly)
michael
parents:
1107
diff
changeset
|
41 #ifdef HAVE_ALTIVEC |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
42 if (has_altivec()) |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
43 { |
2778
4c0ab7ed2642
Disable AltiVec IDCT for lowres decoding in lavc patch by (Sigbjrn Skjret: cisc, broadpark no)
michael
parents:
1942
diff
changeset
|
44 if (s->avctx->lowres==0) |
4c0ab7ed2642
Disable AltiVec IDCT for lowres decoding in lavc patch by (Sigbjrn Skjret: cisc, broadpark no)
michael
parents:
1942
diff
changeset
|
45 { |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
46 if ((s->avctx->idct_algo == FF_IDCT_AUTO) || |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
47 (s->avctx->idct_algo == FF_IDCT_ALTIVEC)) |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
48 { |
1107
28f0e53706a7
altivec compilation fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1064
diff
changeset
|
49 s->dsp.idct_put = idct_put_altivec; |
28f0e53706a7
altivec compilation fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1064
diff
changeset
|
50 s->dsp.idct_add = idct_add_altivec; |
28f0e53706a7
altivec compilation fixes by (Magnus Damm <damm at opensource dot se>)
michaelni
parents:
1064
diff
changeset
|
51 s->dsp.idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
52 } |
2778
4c0ab7ed2642
Disable AltiVec IDCT for lowres decoding in lavc patch by (Sigbjrn Skjret: cisc, broadpark no)
michael
parents:
1942
diff
changeset
|
53 } |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
54 |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
55 // Test to make sure that the dct required alignments are met. |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
56 if ((((long)(s->q_intra_matrix) & 0x0f) != 0) || |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
57 (((long)(s->q_inter_matrix) & 0x0f) != 0)) |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
58 { |
1828
bc8f5e1635b9
av_log() patch by ("Steven M. Schultz" <sms at 2BSD dot COM>)
michael
parents:
1693
diff
changeset
|
59 av_log(s->avctx, AV_LOG_INFO, "Internal Error: q-matrix blocks must be 16-byte aligned " |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
60 "to use Altivec DCT. Reverting to non-altivec version.\n"); |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
61 return; |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
62 } |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
63 |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
64 if (((long)(s->intra_scantable.inverse) & 0x0f) != 0) |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
65 { |
1828
bc8f5e1635b9
av_log() patch by ("Steven M. Schultz" <sms at 2BSD dot COM>)
michael
parents:
1693
diff
changeset
|
66 av_log(s->avctx, AV_LOG_INFO, "Internal Error: scan table blocks must be 16-byte aligned " |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
67 "to use Altivec DCT. Reverting to non-altivec version.\n"); |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
68 return; |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
69 } |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
70 |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
71 |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
72 if ((s->avctx->dct_algo == FF_DCT_AUTO) || |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
73 (s->avctx->dct_algo == FF_DCT_ALTIVEC)) |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
74 { |
1942
9241d99f7443
forgotten copyright & dct_quantize_altivec disabled patch by (Romain Dolbeau <dolbeau at irisa dot fr>)
michael
parents:
1828
diff
changeset
|
75 #if 0 /* seems to cause trouble under some circumstances */ |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
76 s->dct_quantize = dct_quantize_altivec; |
1942
9241d99f7443
forgotten copyright & dct_quantize_altivec disabled patch by (Romain Dolbeau <dolbeau at irisa dot fr>)
michael
parents:
1828
diff
changeset
|
77 #endif |
1693 | 78 s->dct_unquantize_h263_intra = dct_unquantize_h263_altivec; |
79 s->dct_unquantize_h263_inter = dct_unquantize_h263_altivec; | |
828
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
80 } |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
81 } else |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
82 #endif |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
83 { |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
84 /* Non-AltiVec PPC optimisations here */ |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
85 } |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
86 } |
ace3ccd18dd2
Altivec Patch (Mark III) by (Dieter Shirley <dieters at schemasoft dot com>)
michaelni
parents:
diff
changeset
|
87 |