Mercurial > libavcodec.hg
annotate mpegaudiodec_float.c @ 12043:f9a0bd0888a4 libavcodec
mpegaudio: call ff_mpegaudiodec_init_mmx() only from float decoder
The mmx code is floating-point only, and this function does not know
from which decoder it is called. Without this change, the integer
decoder only "works" because the size of the context struct is smaller
in this case, and the mmx init function writes the function pointer
outside the allocated context.
author | mru |
---|---|
date | Thu, 01 Jul 2010 23:21:17 +0000 |
parents | 3f3d08bb5cf8 |
children | 49c528a39187 |
rev | line source |
---|---|
11707 | 1 /* |
2 * Float MPEG Audio decoder | |
3 * Copyright (c) 2010 Michael Niedermayer | |
4 * | |
5 * This file is part of FFmpeg. | |
6 * | |
7 * FFmpeg is free software; you can redistribute it and/or | |
8 * modify it under the terms of the GNU Lesser General Public | |
9 * License as published by the Free Software Foundation; either | |
10 * version 2.1 of the License, or (at your option) any later version. | |
11 * | |
12 * FFmpeg is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * Lesser General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU Lesser General Public | |
18 * License along with FFmpeg; if not, write to the Free Software | |
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
20 */ | |
21 | |
22 #define CONFIG_FLOAT 1 | |
23 #include "mpegaudiodec.c" | |
24 | |
11935
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
25 void ff_mpa_synth_filter_float(MPADecodeContext *s, float *synth_buf_ptr, |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
26 int *synth_buf_offset, |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
27 float *window, int *dither_state, |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
28 float *samples, int incr, |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
29 float sb_samples[SBLIMIT]) |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
30 { |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
31 float *synth_buf; |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
32 int offset; |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
33 |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
34 offset = *synth_buf_offset; |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
35 synth_buf = synth_buf_ptr + offset; |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
36 |
12026
3f3d08bb5cf8
More mp{1,2,3} 32-point DCT transform to our common DCT framework.
vitor
parents:
11935
diff
changeset
|
37 s->dct.dct32(synth_buf, sb_samples); |
11935
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
38 s->apply_window_mp3(synth_buf, window, dither_state, samples, incr); |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
39 |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
40 offset = (offset - 32) & 511; |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
41 *synth_buf_offset = offset; |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
42 } |
5e8770f9d8f1
Move float-specific function to mpegaudiodec_float.c
vitor
parents:
11707
diff
changeset
|
43 |
11707 | 44 #if CONFIG_MP1FLOAT_DECODER |
45 AVCodec mp1float_decoder = | |
46 { | |
47 "mp1float", | |
48 AVMEDIA_TYPE_AUDIO, | |
49 CODEC_ID_MP1, | |
50 sizeof(MPADecodeContext), | |
51 decode_init, | |
52 NULL, | |
53 NULL, | |
54 decode_frame, | |
55 CODEC_CAP_PARSE_ONLY, | |
56 .flush= flush, | |
57 .long_name= NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"), | |
58 }; | |
59 #endif | |
60 #if CONFIG_MP2FLOAT_DECODER | |
61 AVCodec mp2float_decoder = | |
62 { | |
63 "mp2float", | |
64 AVMEDIA_TYPE_AUDIO, | |
65 CODEC_ID_MP2, | |
66 sizeof(MPADecodeContext), | |
67 decode_init, | |
68 NULL, | |
69 NULL, | |
70 decode_frame, | |
71 CODEC_CAP_PARSE_ONLY, | |
72 .flush= flush, | |
73 .long_name= NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), | |
74 }; | |
75 #endif | |
76 #if CONFIG_MP3FLOAT_DECODER | |
77 AVCodec mp3float_decoder = | |
78 { | |
79 "mp3float", | |
80 AVMEDIA_TYPE_AUDIO, | |
81 CODEC_ID_MP3, | |
82 sizeof(MPADecodeContext), | |
83 decode_init, | |
84 NULL, | |
85 NULL, | |
86 decode_frame, | |
87 CODEC_CAP_PARSE_ONLY, | |
88 .flush= flush, | |
89 .long_name= NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"), | |
90 }; | |
91 #endif | |
92 #if CONFIG_MP3ADUFLOAT_DECODER | |
93 AVCodec mp3adufloat_decoder = | |
94 { | |
95 "mp3adufloat", | |
96 AVMEDIA_TYPE_AUDIO, | |
97 CODEC_ID_MP3ADU, | |
98 sizeof(MPADecodeContext), | |
99 decode_init, | |
100 NULL, | |
101 NULL, | |
102 decode_frame_adu, | |
103 CODEC_CAP_PARSE_ONLY, | |
104 .flush= flush, | |
105 .long_name= NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"), | |
106 }; | |
107 #endif | |
108 #if CONFIG_MP3ON4FLOAT_DECODER | |
109 AVCodec mp3on4float_decoder = | |
110 { | |
111 "mp3on4float", | |
112 AVMEDIA_TYPE_AUDIO, | |
113 CODEC_ID_MP3ON4, | |
114 sizeof(MP3On4DecodeContext), | |
115 decode_init_mp3on4, | |
116 NULL, | |
117 decode_close_mp3on4, | |
118 decode_frame_mp3on4, | |
119 .flush= flush, | |
120 .long_name= NULL_IF_CONFIG_SMALL("MP3onMP4"), | |
121 }; | |
122 #endif |