| OLD | NEW |
| 1 /* | 1 /* |
| 2 * copyright (c) 2001 Fabrice Bellard | 2 * copyright (c) 2001 Fabrice Bellard |
| 3 * | 3 * |
| 4 * This file is part of FFmpeg. | 4 * This file is part of FFmpeg. |
| 5 * | 5 * |
| 6 * FFmpeg is free software; you can redistribute it and/or | 6 * FFmpeg is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2.1 of the License, or (at your option) any later version. | 9 * version 2.1 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 DECLARE_ALIGNED(16, INTFLOAT, sb_samples)[MPA_MAX_CHANNELS][36][SBLIMIT]; | 149 DECLARE_ALIGNED(16, INTFLOAT, sb_samples)[MPA_MAX_CHANNELS][36][SBLIMIT]; |
| 150 INTFLOAT mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for
layer 3 MDCT */ | 150 INTFLOAT mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for
layer 3 MDCT */ |
| 151 GranuleDef granules[2][2]; /* Used in Layer 3 */ | 151 GranuleDef granules[2][2]; /* Used in Layer 3 */ |
| 152 #ifdef DEBUG | 152 #ifdef DEBUG |
| 153 int frame_count; | 153 int frame_count; |
| 154 #endif | 154 #endif |
| 155 int adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3 | 155 int adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3 |
| 156 int dither_state; | 156 int dither_state; |
| 157 int error_recognition; | 157 int error_recognition; |
| 158 AVCodecContext* avctx; | 158 AVCodecContext* avctx; |
| 159 void (*apply_window_mp3)(MPA_INT *synth_buf, MPA_INT *window, |
| 160 int *dither_state, OUT_INT *samples, int incr); |
| 159 } MPADecodeContext; | 161 } MPADecodeContext; |
| 160 | 162 |
| 161 /* layer 3 huffman tables */ | 163 /* layer 3 huffman tables */ |
| 162 typedef struct HuffTable { | 164 typedef struct HuffTable { |
| 163 int xsize; | 165 int xsize; |
| 164 const uint8_t *bits; | 166 const uint8_t *bits; |
| 165 const uint16_t *codes; | 167 const uint16_t *codes; |
| 166 } HuffTable; | 168 } HuffTable; |
| 167 | 169 |
| 168 int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf); | 170 int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf); |
| 169 int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate,
int *channels, int *frame_size, int *bitrate); | 171 int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate,
int *channels, int *frame_size, int *bitrate); |
| 170 extern MPA_INT ff_mpa_synth_window[]; | 172 extern MPA_INT ff_mpa_synth_window[]; |
| 171 void ff_mpa_synth_init(MPA_INT *window); | 173 void ff_mpa_synth_init(MPA_INT *window); |
| 172 void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, | 174 void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, |
| 173 MPA_INT *window, int *dither_state, | 175 MPA_INT *window, int *dither_state, |
| 174 OUT_INT *samples, int incr, | 176 OUT_INT *samples, int incr, |
| 175 INTFLOAT sb_samples[SBLIMIT]); | 177 INTFLOAT sb_samples[SBLIMIT]); |
| 176 | 178 |
| 177 void ff_mpa_synth_init_float(MPA_INT *window); | 179 void ff_mpa_synth_init_float(MPA_INT *window); |
| 178 void ff_mpa_synth_filter_float(MPA_INT *synth_buf_ptr, int *synth_buf_offset, | 180 void ff_mpa_synth_filter_float(MPADecodeContext *s, |
| 181 MPA_INT *synth_buf_ptr, int *synth_buf_offset, |
| 179 MPA_INT *window, int *dither_state, | 182 MPA_INT *window, int *dither_state, |
| 180 OUT_INT *samples, int incr, | 183 OUT_INT *samples, int incr, |
| 181 INTFLOAT sb_samples[SBLIMIT]); | 184 INTFLOAT sb_samples[SBLIMIT]); |
| 182 | 185 |
| 183 /* fast header check for resync */ | 186 /* fast header check for resync */ |
| 184 static inline int ff_mpa_check_header(uint32_t header){ | 187 static inline int ff_mpa_check_header(uint32_t header){ |
| 185 /* header */ | 188 /* header */ |
| 186 if ((header & 0xffe00000) != 0xffe00000) | 189 if ((header & 0xffe00000) != 0xffe00000) |
| 187 return -1; | 190 return -1; |
| 188 /* layer check */ | 191 /* layer check */ |
| 189 if ((header & (3<<17)) == 0) | 192 if ((header & (3<<17)) == 0) |
| 190 return -1; | 193 return -1; |
| 191 /* bit rate */ | 194 /* bit rate */ |
| 192 if ((header & (0xf<<12)) == 0xf<<12) | 195 if ((header & (0xf<<12)) == 0xf<<12) |
| 193 return -1; | 196 return -1; |
| 194 /* frequency */ | 197 /* frequency */ |
| 195 if ((header & (3<<10)) == 3<<10) | 198 if ((header & (3<<10)) == 3<<10) |
| 196 return -1; | 199 return -1; |
| 197 return 0; | 200 return 0; |
| 198 } | 201 } |
| 199 | 202 |
| 200 #endif /* AVCODEC_MPEGAUDIO_H */ | 203 #endif /* AVCODEC_MPEGAUDIO_H */ |
| OLD | NEW |