Signed-off-by: Paul B Mahol <onemda@gmail.com>
Paul B Mahol authored on 2016/12/27 00:58:46... | ... |
@@ -1048,6 +1048,7 @@ following image formats are supported: |
1048 | 1048 |
@item PCM unsigned 32-bit little-endian @tab X @tab X |
1049 | 1049 |
@item PCM Zork @tab @tab X |
1050 | 1050 |
@item QCELP / PureVoice @tab @tab X |
1051 |
+@item QDesign Music Codec 1 @tab @tab X |
|
1051 | 1052 |
@item QDesign Music Codec 2 @tab @tab X |
1052 | 1053 |
@tab There are still some distortions. |
1053 | 1054 |
@item RealAudio 1.0 (14.4K) @tab X @tab X |
... | ... |
@@ -466,6 +466,7 @@ OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o \ |
466 | 466 |
celp_filters.o acelp_vectors.o \ |
467 | 467 |
acelp_filters.o |
468 | 468 |
OBJS-$(CONFIG_QDM2_DECODER) += qdm2.o |
469 |
+OBJS-$(CONFIG_QDMC_DECODER) += qdmc.o |
|
469 | 470 |
OBJS-$(CONFIG_QDRAW_DECODER) += qdrw.o |
470 | 471 |
OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o |
471 | 472 |
OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o |
... | ... |
@@ -449,6 +449,7 @@ void avcodec_register_all(void) |
449 | 449 |
REGISTER_DECODER(PAF_AUDIO, paf_audio); |
450 | 450 |
REGISTER_DECODER(QCELP, qcelp); |
451 | 451 |
REGISTER_DECODER(QDM2, qdm2); |
452 |
+ REGISTER_DECODER(QDMC, qdmc); |
|
452 | 453 |
REGISTER_ENCDEC (RA_144, ra_144); |
453 | 454 |
REGISTER_DECODER(RA_288, ra_288); |
454 | 455 |
REGISTER_DECODER(RALF, ralf); |
455 | 456 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,783 @@ |
0 |
+/* |
|
1 |
+ * QDMC compatible decoder |
|
2 |
+ * Copyright (c) 2017 Paul B Mahol |
|
3 |
+ * |
|
4 |
+ * This file is part of FFmpeg. |
|
5 |
+ * |
|
6 |
+ * FFmpeg is free software; you can redistribute it and/or |
|
7 |
+ * modify it under the terms of the GNU Lesser General Public |
|
8 |
+ * License as published by the Free Software Foundation; either |
|
9 |
+ * version 2.1 of the License, or (at your option) any later version. |
|
10 |
+ * |
|
11 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
12 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 |
+ * Lesser General Public License for more details. |
|
15 |
+ * |
|
16 |
+ * You should have received a copy of the GNU Lesser General Public |
|
17 |
+ * License along with FFmpeg; if not, write to the Free Software |
|
18 |
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
19 |
+ */ |
|
20 |
+ |
|
21 |
+#include <math.h> |
|
22 |
+#include <stddef.h> |
|
23 |
+#include <stdio.h> |
|
24 |
+ |
|
25 |
+#define BITSTREAM_READER_LE |
|
26 |
+ |
|
27 |
+#include "libavutil/channel_layout.h" |
|
28 |
+ |
|
29 |
+#include "avcodec.h" |
|
30 |
+#include "bytestream.h" |
|
31 |
+#include "get_bits.h" |
|
32 |
+#include "internal.h" |
|
33 |
+#include "fft.h" |
|
34 |
+ |
|
35 |
+typedef struct QDMCTone { |
|
36 |
+ uint8_t mode; |
|
37 |
+ uint8_t phase; |
|
38 |
+ uint8_t offset; |
|
39 |
+ int16_t freq; |
|
40 |
+ int16_t amplitude; |
|
41 |
+} QDMCTone; |
|
42 |
+ |
|
43 |
+typedef struct QDMCContext { |
|
44 |
+ AVCodecContext *avctx; |
|
45 |
+ |
|
46 |
+ uint8_t frame_bits; |
|
47 |
+ int band_index; |
|
48 |
+ int frame_size; |
|
49 |
+ int subframe_size; |
|
50 |
+ int fft_offset; |
|
51 |
+ int buffer_offset; |
|
52 |
+ int nb_channels; |
|
53 |
+ int checksum_size; |
|
54 |
+ |
|
55 |
+ uint8_t noise[2][19][16]; |
|
56 |
+ QDMCTone tones[5][8192]; |
|
57 |
+ int nb_tones[5]; |
|
58 |
+ int cur_tone[5]; |
|
59 |
+ float alt_sin[5][31]; |
|
60 |
+ float fft_buffer[4][8192 * 2]; |
|
61 |
+ float noise2_buffer[4096 * 2]; |
|
62 |
+ float noise_buffer[4096 * 2]; |
|
63 |
+ float buffer[2 * 32768]; |
|
64 |
+ float *buffer_ptr; |
|
65 |
+ int rndval; |
|
66 |
+ |
|
67 |
+ DECLARE_ALIGNED(32, FFTComplex, cmplx)[2][512]; |
|
68 |
+ FFTContext fft_ctx; |
|
69 |
+} QDMCContext; |
|
70 |
+ |
|
71 |
+static float sin_table[512]; |
|
72 |
+static VLC vtable[6]; |
|
73 |
+ |
|
74 |
+static const unsigned code_prefix[] = { |
|
75 |
+ 0x0, 0x1, 0x2, 0x3, 0x4, 0x6, 0x8, 0xA, |
|
76 |
+ 0xC, 0x10, 0x14, 0x18, 0x1C, 0x24, 0x2C, 0x34, |
|
77 |
+ 0x3C, 0x4C, 0x5C, 0x6C, 0x7C, 0x9C, 0xBC, 0xDC, |
|
78 |
+ 0xFC, 0x13C, 0x17C, 0x1BC, 0x1FC, 0x27C, 0x2FC, 0x37C, |
|
79 |
+ 0x3FC, 0x4FC, 0x5FC, 0x6FC, 0x7FC, 0x9FC, 0xBFC, 0xDFC, |
|
80 |
+ 0xFFC, 0x13FC, 0x17FC, 0x1BFC, 0x1FFC, 0x27FC, 0x2FFC, 0x37FC, |
|
81 |
+ 0x3FFC, 0x4FFC, 0x5FFC, 0x6FFC, 0x7FFC, 0x9FFC, 0xBFFC, 0xDFFC, |
|
82 |
+ 0xFFFC, 0x13FFC, 0x17FFC, 0x1BFFC, 0x1FFFC, 0x27FFC, 0x2FFFC, 0x37FFC, |
|
83 |
+ 0x3FFFC |
|
84 |
+}; |
|
85 |
+ |
|
86 |
+static const float amplitude_tab[64] = { |
|
87 |
+ 1.18750000f, 1.68359380f, 2.37500000f, 3.36718750f, 4.75000000f, |
|
88 |
+ 6.73437500f, 9.50000000f, 13.4687500f, 19.0000000f, 26.9375000f, |
|
89 |
+ 38.0000000f, 53.8750000f, 76.0000000f, 107.750000f, 152.000000f, |
|
90 |
+ 215.500000f, 304.000000f, 431.000000f, 608.000000f, 862.000000f, |
|
91 |
+ 1216.00000f, 1724.00000f, 2432.00000f, 3448.00000f, 4864.00000f, |
|
92 |
+ 6896.00000f, 9728.00000f, 13792.0000f, 19456.0000f, 27584.0000f, |
|
93 |
+ 38912.0000f, 55168.0000f, 77824.0000f, 110336.000f, 155648.000f, |
|
94 |
+ 220672.000f, 311296.000f, 441344.000f, 622592.000f, 882688.000f, |
|
95 |
+ 1245184.00f, 1765376.00f, 2490368.00f, 3530752.00f, 4980736.00f, |
|
96 |
+ 7061504.00f, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
97 |
+}; |
|
98 |
+ |
|
99 |
+static const uint16_t qdmc_nodes[112] = { |
|
100 |
+ 0, 1, 2, 4, 6, 8, 12, 16, 24, 32, 48, 56, 64, |
|
101 |
+ 80, 96, 120, 144, 176, 208, 240, 256, |
|
102 |
+ 0, 2, 4, 8, 16, 24, 32, 48, 56, 64, 80, 104, |
|
103 |
+ 128, 160, 208, 256, 0, 0, 0, 0, 0, |
|
104 |
+ 0, 2, 4, 8, 16, 32, 48, 64, 80, 112, 160, 208, |
|
105 |
+ 256, 0, 0, 0, 0, 0, 0, 0, 0, |
|
106 |
+ 0, 4, 8, 16, 32, 48, 64, 96, 144, 208, 256, |
|
107 |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
|
108 |
+ 0, 4, 16, 32, 64, 256, 0, 0, 0, 0, 0, 0, 0, 0, |
|
109 |
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
|
110 |
+}; |
|
111 |
+ |
|
112 |
+static const uint8_t noise_bands_size[] = { |
|
113 |
+ 19, 14, 11, 9, 4, 2, 0 |
|
114 |
+}; |
|
115 |
+ |
|
116 |
+static const uint8_t noise_bands_selector[] = { |
|
117 |
+ 4, 3, 2, 1, 0, 0, 0, |
|
118 |
+}; |
|
119 |
+ |
|
120 |
+static const uint8_t noise_value_bits[] = { |
|
121 |
+ 12, 7, 9, 7, 10, 9, 11, 9, 9, 2, 9, 9, 9, 9, |
|
122 |
+ 9, 3, 9, 10, 10, 12, 2, 3, 3, 5, 5, 6, 7, |
|
123 |
+}; |
|
124 |
+ |
|
125 |
+static const uint8_t noise_value_symbols[] = { |
|
126 |
+ 0, 10, 11, 12, 13, 14, 15, 16, 18, 1, 20, 22, 24, |
|
127 |
+ 26, 28, 2, 30, 32, 34, 36, 3, 4, 5, 6, 7, 8, 9, |
|
128 |
+}; |
|
129 |
+ |
|
130 |
+static const uint16_t noise_value_codes[] = { |
|
131 |
+ 0xC7A, 0x002, 0x0FA, 0x03A, 0x35A, 0x1C2, 0x07A, 0x1FA, |
|
132 |
+ 0x17A, 0x000, 0x0DA, 0x142, 0x0C2, 0x042, 0x1DA, 0x001, |
|
133 |
+ 0x05A, 0x15A, 0x27A, 0x47A, 0x003, 0x005, 0x006, 0x012, |
|
134 |
+ 0x00A, 0x022, 0x01A, |
|
135 |
+}; |
|
136 |
+ |
|
137 |
+static const uint8_t noise_segment_length_bits[] = { |
|
138 |
+ 10, 8, 5, 1, 2, 4, 4, 4, 6, 7, 9, 10, |
|
139 |
+}; |
|
140 |
+ |
|
141 |
+static const uint8_t noise_segment_length_symbols[] = { |
|
142 |
+ 0, 13, 17, 1, 2, 3, 4, 5, 6, 7, 8, 9, |
|
143 |
+}; |
|
144 |
+ |
|
145 |
+static const uint16_t noise_segment_length_codes[] = { |
|
146 |
+ 0x30B, 0x8B, 0x1B, 0x0, 0x1, 0x3, 0x7, 0xF, 0x2b, 0x4B, 0xB, 0x10B, |
|
147 |
+}; |
|
148 |
+ |
|
149 |
+static const uint8_t freq_diff_bits[] = { |
|
150 |
+ 18, 2, 4, 4, 5, 4, 4, 5, 5, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 6, |
|
151 |
+ 7, 6, 6, 6, 7, 7, 7, 7, 7, 8, 9, 9, 8, 9, 11, 11, 12, 12, 13, 12, |
|
152 |
+ 14, 15, 18, 16, 17, |
|
153 |
+}; |
|
154 |
+ |
|
155 |
+static const uint32_t freq_diff_codes[] = { |
|
156 |
+ 0x2AD46, 0x1, 0x0, 0x3, 0xC, 0xA, 0x7, 0x18, 0x12, 0xE, 0x4, 0x16, |
|
157 |
+ 0xF, 0x1C, 0x8, 0x22, 0x26, 0x2, 0x3B, 0x34, 0x74, 0x1F, 0x14, 0x2B, |
|
158 |
+ 0x1B, 0x3F, 0x28, 0x54, 0x6, 0x4B, 0xB, 0x68, 0xE8, 0x46, 0xC6, 0x1E8, |
|
159 |
+ 0x146, 0x346, 0x546, 0x746, 0x1D46, 0xF46, 0xD46, 0x6D46, 0xAD46, 0x2D46, |
|
160 |
+ 0x1AD46, |
|
161 |
+}; |
|
162 |
+ |
|
163 |
+static const uint8_t amplitude_bits[] = { |
|
164 |
+ 13, 7, 8, 9, 10, 10, 10, 10, 10, 9, 8, 7, 6, |
|
165 |
+ 5, 4, 3, 3, 2, 3, 3, 4, 5, 7, 8, 9, 11, 12, 13, |
|
166 |
+}; |
|
167 |
+ |
|
168 |
+static const uint16_t amplitude_codes[] = { |
|
169 |
+ 0x1EC6, 0x6, 0xC2, 0x142, 0x242, 0x246, 0xC6, 0x46, 0x42, 0x146, 0xA2, |
|
170 |
+ 0x62, 0x26, 0x16, 0xE, 0x5, 0x4, 0x3, 0x0, 0x1, 0xA, 0x12, 0x2, 0x22, |
|
171 |
+ 0x1C6, 0x2C6, 0x6C6, 0xEC6, |
|
172 |
+}; |
|
173 |
+ |
|
174 |
+static const uint8_t amplitude_diff_bits[] = { |
|
175 |
+ 8, 2, 1, 3, 4, 5, 6, 7, 8, |
|
176 |
+}; |
|
177 |
+ |
|
178 |
+static const uint8_t amplitude_diff_codes[] = { |
|
179 |
+ 0xFE, 0x0, 0x1, 0x2, 0x6, 0xE, 0x1E, 0x3E, 0x7E, |
|
180 |
+}; |
|
181 |
+ |
|
182 |
+static const uint8_t phase_diff_bits[] = { |
|
183 |
+ 6, 2, 2, 4, 4, 6, 5, 4, 2, |
|
184 |
+}; |
|
185 |
+ |
|
186 |
+static const uint8_t phase_diff_codes[] = { |
|
187 |
+ 0x35, 0x2, 0x0, 0x1, 0xD, 0x15, 0x5, 0x9, 0x3, |
|
188 |
+}; |
|
189 |
+ |
|
190 |
+#define INIT_VLC_STATIC_LE(vlc, nb_bits, nb_codes, \ |
|
191 |
+ bits, bits_wrap, bits_size, \ |
|
192 |
+ codes, codes_wrap, codes_size, \ |
|
193 |
+ symbols, symbols_wrap, symbols_size, \ |
|
194 |
+ static_size) \ |
|
195 |
+ do { \ |
|
196 |
+ static VLC_TYPE table[static_size][2]; \ |
|
197 |
+ (vlc)->table = table; \ |
|
198 |
+ (vlc)->table_allocated = static_size; \ |
|
199 |
+ ff_init_vlc_sparse(vlc, nb_bits, nb_codes, \ |
|
200 |
+ bits, bits_wrap, bits_size, \ |
|
201 |
+ codes, codes_wrap, codes_size, \ |
|
202 |
+ symbols, symbols_wrap, symbols_size, \ |
|
203 |
+ INIT_VLC_LE | INIT_VLC_USE_NEW_STATIC); \ |
|
204 |
+ } while (0) |
|
205 |
+ |
|
206 |
+static av_cold void qdmc_init_static_data(AVCodec *codec) |
|
207 |
+{ |
|
208 |
+ int i; |
|
209 |
+ |
|
210 |
+ INIT_VLC_STATIC_LE(&vtable[0], 12, FF_ARRAY_ELEMS(noise_value_bits), |
|
211 |
+ noise_value_bits, 1, 1, noise_value_codes, 2, 2, noise_value_symbols, 1, 1, 4096); |
|
212 |
+ INIT_VLC_STATIC_LE(&vtable[1], 10, FF_ARRAY_ELEMS(noise_segment_length_bits), |
|
213 |
+ noise_segment_length_bits, 1, 1, noise_segment_length_codes, 2, 2, |
|
214 |
+ noise_segment_length_symbols, 1, 1, 1024); |
|
215 |
+ INIT_VLC_STATIC_LE(&vtable[2], 13, FF_ARRAY_ELEMS(amplitude_bits), |
|
216 |
+ amplitude_bits, 1, 1, amplitude_codes, 2, 2, NULL, 0, 0, 8192); |
|
217 |
+ INIT_VLC_STATIC_LE(&vtable[3], 18, FF_ARRAY_ELEMS(freq_diff_bits), |
|
218 |
+ freq_diff_bits, 1, 1, freq_diff_codes, 4, 4, NULL, 0, 0, 262144); |
|
219 |
+ INIT_VLC_STATIC_LE(&vtable[4], 8, FF_ARRAY_ELEMS(amplitude_diff_bits), |
|
220 |
+ amplitude_diff_bits, 1, 1, amplitude_diff_codes, 1, 1, NULL, 0, 0, 256); |
|
221 |
+ INIT_VLC_STATIC_LE(&vtable[5], 6, FF_ARRAY_ELEMS(phase_diff_bits), |
|
222 |
+ phase_diff_bits, 1, 1, phase_diff_codes, 1, 1, NULL, 0, 0, 64); |
|
223 |
+ |
|
224 |
+ for (i = 0; i < 512; i++) |
|
225 |
+ sin_table[i] = sin(2.0f * i * M_PI * 0.001953125f); |
|
226 |
+} |
|
227 |
+ |
|
228 |
+static void make_noises(QDMCContext *s) |
|
229 |
+{ |
|
230 |
+ int i, j, n0, n1, n2, diff; |
|
231 |
+ float *nptr; |
|
232 |
+ |
|
233 |
+ for (j = 0; j < noise_bands_size[s->band_index]; j++) { |
|
234 |
+ n0 = qdmc_nodes[j + 21 * s->band_index ]; |
|
235 |
+ n1 = qdmc_nodes[j + 21 * s->band_index + 1]; |
|
236 |
+ n2 = qdmc_nodes[j + 21 * s->band_index + 2]; |
|
237 |
+ nptr = s->noise_buffer + 256 * j; |
|
238 |
+ |
|
239 |
+ for (i = 0; i + n0 < n1; i++, nptr++) |
|
240 |
+ nptr[0] = i / (float)(n1 - n0); |
|
241 |
+ |
|
242 |
+ diff = n2 - n1; |
|
243 |
+ nptr = s->noise_buffer + (j << 8) + n1 - n0; |
|
244 |
+ |
|
245 |
+ for (i = n1; i < n2; i++, nptr++, diff--) |
|
246 |
+ nptr[0] = diff / (float)(n2 - n1); |
|
247 |
+ } |
|
248 |
+} |
|
249 |
+ |
|
250 |
+static av_cold int qdmc_decode_init(AVCodecContext *avctx) |
|
251 |
+{ |
|
252 |
+ QDMCContext *s = avctx->priv_data; |
|
253 |
+ int fft_size, fft_order, size, g, j, x; |
|
254 |
+ GetByteContext b; |
|
255 |
+ |
|
256 |
+ if (!avctx->extradata || (avctx->extradata_size < 48)) { |
|
257 |
+ av_log(avctx, AV_LOG_ERROR, "extradata missing or truncated\n"); |
|
258 |
+ return AVERROR_INVALIDDATA; |
|
259 |
+ } |
|
260 |
+ |
|
261 |
+ bytestream2_init(&b, avctx->extradata, avctx->extradata_size); |
|
262 |
+ |
|
263 |
+ while (bytestream2_get_bytes_left(&b) > 8) { |
|
264 |
+ if (bytestream2_peek_be64(&b) == (((uint64_t)MKBETAG('f','r','m','a') << 32) | |
|
265 |
+ (uint64_t)MKBETAG('Q','D','M','C'))) |
|
266 |
+ break; |
|
267 |
+ bytestream2_skipu(&b, 1); |
|
268 |
+ } |
|
269 |
+ bytestream2_skipu(&b, 8); |
|
270 |
+ |
|
271 |
+ if (bytestream2_get_bytes_left(&b) < 36) { |
|
272 |
+ av_log(avctx, AV_LOG_ERROR, "not enough extradata (%i)\n", |
|
273 |
+ bytestream2_get_bytes_left(&b)); |
|
274 |
+ return AVERROR_INVALIDDATA; |
|
275 |
+ } |
|
276 |
+ |
|
277 |
+ size = bytestream2_get_be32u(&b); |
|
278 |
+ if (size > bytestream2_get_bytes_left(&b)) { |
|
279 |
+ av_log(avctx, AV_LOG_ERROR, "extradata size too small, %i < %i\n", |
|
280 |
+ bytestream2_get_bytes_left(&b), size); |
|
281 |
+ return AVERROR_INVALIDDATA; |
|
282 |
+ } |
|
283 |
+ |
|
284 |
+ if (bytestream2_get_be32u(&b) != MKBETAG('Q','D','C','A')) { |
|
285 |
+ av_log(avctx, AV_LOG_ERROR, "invalid extradata, expecting QDCA\n"); |
|
286 |
+ return AVERROR_INVALIDDATA; |
|
287 |
+ } |
|
288 |
+ bytestream2_skipu(&b, 4); |
|
289 |
+ |
|
290 |
+ avctx->channels = s->nb_channels = bytestream2_get_be32u(&b); |
|
291 |
+ if (s->nb_channels <= 0 || s->nb_channels > 2) { |
|
292 |
+ av_log(avctx, AV_LOG_ERROR, "invalid number of channels\n"); |
|
293 |
+ return AVERROR_INVALIDDATA; |
|
294 |
+ } |
|
295 |
+ avctx->channel_layout = avctx->channels == 2 ? AV_CH_LAYOUT_STEREO : |
|
296 |
+ AV_CH_LAYOUT_MONO; |
|
297 |
+ |
|
298 |
+ avctx->sample_rate = bytestream2_get_be32u(&b); |
|
299 |
+ avctx->bit_rate = bytestream2_get_be32u(&b); |
|
300 |
+ bytestream2_skipu(&b, 4); |
|
301 |
+ fft_size = bytestream2_get_be32u(&b); |
|
302 |
+ fft_order = av_log2(fft_size) + 1; |
|
303 |
+ s->checksum_size = bytestream2_get_be32u(&b); |
|
304 |
+ if (s->checksum_size >= 1U << 28) { |
|
305 |
+ av_log(avctx, AV_LOG_ERROR, "data block size too large (%u)\n", s->checksum_size); |
|
306 |
+ return AVERROR_INVALIDDATA; |
|
307 |
+ } |
|
308 |
+ |
|
309 |
+ if (avctx->sample_rate >= 32000) { |
|
310 |
+ x = 28000; |
|
311 |
+ s->frame_bits = 13; |
|
312 |
+ } else if (avctx->sample_rate >= 16000) { |
|
313 |
+ x = 20000; |
|
314 |
+ s->frame_bits = 12; |
|
315 |
+ } else { |
|
316 |
+ x = 16000; |
|
317 |
+ s->frame_bits = 11; |
|
318 |
+ } |
|
319 |
+ s->frame_size = 1 << s->frame_bits; |
|
320 |
+ s->subframe_size = s->frame_size >> 5; |
|
321 |
+ |
|
322 |
+ if (avctx->channels == 2) |
|
323 |
+ x = 3 * x / 2; |
|
324 |
+ s->band_index = noise_bands_selector[FFMIN(6, llrint(floor(avctx->bit_rate * 3.0 / (double)x + 0.5)))]; |
|
325 |
+ |
|
326 |
+ if ((fft_order < 7) || (fft_order > 9)) { |
|
327 |
+ avpriv_request_sample(avctx, "Unknown FFT order %d", fft_order); |
|
328 |
+ return AVERROR_PATCHWELCOME; |
|
329 |
+ } |
|
330 |
+ |
|
331 |
+ if (fft_size != (1 << (fft_order - 1))) { |
|
332 |
+ av_log(avctx, AV_LOG_ERROR, "FFT size %d not power of 2.\n", fft_size); |
|
333 |
+ return AVERROR_INVALIDDATA; |
|
334 |
+ } |
|
335 |
+ |
|
336 |
+ ff_fft_init(&s->fft_ctx, fft_order, 1); |
|
337 |
+ |
|
338 |
+ avctx->sample_fmt = AV_SAMPLE_FMT_S16; |
|
339 |
+ |
|
340 |
+ for (g = 5; g > 0; g--) { |
|
341 |
+ for (j = 0; j < (1 << g) - 1; j++) |
|
342 |
+ s->alt_sin[5-g][j] = sin_table[(((j+1) << (8 - g)) & 0x1FF)]; |
|
343 |
+ } |
|
344 |
+ |
|
345 |
+ make_noises(s); |
|
346 |
+ |
|
347 |
+ return 0; |
|
348 |
+} |
|
349 |
+ |
|
350 |
+static av_cold int qdmc_decode_close(AVCodecContext *avctx) |
|
351 |
+{ |
|
352 |
+ QDMCContext *s = avctx->priv_data; |
|
353 |
+ |
|
354 |
+ ff_fft_end(&s->fft_ctx); |
|
355 |
+ |
|
356 |
+ return 0; |
|
357 |
+} |
|
358 |
+ |
|
359 |
+static int qdmc_get_vlc(GetBitContext *gb, VLC *table, int flag) |
|
360 |
+{ |
|
361 |
+ int v; |
|
362 |
+ |
|
363 |
+ v = get_vlc2(gb, table->table, table->bits, 1); |
|
364 |
+ if (v < 0) |
|
365 |
+ return AVERROR_INVALIDDATA; |
|
366 |
+ if (v) |
|
367 |
+ v = v - 1; |
|
368 |
+ else |
|
369 |
+ v = get_bits(gb, get_bits(gb, 3) + 1); |
|
370 |
+ |
|
371 |
+ if (flag) { |
|
372 |
+ if (v >= FF_ARRAY_ELEMS(code_prefix)) |
|
373 |
+ return AVERROR_INVALIDDATA; |
|
374 |
+ |
|
375 |
+ v = code_prefix[v] + get_bitsz(gb, v >> 2); |
|
376 |
+ } |
|
377 |
+ |
|
378 |
+ return v; |
|
379 |
+} |
|
380 |
+ |
|
381 |
+static int skip_label(QDMCContext *s, GetBitContext *gb) |
|
382 |
+{ |
|
383 |
+ uint32_t label = get_bits_long(gb, 32); |
|
384 |
+ uint16_t sum = 226, checksum = get_bits(gb, 16); |
|
385 |
+ const uint8_t *ptr = gb->buffer + 6; |
|
386 |
+ int i; |
|
387 |
+ |
|
388 |
+ if (label != MKTAG('Q', 'M', 'C', 1)) |
|
389 |
+ return AVERROR_INVALIDDATA; |
|
390 |
+ |
|
391 |
+ for (i = 0; i < s->checksum_size - 6; i++) |
|
392 |
+ sum += ptr[i]; |
|
393 |
+ |
|
394 |
+ return sum != checksum; |
|
395 |
+} |
|
396 |
+ |
|
397 |
+static int read_noise_data(QDMCContext *s, GetBitContext *gb) |
|
398 |
+{ |
|
399 |
+ int ch, j, k, v, idx, band, lastval, newval, len; |
|
400 |
+ |
|
401 |
+ for (ch = 0; ch < s->nb_channels; ch++) { |
|
402 |
+ for (band = 0; band < noise_bands_size[s->band_index]; band++) { |
|
403 |
+ v = qdmc_get_vlc(gb, &vtable[0], 0); |
|
404 |
+ if (v < 0) |
|
405 |
+ return AVERROR_INVALIDDATA; |
|
406 |
+ |
|
407 |
+ if (v & 1) |
|
408 |
+ v = v + 1; |
|
409 |
+ else |
|
410 |
+ v = -v; |
|
411 |
+ |
|
412 |
+ lastval = v / 2; |
|
413 |
+ s->noise[ch][band][0] = lastval - 1; |
|
414 |
+ for (j = 0; j < 15;) { |
|
415 |
+ len = qdmc_get_vlc(gb, &vtable[1], 1); |
|
416 |
+ if (len < 0) |
|
417 |
+ return AVERROR_INVALIDDATA; |
|
418 |
+ len += 1; |
|
419 |
+ |
|
420 |
+ v = qdmc_get_vlc(gb, &vtable[0], 0); |
|
421 |
+ if (v < 0) |
|
422 |
+ return AVERROR_INVALIDDATA; |
|
423 |
+ |
|
424 |
+ if (v & 1) |
|
425 |
+ newval = lastval + (v + 1) / 2; |
|
426 |
+ else |
|
427 |
+ newval = lastval - v / 2; |
|
428 |
+ |
|
429 |
+ idx = j + 1; |
|
430 |
+ if (len + idx > 16) |
|
431 |
+ return AVERROR_INVALIDDATA; |
|
432 |
+ |
|
433 |
+ for (k = 1; idx <= j + len; k++, idx++) |
|
434 |
+ s->noise[ch][band][idx] = lastval + k * (newval - lastval) / len - 1; |
|
435 |
+ |
|
436 |
+ lastval = newval; |
|
437 |
+ j += len; |
|
438 |
+ } |
|
439 |
+ } |
|
440 |
+ } |
|
441 |
+ |
|
442 |
+ return 0; |
|
443 |
+} |
|
444 |
+ |
|
445 |
+static void add_tone(QDMCContext *s, int group, int offset, int freq, int stereo_mode, int amplitude, int phase) |
|
446 |
+{ |
|
447 |
+ const int index = s->nb_tones[group]; |
|
448 |
+ |
|
449 |
+ if (index >= FF_ARRAY_ELEMS(s->tones[group])) { |
|
450 |
+ av_log(s->avctx, AV_LOG_WARNING, "Too many tones already in buffer, ignoring tone!\n"); |
|
451 |
+ return; |
|
452 |
+ } |
|
453 |
+ |
|
454 |
+ s->tones[group][index].offset = offset; |
|
455 |
+ s->tones[group][index].freq = freq; |
|
456 |
+ s->tones[group][index].mode = stereo_mode; |
|
457 |
+ s->tones[group][index].amplitude = amplitude; |
|
458 |
+ s->tones[group][index].phase = phase; |
|
459 |
+ s->nb_tones[group]++; |
|
460 |
+} |
|
461 |
+ |
|
462 |
+static int read_wave_data(QDMCContext *s, GetBitContext *gb) |
|
463 |
+{ |
|
464 |
+ int amp, phase, stereo_mode = 0, i, group, freq, group_size, group_bits; |
|
465 |
+ int amp2, phase2, pos2, off; |
|
466 |
+ |
|
467 |
+ for (group = 0; group < 5; group++) { |
|
468 |
+ group_size = 1 << (s->frame_bits - group - 1); |
|
469 |
+ group_bits = 4 - group; |
|
470 |
+ pos2 = 0; |
|
471 |
+ off = 0; |
|
472 |
+ |
|
473 |
+ for (i = 1; ; i = freq + 1) { |
|
474 |
+ int v; |
|
475 |
+ |
|
476 |
+ v = qdmc_get_vlc(gb, &vtable[3], 1); |
|
477 |
+ if (v < 0) |
|
478 |
+ return AVERROR_INVALIDDATA; |
|
479 |
+ |
|
480 |
+ freq = i + v; |
|
481 |
+ while (freq >= group_size - 1) { |
|
482 |
+ freq += 2 - group_size; |
|
483 |
+ pos2 += group_size; |
|
484 |
+ off += 1 << group_bits; |
|
485 |
+ } |
|
486 |
+ |
|
487 |
+ if (pos2 >= s->frame_size) |
|
488 |
+ break; |
|
489 |
+ |
|
490 |
+ if (s->nb_channels > 1) |
|
491 |
+ stereo_mode = get_bits(gb, 2); |
|
492 |
+ |
|
493 |
+ amp = qdmc_get_vlc(gb, &vtable[2], 0); |
|
494 |
+ if (amp < 0) |
|
495 |
+ return AVERROR_INVALIDDATA; |
|
496 |
+ phase = get_bits(gb, 3); |
|
497 |
+ |
|
498 |
+ if (stereo_mode > 1) { |
|
499 |
+ amp2 = qdmc_get_vlc(gb, &vtable[4], 0); |
|
500 |
+ if (amp2 < 0) |
|
501 |
+ return AVERROR_INVALIDDATA; |
|
502 |
+ amp2 = amp - amp2; |
|
503 |
+ |
|
504 |
+ phase2 = qdmc_get_vlc(gb, &vtable[5], 0); |
|
505 |
+ if (phase2 < 0) |
|
506 |
+ return AVERROR_INVALIDDATA; |
|
507 |
+ phase2 = phase - phase2; |
|
508 |
+ |
|
509 |
+ if (phase2 < 0) |
|
510 |
+ phase2 += 8; |
|
511 |
+ } |
|
512 |
+ |
|
513 |
+ if ((freq >> group_bits) + 1 < s->subframe_size) { |
|
514 |
+ add_tone(s, group, off, freq, stereo_mode & 1, amp, phase); |
|
515 |
+ if (stereo_mode > 1) |
|
516 |
+ add_tone(s, group, off, freq, ~stereo_mode & 1, amp2, phase2); |
|
517 |
+ } |
|
518 |
+ } |
|
519 |
+ } |
|
520 |
+ |
|
521 |
+ return 0; |
|
522 |
+} |
|
523 |
+ |
|
524 |
+static void lin_calc(QDMCContext *s, float amplitude, int node1, int node2, int index) |
|
525 |
+{ |
|
526 |
+ int subframe_size, i, j, k, length; |
|
527 |
+ float scale, *noise_ptr; |
|
528 |
+ |
|
529 |
+ scale = 0.5 * amplitude; |
|
530 |
+ subframe_size = s->subframe_size; |
|
531 |
+ if (subframe_size >= node2) |
|
532 |
+ subframe_size = node2; |
|
533 |
+ length = (subframe_size - node1) & 0xFFFC; |
|
534 |
+ j = node1; |
|
535 |
+ noise_ptr = &s->noise_buffer[256 * index]; |
|
536 |
+ |
|
537 |
+ for (i = 0; i < length; i += 4, j+= 4, noise_ptr += 4) { |
|
538 |
+ s->noise2_buffer[j ] += scale * noise_ptr[0]; |
|
539 |
+ s->noise2_buffer[j + 1] += scale * noise_ptr[1]; |
|
540 |
+ s->noise2_buffer[j + 2] += scale * noise_ptr[2]; |
|
541 |
+ s->noise2_buffer[j + 3] += scale * noise_ptr[3]; |
|
542 |
+ } |
|
543 |
+ |
|
544 |
+ k = length + node1; |
|
545 |
+ noise_ptr = s->noise_buffer + length + (index << 8); |
|
546 |
+ for (i = length; i < subframe_size - node1; i++, k++, noise_ptr++) |
|
547 |
+ s->noise2_buffer[k] += scale * noise_ptr[0]; |
|
548 |
+} |
|
549 |
+ |
|
550 |
+static void add_noise(QDMCContext *s, int ch, int current_subframe) |
|
551 |
+{ |
|
552 |
+ int i, j, aindex; |
|
553 |
+ float amplitude; |
|
554 |
+ float *im = &s->fft_buffer[0 + ch][s->fft_offset + s->subframe_size * current_subframe]; |
|
555 |
+ float *re = &s->fft_buffer[2 + ch][s->fft_offset + s->subframe_size * current_subframe]; |
|
556 |
+ |
|
557 |
+ memset(s->noise2_buffer, 0, 4 * s->subframe_size); |
|
558 |
+ |
|
559 |
+ for (i = 0; i < noise_bands_size[s->band_index]; i++) { |
|
560 |
+ if (qdmc_nodes[i + 21 * s->band_index] > s->subframe_size - 1) |
|
561 |
+ break; |
|
562 |
+ |
|
563 |
+ aindex = s->noise[ch][i][current_subframe / 2]; |
|
564 |
+ amplitude = aindex > 0 ? amplitude_tab[aindex & 0x3F] : 0.0f; |
|
565 |
+ |
|
566 |
+ lin_calc(s, amplitude, qdmc_nodes[21 * s->band_index + i], |
|
567 |
+ qdmc_nodes[21 * s->band_index + i + 2], i); |
|
568 |
+ } |
|
569 |
+ |
|
570 |
+ for (j = 2; j < s->subframe_size - 1; j++) { |
|
571 |
+ float rnd_re, rnd_im; |
|
572 |
+ |
|
573 |
+ s->rndval = 214013 * s->rndval + 2531011; |
|
574 |
+ rnd_im = ((s->rndval & 0x7FFF) - 16384.0f) * 0.000030517578f * s->noise2_buffer[j]; |
|
575 |
+ s->rndval = 214013 * s->rndval + 2531011; |
|
576 |
+ rnd_re = ((s->rndval & 0x7FFF) - 16384.0f) * 0.000030517578f * s->noise2_buffer[j]; |
|
577 |
+ im[j ] += rnd_im; |
|
578 |
+ re[j ] += rnd_re; |
|
579 |
+ im[j+1] -= rnd_im; |
|
580 |
+ re[j+1] -= rnd_re; |
|
581 |
+ } |
|
582 |
+} |
|
583 |
+ |
|
584 |
+static void add_wave(QDMCContext *s, int offset, int freqs, int group, int stereo_mode, int amp, int phase) |
|
585 |
+{ |
|
586 |
+ int j, group_bits, pos, pindex; |
|
587 |
+ float im, re, amplitude, level, *imptr, *reptr; |
|
588 |
+ |
|
589 |
+ if (s->nb_channels == 1) |
|
590 |
+ stereo_mode = 0; |
|
591 |
+ |
|
592 |
+ group_bits = 4 - group; |
|
593 |
+ pos = freqs >> (4 - group); |
|
594 |
+ amplitude = amplitude_tab[amp & 0x3F]; |
|
595 |
+ imptr = &s->fft_buffer[ stereo_mode][s->fft_offset + s->subframe_size * offset + pos]; |
|
596 |
+ reptr = &s->fft_buffer[2 + stereo_mode][s->fft_offset + s->subframe_size * offset + pos]; |
|
597 |
+ pindex = (phase << 6) - ((2 * (freqs >> (4 - group)) + 1) << 7); |
|
598 |
+ for (j = 0; j < (1 << (group_bits + 1)) - 1; j++) { |
|
599 |
+ pindex += (2 * freqs + 1) << (7 - group_bits); |
|
600 |
+ level = amplitude * s->alt_sin[group][j]; |
|
601 |
+ im = level * sin_table[ pindex & 0x1FF]; |
|
602 |
+ re = level * sin_table[(pindex + 128) & 0x1FF]; |
|
603 |
+ imptr[0] += im; |
|
604 |
+ imptr[1] -= im; |
|
605 |
+ reptr[0] += re; |
|
606 |
+ reptr[1] -= re; |
|
607 |
+ imptr += s->subframe_size; |
|
608 |
+ reptr += s->subframe_size; |
|
609 |
+ if (imptr >= &s->fft_buffer[stereo_mode][2 * s->frame_size]) { |
|
610 |
+ imptr = &s->fft_buffer[0 + stereo_mode][pos]; |
|
611 |
+ reptr = &s->fft_buffer[2 + stereo_mode][pos]; |
|
612 |
+ } |
|
613 |
+ } |
|
614 |
+} |
|
615 |
+ |
|
616 |
+static void add_wave0(QDMCContext *s, int offset, int freqs, int stereo_mode, int amp, int phase) |
|
617 |
+{ |
|
618 |
+ float level, im, re; |
|
619 |
+ int pos; |
|
620 |
+ |
|
621 |
+ if (s->nb_channels == 1) |
|
622 |
+ stereo_mode = 0; |
|
623 |
+ |
|
624 |
+ level = amplitude_tab[amp & 0x3F]; |
|
625 |
+ im = level * sin_table[ (phase << 6) & 0x1FF]; |
|
626 |
+ re = level * sin_table[((phase << 6) + 128) & 0x1FF]; |
|
627 |
+ pos = s->fft_offset + freqs + s->subframe_size * offset; |
|
628 |
+ s->fft_buffer[ stereo_mode][pos ] += im; |
|
629 |
+ s->fft_buffer[2 + stereo_mode][pos ] += re; |
|
630 |
+ s->fft_buffer[ stereo_mode][pos + 1] -= im; |
|
631 |
+ s->fft_buffer[2 + stereo_mode][pos + 1] -= re; |
|
632 |
+} |
|
633 |
+ |
|
634 |
+static void add_waves(QDMCContext *s, int current_subframe) |
|
635 |
+{ |
|
636 |
+ int w, g; |
|
637 |
+ |
|
638 |
+ for (g = 0; g < 4; g++) { |
|
639 |
+ for (w = s->cur_tone[g]; w < s->nb_tones[g]; w++) { |
|
640 |
+ QDMCTone *t = &s->tones[g][w]; |
|
641 |
+ |
|
642 |
+ if (current_subframe < t->offset) |
|
643 |
+ break; |
|
644 |
+ add_wave(s, t->offset, t->freq, g, t->mode, t->amplitude, t->phase); |
|
645 |
+ } |
|
646 |
+ s->cur_tone[g] = w; |
|
647 |
+ } |
|
648 |
+ for (w = s->cur_tone[4]; w < s->nb_tones[4]; w++) { |
|
649 |
+ QDMCTone *t = &s->tones[4][w]; |
|
650 |
+ |
|
651 |
+ if (current_subframe < t->offset) |
|
652 |
+ break; |
|
653 |
+ add_wave0(s, t->offset, t->freq, t->mode, t->amplitude, t->phase); |
|
654 |
+ } |
|
655 |
+ s->cur_tone[4] = w; |
|
656 |
+} |
|
657 |
+ |
|
658 |
+static int decode_frame(QDMCContext *s, GetBitContext *gb, int16_t *out) |
|
659 |
+{ |
|
660 |
+ int ret, ch, i, n; |
|
661 |
+ |
|
662 |
+ if (skip_label(s, gb)) |
|
663 |
+ return AVERROR_INVALIDDATA; |
|
664 |
+ |
|
665 |
+ s->fft_offset = s->frame_size - s->fft_offset; |
|
666 |
+ s->buffer_ptr = &s->buffer[s->nb_channels * s->buffer_offset]; |
|
667 |
+ |
|
668 |
+ ret = read_noise_data(s, gb); |
|
669 |
+ if (ret < 0) |
|
670 |
+ return ret; |
|
671 |
+ |
|
672 |
+ ret = read_wave_data(s, gb); |
|
673 |
+ if (ret < 0) |
|
674 |
+ return ret; |
|
675 |
+ |
|
676 |
+ for (n = 0; n < 32; n++) { |
|
677 |
+ float *r; |
|
678 |
+ |
|
679 |
+ for (ch = 0; ch < s->nb_channels; ch++) |
|
680 |
+ add_noise(s, ch, n); |
|
681 |
+ |
|
682 |
+ add_waves(s, n); |
|
683 |
+ |
|
684 |
+ for (ch = 0; ch < s->nb_channels; ch++) { |
|
685 |
+ for (i = 0; i < s->subframe_size; i++) { |
|
686 |
+ s->cmplx[ch][i].re = s->fft_buffer[ch + 2][s->fft_offset + n * s->subframe_size + i]; |
|
687 |
+ s->cmplx[ch][i].im = s->fft_buffer[ch + 0][s->fft_offset + n * s->subframe_size + i]; |
|
688 |
+ s->cmplx[ch][s->subframe_size + i].re = 0; |
|
689 |
+ s->cmplx[ch][s->subframe_size + i].im = 0; |
|
690 |
+ } |
|
691 |
+ } |
|
692 |
+ |
|
693 |
+ for (ch = 0; ch < s->nb_channels; ch++) { |
|
694 |
+ s->fft_ctx.fft_permute(&s->fft_ctx, s->cmplx[ch]); |
|
695 |
+ s->fft_ctx.fft_calc(&s->fft_ctx, s->cmplx[ch]); |
|
696 |
+ } |
|
697 |
+ |
|
698 |
+ r = &s->buffer_ptr[s->nb_channels * n * s->subframe_size]; |
|
699 |
+ for (i = 0; i < 2 * s->subframe_size; i++) { |
|
700 |
+ for (ch = 0; ch < s->nb_channels; ch++) { |
|
701 |
+ *r++ += s->cmplx[ch][i].re; |
|
702 |
+ } |
|
703 |
+ } |
|
704 |
+ |
|
705 |
+ r = &s->buffer_ptr[n * s->subframe_size * s->nb_channels]; |
|
706 |
+ for (i = 0; i < s->nb_channels * s->subframe_size; i++) { |
|
707 |
+ out[i] = av_clipf(r[i], INT16_MIN, INT16_MAX); |
|
708 |
+ } |
|
709 |
+ out += s->subframe_size * s->nb_channels; |
|
710 |
+ |
|
711 |
+ for (ch = 0; ch < s->nb_channels; ch++) { |
|
712 |
+ memset(s->fft_buffer[ch+0] + s->fft_offset + n * s->subframe_size, 0, 4 * s->subframe_size); |
|
713 |
+ memset(s->fft_buffer[ch+2] + s->fft_offset + n * s->subframe_size, 0, 4 * s->subframe_size); |
|
714 |
+ } |
|
715 |
+ memset(s->buffer + s->nb_channels * (n * s->subframe_size + s->frame_size + s->buffer_offset), 0, 4 * s->subframe_size * s->nb_channels); |
|
716 |
+ } |
|
717 |
+ |
|
718 |
+ s->buffer_offset += s->frame_size; |
|
719 |
+ if (s->buffer_offset >= 32768 - s->frame_size) { |
|
720 |
+ memcpy(s->buffer, &s->buffer[s->nb_channels * s->buffer_offset], 4 * s->frame_size * s->nb_channels); |
|
721 |
+ s->buffer_offset = 0; |
|
722 |
+ } |
|
723 |
+ |
|
724 |
+ return 0; |
|
725 |
+} |
|
726 |
+ |
|
727 |
+static av_cold void qdmc_flush(AVCodecContext *avctx) |
|
728 |
+{ |
|
729 |
+ QDMCContext *s = avctx->priv_data; |
|
730 |
+ |
|
731 |
+ memset(s->buffer, 0, sizeof(s->buffer)); |
|
732 |
+ memset(s->fft_buffer, 0, sizeof(s->fft_buffer)); |
|
733 |
+ s->fft_offset = 0; |
|
734 |
+ s->buffer_offset = 0; |
|
735 |
+} |
|
736 |
+ |
|
737 |
+static int qdmc_decode_frame(AVCodecContext *avctx, void *data, |
|
738 |
+ int *got_frame_ptr, AVPacket *avpkt) |
|
739 |
+{ |
|
740 |
+ QDMCContext *s = avctx->priv_data; |
|
741 |
+ AVFrame *frame = data; |
|
742 |
+ GetBitContext gb; |
|
743 |
+ int ret; |
|
744 |
+ |
|
745 |
+ if (!avpkt->data) |
|
746 |
+ return 0; |
|
747 |
+ if (avpkt->size < s->checksum_size) |
|
748 |
+ return AVERROR_INVALIDDATA; |
|
749 |
+ |
|
750 |
+ s->avctx = avctx; |
|
751 |
+ frame->nb_samples = s->frame_size; |
|
752 |
+ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) |
|
753 |
+ return ret; |
|
754 |
+ |
|
755 |
+ if ((ret = init_get_bits8(&gb, avpkt->data, s->checksum_size)) < 0) |
|
756 |
+ return ret; |
|
757 |
+ |
|
758 |
+ memset(s->nb_tones, 0, sizeof(s->nb_tones)); |
|
759 |
+ memset(s->cur_tone, 0, sizeof(s->cur_tone)); |
|
760 |
+ |
|
761 |
+ ret = decode_frame(s, &gb, (int16_t *)frame->data[0]); |
|
762 |
+ if (ret >= 0) { |
|
763 |
+ *got_frame_ptr = 1; |
|
764 |
+ return s->checksum_size; |
|
765 |
+ } |
|
766 |
+ qdmc_flush(avctx); |
|
767 |
+ return ret; |
|
768 |
+} |
|
769 |
+ |
|
770 |
+AVCodec ff_qdmc_decoder = { |
|
771 |
+ .name = "qdmc", |
|
772 |
+ .long_name = NULL_IF_CONFIG_SMALL("QDesign Music Codec 1"), |
|
773 |
+ .type = AVMEDIA_TYPE_AUDIO, |
|
774 |
+ .id = AV_CODEC_ID_QDMC, |
|
775 |
+ .priv_data_size = sizeof(QDMCContext), |
|
776 |
+ .init = qdmc_decode_init, |
|
777 |
+ .init_static_data = qdmc_init_static_data, |
|
778 |
+ .close = qdmc_decode_close, |
|
779 |
+ .decode = qdmc_decode_frame, |
|
780 |
+ .flush = qdmc_flush, |
|
781 |
+ .capabilities = AV_CODEC_CAP_DR1, |
|
782 |
+}; |
... | ... |
@@ -28,8 +28,8 @@ |
28 | 28 |
#include "libavutil/version.h" |
29 | 29 |
|
30 | 30 |
#define LIBAVCODEC_VERSION_MAJOR 57 |
31 |
-#define LIBAVCODEC_VERSION_MINOR 70 |
|
32 |
-#define LIBAVCODEC_VERSION_MICRO 101 |
|
31 |
+#define LIBAVCODEC_VERSION_MINOR 71 |
|
32 |
+#define LIBAVCODEC_VERSION_MICRO 100 |
|
33 | 33 |
|
34 | 34 |
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
35 | 35 |
LIBAVCODEC_VERSION_MINOR, \ |