OLD | NEW |
1 /* | 1 /* |
2 * Atrac 3 compatible decoder | 2 * Atrac 3 compatible decoder |
3 * Copyright (c) 2006-2008 Maxim Poliakovski | 3 * Copyright (c) 2006-2008 Maxim Poliakovski |
4 * Copyright (c) 2006-2008 Benjamin Larsson | 4 * Copyright (c) 2006-2008 Benjamin Larsson |
5 * | 5 * |
6 * This file is part of FFmpeg. | 6 * This file is part of FFmpeg. |
7 * | 7 * |
8 * FFmpeg is free software; you can redistribute it and/or | 8 * FFmpeg is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 22 matching lines...) Expand all Loading... |
33 */ | 33 */ |
34 | 34 |
35 #include <math.h> | 35 #include <math.h> |
36 #include <stddef.h> | 36 #include <stddef.h> |
37 #include <stdio.h> | 37 #include <stdio.h> |
38 | 38 |
39 #include "avcodec.h" | 39 #include "avcodec.h" |
40 #include "get_bits.h" | 40 #include "get_bits.h" |
41 #include "dsputil.h" | 41 #include "dsputil.h" |
42 #include "bytestream.h" | 42 #include "bytestream.h" |
| 43 #include "fft.h" |
43 | 44 |
44 #include "atrac.h" | 45 #include "atrac.h" |
45 #include "atrac3data.h" | 46 #include "atrac3data.h" |
46 | 47 |
47 #define JOINT_STEREO 0x12 | 48 #define JOINT_STEREO 0x12 |
48 #define STEREO 0x2 | 49 #define STEREO 0x2 |
49 | 50 |
50 | 51 |
51 /* These structures are needed to store the parsed gain control data. */ | 52 /* These structures are needed to store the parsed gain control data. */ |
52 typedef struct { | 53 typedef struct { |
(...skipping 13 matching lines...) Expand all Loading... |
66 } tonal_component; | 67 } tonal_component; |
67 | 68 |
68 typedef struct { | 69 typedef struct { |
69 int bandsCoded; | 70 int bandsCoded; |
70 int numComponents; | 71 int numComponents; |
71 tonal_component components[64]; | 72 tonal_component components[64]; |
72 float prevFrame[1024]; | 73 float prevFrame[1024]; |
73 int gcBlkSwitch; | 74 int gcBlkSwitch; |
74 gain_block gainBlock[2]; | 75 gain_block gainBlock[2]; |
75 | 76 |
76 DECLARE_ALIGNED_16(float, spectrum)[1024]; | 77 DECLARE_ALIGNED(16, float, spectrum)[1024]; |
77 DECLARE_ALIGNED_16(float, IMDCT_buf)[1024]; | 78 DECLARE_ALIGNED(16, float, IMDCT_buf)[1024]; |
78 | 79 |
79 float delayBuf1[46]; ///<qmf delay buffers | 80 float delayBuf1[46]; ///<qmf delay buffers |
80 float delayBuf2[46]; | 81 float delayBuf2[46]; |
81 float delayBuf3[46]; | 82 float delayBuf3[46]; |
82 } channel_unit; | 83 } channel_unit; |
83 | 84 |
84 typedef struct { | 85 typedef struct { |
85 GetBitContext gb; | 86 GetBitContext gb; |
86 //@{ | 87 //@{ |
87 /** stream data */ | 88 /** stream data */ |
(...skipping 24 matching lines...) Expand all Loading... |
112 //@} | 113 //@} |
113 //@{ | 114 //@{ |
114 /** extradata */ | 115 /** extradata */ |
115 int atrac3version; | 116 int atrac3version; |
116 int delay; | 117 int delay; |
117 int scrambled_stream; | 118 int scrambled_stream; |
118 int frame_factor; | 119 int frame_factor; |
119 //@} | 120 //@} |
120 } ATRAC3Context; | 121 } ATRAC3Context; |
121 | 122 |
122 static DECLARE_ALIGNED_16(float,mdct_window)[512]; | 123 static DECLARE_ALIGNED(16, float,mdct_window)[512]; |
123 static VLC spectral_coeff_tab[7]; | 124 static VLC spectral_coeff_tab[7]; |
124 static float gain_tab1[16]; | 125 static float gain_tab1[16]; |
125 static float gain_tab2[31]; | 126 static float gain_tab2[31]; |
126 static FFTContext mdct_ctx; | 127 static FFTContext mdct_ctx; |
127 static DSPContext dsp; | 128 static DSPContext dsp; |
128 | 129 |
129 | 130 |
130 /** | 131 /** |
131 * Regular 512 points IMDCT without overlapping, with the exception of the swapp
ing of odd bands | 132 * Regular 512 points IMDCT without overlapping, with the exception of the swapp
ing of odd bands |
132 * caused by the reverse spectra of the QMF. | 133 * caused by the reverse spectra of the QMF. |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 { | 1017 { |
1017 .name = "atrac3", | 1018 .name = "atrac3", |
1018 .type = CODEC_TYPE_AUDIO, | 1019 .type = CODEC_TYPE_AUDIO, |
1019 .id = CODEC_ID_ATRAC3, | 1020 .id = CODEC_ID_ATRAC3, |
1020 .priv_data_size = sizeof(ATRAC3Context), | 1021 .priv_data_size = sizeof(ATRAC3Context), |
1021 .init = atrac3_decode_init, | 1022 .init = atrac3_decode_init, |
1022 .close = atrac3_decode_close, | 1023 .close = atrac3_decode_close, |
1023 .decode = atrac3_decode_frame, | 1024 .decode = atrac3_decode_frame, |
1024 .long_name = NULL_IF_CONFIG_SMALL("Atrac 3 (Adaptive TRansform Acoustic Codi
ng 3)"), | 1025 .long_name = NULL_IF_CONFIG_SMALL("Atrac 3 (Adaptive TRansform Acoustic Codi
ng 3)"), |
1025 }; | 1026 }; |
OLD | NEW |