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 "codec_internal.h"
26 #include "dcadec.h"
27 #include "dcahuff.h"
28 #include "dca_syncwords.h"
29 #include "profiles.h"
30 
31 #define MIN_PACKET_SIZE 16
32 #define MAX_PACKET_SIZE 0x104000
33 
34 int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask)
35 {
36  static const uint8_t dca2wav_norm[28] = {
37  2, 0, 1, 9, 10, 3, 8, 4, 5, 9, 10, 6, 7, 12,
38  13, 14, 3, 6, 7, 11, 12, 14, 16, 15, 17, 8, 4, 5,
39  };
40 
41  static const uint8_t dca2wav_wide[28] = {
42  2, 0, 1, 4, 5, 3, 8, 4, 5, 9, 10, 6, 7, 12,
43  13, 14, 3, 9, 10, 11, 12, 14, 16, 15, 17, 8, 4, 5,
44  };
45 
46  DCAContext *s = avctx->priv_data;
47 
48  int dca_ch, wav_ch, nchannels = 0;
49 
51  if (s->output_channel_order == CHANNEL_ORDER_CODED) {
52  for (dca_ch = 0; dca_ch < DCA_SPEAKER_COUNT; dca_ch++)
53  if (dca_mask & (1U << dca_ch))
54  ch_remap[nchannels++] = dca_ch;
56  avctx->ch_layout.nb_channels = nchannels;
57  } else {
58  int wav_mask = 0;
59  int wav_map[18];
60  const uint8_t *dca2wav;
61  if (dca_mask == DCA_SPEAKER_LAYOUT_7POINT0_WIDE ||
63  dca2wav = dca2wav_wide;
64  else
65  dca2wav = dca2wav_norm;
66  for (dca_ch = 0; dca_ch < 28; dca_ch++) {
67  if (dca_mask & (1 << dca_ch)) {
68  wav_ch = dca2wav[dca_ch];
69  if (!(wav_mask & (1 << wav_ch))) {
70  wav_map[wav_ch] = dca_ch;
71  wav_mask |= 1 << wav_ch;
72  }
73  }
74  }
75  for (wav_ch = 0; wav_ch < 18; wav_ch++)
76  if (wav_mask & (1 << wav_ch))
77  ch_remap[nchannels++] = wav_map[wav_ch];
78 
79  av_channel_layout_from_mask(&avctx->ch_layout, wav_mask);
80  }
81 
82  return nchannels;
83 }
84 
86  int *coeff_l, int nsamples, int ch_mask)
87 {
88  int pos, spkr, max_spkr = av_log2(ch_mask);
89  int *coeff_r = coeff_l + av_popcount(ch_mask);
90 
91  av_assert0(DCA_HAS_STEREO(ch_mask));
92 
93  // Scale left and right channels
94  pos = (ch_mask & DCA_SPEAKER_MASK_C);
95  dcadsp->dmix_scale(samples[DCA_SPEAKER_L], coeff_l[pos ], nsamples);
96  dcadsp->dmix_scale(samples[DCA_SPEAKER_R], coeff_r[pos + 1], nsamples);
97 
98  // Downmix remaining channels
99  for (spkr = 0; spkr <= max_spkr; spkr++) {
100  if (!(ch_mask & (1U << spkr)))
101  continue;
102 
103  if (*coeff_l && spkr != DCA_SPEAKER_L)
104  dcadsp->dmix_add(samples[DCA_SPEAKER_L], samples[spkr],
105  *coeff_l, nsamples);
106 
107  if (*coeff_r && spkr != DCA_SPEAKER_R)
108  dcadsp->dmix_add(samples[DCA_SPEAKER_R], samples[spkr],
109  *coeff_r, nsamples);
110 
111  coeff_l++;
112  coeff_r++;
113  }
114 }
115 
117  int *coeff_l, int nsamples, int ch_mask)
118 {
119  int pos, spkr, max_spkr = av_log2(ch_mask);
120  int *coeff_r = coeff_l + av_popcount(ch_mask);
121  const float scale = 1.0f / (1 << 15);
122 
123  av_assert0(DCA_HAS_STEREO(ch_mask));
124 
125  // Scale left and right channels
126  pos = (ch_mask & DCA_SPEAKER_MASK_C);
128  coeff_l[pos ] * scale, nsamples);
130  coeff_r[pos + 1] * scale, nsamples);
131 
132  // Downmix remaining channels
133  for (spkr = 0; spkr <= max_spkr; spkr++) {
134  if (!(ch_mask & (1U << spkr)))
135  continue;
136 
137  if (*coeff_l && spkr != DCA_SPEAKER_L)
139  *coeff_l * scale, nsamples);
140 
141  if (*coeff_r && spkr != DCA_SPEAKER_R)
143  *coeff_r * scale, nsamples);
144 
145  coeff_l++;
146  coeff_r++;
147  }
148 }
149 
151  int *got_frame_ptr, AVPacket *avpkt)
152 {
153  DCAContext *s = avctx->priv_data;
154  const uint8_t *input = avpkt->data;
155  int input_size = avpkt->size;
156  int i, ret, prev_packet = s->packet;
157  uint32_t mrk;
158 
159  if (input_size < MIN_PACKET_SIZE || input_size > MAX_PACKET_SIZE) {
160  av_log(avctx, AV_LOG_ERROR, "Invalid packet size\n");
161  return AVERROR_INVALIDDATA;
162  }
163 
164  // Convert input to BE format
165  mrk = AV_RB32(input);
166  if (mrk != DCA_SYNCWORD_CORE_BE && mrk != DCA_SYNCWORD_SUBSTREAM) {
167  av_fast_padded_malloc(&s->buffer, &s->buffer_size, input_size);
168  if (!s->buffer)
169  return AVERROR(ENOMEM);
170 
171  for (i = 0, ret = AVERROR_INVALIDDATA; i < input_size - MIN_PACKET_SIZE + 1 && ret < 0; i++)
172  ret = avpriv_dca_convert_bitstream(input + i, input_size - i, s->buffer, s->buffer_size);
173 
174  if (ret < 0) {
175  av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n");
176  return ret;
177  }
178 
179  input = s->buffer;
180  input_size = ret;
181  }
182 
183  s->packet = 0;
184 
185  // Parse backward compatible core sub-stream
187  int frame_size;
188 
189  if ((ret = ff_dca_core_parse(&s->core, input, input_size)) < 0)
190  return ret;
191 
192  s->packet |= DCA_PACKET_CORE;
193 
194  // EXXS data must be aligned on 4-byte boundary
195  frame_size = FFALIGN(s->core.frame_size, 4);
196  if (input_size - 4 > frame_size) {
197  input += frame_size;
198  input_size -= frame_size;
199  }
200  }
201 
202  if (!s->core_only) {
203  DCAExssAsset *asset = NULL;
204 
205  // Parse extension sub-stream (EXSS)
207  if ((ret = ff_dca_exss_parse(&s->exss, input, input_size)) < 0) {
208  if (avctx->err_recognition & AV_EF_EXPLODE)
209  return ret;
210  } else {
211  s->packet |= DCA_PACKET_EXSS;
212  asset = &s->exss.assets[0];
213  }
214  }
215 
216  // Parse XLL component in EXSS
217  if (asset && (asset->extension_mask & DCA_EXSS_XLL)) {
218  if ((ret = ff_dca_xll_parse(&s->xll, input, asset)) < 0) {
219  // Conceal XLL synchronization error
220  if (ret == AVERROR(EAGAIN)) {
221  if ((prev_packet & DCA_PACKET_XLL) && (s->packet & DCA_PACKET_CORE))
222  s->packet |= DCA_PACKET_XLL | DCA_PACKET_RECOVERY;
223  } else if (ret == AVERROR(ENOMEM) || (avctx->err_recognition & AV_EF_EXPLODE))
224  return ret;
225  } else {
226  s->packet |= DCA_PACKET_XLL;
227  }
228  }
229 
230  // Parse LBR component in EXSS
231  if (asset && (asset->extension_mask & DCA_EXSS_LBR)) {
232  if ((ret = ff_dca_lbr_parse(&s->lbr, input, asset)) < 0) {
233  if (ret == AVERROR(ENOMEM) || (avctx->err_recognition & AV_EF_EXPLODE))
234  return ret;
235  } else {
236  s->packet |= DCA_PACKET_LBR;
237  }
238  }
239 
240  // Parse core extensions in EXSS or backward compatible core sub-stream
241  if ((s->packet & DCA_PACKET_CORE)
242  && (ret = ff_dca_core_parse_exss(&s->core, input, asset)) < 0)
243  return ret;
244  }
245 
246  // Filter the frame
247  if (s->packet & DCA_PACKET_LBR) {
248  if ((ret = ff_dca_lbr_filter_frame(&s->lbr, frame)) < 0)
249  return ret;
250  } else if (s->packet & DCA_PACKET_XLL) {
251  if (s->packet & DCA_PACKET_CORE) {
252  int x96_synth = -1;
253 
254  // Enable X96 synthesis if needed
255  if (s->xll.chset[0].freq == 96000 && s->core.sample_rate == 48000)
256  x96_synth = 1;
257 
258  if ((ret = ff_dca_core_filter_fixed(&s->core, x96_synth)) < 0)
259  return ret;
260 
261  // Force lossy downmixed output on the first core frame filtered.
262  // This prevents audible clicks when seeking and is consistent with
263  // what reference decoder does when there are multiple channel sets.
264  if (!(prev_packet & DCA_PACKET_RESIDUAL) && s->xll.nreschsets > 0
265  && s->xll.nchsets > 1) {
266  av_log(avctx, AV_LOG_VERBOSE, "Forcing XLL recovery mode\n");
267  s->packet |= DCA_PACKET_RECOVERY;
268  }
269 
270  // Set 'residual ok' flag for the next frame
271  s->packet |= DCA_PACKET_RESIDUAL;
272  }
273 
274  if ((ret = ff_dca_xll_filter_frame(&s->xll, frame)) < 0) {
275  // Fall back to core unless hard error
276  if (!(s->packet & DCA_PACKET_CORE))
277  return ret;
279  return ret;
280  if ((ret = ff_dca_core_filter_frame(&s->core, frame)) < 0)
281  return ret;
282  }
283  } else if (s->packet & DCA_PACKET_CORE) {
284  if ((ret = ff_dca_core_filter_frame(&s->core, frame)) < 0)
285  return ret;
286  if (s->core.filter_mode & DCA_FILTER_MODE_FIXED)
287  s->packet |= DCA_PACKET_RESIDUAL;
288  } else {
289  av_log(avctx, AV_LOG_ERROR, "No valid DCA sub-stream found\n");
290  if (s->core_only)
291  av_log(avctx, AV_LOG_WARNING, "Consider disabling 'core_only' option\n");
292  return AVERROR_INVALIDDATA;
293  }
294 
295  *got_frame_ptr = 1;
296 
297  return avpkt->size;
298 }
299 
301 {
302  DCAContext *s = avctx->priv_data;
303 
304  ff_dca_core_flush(&s->core);
305  ff_dca_xll_flush(&s->xll);
306  ff_dca_lbr_flush(&s->lbr);
307 
308  s->packet &= DCA_PACKET_MASK;
309 }
310 
312 {
313  DCAContext *s = avctx->priv_data;
314 
315  ff_dca_core_close(&s->core);
316  ff_dca_xll_close(&s->xll);
317  ff_dca_lbr_close(&s->lbr);
318 
319  av_freep(&s->buffer);
320  s->buffer_size = 0;
321 
322  return 0;
323 }
324 
325 static av_cold void dcadec_init_static(void)
326 {
329 }
330 
332 {
333  static AVOnce init_static_once = AV_ONCE_INIT;
334  DCAContext *s = avctx->priv_data;
335 
336  s->avctx = avctx;
337  s->core.avctx = avctx;
338  s->exss.avctx = avctx;
339  s->xll.avctx = avctx;
340  s->lbr.avctx = avctx;
341 
342  if (ff_dca_core_init(&s->core) < 0)
343  return AVERROR(ENOMEM);
344 
345  if (ff_dca_lbr_init(&s->lbr) < 0)
346  return AVERROR(ENOMEM);
347 
348  ff_dcadsp_init(&s->dcadsp);
349  s->core.dcadsp = &s->dcadsp;
350  s->xll.dcadsp = &s->dcadsp;
351  s->lbr.dcadsp = &s->dcadsp;
352 
354 
355  if (s->downmix_layout.nb_channels) {
358  s->request_channel_layout = DCA_SPEAKER_LAYOUT_STEREO;
361  } else if (!av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT0)) {
362  s->request_channel_layout = DCA_SPEAKER_LAYOUT_5POINT0;
365  } else if (!av_channel_layout_compare(&s->downmix_layout, &(AVChannelLayout)AV_CHANNEL_LAYOUT_5POINT1)) {
366  s->request_channel_layout = DCA_SPEAKER_LAYOUT_5POINT1;
369  }
370  else
371  av_log(avctx, AV_LOG_WARNING, "Invalid downmix layout\n");
372  }
373 
374  ff_thread_once(&init_static_once, dcadec_init_static);
375 
376  return 0;
377 }
378 
379 #define OFFSET(x) offsetof(DCAContext, x)
380 #define PARAM AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
381 
382 static const AVOption dcadec_options[] = {
383  { "core_only", "Decode core only without extensions", OFFSET(core_only), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, PARAM },
384 
385  { "channel_order", "Order in which the channels are to be exported",
386  OFFSET(output_channel_order), AV_OPT_TYPE_INT,
387  { .i64 = CHANNEL_ORDER_DEFAULT }, 0, 1, PARAM, .unit = "channel_order" },
388  { "default", "normal libavcodec channel order", 0, AV_OPT_TYPE_CONST,
389  { .i64 = CHANNEL_ORDER_DEFAULT }, .flags = PARAM, .unit = "channel_order" },
390  { "coded", "order in which the channels are coded in the bitstream",
391  0, AV_OPT_TYPE_CONST, { .i64 = CHANNEL_ORDER_CODED }, .flags = PARAM, .unit = "channel_order" },
392 
393  { "downmix", "Request a specific channel layout from the decoder", OFFSET(downmix_layout),
394  AV_OPT_TYPE_CHLAYOUT, {.str = NULL}, .flags = PARAM },
395 
396  { NULL }
397 };
398 
399 static const AVClass dcadec_class = {
400  .class_name = "DCA decoder",
401  .item_name = av_default_item_name,
402  .option = dcadec_options,
403  .version = LIBAVUTIL_VERSION_INT,
404  .category = AV_CLASS_CATEGORY_DECODER,
405 };
406 
408  .p.name = "dca",
409  CODEC_LONG_NAME("DCA (DTS Coherent Acoustics)"),
410  .p.type = AVMEDIA_TYPE_AUDIO,
411  .p.id = AV_CODEC_ID_DTS,
412  .priv_data_size = sizeof(DCAContext),
413  .init = dcadec_init,
415  .close = dcadec_close,
416  .flush = dcadec_flush,
417  .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
418  .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P,
420  .p.priv_class = &dcadec_class,
421  .p.profiles = NULL_IF_CONFIG_SMALL(ff_dca_profiles),
422  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
423 };
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
dcadec_close
static av_cold int dcadec_close(AVCodecContext *avctx)
Definition: dcadec.c:311
AV_CHANNEL_LAYOUT_STEREO_DOWNMIX
#define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX
Definition: channel_layout.h:413
AV_EF_EXPLODE
#define AV_EF_EXPLODE
abort decoding on minor error detection
Definition: defs.h:51
ff_dca_xll_parse
int ff_dca_xll_parse(DCAXllDecoder *s, const uint8_t *data, DCAExssAsset *asset)
Definition: dca_xll.c:1180
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
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
AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_STEREO
Definition: channel_layout.h:379
DCA_SPEAKER_LAYOUT_5POINT0
#define DCA_SPEAKER_LAYOUT_5POINT0
Definition: dca.h:128
thread.h
ff_dca_core_close
av_cold void ff_dca_core_close(DCACoreDecoder *s)
Definition: dca_core.c:2436
AVCodecContext::err_recognition
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
Definition: avcodec.h:1420
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:344
DCA_PACKET_LBR
#define DCA_PACKET_LBR
Definition: dcadec.h:42
AVPacket::data
uint8_t * data
Definition: packet.h:522
AVOption
AVOption.
Definition: opt.h:346
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:65
DCA_SPEAKER_LAYOUT_STEREO
#define DCA_SPEAKER_LAYOUT_STEREO
Definition: dca.h:122
FFCodec
Definition: codec_internal.h:127
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
AVChannelLayout::order
enum AVChannelOrder order
Channel order used in this layout.
Definition: channel_layout.h:308
av_popcount
#define av_popcount
Definition: common.h:152
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:313
DCA_PACKET_XLL
#define DCA_PACKET_XLL
Definition: dcadec.h:41
DCA_FILTER_MODE_FIXED
#define DCA_FILTER_MODE_FIXED
Definition: dca_core.h:55
ff_dca_lbr_parse
int ff_dca_lbr_parse(DCALbrDecoder *s, const uint8_t *data, DCAExssAsset *asset)
Definition: dca_lbr.c:1169
dcadec_init
static av_cold int dcadec_init(AVCodecContext *avctx)
Definition: dcadec.c:331
DCAExssAsset
Definition: dca_exss.h:29
DCA_PACKET_RECOVERY
#define DCA_PACKET_RECOVERY
Sync error recovery flag.
Definition: dcadec.h:45
ff_dca_core_filter_frame
int ff_dca_core_filter_frame(DCACoreDecoder *s, AVFrame *frame)
Definition: dca_core.c:2343
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:49
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
DCA_EXSS_XLL
@ DCA_EXSS_XLL
Definition: dca.h:179
AVCodecContext::ch_layout
AVChannelLayout ch_layout
Audio channel layout.
Definition: avcodec.h:1065
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:300
DCA_SPEAKER_MASK_C
@ DCA_SPEAKER_MASK_C
Definition: dca.h:91
DCA_SPEAKER_LAYOUT_7POINT1_WIDE
#define DCA_SPEAKER_LAYOUT_7POINT1_WIDE
Definition: dca.h:131
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:116
dcadec_init_static
static av_cold void dcadec_init_static(void)
Definition: dcadec.c:325
ff_thread_once
static int ff_thread_once(char *control, void(*routine)(void))
Definition: thread.h:205
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
dcadec_decode_frame
static int dcadec_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Definition: dcadec.c:150
ff_dca_lbr_init_tables
av_cold void ff_dca_lbr_init_tables(void)
Definition: dca_lbr.c:134
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:85
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:287
dcadec_options
static const AVOption dcadec_options[]
Definition: dcadec.c:382
s
#define s(width, name)
Definition: cbs_vp9.c:198
DCA_SPEAKER_LAYOUT_7POINT0_WIDE
#define DCA_SPEAKER_LAYOUT_7POINT0_WIDE
Definition: dca.h:130
DCA_SPEAKER_LAYOUT_5POINT1
#define DCA_SPEAKER_LAYOUT_5POINT1
Definition: dca.h:129
frame_size
int frame_size
Definition: mxfenc.c:2422
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AV_CHANNEL_ORDER_UNSPEC
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
Definition: channel_layout.h:112
av_channel_layout_from_mask
int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask)
Initialize a native channel layout from a bitmask indicating which channels are present.
Definition: channel_layout.c:242
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
DCADSPContext::dmix_scale
void(* dmix_scale)(int32_t *dst, int scale, ptrdiff_t len)
Definition: dcadsp.h:82
dcadec.h
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
frame
static AVFrame * frame
Definition: demux_decode.c:54
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:34
ff_dca_lbr_filter_frame
int ff_dca_lbr_filter_frame(DCALbrDecoder *s, AVFrame *frame)
Definition: dca_lbr.c:1736
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AV_ONCE_INIT
#define AV_ONCE_INIT
Definition: thread.h:203
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
DCA_HAS_STEREO
#define DCA_HAS_STEREO(mask)
Definition: dca.h:133
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:83
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
profiles.h
ff_dca_init_vlcs
av_cold void ff_dca_init_vlcs(void)
Definition: dcahuff.c:789
ff_dca_decoder
const FFCodec ff_dca_decoder
Definition: dcadec.c:407
OFFSET
#define OFFSET(x)
Definition: dcadec.c:379
AV_OPT_TYPE_CHLAYOUT
@ AV_OPT_TYPE_CHLAYOUT
Definition: opt.h:252
DCA_PACKET_CORE
#define DCA_PACKET_CORE
Definition: dcadec.h:39
DCADSPContext
Definition: dcadsp.h:30
AVOnce
#define AVOnce
Definition: thread.h:202
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:106
DCA_SYNCWORD_CORE_BE
#define DCA_SYNCWORD_CORE_BE
Definition: dca_syncwords.h:22
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
dcahuff.h
AVPacket::size
int size
Definition: packet.h:523
scale
static void scale(int *out, const int *in, const int w, const int h, const int shift)
Definition: vvc_intra.c:291
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:106
ff_dca_core_parse
int ff_dca_core_parse(DCACoreDecoder *s, const uint8_t *data, int size)
Definition: dca_core.c:1795
ff_dcadsp_init
av_cold void ff_dcadsp_init(DCADSPContext *s)
Definition: dcadsp.c:461
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:303
codec_internal.h
PARAM
#define PARAM
Definition: dcadec.c:380
AV_CODEC_ID_DTS
@ AV_CODEC_ID_DTS
Definition: codec_id.h:444
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
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:22
DCA_PACKET_RESIDUAL
#define DCA_PACKET_RESIDUAL
Core valid for residual decoding.
Definition: dcadec.h:46
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:78
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:64
av_channel_layout_compare
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
Definition: channel_layout.c:800
ff_dca_core_init
av_cold int ff_dca_core_init(DCACoreDecoder *s)
Definition: dca_core.c:2410
DCADSPContext::dmix_add
void(* dmix_add)(int32_t *dst, const int32_t *src, int coeff, ptrdiff_t len)
Definition: dcadsp.h:80
ff_dca_exss_parse
int ff_dca_exss_parse(DCAExssParser *s, const uint8_t *data, int size)
Definition: dca_exss.c:378
CHANNEL_ORDER_CODED
@ CHANNEL_ORDER_CODED
Definition: aacdec.h:59
DCAContext
Definition: dcadec.h:53
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
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:52
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
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:52
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
ff_dca_lbr_init
av_cold int ff_dca_lbr_init(DCALbrDecoder *s)
Definition: dca_lbr.c:1822
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:1956
ff_dca_xll_filter_frame
int ff_dca_xll_filter_frame(DCAXllDecoder *s, AVFrame *frame)
Definition: dca_xll.c:1341
ff_dca_lbr_flush
av_cold void ff_dca_lbr_flush(DCALbrDecoder *s)
Definition: dca_lbr.c:1798
ret
ret
Definition: filter_design.txt:187
ff_dca_core_parse_exss
int ff_dca_core_parse_exss(DCACoreDecoder *s, const uint8_t *data, DCAExssAsset *asset)
Definition: dca_core.c:1828
DCA_PACKET_EXSS
#define DCA_PACKET_EXSS
Definition: dcadec.h:40
ff_dca_lbr_close
av_cold void ff_dca_lbr_close(DCALbrDecoder *s)
Definition: dca_lbr.c:1831
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
pos
unsigned int pos
Definition: spdifenc.c:413
CHANNEL_ORDER_DEFAULT
@ CHANNEL_ORDER_DEFAULT
Definition: aacdec.h:58
dcadec_class
static const AVClass dcadec_class
Definition: dcadec.c:399
U
#define U(x)
Definition: vpx_arith.h:37
AVCodecContext
main external API structure.
Definition: avcodec.h:445
channel_layout.h
MAX_PACKET_SIZE
#define MAX_PACKET_SIZE
Definition: dcadec.c:32
DCA_PACKET_MASK
#define DCA_PACKET_MASK
Definition: dcadec.h:43
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
av_channel_layout_uninit
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
Definition: channel_layout.c:432
samples
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:8
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:31
AVPacket
This structure stores compressed data.
Definition: packet.h:499
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:472
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:251
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
ff_dca_xll_flush
av_cold void ff_dca_xll_flush(DCAXllDecoder *s)
Definition: dca_xll.c:1497
int32_t
int32_t
Definition: audioconvert.c:56
DCA_SPEAKER_COUNT
@ DCA_SPEAKER_COUNT
Definition: dca.h:87
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
DCA_SPEAKER_L
@ DCA_SPEAKER_L
Definition: dca.h:78
AV_CHANNEL_LAYOUT_5POINT0
#define AV_CHANNEL_LAYOUT_5POINT0
Definition: channel_layout.h:388
AV_CHANNEL_LAYOUT_5POINT1
#define AV_CHANNEL_LAYOUT_5POINT1
Definition: channel_layout.h:389
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244
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:1502
DCA_EXSS_LBR
@ DCA_EXSS_LBR
Definition: dca.h:178
ff_dca_core_flush
av_cold void ff_dca_core_flush(DCACoreDecoder *s)
Definition: dca_core.c:2397