53 #define DCA_PRIM_CHANNELS_MAX (7)
54 #define DCA_SUBBANDS (32)
55 #define DCA_ABITS_MAX (32)
56 #define DCA_SUBSUBFRAMES_MAX (4)
57 #define DCA_SUBFRAMES_MAX (16)
58 #define DCA_BLOCKS_MAX (16)
59 #define DCA_LFE_MAX (3)
121 #define DCA_CORE_EXTS (DCA_EXT_XCH | DCA_EXT_XXCH | DCA_EXT_X96)
170 1, 2, 2, 2, 2, 3, 2, 3, 2, 3, 2, 3, 1, 3, 2, 3
174 { 0, -1, -1, -1, -1, -1, -1, -1, -1},
175 { 0, 1, -1, -1, -1, -1, -1, -1, -1},
176 { 0, 1, -1, -1, -1, -1, -1, -1, -1},
177 { 0, 1, -1, -1, -1, -1, -1, -1, -1},
178 { 0, 1, -1, -1, -1, -1, -1, -1, -1},
179 { 2, 0, 1, -1, -1, -1, -1, -1, -1},
180 { 0, 1, 3, -1, -1, -1, -1, -1, -1},
181 { 2, 0, 1, 4, -1, -1, -1, -1, -1},
182 { 0, 1, 3, 4, -1, -1, -1, -1, -1},
183 { 2, 0, 1, 4, 5, -1, -1, -1, -1},
184 { 3, 4, 0, 1, 5, 6, -1, -1, -1},
185 { 2, 0, 1, 4, 5, 6, -1, -1, -1},
186 { 0, 6, 4, 5, 2, 3, -1, -1, -1},
187 { 4, 2, 5, 0, 1, 6, 7, -1, -1},
188 { 5, 6, 0, 1, 7, 3, 8, 4, -1},
189 { 4, 2, 5, 0, 1, 6, 8, 7, -1},
193 { 0, 2, -1, -1, -1, -1, -1, -1, -1},
194 { 0, 1, 3, -1, -1, -1, -1, -1, -1},
195 { 0, 1, 3, -1, -1, -1, -1, -1, -1},
196 { 0, 1, 3, -1, -1, -1, -1, -1, -1},
197 { 0, 1, 3, -1, -1, -1, -1, -1, -1},
198 { 2, 0, 1, 4, -1, -1, -1, -1, -1},
199 { 0, 1, 3, 4, -1, -1, -1, -1, -1},
200 { 2, 0, 1, 4, 5, -1, -1, -1, -1},
201 { 0, 1, 4, 5, 3, -1, -1, -1, -1},
202 { 2, 0, 1, 5, 6, 4, -1, -1, -1},
203 { 3, 4, 0, 1, 6, 7, 5, -1, -1},
204 { 2, 0, 1, 4, 5, 6, 7, -1, -1},
205 { 0, 6, 4, 5, 2, 3, 7, -1, -1},
206 { 4, 2, 5, 0, 1, 7, 8, 6, -1},
207 { 5, 6, 0, 1, 8, 3, 9, 4, 7},
208 { 4, 2, 5, 0, 1, 6, 9, 8, 7},
212 { 0, -1, -1, -1, -1, -1, -1, -1, -1},
213 { 0, 1, -1, -1, -1, -1, -1, -1, -1},
214 { 0, 1, -1, -1, -1, -1, -1, -1, -1},
215 { 0, 1, -1, -1, -1, -1, -1, -1, -1},
216 { 0, 1, -1, -1, -1, -1, -1, -1, -1},
217 { 2, 0, 1, -1, -1, -1, -1, -1, -1},
218 { 0, 1, 2, -1, -1, -1, -1, -1, -1},
219 { 2, 0, 1, 3, -1, -1, -1, -1, -1},
220 { 0, 1, 2, 3, -1, -1, -1, -1, -1},
221 { 2, 0, 1, 3, 4, -1, -1, -1, -1},
222 { 2, 3, 0, 1, 4, 5, -1, -1, -1},
223 { 2, 0, 1, 3, 4, 5, -1, -1, -1},
224 { 0, 5, 3, 4, 1, 2, -1, -1, -1},
225 { 3, 2, 4, 0, 1, 5, 6, -1, -1},
226 { 4, 5, 0, 1, 6, 2, 7, 3, -1},
227 { 3, 2, 4, 0, 1, 5, 7, 6, -1},
231 { 0, 1, -1, -1, -1, -1, -1, -1, -1},
232 { 0, 1, 2, -1, -1, -1, -1, -1, -1},
233 { 0, 1, 2, -1, -1, -1, -1, -1, -1},
234 { 0, 1, 2, -1, -1, -1, -1, -1, -1},
235 { 0, 1, 2, -1, -1, -1, -1, -1, -1},
236 { 2, 0, 1, 3, -1, -1, -1, -1, -1},
237 { 0, 1, 2, 3, -1, -1, -1, -1, -1},
238 { 2, 0, 1, 3, 4, -1, -1, -1, -1},
239 { 0, 1, 3, 4, 2, -1, -1, -1, -1},
240 { 2, 0, 1, 4, 5, 3, -1, -1, -1},
241 { 2, 3, 0, 1, 5, 6, 4, -1, -1},
242 { 2, 0, 1, 3, 4, 5, 6, -1, -1},
243 { 0, 5, 3, 4, 1, 2, 6, -1, -1},
244 { 3, 2, 4, 0, 1, 6, 7, 5, -1},
245 { 4, 5, 0, 1, 7, 2, 8, 3, 6},
246 { 3, 2, 4, 0, 1, 5, 8, 7, 6},
249 #define DCA_DOLBY 101
251 #define DCA_CHANNEL_BITS 6
252 #define DCA_CHANNEL_MASK 0x3F
256 #define HEADER_SIZE 14
258 #define DCA_MAX_FRAME_SIZE 16384
259 #define DCA_MAX_EXSS_HEADER_SIZE 4096
261 #define DCA_BUFFER_PADDING_SIZE 1024
381 int mix_config_num_ch[4];
394 0, 512, 640, 768, 1282, 1794, 2436, 3080, 3770, 4454, 5364,
395 5372, 5380, 5388, 5392, 5396, 5412, 5420, 5428, 5460, 5492, 5508,
396 5572, 5604, 5668, 5796, 5860, 5892, 6412, 6668, 6796, 7308, 7564,
397 7820, 8076, 8620, 9132, 9388, 9910, 10166, 10680, 11196, 11726, 12240,
398 12752, 13298, 13810, 14326, 14840, 15500, 16022, 16540, 17158, 17678, 18264,
399 18796, 19352, 19926, 20468, 21472, 22398, 23014, 23622,
404 static int vlcs_initialized = 0;
406 static VLC_TYPE dca_table[23622][2];
408 if (vlcs_initialized)
411 dca_bitalloc_index.
offset = 1;
412 dca_bitalloc_index.
wrap = 2;
413 for (i = 0; i < 5; i++) {
420 dca_scalefactor.
offset = -64;
421 dca_scalefactor.
wrap = 2;
422 for (i = 0; i < 5; i++) {
431 for (i = 0; i < 4; i++) {
439 for (i = 0; i < 10; i++)
440 for (j = 0; j < 7; j++) {
444 dca_smpl_bitalloc[i + 1].
wrap = 1 + (j > 4);
446 dca_smpl_bitalloc[i + 1].
vlc[j].
table_allocated = dca_vlc_offs[c + 1] - dca_vlc_offs[c];
454 vlcs_initialized = 1;
466 static const float adj_table[4] = { 1.0, 1.1250, 1.2500, 1.4375 };
467 static const int bitlen[11] = { 0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3 };
468 static const int thr[11] = { 0, 1, 3, 3, 3, 3, 7, 7, 7, 7, 7 };
495 for (j = 1; j < 11; j++)
500 for (j = 0; j < 11; j++)
504 for (j = 1; j < 11; j++)
534 for (j = 0; j < 11; j++)
538 for (j = 0; j < 11; j++)
634 "source pcm resolution: %i (%i bits/sample)\n",
654 value = av_clip(value, 0, (1 << log2range) - 1);
655 }
else if (level < 8) {
656 if (level + 1 > log2range) {
703 "Invalid bit allocation index\n");
723 k < s->vq_start_subband[j] && s->
bitalloc[j][k] > 0) {
734 const uint32_t *scale_table;
735 int scale_sum, log_size;
787 for (k = s->
subband_activity[j]; k < s->subband_activity[source_channel]; k++) {
794 "Joint stereo coding not supported\n");
811 "Invalid channel mode %d\n", am);
848 if (!base_channel && s->
lfe) {
850 int lfe_samples = 2 * s->
lfe * (4 + block_index);
854 for (j = lfe_samples; j < lfe_end_sample; j++) {
866 for (j = lfe_samples; j < lfe_end_sample; j++)
885 "prediction coefs: %f, %f, %f, %f\n",
917 for (k = s->
subband_activity[j]; k < s->subband_activity[source_channel]; k++)
935 if (!base_channel && s->
lfe) {
936 int lfe_samples = 2 * s->
lfe * (4 + block_index);
940 for (j = lfe_samples; j < lfe_end_sample; j++)
950 float samples_in[32][8],
float *samples_out,
953 const float *prCoeff;
959 scale *= sqrt(1 / 8.0);
967 for (i = sb_act; i < 32; i++)
971 for (subindex = 0; subindex < 8; subindex++) {
973 for (i = 0; i < sb_act; i++) {
974 unsigned sign = (i - 1) & 2;
975 uint32_t
v =
AV_RN32A(&samples_in[i][subindex]) ^ sign << 30;
983 samples_out, s->
raXin, scale);
989 int num_deci_sample,
float *samples_in,
990 float *samples_out,
float scale)
1001 const float *prCoeff;
1005 if (decimation_select == 1) {
1013 for (deciindex = 0; deciindex < num_deci_sample; deciindex++) {
1014 s->
dcadsp.
lfe_fir(samples_out, samples_in, prCoeff, decifactor, scale);
1016 samples_out += 2 * decifactor;
1021 #define MIX_REAR1(samples, si1, rs, coef) \
1022 samples[i] += samples[si1] * coef[rs][0]; \
1023 samples[i+256] += samples[si1] * coef[rs][1];
1025 #define MIX_REAR2(samples, si1, si2, rs, coef) \
1026 samples[i] += samples[si1] * coef[rs][0] + samples[si2] * coef[rs + 1][0]; \
1027 samples[i+256] += samples[si1] * coef[rs][1] + samples[si2] * coef[rs + 1][1];
1029 #define MIX_FRONT3(samples, coef) \
1030 t = samples[i + c]; \
1031 u = samples[i + l]; \
1032 v = samples[i + r]; \
1033 samples[i] = t * coef[0][0] + u * coef[1][0] + v * coef[2][0]; \
1034 samples[i+256] = t * coef[0][1] + u * coef[1][1] + v * coef[2][1];
1036 #define DOWNMIX_TO_STEREO(op1, op2) \
1037 for (i = 0; i < 256; i++) { \
1044 const int8_t *channel_mapping)
1046 int c, l,
r, sl, sr, s;
1067 c = channel_mapping[0] * 256;
1068 l = channel_mapping[1] * 256;
1069 r = channel_mapping[2] * 256;
1073 s = channel_mapping[2] * 256;
1077 c = channel_mapping[0] * 256;
1078 l = channel_mapping[1] * 256;
1079 r = channel_mapping[2] * 256;
1080 s = channel_mapping[3] * 256;
1085 sl = channel_mapping[2] * 256;
1086 sr = channel_mapping[3] * 256;
1090 c = channel_mapping[0] * 256;
1091 l = channel_mapping[1] * 256;
1092 r = channel_mapping[2] * 256;
1093 sl = channel_mapping[3] * 256;
1094 sr = channel_mapping[4] * 256;
1096 MIX_REAR2(samples, i + sl, i + sr, 3, coef));
1102 #ifndef decode_blockcodes
1108 int offset = (levels - 1) >> 1;
1110 for (i = 0; i < 4; i++) {
1111 int div =
FASTDIV(code, levels);
1112 values[i] = code - offset - div * levels;
1129 #ifndef int8x8_fmul_int32
1132 float fscale = scale / 16.0;
1134 for (i = 0; i < 8; i++)
1135 dst[i] = src[i] * fscale;
1144 const float *quant_step_table;
1170 float quant_step_size = quant_step_table[abits];
1183 memset(subband_samples[k][l], 0, 8 *
sizeof(subband_samples[0][0][0]));
1187 float rscale = quant_step_size * s->
scale_factor[k][l][sfi] *
1190 if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table) {
1193 int block_code1, block_code2,
size, levels, err;
1204 "ERROR: block code look-up failed\n");
1209 for (m = 0; m < 8; m++)
1214 for (m = 0; m < 8; m++)
1216 &dca_smpl_bitalloc[abits], sel);
1228 for (m = 0; m < 8; m++) {
1229 for (n = 1; n <= 4; n++)
1231 subband_samples[k][l][m] +=
1233 subband_samples[k][l][m - n] / 8192);
1235 subband_samples[k][l][m] +=
1252 "Stream with high frequencies VQ coding\n");
1278 &subband_samples[k][l][4],
1279 4 *
sizeof(subband_samples[0][0][0]));
1318 int aux_data_count = 0, i;
1325 if (!base_channel) {
1332 for (i = 0; i < aux_data_count; i++)
1401 const uint16_t *ssrc = (
const uint16_t *) src;
1402 uint16_t *sdst = (uint16_t *) dst;
1405 if ((
unsigned) src_size > (unsigned) max_size) {
1408 src_size = max_size;
1414 memcpy(dst, src, src_size);
1417 for (i = 0; i < (src_size + 1) >> 1; i++)
1423 for (i = 0; i < (src_size + 1) >> 1; i++, src += 2) {
1440 return av_popcount(mask) +
1459 for (i = 0; i < channels; i++) {
1460 int mix_map_mask =
get_bits(gb, out_ch);
1461 int num_coeffs = av_popcount(mix_map_mask);
1474 int embedded_stereo = 0;
1475 int embedded_6ch = 0;
1476 int drc_code_present;
1477 int extensions_mask;
1509 int spkr_remap_sets;
1510 int spkr_mask_size = 16;
1519 spkr_mask_size = (
get_bits(&s->
gb, 2) + 1) << 2;
1525 for (i = 0; i < spkr_remap_sets; i++) {
1530 for (i = 0; i < spkr_remap_sets; i++) {
1531 int num_dec_ch_remaps =
get_bits(&s->
gb, 5) + 1;
1535 for (j = 0; j < num_spkrs[i]; j++) {
1537 int num_dec_ch = av_popcount(remap_dec_ch_mask);
1548 if (drc_code_present)
1554 if (drc_code_present && embedded_stereo)
1578 if (embedded_stereo)
1584 case 0: extensions_mask =
get_bits(&s->
gb, 12);
break;
1587 case 3: extensions_mask = 0;
break;
1611 "DTS extensions detection mismatch (%d, %d)\n",
1626 int active_ss_mask[8];
1651 if (num_audiop > 1) {
1658 if (num_assets > 1) {
1664 for (i = 0; i < num_audiop; i++)
1665 active_ss_mask[i] =
get_bits(&s->
gb, ss_index + 1);
1667 for (i = 0; i < num_audiop; i++)
1668 for (j = 0; j <= ss_index; j++)
1669 if (active_ss_mask[i] & (1 << j))
1674 int mix_out_mask_size;
1677 mix_out_mask_size = (
get_bits(&s->
gb, 2) + 1) << 2;
1681 int mix_out_mask =
get_bits(&s->
gb, mix_out_mask_size);
1687 for (i = 0; i < num_assets; i++)
1690 for (i = 0; i < num_assets; i++) {
1704 int *got_frame_ptr,
AVPacket *avpkt)
1706 const uint8_t *buf = avpkt->
data;
1707 int buf_size = avpkt->
size;
1710 int num_core_channels = 0;
1713 int16_t *samples_s16;
1773 int ext_amode, xch_fsize;
1790 if ((ext_amode =
get_bits(&s->
gb, 4)) != 1) {
1792 " supported!\n", ext_amode);
1852 if (s->
amode < 16) {
1855 if (s->
xch_present && (!avctx->request_channels ||
1856 avctx->request_channels > num_core_channels + !!s->
lfe)) {
1865 channels = num_core_channels + !!s->
lfe;
1874 if (channels > !!s->
lfe &&
1900 "channels changing in stream. Skipping frame.\n");
1910 samples_flt = (
float *) s->
frame.
data[0];
1911 samples_s16 = (int16_t *) s->
frame.
data[0];
1930 samples_flt += 256 * channels;
1935 samples_s16 += 256 * channels;
1941 for (i = 0; i < 2 * s->
lfe * 4; i++)
1985 avctx->request_channels == 2) {
1986 avctx->
channels = avctx->request_channels;
int wrap
wrap for get_vlc2()
static int dca_filter_channels(DCAContext *s, int block_index)
int ext_descr
extension audio descriptor flag
static const int8_t bitalloc_offsets[10]
int downmix
embedded downmix enabled
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int quant_index_huffman[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX]
quantization index codebook select
low bitrate component in ExSS
int bitalloc_huffman[DCA_PRIM_CHANNELS_MAX]
bit allocation quantizer select
int crc_present
crc is present in the bitstream
AV_WL32 AV_WL24 AV_WL16 AV_WB32 AV_WB24 AV_RB16
#define DCA_BUFFER_PADDING_SIZE
static void int8x8_fmul_int32(float *dst, const int8_t *src, int scale)
int timestamp
embedded time stamp flag
int amode
audio channels arrangement
AV_WL32 AV_WL24 AV_WL16 AV_RB32
static const AVProfile profiles[]
static const int8_t dca_channel_reorder_nolfe[][9]
static av_cold int dca_decode_init(AVCodecContext *avctx)
DCA initialization.
static const uint16_t tmode_codes[TMODE_COUNT][4]
int downmix_coef[DCA_PRIM_CHANNELS_MAX][2]
stereo downmix coefficients
int transient_huffman[DCA_PRIM_CHANNELS_MAX]
transient mode code book
static const int8_t dca_channel_reorder_lfe[][9]
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static const uint32_t scale_factor_quant6[64]
int mix_config_num_ch[4]
number of channels in each mix out configuration
static void skip_bits_long(GetBitContext *s, int n)
AVFrame * coded_frame
the picture in the bitstream
static void dca_exss_skip_mix_coeffs(GetBitContext *gb, int channels, int out_ch)
Skip mixing coefficients of a single mix out configuration (HD)
FmtConvertContext fmt_conv
#define AV_LOG_WARNING
Something somehow does not look correct.
static BitAlloc dca_tmode
transition mode VLCs
#define FF_PROFILE_DTS_HD_HRA
float scale_bias
output scale
int vq_start_subband[DCA_PRIM_CHANNELS_MAX]
high frequency vq start subband
void ff_dcadsp_init(DCADSPContext *s)
float subband_fir_noidea[DCA_PRIM_CHANNELS_MAX][32]
int hist_index[DCA_PRIM_CHANNELS_MAX]
int samples_deficit
deficit sample count
#define DECLARE_ALIGNED(n, t, v)
static const float lossless_quant_d[32]
int dynrange
embedded dynamic range flag
int joint_scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]
joint subband scale factors
int version
encoder software revision
#define FF_ARRAY_ELEMS(a)
extended bitrate extension in ExSS
#define AV_CH_LAYOUT_STEREO
void(* lfe_fir)(float *out, const float *in, const float *coefs, int decifactor, float scale)
static int dca_parse_frame_header(DCAContext *s)
void(* float_interleave)(float *dst, const float **src, unsigned int len, int channels)
Convert multiple arrays of float to an array of interleaved float.
static av_cold void dca_init_vlcs(void)
static int get_sbits(GetBitContext *s, int n)
static int dca_parse_audio_coding_header(DCAContext *s, int base_channel)
float subband_fir_hist[DCA_PRIM_CHANNELS_MAX][512]
#define DCA_HD_MARKER
DCA-HD specific block starts with this marker.
#define DCA_PRIM_CHANNELS_MAX
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
void(* float_to_int16_interleave)(int16_t *dst, const float **src, long len, int channels)
Convert multiple arrays of float to an interleaved array of int16_t.
int scalefactor_huffman[DCA_PRIM_CHANNELS_MAX]
scale factor code book
void(* int32_to_float_fmul_scalar)(float *dst, const int *src, float mul, int len)
Convert an array of int32_t to float and multiply by a float value.
enum AVSampleFormat sample_fmt
audio sample format
int xch_base_channel
index of first (only) channel containing XCH data
float subband_samples_hist[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4]
static const uint8_t abits_sizes[7]
int dca_buffer_size
how much data is in the dca_buffer
static const uint32_t scale_factor_quant7[128]
static const int8_t dca_channel_reorder_lfe_xch[][9]
static int decode_blockcode(int code, int levels, int *values)
#define AV_CH_LOW_FREQUENCY
int header_crc
header crc check bytes
static av_cold int dca_decode_end(AVCodecContext *avctx)
int transition_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]
transition mode (transients)
static int dca_exss_parse_asset_header(DCAContext *s)
Parse extension substream asset header (HD)
static int get_bits_count(const GetBitContext *s)
#define MIX_REAR1(samples, si1, rs, coef)
int sample_rate
audio sampling rate
bitstream reader API header.
int lfe
low frequency effects flag
static const float fir_32bands_nonperfect[]
#define LOCAL_ALIGNED_16(t, v,...)
static const uint8_t bitalloc_sizes[10]
av_cold void dsputil_init(DSPContext *c, AVCodecContext *avctx)
static int init(AVCodecParserContext *s)
XXCh channels extension in core substream.
audio conversion routines
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
int predictor_history
predictor history flag
static void dca_downmix(float *samples, int srcfmt, int downmix_coef[DCA_PRIM_CHANNELS_MAX][2], const int8_t *channel_mapping)
static int 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.
int dynrange_coef
dynamic range coefficient
int joint_huff[DCA_PRIM_CHANNELS_MAX]
joint subband scale factors codebook
static int get_bits_left(GetBitContext *gb)
int scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][2]
scale factors (2 if transient)
float subband_samples[DCA_BLOCKS_MAX][DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8]
static const uint16_t mask[17]
#define MIX_FRONT3(samples, coef)
#define MIX_REAR2(samples, si1, si2, rs, coef)
static const uint16_t bitalloc_12_codes[BITALLOC_12_COUNT][12]
enum AVSampleFormat request_sample_fmt
Used to request a sample format from the decoder.
int hdcd
source material is mastered in HDCD
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static const uint64_t dca_core_channel_layout[]
#define DOWNMIX_TO_STEREO(op1, op2)
int mix_metadata
mixing metadata present
#define FF_PROFILE_DTS_ES
void av_log(void *avcl, int level, const char *fmt,...)
static const uint8_t bitalloc_12_bits[BITALLOC_12_COUNT][12]
const char * name
Name of the codec implementation.
int bitalloc[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]
bit allocation index
static void put_bits(PutBitContext *s, int n, unsigned int value)
Write up to 31 bits into a bitstream.
int debug_flag
used for suppressing repeated error messages output
static void get_array(GetBitContext *gb, int *dst, int len, int bits)
static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
static const uint32_t dca_sample_rates[16]
uint64_t channel_layout
Audio channel layout.
static int put_bits_count(PutBitContext *s)
static const int dca_ext_audio_descr_mask[]
static int dca_exss_mask2count(int mask)
Return the number of channels in an ExSS speaker mask (HD)
const int8_t * channel_order_tab
channel reordering table, lfe and non lfe
float lfe_data[2 *DCA_LFE_MAX *(DCA_BLOCKS_MAX+4)]
Low frequency effect data.
static const uint8_t tmode_bits[TMODE_COUNT][4]
#define DCA_MARKER_14B_LE
int front_sum
front sum/difference flag
static const float dca_downmix_coeffs[65]
int source_pcm_res
source pcm resolution
static int dca_decode_block(DCAContext *s, int base_channel, int block_index)
Decode a dca frame block.
static int decode_blockcodes(int code1, int code2, int levels, int *values)
static BitAlloc dca_scalefactor
scalefactor VLCs
int bit_rate
the average bitrate
static BitAlloc dca_bitalloc_index
indexes for samples VLC select
lossless extension in ExSS
static const uint16_t dca_vlc_offs[]
int surround_sum
surround sum/difference flag
#define FF_PROFILE_UNKNOWN
static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba, int idx)
av_cold void ff_synth_filter_init(SynthFilterContext *c)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame)
int is_channels_set
check for if the channel number is already set
uint8_t dca_buffer[DCA_MAX_FRAME_SIZE+DCA_MAX_EXSS_HEADER_SIZE+DCA_BUFFER_PADDING_SIZE]
static const uint8_t scales_bits[SCALES_COUNT][129]
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
XCh channel extension in core substream.
int joint_intensity[DCA_PRIM_CHANNELS_MAX]
joint intensity coding index
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.
static const int16_t adpcm_vb[4096][4]
static const uint16_t *const bitalloc_codes[10][8]
int multirate_inter
multirate interpolator switch
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static const uint8_t dca_channels[16]
#define AV_CH_FRONT_LEFT_OF_CENTER
#define AV_CH_FRONT_CENTER
int bit_rate
transmission bit rate
static const uint8_t *const bitalloc_bits[10][8]
#define INIT_VLC_USE_NEW_STATIC
int offset
code values offset
#define AV_CH_FRONT_RIGHT_OF_CENTER
static const float lfe_fir_64[]
int xch_present
XCh extension present and valid.
static int dca_subframe_footer(DCAContext *s, int base_channel)
static void qmf_32_subbands(DCAContext *s, int chans, float samples_in[32][8], float *samples_out, float scale)
static const uint8_t abits_levels[7]
#define AVERROR_PATCHWELCOME
Not yet implemented in Libav, patches welcome.
int high_freq_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]
VQ encoded high frequency subbands.
int core_ext_mask
present extensions in the core substream
#define FF_PROFILE_DTS_96_24
int frame_size
Samples per packet, initialized when calling 'init'.
static int dca_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Main frame decoding function FIXME add arguments.
#define DCA_MARKER_RAW_LE
int aux_data
auxiliary data flag
int sample_rate
samples per second
int ext_coding
extended coding flag
void av_log_ask_for_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message asking for a sample.
int subband_activity[DCA_PRIM_CHANNELS_MAX]
subband activity count
main external API structure.
static void close(AVCodecParserContext *s)
float scalefactor_adj[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX]
scale factor adjustment
int copy_history
copy history
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define init_vlc(vlc, nb_bits, nb_codes,bits, bits_wrap, bits_size,codes, codes_wrap, codes_size,flags)
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static const float lossy_quant_d[32]
#define DCA_MAX_FRAME_SIZE
int sample_blocks
number of PCM sample blocks
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static void dca_exss_parse_header(DCAContext *s)
Parse extension substream header (HD)
static const uint16_t scale[4]
#define AV_CH_BACK_CENTER
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int prediction_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]
prediction mode (ADPCM used or not)
static int get_scale(GetBitContext *gb, int level, int value, int log2range)
static const float fir_32bands_perfect[]
int num_mix_configs
number of mix out configurations
void(* synth_filter_float)(FFTContext *imdct, float *synth_buf_ptr, int *synth_buf_offset, float synth_buf2[32], const float window[512], float out[32], const float in[32], float scale)
static BitAlloc dca_smpl_bitalloc[11]
samples VLCs
static const int8_t dca_channel_reorder_nolfe_xch[][9]
static const uint8_t dca_default_coeffs[10][5][2]
#define DCA_MARKER_14B_BE
common internal api header.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
common internal and external API header
96/24 extension in core substream
int total_channels
number of channels including extensions
static const uint16_t scales_codes[SCALES_COUNT][129]
int prediction_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]
prediction VQ coefs
int dialog_norm
dialog normalisation parameter
AVSampleFormat
all in native-endian format
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
int bit_rate_index
transmission bit rate index
static const uint8_t bitalloc_maxbits[10][7]
av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx)
static void lfe_interpolation_fir(DCAContext *s, int decimation_select, int num_deci_sample, float *samples_in, float *samples_out, float scale)
static const int8_t dca_lfe_index[]
int channels
number of audio channels
static const uint32_t dca_bit_rates[32]
VLC_TYPE(* table)[2]
code, bits
static const int8_t high_freq_vq[1024][32]
int subsubframes[DCA_SUBFRAMES_MAX]
number of subsubframes
static const float lfe_fir_128[]
const float * samples_chanptr[DCA_PRIM_CHANNELS_MAX+1]
int frame_size
primary frame byte size
int aspf
audio sync word insertion flag
#define DCA_MARKER_RAW_BE
DCA syncwords, also used for bitstream type detection.
void avcodec_get_frame_defaults(AVFrame *pic)
Set the fields of the given AVFrame to default values.
int prim_channels
number of primary audio channels
#define FF_PROFILE_DTS_HD_MA
static const uint8_t bitalloc_12_vlc_bits[BITALLOC_12_COUNT]
XXCh channels extension in ExSS.
int partial_samples[DCA_SUBFRAMES_MAX]
partial subsubframe samples count
#define DCA_SUBFRAMES_MAX
int subframes
number of subframes
int nb_samples
number of audio samples (per channel) described by this frame
core in ExSS (extension substream)
static const uint8_t tmode_vlc_bits[TMODE_COUNT]
int static_fields
static fields present
int frame_type
type of the current frame
static const uint8_t dca_bits_per_sample[7]
#define DCA_MAX_EXSS_HEADER_SIZE
float samples[(DCA_PRIM_CHANNELS_MAX+1)*256]
static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)