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 #include "libavutil/thread.h"
24 
25 #include "dcadec.h"
26 #include "dcahuff.h"
27 #include "dca_syncwords.h"
28 #include "profiles.h"
29 
30 #define MIN_PACKET_SIZE 16
31 #define MAX_PACKET_SIZE 0x104000
32 
33 int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask)
34 {
35  static const uint8_t dca2wav_norm[28] = {
36  2, 0, 1, 9, 10, 3, 8, 4, 5, 9, 10, 6, 7, 12,
37  13, 14, 3, 6, 7, 11, 12, 14, 16, 15, 17, 8, 4, 5,
38  };
39 
40  static const uint8_t dca2wav_wide[28] = {
41  2, 0, 1, 4, 5, 3, 8, 4, 5, 9, 10, 6, 7, 12,
42  13, 14, 3, 9, 10, 11, 12, 14, 16, 15, 17, 8, 4, 5,
43  };
44 
45  int dca_ch, wav_ch, nchannels = 0;
46 
48  for (dca_ch = 0; dca_ch < DCA_SPEAKER_COUNT; dca_ch++)
49  if (dca_mask & (1U << dca_ch))
50  ch_remap[nchannels++] = dca_ch;
51  avctx->channel_layout = dca_mask;
52  } else {
53  int wav_mask = 0;
54  int wav_map[18];
55  const uint8_t *dca2wav;
56  if (dca_mask == DCA_SPEAKER_LAYOUT_7POINT0_WIDE ||
58  dca2wav = dca2wav_wide;
59  else
60  dca2wav = dca2wav_norm;
61  for (dca_ch = 0; dca_ch < 28; dca_ch++) {
62  if (dca_mask & (1 << dca_ch)) {
63  wav_ch = dca2wav[dca_ch];
64  if (!(wav_mask & (1 << wav_ch))) {
65  wav_map[wav_ch] = dca_ch;
66  wav_mask |= 1 << wav_ch;
67  }
68  }
69  }
70  for (wav_ch = 0; wav_ch < 18; wav_ch++)
71  if (wav_mask & (1 << wav_ch))
72  ch_remap[nchannels++] = wav_map[wav_ch];
73  avctx->channel_layout = wav_mask;
74  }
75 
76  avctx->channels = nchannels;
77  return nchannels;
78 }
79 
81  int *coeff_l, int nsamples, int ch_mask)
82 {
83  int pos, spkr, max_spkr = av_log2(ch_mask);
84  int *coeff_r = coeff_l + av_popcount(ch_mask);
85 
86  av_assert0(DCA_HAS_STEREO(ch_mask));
87 
88  // Scale left and right channels
89  pos = (ch_mask & DCA_SPEAKER_MASK_C);
90  dcadsp->dmix_scale(samples[DCA_SPEAKER_L], coeff_l[pos ], nsamples);
91  dcadsp->dmix_scale(samples[DCA_SPEAKER_R], coeff_r[pos + 1], nsamples);
92 
93  // Downmix remaining channels
94  for (spkr = 0; spkr <= max_spkr; spkr++) {
95  if (!(ch_mask & (1U << spkr)))
96  continue;
97 
98  if (*coeff_l && spkr != DCA_SPEAKER_L)
99  dcadsp->dmix_add(samples[DCA_SPEAKER_L], samples[spkr],
100  *coeff_l, nsamples);
101 
102  if (*coeff_r && spkr != DCA_SPEAKER_R)
103  dcadsp->dmix_add(samples[DCA_SPEAKER_R], samples[spkr],
104  *coeff_r, nsamples);
105 
106  coeff_l++;
107  coeff_r++;
108  }
109 }
110 
112  int *coeff_l, int nsamples, int ch_mask)
113 {
114  int pos, spkr, max_spkr = av_log2(ch_mask);
115  int *coeff_r = coeff_l + av_popcount(ch_mask);
116  const float scale = 1.0f / (1 << 15);
117 
118  av_assert0(DCA_HAS_STEREO(ch_mask));
119 
120  // Scale left and right channels
121  pos = (ch_mask & DCA_SPEAKER_MASK_C);
123  coeff_l[pos ] * scale, nsamples);
125  coeff_r[pos + 1] * scale, nsamples);
126 
127  // Downmix remaining channels
128  for (spkr = 0; spkr <= max_spkr; spkr++) {
129  if (!(ch_mask & (1U << spkr)))
130  continue;
131 
132  if (*coeff_l && spkr != DCA_SPEAKER_L)
134  *coeff_l * scale, nsamples);
135 
136  if (*coeff_r && spkr != DCA_SPEAKER_R)
138  *coeff_r * scale, nsamples);
139 
140  coeff_l++;
141  coeff_r++;
142  }
143 }
144 
145 static int dcadec_decode_frame(AVCodecContext *avctx, void *data,
146  int *got_frame_ptr, AVPacket *avpkt)
147 {
148  DCAContext *s = avctx->priv_data;
149  AVFrame *frame = data;
150  uint8_t *input = avpkt->data;
151  int input_size = avpkt->size;
152  int i, ret, prev_packet = s->packet;
153  uint32_t mrk;
154 
155  if (input_size < MIN_PACKET_SIZE || input_size > MAX_PACKET_SIZE) {
156  av_log(avctx, AV_LOG_ERROR, "Invalid packet size\n");
157  return AVERROR_INVALIDDATA;
158  }
159 
160  // Convert input to BE format
161  mrk = AV_RB32(input);
162  if (mrk != DCA_SYNCWORD_CORE_BE && mrk != DCA_SYNCWORD_SUBSTREAM) {
163  av_fast_padded_malloc(&s->buffer, &s->buffer_size, input_size);
164  if (!s->buffer)
165  return AVERROR(ENOMEM);
166 
167  for (i = 0, ret = AVERROR_INVALIDDATA; i < input_size - MIN_PACKET_SIZE + 1 && ret < 0; i++)
168  ret = avpriv_dca_convert_bitstream(input + i, input_size - i, s->buffer, s->buffer_size);
169 
170  if (ret < 0) {
171  av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n");
172  return ret;
173  }
174 
175  input = s->buffer;
176  input_size = ret;
177  }
178 
179  s->packet = 0;
180 
181  // Parse backward compatible core sub-stream
183  int frame_size;
184 
185  if ((ret = ff_dca_core_parse(&s->core, input, input_size)) < 0)
186  return ret;
187 
188  s->packet |= DCA_PACKET_CORE;
189 
190  // EXXS data must be aligned on 4-byte boundary
191  frame_size = FFALIGN(s->core.frame_size, 4);
192  if (input_size - 4 > frame_size) {
193  input += frame_size;
194  input_size -= frame_size;
195  }
196  }
197 
198  if (!s->core_only) {
199  DCAExssAsset *asset = NULL;
200 
201  // Parse extension sub-stream (EXSS)
203  if ((ret = ff_dca_exss_parse(&s->exss, input, input_size)) < 0) {
204  if (avctx->err_recognition & AV_EF_EXPLODE)
205  return ret;
206  } else {
207  s->packet |= DCA_PACKET_EXSS;
208  asset = &s->exss.assets[0];
209  }
210  }
211 
212  // Parse XLL component in EXSS
213  if (asset && (asset->extension_mask & DCA_EXSS_XLL)) {
214  if ((ret = ff_dca_xll_parse(&s->xll, input, asset)) < 0) {
215  // Conceal XLL synchronization error
216  if (ret == AVERROR(EAGAIN)
217  && (prev_packet & DCA_PACKET_XLL)
218  && (s->packet & DCA_PACKET_CORE))
219  s->packet |= DCA_PACKET_XLL | DCA_PACKET_RECOVERY;
220  else if (ret == AVERROR(ENOMEM) || (avctx->err_recognition & AV_EF_EXPLODE))
221  return ret;
222  } else {
223  s->packet |= DCA_PACKET_XLL;
224  }
225  }
226 
227  // Parse LBR component in EXSS
228  if (asset && (asset->extension_mask & DCA_EXSS_LBR)) {
229  if ((ret = ff_dca_lbr_parse(&s->lbr, input, asset)) < 0) {
230  if (ret == AVERROR(ENOMEM) || (avctx->err_recognition & AV_EF_EXPLODE))
231  return ret;
232  } else {
233  s->packet |= DCA_PACKET_LBR;
234  }
235  }
236 
237  // Parse core extensions in EXSS or backward compatible core sub-stream
238  if ((s->packet & DCA_PACKET_CORE)
239  && (ret = ff_dca_core_parse_exss(&s->core, input, asset)) < 0)
240  return ret;
241  }
242 
243  // Filter the frame
244  if (s->packet & DCA_PACKET_LBR) {
245  if ((ret = ff_dca_lbr_filter_frame(&s->lbr, frame)) < 0)
246  return ret;
247  } else if (s->packet & DCA_PACKET_XLL) {
248  if (s->packet & DCA_PACKET_CORE) {
249  int x96_synth = -1;
250 
251  // Enable X96 synthesis if needed
252  if (s->xll.chset[0].freq == 96000 && s->core.sample_rate == 48000)
253  x96_synth = 1;
254 
255  if ((ret = ff_dca_core_filter_fixed(&s->core, x96_synth)) < 0)
256  return ret;
257 
258  // Force lossy downmixed output on the first core frame filtered.
259  // This prevents audible clicks when seeking and is consistent with
260  // what reference decoder does when there are multiple channel sets.
261  if (!(prev_packet & DCA_PACKET_RESIDUAL) && s->xll.nreschsets > 0
262  && s->xll.nchsets > 1) {
263  av_log(avctx, AV_LOG_VERBOSE, "Forcing XLL recovery mode\n");
264  s->packet |= DCA_PACKET_RECOVERY;
265  }
266 
267  // Set 'residual ok' flag for the next frame
268  s->packet |= DCA_PACKET_RESIDUAL;
269  }
270 
271  if ((ret = ff_dca_xll_filter_frame(&s->xll, frame)) < 0) {
272  // Fall back to core unless hard error
273  if (!(s->packet & DCA_PACKET_CORE))
274  return ret;
276  return ret;
277  if ((ret = ff_dca_core_filter_frame(&s->core, frame)) < 0)
278  return ret;
279  }
280  } else if (s->packet & DCA_PACKET_CORE) {
281  if ((ret = ff_dca_core_filter_frame(&s->core, frame)) < 0)
282  return ret;
283  if (s->core.filter_mode & DCA_FILTER_MODE_FIXED)
284  s->packet |= DCA_PACKET_RESIDUAL;
285  } else {
286  av_log(avctx, AV_LOG_ERROR, "No valid DCA sub-stream found\n");
287  if (s->core_only)
288  av_log(avctx, AV_LOG_WARNING, "Consider disabling 'core_only' option\n");
289  return AVERROR_INVALIDDATA;
290  }
291 
292  *got_frame_ptr = 1;
293 
294  return avpkt->size;
295 }
296 
298 {
299  DCAContext *s = avctx->priv_data;
300 
301  ff_dca_core_flush(&s->core);
302  ff_dca_xll_flush(&s->xll);
303  ff_dca_lbr_flush(&s->lbr);
304 
305  s->packet &= DCA_PACKET_MASK;
306 }
307 
309 {
310  DCAContext *s = avctx->priv_data;
311 
312  ff_dca_core_close(&s->core);
313  ff_dca_xll_close(&s->xll);
314  ff_dca_lbr_close(&s->lbr);
315 
316  av_freep(&s->buffer);
317  s->buffer_size = 0;
318 
319  return 0;
320 }
321 
322 static av_cold void dcadec_init_static(void)
323 {
326 }
327 
329 {
330  static AVOnce init_static_once = AV_ONCE_INIT;
331  DCAContext *s = avctx->priv_data;
332 
333  s->avctx = avctx;
334  s->core.avctx = avctx;
335  s->exss.avctx = avctx;
336  s->xll.avctx = avctx;
337  s->lbr.avctx = avctx;
338 
339  if (ff_dca_core_init(&s->core) < 0)
340  return AVERROR(ENOMEM);
341 
342  if (ff_dca_lbr_init(&s->lbr) < 0)
343  return AVERROR(ENOMEM);
344 
345  ff_dcadsp_init(&s->dcadsp);
346  s->core.dcadsp = &s->dcadsp;
347  s->xll.dcadsp = &s->dcadsp;
348  s->lbr.dcadsp = &s->dcadsp;
349 
351 
352  switch (avctx->request_channel_layout & ~AV_CH_LAYOUT_NATIVE) {
353  case 0:
354  s->request_channel_layout = 0;
355  break;
356  case AV_CH_LAYOUT_STEREO:
358  s->request_channel_layout = DCA_SPEAKER_LAYOUT_STEREO;
359  break;
361  s->request_channel_layout = DCA_SPEAKER_LAYOUT_5POINT0;
362  break;
364  s->request_channel_layout = DCA_SPEAKER_LAYOUT_5POINT1;
365  break;
366  default:
367  av_log(avctx, AV_LOG_WARNING, "Invalid request_channel_layout\n");
368  break;
369  }
370 
371  ff_thread_once(&init_static_once, dcadec_init_static);
372 
373  return 0;
374 }
375 
376 #define OFFSET(x) offsetof(DCAContext, x)
377 #define PARAM AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
378 
379 static const AVOption dcadec_options[] = {
380  { "core_only", "Decode core only without extensions", OFFSET(core_only), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, PARAM },
381  { NULL }
382 };
383 
384 static const AVClass dcadec_class = {
385  .class_name = "DCA decoder",
386  .item_name = av_default_item_name,
387  .option = dcadec_options,
388  .version = LIBAVUTIL_VERSION_INT,
389  .category = AV_CLASS_CATEGORY_DECODER,
390 };
391 
393  .name = "dca",
394  .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
395  .type = AVMEDIA_TYPE_AUDIO,
396  .id = AV_CODEC_ID_DTS,
397  .priv_data_size = sizeof(DCAContext),
398  .init = dcadec_init,
400  .close = dcadec_close,
401  .flush = dcadec_flush,
405  .priv_class = &dcadec_class,
408 };
AVCodec
AVCodec.
Definition: codec.h:202
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:69
dcadec_decode_frame
static int dcadec_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: dcadec.c:145
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:42
dcadec_close
static av_cold int dcadec_close(AVCodecContext *avctx)
Definition: dcadec.c:308
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
AVERROR
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
opt.h
AV_CLASS_CATEGORY_DECODER
@ AV_CLASS_CATEGORY_DECODER
Definition: log.h:35
AVCodecContext::channel_layout
uint64_t channel_layout
Audio channel layout.
Definition: avcodec.h:1043
ff_dca_core_parse_exss
int ff_dca_core_parse_exss(DCACoreDecoder *s, uint8_t *data, DCAExssAsset *asset)
Definition: dca_core.c:1832
DCA_SPEAKER_LAYOUT_5POINT0
#define DCA_SPEAKER_LAYOUT_5POINT0
Definition: dca.h:129
sample_fmts
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:948
thread.h
ff_dca_core_close
av_cold void ff_dca_core_close(DCACoreDecoder *s)
Definition: dca_core.c:2431
AVCodecContext::err_recognition
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
Definition: avcodec.h:1324
ff_dca_xll_parse
int ff_dca_xll_parse(DCAXllDecoder *s, uint8_t *data, DCAExssAsset *asset)
Definition: dca_xll.c:1162
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:303
DCA_PACKET_LBR
#define DCA_PACKET_LBR
Definition: dcadec.h:40
AVPacket::data
uint8_t * data
Definition: packet.h:373
AVOption
AVOption.
Definition: opt.h:247
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:68
data
const char data[16]
Definition: mxf.c:143
DCA_SPEAKER_LAYOUT_STEREO
#define DCA_SPEAKER_LAYOUT_STEREO
Definition: dca.h:123
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
av_popcount
#define av_popcount
Definition: common.h:150
DCA_PACKET_XLL
#define DCA_PACKET_XLL
Definition: dcadec.h:39
AVCodecContext::request_channel_layout
uint64_t request_channel_layout
Request decoder to use this channel layout if it can (0 for default)
Definition: avcodec.h:1050
DCA_FILTER_MODE_FIXED
#define DCA_FILTER_MODE_FIXED
Definition: dca_core.h:57
dcadec_init
static av_cold int dcadec_init(AVCodecContext *avctx)
Definition: dcadec.c:328
DCAExssAsset
Definition: dca_exss.h:29
DCA_PACKET_RECOVERY
#define DCA_PACKET_RECOVERY
Sync error recovery flag.
Definition: dcadec.h:43
ff_dca_core_filter_frame
int ff_dca_core_filter_frame(DCACoreDecoder *s, AVFrame *frame)
Definition: dca_core.c:2346
avpriv_dca_convert_bitstream
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
DCA_EXSS_XLL
@ DCA_EXSS_XLL
Definition: dca.h:180
U
#define U(x)
Definition: vp56_arith.h:37
ff_dca_profiles
const AVProfile ff_dca_profiles[]
Definition: profiles.c:38
dcadec_flush
static av_cold void dcadec_flush(AVCodecContext *avctx)
Definition: dcadec.c:297
DCA_SPEAKER_MASK_C
@ DCA_SPEAKER_MASK_C
Definition: dca.h:92
scale
static av_always_inline float scale(float x, float s)
Definition: vf_v360.c:1376
DCA_SPEAKER_LAYOUT_7POINT1_WIDE
#define DCA_SPEAKER_LAYOUT_7POINT1_WIDE
Definition: dca.h:132
ff_dca_downmix_to_stereo_float
void ff_dca_downmix_to_stereo_float(AVFloatDSPContext *fdsp, float **samples, int *coeff_l, int nsamples, int ch_mask)
Definition: dcadec.c:111
dcadec_init_static
static av_cold void dcadec_init_static(void)
Definition: dcadec.c:322
AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_STEREO
Definition: channel_layout.h:91
ff_thread_once
static int ff_thread_once(char *control, void(*routine)(void))
Definition: thread.h:175
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
ff_dca_lbr_init_tables
av_cold void ff_dca_lbr_init_tables(void)
Definition: dca_lbr.c:127
ff_dca_downmix_to_stereo_fixed
void ff_dca_downmix_to_stereo_fixed(DCADSPContext *dcadsp, int32_t **samples, int *coeff_l, int nsamples, int ch_mask)
Definition: dcadec.c:80
decode
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
dcadec_options
static const AVOption dcadec_options[]
Definition: dcadec.c:379
s
#define s(width, name)
Definition: cbs_vp9.c:257
DCA_SPEAKER_LAYOUT_7POINT0_WIDE
#define DCA_SPEAKER_LAYOUT_7POINT0_WIDE
Definition: dca.h:131
DCA_SPEAKER_LAYOUT_5POINT1
#define DCA_SPEAKER_LAYOUT_5POINT1
Definition: dca.h:130
frame_size
int frame_size
Definition: mxfenc.c:2207
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AV_CH_LAYOUT_STEREO_DOWNMIX
#define AV_CH_LAYOUT_STEREO_DOWNMIX
Definition: channel_layout.h:117
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
DCADSPContext::dmix_scale
void(* dmix_scale)(int32_t *dst, int scale, ptrdiff_t len)
Definition: dcadsp.h:81
dcadec.h
dca_syncwords.h
ff_dca_set_channel_layout
int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask)
Definition: dcadec.c:33
ff_dca_lbr_filter_frame
int ff_dca_lbr_filter_frame(DCALbrDecoder *s, AVFrame *frame)
Definition: dca_lbr.c:1729
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AV_ONCE_INIT
#define AV_ONCE_INIT
Definition: thread.h:173
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
DCA_HAS_STEREO
#define DCA_HAS_STEREO(mask)
Definition: dca.h:134
flush
static void flush(AVCodecContext *avctx)
Definition: aacdec_template.c:593
NULL
#define NULL
Definition: coverity.c:32
AVFloatDSPContext::vector_fmul_scalar
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
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
profiles.h
AV_CH_LAYOUT_5POINT1
#define AV_CH_LAYOUT_5POINT1
Definition: channel_layout.h:101
ff_dca_init_vlcs
av_cold void ff_dca_init_vlcs(void)
Definition: dcahuff.c:1265
OFFSET
#define OFFSET(x)
Definition: dcadec.c:376
AV_EF_EXPLODE
#define AV_EF_EXPLODE
abort decoding on minor error detection
Definition: avcodec.h:1335
DCA_PACKET_CORE
#define DCA_PACKET_CORE
Definition: dcadec.h:37
DCADSPContext
Definition: dcadsp.h:30
AVOnce
#define AVOnce
Definition: thread.h:172
AV_CODEC_CAP_CHANNEL_CONF
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:109
DCA_SYNCWORD_CORE_BE
#define DCA_SYNCWORD_CORE_BE
Definition: dca_syncwords.h:22
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
dcahuff.h
AVPacket::size
int size
Definition: packet.h:374
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
ff_dcadsp_init
av_cold void ff_dcadsp_init(DCADSPContext *s)
Definition: dcadsp.c:459
PARAM
#define PARAM
Definition: dcadec.c:377
AV_CODEC_ID_DTS
@ AV_CODEC_ID_DTS
Definition: codec_id.h:426
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
ff_dca_core_parse
int ff_dca_core_parse(DCACoreDecoder *s, uint8_t *data, int size)
Definition: dca_core.c:1799
AV_RB32
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:96
AVFloatDSPContext
Definition: float_dsp.h:24
DCA_PACKET_RESIDUAL
#define DCA_PACKET_RESIDUAL
Core valid for residual decoding.
Definition: dcadec.h:44
av_crc_get_table
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
Definition: crc.c:374
DCA_SPEAKER_R
@ DCA_SPEAKER_R
Definition: dca.h:79
input
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
Definition: filter_design.txt:172
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:67
AVCodecContext::channels
int channels
number of audio channels
Definition: avcodec.h:993
ff_dca_core_init
av_cold int ff_dca_core_init(DCACoreDecoder *s)
Definition: dca_core.c:2413
AV_CH_LAYOUT_5POINT0
#define AV_CH_LAYOUT_5POINT0
Definition: channel_layout.h:100
DCADSPContext::dmix_add
void(* dmix_add)(int32_t *dst, const int32_t *src, int coeff, ptrdiff_t len)
Definition: dcadsp.h:79
ff_dca_exss_parse
int ff_dca_exss_parse(DCAExssParser *s, const uint8_t *data, int size)
Definition: dca_exss.c:378
i
int i
Definition: input.c:406
DCAContext
Definition: dcadec.h:46
AV_CRC_16_CCITT
@ AV_CRC_16_CCITT
Definition: crc.h:51
AVFloatDSPContext::vector_fmac_scalar
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
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: internal.h:50
AV_CH_LAYOUT_NATIVE
#define AV_CH_LAYOUT_NATIVE
Channel mask value used for AVCodecContext.request_channel_layout to indicate that the user requests ...
Definition: channel_layout.h:83
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
av_fast_padded_malloc
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:50
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:209
ff_dca_lbr_init
av_cold int ff_dca_lbr_init(DCALbrDecoder *s)
Definition: dca_lbr.c:1813
DCA_SYNCWORD_SUBSTREAM
#define DCA_SYNCWORD_SUBSTREAM
Definition: dca_syncwords.h:32
ff_dca_core_filter_fixed
int ff_dca_core_filter_fixed(DCACoreDecoder *s, int x96_synth)
Definition: dca_core.c:1960
ff_dca_xll_filter_frame
int ff_dca_xll_filter_frame(DCAXllDecoder *s, AVFrame *frame)
Definition: dca_xll.c:1323
ff_dca_lbr_flush
av_cold void ff_dca_lbr_flush(DCALbrDecoder *s)
Definition: dca_lbr.c:1789
ret
ret
Definition: filter_design.txt:187
DCA_PACKET_EXSS
#define DCA_PACKET_EXSS
Definition: dcadec.h:38
ff_dca_lbr_close
av_cold void ff_dca_lbr_close(DCALbrDecoder *s)
Definition: dca_lbr.c:1822
AVClass::class_name
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:71
frame
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
Definition: filter_design.txt:264
pos
unsigned int pos
Definition: spdifenc.c:412
dcadec_class
static const AVClass dcadec_class
Definition: dcadec.c:384
AVCodecContext
main external API structure.
Definition: avcodec.h:383
channel_layout.h
MAX_PACKET_SIZE
#define MAX_PACKET_SIZE
Definition: dcadec.c:31
DCA_PACKET_MASK
#define DCA_PACKET_MASK
Definition: dcadec.h:41
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8
ff_dca_lbr_parse
int ff_dca_lbr_parse(DCALbrDecoder *s, uint8_t *data, DCAExssAsset *asset)
Definition: dca_lbr.c:1162
DCAExssAsset::extension_mask
int extension_mask
Coding components used in asset.
Definition: dca_exss.h:45
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
MIN_PACKET_SIZE
#define MIN_PACKET_SIZE
Definition: dcadec.c:30
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:410
AVPacket
This structure stores compressed data.
Definition: packet.h:350
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:241
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
ff_dca_xll_flush
av_cold void ff_dca_xll_flush(DCAXllDecoder *s)
Definition: dca_xll.c:1472
int32_t
int32_t
Definition: audioconvert.c:56
DCA_SPEAKER_COUNT
@ DCA_SPEAKER_COUNT
Definition: dca.h:88
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
DCA_SPEAKER_L
@ DCA_SPEAKER_L
Definition: dca.h:79
av_log2
int av_log2(unsigned v)
Definition: intmath.c:26
ff_dca_xll_close
av_cold void ff_dca_xll_close(DCAXllDecoder *s)
Definition: dca_xll.c:1477
DCA_EXSS_LBR
@ DCA_EXSS_LBR
Definition: dca.h:179
ff_dca_core_flush
av_cold void ff_dca_core_flush(DCACoreDecoder *s)
Definition: dca_core.c:2400
ff_dca_decoder
const AVCodec ff_dca_decoder
Definition: dcadec.c:392