27#include "config_components.h"
51#define VLC_STATIC_SIZE 64
54#define VLC_STATIC_SIZE 512
182 int8_t *output_shift,
183 uint8_t max_matrix_channel,
230 for (
int i = 0;
i < 3;
i++) {
243 unsigned int substr,
unsigned int ch)
247 int lsb_bits = cp->
huff_lsbs -
s->quant_step_size[ch];
252 sign_huff_offset -= 7 << lsb_bits;
255 sign_huff_offset -= 1 << sign_shift;
257 return sign_huff_offset;
264 unsigned int substr,
unsigned int pos)
269 for (mat = 0; mat <
s->num_primitive_matrices; mat++)
270 if (
s->lsb_bypass[mat])
288 result = (result << lsb_bits) +
get_bits_long(gbp, lsb_bits);
346 if (
mh.group1_bits == 0) {
350 if (
mh.group2_bits >
mh.group1_bits) {
352 "Channel group 2 cannot have more bits per sample than group 1.\n");
356 if (
mh.group2_samplerate &&
mh.group2_samplerate !=
mh.group1_samplerate) {
358 "Channel groups with differing sample rates are not currently supported.\n");
362 if (
mh.group1_samplerate == 0) {
368 "Sampling rate %d is greater than the supported maximum (%d).\n",
374 "Block size %d is greater than the supported maximum (%d).\n",
380 "Block size pow2 %d is greater than the supported maximum (%d).\n",
385 if (
mh.num_substreams == 0)
393 "%d substreams (more than the "
394 "maximum supported by the decoder)",
423 if (
mh.group1_bits > 16)
442 "unexpected stream_type %X in MLP",
446 if ((substr = (
mh.num_substreams > 1)))
452 "unexpected stream_type %X in !MLP",
457 if (
mh.channels_thd_stream1 == 2 &&
458 mh.channels_thd_stream2 == 2)
460 if ((substr = (
mh.num_substreams > 1)))
462 if (
mh.num_substreams == 1 &&
463 mh.channels_thd_stream1 == 1 &&
464 mh.channels_thd_stream2 == 1)
466 if (
mh.num_substreams > 2)
467 if (
mh.channel_layout_thd_stream2)
493 if (
mh.num_substreams > 2 &&
499 if (
mh.num_substreams > 1 &&
505 if (
mh.num_substreams > 0)
506 switch (
mh.channel_modifier_thd_stream0) {
526 const uint8_t *buf,
unsigned int substr)
532 uint8_t lossless_check;
534 int min_channel, max_channel, max_matrix_channel, noise_type;
541 if (sync_word != 0x31ea >> 1) {
543 "restart header sync incorrect (got 0x%04x)\n", sync_word);
558 max_matrix_channel =
get_bits(gbp, 4);
560 if (max_matrix_channel > std_max_matrix_channel) {
562 "Max matrix channel cannot be greater than %d.\n",
563 std_max_matrix_channel);
571 "%d channels (more than the "
572 "maximum supported by the decoder)",
577 if (max_channel + 1 >
MAX_CHANNELS || max_channel + 1 < min_channel)
580 s->min_channel = min_channel;
581 s->max_channel = max_channel;
582 s->coded_channels = ((1LL << (max_channel - min_channel + 1)) - 1) << min_channel;
583 s->max_matrix_channel = max_matrix_channel;
584 s->noise_type = noise_type;
589 "Extracting %d-channel downmix (0x%"PRIx64
") from substream %d. "
590 "Further substreams will be skipped.\n",
591 s->max_channel + 1,
s->mask, substr);
603 &&
s->lossless_check_data != 0xffffffff) {
605 if (
tmp != lossless_check)
607 "Lossless check failed - expected %02x, calculated %02x.\n",
608 lossless_check,
tmp);
613 memset(
s->ch_assign, 0,
sizeof(
s->ch_assign));
615 for (ch = 0; ch <=
s->max_matrix_channel; ch++) {
624 if (ch_assign < 0 || ch_assign >
s->max_matrix_channel) {
626 "Assignment of matrix channel %d to invalid output channel %d",
630 s->ch_assign[ch_assign] = ch;
639 s->param_presence_flags = 0xff;
640 s->num_primitive_matrices = 0;
642 s->lossless_check_data = 0;
644 memset(
s->output_shift , 0,
sizeof(
s->output_shift ));
645 memset(
s->quant_step_size, 0,
sizeof(
s->quant_step_size));
647 for (ch =
s->min_channel; ch <= s->max_channel; ch++) {
666 s->max_matrix_channel,
672 int i =
s->ch_assign[4];
673 s->ch_assign[4] =
s->ch_assign[3];
674 s->ch_assign[3] =
s->ch_assign[2];
677 FFSWAP(
int,
s->ch_assign[2],
s->ch_assign[4]);
678 FFSWAP(
int,
s->ch_assign[3],
s->ch_assign[5]);
690 unsigned int substr,
unsigned int channel,
696 const char fchar =
filter ?
'I' :
'F';
708 if (order > max_order) {
710 "%cIR filter order %d is greater than maximum %d.\n",
711 fchar, order, max_order);
718 int coeff_bits, coeff_shift;
724 if (coeff_bits < 1 || coeff_bits > 16) {
726 "%cIR filter coeff_bits must be between 1 and 16.\n",
730 if (coeff_bits + coeff_shift > 16) {
732 "Sum of coeff_bits and coeff_shift for %cIR filter must be 16 or less.\n",
737 for (
i = 0;
i < order;
i++)
738 fcoeff[
i] =
get_sbits(gbp, coeff_bits) * (1 << coeff_shift);
741 int state_bits, state_shift;
745 "FIR filter has state data specified.\n");
754 for (
i = 0;
i < order;
i++)
755 fp->
state[
i] = state_bits ?
get_sbits(gbp, state_bits) * (1 << state_shift) : 0;
767 unsigned int mat, ch;
777 s->num_primitive_matrices =
get_bits(gbp, 4);
779 if (
s->num_primitive_matrices > max_primitive_matrices) {
781 "Number of primitive matrices cannot be greater than %d.\n",
782 max_primitive_matrices);
786 for (mat = 0; mat <
s->num_primitive_matrices; mat++) {
787 int frac_bits, max_chan;
788 s->matrix_out_ch[mat] =
get_bits(gbp, 4);
792 if (
s->matrix_out_ch[mat] >
s->max_matrix_channel) {
794 "Invalid channel %d specified as output from matrix.\n",
795 s->matrix_out_ch[mat]);
798 if (frac_bits > 14) {
800 "Too many fractional bits specified.\n");
804 max_chan =
s->max_matrix_channel;
808 for (ch = 0; ch <= max_chan; ch++) {
811 coeff_val =
get_sbits(gbp, frac_bits + 2);
813 s->matrix_coeff[mat][ch] = coeff_val * (1 << (14 - frac_bits));
817 s->matrix_noise_shift[mat] =
get_bits(gbp, 4);
819 s->matrix_noise_shift[mat] = 0;
824 s->num_primitive_matrices = 0;
825 memset(
s->matrix_out_ch, 0,
sizeof(
s->matrix_out_ch));
859 "FIR and IIR filters must use the same precision.\n");
895 unsigned recompute_sho = 0;
899 s->param_presence_flags =
get_bits(gbp, 8);
918 for (ch = 0; ch <=
s->max_matrix_channel; ch++) {
920 if (
s->output_shift[ch] < 0) {
922 s->output_shift[ch] = 0;
928 s->max_matrix_channel,
934 for (ch = 0; ch <=
s->max_channel; ch++) {
935 s->quant_step_size[ch] =
get_bits(gbp, 4);
937 recompute_sho |= 1<<ch;
940 for (ch =
s->min_channel; ch <= s->max_channel; ch++)
942 recompute_sho |= 1<<ch;
949 for (ch = 0; ch <=
s->max_channel; ch++) {
950 if (recompute_sho & (1<<ch)) {
958 s->quant_step_size[ch] = 0;
967#define MSB_MASK(bits) (-(1 << (bits)))
982 unsigned int filter_shift = fir->
shift;
990 filter_shift,
mask,
s->blocksize,
1000 unsigned int substr)
1003 unsigned int i, ch, expected_stream_pos = 0;
1006 if (
s->data_check_present) {
1008 expected_stream_pos +=
get_bits(gbp, 16);
1010 "Substreams with VLC block size check info");
1021 for (
i = 0;
i <
s->blocksize;
i++)
1025 for (ch =
s->min_channel; ch <= s->max_channel; ch++)
1028 s->blockpos +=
s->blocksize;
1030 if (
s->data_check_present) {
1042 30, 51, 22, 54, 3, 7, -4, 38, 14, 55, 46, 81, 22, 58, -3, 2,
1043 52, 31, -7, 51, 15, 44, 74, 30, 85, -17, 10, 33, 18, 80, 28, 62,
1044 10, 32, 23, 69, 72, 26, 35, 17, 73, 60, 8, 56, 2, 6, -2, -5,
1045 51, 4, 11, 50, 66, 76, 21, 44, 33, 47, 1, 26, 64, 48, 57, 40,
1046 38, 16, -10, -28, 92, 22, -18, 29, -10, 5, -13, 49, 19, 24, 70, 34,
1047 61, 48, 30, 14, -6, 25, 58, 33, 42, 60, 67, 17, 54, 17, 22, 30,
1048 67, 44, -9, 50, -11, 43, 40, 32, 59, 82, 13, 49, -14, 55, 60, 36,
1049 48, 49, 31, 47, 15, 12, 4, 65, 1, 23, 29, 39, 45, -2, 84, 69,
1050 0, 72, 37, 57, 27, 41, -15, -16, 35, 31, 14, 61, 24, 0, 27, 24,
1051 16, 41, 55, 34, 53, 9, 56, 12, 25, 29, 53, 5, 20, -20, -8, 20,
1052 13, 28, -3, 78, 38, 16, 11, 62, 46, 29, 21, 24, 46, 65, 43, -23,
1053 89, 18, 74, 21, 38, -12, 19, 12, -19, 8, 15, 33, 4, 57, 9, -8,
1054 36, 35, 26, 28, 7, 83, 63, 79, 75, 11, 3, 87, 37, 47, 34, 40,
1055 39, 19, 20, 42, 27, 34, 39, 77, 13, 42, 59, 64, 45, -1, 32, 37,
1056 45, -5, 53, -6, 7, 36, 50, 23, 6, 32, 9, -21, 18, 71, 27, 52,
1057 -25, 31, 35, 42, -1, 68, 63, 52, 26, 43, 66, 37, 41, 25, 40, 70,
1074 uint32_t
seed =
s->noisegen_seed;
1075 unsigned int maxchan =
s->max_matrix_channel;
1077 for (
i = 0;
i <
s->blockpos;
i++) {
1078 uint16_t seed_shr7 =
seed >> 7;
1080 m->
sample_buffer[
i][maxchan+2] = ((int8_t) seed_shr7) * (1 <<
s->noise_shift);
1082 seed = (
seed << 16) ^ seed_shr7 ^ (seed_shr7 << 5);
1085 s->noisegen_seed =
seed;
1094 uint32_t
seed =
s->noisegen_seed;
1097 uint8_t seed_shr15 =
seed >> 15;
1099 seed = (
seed << 8) ^ seed_shr15 ^ (seed_shr15 << 5);
1102 s->noisegen_seed =
seed;
1113 unsigned int maxchan;
1127 maxchan =
s->max_matrix_channel;
1128 if (!
s->noise_type) {
1137 for (mat = 0; mat <
s->num_primitive_matrices; mat++) {
1138 unsigned int dest_ch =
s->matrix_out_ch[mat];
1140 s->matrix_coeff[mat],
1143 s->num_primitive_matrices - mat,
1147 s->matrix_noise_shift[mat],
1153 frame->nb_samples =
s->blockpos;
1156 s->lossless_check_data = m->
pack_output(
s->lossless_check_data,
1162 s->max_matrix_channel,
1166 if (
s->matrix_encoding !=
s->prev_matrix_encoding) {
1170 s->prev_matrix_encoding =
s->matrix_encoding;
1183 int *got_frame_ptr,
AVPacket *avpkt)
1185 const uint8_t *buf = avpkt->
data;
1186 int buf_size = avpkt->
size;
1189 unsigned int length, substr;
1190 unsigned int substream_start;
1191 unsigned int header_size = 4;
1192 unsigned int substr_header_size = 0;
1195 uint8_t parity_bits;
1201 length = (
AV_RB16(buf) & 0xfff) * 2;
1203 if (length < 4 || length > buf_size)
1219 "Stream parameters not seen; skipping frame.\n");
1224 substream_start = 0;
1227 int extraword_present, checkdata_present, end, nonrestart_substr;
1236 substr_header_size += 2;
1238 if (extraword_present) {
1244 substr_header_size += 2;
1247 if (length < header_size + substr_header_size) {
1257 if (end + header_size + substr_header_size > length) {
1259 "Indicated length of substream %d data goes off end of "
1260 "packet.\n", substr);
1261 end = length - header_size - substr_header_size;
1264 if (end < substream_start) {
1266 "Indicated end offset of substream %d data "
1267 "is smaller than calculated start offset.\n",
1275 substream_parity_present[substr] = checkdata_present;
1276 substream_data_len[substr] = end - substream_start;
1277 substream_start = end;
1283 if ((((parity_bits >> 4) ^ parity_bits) & 0xF) != 0xF) {
1288 buf += header_size + substr_header_size;
1305 s->restart_seen = 1;
1308 if (!
s->restart_seen)
1314 if (!
s->restart_seen)
1323 substr > 0 && substr < m->max_decoded_substream &&
1326 "Previous substream(%d) channels overlaps current substream(%d) channels, skipping.\n",
1327 substr - 1, substr);
1334 "Current substream(%d) channels overlaps final substream(%d) channels, skipping.\n",
1343 goto substream_length_mismatch;
1349 if (substream_data_len[substr] * 8 -
get_bits_count(&gb) >= 32) {
1357 s->blockpos -=
FFMIN(shorten_by & 0x1FFF,
s->blockpos);
1362 s->end_of_stream = 1;
1365 if (substream_parity_present[substr]) {
1366 uint8_t
parity, checksum;
1369 goto substream_length_mismatch;
1381 goto substream_length_mismatch;
1384 if (!
s->restart_seen)
1386 "No restart header present in substream %d.\n", substr);
1388 buf += substream_data_len[substr];
1397 if (
s->end_of_stream) {
1398 s->lossless_check_data = 0xffffffff;
1399 s->end_of_stream = 0;
1406substream_length_mismatch:
1423 s->lossless_check_data = 0xffffffff;
1424 s->prev_matrix_encoding = 0;
1428#define OFFSET(x) offsetof(MLPDecodeContext, x)
1429#define FLAGS (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM)
1431 {
"downmix",
"Request a specific channel layout from the decoder",
OFFSET(downmix_layout),
1437 .class_name =
"MLP decoder",
1444 .class_name =
"TrueHD decoder",
1450#if CONFIG_MLP_DECODER
1464#if CONFIG_TRUEHD_DECODER
const FFCodec ff_mlp_decoder
const FFCodec ff_truehd_decoder
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
#define i(width, name, range_min, range_max)
static const unsigned codebook[256][2]
Public libavutil channel layout APIs header.
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int ff_side_data_update_matrix_encoding(AVFrame *frame, enum AVMatrixEncoding matrix_encoding)
Add or update AV_FRAME_DATA_MATRIXENCODING side data.
#define AV_PROFILE_TRUEHD_ATMOS
channel
Use these values when setting the channel map with ebur128_set_channel().
bitstream reader API header.
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
static int get_sbits(GetBitContext *s, int n)
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static int get_bits_count(const GetBitContext *s)
static void skip_bits1(GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
#define AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_5POINT0_BACK
#define AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_5POINT1_BACK
@ AV_MATRIX_ENCODING_NONE
@ AV_MATRIX_ENCODING_DOLBY
@ AV_MATRIX_ENCODING_DOLBYEX
@ AV_MATRIX_ENCODING_DOLBYHEADPHONE
#define AV_CH_LOW_FREQUENCY
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
int av_channel_layout_index_from_channel(const AVChannelLayout *channel_layout, enum AVChannel channel)
Get the index of a given channel in a channel layout.
#define AV_CHANNEL_LAYOUT_5POINT0
#define AV_CHANNEL_LAYOUT_STEREO
int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1)
Check whether two channel layouts are semantically the same, i.e.
#define AV_CHANNEL_LAYOUT_5POINT1
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
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.
int av_channel_layout_check(const AVChannelLayout *channel_layout)
Check whether a channel layout is valid, i.e.
#define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX
uint64_t av_channel_layout_subset(const AVChannelLayout *channel_layout, uint64_t mask)
Find out what channels from a given set are present in a channel layout, without regard for their pos...
@ AV_CHAN_FRONT_RIGHT_OF_CENTER
@ AV_CHAN_TOP_FRONT_RIGHT
@ AV_CHAN_FRONT_LEFT_OF_CENTER
@ AV_CHAN_NONE
Invalid channel index.
@ AV_CHAN_LOW_FREQUENCY_2
@ AV_CHAN_SURROUND_DIRECT_RIGHT
@ AV_CHAN_SURROUND_DIRECT_LEFT
@ AV_CHAN_TOP_FRONT_CENTER
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
@ AV_SAMPLE_FMT_S32
signed 32 bits
@ AV_SAMPLE_FMT_S16
signed 16 bits
#define LIBAVUTIL_VERSION_INT
static const float quant_step_size[]
static const int8_t noise_table[256]
Data table used for TrueHD noise generation function.
static av_cold int mlp_decode_init(AVCodecContext *avctx)
static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp, unsigned int substr, unsigned int channel, unsigned int filter)
Read parameters for one of the prediction filters.
static int read_huff_channels(MLPDecodeContext *m, GetBitContext *gbp, unsigned int substr, unsigned int pos)
Read a sample, consisting of either, both or neither of entropy-coded MSBs and plain LSBs.
static void filter_channel(MLPDecodeContext *m, unsigned int substr, unsigned int channel)
Generate PCM samples using the prediction filters and residual values read from the data stream,...
static enum AVChannel thd_channel_layout_extract_channel(uint64_t channel_layout, int index)
static const AVClass mlp_decoder_class
static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, const uint8_t *buf, unsigned int substr)
Read a restart header from a block in a substream.
static void fill_noise_buffer(MLPDecodeContext *m, unsigned int substr)
Generate a block of noise, used when restart sync word == 0x31eb.
static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
Read a major sync info header - contains high level information about the stream - sample rate,...
static int read_access_unit(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt)
Read an access unit from the stream.
static int32_t calculate_sign_huff(MLPDecodeContext *m, unsigned int substr, unsigned int ch)
static int output_data(MLPDecodeContext *m, unsigned int substr, AVFrame *frame, int *got_frame_ptr)
Write the audio data into the output buffer.
static av_cold void mlp_decode_flush(AVCodecContext *avctx)
static void generate_2_noise_channels(MLPDecodeContext *m, unsigned int substr)
Noise generation functions.
static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp, unsigned int substr)
Read decoding parameters that change more often than those in the restart header.
static av_cold void init_static(void)
Initialize static data, constant between all invocations of the codec.
static const AVClass truehd_decoder_class
static int mlp_channel_layout_subset(AVChannelLayout *layout, uint64_t mask)
static int read_matrix_params(MLPDecodeContext *m, unsigned int substr, GetBitContext *gbp)
Read parameters for primitive matrices.
static int read_block_data(MLPDecodeContext *m, GetBitContext *gbp, unsigned int substr)
Read a block of PCM residual data (or actual if no filtering active).
static enum AVChannel thd_channel_order[]
static int read_channel_params(MLPDecodeContext *m, unsigned int substr, GetBitContext *gbp, unsigned int ch)
Read channel parameters.
Macro definitions for various function/variable attributes.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int ff_thread_once(char *control, void(*routine)(void))
static const uint16_t mask[17]
#define FFSWAP(type, a, b)
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
const uint8_t ff_mlp_huffman_tables[3][18][2]
Tables defining the Huffman codes.
uint8_t ff_mlp_restart_checksum(const uint8_t *buf, unsigned int bit_size)
Calculate an 8-bit checksum over a restart header – a non-multiple-of-8 number of bits,...
av_cold void ff_mlp_init_crc(void)
uint8_t ff_mlp_calculate_parity(const uint8_t *buf, unsigned int buf_size)
XOR together all the bytes of a buffer.
uint8_t ff_mlp_checksum8(const uint8_t *buf, unsigned int buf_size)
MLP uses checksums that seem to be based on the standard CRC algorithm, but are not (in implementatio...
#define NUM_FILTERS
number of allowed filters
#define MAX_SUBSTREAMS
Maximum number of substreams that can be decoded.
#define MAX_BLOCKSIZE_POW2
next power of two greater than MAX_BLOCKSIZE
#define MAX_SAMPLERATE
maximum sample frequency seen in files
#define MAX_MATRICES_MLP
Maximum number of matrices used in decoding; most streams have one matrix per output channel,...
#define MAX_FIR_ORDER
The maximum number of taps in IIR and FIR filters.
#define MAX_MATRIX_CHANNEL_TRUEHD
#define MAX_MATRIX_CHANNEL_MLP
Last possible matrix channel for each codec.
@ THD_CH_MODIFIER_SURROUNDEX
@ THD_CH_MODIFIER_LBINRBIN
static uint8_t xor_32_to_8(uint32_t value)
XOR four bytes into one.
#define MAX_MATRICES_TRUEHD
int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
Read a major sync info header - contains high level information about the stream - sample rate,...
av_cold void ff_mlpdsp_init(MLPDSPContext *c)
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
const AVProfile ff_truehd_profiles[]
static const uint16_t table[]
#define FF_ARRAY_ELEMS(a)
An AVChannelLayout holds information about the channel layout of audio data.
int nb_channels
Number of channels in this layout.
Describe the class of an AVClass context structure.
main external API structure.
AVChannelLayout ch_layout
Audio channel layout.
enum AVSampleFormat sample_fmt
audio sample format
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
int sample_rate
samples per second
int frame_size
Number of samples per channel in an audio frame.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
sample data coding information
FilterParams filter_params[NUM_FILTERS]
int32_t sign_huff_offset
sign/rounding-corrected version of huff_offset
uint8_t huff_lsbs
Size of residual suffix not encoded using VLC.
int16_t huff_offset
Offset to apply to residual values.
uint8_t codebook
Which VLC codebook to use to read residuals.
int32_t state[MAX_FIR_ORDER]
uint8_t shift
Right shift to apply to output of filter.
uint8_t order
number of taps in filter
int32_t(*(* mlp_select_pack_output)(uint8_t *ch_assign, int8_t *output_shift, uint8_t max_matrix_channel, int is32))(int32_t
void(* mlp_rematrix_channel)(int32_t *samples, const int32_t *coeffs, const uint8_t *bypassed_lsbs, const int8_t *noise_buffer, int index, unsigned int dest_ch, uint16_t blockpos, unsigned int maxchan, int matrix_noise_shift, int access_unit_size_pow2, int32_t mask)
void(* mlp_filter_channel)(int32_t *state, const int32_t *coeff, int firorder, int iirorder, unsigned int filter_shift, int32_t mask, int blocksize, int32_t *sample_buffer)
int filter_changed[MAX_CHANNELS][NUM_FILTERS]
int access_unit_size_pow2
next power of two above the number of samples in each frame
uint8_t needs_reordering
Stream needs channel reordering to comply with FFmpeg's channel order.
uint8_t params_valid
Set if a valid major sync block has been read. Otherwise no decoding is possible.
int major_sync_header_size
Size of the major sync unit, in bytes.
int8_t bypassed_lsbs[MAX_BLOCKSIZE][MAX_CHANNELS]
int8_t noise_buffer[MAX_BLOCKSIZE_POW2]
uint8_t max_decoded_substream
Index of the last substream to decode - further substreams are skipped.
int access_unit_size
number of PCM samples contained in each frame
SubStream substream[MAX_SUBSTREAMS]
int32_t(* pack_output)(int32_t lossless_check_data, uint16_t blockpos, int32_t(*sample_buffer)[MAX_CHANNELS], void *data, uint8_t *ch_assign, int8_t *output_shift, uint8_t max_matrix_channel, int is32)
uint8_t extended_substream_info
Which substream of substreams carry 16-channel presentation.
int32_t sample_buffer[MAX_BLOCKSIZE][MAX_CHANNELS]
uint8_t substream_info
Which substream of substreams carry 2/6/8-channel presentation.
uint8_t num_substreams
Number of substreams contained within this stream.
AVChannelLayout downmix_layout
int is_major_sync_unit
Current access unit being read has a major sync.
uint8_t num_primitive_matrices
matrix data
uint64_t coded_channels
The coded channels mask in this substream.
int32_t matrix_coeff[MAX_MATRICES][MAX_CHANNELS]
Matrix coefficients, stored as 2.14 fixed point.
uint8_t max_channel
The index of the last channel coded in this substream.
uint32_t noisegen_seed
The current seed value for the pseudorandom noise generator(s).
uint16_t blockpos
Number of PCM samples decoded so far in this frame.
uint8_t restart_seen
Set if a valid restart header has been read. Otherwise the substream cannot be decoded.
uint8_t matrix_out_ch[MAX_MATRICES]
matrix output channel
uint8_t data_check_present
Set if the substream contains extra info to check the size of VLC blocks.
uint8_t end_of_stream
Set if end of stream is encountered.
uint8_t noise_shift
The left shift applied to random noise in 0x31ea substreams.
ChannelParams channel_params[MAX_CHANNELS]
Channel coding parameters for channels in the substream.
uint16_t blocksize
number of PCM samples in current audio block
enum AVMatrixEncoding prev_matrix_encoding
uint16_t noise_type
restart header data
uint64_t mask
The channel layout for this substream.
uint8_t lsb_bypass[MAX_MATRICES]
Whether the LSBs of the matrix output are encoded in the bitstream.
int8_t output_shift[MAX_CHANNELS]
Left shift to apply to decoded PCM values to get final 24-bit output.
uint8_t param_presence_flags
Bitmask of which parameter sets are conveyed in a decoding parameter block.
uint8_t quant_step_size[MAX_CHANNELS]
Left shift to apply to Huffman-decoded residuals.
uint8_t matrix_noise_shift[MAX_MATRICES]
Left shift to apply to noise values in 0x31eb substreams.
enum AVMatrixEncoding matrix_encoding
The matrix encoding mode for this substream.
uint8_t ch_assign[MAX_CHANNELS]
For each channel output by the matrix, the output channel to map it to.
uint8_t max_matrix_channel
The number of channels input into the rematrix stage.
uint8_t min_channel
The index of the first channel coded in this substream.
int32_t lossless_check_data
Running XOR of all output samples.
#define avpriv_request_sample(...)
static void error(const char *err)
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
#define VLC_INIT_USE_STATIC
#define vlc_init(vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, flags)