FFmpeg
Loading...
Searching...
No Matches
ralf.c
Go to the documentation of this file.
1/*
2 * RealAudio Lossless decoder
3 *
4 * Copyright (c) 2012 Konstantin Shishkov
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23/**
24 * @file
25 * This is a decoder for Real Audio Lossless format.
26 * Dedicated to the mastermind behind it, Ralph Wiggum.
27 */
28
31#include "avcodec.h"
32#include "codec_internal.h"
33#include "decode.h"
34#include "get_bits.h"
35#include "golomb.h"
36#include "unary.h"
37#include "ralfdata.h"
38
39#define FILTER_NONE 0
40#define FILTER_RAW 642
41
50
51#define RALF_MAX_PKT_SIZE 8192
52
53typedef struct RALFContext {
58
59 int filter_params; ///< combined filter parameters for the current channel data
60 int filter_length; ///< length of the filter for the current channel data
61 int filter_bits; ///< filter precision for the current channel data
63
64 unsigned bias[2]; ///< a constant value added to channel data after filtering
65
67 int block_size[1 << 12]; ///< size of the blocks
68 int block_pts[1 << 12]; ///< block start time (in milliseconds)
69
70 uint8_t pkt[16384];
73
74#define MAX_ELEMS 644 // no RALF table uses more than that
75
76static av_cold int init_ralf_vlc(VLC *vlc, const uint8_t *data, int elems)
77{
78 uint8_t lens[MAX_ELEMS];
79 uint16_t codes[MAX_ELEMS];
80 int counts[17], prefixes[18];
81 int i, cur_len;
82 int max_bits = 0;
83 int nb = 0;
84
85 for (i = 0; i <= 16; i++)
86 counts[i] = 0;
87 for (i = 0; i < elems; i++) {
88 cur_len = (nb ? *data & 0xF : *data >> 4) + 1;
89 counts[cur_len]++;
90 max_bits = FFMAX(max_bits, cur_len);
91 lens[i] = cur_len;
92 data += nb;
93 nb ^= 1;
94 }
95 prefixes[1] = 0;
96 for (i = 1; i <= 16; i++)
97 prefixes[i + 1] = (prefixes[i] + counts[i]) << 1;
98
99 for (i = 0; i < elems; i++)
100 codes[i] = prefixes[lens[i]]++;
101
102 return ff_vlc_init_sparse(vlc, FFMIN(max_bits, 9), elems,
103 lens, 1, 1, codes, 2, 2, NULL, 0, 0, 0);
104}
105
107{
108 RALFContext *ctx = avctx->priv_data;
109 int i, j, k;
110
111 for (i = 0; i < 3; i++) {
112 ff_vlc_free(&ctx->sets[i].filter_params);
113 ff_vlc_free(&ctx->sets[i].bias);
114 ff_vlc_free(&ctx->sets[i].coding_mode);
115 for (j = 0; j < 10; j++)
116 for (k = 0; k < 11; k++)
117 ff_vlc_free(&ctx->sets[i].filter_coeffs[j][k]);
118 for (j = 0; j < 15; j++)
119 ff_vlc_free(&ctx->sets[i].short_codes[j]);
120 for (j = 0; j < 125; j++)
121 ff_vlc_free(&ctx->sets[i].long_codes[j]);
122 }
123
124 return 0;
125}
126
128{
129 RALFContext *ctx = avctx->priv_data;
130 int i, j, k;
131 int ret, channels;
132
133 if (avctx->extradata_size < 24 || memcmp(avctx->extradata, "LSD:", 4)) {
134 av_log(avctx, AV_LOG_ERROR, "Extradata is not groovy, dude\n");
135 return AVERROR_INVALIDDATA;
136 }
137
138 ctx->version = AV_RB16(avctx->extradata + 4);
139 if (ctx->version != 0x103) {
140 avpriv_request_sample(avctx, "Unknown version %X", ctx->version);
142 }
143
144 channels = AV_RB16(avctx->extradata + 8);
145 avctx->sample_rate = AV_RB32(avctx->extradata + 12);
147 || avctx->sample_rate < 8000 || avctx->sample_rate > 96000) {
148 av_log(avctx, AV_LOG_ERROR, "Invalid coding parameters %d Hz %d ch\n",
149 avctx->sample_rate, channels);
150 return AVERROR_INVALIDDATA;
151 }
155
156 ctx->max_frame_size = AV_RB32(avctx->extradata + 16);
157 if (ctx->max_frame_size > (1 << 20) || !ctx->max_frame_size) {
158 av_log(avctx, AV_LOG_ERROR, "invalid frame size %d\n",
159 ctx->max_frame_size);
160 return AVERROR_INVALIDDATA;
161 }
162 ctx->max_frame_size = FFMAX(ctx->max_frame_size, avctx->sample_rate);
163
164 for (i = 0; i < 3; i++) {
165 ret = init_ralf_vlc(&ctx->sets[i].filter_params, filter_param_def[i],
167 if (ret < 0)
168 return ret;
169 ret = init_ralf_vlc(&ctx->sets[i].bias, bias_def[i], BIAS_ELEMENTS);
170 if (ret < 0)
171 return ret;
172 ret = init_ralf_vlc(&ctx->sets[i].coding_mode, coding_mode_def[i],
174 if (ret < 0)
175 return ret;
176 for (j = 0; j < 10; j++) {
177 for (k = 0; k < 11; k++) {
178 ret = init_ralf_vlc(&ctx->sets[i].filter_coeffs[j][k],
179 filter_coeffs_def[i][j][k],
181 if (ret < 0)
182 return ret;
183 }
184 }
185 for (j = 0; j < 15; j++) {
186 ret = init_ralf_vlc(&ctx->sets[i].short_codes[j],
188 if (ret < 0)
189 return ret;
190 }
191 for (j = 0; j < 125; j++) {
192 ret = init_ralf_vlc(&ctx->sets[i].long_codes[j],
194 if (ret < 0)
195 return ret;
196 }
197 }
198
199 return 0;
200}
201
202static inline int extend_code(GetBitContext *gb, int val, int range, int bits)
203{
204 if (val == 0) {
205 val = -range - get_ue_golomb(gb);
206 } else if (val == range * 2) {
207 val = range + get_ue_golomb(gb);
208 } else {
209 val -= range;
210 }
211 if (bits)
212 val = ((unsigned)val << bits) | get_bits(gb, bits);
213 return val;
214}
215
217 int length, int mode, int bits)
218{
219 int i, t;
220 int code_params;
221 VLCSet *set = ctx->sets + mode;
222 VLC *code_vlc; int range, range2, add_bits;
223 int *dst = ctx->channel_data[ch];
224
225 ctx->filter_params = get_vlc2(gb, set->filter_params.table, 9, 2);
226 if (ctx->filter_params > 1) {
227 ctx->filter_bits = (ctx->filter_params - 2) >> 6;
228 ctx->filter_length = ctx->filter_params - (ctx->filter_bits << 6) - 1;
229 }
230
231 if (ctx->filter_params == FILTER_RAW) {
232 for (i = 0; i < length; i++)
233 dst[i] = get_bits(gb, bits);
234 ctx->bias[ch] = 0;
235 return 0;
236 }
237
238 ctx->bias[ch] = get_vlc2(gb, set->bias.table, 9, 2);
239 ctx->bias[ch] = extend_code(gb, ctx->bias[ch], 127, 4);
240
241 if (ctx->filter_params == FILTER_NONE) {
242 memset(dst, 0, sizeof(*dst) * length);
243 return 0;
244 }
245
246 if (ctx->filter_params > 1) {
247 int cmode = 0, coeff = 0;
248 VLC *vlc = set->filter_coeffs[ctx->filter_bits] + 5;
249
250 add_bits = ctx->filter_bits;
251
252 for (i = 0; i < ctx->filter_length; i++) {
253 t = get_vlc2(gb, vlc[cmode].table, vlc[cmode].bits, 2);
254 t = extend_code(gb, t, 21, add_bits);
255 if (!cmode)
256 coeff -= 12U << add_bits;
257 coeff = (unsigned)t - coeff;
258 ctx->filter[i] = coeff;
259
260 cmode = coeff >> add_bits;
261 if (cmode < 0) {
262 cmode = -1 - av_log2(-cmode);
263 if (cmode < -5)
264 cmode = -5;
265 } else if (cmode > 0) {
266 cmode = 1 + av_log2(cmode);
267 if (cmode > 5)
268 cmode = 5;
269 }
270 }
271 }
272
273 code_params = get_vlc2(gb, set->coding_mode.table, set->coding_mode.bits, 2);
274 if (code_params >= 15) {
275 add_bits = av_clip((code_params / 5 - 3) / 2, 0, 10);
276 if (add_bits > 9 && (code_params % 5) != 2)
277 add_bits--;
278 range = 10;
279 range2 = 21;
280 code_vlc = set->long_codes + (code_params - 15);
281 } else {
282 add_bits = 0;
283 range = 6;
284 range2 = 13;
285 code_vlc = set->short_codes + code_params;
286 }
287
288 for (i = 0; i < length; i += 2) {
289 int code1, code2;
290
291 t = get_vlc2(gb, code_vlc->table, code_vlc->bits, 2);
292 code1 = t / range2;
293 code2 = t % range2;
294 dst[i] = extend_code(gb, code1, range, 0) * (1U << add_bits);
295 dst[i + 1] = extend_code(gb, code2, range, 0) * (1U << add_bits);
296 if (add_bits) {
297 dst[i] |= get_bits(gb, add_bits);
298 dst[i + 1] |= get_bits(gb, add_bits);
299 }
300 }
301
302 return 0;
303}
304
305static void apply_lpc(RALFContext *ctx, int ch, int length, int bits)
306{
307 int i, j, acc;
308 int *audio = ctx->channel_data[ch];
309 int bias = 1 << (ctx->filter_bits - 1);
310 int max_clip = (1 << bits) - 1, min_clip = -max_clip - 1;
311
312 for (i = 1; i < length; i++) {
313 int flen = FFMIN(ctx->filter_length, i);
314
315 acc = 0;
316 for (j = 0; j < flen; j++)
317 acc += (unsigned)ctx->filter[j] * audio[i - j - 1];
318 if (acc < 0) {
319 acc = (acc + bias - 1) >> ctx->filter_bits;
320 acc = FFMAX(acc, min_clip);
321 } else {
322 acc = ((unsigned)acc + bias) >> ctx->filter_bits;
323 acc = FFMIN(acc, max_clip);
324 }
325 audio[i] += acc;
326 }
327}
328
330 int16_t *dst0, int16_t *dst1)
331{
332 RALFContext *ctx = avctx->priv_data;
333 int len, ch, ret;
334 int dmode, mode[2], bits[2];
335 int *ch0, *ch1;
336 int i;
337 unsigned int t, t2;
338
339 len = 12 - get_unary(gb, 0, 6);
340
341 if (len <= 7) len ^= 1; // codes for length = 6 and 7 are swapped
342 len = 1 << len;
343
344 if (ctx->sample_offset + len > ctx->max_frame_size) {
345 av_log(avctx, AV_LOG_ERROR,
346 "Decoder's stomach is crying, it ate too many samples\n");
347 return AVERROR_INVALIDDATA;
348 }
349
350 if (avctx->ch_layout.nb_channels > 1)
351 dmode = get_bits(gb, 2) + 1;
352 else
353 dmode = 0;
354
355 mode[0] = (dmode == 4) ? 1 : 0;
356 mode[1] = (dmode >= 2) ? 2 : 0;
357 bits[0] = 16;
358 bits[1] = (mode[1] == 2) ? 17 : 16;
359
360 for (ch = 0; ch < avctx->ch_layout.nb_channels; ch++) {
361 if ((ret = decode_channel(ctx, gb, ch, len, mode[ch], bits[ch])) < 0)
362 return ret;
363 if (ctx->filter_params > 1 && ctx->filter_params != FILTER_RAW) {
364 ctx->filter_bits += 3;
365 apply_lpc(ctx, ch, len, bits[ch]);
366 }
367 if (get_bits_left(gb) < 0)
368 return AVERROR_INVALIDDATA;
369 }
370 ch0 = ctx->channel_data[0];
371 ch1 = ctx->channel_data[1];
372 switch (dmode) {
373 case 0:
374 for (i = 0; i < len; i++)
375 dst0[i] = ch0[i] + ctx->bias[0];
376 break;
377 case 1:
378 for (i = 0; i < len; i++) {
379 dst0[i] = ch0[i] + ctx->bias[0];
380 dst1[i] = ch1[i] + ctx->bias[1];
381 }
382 break;
383 case 2:
384 for (i = 0; i < len; i++) {
385 ch0[i] += ctx->bias[0];
386 dst0[i] = ch0[i];
387 dst1[i] = ch0[i] - (ch1[i] + ctx->bias[1]);
388 }
389 break;
390 case 3:
391 for (i = 0; i < len; i++) {
392 t = ch0[i] + ctx->bias[0];
393 t2 = ch1[i] + ctx->bias[1];
394 dst0[i] = t + t2;
395 dst1[i] = t;
396 }
397 break;
398 case 4:
399 for (i = 0; i < len; i++) {
400 t = ch1[i] + ctx->bias[1];
401 t2 = ((ch0[i] + ctx->bias[0]) * 2) | (t & 1);
402 dst0[i] = (int)(t2 + t) / 2;
403 dst1[i] = (int)(t2 - t) / 2;
404 }
405 break;
406 }
407
408 ctx->sample_offset += len;
409
410 return 0;
411}
412
414 int *got_frame_ptr, AVPacket *avpkt)
415{
416 RALFContext *ctx = avctx->priv_data;
417 int16_t *samples0;
418 int16_t *samples1;
419 int ret;
420 GetBitContext gb;
421 int table_size, table_bytes, num_blocks;
422 const uint8_t *src, *block_pointer;
423 int src_size;
424 int bytes_left;
425
426 if (ctx->has_pkt) {
427 ctx->has_pkt = 0;
428 table_bytes = (AV_RB16(avpkt->data) + 7) >> 3;
429 if (table_bytes + 3 > avpkt->size || avpkt->size > RALF_MAX_PKT_SIZE) {
430 av_log(avctx, AV_LOG_ERROR, "Wrong packet's breath smells of wrong data!\n");
431 return AVERROR_INVALIDDATA;
432 }
433 if (memcmp(ctx->pkt, avpkt->data, 2 + table_bytes)) {
434 av_log(avctx, AV_LOG_ERROR, "Wrong packet tails are wrong!\n");
435 return AVERROR_INVALIDDATA;
436 }
437
438 src = ctx->pkt;
439 src_size = RALF_MAX_PKT_SIZE + avpkt->size;
440 memcpy(ctx->pkt + RALF_MAX_PKT_SIZE, avpkt->data + 2 + table_bytes,
441 avpkt->size - 2 - table_bytes);
442 } else {
443 if (avpkt->size == RALF_MAX_PKT_SIZE) {
444 memcpy(ctx->pkt, avpkt->data, avpkt->size);
445 ctx->has_pkt = 1;
446 *got_frame_ptr = 0;
447
448 return avpkt->size;
449 }
450 src = avpkt->data;
451 src_size = avpkt->size;
452 }
453
454 if (src_size < 5) {
455 av_log(avctx, AV_LOG_ERROR, "too short packets are too short!\n");
456 return AVERROR_INVALIDDATA;
457 }
458 table_size = AV_RB16(src);
459 table_bytes = (table_size + 7) >> 3;
460 if (src_size < table_bytes + 3) {
461 av_log(avctx, AV_LOG_ERROR, "short packets are short!\n");
462 return AVERROR_INVALIDDATA;
463 }
464 init_get_bits(&gb, src + 2, table_size);
465 num_blocks = 0;
466 while (get_bits_left(&gb) > 0) {
467 if (num_blocks >= FF_ARRAY_ELEMS(ctx->block_size))
468 return AVERROR_INVALIDDATA;
469 ctx->block_size[num_blocks] = get_bits(&gb, 13 + avctx->ch_layout.nb_channels);
470 if (get_bits1(&gb)) {
471 ctx->block_pts[num_blocks] = get_bits(&gb, 9);
472 } else {
473 ctx->block_pts[num_blocks] = 0;
474 }
475 num_blocks++;
476 }
477
478 frame->nb_samples = ctx->max_frame_size;
479 if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
480 return ret;
481 samples0 = (int16_t *)frame->data[0];
482 samples1 = (int16_t *)frame->data[1];
483 block_pointer = src + table_bytes + 2;
484 bytes_left = src_size - table_bytes - 2;
485 ctx->sample_offset = 0;
486 for (int i = 0; i < num_blocks; i++) {
487 if (bytes_left < ctx->block_size[i]) {
488 av_log(avctx, AV_LOG_ERROR, "I'm pedaling backwards\n");
489 break;
490 }
491 init_get_bits(&gb, block_pointer, ctx->block_size[i] * 8);
492 if (decode_block(avctx, &gb, samples0 + ctx->sample_offset,
493 samples1 + ctx->sample_offset) < 0) {
494 av_log(avctx, AV_LOG_ERROR, "Sir, I got carsick in your office. Not decoding the rest of packet.\n");
495 break;
496 }
497 block_pointer += ctx->block_size[i];
498 bytes_left -= ctx->block_size[i];
499 }
500
501 frame->nb_samples = ctx->sample_offset;
502 *got_frame_ptr = ctx->sample_offset > 0;
503
504 return avpkt->size;
505}
506
508{
509 RALFContext *ctx = avctx->priv_data;
510
511 ctx->has_pkt = 0;
512}
513
514
516 .p.name = "ralf",
517 CODEC_LONG_NAME("RealAudio Lossless"),
518 .p.type = AVMEDIA_TYPE_AUDIO,
519 .p.id = AV_CODEC_ID_RALF,
520 .priv_data_size = sizeof(RALFContext),
521 .init = decode_init,
524 .flush = decode_flush,
525 .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF |
527 .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
528};
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static double val(void *priv, double ch)
Definition aeval.c:77
static av_cold void decode_flush(AVCodecContext *avctx)
Definition agm.c:1253
const FFCodec ff_ralf_decoder
Definition ralf.c:515
static AVFormatContext * ctx
channels
Definition aptx.h:31
static av_cold void close(AVCodecParserContext *s)
Definition apv_parser.c:197
int32_t
Libavcodec external API header.
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
Public libavutil channel layout APIs header.
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define av_clip
Definition common.h:100
#define NULL
Definition coverity.c:32
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition decode.c:1777
static AVFrame * frame
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
static const uint8_t bits[8]
Definition fastaudio.c:100
bitstream reader API header.
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
Definition get_bits.h:645
static int get_bits_left(GetBitContext *gb)
Definition get_bits.h:688
static unsigned int get_bits1(GetBitContext *s)
Definition get_bits.h:391
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition get_bits.h:337
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition get_bits.h:517
exp golomb vlc stuff
static int get_ue_golomb(GetBitContext *gb)
Read an unsigned Exp-Golomb code in the range 0 to 8190.
Definition golomb.h:53
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition codec.h:94
@ AV_CODEC_ID_RALF
Definition codec_id.h:510
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition error.h:64
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition error.h:61
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition samplefmt.h:64
#define av_log2
Definition intmath.h:84
#define AV_RB32(p)
#define AV_RB16(p)
static av_cold int decode_init(AVCodecContext *avctx)
Definition 4xm.c:998
static int decode_frame(AVCodecContext *avctx, AVFrame *picture, int *got_frame, AVPacket *avpkt)
Definition 4xm.c:837
static av_cold int decode_close(AVCodecContext *avctx)
Definition aacdec.c:1220
Macro definitions for various function/variable attributes.
#define av_cold
Definition attributes.h:117
#define FFMIN(a, b)
Definition macros.h:49
#define FFMAX(a, b)
Definition macros.h:47
enum AVColorRange range
const char data[16]
Definition mxf.c:149
static const uint16_t table[]
Definition prosumer.c:203
static av_cold void decode_flush(AVCodecContext *avctx)
Definition ralf.c:507
static int extend_code(GetBitContext *gb, int val, int range, int bits)
Definition ralf.c:202
#define MAX_ELEMS
Definition ralf.c:74
static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition ralf.c:413
static av_cold int init_ralf_vlc(VLC *vlc, const uint8_t *data, int elems)
Definition ralf.c:76
static av_cold int decode_close(AVCodecContext *avctx)
Definition ralf.c:106
#define FILTER_RAW
Definition ralf.c:40
static av_cold int decode_init(AVCodecContext *avctx)
Definition ralf.c:127
#define FILTER_NONE
Definition ralf.c:39
#define RALF_MAX_PKT_SIZE
Definition ralf.c:51
static int decode_channel(RALFContext *ctx, GetBitContext *gb, int ch, int length, int mode, int bits)
Definition ralf.c:216
static int decode_block(AVCodecContext *avctx, GetBitContext *gb, int16_t *dst0, int16_t *dst1)
Definition ralf.c:329
static void apply_lpc(RALFContext *ctx, int ch, int length, int bits)
Definition ralf.c:305
static const uint8_t filter_coeffs_def[3][10][11][24]
Definition ralfdata.h:188
#define BIAS_ELEMENTS
Definition ralfdata.h:29
static const uint8_t long_codes_def[3][125][224]
Definition ralfdata.h:2036
static const uint8_t filter_param_def[3][324]
Definition ralfdata.h:35
#define CODING_MODE_ELEMENTS
Definition ralfdata.h:30
#define SHORT_CODES_ELEMENTS
Definition ralfdata.h:32
static const uint8_t bias_def[3][128]
Definition ralfdata.h:123
#define FILTER_COEFFS_ELEMENTS
Definition ralfdata.h:31
#define LONG_CODES_ELEMENTS
Definition ralfdata.h:33
static const uint8_t short_codes_def[3][15][88]
Definition ralfdata.h:1577
static const uint8_t coding_mode_def[3][72]
Definition ralfdata.h:163
#define FILTERPARAM_ELEMENTS
Definition ralfdata.h:28
#define FF_ARRAY_ELEMS(a)
int nb_channels
Number of channels in this layout.
main external API structure.
Definition avcodec.h:443
AVChannelLayout ch_layout
Audio channel layout.
Definition avcodec.h:1055
enum AVSampleFormat sample_fmt
audio sample format
Definition avcodec.h:1047
int sample_rate
samples per second
Definition avcodec.h:1040
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
Definition avcodec.h:526
int extradata_size
Definition avcodec.h:527
void * priv_data
Definition avcodec.h:470
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
This structure stores compressed data.
Definition packet.h:580
int size
Definition packet.h:604
uint8_t * data
Definition packet.h:603
int block_size[1<< 12]
size of the blocks
Definition ralf.c:67
int32_t filter[64]
Definition ralf.c:62
uint8_t pkt[16384]
Definition ralf.c:70
int version
Definition ralf.c:54
int filter_length
length of the filter for the current channel data
Definition ralf.c:60
VLCSet sets[3]
Definition ralf.c:56
unsigned bias[2]
a constant value added to channel data after filtering
Definition ralf.c:64
int32_t channel_data[2][4096]
Definition ralf.c:57
int block_pts[1<< 12]
block start time (in milliseconds)
Definition ralf.c:68
int filter_params
combined filter parameters for the current channel data
Definition ralf.c:59
int filter_bits
filter precision for the current channel data
Definition ralf.c:61
int sample_offset
Definition ralf.c:66
int has_pkt
Definition ralf.c:71
int max_frame_size
Definition ralf.c:55
Definition ralf.c:42
VLC short_codes[15]
Definition ralf.c:47
VLC filter_params
Definition ralf.c:43
VLC coding_mode
Definition ralf.c:45
VLC long_codes[125]
Definition ralf.c:48
VLC bias
Definition ralf.c:44
VLC filter_coeffs[10][11]
Definition ralf.c:46
Definition vlc.h:50
Definition swscale.c:71
#define avpriv_request_sample(...)
#define av_log(a,...)
#define src
Definition vp8dsp.c:248
static void set(uint8_t *a[], int ch, int index, int ch_count, enum AVSampleFormat f, double v)
Definition swresample.c:55
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
Definition unary.h:46
static const double coeff[2][5]
int ff_vlc_init_sparse(VLC *vlc, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, const void *symbols, int symbols_wrap, int symbols_size, int flags)
Build VLC decoding tables suitable for use with get_vlc2().
Definition vlc.c:250
void ff_vlc_free(VLC *vlc)
Definition vlc.c:580
int len
static int bias(int x, int c)
Definition vqcdec.c:115
static VLCElem code_vlc[1<< CODE_VLC_BITS]
Definition wnv1.c:42