OLD | NEW |
1 /* | 1 /* |
2 * MPEG Audio decoder | 2 * MPEG Audio decoder |
3 * Copyright (c) 2001, 2002 Fabrice Bellard | 3 * Copyright (c) 2001, 2002 Fabrice Bellard |
4 * | 4 * |
5 * This file is part of FFmpeg. | 5 * This file is part of FFmpeg. |
6 * | 6 * |
7 * FFmpeg is free software; you can redistribute it and/or | 7 * FFmpeg is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2.1 of the License, or (at your option) any later version. | 10 * version 2.1 of the License, or (at your option) any later version. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 #define SCALE_GEN(v) \ | 89 #define SCALE_GEN(v) \ |
90 { FIXR(1.0 * (v)), FIXR(0.7937005259 * (v)), FIXR(0.6299605249 * (v)) } | 90 { FIXR(1.0 * (v)), FIXR(0.7937005259 * (v)), FIXR(0.6299605249 * (v)) } |
91 | 91 |
92 static const int32_t scale_factor_mult2[3][3] = { | 92 static const int32_t scale_factor_mult2[3][3] = { |
93 SCALE_GEN(4.0 / 3.0), /* 3 steps */ | 93 SCALE_GEN(4.0 / 3.0), /* 3 steps */ |
94 SCALE_GEN(4.0 / 5.0), /* 5 steps */ | 94 SCALE_GEN(4.0 / 5.0), /* 5 steps */ |
95 SCALE_GEN(4.0 / 9.0), /* 9 steps */ | 95 SCALE_GEN(4.0 / 9.0), /* 9 steps */ |
96 }; | 96 }; |
97 | 97 |
98 DECLARE_ALIGNED_16(MPA_INT, ff_mpa_synth_window)[512]; | 98 DECLARE_ALIGNED(16, MPA_INT, ff_mpa_synth_window)[512]; |
99 | 99 |
100 /** | 100 /** |
101 * Convert region offsets to region sizes and truncate | 101 * Convert region offsets to region sizes and truncate |
102 * size to big_values. | 102 * size to big_values. |
103 */ | 103 */ |
104 void ff_region_offset2size(GranuleDef *g){ | 104 static void ff_region_offset2size(GranuleDef *g){ |
105 int i, k, j=0; | 105 int i, k, j=0; |
106 g->region_size[2] = (576 / 2); | 106 g->region_size[2] = (576 / 2); |
107 for(i=0;i<3;i++) { | 107 for(i=0;i<3;i++) { |
108 k = FFMIN(g->region_size[i], g->big_values); | 108 k = FFMIN(g->region_size[i], g->big_values); |
109 g->region_size[i] = k - j; | 109 g->region_size[i] = k - j; |
110 j = k; | 110 j = k; |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 void ff_init_short_region(MPADecodeContext *s, GranuleDef *g){ | 114 static void ff_init_short_region(MPADecodeContext *s, GranuleDef *g){ |
115 if (g->block_type == 2) | 115 if (g->block_type == 2) |
116 g->region_size[0] = (36 / 2); | 116 g->region_size[0] = (36 / 2); |
117 else { | 117 else { |
118 if (s->sample_rate_index <= 2) | 118 if (s->sample_rate_index <= 2) |
119 g->region_size[0] = (36 / 2); | 119 g->region_size[0] = (36 / 2); |
120 else if (s->sample_rate_index != 8) | 120 else if (s->sample_rate_index != 8) |
121 g->region_size[0] = (54 / 2); | 121 g->region_size[0] = (54 / 2); |
122 else | 122 else |
123 g->region_size[0] = (108 / 2); | 123 g->region_size[0] = (108 / 2); |
124 } | 124 } |
125 g->region_size[1] = (576 / 2); | 125 g->region_size[1] = (576 / 2); |
126 } | 126 } |
127 | 127 |
128 void ff_init_long_region(MPADecodeContext *s, GranuleDef *g, int ra1, int ra2){ | 128 static void ff_init_long_region(MPADecodeContext *s, GranuleDef *g, int ra1, int
ra2){ |
129 int l; | 129 int l; |
130 g->region_size[0] = | 130 g->region_size[0] = |
131 band_index_long[s->sample_rate_index][ra1 + 1] >> 1; | 131 band_index_long[s->sample_rate_index][ra1 + 1] >> 1; |
132 /* should not overflow */ | 132 /* should not overflow */ |
133 l = FFMIN(ra1 + ra2 + 2, 22); | 133 l = FFMIN(ra1 + ra2 + 2, 22); |
134 g->region_size[1] = | 134 g->region_size[1] = |
135 band_index_long[s->sample_rate_index][l] >> 1; | 135 band_index_long[s->sample_rate_index][l] >> 1; |
136 } | 136 } |
137 | 137 |
138 void ff_compute_band_indexes(MPADecodeContext *s, GranuleDef *g){ | 138 static void ff_compute_band_indexes(MPADecodeContext *s, GranuleDef *g){ |
139 if (g->block_type == 2) { | 139 if (g->block_type == 2) { |
140 if (g->switch_point) { | 140 if (g->switch_point) { |
141 /* if switched mode, we handle the 36 first samples as | 141 /* if switched mode, we handle the 36 first samples as |
142 long blocks. For 8000Hz, we handle the 48 first | 142 long blocks. For 8000Hz, we handle the 48 first |
143 exponents as long blocks (XXX: check this!) */ | 143 exponents as long blocks (XXX: check this!) */ |
144 if (s->sample_rate_index <= 2) | 144 if (s->sample_rate_index <= 2) |
145 g->long_end = 8; | 145 g->long_end = 8; |
146 else if (s->sample_rate_index != 8) | 146 else if (s->sample_rate_index != 8) |
147 g->long_end = 6; | 147 g->long_end = 6; |
148 else | 148 else |
(...skipping 2404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2553 CODEC_ID_MP3ON4, | 2553 CODEC_ID_MP3ON4, |
2554 sizeof(MP3On4DecodeContext), | 2554 sizeof(MP3On4DecodeContext), |
2555 decode_init_mp3on4, | 2555 decode_init_mp3on4, |
2556 NULL, | 2556 NULL, |
2557 decode_close_mp3on4, | 2557 decode_close_mp3on4, |
2558 decode_frame_mp3on4, | 2558 decode_frame_mp3on4, |
2559 .flush= flush, | 2559 .flush= flush, |
2560 .long_name= NULL_IF_CONFIG_SMALL("MP3onMP4"), | 2560 .long_name= NULL_IF_CONFIG_SMALL("MP3onMP4"), |
2561 }; | 2561 }; |
2562 #endif | 2562 #endif |
OLD | NEW |