OLD | NEW |
1 /* | 1 /* |
2 * WMA compatible codec | 2 * WMA compatible codec |
3 * Copyright (c) 2002-2007 The FFmpeg Project | 3 * Copyright (c) 2002-2007 The FFmpeg Project |
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. |
11 * | 11 * |
12 * FFmpeg is distributed in the hope that it will be useful, | 12 * FFmpeg is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Lesser General Public License for more details. | 15 * Lesser General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Lesser General Public | 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 | 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 | 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
20 */ | 20 */ |
21 | 21 |
22 #ifndef AVCODEC_WMA_H | 22 #ifndef AVCODEC_WMA_H |
23 #define AVCODEC_WMA_H | 23 #define AVCODEC_WMA_H |
24 | 24 |
25 #include "get_bits.h" | 25 #include "get_bits.h" |
26 #include "put_bits.h" | 26 #include "put_bits.h" |
27 #include "dsputil.h" | 27 #include "dsputil.h" |
| 28 #include "fft.h" |
28 | 29 |
29 /* size of blocks */ | 30 /* size of blocks */ |
30 #define BLOCK_MIN_BITS 7 | 31 #define BLOCK_MIN_BITS 7 |
31 #define BLOCK_MAX_BITS 11 | 32 #define BLOCK_MAX_BITS 11 |
32 #define BLOCK_MAX_SIZE (1 << BLOCK_MAX_BITS) | 33 #define BLOCK_MAX_SIZE (1 << BLOCK_MAX_BITS) |
33 | 34 |
34 #define BLOCK_NB_SIZES (BLOCK_MAX_BITS - BLOCK_MIN_BITS + 1) | 35 #define BLOCK_NB_SIZES (BLOCK_MAX_BITS - BLOCK_MIN_BITS + 1) |
35 | 36 |
36 /* XXX: find exact max size */ | 37 /* XXX: find exact max size */ |
37 #define HIGH_BAND_MAX_SIZE 16 | 38 #define HIGH_BAND_MAX_SIZE 16 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 int reset_block_lengths; | 105 int reset_block_lengths; |
105 int block_len_bits; ///< log2 of current block length | 106 int block_len_bits; ///< log2 of current block length |
106 int next_block_len_bits; ///< log2 of next block length | 107 int next_block_len_bits; ///< log2 of next block length |
107 int prev_block_len_bits; ///< log2 of prev block length | 108 int prev_block_len_bits; ///< log2 of prev block length |
108 int block_len; ///< block length in samples | 109 int block_len; ///< block length in samples |
109 int block_num; ///< block number in current frame | 110 int block_num; ///< block number in current frame |
110 int block_pos; ///< current position in frame | 111 int block_pos; ///< current position in frame |
111 uint8_t ms_stereo; ///< true if mid/side stereo mode | 112 uint8_t ms_stereo; ///< true if mid/side stereo mode |
112 uint8_t channel_coded[MAX_CHANNELS]; ///< true if channel is coded | 113 uint8_t channel_coded[MAX_CHANNELS]; ///< true if channel is coded |
113 int exponents_bsize[MAX_CHANNELS]; ///< log2 ratio frame/exp. length | 114 int exponents_bsize[MAX_CHANNELS]; ///< log2 ratio frame/exp. length |
114 DECLARE_ALIGNED_16(float, exponents)[MAX_CHANNELS][BLOCK_MAX_SIZE]; | 115 DECLARE_ALIGNED(16, float, exponents)[MAX_CHANNELS][BLOCK_MAX_SIZE]; |
115 float max_exponent[MAX_CHANNELS]; | 116 float max_exponent[MAX_CHANNELS]; |
116 WMACoef coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE]; | 117 WMACoef coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE]; |
117 DECLARE_ALIGNED_16(float, coefs)[MAX_CHANNELS][BLOCK_MAX_SIZE]; | 118 DECLARE_ALIGNED(16, float, coefs)[MAX_CHANNELS][BLOCK_MAX_SIZE]; |
118 DECLARE_ALIGNED_16(FFTSample, output)[BLOCK_MAX_SIZE * 2]; | 119 DECLARE_ALIGNED(16, FFTSample, output)[BLOCK_MAX_SIZE * 2]; |
119 FFTContext mdct_ctx[BLOCK_NB_SIZES]; | 120 FFTContext mdct_ctx[BLOCK_NB_SIZES]; |
120 float *windows[BLOCK_NB_SIZES]; | 121 float *windows[BLOCK_NB_SIZES]; |
121 /* output buffer for one frame and the last for IMDCT windowing */ | 122 /* output buffer for one frame and the last for IMDCT windowing */ |
122 DECLARE_ALIGNED_16(float, frame_out)[MAX_CHANNELS][BLOCK_MAX_SIZE * 2]; | 123 DECLARE_ALIGNED(16, float, frame_out)[MAX_CHANNELS][BLOCK_MAX_SIZE * 2]; |
123 /* last frame info */ | 124 /* last frame info */ |
124 uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + 4]; /* padding added */ | 125 uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + 4]; /* padding added */ |
125 int last_bitoffset; | 126 int last_bitoffset; |
126 int last_superframe_len; | 127 int last_superframe_len; |
127 float noise_table[NOISE_TAB_SIZE]; | 128 float noise_table[NOISE_TAB_SIZE]; |
128 int noise_index; | 129 int noise_index; |
129 float noise_mult; /* XXX: suppress that and integrate it in the noise array
*/ | 130 float noise_mult; /* XXX: suppress that and integrate it in the noise array
*/ |
130 /* lsp_to_curve tables */ | 131 /* lsp_to_curve tables */ |
131 float lsp_cos_table[BLOCK_MAX_SIZE]; | 132 float lsp_cos_table[BLOCK_MAX_SIZE]; |
132 float lsp_pow_e_table[256]; | 133 float lsp_pow_e_table[256]; |
133 float lsp_pow_m_table1[(1 << LSP_POW_BITS)]; | 134 float lsp_pow_m_table1[(1 << LSP_POW_BITS)]; |
134 float lsp_pow_m_table2[(1 << LSP_POW_BITS)]; | 135 float lsp_pow_m_table2[(1 << LSP_POW_BITS)]; |
135 DSPContext dsp; | 136 DSPContext dsp; |
136 | 137 |
137 #ifdef TRACE | 138 #ifdef TRACE |
138 int frame_count; | 139 int frame_count; |
139 #endif | 140 #endif |
140 } WMACodecContext; | 141 } WMACodecContext; |
141 | 142 |
142 extern const uint16_t ff_wma_critical_freqs[25]; | 143 extern const uint16_t ff_wma_critical_freqs[25]; |
143 extern const uint16_t ff_wma_hgain_huffcodes[37]; | 144 extern const uint16_t ff_wma_hgain_huffcodes[37]; |
144 extern const uint8_t ff_wma_hgain_huffbits[37]; | 145 extern const uint8_t ff_wma_hgain_huffbits[37]; |
145 extern const float ff_wma_lsp_codebook[NB_LSP_COEFS][16]; | 146 extern const float ff_wma_lsp_codebook[NB_LSP_COEFS][16]; |
146 extern const uint32_t ff_wma_scale_huffcodes[121]; | 147 extern const uint32_t ff_aac_scalefactor_code[121]; |
147 extern const uint8_t ff_wma_scale_huffbits[121]; | 148 extern const uint8_t ff_aac_scalefactor_bits[121]; |
148 | 149 |
149 int av_cold ff_wma_get_frame_len_bits(int sample_rate, int version, | 150 int av_cold ff_wma_get_frame_len_bits(int sample_rate, int version, |
150 unsigned int decode_flags); | 151 unsigned int decode_flags); |
151 int ff_wma_init(AVCodecContext * avctx, int flags2); | 152 int ff_wma_init(AVCodecContext * avctx, int flags2); |
152 int ff_wma_total_gain_to_bits(int total_gain); | 153 int ff_wma_total_gain_to_bits(int total_gain); |
153 int ff_wma_end(AVCodecContext *avctx); | 154 int ff_wma_end(AVCodecContext *avctx); |
154 unsigned int ff_wma_get_large_val(GetBitContext* gb); | 155 unsigned int ff_wma_get_large_val(GetBitContext* gb); |
155 int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb, | 156 int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb, |
156 VLC *vlc, | 157 VLC *vlc, |
157 const float *level_table, const uint16_t *run_table, | 158 const float *level_table, const uint16_t *run_table, |
158 int version, WMACoef *ptr, int offset, | 159 int version, WMACoef *ptr, int offset, |
159 int num_coefs, int block_len, int frame_len_bits, | 160 int num_coefs, int block_len, int frame_len_bits, |
160 int coef_nb_bits); | 161 int coef_nb_bits); |
161 | 162 |
162 #endif /* AVCODEC_WMA_H */ | 163 #endif /* AVCODEC_WMA_H */ |
OLD | NEW |