44#define IS_CORE_MARKER(state) \
45 (((state & 0xFFFFFFFFF0FF) == (((uint64_t)DCA_SYNCWORD_CORE_14B_LE << 16) | 0xF007)) || \
46 ((state & 0xFFFFFFFFFFF0) == (((uint64_t)DCA_SYNCWORD_CORE_14B_BE << 16) | 0x07F0)) || \
47 ((state & 0xFFFFFFFF00FC) == (((uint64_t)DCA_SYNCWORD_CORE_LE << 16) | 0x00FC)) || \
48 ((state & 0xFFFFFFFFFC00) == (((uint64_t)DCA_SYNCWORD_CORE_BE << 16) | 0xFC00)))
50#define IS_EXSS_MARKER(state) ((state & 0xFFFFFFFF) == DCA_SYNCWORD_SUBSTREAM)
52#define IS_MARKER(state) (IS_CORE_MARKER(state) || IS_EXSS_MARKER(state))
54#define CORE_MARKER(state) ((state >> 16) & 0xFFFFFFFF)
55#define EXSS_MARKER(state) (state & 0xFFFFFFFF)
57#define STATE_LE(state) (((state & 0xFF00FF00) >> 8) | ((state & 0x00FF00FF) << 8))
58#define STATE_14(state) (((state & 0x3FFF0000) >> 8) | ((state & 0x00003FFF) >> 6))
60#define CORE_FRAMESIZE(state) (((state >> 4) & 0x3FFF) + 1)
61#define EXSS_FRAMESIZE(state) ((state & 0x2000000000) ? \
62 ((state >> 5) & 0xFFFFF) + 1 : \
63 ((state >> 13) & 0x0FFFF) + 1)
72 int start_found,
size,
i;
82 for (;
i < buf_size;
i++) {
108 for (;
i < buf_size;
i++) {
112 if (start_found == 1) {
157 if (start_found == 3) {
195 int buf_size,
int *
duration,
int *sample_rate,
253 if (nsamples_log2 > 24)
257 *
duration = (1 + (*sample_rate > 96000)) << nsamples_log2;
277 if (
h.ext_audio_present) {
278 switch (
h.ext_audio_type) {
309 const uint8_t **poutbuf,
int *poutbuf_size,
310 const uint8_t *buf,
int buf_size)
344 *poutbuf_size = buf_size;
static int parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
static av_cold void close(AVCodecParserContext *s)
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define PARSER_FLAG_COMPLETE_FRAMES
#define i(width, name, range_min, range_max)
const uint8_t ff_dca_freq_ranges[16]
int avpriv_dca_parse_core_frame_header(DCACoreFrameHeader *h, const uint8_t *buf, int size)
Parse and validate core frame header.
const uint32_t ff_dca_sampling_freqs[16]
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.
const uint32_t ff_dca_sample_rates[16]
#define DCA_CORE_FRAME_HEADER_SIZE
#define DCA_PCMBLOCK_SAMPLES
int ff_dca_exss_parse(DCAExssParser *s, const uint8_t *data, int size)
@ DCA_LBR_HEADER_SYNC_ONLY
@ DCA_LBR_HEADER_DECODER_INIT
#define IS_EXSS_MARKER(state)
#define CORE_MARKER(state)
static int dca_find_frame_end(DCAParseContext *pc1, const uint8_t *buf, int buf_size)
Find the end of the current frame in the bitstream.
static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
static av_cold int dca_parse_init(AVCodecParserContext *s)
static int dca_parse_params(DCAParseContext *pc1, const uint8_t *buf, int buf_size, int *duration, int *sample_rate, int *profile)
#define CORE_FRAMESIZE(state)
#define EXSS_FRAMESIZE(state)
#define EXSS_MARKER(state)
const FFCodecParser ff_dca_parser
#define DCA_SYNCWORD_SUBSTREAM
#define DCA_SYNCWORD_CORE_14B_BE
#define DCA_SYNCWORD_CORE_LE
#define DCA_SYNCWORD_CORE_BE
#define DCA_SYNCWORD_CORE_14B_LE
#define AV_PROFILE_DTS_EXPRESS
#define AV_PROFILE_DTS_HD_MA
#define AV_PROFILE_UNKNOWN
#define AV_PROFILE_DTS_HD_HRA
#define AV_PROFILE_DTS_96_24
#define AV_PROFILE_DTS_ES
int(* init)(AVBSFContext *ctx)
static struct @346255127015250356166251341105367306144006377143 state
static const uint8_t frame_size[4]
bitstream reader API header.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
av_cold void ff_parse_close(AVCodecParserContext *s)
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
#define PARSER_CODEC_LIST(...)
#define FF_ARRAY_ELEMS(a)
main external API structure.
int sample_rate
samples per second
int lbr_offset
Offset to LBR component from start of substream.
int xll_offset
Offset to XLL data from start of substream.
int extension_mask
Coding components used in asset.
int xll_size
Size of XLL data in extension substream.
int lbr_size
Size of LBR component in extension substream.
int max_sample_rate
Maximum sample rate.
DCAExssAsset assets[1]
Audio asset descriptors.
uint64_t state64
contains the last 8 bytes in MSB order