104 #define DCA_DOLBY                  101            
  106 #define DCA_CHANNEL_BITS             6 
  107 #define DCA_CHANNEL_MASK          0x3F 
  111 #define HEADER_SIZE                 14 
  113 #define DCA_NSYNCAUX        0x9A1105A0 
  140     static int vlcs_initialized = 0;
 
  142     static VLC_TYPE dca_table[23622][2];
 
  144     if (vlcs_initialized)
 
  147     dca_bitalloc_index.
offset = 1;
 
  148     dca_bitalloc_index.
wrap   = 2;
 
  149     for (i = 0; i < 5; i++) {
 
  151         dca_bitalloc_index.
vlc[i].
table_allocated = ff_dca_vlc_offs[i + 1] - ff_dca_vlc_offs[i];
 
  156     dca_scalefactor.
offset = -64;
 
  157     dca_scalefactor.
wrap   = 2;
 
  158     for (i = 0; i < 5; i++) {
 
  160         dca_scalefactor.
vlc[i].
table_allocated = ff_dca_vlc_offs[i + 6] - ff_dca_vlc_offs[i + 5];
 
  167     for (i = 0; i < 4; i++) {
 
  175     for (i = 0; i < 10; i++)
 
  176         for (j = 0; j < 7; j++) {
 
  180             dca_smpl_bitalloc[i + 1].
wrap                   = 1 + (j > 4);
 
  182             dca_smpl_bitalloc[i + 1].
vlc[j].
table_allocated = ff_dca_vlc_offs[c + 1] - ff_dca_vlc_offs[
c];
 
  190     vlcs_initialized = 1;
 
  205          i <= s->xxch_chset && !(mask & xxch_ch); mask = s->
xxch_spk_masks[++i])
 
  206         base += av_popcount(mask);
 
  208     return base + av_popcount(mask & (xxch_ch - 1));
 
  215     static const float adj_table[4] = { 1.0, 1.1250, 1.2500, 1.4375 };
 
  216     static const int bitlen[11] = { 0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3 };
 
  217     static const int thr[11]    = { 0, 1, 3, 3, 3, 3, 7, 7, 7, 7, 7 };
 
  218     int hdr_pos = 0, hdr_size = 0;
 
  220     int this_chans, acc_mask;
 
  221     int embedded_downmix;
 
  232     if (xxch && nchans >= 3) {
 
  259             if (coeff<1 || coeff>61) {
 
  276                     if (mask[j] & (1 << i)) {
 
  279                                    "DCA-XXCH: dmix to LFE1 not supported.\n");
 
  285                         if ((coeff&63)<1 || (coeff&63)>61) {
 
  317     for (j = 1; j < 11; j++)
 
  322     for (j = 0; j < 11; j++)
 
  326     for (j = 1; j < 11; j++)
 
  339         if (hdr_pos + 8 * hdr_size > i)
 
  418         value  = av_clip(value, 0, (1 << log2range) - 1);
 
  419     } 
else if (level < 8) {
 
  420         if (level + 1 > log2range) {
 
  471                        "Invalid bit allocation index\n");
 
  479                 ff_dlog(s->
avctx, 
"bitalloc index [%i][%i] too big (%i)\n",
 
  491                 k < s->vq_start_subband[j] && s->
bitalloc[j][k] > 0) {
 
  502         const uint32_t *scale_table;
 
  503         int scale_sum, log_size;
 
  555             for (k = s->
subband_activity[j]; k < s->subband_activity[source_channel]; k++) {
 
  562                        "Joint stereo coding not supported\n");
 
  588     if (!base_channel && s->
lfe) {
 
  591         int lfe_samples    = 2 * s->
lfe * (4 + block_index);
 
  595         for (j = lfe_samples; j < lfe_end_sample; j++) {
 
  611         for (j = lfe_samples; j < lfe_end_sample; j++)
 
  619                             float samples_in[32][8], 
float *samples_out,
 
  622     const float *prCoeff;
 
  626     scale *= sqrt(1 / 8.0);
 
  638                               samples_out, s->
raXin, scale);
 
  648     for (i = 0; i < 32; i++)
 
  649         for (j = 0; j < 32; j++)
 
  650             table->
dct4_coeff[i][j] = cos((2 * i + 1) * (2 * j + 1) * 
M_PI / 128);
 
  651     for (i = 0; i < 32; i++)
 
  652         for (j = 0; j < 32; j++)
 
  656     for (i = 0; i < 32; i++)
 
  657         table->
rcos[i] =  0.125 / cos((2 * i + 1) * 
M_PI / 256);
 
  658     for (i = 0; i < 32; i++)
 
  659         table->
rsin[i] = -0.125 / sin((2 * i + 1) * 
M_PI / 256);
 
  668                             float *samples_out, 
float scale)
 
  674     unsigned i, j, k, subindex;
 
  678     for (subindex = 0; subindex < 8; subindex++) {
 
  680             raXin[i] = samples_in[i][subindex];
 
  682         for (k = 0; k < 32; k++) {
 
  684             for (i = 0; i < 32; i++)
 
  687         for (k = 0; k < 32; k++) {
 
  689             for (i = 1; i < 32; i++)
 
  692         for (k = 0; k < 32; k++) {
 
  697         for (i = 0; i < 64; i++) {
 
  699             for (j = 0; j < 1024; j += 128)
 
  701             *samples_out++ = out * scale;
 
  704         for (i = 0; i < 64; i++) {
 
  706             for (j = 0; j < 1024; j += 128)
 
  713         memmove(raX + 64, raX, (1024 - 64) * 
sizeof(*raX));
 
  729     const float *prCoeff;
 
  744     for (deciindex = 0; deciindex < 2 * s->
lfe; deciindex++) {
 
  747         samples_out += 2 * 32 * (1 + idx);
 
  752 #define MIX_REAR1(samples, s1, rs, coef)            \ 
  753     samples[0][i] += samples[s1][i] * coef[rs][0];  \ 
  754     samples[1][i] += samples[s1][i] * coef[rs][1]; 
  756 #define MIX_REAR2(samples, s1, s2, rs, coef)                                          \ 
  757     samples[0][i] += samples[s1][i] * coef[rs][0] + samples[s2][i] * coef[rs + 1][0]; \ 
  758     samples[1][i] += samples[s1][i] * coef[rs][1] + samples[s2][i] * coef[rs + 1][1]; 
  760 #define MIX_FRONT3(samples, coef)                                      \ 
  764     samples[0][i] = t * coef[0][0] + u * coef[1][0] + v * coef[2][0];  \ 
  765     samples[1][i] = t * coef[0][1] + u * coef[1][1] + v * coef[2][1]; 
  767 #define DOWNMIX_TO_STEREO(op1, op2)             \ 
  768     for (i = 0; i < 256; i++) {                 \ 
  773 static void dca_downmix(
float **samples, 
int srcfmt, 
int lfe_present,
 
  775                         const int8_t *channel_mapping)
 
  777     int c, l, 
r, sl, sr, 
s;
 
  792         c = channel_mapping[0];
 
  793         l = channel_mapping[1];
 
  794         r = channel_mapping[2];
 
  798         s = channel_mapping[2];
 
  802         c = channel_mapping[0];
 
  803         l = channel_mapping[1];
 
  804         r = channel_mapping[2];
 
  805         s = channel_mapping[3];
 
  810         sl = channel_mapping[2];
 
  811         sr = channel_mapping[3];
 
  815         c  = channel_mapping[0];
 
  816         l  = channel_mapping[1];
 
  817         r  = channel_mapping[2];
 
  818         sl = channel_mapping[3];
 
  819         sr = channel_mapping[4];
 
  827         for (i = 0; i < 256; i++) {
 
  828             samples[0][i] += samples[lf_buf][i] * coef[lf_idx][0];
 
  829             samples[1][i] += samples[lf_buf][i] * coef[lf_idx][1];
 
  834 #ifndef decode_blockcodes 
  840     int offset = (levels - 1) >> 1;
 
  842     for (i = 0; i < 4; i++) {
 
  843         int div = 
FASTDIV(code, levels);
 
  844         values[i] = code - offset - div * levels;
 
  866     const float *quant_step_table;
 
  894             float quant_step_size = quant_step_table[abits];
 
  908                 memset(
block + 8 * l, 0, 8 * 
sizeof(
block[0]));
 
  912                 rscale[l] = quant_step_size * s->
scale_factor[k][l][sfi] *
 
  915                 if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].
table) {
 
  918                         int block_code1, block_code2, 
size, levels, err;
 
  926                                                         levels, 
block + 8 * l);
 
  929                                    "ERROR: block code look-up failed\n");
 
  934                         for (m = 0; m < 8; m++)
 
  939                     for (m = 0; m < 8; m++)
 
  941                                                         &dca_smpl_bitalloc[abits], sel);
 
  966                 for (m = 1; m < 8; m++) {
 
  968                                 subband_samples[k][l][m - 1];
 
  969                     for (n = 2; n <= 4; n++)
 
  972                                    subband_samples[k][l][m - 
n];
 
  976                     subband_samples[k][l][
m] += sum * (1.0f / 8192);
 
  987                        "Stream with high frequencies VQ coding\n");
 
 1053             for (i = 255; i > 0; i--) {
 
 1055                 samples[2 * i + 1] = samples[i];
 
 1057             samples[1] = samples[0];
 
 1075     int in, 
out, aux_data_count, aux_data_end, reserved;
 
 1083     if (!base_channel) {
 
 1103                                       "Auxiliary Decode Time Stamp Flag");
 
 1136                            "Invalid mode %d for embedded downmix coefficients\n",
 
 1143                         if ((tmp & 0xFF) > 241) {
 
 1145                                    "Invalid downmix coefficient code %"PRIu16
"\n",
 
 1160                        "Overread auxiliary data by %d bits\n", -reserved);
 
 1162             } 
else if (reserved) {
 
 1164                                       "Core auxiliary data reserved content");
 
 1226     int hdr_size, num_chsets, xbr_tmode, hdr_pos;
 
 1227     int i, j, k, l, chset, chan_base;
 
 1237     for(i = 0; i < num_chsets; i++)
 
 1242     for(i = 0; i < num_chsets; i++) {
 
 1245         for(j = 0; j < n_xbr_ch[i]; j++) {
 
 1246             active_bands[i][j] = 
get_bits(&s->
gb, k) + 1;
 
 1256     if(hdr_pos + hdr_size * 8 > i)
 
 1261     for(chset = 0, chan_base = 0;
 
 1262         chset < num_chsets && chan_base + n_xbr_ch[chset] <= s->
prim_channels;
 
 1263         chan_base += n_xbr_ch[chset++]) {
 
 1265         int subsubframe = 0;
 
 1271             if(subsubframe == 0) {
 
 1273                 for(i = 0; i < n_xbr_ch[chset]; i++) {
 
 1277                 for(i = 0; i < n_xbr_ch[chset]; i++) {
 
 1278                     get_array(&s->
gb, abits_high[i], active_bands[chset][i], anctemp[i]);
 
 1281                 for(i = 0; i < n_xbr_ch[chset]; i++) {
 
 1283                     if(anctemp[i] < 1) {
 
 1290                 for(i = 0; i < n_xbr_ch[chset]; i++) {
 
 1291                     const uint32_t *scale_table;
 
 1293                     int scale_table_size;
 
 1305                     for(j = 0; j < active_bands[chset][i]; j++) {
 
 1306                         if(abits_high[i][j] > 0) {
 
 1308                             if (index >= scale_table_size) {
 
 1312                             scale_table_high[i][j][0] = scale_table[
index];
 
 1316                                 if (index >= scale_table_size) {
 
 1320                                 scale_table_high[i][j][1] = scale_table[
index];
 
 1328             for(i = 0; i < n_xbr_ch[chset]; i++) {
 
 1329                 for(j = 0; j < active_bands[chset][i]; j++) {
 
 1330                     const int xbr_abits = abits_high[i][j];
 
 1333                     const float rscale = quant_step_size * scale_table_high[i][j][sfi];
 
 1343                         int block_code1, block_code2, 
size, levels, err;
 
 1354                                    "ERROR: DTS-XBR: block code look-up failed\n");
 
 1360                     for(l = 0; l < 8; l++)
 
 1361                         subband_samples[l] += (
float)block[l] * rscale;
 
 1382         if(start_posn + chset_fsize[chset] * 8 != i) {
 
 1383             j = start_posn + chset_fsize[chset] * 8 - i;
 
 1386                        " skipping further than expected (%d bits)\n", j);
 
 1398     int hdr_size, spkmsk_bits, num_chsets, core_spk, hdr_pos;
 
 1399     int i, chset, base_channel, chstart, fsize[8];
 
 1408     for (i = 0; i < num_chsets; i++)
 
 1418     if (hdr_pos + hdr_size * 8 > i)
 
 1421     for (chset = 0; chset < num_chsets; chset++) {
 
 1434                        "Error decoding DTS-XXCH extension\n");
 
 1441         if (chstart + fsize[chset] * 8 > i)
 
 1451     int sign = (code >> 8) - 1;
 
 1461                             int *got_frame_ptr, 
AVPacket *avpkt)
 
 1465     int buf_size       = avpkt->
size;
 
 1469     int num_core_channels = 0;
 
 1471     float **samples_flt;
 
 1476     int channels, full_channels;
 
 1528                 for (i = 0; i < num_core_channels + !!s->
lfe; i++) {
 
 1538                            "Invalid channel mode %d\n", am);
 
 1541                 if (num_core_channels + !!s->
lfe >
 
 1547                 for (i = 0; i < num_core_channels + !!s->
lfe; i++) {
 
 1553             for (i = 0; i < num_core_channels + !!s->
lfe; i++) {
 
 1584                 int ext_amode, xch_fsize;
 
 1601                 if ((ext_amode = 
get_bits(&s->
gb, 4)) != 1) {
 
 1603                            "XCh extension amode %d not supported!\n",
 
 1677         if (s->
amode < 16) {
 
 1690 #if FF_API_REQUEST_CHANNELS 
 1713                 channels       = num_core_channels + !!s->
lfe;
 
 1722             if (channels > !!s->
lfe &&
 
 1731             if (num_core_channels + !!s->
lfe > 2 &&
 
 1738                 static const int8_t dca_channel_order_native[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
 
 1744                    "Non standard configuration %d !\n", s->
amode);
 
 1755             channels = num_core_channels + !!s->
lfe;
 
 1771             if (channel_mask & (1 << i)) {
 
 1778         if (av_popcount(channel_mask) != av_popcount(channel_layout)) {
 
 1780                    "DTS-XXCH: Inconsistent avcodec/dts channel layouts\n");
 
 1788             for (chset = -1, j = 0; chset < s->
xxch_chset; ++chset) {
 
 1794                         posn = av_popcount(channel_layout & (lavc - 1));
 
 1803             for (i = 0; i < channels; i++)
 
 1819                    "DCA: too many residual channels (%d, core channels %d). Disabling XLL\n",
 
 1822         } 
else if (xll_nb_samples != frame->
nb_samples &&
 
 1825                    "DCA: unsupported upsampling (%d XLL samples, %d core samples). Disabling XLL\n",
 
 1829             if (2 * frame->
nb_samples == xll_nb_samples) {
 
 1831                        "XLL: upsampling core channels by a factor of 2\n");
 
 1876                                      full_channels - channels,
 
 1885         unsigned block = upsample ? 512 : 256;
 
 1886         for (ch = 0; ch < channels; ch++)
 
 1888         for (; ch < full_channels; ch++)
 
 1906             ch = num_core_channels;
 
 1907             for (chset = 0; chset < s->
xxch_chset; chset++) {
 
 1912                 for (j = ch; j < endch; j++) {
 
 1913                     if (mask & (1 << j)) { 
 
 1915                         for (k = 0; k < endch; k++) {
 
 1928                 if ((mask & (1 << ch)) && s->
xxch_dmix_sf[chset] != 1.0f) {
 
 1931                     for (j = 0; j < ch; j++) {
 
 1933                         for (k = 0; k < 256; k++)
 
 1934                             src_chan[k] *= scale;
 
 1940                         for (k = 0; k < 256; k++)
 
 1941                             src_chan[k] *= scale;
 
 1953     for (i = 0; i < 2 * s->
lfe * 4; i++)
 
 2003 #if FF_API_REQUEST_CHANNELS 
int wrap
wrap for get_vlc2() 
const float ff_dca_lfe_xll_fir_64[256]
int ext_descr
extension audio descriptor flag 
const float ff_dca_lossless_quant_d[32]
static const int8_t bitalloc_offsets[10]
#define AVERROR_INVALIDDATA
Invalid data found when processing input. 
int quant_index_huffman[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX]
quantization index codebook select 
int bitalloc_huffman[DCA_PRIM_CHANNELS_MAX]
bit allocation quantizer select 
int crc_present
crc is present in the bitstream 
This structure describes decoded (raw) audio or video data. 
const int8_t ff_dca_channel_reorder_lfe_xch[16][9]
int timestamp
embedded time stamp flag 
int amode
audio channels arrangement 
ptrdiff_t const GLvoid * data
static int decode_blockcodes(int code1, int code2, int levels, int32_t *values)
lossless extension in ExSS 
static const AVProfile profiles[]
const float ff_dca_lossy_quant_d[32]
static const uint16_t tmode_codes[TMODE_COUNT][4]
int transient_huffman[DCA_PRIM_CHANNELS_MAX]
transient mode code book 
const uint32_t ff_dca_map_xxch_to_native[28]
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits. 
#define AV_LOG_WARNING
Something somehow does not look correct. 
#define LIBAVUTIL_VERSION_INT
static void qmf_64_subbands(DCAContext *s, int chans, float samples_in[64][8], float *samples_out, float scale)
static void skip_bits_long(GetBitContext *s, int n)
attribute_deprecated int request_channels
Decoder should decode to this many channels if it can (0 for default) 
static av_cold int init(AVCodecContext *avctx)
FmtConvertContext fmt_conv
static int dca_parse_frame_header(DCAContext *s)
void(* lfe_fir[2])(float *out, const float *in, const float *coefs)
int vq_start_subband[DCA_PRIM_CHANNELS_MAX]
high frequency vq start subband 
#define AV_OPT_FLAG_AUDIO_PARAM
int hist_index[DCA_PRIM_CHANNELS_MAX]
int samples_deficit
deficit sample count 
uint8_t core_downmix
embedded downmix coefficients available 
#define DCA_MAX_FRAME_SIZE
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)
#define AV_CH_LAYOUT_STEREO
static BitAlloc dca_scalefactor
scalefactor VLCs 
static void lfe_interpolation_fir(DCAContext *s, const float *samples_in, float *samples_out)
int ff_dca_xbr_parse_frame(DCAContext *s)
static int get_sbits(GetBitContext *s, int n)
const float ff_dca_fir_32bands_nonperfect[512]
Macro definitions for various function/variable attributes. 
int maxbits[8]
max bits in VLC 
float xxch_dmix_coeff[DCA_PRIM_CHANNELS_MAX][32]
const int8_t ff_dca_high_freq_vq[1024][32]
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout. 
float * extra_channels[DCA_PRIM_CHANNELS_MAX+1]
const float ff_dca_fir_64bands[1024]
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 int dca_subframe_footer(DCAContext *s, int base_channel)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int xll_channels
total number of channels (in all channel sets) 
static BitAlloc dca_tmode
transition mode VLCs 
#define DCA_MAX_EXSS_HEADER_SIZE
#define MIX_FRONT3(samples, coef)
#define FF_PROFILE_DTS_ES
static int dca_subframe_header(DCAContext *s, int base_channel, int block_index)
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature. 
int scalefactor_huffman[DCA_PRIM_CHANNELS_MAX]
scale factor code book 
static int dca_decode_block(DCAContext *s, int base_channel, int block_index)
Decode a dca frame block. 
const uint32_t ff_dca_bit_rates[32]
static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
enum AVSampleFormat sample_fmt
audio sample format 
uint32_t xxch_core_spkmask
int xch_base_channel
index of first (only) channel containing XCH data 
float subband_samples_hist[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4]
int xll_residual_channels
number of residual channels 
static int dca_parse_audio_coding_header(DCAContext *s, int base_channel, int xxch)
int dca_buffer_size
how much data is in the dca_buffer 
#define MIX_REAR2(samples, s1, s2, rs, coef)
static void get_array(GetBitContext *gb, int *dst, int len, int bits)
96/24 extension in core substream 
#define FF_PROFILE_UNKNOWN
int8_t xxch_order_tab[32]
static av_cold int dca_decode_end(AVCodecContext *avctx)
void(* int32_to_float_fmul_array8)(struct FmtConvertContext *c, float *dst, const int32_t *src, const float *mul, int len)
Convert an array of int32_t to float and multiply by a float value from another array, stepping along the float array once for each 8 integers. 
const uint16_t ff_dca_vlc_offs[63]
#define AV_CH_LOW_FREQUENCY
int header_crc
header crc check bytes 
#define FF_PROFILE_DTS_96_24
int transition_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]
transition mode (transients) 
static int dca_xxch2index(DCAContext *s, int xxch_ch)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators. 
XllChSetSubHeader xll_chsets[DCA_XLL_CHSETS_MAX]
av_cold void ff_dcadsp_init(DCADSPContext *s)
static int get_bits_count(const GetBitContext *s)
int sample_rate
audio sampling rate 
bitstream reader API header. 
uint32_t xxch_spk_masks[4]
#define CODEC_FLAG_BITEXACT
Use only bitexact stuff (except (I)DCT). 
static BitAlloc dca_bitalloc_index
indexes for samples VLC select 
const int8_t ff_dca_channel_reorder_nolfe[16][9]
int lfe
low frequency effects flag 
static BitAlloc dca_smpl_bitalloc[11]
samples VLCs 
static const uint8_t bitalloc_sizes[10]
static void dca_downmix(float **samples, int srcfmt, int lfe_present, float coef[DCA_PRIM_CHANNELS_MAX+1][2], const int8_t *channel_mapping)
int predictor_history
predictor history flag 
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)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
uint16_t core_downmix_codes[DCA_PRIM_CHANNELS_MAX+1][4]
embedded downmix coefficients (9-bit codes) 
const float ff_dca_lfe_fir_128[256]
void(* decode_hf)(float dst[DCA_SUBBANDS][8], const int32_t vq_num[DCA_SUBBANDS], const int8_t hf_vq[1024][32], intptr_t vq_offset, int32_t scale[DCA_SUBBANDS][2], intptr_t start, intptr_t end)
float subband_samples[DCA_BLOCKS_MAX][DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8]
static const uint16_t mask[17]
#define MIX_REAR1(samples, s1, rs, coef)
static const uint16_t bitalloc_12_codes[BITALLOC_12_COUNT][12]
static const struct endianess table[]
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. ...
const uint16_t ff_dca_dmixtable[FF_DCA_DMIXTABLE_SIZE]
void(* qmf_32_subbands)(float samples_in[32][8], int sb_act, SynthFilterContext *synth, FFTContext *imdct, float synth_buf_ptr[512], int *synth_buf_offset, float synth_buf2[32], const float window[512], float *samples_out, float raXin[32], float scale)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers. 
const float ff_dca_lfe_fir_64[256]
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 int dca_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Main frame decoding function FIXME add arguments. 
static const uint8_t offset[127][2]
int debug_flag
used for suppressing repeated error messages output 
Libavcodec external API header. 
uint64_t channel_layout
Audio channel layout. 
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. 
common internal API header 
static const uint8_t tmode_bits[TMODE_COUNT][4]
static void qmf_32_subbands(DCAContext *s, int chans, float samples_in[32][8], float *samples_out, float scale)
int front_sum
front sum/difference flag 
int xch_disable
whether the XCh extension should be decoded or not 
int source_pcm_res
source pcm resolution 
#define FF_PROFILE_DTS_HD_HRA
int bit_rate
the average bitrate 
audio channel layout utility functions 
int surround_sum
surround sum/difference flag 
GLsizei GLboolean const GLfloat * value
static av_cold void dca_init_vlcs(void)
av_cold void ff_synth_filter_init(SynthFilterContext *c)
uint8_t dca_buffer[DCA_MAX_FRAME_SIZE+DCA_MAX_EXSS_HEADER_SIZE+DCA_BUFFER_PADDING_SIZE]
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. 
static const uint8_t scales_bits[SCALES_COUNT][129]
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits. 
int joint_intensity[DCA_PRIM_CHANNELS_MAX]
joint intensity coding index 
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. 
uint8_t core_downmix_amode
audio channel arrangement of embedded downmix 
const uint32_t avpriv_dca_sample_rates[16]
int bit_rate
transmission bit rate 
const uint64_t ff_dca_core_channel_layout[16]
static const uint8_t *const bitalloc_bits[10][8]
#define INIT_VLC_USE_NEW_STATIC
int offset
code values offset 
static const uint8_t abits_levels[7]
#define DCA_CHSET_CHANS_MAX
int xch_present
XCh extension present and valid. 
int ff_side_data_update_matrix_encoding(AVFrame *frame, enum AVMatrixEncoding matrix_encoding)
Add or update AV_FRAME_DATA_MATRIXENCODING side data. 
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome. 
const int16_t ff_dca_adpcm_vb[4096][4]
const uint32_t ff_dca_scale_factor_quant7[128]
int core_ext_mask
present extensions in the core substream 
int ff_dca_xll_decode_audio(DCAContext *s, AVFrame *frame)
const uint8_t ff_dca_channels[16]
#define AV_LOG_INFO
Standard information. 
static int dca_filter_channels(DCAContext *s, int block_index, int upsample)
int aux_data
auxiliary data flag 
AVSampleFormat
Audio sample formats. 
int sample_rate
samples per second 
int ext_coding
extended coding flag 
#define AV_CH_LAYOUT_NATIVE
Channel mask value used for AVCodecContext.request_channel_layout to indicate that the user requests ...
static float dca_dmix_code(unsigned code)
int32_t scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][2]
scale factors (2 if transient) 
int subband_activity[DCA_PRIM_CHANNELS_MAX]
subband activity count 
main external API structure. 
const int ff_dca_ext_audio_descr_mask[8]
float scalefactor_adj[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX]
scale factor adjustment 
int copy_history
copy history 
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame. 
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> in
const float ff_dca_default_coeffs[10][6][2]
#define init_vlc(vlc, nb_bits, nb_codes,bits, bits_wrap, bits_size,codes, codes_wrap, codes_size,flags)
const int8_t ff_dca_channel_reorder_nolfe_xch[16][9]
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits1(GetBitContext *s)
Describe the class of an AVClass context structure. 
int exss_ext_mask
Non-core extensions. 
static void skip_bits(GetBitContext *s, int n)
const uint32_t ff_dca_scale_factor_quant6[64]
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Get the required buffer size for the given audio parameters. 
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding 
int32_t high_freq_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]
VQ encoded high frequency subbands. 
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext. 
int sample_blocks
number of PCM sample blocks 
static const uint8_t abits_sizes[7]
const int8_t ff_dca_channel_reorder_lfe[16][9]
av_cold AVFloatDSPContext * avpriv_float_dsp_alloc(int bit_exact)
Allocate a float DSP context. 
int xll_segments
number of segments per frame 
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits. 
static const AVOption options[]
float subband_fir_noidea[DCA_PRIM_CHANNELS_MAX][64]
static int decode_blockcode(int code, int levels, int32_t *values)
#define AV_CH_BACK_CENTER
int prediction_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]
prediction mode (ADPCM used or not) 
static av_cold int dca_decode_init(AVCodecContext *avctx)
DCA initialization. 
static int decode(AVCodecContext *avctx, void *data, int *got_sub, AVPacket *avpkt)
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough. 
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header. 
common internal and external API header 
uint8_t * extra_channels_buffer
#define CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container. 
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 
#define FF_PROFILE_DTS_HD_MA
int xll_smpl_in_seg
samples in segment per one frequency band for the first channel set 
float subband_fir_hist[DCA_PRIM_CHANNELS_MAX][1024]
int bit_rate_index
transmission bit rate index 
void ff_dca_exss_parse_header(DCAContext *s)
Parse extension substream header (HD) 
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, const uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Fill plane data pointers and linesize for samples with sample format sample_fmt. 
static const uint8_t bitalloc_maxbits[10][7]
#define FF_ENABLE_DEPRECATION_WARNINGS
av_cold void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx)
int channels
number of audio channels 
VLC_TYPE(* table)[2]
code, bits 
float * samples_chanptr[DCA_PRIM_CHANNELS_MAX+1]
int ff_dca_xxch_decode_frame(DCAContext *s)
int subsubframes[DCA_SUBFRAMES_MAX]
number of subsubframes 
QMF64_table * qmf64_table
static const double coeff[2][5]
XCh channel extension in core substream. 
static const uint8_t * align_get_bits(GetBitContext *s)
#define DOWNMIX_TO_STEREO(op1, op2)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(constuint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(constint16_t *) pi >>8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(constint16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(constint32_t *) pi >>24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(constint32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(constfloat *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(constfloat *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(constfloat *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(constdouble *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(constdouble *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(constdouble *) pi *(1U<< 31))))#defineSET_CONV_FUNC_GROUP(ofmt, ifmt) staticvoidset_generic_function(AudioConvert *ac){}voidff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enumAVSampleFormatout_fmt, enumAVSampleFormatin_fmt, intchannels, intsample_rate, intapply_map){AudioConvert *ac;intin_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) returnNULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt)>2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);returnNULL;}returnac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}elseif(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;elseac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);returnac;}intff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){intuse_generic=1;intlen=in->nb_samples;intp;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%dsamples-audio_convert:%sto%s(dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));returnff_convert_dither(ac-> out
int frame_size
primary frame byte size 
static QMF64_table * qmf64_precompute(void)
static enum AVSampleFormat sample_fmts[]
float xxch_dmix_sf[DCA_CHSETS_MAX]
int aspf
audio sync word insertion flag 
#define LOCAL_ALIGNED_16(t, v,...)
int prim_channels
number of primary audio channels 
float downmix_coef[DCA_PRIM_CHANNELS_MAX+1][2]
stereo downmix coefficients 
static const uint8_t bitalloc_12_vlc_bits[BITALLOC_12_COUNT]
static int get_scale(GetBitContext *gb, int level, int value, int log2range)
const float ff_dca_fir_32bands_perfect[512]
uint8_t ** extended_data
pointers to the data planes/channels. 
uint64_t request_channel_layout
Request decoder to use this channel layout if it can (0 for default) 
const int8_t ff_dca_lfe_index[16]
int partial_samples[DCA_SUBFRAMES_MAX]
partial subsubframe samples count 
static const AVClass dca_decoder_class
This structure stores compressed data. 
uint32_t xxch_dmix_embedded
int subframes
number of subframes 
int nb_samples
number of audio samples (per channel) described by this frame 
unsigned int extra_channels_buffer_size
static const uint8_t tmode_vlc_bits[TMODE_COUNT]
static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba, int idx)
#define DCA_PRIM_CHANNELS_MAX
int frame_type
type of the current frame 
XXCh channels extension in core substream.