FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, int max_size)
145 {
146  switch (AV_RB32(src)) {
149  memcpy(dst, src, src_size);
150  return src_size;
154  return avpriv_dca_convert_bitstream(src, src_size, dst, max_size);
155  default:
156  return AVERROR_INVALIDDATA;
157  }
158 }
159 
160 static int dcadec_decode_frame(AVCodecContext *avctx, void *data,
161  int *got_frame_ptr, AVPacket *avpkt)
162 {
163  DCAContext *s = avctx->priv_data;
164  AVFrame *frame = data;
165  uint8_t *input = avpkt->data;
166  int input_size = avpkt->size;
167  int i, ret, prev_packet = s->packet;
168 
169  if (input_size < MIN_PACKET_SIZE || input_size > MAX_PACKET_SIZE) {
170  av_log(avctx, AV_LOG_ERROR, "Invalid packet size\n");
171  return AVERROR_INVALIDDATA;
172  }
173 
175  FFALIGN(input_size, 4096) + DCA_BUFFER_PADDING_SIZE);
176  if (!s->buffer)
177  return AVERROR(ENOMEM);
178 
179  for (i = 0, ret = AVERROR_INVALIDDATA; i < input_size - MIN_PACKET_SIZE + 1 && ret < 0; i++)
180  ret = convert_bitstream(input + i, input_size - i, s->buffer, s->buffer_size);
181 
182  if (ret < 0) {
183  av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n");
184  return ret;
185  }
186 
187  input = s->buffer;
188  input_size = ret;
189 
190  s->packet = 0;
191 
192  // Parse backward compatible core sub-stream
193  if (AV_RB32(input) == DCA_SYNCWORD_CORE_BE) {
194  int frame_size;
195 
196  if ((ret = ff_dca_core_parse(&s->core, input, input_size)) < 0)
197  return ret;
198 
199  s->packet |= DCA_PACKET_CORE;
200 
201  // EXXS data must be aligned on 4-byte boundary
202  frame_size = FFALIGN(s->core.frame_size, 4);
203  if (input_size - 4 > frame_size) {
204  input += frame_size;
205  input_size -= frame_size;
206  }
207  }
208 
209  if (!s->core_only) {
210  DCAExssAsset *asset = NULL;
211 
212  // Parse extension sub-stream (EXSS)
213  if (AV_RB32(input) == DCA_SYNCWORD_SUBSTREAM) {
214  if ((ret = ff_dca_exss_parse(&s->exss, input, input_size)) < 0) {
215  if (avctx->err_recognition & AV_EF_EXPLODE)
216  return ret;
217  } else {
218  s->packet |= DCA_PACKET_EXSS;
219  asset = &s->exss.assets[0];
220  }
221  }
222 
223  // Parse XLL component in EXSS
224  if (asset && (asset->extension_mask & DCA_EXSS_XLL)) {
225  if ((ret = ff_dca_xll_parse(&s->xll, input, asset)) < 0) {
226  // Conceal XLL synchronization error
227  if (ret == AVERROR(EAGAIN)
228  && (prev_packet & DCA_PACKET_XLL)
229  && (s->packet & DCA_PACKET_CORE))
230  s->packet |= DCA_PACKET_XLL | DCA_PACKET_RECOVERY;
231  else if (ret == AVERROR(ENOMEM) || (avctx->err_recognition & AV_EF_EXPLODE))
232  return ret;
233  } else {
234  s->packet |= DCA_PACKET_XLL;
235  }
236  }
237 
238  // Parse LBR component in EXSS
239  if (asset && (asset->extension_mask & DCA_EXSS_LBR)) {
240  if ((ret = ff_dca_lbr_parse(&s->lbr, input, asset)) < 0) {
241  if (ret == AVERROR(ENOMEM) || (avctx->err_recognition & AV_EF_EXPLODE))
242  return ret;
243  } else {
244  s->packet |= DCA_PACKET_LBR;
245  }
246  }
247 
248  // Parse core extensions in EXSS or backward compatible core sub-stream
249  if ((s->packet & DCA_PACKET_CORE)
250  && (ret = ff_dca_core_parse_exss(&s->core, input, asset)) < 0)
251  return ret;
252  }
253 
254  // Filter the frame
255  if (s->packet & DCA_PACKET_LBR) {
256  if ((ret = ff_dca_lbr_filter_frame(&s->lbr, frame)) < 0)
257  return ret;
258  } else if (s->packet & DCA_PACKET_XLL) {
259  if (s->packet & DCA_PACKET_CORE) {
260  int x96_synth = -1;
261 
262  // Enable X96 synthesis if needed
263  if (s->xll.chset[0].freq == 96000 && s->core.sample_rate == 48000)
264  x96_synth = 1;
265 
266  if ((ret = ff_dca_core_filter_fixed(&s->core, x96_synth)) < 0)
267  return ret;
268 
269  // Force lossy downmixed output on the first core frame filtered.
270  // This prevents audible clicks when seeking and is consistent with
271  // what reference decoder does when there are multiple channel sets.
272  if (!(prev_packet & DCA_PACKET_RESIDUAL) && s->xll.nreschsets > 0
273  && s->xll.nchsets > 1) {
274  av_log(avctx, AV_LOG_VERBOSE, "Forcing XLL recovery mode\n");
276  }
277 
278  // Set 'residual ok' flag for the next frame
280  }
281 
282  if ((ret = ff_dca_xll_filter_frame(&s->xll, frame)) < 0) {
283  // Fall back to core unless hard error
284  if (!(s->packet & DCA_PACKET_CORE))
285  return ret;
286  if (ret != AVERROR_INVALIDDATA || (avctx->err_recognition & AV_EF_EXPLODE))
287  return ret;
288  if ((ret = ff_dca_core_filter_frame(&s->core, frame)) < 0)
289  return ret;
290  }
291  } else if (s->packet & DCA_PACKET_CORE) {
292  if ((ret = ff_dca_core_filter_frame(&s->core, frame)) < 0)
293  return ret;
296  } else {
297  av_log(avctx, AV_LOG_ERROR, "No valid DCA sub-stream found\n");
298  if (s->core_only)
299  av_log(avctx, AV_LOG_WARNING, "Consider disabling 'core_only' option\n");
300  return AVERROR_INVALIDDATA;
301  }
302 
303  *got_frame_ptr = 1;
304 
305  return avpkt->size;
306 }
307 
309 {
310  DCAContext *s = avctx->priv_data;
311 
312  ff_dca_core_flush(&s->core);
313  ff_dca_xll_flush(&s->xll);
314  ff_dca_lbr_flush(&s->lbr);
315 
316  s->packet &= DCA_PACKET_MASK;
317 }
318 
320 {
321  DCAContext *s = avctx->priv_data;
322 
323  ff_dca_core_close(&s->core);
324  ff_dca_xll_close(&s->xll);
325  ff_dca_lbr_close(&s->lbr);
326 
327  av_freep(&s->buffer);
328  s->buffer_size = 0;
329 
330  return 0;
331 }
332 
334 {
335  DCAContext *s = avctx->priv_data;
336 
337  s->avctx = avctx;
338  s->core.avctx = avctx;
339  s->exss.avctx = avctx;
340  s->xll.avctx = avctx;
341  s->lbr.avctx = avctx;
342 
344 
345  if (ff_dca_core_init(&s->core) < 0)
346  return AVERROR(ENOMEM);
347 
348  if (ff_dca_lbr_init(&s->lbr) < 0)
349  return AVERROR(ENOMEM);
350 
351  ff_dcadsp_init(&s->dcadsp);
352  s->core.dcadsp = &s->dcadsp;
353  s->xll.dcadsp = &s->dcadsp;
354  s->lbr.dcadsp = &s->dcadsp;
355 
357 
358  switch (avctx->request_channel_layout & ~AV_CH_LAYOUT_NATIVE) {
359  case 0:
360  s->request_channel_layout = 0;
361  break;
362  case AV_CH_LAYOUT_STEREO:
365  break;
368  break;
371  break;
372  default:
373  av_log(avctx, AV_LOG_WARNING, "Invalid request_channel_layout\n");
374  break;
375  }
376 
377  return 0;
378 }
379 
380 #define OFFSET(x) offsetof(DCAContext, x)
381 #define PARAM AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
382 
383 static const AVOption dcadec_options[] = {
384  { "core_only", "Decode core only without extensions", OFFSET(core_only), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, PARAM },
385  { NULL }
386 };
387 
388 static const AVClass dcadec_class = {
389  .class_name = "DCA decoder",
390  .item_name = av_default_item_name,
391  .option = dcadec_options,
392  .version = LIBAVUTIL_VERSION_INT,
393  .category = AV_CLASS_CATEGORY_DECODER,
394 };
395 
397  .name = "dca",
398  .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
399  .type = AVMEDIA_TYPE_AUDIO,
400  .id = AV_CODEC_ID_DTS,
401  .priv_data_size = sizeof(DCAContext),
402  .init = dcadec_init,
404  .close = dcadec_close,
405  .flush = dcadec_flush,
409  .priv_class = &dcadec_class,
411  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
412 };
#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:2063
float, planar
Definition: samplefmt.h:69
#define NULL
Definition: coverity.c:32
DCACoreDecoder core
Core decoder context.
Definition: dcadec.h:52
const char * s
Definition: avisynth_c.h:631
#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:180
static const AVClass dcadec_class
Definition: dcadec.c:388
AVOption.
Definition: opt.h:245
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
static void flush(AVCodecContext *avctx)
int ff_dca_lbr_parse(DCALbrDecoder *s, uint8_t *data, DCAExssAsset *asset)
Definition: dca_lbr.c:1149
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
#define LIBAVUTIL_VERSION_INT
Definition: version.h:70
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:333
#define DCA_PACKET_RECOVERY
Sync error recovery flag.
Definition: dcadec.h:45
int ff_dca_core_parse_exss(DCACoreDecoder *s, uint8_t *data, DCAExssAsset *asset)
Definition: dca_core.c:1936
int frame_size
Primary frame byte size.
Definition: dca_core.h:80
#define DCA_PACKET_EXSS
Definition: dcadec.h:40
int size
Definition: avcodec.h:1578
int av_log2(unsigned v)
Definition: intmath.c:26
av_cold void ff_dca_core_close(DCACoreDecoder *s)
Definition: dca_core.c:2534
static av_cold int dcadec_close(AVCodecContext *avctx)
Definition: dcadec.c:319
int core_only
Core only decoding flag.
Definition: dcadec.h:67
#define DCA_FILTER_MODE_FIXED
Definition: dca_core.h:57
int packet
Packet flags.
Definition: dcadec.h:64
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: avcodec.h:1012
uint8_t * buffer
Packet buffer.
Definition: dcadec.h:61
#define AV_CH_LAYOUT_STEREO
int freq
Original sampling frequency (max. 96000 Hz)
Definition: dca_xll.h:70
AVCodec.
Definition: avcodec.h:3535
#define AV_CH_LAYOUT_5POINT0
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
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
#define OFFSET(x)
Definition: dcadec.c:380
uint8_t
static av_cold void dcadec_flush(AVCodecContext *avctx)
Definition: dcadec.c:308
#define av_cold
Definition: attributes.h:82
AVOptions.
int ff_dca_core_parse(DCACoreDecoder *s, uint8_t *data, int size)
Definition: dca_core.c:1903
#define DCA_SYNCWORD_CORE_14B_BE
Definition: dca_syncwords.h:24
static int dcadec_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: dcadec.c:160
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:184
int extension_mask
Coding components used in asset.
Definition: dca_exss.h:45
static AVFrame * frame
DCADSPContext * dcadsp
Definition: dca_lbr.h:121
void(* dmix_add)(int32_t *dst, const int32_t *src, int coeff, ptrdiff_t len)
Definition: dcadsp.h:79
av_cold void ff_dcadsp_init(DCADSPContext *s)
Definition: dcadsp.c:459
uint8_t * data
Definition: avcodec.h:1577
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:192
AVCodecContext * avctx
Definition: dcadec.h:50
DCALbrDecoder lbr
LBR decoder context.
Definition: dcadec.h:55
#define FFALIGN(x, a)
Definition: macros.h:48
#define av_log(a,...)
DCAExssParser exss
EXSS parser context.
Definition: dcadec.h:53
#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:383
#define DCA_PACKET_LBR
Definition: dcadec.h:42
#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
av_default_item_name
#define AVERROR(e)
Definition: error.h:43
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:176
DCADSPContext * dcadsp
Definition: dca_xll.h:138
const char * name
Name of the codec implementation.
Definition: avcodec.h:3542
#define DCA_SPEAKER_LAYOUT_STEREO
Definition: dca.h:80
#define MAX_PACKET_SIZE
Definition: dcadec.c:30
#define DCA_SYNCWORD_CORE_14B_LE
Definition: dca_syncwords.h:25
#define DCA_BUFFER_PADDING_SIZE
Definition: dcadec.h:37
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:2454
#define DCA_PACKET_MASK
Definition: dcadec.h:43
int sample_rate
Core audio sampling frequency.
Definition: dca_core.h:82
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:2929
signed 32 bits, planar
Definition: samplefmt.h:68
const AVCRC * crctab
Definition: dcadec.h:59
void(* dmix_scale)(int32_t *dst, int scale, ptrdiff_t len)
Definition: dcadsp.h:81
#define DCA_PACKET_XLL
Definition: dcadec.h:41
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:48
#define DCA_HAS_STEREO(mask)
Definition: dca.h:91
AVCodecContext * avctx
Definition: dca_core.h:74
DCAXllDecoder xll
XLL decoder context.
Definition: dcadec.h:54
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:1776
av_cold void ff_dca_lbr_close(DCALbrDecoder *s)
Definition: dca_lbr.c:1811
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:69
av_cold void ff_dca_core_flush(DCACoreDecoder *s)
Definition: dca_core.c:2503
#define AV_EF_EXPLODE
abort decoding on minor error detection
Definition: avcodec.h:2940
AVCodecContext * avctx
Definition: dca_lbr.h:54
#define src
Definition: vp9dsp.c:530
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:1716
int frame_size
Definition: mxfenc.c:1821
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:39
av_cold void ff_dca_init_vlcs(void)
Definition: dcahuff.c:1264
#define AV_CH_LAYOUT_NATIVE
Channel mask value used for AVCodecContext.request_channel_layout to indicate that the user requests ...
#define DCA_SYNCWORD_CORE_LE
Definition: dca_syncwords.h:23
main external API structure.
Definition: avcodec.h:1642
#define DCA_SPEAKER_LAYOUT_7POINT0_WIDE
Definition: dca.h:88
Describe the class of an AVClass context structure.
Definition: log.h:67
#define PARAM
Definition: dcadec.c:381
av_cold int ff_dca_core_init(DCACoreDecoder *s)
Definition: dca_core.c:2516
DCADSPContext * dcadsp
Definition: dca_core.h:164
int nreschsets
Number of channel sets that have residual encoded channels.
Definition: dca_xll.h:129
#define DCA_SPEAKER_LAYOUT_5POINT1
Definition: dca.h:87
AVCodec ff_dca_decoder
Definition: dcadec.c:396
#define DCA_SPEAKER_LAYOUT_5POINT0
Definition: dca.h:86
const AVProfile ff_dca_profiles[]
Definition: profiles.c:39
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
Definition: crc.c:343
int ff_dca_core_filter_frame(DCACoreDecoder *s, AVFrame *frame)
Definition: dca_core.c:2449
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:722
DCADSPContext dcadsp
Definition: dcadec.h:57
av_cold void ff_dca_xll_flush(DCAXllDecoder *s)
Definition: dca_xll.c:1469
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
Definition: mem.c:499
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:66
static int convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, int max_size)
Definition: dcadec.c:144
AVCodecContext * avctx
Definition: dca_exss.h:72
void * priv_data
Definition: avcodec.h:1684
av_cold void ff_dca_xll_close(DCAXllDecoder *s)
Definition: dca_xll.c:1474
#define DCA_PACKET_RESIDUAL
Core valid for residual decoding.
Definition: dcadec.h:46
int channels
number of audio channels
Definition: avcodec.h:2404
#define DCA_SYNCWORD_SUBSTREAM
Definition: dca_syncwords.h:32
unsigned int buffer_size
Definition: dcadec.h:62
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
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:1800
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:2461
This structure stores compressed data.
Definition: avcodec.h:1554
#define DCA_SPEAKER_LAYOUT_7POINT1_WIDE
Definition: dca.h:89
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:953