FFmpeg
dcadec.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 foo86
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 "libavutil/opt.h"
23 
24 #include "dcadec.h"
25 #include "dcahuff.h"
26 #include "dca_syncwords.h"
27 #include "profiles.h"
28 
29 #define MIN_PACKET_SIZE 16
30 #define MAX_PACKET_SIZE 0x104000
31 
32 int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask)
33 {
34  static const uint8_t dca2wav_norm[28] = {
35  2, 0, 1, 9, 10, 3, 8, 4, 5, 9, 10, 6, 7, 12,
36  13, 14, 3, 6, 7, 11, 12, 14, 16, 15, 17, 8, 4, 5,
37  };
38 
39  static const uint8_t dca2wav_wide[28] = {
40  2, 0, 1, 4, 5, 3, 8, 4, 5, 9, 10, 6, 7, 12,
41  13, 14, 3, 9, 10, 11, 12, 14, 16, 15, 17, 8, 4, 5,
42  };
43 
44  int dca_ch, wav_ch, nchannels = 0;
45 
47  for (dca_ch = 0; dca_ch < DCA_SPEAKER_COUNT; dca_ch++)
48  if (dca_mask & (1U << dca_ch))
49  ch_remap[nchannels++] = dca_ch;
50  avctx->channel_layout = dca_mask;
51  } else {
52  int wav_mask = 0;
53  int wav_map[18];
54  const uint8_t *dca2wav;
55  if (dca_mask == DCA_SPEAKER_LAYOUT_7POINT0_WIDE ||
57  dca2wav = dca2wav_wide;
58  else
59  dca2wav = dca2wav_norm;
60  for (dca_ch = 0; dca_ch < 28; dca_ch++) {
61  if (dca_mask & (1 << dca_ch)) {
62  wav_ch = dca2wav[dca_ch];
63  if (!(wav_mask & (1 << wav_ch))) {
64  wav_map[wav_ch] = dca_ch;
65  wav_mask |= 1 << wav_ch;
66  }
67  }
68  }
69  for (wav_ch = 0; wav_ch < 18; wav_ch++)
70  if (wav_mask & (1 << wav_ch))
71  ch_remap[nchannels++] = wav_map[wav_ch];
72  avctx->channel_layout = wav_mask;
73  }
74 
75  avctx->channels = nchannels;
76  return nchannels;
77 }
78 
80  int *coeff_l, int nsamples, int ch_mask)
81 {
82  int pos, spkr, max_spkr = av_log2(ch_mask);
83  int *coeff_r = coeff_l + av_popcount(ch_mask);
84 
85  av_assert0(DCA_HAS_STEREO(ch_mask));
86 
87  // Scale left and right channels
88  pos = (ch_mask & DCA_SPEAKER_MASK_C);
89  dcadsp->dmix_scale(samples[DCA_SPEAKER_L], coeff_l[pos ], nsamples);
90  dcadsp->dmix_scale(samples[DCA_SPEAKER_R], coeff_r[pos + 1], nsamples);
91 
92  // Downmix remaining channels
93  for (spkr = 0; spkr <= max_spkr; spkr++) {
94  if (!(ch_mask & (1U << spkr)))
95  continue;
96 
97  if (*coeff_l && spkr != DCA_SPEAKER_L)
98  dcadsp->dmix_add(samples[DCA_SPEAKER_L], samples[spkr],
99  *coeff_l, nsamples);
100 
101  if (*coeff_r && spkr != DCA_SPEAKER_R)
102  dcadsp->dmix_add(samples[DCA_SPEAKER_R], samples[spkr],
103  *coeff_r, nsamples);
104 
105  coeff_l++;
106  coeff_r++;
107  }
108 }
109 
111  int *coeff_l, int nsamples, int ch_mask)
112 {
113  int pos, spkr, max_spkr = av_log2(ch_mask);
114  int *coeff_r = coeff_l + av_popcount(ch_mask);
115  const float scale = 1.0f / (1 << 15);
116 
117  av_assert0(DCA_HAS_STEREO(ch_mask));
118 
119  // Scale left and right channels
120  pos = (ch_mask & DCA_SPEAKER_MASK_C);
121  fdsp->vector_fmul_scalar(samples[DCA_SPEAKER_L], samples[DCA_SPEAKER_L],
122  coeff_l[pos ] * scale, nsamples);
123  fdsp->vector_fmul_scalar(samples[DCA_SPEAKER_R], samples[DCA_SPEAKER_R],
124  coeff_r[pos + 1] * scale, nsamples);
125 
126  // Downmix remaining channels
127  for (spkr = 0; spkr <= max_spkr; spkr++) {
128  if (!(ch_mask & (1U << spkr)))
129  continue;
130 
131  if (*coeff_l && spkr != DCA_SPEAKER_L)
132  fdsp->vector_fmac_scalar(samples[DCA_SPEAKER_L], samples[spkr],
133  *coeff_l * scale, nsamples);
134 
135  if (*coeff_r && spkr != DCA_SPEAKER_R)
136  fdsp->vector_fmac_scalar(samples[DCA_SPEAKER_R], samples[spkr],
137  *coeff_r * scale, nsamples);
138 
139  coeff_l++;
140  coeff_r++;
141  }
142 }
143 
144 static int dcadec_decode_frame(AVCodecContext *avctx, void *data,
145  int *got_frame_ptr, AVPacket *avpkt)
146 {
147  DCAContext *s = avctx->priv_data;
148  AVFrame *frame = data;
149  uint8_t *input = avpkt->data;
150  int input_size = avpkt->size;
151  int i, ret, prev_packet = s->packet;
152  uint32_t mrk;
153 
154  if (input_size < MIN_PACKET_SIZE || input_size > MAX_PACKET_SIZE) {
155  av_log(avctx, AV_LOG_ERROR, "Invalid packet size\n");
156  return AVERROR_INVALIDDATA;
157  }
158 
159  // Convert input to BE format
160  mrk = AV_RB32(input);
161  if (mrk != DCA_SYNCWORD_CORE_BE && mrk != DCA_SYNCWORD_SUBSTREAM) {
162  av_fast_padded_malloc(&s->buffer, &s->buffer_size, input_size);
163  if (!s->buffer)
164  return AVERROR(ENOMEM);
165 
166  for (i = 0, ret = AVERROR_INVALIDDATA; i < input_size - MIN_PACKET_SIZE + 1 && ret < 0; i++)
167  ret = avpriv_dca_convert_bitstream(input + i, input_size - i, s->buffer, s->buffer_size);
168 
169  if (ret < 0) {
170  av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n");
171  return ret;
172  }
173 
174  input = s->buffer;
175  input_size = ret;
176  }
177 
178  s->packet = 0;
179 
180  // Parse backward compatible core sub-stream
181  if (AV_RB32(input) == DCA_SYNCWORD_CORE_BE) {
182  int frame_size;
183 
184  if ((ret = ff_dca_core_parse(&s->core, input, input_size)) < 0)
185  return ret;
186 
187  s->packet |= DCA_PACKET_CORE;
188 
189  // EXXS data must be aligned on 4-byte boundary
190  frame_size = FFALIGN(s->core.frame_size, 4);
191  if (input_size - 4 > frame_size) {
192  input += frame_size;
193  input_size -= frame_size;
194  }
195  }
196 
197  if (!s->core_only) {
198  DCAExssAsset *asset = NULL;
199 
200  // Parse extension sub-stream (EXSS)
201  if (AV_RB32(input) == DCA_SYNCWORD_SUBSTREAM) {
202  if ((ret = ff_dca_exss_parse(&s->exss, input, input_size)) < 0) {
203  if (avctx->err_recognition & AV_EF_EXPLODE)
204  return ret;
205  } else {
206  s->packet |= DCA_PACKET_EXSS;
207  asset = &s->exss.assets[0];
208  }
209  }
210 
211  // Parse XLL component in EXSS
212  if (asset && (asset->extension_mask & DCA_EXSS_XLL)) {
213  if ((ret = ff_dca_xll_parse(&s->xll, input, asset)) < 0) {
214  // Conceal XLL synchronization error
215  if (ret == AVERROR(EAGAIN)
216  && (prev_packet & DCA_PACKET_XLL)
217  && (s->packet & DCA_PACKET_CORE))
218  s->packet |= DCA_PACKET_XLL | DCA_PACKET_RECOVERY;
219  else if (ret == AVERROR(ENOMEM) || (avctx->err_recognition & AV_EF_EXPLODE))
220  return ret;
221  } else {
222  s->packet |= DCA_PACKET_XLL;
223  }
224  }
225 
226  // Parse LBR component in EXSS
227  if (asset && (asset->extension_mask & DCA_EXSS_LBR)) {
228  if ((ret = ff_dca_lbr_parse(&s->lbr, input, asset)) < 0) {
229  if (ret == AVERROR(ENOMEM) || (avctx->err_recognition & AV_EF_EXPLODE))
230  return ret;
231  } else {
232  s->packet |= DCA_PACKET_LBR;
233  }
234  }
235 
236  // Parse core extensions in EXSS or backward compatible core sub-stream
237  if ((s->packet & DCA_PACKET_CORE)
238  && (ret = ff_dca_core_parse_exss(&s->core, input, asset)) < 0)
239  return ret;
240  }
241 
242  // Filter the frame
243  if (s->packet & DCA_PACKET_LBR) {
244  if ((ret = ff_dca_lbr_filter_frame(&s->lbr, frame)) < 0)
245  return ret;
246  } else if (s->packet & DCA_PACKET_XLL) {
247  if (s->packet & DCA_PACKET_CORE) {
248  int x96_synth = -1;
249 
250  // Enable X96 synthesis if needed
251  if (s->xll.chset[0].freq == 96000 && s->core.sample_rate == 48000)
252  x96_synth = 1;
253 
254  if ((ret = ff_dca_core_filter_fixed(&s->core, x96_synth)) < 0)
255  return ret;
256 
257  // Force lossy downmixed output on the first core frame filtered.
258  // This prevents audible clicks when seeking and is consistent with
259  // what reference decoder does when there are multiple channel sets.
260  if (!(prev_packet & DCA_PACKET_RESIDUAL) && s->xll.nreschsets > 0
261  && s->xll.nchsets > 1) {
262  av_log(avctx, AV_LOG_VERBOSE, "Forcing XLL recovery mode\n");
264  }
265 
266  // Set 'residual ok' flag for the next frame
268  }
269 
270  if ((ret = ff_dca_xll_filter_frame(&s->xll, frame)) < 0) {
271  // Fall back to core unless hard error
272  if (!(s->packet & DCA_PACKET_CORE))
273  return ret;
274  if (ret != AVERROR_INVALIDDATA || (avctx->err_recognition & AV_EF_EXPLODE))
275  return ret;
276  if ((ret = ff_dca_core_filter_frame(&s->core, frame)) < 0)
277  return ret;
278  }
279  } else if (s->packet & DCA_PACKET_CORE) {
280  if ((ret = ff_dca_core_filter_frame(&s->core, frame)) < 0)
281  return ret;
284  } else {
285  av_log(avctx, AV_LOG_ERROR, "No valid DCA sub-stream found\n");
286  if (s->core_only)
287  av_log(avctx, AV_LOG_WARNING, "Consider disabling 'core_only' option\n");
288  return AVERROR_INVALIDDATA;
289  }
290 
291  *got_frame_ptr = 1;
292 
293  return avpkt->size;
294 }
295 
297 {
298  DCAContext *s = avctx->priv_data;
299 
300  ff_dca_core_flush(&s->core);
301  ff_dca_xll_flush(&s->xll);
302  ff_dca_lbr_flush(&s->lbr);
303 
304  s->packet &= DCA_PACKET_MASK;
305 }
306 
308 {
309  DCAContext *s = avctx->priv_data;
310 
311  ff_dca_core_close(&s->core);
312  ff_dca_xll_close(&s->xll);
313  ff_dca_lbr_close(&s->lbr);
314 
315  av_freep(&s->buffer);
316  s->buffer_size = 0;
317 
318  return 0;
319 }
320 
322 {
323  DCAContext *s = avctx->priv_data;
324 
325  s->avctx = avctx;
326  s->core.avctx = avctx;
327  s->exss.avctx = avctx;
328  s->xll.avctx = avctx;
329  s->lbr.avctx = avctx;
330 
332 
333  if (ff_dca_core_init(&s->core) < 0)
334  return AVERROR(ENOMEM);
335 
336  if (ff_dca_lbr_init(&s->lbr) < 0)
337  return AVERROR(ENOMEM);
338 
339  ff_dcadsp_init(&s->dcadsp);
340  s->core.dcadsp = &s->dcadsp;
341  s->xll.dcadsp = &s->dcadsp;
342  s->lbr.dcadsp = &s->dcadsp;
343 
345 
346  switch (avctx->request_channel_layout & ~AV_CH_LAYOUT_NATIVE) {
347  case 0:
348  s->request_channel_layout = 0;
349  break;
350  case AV_CH_LAYOUT_STEREO:
353  break;
356  break;
359  break;
360  default:
361  av_log(avctx, AV_LOG_WARNING, "Invalid request_channel_layout\n");
362  break;
363  }
364 
365  return 0;
366 }
367 
368 #define OFFSET(x) offsetof(DCAContext, x)
369 #define PARAM AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
370 
371 static const AVOption dcadec_options[] = {
372  { "core_only", "Decode core only without extensions", OFFSET(core_only), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, PARAM },
373  { NULL }
374 };
375 
376 static const AVClass dcadec_class = {
377  .class_name = "DCA decoder",
378  .item_name = av_default_item_name,
379  .option = dcadec_options,
380  .version = LIBAVUTIL_VERSION_INT,
381  .category = AV_CLASS_CATEGORY_DECODER,
382 };
383 
385  .name = "dca",
386  .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
387  .type = AVMEDIA_TYPE_AUDIO,
388  .id = AV_CODEC_ID_DTS,
389  .priv_data_size = sizeof(DCAContext),
390  .init = dcadec_init,
392  .close = dcadec_close,
393  .flush = dcadec_flush,
397  .priv_class = &dcadec_class,
399  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
400 };
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:48
int ff_dca_core_filter_fixed(DCACoreDecoder *s, int x96_synth)
Definition: dca_core.c:1959
float, planar
Definition: samplefmt.h:69
#define NULL
Definition: coverity.c:32
DCACoreDecoder core
Core decoder context.
Definition: dcadec.h:50
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
static const AVClass dcadec_class
Definition: dcadec.c:376
AVOption.
Definition: opt.h:246
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:100
static void flush(AVCodecContext *avctx)
int ff_dca_lbr_parse(DCALbrDecoder *s, uint8_t *data, DCAExssAsset *asset)
Definition: dca_lbr.c:1143
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVCodecContext * avctx
Definition: dca_xll.h:106
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static av_cold int dcadec_init(AVCodecContext *avctx)
Definition: dcadec.c:321
#define DCA_PACKET_RECOVERY
Sync error recovery flag.
Definition: dcadec.h:43
int ff_dca_core_parse_exss(DCACoreDecoder *s, uint8_t *data, DCAExssAsset *asset)
Definition: dca_core.c:1831
int frame_size
Primary frame byte size.
Definition: dca_core.h:109
#define DCA_PACKET_EXSS
Definition: dcadec.h:38
int size
Definition: avcodec.h:1481
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
int av_log2(unsigned v)
Definition: intmath.c:26
av_cold void ff_dca_core_close(DCACoreDecoder *s)
Definition: dca_core.c:2430
static av_cold int dcadec_close(AVCodecContext *avctx)
Definition: dcadec.c:307
int core_only
Core only decoding flag.
Definition: dcadec.h:65
#define DCA_FILTER_MODE_FIXED
Definition: dca_core.h:57
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
Definition: utils.c:70
int packet
Packet flags.
Definition: dcadec.h:62
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: avcodec.h:1036
uint8_t * buffer
Packet buffer.
Definition: dcadec.h:59
#define AV_CH_LAYOUT_STEREO
int freq
Original sampling frequency (max. 96000 Hz)
Definition: dca_xll.h:70
AVCodec.
Definition: avcodec.h:3484
#define AV_CH_LAYOUT_5POINT0
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
void(* vector_fmac_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float and add to destination vector.
Definition: float_dsp.h:54
#define OFFSET(x)
Definition: dcadec.c:368
uint8_t
static av_cold void dcadec_flush(AVCodecContext *avctx)
Definition: dcadec.c:296
#define av_cold
Definition: attributes.h:82
AVOptions.
int ff_dca_core_parse(DCACoreDecoder *s, uint8_t *data, int size)
Definition: dca_core.c:1798
static int dcadec_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: dcadec.c:144
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
Definition: bytestream.h:87
int filter_mode
Previous filtering mode for detecting changes.
Definition: dca_core.h:213
int extension_mask
Coding components used in asset.
Definition: dca_exss.h:45
DCADSPContext * dcadsp
Definition: dca_lbr.h:126
av_cold void ff_dcadsp_init(DCADSPContext *s)
Definition: dcadsp.c:459
uint8_t * data
Definition: avcodec.h:1480
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:192
AVCodecContext * avctx
Definition: dcadec.h:48
DCALbrDecoder lbr
LBR decoder context.
Definition: dcadec.h:53
#define FFALIGN(x, a)
Definition: macros.h:48
#define av_log(a,...)
DCAExssParser exss
EXSS parser context.
Definition: dcadec.h:51
#define DCA_SYNCWORD_CORE_BE
Definition: dca_syncwords.h:22
#define AV_CH_LAYOUT_5POINT1
void ff_dca_downmix_to_stereo_fixed(DCADSPContext *dcadsp, int32_t **samples, int *coeff_l, int nsamples, int ch_mask)
Definition: dcadec.c:79
#define U(x)
Definition: vp56_arith.h:37
static const AVOption dcadec_options[]
Definition: dcadec.c:371
#define DCA_PACKET_LBR
Definition: dcadec.h:40
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
int ff_dca_xll_filter_frame(DCAXllDecoder *s, AVFrame *frame)
Definition: dca_xll.c:1322
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
DCADSPContext * dcadsp
Definition: dca_xll.h:138
const char * name
Name of the codec implementation.
Definition: avcodec.h:3491
#define DCA_SPEAKER_LAYOUT_STEREO
Definition: dca.h:123
#define MAX_PACKET_SIZE
Definition: dcadec.c:30
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:2279
#define DCA_PACKET_MASK
Definition: dcadec.h:41
int sample_rate
Core audio sampling frequency.
Definition: dca_core.h:111
audio channel layout utility functions
#define AV_CH_LAYOUT_STEREO_DOWNMIX
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
Definition: avcodec.h:2697
signed 32 bits, planar
Definition: samplefmt.h:68
const AVCRC * crctab
Definition: dcadec.h:57
#define DCA_PACKET_XLL
Definition: dcadec.h:39
int32_t
int avpriv_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, int max_size)
Convert bitstream to one representation based on sync marker.
Definition: dca.c:54
#define DCA_HAS_STEREO(mask)
Definition: dca.h:134
AVCodecContext * avctx
Definition: dca_core.h:102
DCAXllDecoder xll
XLL decoder context.
Definition: dcadec.h:52
int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask)
Definition: dcadec.c:32
av_cold void ff_dca_lbr_flush(DCALbrDecoder *s)
Definition: dca_lbr.c:1770
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
#define s(width, name)
Definition: cbs_vp9.c:257
av_cold void ff_dca_lbr_close(DCALbrDecoder *s)
Definition: dca_lbr.c:1805
av_cold void ff_dca_core_flush(DCACoreDecoder *s)
Definition: dca_core.c:2399
#define AV_EF_EXPLODE
abort decoding on minor error detection
Definition: avcodec.h:2708
AVCodecContext * avctx
Definition: dca_lbr.h:59
DCAExssAsset assets[1]
Audio asset descriptors.
Definition: dca_exss.h:87
int ff_dca_lbr_filter_frame(DCALbrDecoder *s, AVFrame *frame)
Definition: dca_lbr.c:1710
int frame_size
Definition: mxfenc.c:2214
void ff_dca_downmix_to_stereo_float(AVFloatDSPContext *fdsp, float **samples, int *coeff_l, int nsamples, int ch_mask)
Definition: dcadec.c:110
#define MIN_PACKET_SIZE
Definition: dcadec.c:29
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
#define DCA_PACKET_CORE
Definition: dcadec.h:37
av_cold void ff_dca_init_vlcs(void)
Definition: dcahuff.c:1263
#define AV_CH_LAYOUT_NATIVE
Channel mask value used for AVCodecContext.request_channel_layout to indicate that the user requests ...
main external API structure.
Definition: avcodec.h:1568
#define DCA_SPEAKER_LAYOUT_7POINT0_WIDE
Definition: dca.h:131
Describe the class of an AVClass context structure.
Definition: log.h:67
#define PARAM
Definition: dcadec.c:369
av_cold int ff_dca_core_init(DCACoreDecoder *s)
Definition: dca_core.c:2412
DCADSPContext * dcadsp
Definition: dca_core.h:193
int nreschsets
Number of channel sets that have residual encoded channels.
Definition: dca_xll.h:129
void(* vector_fmul_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float.
Definition: float_dsp.h:85
#define DCA_SPEAKER_LAYOUT_5POINT1
Definition: dca.h:130
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
AVCodec ff_dca_decoder
Definition: dcadec.c:384
#define DCA_SPEAKER_LAYOUT_5POINT0
Definition: dca.h:129
const AVProfile ff_dca_profiles[]
Definition: profiles.c:38
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
Definition: crc.c:374
int ff_dca_core_filter_frame(DCACoreDecoder *s, AVFrame *frame)
Definition: dca_core.c:2345
void(* dmix_scale)(int32_t *dst, int scale, ptrdiff_t len)
Definition: dcadsp.h:81
DCADSPContext dcadsp
Definition: dcadec.h:55
av_cold void ff_dca_xll_flush(DCAXllDecoder *s)
Definition: dca_xll.c:1471
DCAXllChSet chset[DCA_XLL_CHSETS_MAX]
Channel sets.
Definition: dca_xll.h:122
int request_channel_layout
Converted from avctx.request_channel_layout.
Definition: dcadec.h:64
AVCodecContext * avctx
Definition: dca_exss.h:72
void * priv_data
Definition: avcodec.h:1595
av_cold void ff_dca_xll_close(DCAXllDecoder *s)
Definition: dca_xll.c:1476
#define DCA_PACKET_RESIDUAL
Core valid for residual decoding.
Definition: dcadec.h:44
int channels
number of audio channels
Definition: avcodec.h:2229
#define DCA_SYNCWORD_SUBSTREAM
Definition: dca_syncwords.h:32
unsigned int buffer_size
Definition: dcadec.h:60
int ff_dca_xll_parse(DCAXllDecoder *s, uint8_t *data, DCAExssAsset *asset)
Definition: dca_xll.c:1161
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:701
Filter the word “frame” indicates either a video frame or a group of audio samples
int ff_dca_exss_parse(DCAExssParser *s, const uint8_t *data, int size)
Definition: dca_exss.c:378
#define av_freep(p)
signed 16 bits, planar
Definition: samplefmt.h:67
av_cold int ff_dca_lbr_init(DCALbrDecoder *s)
Definition: dca_lbr.c:1794
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 all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
int nchsets
Number of channels sets per frame.
Definition: dca_xll.h:110
uint64_t request_channel_layout
Request decoder to use this channel layout if it can (0 for default)
Definition: avcodec.h:2286
void(* dmix_add)(int32_t *dst, const int32_t *src, int coeff, ptrdiff_t len)
Definition: dcadsp.h:79
This structure stores compressed data.
Definition: avcodec.h:1457
#define DCA_SPEAKER_LAYOUT_7POINT1_WIDE
Definition: dca.h:132
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:984