FFmpeg
binkaudio.c
Go to the documentation of this file.
1 /*
2  * Bink Audio decoder
3  * Copyright (c) 2007-2011 Peter Ross (pross@xvid.org)
4  * Copyright (c) 2009 Daniel Verkamp (daniel@drv.nu)
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  * Bink Audio decoder
26  *
27  * Technical details here:
28  * http://wiki.multimedia.cx/index.php?title=Bink_Audio
29  */
30 
31 #include "config_components.h"
32 
34 #include "libavutil/intfloat.h"
35 #include "libavutil/mem_internal.h"
36 #include "libavutil/tx.h"
37 
38 #define BITSTREAM_READER_LE
39 #include "avcodec.h"
40 #include "decode.h"
41 #include "get_bits.h"
42 #include "codec_internal.h"
43 #include "internal.h"
44 #include "wma_freqs.h"
45 
46 #define MAX_DCT_CHANNELS 6
47 #define MAX_CHANNELS 2
48 #define BINK_BLOCK_MAX_SIZE (MAX_CHANNELS << 11)
49 
50 typedef struct BinkAudioContext {
52  int version_b; ///< Bink version 'b'
53  int first;
54  int channels;
55  int ch_offset;
56  int frame_len; ///< transform size (samples)
57  int overlap_len; ///< overlap size (samples)
59  int num_bands;
60  float root;
61  unsigned int bands[26];
62  float previous[MAX_DCT_CHANNELS][BINK_BLOCK_MAX_SIZE / 16]; ///< coeffs from previous audio block
63  float quant_table[96];
68 
69 
71 {
72  BinkAudioContext *s = avctx->priv_data;
73  int sample_rate = avctx->sample_rate;
74  int sample_rate_half;
75  int i, ret;
76  int frame_len_bits;
77  int max_channels = avctx->codec->id == AV_CODEC_ID_BINKAUDIO_RDFT ? MAX_CHANNELS : MAX_DCT_CHANNELS;
78  int channels = avctx->ch_layout.nb_channels;
79 
80  /* determine frame length */
81  if (avctx->sample_rate < 22050) {
82  frame_len_bits = 9;
83  } else if (avctx->sample_rate < 44100) {
84  frame_len_bits = 10;
85  } else {
86  frame_len_bits = 11;
87  }
88 
89  if (channels < 1 || channels > max_channels) {
90  av_log(avctx, AV_LOG_ERROR, "invalid number of channels: %d\n", channels);
91  return AVERROR_INVALIDDATA;
92  }
95 
96  s->version_b = avctx->extradata_size >= 4 && avctx->extradata[3] == 'b';
97 
98  if (avctx->codec->id == AV_CODEC_ID_BINKAUDIO_RDFT) {
99  // audio is already interleaved for the RDFT format variant
100  avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
101  if (sample_rate > INT_MAX / channels)
102  return AVERROR_INVALIDDATA;
104  s->channels = 1;
105  if (!s->version_b)
106  frame_len_bits += av_log2(channels);
107  } else {
108  s->channels = channels;
110  }
111 
112  s->frame_len = 1 << frame_len_bits;
113  s->overlap_len = s->frame_len / 16;
114  s->block_size = (s->frame_len - s->overlap_len) * FFMIN(MAX_CHANNELS, s->channels);
115  sample_rate_half = (sample_rate + 1LL) / 2;
116  if (avctx->codec->id == AV_CODEC_ID_BINKAUDIO_RDFT)
117  s->root = 2.0 / (sqrt(s->frame_len) * 32768.0);
118  else
119  s->root = s->frame_len / (sqrt(s->frame_len) * 32768.0);
120  for (i = 0; i < 96; i++) {
121  /* constant is result of 0.066399999/log10(M_E) */
122  s->quant_table[i] = expf(i * 0.15289164787221953823f) * s->root;
123  }
124 
125  /* calculate number of bands */
126  for (s->num_bands = 1; s->num_bands < 25; s->num_bands++)
127  if (sample_rate_half <= ff_wma_critical_freqs[s->num_bands - 1])
128  break;
129 
130  /* populate bands data */
131  s->bands[0] = 2;
132  for (i = 1; i < s->num_bands; i++)
133  s->bands[i] = (ff_wma_critical_freqs[i - 1] * s->frame_len / sample_rate_half) & ~1;
134  s->bands[s->num_bands] = s->frame_len;
135 
136  s->first = 1;
137 
138  if (CONFIG_BINKAUDIO_RDFT_DECODER && avctx->codec->id == AV_CODEC_ID_BINKAUDIO_RDFT) {
139  float scale = 0.5;
140  ret = av_tx_init(&s->tx, &s->tx_fn, AV_TX_FLOAT_RDFT, 1, 1 << frame_len_bits, &scale, 0);
141  } else if (CONFIG_BINKAUDIO_DCT_DECODER) {
142  float scale = 1.0 / (1 << frame_len_bits);
143  ret = av_tx_init(&s->tx, &s->tx_fn, AV_TX_FLOAT_DCT, 1, 1 << (frame_len_bits - 1), &scale, 0);
144  } else {
145  av_assert0(0);
146  }
147  if (ret < 0)
148  return ret;
149 
150  s->pkt = avctx->internal->in_pkt;
151 
152  return 0;
153 }
154 
155 static float get_float(GetBitContext *gb)
156 {
157  int power = get_bits(gb, 5);
158  float f = ldexpf(get_bits(gb, 23), power - 23);
159  if (get_bits1(gb))
160  f = -f;
161  return f;
162 }
163 
164 static const uint8_t rle_length_tab[16] = {
165  2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 64
166 };
167 
168 /**
169  * Decode Bink Audio block
170  * @param[out] out Output buffer (must contain s->block_size elements)
171  * @return 0 on success, negative error code on failure
172  */
173 static int decode_block(BinkAudioContext *s, float **out, int use_dct,
174  int channels, int ch_offset)
175 {
176  int ch, i, j, k;
177  float q, quant[25];
178  int width, coeff;
179  GetBitContext *gb = &s->gb;
180  LOCAL_ALIGNED_32(float, coeffs, [4098]);
181 
182  if (use_dct)
183  skip_bits(gb, 2);
184 
185  for (ch = 0; ch < channels; ch++) {
186  if (s->version_b) {
187  if (get_bits_left(gb) < 64)
188  return AVERROR_INVALIDDATA;
189  coeffs[0] = av_int2float(get_bits_long(gb, 32)) * s->root;
190  coeffs[1] = av_int2float(get_bits_long(gb, 32)) * s->root;
191  } else {
192  if (get_bits_left(gb) < 58)
193  return AVERROR_INVALIDDATA;
194  coeffs[0] = get_float(gb) * s->root;
195  coeffs[1] = get_float(gb) * s->root;
196  }
197 
198  if (get_bits_left(gb) < s->num_bands * 8)
199  return AVERROR_INVALIDDATA;
200  for (i = 0; i < s->num_bands; i++) {
201  int value = get_bits(gb, 8);
202  quant[i] = s->quant_table[FFMIN(value, 95)];
203  }
204 
205  k = 0;
206  q = quant[0];
207 
208  // parse coefficients
209  i = 2;
210  while (i < s->frame_len) {
211  if (s->version_b) {
212  j = i + 16;
213  } else {
214  int v = get_bits1(gb);
215  if (v) {
216  v = get_bits(gb, 4);
217  j = i + rle_length_tab[v] * 8;
218  } else {
219  j = i + 8;
220  }
221  }
222 
223  j = FFMIN(j, s->frame_len);
224 
225  width = get_bits(gb, 4);
226  if (width == 0) {
227  memset(coeffs + i, 0, (j - i) * sizeof(*coeffs));
228  i = j;
229  while (s->bands[k] < i)
230  q = quant[k++];
231  } else {
232  while (i < j) {
233  if (s->bands[k] == i)
234  q = quant[k++];
235  coeff = get_bits(gb, width);
236  if (coeff) {
237  int v;
238  v = get_bits1(gb);
239  if (v)
240  coeffs[i] = -q * coeff;
241  else
242  coeffs[i] = q * coeff;
243  } else {
244  coeffs[i] = 0.0f;
245  }
246  i++;
247  }
248  }
249  }
250 
251  if (CONFIG_BINKAUDIO_DCT_DECODER && use_dct) {
252  coeffs[0] /= 0.5;
253  s->tx_fn(s->tx, out[ch + ch_offset], coeffs, sizeof(float));
254  } else if (CONFIG_BINKAUDIO_RDFT_DECODER) {
255  for (int i = 2; i < s->frame_len; i += 2)
256  coeffs[i + 1] *= -1;
257 
258  coeffs[s->frame_len + 0] = coeffs[1];
259  coeffs[s->frame_len + 1] = coeffs[1] = 0;
260  s->tx_fn(s->tx, out[ch + ch_offset], coeffs, sizeof(AVComplexFloat));
261  }
262  }
263 
264  for (ch = 0; ch < channels; ch++) {
265  int j;
266  int count = s->overlap_len * channels;
267  if (!s->first) {
268  j = ch;
269  for (i = 0; i < s->overlap_len; i++, j += channels)
270  out[ch + ch_offset][i] = (s->previous[ch + ch_offset][i] * (count - j) +
271  out[ch + ch_offset][i] * j) / count;
272  }
273  memcpy(s->previous[ch + ch_offset], &out[ch + ch_offset][s->frame_len - s->overlap_len],
274  s->overlap_len * sizeof(*s->previous[ch + ch_offset]));
275  }
276 
277  s->first = 0;
278 
279  return 0;
280 }
281 
283 {
284  BinkAudioContext * s = avctx->priv_data;
285  av_tx_uninit(&s->tx);
286  return 0;
287 }
288 
290 {
291  int n = (-get_bits_count(s)) & 31;
292  if (n) skip_bits(s, n);
293 }
294 
296 {
297  BinkAudioContext *s = avctx->priv_data;
298  GetBitContext *gb = &s->gb;
299  int new_pkt, ret;
300 
301 again:
302  new_pkt = !s->pkt->data;
303  if (!s->pkt->data) {
304  ret = ff_decode_get_packet(avctx, s->pkt);
305  if (ret < 0) {
306  s->ch_offset = 0;
307  return ret;
308  }
309 
310  if (s->pkt->size < 4) {
311  av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
313  goto fail;
314  }
315 
316  ret = init_get_bits8(gb, s->pkt->data, s->pkt->size);
317  if (ret < 0)
318  goto fail;
319 
320  /* skip reported size */
321  skip_bits_long(gb, 32);
322  }
323 
324  /* get output buffer */
325  if (s->ch_offset == 0) {
326  frame->nb_samples = s->frame_len;
327  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
328  goto fail;
329  if (!new_pkt)
331  }
332 
333  if (decode_block(s, (float **)frame->extended_data,
335  FFMIN(MAX_CHANNELS, s->channels - s->ch_offset), s->ch_offset)) {
336  av_log(avctx, AV_LOG_ERROR, "Incomplete packet\n");
338  goto fail;
339  }
340  s->ch_offset += MAX_CHANNELS;
341  get_bits_align32(gb);
342  if (!get_bits_left(gb)) {
343  memset(gb, 0, sizeof(*gb));
344  av_packet_unref(s->pkt);
345  }
346  if (s->ch_offset >= s->channels) {
347  s->ch_offset = 0;
348  } else {
349  goto again;
350  }
351 
352  frame->nb_samples = s->block_size / FFMIN(avctx->ch_layout.nb_channels, MAX_CHANNELS);
353 
354  return 0;
355 fail:
356  s->ch_offset = 0;
357  av_packet_unref(s->pkt);
358  return ret;
359 }
360 
361 static void decode_flush(AVCodecContext *avctx)
362 {
363  BinkAudioContext *const s = avctx->priv_data;
364 
365  /* s->pkt coincides with avctx->internal->in_pkt
366  * and is unreferenced generically when flushing. */
367  s->first = 1;
368  s->ch_offset = 0;
369 }
370 
372  .p.name = "binkaudio_rdft",
373  CODEC_LONG_NAME("Bink Audio (RDFT)"),
374  .p.type = AVMEDIA_TYPE_AUDIO,
376  .priv_data_size = sizeof(BinkAudioContext),
377  .init = decode_init,
378  .flush = decode_flush,
379  .close = decode_end,
381  .p.capabilities = AV_CODEC_CAP_DR1,
382  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
383 };
384 
386  .p.name = "binkaudio_dct",
387  CODEC_LONG_NAME("Bink Audio (DCT)"),
388  .p.type = AVMEDIA_TYPE_AUDIO,
390  .priv_data_size = sizeof(BinkAudioContext),
391  .init = decode_init,
392  .flush = decode_flush,
393  .close = decode_end,
395  .p.capabilities = AV_CODEC_CAP_DR1,
396  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
397 };
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:427
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
skip_bits_long
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
Definition: get_bits.h:278
ff_decode_get_packet
int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
Called by decoders to get the next packet for decoding.
Definition: decode.c:220
BinkAudioContext::first
int first
Definition: binkaudio.c:53
BinkAudioContext::version_b
int version_b
Bink version 'b'.
Definition: binkaudio.c:52
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:695
mem_internal.h
out
FILE * out
Definition: movenc.c:54
AVCodecContext::sample_rate
int sample_rate
samples per second
Definition: avcodec.h:1050
wma_freqs.h
BinkAudioContext::channels
int channels
Definition: binkaudio.c:54
AVTXContext
Definition: tx_priv.h:235
get_bits_long
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
Definition: get_bits.h:421
get_float
static float get_float(GetBitContext *gb)
Definition: binkaudio.c:155
BINK_BLOCK_MAX_SIZE
#define BINK_BLOCK_MAX_SIZE
Definition: binkaudio.c:48
get_bits_count
static int get_bits_count(const GetBitContext *s)
Definition: get_bits.h:266
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:344
AVFrame::pts
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition: frame.h:456
internal.h
expf
#define expf(x)
Definition: libm.h:283
FFCodec
Definition: codec_internal.h:127
AVComplexFloat
Definition: tx.h:27
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:313
intfloat.h
sample_rate
sample_rate
Definition: ffmpeg_filter.c:409
av_tx_init
av_cold int av_tx_init(AVTXContext **ctx, av_tx_fn *tx, enum AVTXType type, int inv, int len, const void *scale, uint64_t flags)
Initialize a transform context with the given configuration (i)MDCTs with an odd length are currently...
Definition: tx.c:902
BinkAudioContext::gb
GetBitContext gb
Definition: binkaudio.c:51
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:381
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:335
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
AVCodecContext::codec
const struct AVCodec * codec
Definition: avcodec.h:454
BinkAudioContext::tx
AVTXContext * tx
Definition: binkaudio.c:65
AVCodecContext::ch_layout
AVChannelLayout ch_layout
Audio channel layout.
Definition: avcodec.h:1065
fail
#define fail()
Definition: checkasm.h:179
av_int2float
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
Definition: intfloat.h:40
GetBitContext
Definition: get_bits.h:108
quant
static const uint8_t quant[64]
Definition: vmixdec.c:71
BinkAudioContext
Definition: binkaudio.c:50
BinkAudioContext::quant_table
float quant_table[96]
Definition: binkaudio.c:63
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_cold
#define av_cold
Definition: attributes.h:90
init_get_bits8
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:545
av_tx_fn
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.
Definition: tx.h:151
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:524
width
#define width
s
#define s(width, name)
Definition: cbs_vp9.c:198
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
decode_end
static av_cold int decode_end(AVCodecContext *avctx)
Definition: binkaudio.c:282
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
binkaudio_receive_frame
static int binkaudio_receive_frame(AVCodecContext *avctx, AVFrame *frame)
Definition: binkaudio.c:295
AV_CODEC_ID_BINKAUDIO_DCT
@ AV_CODEC_ID_BINKAUDIO_DCT
Definition: codec_id.h:488
channels
channels
Definition: aptx.h:31
decode.h
get_bits.h
ff_wma_critical_freqs
const uint16_t ff_wma_critical_freqs[25]
Definition: wma_freqs.c:23
BinkAudioContext::ch_offset
int ch_offset
Definition: binkaudio.c:55
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
frame
static AVFrame * frame
Definition: demux_decode.c:54
ldexpf
#define ldexpf(x, exp)
Definition: libm.h:389
LOCAL_ALIGNED_32
#define LOCAL_ALIGNED_32(t, v,...)
Definition: mem_internal.h:156
BinkAudioContext::overlap_len
int overlap_len
overlap size (samples)
Definition: binkaudio.c:57
AVCodecContext::internal
struct AVCodecInternal * internal
Private context used for internal data.
Definition: avcodec.h:480
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:388
flush
void(* flush)(AVBSFContext *ctx)
Definition: dts2pts.c:367
MAX_DCT_CHANNELS
#define MAX_DCT_CHANNELS
Definition: binkaudio.c:46
decode_block
static int decode_block(BinkAudioContext *s, float **out, int use_dct, int channels, int ch_offset)
Decode Bink Audio block.
Definition: binkaudio.c:173
BinkAudioContext::pkt
AVPacket * pkt
Definition: binkaudio.c:64
ff_binkaudio_dct_decoder
const FFCodec ff_binkaudio_dct_decoder
Definition: binkaudio.c:385
f
f
Definition: af_crystalizer.c:121
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1569
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: vvc_intra.c:291
BinkAudioContext::previous
float previous[MAX_DCT_CHANNELS][BINK_BLOCK_MAX_SIZE/16]
coeffs from previous audio block
Definition: binkaudio.c:62
codec_internal.h
BinkAudioContext::root
float root
Definition: binkaudio.c:60
AVCodecContext::sample_fmt
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:1057
ff_binkaudio_rdft_decoder
const FFCodec ff_binkaudio_rdft_decoder
Definition: binkaudio.c:371
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:248
rle_length_tab
static const uint8_t rle_length_tab[16]
Definition: binkaudio.c:164
BinkAudioContext::frame_len
int frame_len
transform size (samples)
Definition: binkaudio.c:56
av_tx_uninit
av_cold void av_tx_uninit(AVTXContext **ctx)
Frees a context and sets *ctx to NULL, does nothing when *ctx == NULL.
Definition: tx.c:294
decode_init
static av_cold int decode_init(AVCodecContext *avctx)
Definition: binkaudio.c:70
AVCodec::id
enum AVCodecID id
Definition: codec.h:201
av_channel_layout_default
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
Definition: channel_layout.c:830
AVFrame::nb_samples
int nb_samples
number of audio samples (per channel) described by this frame
Definition: frame.h:424
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
AVCodecContext::extradata
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:523
get_bits_align32
static void get_bits_align32(GetBitContext *s)
Definition: binkaudio.c:289
AVFrame::extended_data
uint8_t ** extended_data
pointers to the data planes/channels.
Definition: frame.h:405
AVCodecInternal::in_pkt
AVPacket * in_pkt
This packet is used to hold the packet given to decoders implementing the .decode API; it is unused b...
Definition: internal.h:74
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
avcodec.h
ret
ret
Definition: filter_design.txt:187
AV_TX_FLOAT_RDFT
@ AV_TX_FLOAT_RDFT
Real to complex and complex to real DFTs.
Definition: tx.h:90
AVCodecContext
main external API structure.
Definition: avcodec.h:445
power
static float power(float r, float g, float b, float max)
Definition: preserve_color.h:45
channel_layout.h
FF_CODEC_RECEIVE_FRAME_CB
#define FF_CODEC_RECEIVE_FRAME_CB(func)
Definition: codec_internal.h:293
again
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining again
Definition: filter_design.txt:25
BinkAudioContext::tx_fn
av_tx_fn tx_fn
Definition: binkaudio.c:66
av_channel_layout_uninit
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
Definition: channel_layout.c:432
BinkAudioContext::num_bands
int num_bands
Definition: binkaudio.c:59
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:472
AVPacket
This structure stores compressed data.
Definition: packet.h:499
AV_TX_FLOAT_DCT
@ AV_TX_FLOAT_DCT
Real to real (DCT) transforms.
Definition: tx.h:104
BinkAudioContext::block_size
int block_size
Definition: binkaudio.c:58
coeff
static const double coeff[2][5]
Definition: vf_owdenoise.c:79
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
decode_flush
static void decode_flush(AVCodecContext *avctx)
Definition: binkaudio.c:361
AV_CODEC_ID_BINKAUDIO_RDFT
@ AV_CODEC_ID_BINKAUDIO_RDFT
Definition: codec_id.h:487
MAX_CHANNELS
#define MAX_CHANNELS
Definition: binkaudio.c:47
av_log2
int av_log2(unsigned v)
Definition: intmath.c:26
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:60
BinkAudioContext::bands
unsigned int bands[26]
Definition: binkaudio.c:61
tx.h