2 * Float MPEG Audio decoder
3 * Copyright (c) 2010 Michael Niedermayer
5 * This file is part of FFmpeg.
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.
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.
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
22 #define CONFIG_FLOAT 1
23 #include "mpegaudiodec.c"
25 void ff_mpa_synth_filter_float(MPADecodeContext *s, float *synth_buf_ptr,
26 int *synth_buf_offset,
27 float *window, int *dither_state,
28 float *samples, int incr,
29 float sb_samples[SBLIMIT])
34 offset = *synth_buf_offset;
35 synth_buf = synth_buf_ptr + offset;
37 s->dct.dct32(synth_buf, sb_samples);
38 s->apply_window_mp3(synth_buf, window, dither_state, samples, incr);
40 offset = (offset - 32) & 511;
41 *synth_buf_offset = offset;
44 static void compute_antialias_float(MPADecodeContext *s,
50 /* we antialias only "long" bands */
51 if (g->block_type == 2) {
54 /* XXX: check this for 8000Hz case */
60 ptr = g->sb_hybrid + 18;
61 for(i = n;i > 0;i--) {
63 float *csa = &csa_table_float[0][0];
67 ptr[-1-j] = tmp0 * csa[0+4*j] - tmp1 * csa[1+4*j];\
68 ptr[ j] = tmp0 * csa[1+4*j] + tmp1 * csa[0+4*j];
83 static av_cold int decode_end(AVCodecContext * avctx)
85 MPADecodeContext *s = avctx->priv_data;
90 #if CONFIG_MP1FLOAT_DECODER
91 AVCodec ff_mp1float_decoder =
96 sizeof(MPADecodeContext),
101 CODEC_CAP_PARSE_ONLY,
103 .long_name= NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
106 #if CONFIG_MP2FLOAT_DECODER
107 AVCodec ff_mp2float_decoder =
112 sizeof(MPADecodeContext),
117 CODEC_CAP_PARSE_ONLY,
119 .long_name= NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
122 #if CONFIG_MP3FLOAT_DECODER
123 AVCodec ff_mp3float_decoder =
128 sizeof(MPADecodeContext),
133 CODEC_CAP_PARSE_ONLY,
135 .long_name= NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
138 #if CONFIG_MP3ADUFLOAT_DECODER
139 AVCodec ff_mp3adufloat_decoder =
144 sizeof(MPADecodeContext),
149 CODEC_CAP_PARSE_ONLY,
151 .long_name= NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
154 #if CONFIG_MP3ON4FLOAT_DECODER
155 AVCodec ff_mp3on4float_decoder =
160 sizeof(MP3On4DecodeContext),
166 .long_name= NULL_IF_CONFIG_SMALL("MP3onMP4"),