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 "dcamath.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 
79 static uint16_t crc16(const uint8_t *data, int size)
80 {
81  static const uint16_t crctab[16] = {
82  0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
83  0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
84  };
85 
86  uint16_t res = 0xffff;
87  int i;
88 
89  for (i = 0; i < size; i++) {
90  res = (res << 4) ^ crctab[(data[i] >> 4) ^ (res >> 12)];
91  res = (res << 4) ^ crctab[(data[i] & 15) ^ (res >> 12)];
92  }
93 
94  return res;
95 }
96 
97 int ff_dca_check_crc(GetBitContext *s, int p1, int p2)
98 {
99  if (((p1 | p2) & 7) || p1 < 0 || p2 > s->size_in_bits || p2 - p1 < 16)
100  return -1;
101  if (crc16(s->buffer + p1 / 8, (p2 - p1) / 8))
102  return -1;
103  return 0;
104 }
105 
107  int *coeff_l, int nsamples, int ch_mask)
108 {
109  int pos, spkr, max_spkr = av_log2(ch_mask);
110  int *coeff_r = coeff_l + av_popcount(ch_mask);
111 
112  av_assert0(DCA_HAS_STEREO(ch_mask));
113 
114  // Scale left and right channels
115  pos = (ch_mask & DCA_SPEAKER_MASK_C);
116  dcadsp->dmix_scale(samples[DCA_SPEAKER_L], coeff_l[pos ], nsamples);
117  dcadsp->dmix_scale(samples[DCA_SPEAKER_R], coeff_r[pos + 1], nsamples);
118 
119  // Downmix remaining channels
120  for (spkr = 0; spkr <= max_spkr; spkr++) {
121  if (!(ch_mask & (1U << spkr)))
122  continue;
123 
124  if (*coeff_l && spkr != DCA_SPEAKER_L)
125  dcadsp->dmix_add(samples[DCA_SPEAKER_L], samples[spkr],
126  *coeff_l, nsamples);
127 
128  if (*coeff_r && spkr != DCA_SPEAKER_R)
129  dcadsp->dmix_add(samples[DCA_SPEAKER_R], samples[spkr],
130  *coeff_r, nsamples);
131 
132  coeff_l++;
133  coeff_r++;
134  }
135 }
136 
138  int *coeff_l, int nsamples, int ch_mask)
139 {
140  int pos, spkr, max_spkr = av_log2(ch_mask);
141  int *coeff_r = coeff_l + av_popcount(ch_mask);
142  const float scale = 1.0f / (1 << 15);
143 
144  av_assert0(DCA_HAS_STEREO(ch_mask));
145 
146  // Scale left and right channels
147  pos = (ch_mask & DCA_SPEAKER_MASK_C);
148  fdsp->vector_fmul_scalar(samples[DCA_SPEAKER_L], samples[DCA_SPEAKER_L],
149  coeff_l[pos ] * scale, nsamples);
150  fdsp->vector_fmul_scalar(samples[DCA_SPEAKER_R], samples[DCA_SPEAKER_R],
151  coeff_r[pos + 1] * scale, nsamples);
152 
153  // Downmix remaining channels
154  for (spkr = 0; spkr <= max_spkr; spkr++) {
155  if (!(ch_mask & (1U << spkr)))
156  continue;
157 
158  if (*coeff_l && spkr != DCA_SPEAKER_L)
159  fdsp->vector_fmac_scalar(samples[DCA_SPEAKER_L], samples[spkr],
160  *coeff_l * scale, nsamples);
161 
162  if (*coeff_r && spkr != DCA_SPEAKER_R)
163  fdsp->vector_fmac_scalar(samples[DCA_SPEAKER_R], samples[spkr],
164  *coeff_r * scale, nsamples);
165 
166  coeff_l++;
167  coeff_r++;
168  }
169 }
170 
171 static int convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, int max_size)
172 {
173  switch (AV_RB32(src)) {
176  memcpy(dst, src, src_size);
177  return src_size;
181  return avpriv_dca_convert_bitstream(src, src_size, dst, max_size);
182  default:
183  return AVERROR_INVALIDDATA;
184  }
185 }
186 
187 static int dcadec_decode_frame(AVCodecContext *avctx, void *data,
188  int *got_frame_ptr, AVPacket *avpkt)
189 {
190  DCAContext *s = avctx->priv_data;
191  AVFrame *frame = data;
192  uint8_t *input = avpkt->data;
193  int input_size = avpkt->size;
194  int i, ret, prev_packet = s->packet;
195 
196  if (input_size < MIN_PACKET_SIZE || input_size > MAX_PACKET_SIZE) {
197  av_log(avctx, AV_LOG_ERROR, "Invalid packet size\n");
198  return AVERROR_INVALIDDATA;
199  }
200 
202  FFALIGN(input_size, 4096) + DCA_BUFFER_PADDING_SIZE);
203  if (!s->buffer)
204  return AVERROR(ENOMEM);
205 
206  for (i = 0, ret = AVERROR_INVALIDDATA; i < input_size - MIN_PACKET_SIZE + 1 && ret < 0; i++)
207  ret = convert_bitstream(input + i, input_size - i, s->buffer, s->buffer_size);
208 
209  if (ret < 0)
210  return ret;
211 
212  input = s->buffer;
213  input_size = ret;
214 
215  s->packet = 0;
216 
217  // Parse backward compatible core sub-stream
218  if (AV_RB32(input) == DCA_SYNCWORD_CORE_BE) {
219  int frame_size;
220 
221  if ((ret = ff_dca_core_parse(&s->core, input, input_size)) < 0) {
222  s->core_residual_valid = 0;
223  return ret;
224  }
225 
226  s->packet |= DCA_PACKET_CORE;
227 
228  // EXXS data must be aligned on 4-byte boundary
229  frame_size = FFALIGN(s->core.frame_size, 4);
230  if (input_size - 4 > frame_size) {
231  input += frame_size;
232  input_size -= frame_size;
233  }
234  }
235 
236  if (!s->core_only) {
237  DCAExssAsset *asset = NULL;
238 
239  // Parse extension sub-stream (EXSS)
240  if (AV_RB32(input) == DCA_SYNCWORD_SUBSTREAM) {
241  if ((ret = ff_dca_exss_parse(&s->exss, input, input_size)) < 0) {
242  if (avctx->err_recognition & AV_EF_EXPLODE)
243  return ret;
244  } else {
245  s->packet |= DCA_PACKET_EXSS;
246  asset = &s->exss.assets[0];
247  }
248  }
249 
250  // Parse XLL component in EXSS
251  if (asset && (asset->extension_mask & DCA_EXSS_XLL)) {
252  if ((ret = ff_dca_xll_parse(&s->xll, input, asset)) < 0) {
253  // Conceal XLL synchronization error
254  if (ret == AVERROR(EAGAIN)
255  && (prev_packet & DCA_PACKET_XLL)
256  && (s->packet & DCA_PACKET_CORE))
257  s->packet |= DCA_PACKET_XLL | DCA_PACKET_RECOVERY;
258  else if (ret == AVERROR(ENOMEM) || (avctx->err_recognition & AV_EF_EXPLODE))
259  return ret;
260  } else {
261  s->packet |= DCA_PACKET_XLL;
262  }
263  }
264 
265  // Parse core extensions in EXSS or backward compatible core sub-stream
266  if ((s->packet & DCA_PACKET_CORE)
267  && (ret = ff_dca_core_parse_exss(&s->core, input, asset)) < 0)
268  return ret;
269  }
270 
271  // Filter the frame
272  if (s->packet & DCA_PACKET_XLL) {
273  if (s->packet & DCA_PACKET_CORE) {
274  int x96_synth = -1;
275 
276  // Enable X96 synthesis if needed
277  if (s->xll.chset[0].freq == 96000 && s->core.sample_rate == 48000)
278  x96_synth = 1;
279 
280  if ((ret = ff_dca_core_filter_fixed(&s->core, x96_synth)) < 0) {
281  s->core_residual_valid = 0;
282  return ret;
283  }
284 
285  // Force lossy downmixed output on the first core frame filtered.
286  // This prevents audible clicks when seeking and is consistent with
287  // what reference decoder does when there are multiple channel sets.
288  if (!s->core_residual_valid) {
289  if (s->xll.nreschsets > 0 && s->xll.nchsets > 1)
291  s->core_residual_valid = 1;
292  }
293  }
294 
295  if ((ret = ff_dca_xll_filter_frame(&s->xll, frame)) < 0) {
296  // Fall back to core unless hard error
297  if (!(s->packet & DCA_PACKET_CORE))
298  return ret;
299  if (ret != AVERROR_INVALIDDATA || (avctx->err_recognition & AV_EF_EXPLODE))
300  return ret;
301  if ((ret = ff_dca_core_filter_frame(&s->core, frame)) < 0) {
302  s->core_residual_valid = 0;
303  return ret;
304  }
305  }
306  } else if (s->packet & DCA_PACKET_CORE) {
307  if ((ret = ff_dca_core_filter_frame(&s->core, frame)) < 0) {
308  s->core_residual_valid = 0;
309  return ret;
310  }
312  } else {
313  return AVERROR_INVALIDDATA;
314  }
315 
316  *got_frame_ptr = 1;
317 
318  return avpkt->size;
319 }
320 
322 {
323  DCAContext *s = avctx->priv_data;
324 
325  ff_dca_core_flush(&s->core);
326  ff_dca_xll_flush(&s->xll);
327 
328  s->core_residual_valid = 0;
329 }
330 
332 {
333  DCAContext *s = avctx->priv_data;
334 
335  ff_dca_core_close(&s->core);
336  ff_dca_xll_close(&s->xll);
337 
338  av_freep(&s->buffer);
339  s->buffer_size = 0;
340 
341  return 0;
342 }
343 
345 {
346  DCAContext *s = avctx->priv_data;
347 
348  s->avctx = avctx;
349  s->core.avctx = avctx;
350  s->exss.avctx = avctx;
351  s->xll.avctx = avctx;
352 
353  if (ff_dca_core_init(&s->core) < 0)
354  return AVERROR(ENOMEM);
355 
356  ff_dcadsp_init(&s->dcadsp);
357  s->core.dcadsp = &s->dcadsp;
358  s->xll.dcadsp = &s->dcadsp;
359 
360  switch (avctx->request_channel_layout & ~AV_CH_LAYOUT_NATIVE) {
361  case 0:
362  s->request_channel_layout = 0;
363  break;
364  case AV_CH_LAYOUT_STEREO:
367  break;
370  break;
373  break;
374  default:
375  av_log(avctx, AV_LOG_WARNING, "Invalid request_channel_layout\n");
376  break;
377  }
378 
380  avctx->bits_per_raw_sample = 24;
381 
382  return 0;
383 }
384 
385 #define OFFSET(x) offsetof(DCAContext, x)
386 #define PARAM AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
387 
388 static const AVOption dcadec_options[] = {
389  { "core_only", "Decode core only without extensions", OFFSET(core_only), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, PARAM },
390  { NULL }
391 };
392 
393 static const AVClass dcadec_class = {
394  .class_name = "DCA decoder",
395  .item_name = av_default_item_name,
396  .option = dcadec_options,
397  .version = LIBAVUTIL_VERSION_INT,
398  .category = AV_CLASS_CATEGORY_DECODER,
399 };
400 
402  .name = "dca",
403  .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
404  .type = AVMEDIA_TYPE_AUDIO,
405  .id = AV_CODEC_ID_DTS,
406  .priv_data_size = sizeof(DCAContext),
407  .init = dcadec_init,
409  .close = dcadec_close,
410  .flush = dcadec_flush,
414  .priv_class = &dcadec_class,
416  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
417 };
#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:2122
float, planar
Definition: samplefmt.h:70
#define NULL
Definition: coverity.c:32
DCACoreDecoder core
Core decoder context.
Definition: dcadec.h:46
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:181
static const AVClass dcadec_class
Definition: dcadec.c:393
AVOption.
Definition: opt.h:245
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
static void flush(AVCodecContext *avctx)
int ff_dca_check_crc(GetBitContext *s, int p1, int p2)
Definition: dcadec.c:97
#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:344
#define DCA_PACKET_RECOVERY
Definition: dcadec.h:40
int ff_dca_core_parse_exss(DCACoreDecoder *s, uint8_t *data, DCAExssAsset *asset)
Definition: dca_core.c:1995
int frame_size
Primary frame byte size.
Definition: dca_core.h:80
#define DCA_PACKET_EXSS
Definition: dcadec.h:38
int size
Definition: avcodec.h:1468
const uint8_t * buffer
Definition: get_bits.h:55
int av_log2(unsigned v)
Definition: intmath.c:26
av_cold void ff_dca_core_close(DCACoreDecoder *s)
Definition: dca_core.c:2595
static av_cold int dcadec_close(AVCodecContext *avctx)
Definition: dcadec.c:331
int core_only
Core only decoding flag.
Definition: dcadec.h:60
#define DCA_FILTER_MODE_FIXED
Definition: dca_core.h:57
int packet
Packet flags.
Definition: dcadec.h:55
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: avcodec.h:915
uint8_t * buffer
Packet buffer.
Definition: dcadec.h:52
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:2924
#define AV_CH_LAYOUT_STEREO
int freq
Original sampling frequency (max. 96000 Hz)
Definition: dca_xll.h:70
AVCodec.
Definition: avcodec.h:3392
#define AV_CH_LAYOUT_5POINT0
static uint16_t crc16(const uint8_t *data, int size)
Definition: dcadec.c:79
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:385
enum AVSampleFormat sample_fmt
audio sample format
Definition: avcodec.h:2295
uint8_t
static av_cold void dcadec_flush(AVCodecContext *avctx)
Definition: dcadec.c:321
#define av_cold
Definition: attributes.h:82
AVOptions.
int ff_dca_core_parse(DCACoreDecoder *s, uint8_t *data, int size)
Definition: dca_core.c:1960
#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:187
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
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:388
uint8_t * data
Definition: avcodec.h:1467
AVCodecContext * avctx
Definition: dcadec.h:44
ptrdiff_t size
Definition: opengl_enc.c:101
#define FFALIGN(x, a)
Definition: macros.h:48
#define av_log(a,...)
DCAExssParser exss
EXSS parser context.
Definition: dcadec.h:47
#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:106
#define U(x)
Definition: vp56_arith.h:37
static const AVOption dcadec_options[]
Definition: dcadec.c:388
#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:1330
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:3399
#define DCA_SPEAKER_LAYOUT_STEREO
Definition: dca.h:79
#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:35
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:2338
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:2811
signed 32 bits, planar
Definition: samplefmt.h:69
void(* dmix_scale)(int32_t *dst, int scale, ptrdiff_t len)
Definition: dcadsp.h:81
#define DCA_PACKET_XLL
Definition: dcadec.h:39
int size_in_bits
Definition: get_bits.h:57
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:39
#define DCA_HAS_STEREO(mask)
Definition: dca.h:90
AVCodecContext * avctx
Definition: dca_core.h:74
DCAXllDecoder xll
XLL decoder context.
Definition: dcadec.h:48
int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask)
Definition: dcadec.c:32
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:2562
#define AV_EF_EXPLODE
abort decoding on minor error detection
Definition: avcodec.h:2822
#define src
Definition: vp9dsp.c:530
DCAExssAsset assets[1]
Audio asset descriptors.
Definition: dca_exss.h:87
int frame_size
Definition: mxfenc.c:1821
int core_residual_valid
Core valid for residual decoding.
Definition: dcadec.h:57
void ff_dca_downmix_to_stereo_float(AVFloatDSPContext *fdsp, float **samples, int *coeff_l, int nsamples, int ch_mask)
Definition: dcadec.c:137
#define MIN_PACKET_SIZE
Definition: dcadec.c:29
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:59
#define DCA_PACKET_CORE
Definition: dcadec.h:37
#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:1532
#define DCA_SPEAKER_LAYOUT_7POINT0_WIDE
Definition: dca.h:87
Describe the class of an AVClass context structure.
Definition: log.h:67
#define PARAM
Definition: dcadec.c:386
av_cold int ff_dca_core_init(DCACoreDecoder *s)
Definition: dca_core.c:2575
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:86
AVCodec ff_dca_decoder
Definition: dcadec.c:401
#define DCA_SPEAKER_LAYOUT_5POINT0
Definition: dca.h:85
const AVProfile ff_dca_profiles[]
Definition: profiles.c:40
int ff_dca_core_filter_frame(DCACoreDecoder *s, AVFrame *frame)
Definition: dca_core.c:2508
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
Definition: ccaption_dec.c:572
DCADSPContext dcadsp
Definition: dcadec.h:50
av_cold void ff_dca_xll_flush(DCAXllDecoder *s)
Definition: dca_xll.c:1477
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:59
static int convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, int max_size)
Definition: dcadec.c:171
AVCodecContext * avctx
Definition: dca_exss.h:72
void * priv_data
Definition: avcodec.h:1574
av_cold void ff_dca_xll_close(DCAXllDecoder *s)
Definition: dca_xll.c:1482
int channels
number of audio channels
Definition: avcodec.h:2288
#define DCA_SYNCWORD_SUBSTREAM
Definition: dca_syncwords.h:32
unsigned int buffer_size
Definition: dcadec.h:53
int ff_dca_xll_parse(DCAXllDecoder *s, uint8_t *data, DCAExssAsset *asset)
Definition: dca_xll.c:1169
int ff_dca_exss_parse(DCAExssParser *s, uint8_t *data, int size)
Definition: dca_exss.c:383
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:701
#define av_freep(p)
signed 16 bits, planar
Definition: samplefmt.h:68
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:2345
This structure stores compressed data.
Definition: avcodec.h:1444
#define DCA_SPEAKER_LAYOUT_7POINT1_WIDE
Definition: dca.h:88
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:856