Go to the documentation of this file.
31 #define MIN_PACKET_SIZE 16
32 #define MAX_PACKET_SIZE 0x104000
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,
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,
48 int dca_ch, wav_ch, nchannels = 0;
53 if (dca_mask & (1
U << dca_ch))
54 ch_remap[nchannels++] = dca_ch;
60 const uint8_t *dca2wav;
63 dca2wav = dca2wav_wide;
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;
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];
86 int *coeff_l,
int nsamples,
int ch_mask)
99 for (spkr = 0; spkr <= max_spkr; spkr++) {
100 if (!(ch_mask & (1
U << spkr)))
117 int *coeff_l,
int nsamples,
int ch_mask)
121 const float scale = 1.0f / (1 << 15);
130 coeff_r[
pos + 1] *
scale, nsamples);
133 for (spkr = 0; spkr <= max_spkr; spkr++) {
134 if (!(ch_mask & (1
U << spkr)))
139 *coeff_l *
scale, nsamples);
143 *coeff_r *
scale, nsamples);
151 int *got_frame_ptr,
AVPacket *avpkt)
155 int input_size = avpkt->
size;
156 int i,
ret, prev_packet =
s->packet;
212 asset = &
s->exss.assets[0];
256 if (
s->xll.chset[0].freq == 96000 &&
s->core.sample_rate == 48000)
266 &&
s->xll.nchsets > 1) {
338 s->core.avctx = avctx;
339 s->exss.avctx = avctx;
340 s->xll.avctx = avctx;
341 s->lbr.avctx = avctx;
350 s->core.dcadsp = &
s->dcadsp;
351 s->xll.dcadsp = &
s->dcadsp;
352 s->lbr.dcadsp = &
s->dcadsp;
356 #if FF_API_OLD_CHANNEL_LAYOUT
368 if (
s->downmix_layout.nb_channels) {
385 #define OFFSET(x) offsetof(DCAContext, x)
386 #define PARAM AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM
391 {
"channel_order",
"Order in which the channels are to be exported",
396 {
"coded",
"order in which the channels are coded in the bitstream",
399 {
"downmix",
"Request a specific channel layout from the decoder",
OFFSET(downmix_layout),
#define FF_ENABLE_DEPRECATION_WARNINGS
@ AV_SAMPLE_FMT_FLTP
float, planar
#define AV_LOG_WARNING
Something somehow does not look correct.
static av_cold int dcadec_close(AVCodecContext *avctx)
int ff_dca_xll_parse(DCAXllDecoder *s, const uint8_t *data, DCAExssAsset *asset)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
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
@ AV_CLASS_CATEGORY_DECODER
#define DCA_SPEAKER_LAYOUT_5POINT0
#define AV_CHANNEL_LAYOUT_5POINT1
av_cold void ff_dca_core_close(DCACoreDecoder *s)
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
This structure describes decoded (raw) audio or video data.
#define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
#define DCA_SPEAKER_LAYOUT_STEREO
#define AV_LOG_VERBOSE
Detailed information.
#define AV_CHANNEL_LAYOUT_STEREO
enum AVChannelOrder order
Channel order used in this layout.
int nb_channels
Number of channels in this layout.
#define DCA_FILTER_MODE_FIXED
int ff_dca_lbr_parse(DCALbrDecoder *s, const uint8_t *data, DCAExssAsset *asset)
static av_cold int dcadec_init(AVCodecContext *avctx)
#define AV_CHANNEL_LAYOUT_5POINT0
#define DCA_PACKET_RECOVERY
Sync error recovery flag.
int ff_dca_core_filter_frame(DCACoreDecoder *s, AVFrame *frame)
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.
AVCodec p
The public AVCodec.
AVChannelLayout ch_layout
Audio channel layout.
const AVProfile ff_dca_profiles[]
static av_cold void dcadec_flush(AVCodecContext *avctx)
static av_always_inline float scale(float x, float s)
#define DCA_SPEAKER_LAYOUT_7POINT1_WIDE
void ff_dca_downmix_to_stereo_float(AVFloatDSPContext *fdsp, float **samples, int *coeff_l, int nsamples, int ch_mask)
static av_cold void dcadec_init_static(void)
static int ff_thread_once(char *control, void(*routine)(void))
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int dcadec_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
av_cold void ff_dca_lbr_init_tables(void)
void ff_dca_downmix_to_stereo_fixed(DCADSPContext *dcadsp, int32_t **samples, int *coeff_l, int nsamples, int ch_mask)
#define FF_CODEC_DECODE_CB(func)
static const AVOption dcadec_options[]
#define DCA_SPEAKER_LAYOUT_7POINT0_WIDE
#define DCA_SPEAKER_LAYOUT_5POINT1
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void(* dmix_scale)(int32_t *dst, int scale, ptrdiff_t len)
int ff_dca_set_channel_layout(AVCodecContext *avctx, int *ch_remap, int dca_mask)
int ff_dca_lbr_filter_frame(DCALbrDecoder *s, AVFrame *frame)
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
#define DCA_HAS_STEREO(mask)
void(* vector_fmul_scalar)(float *dst, const float *src, float mul, int len)
Multiply a vector of floats by a scalar float.
const char * av_default_item_name(void *ptr)
Return the context name.
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
av_cold void ff_dca_init_vlcs(void)
const FFCodec ff_dca_decoder
#define AV_EF_EXPLODE
abort decoding on minor error detection
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
#define DCA_SYNCWORD_CORE_BE
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
int ff_dca_core_parse(DCACoreDecoder *s, const uint8_t *data, int size)
av_cold void ff_dcadsp_init(DCADSPContext *s)
An AVChannelLayout holds information about the channel layout of audio data.
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
#define DCA_PACKET_RESIDUAL
Core valid for residual decoding.
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
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
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
av_cold int ff_dca_core_init(DCACoreDecoder *s)
void(* dmix_add)(int32_t *dst, const int32_t *src, int coeff, ptrdiff_t len)
int ff_dca_exss_parse(DCAExssParser *s, const uint8_t *data, int size)
#define i(width, name, range_min, range_max)
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.
#define AV_CH_LAYOUT_NATIVE
Channel mask value used for AVCodecContext.request_channel_layout to indicate that the user requests ...
AVSampleFormat
Audio sample formats.
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...
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
const char * name
Name of the codec implementation.
av_cold int ff_dca_lbr_init(DCALbrDecoder *s)
#define DCA_SYNCWORD_SUBSTREAM
int ff_dca_core_filter_fixed(DCACoreDecoder *s, int x96_synth)
int ff_dca_xll_filter_frame(DCAXllDecoder *s, AVFrame *frame)
FF_ENABLE_DEPRECATION_WARNINGS 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.
av_cold void ff_dca_lbr_flush(DCALbrDecoder *s)
int ff_dca_core_parse_exss(DCACoreDecoder *s, const uint8_t *data, DCAExssAsset *asset)
av_cold void ff_dca_lbr_close(DCALbrDecoder *s)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
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
static const AVClass dcadec_class
main external API structure.
Filter the word “frame” indicates either a video frame or a group of audio samples
#define FF_DISABLE_DEPRECATION_WARNINGS
int extension_mask
Coding components used in asset.
This structure stores compressed data.
av_cold void ff_dca_xll_flush(DCAXllDecoder *s)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
av_cold void ff_dca_xll_close(DCAXllDecoder *s)
av_cold void ff_dca_core_flush(DCACoreDecoder *s)