51 int *tab_offset,
VLC *out_vlc)
61 for (b = min_len; b <= max_len; b++) {
62 for (i = *cb++; i > 0; i--) {
65 codes[
index] = code++;
77 *tab_offset += 1 << max_len;
82 int i, wl_vlc_offs, ct_vlc_offs, sf_vlc_offs, tab_offset;
84 static const int wl_nb_bits[4] = { 2, 3, 5, 5 };
85 static const int wl_nb_codes[4] = { 3, 5, 8, 8 };
86 static const uint8_t *
const wl_bits[4] = {
90 static const uint8_t *
const wl_codes[4] = {
94 static const uint8_t *
const wl_xlats[4] = {
98 static const int ct_nb_bits[4] = { 3, 4, 4, 4 };
99 static const int ct_nb_codes[4] = { 4, 8, 8, 8 };
100 static const uint8_t *
const ct_bits[4] = {
104 static const uint8_t *
const ct_codes[4] = {
108 static const uint8_t *
const ct_xlats[4] = {
112 static const int sf_nb_bits[8] = { 9, 9, 9, 9, 6, 6, 7, 7 };
113 static const int sf_nb_codes[8] = { 64, 64, 64, 64, 16, 16, 16, 16 };
114 static const uint8_t *
const sf_bits[8] = {
119 static const uint16_t *
const sf_codes[8] = {
124 static const uint8_t *
const sf_xlats[8] = {
129 static const uint8_t *
const gain_cbs[11] = {
137 static const uint8_t *
const gain_xlats[11] = {
145 static const uint8_t *
const tone_cbs[7] = {
151 static const uint8_t *
const tone_xlats[7] = {
157 for (i = 0, wl_vlc_offs = 0, ct_vlc_offs = 2508; i < 4; i++) {
179 for (i = 0, sf_vlc_offs = 76; i < 8; i++) {
194 for (i = 0; i < 112; i++) {
198 &tab_offset, &spec_vlc_tabs[i]);
200 spec_vlc_tabs[i].
table = 0;
204 for (i = 0; i < 11; i++)
208 for (i = 0; i < 7; i++)
231 "Invalid number of transmitted units!\n");
256 const int8_t *weights_tab =
263 "WL index out of range: pos=%d, val=%d!\n",
292 "SF index out of range: pos=%d, val=%d!\n",
310 int *dst,
int num_values)
315 dst[0] = dst[1] = dst[2] = start_val;
316 for (i = 3; i < num_values; i++)
321 #define UNPACK_SF_VQ_SHAPE(gb, dst, num_vals) \
322 start_val = get_bits((gb), 6); \
323 unpack_vq_shape(start_val, &atrac3p_sf_shapes[get_bits((gb), 6)][0], \
338 int i, weight_idx = 0,
delta,
diff, pos, delta_bits, min_val,
flag,
357 vlc_tab = &wl_vlc_tabs[
get_bits(gb, 2)];
373 "WL mode 1: invalid position!\n");
380 for (i = 0; i < pos; i++)
393 vlc_tab = &wl_vlc_tabs[
get_bits(gb, 2)];
404 vlc_tab = &wl_vlc_tabs[
get_bits(gb, 1)];
421 vlc_tab->
bits, 1)) & 7;
424 vlc_tab->
bits, 1)) & 7;
430 vlc_tab->
bits, 1)) & 7;
440 vlc_tab = &wl_vlc_tabs[
get_bits(gb, 2)];
481 int i, weight_idx = 0,
delta,
diff, num_long_vals,
482 delta_bits, min_val, vlc_sel, start_val;
494 vlc_tab = &sf_vlc_tabs[
get_bits(gb, 2)];
502 if (weight_idx == 3) {
509 for (i = 0; i < num_long_vals; i++)
523 "SF mode 1: invalid parameters!\n");
528 for (i = 0; i < num_long_vals; i++)
540 vlc_tab = &sf_vlc_tabs[
get_bits(gb, 2)];
551 vlc_tab = &sf_vlc_tabs[
get_bits(gb, 2) + 4];
570 vlc_tab = &sf_vlc_tabs[vlc_sel];
572 if (weight_idx == 3) {
573 vlc_tab = &sf_vlc_tabs[vlc_sel + 4];
577 diff = (
get_bits(gb, 4) + 56) & 0x3F;
598 if (weight_idx && weight_idx < 3)
618 for (ch_num = 0; ch_num < num_channels; ch_num++) {
654 for (ch_num = 0; ch_num < num_channels; ch_num++) {
682 "Invalid number of code table indexes: %d!\n", num_coded_vals);
685 return num_coded_vals;
690 #define DEC_CT_IDX_COMMON(OP) \
691 num_vals = get_num_ct_values(gb, ctx, avctx); \
695 for (i = 0; i < num_vals; i++) { \
696 if (chan->qu_wordlen[i]) { \
697 chan->qu_tab_idx[i] = OP; \
698 } else if (ch_num && ref_chan->qu_wordlen[i]) \
700 chan->qu_tab_idx[i] = get_bits1(gb); \
703 #define CODING_DIRECT get_bits(gb, num_bits)
705 #define CODING_VLC get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1)
707 #define CODING_VLC_DELTA \
709 : (pred + get_vlc2(gb, delta_vlc->table, \
710 delta_vlc->bits, 1)) & mask; \
711 pred = chan->qu_tab_idx[i]
713 #define CODING_VLC_DIFF \
714 (ref_chan->qu_tab_idx[i] + \
715 get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1)) & mask
729 int i, num_vals, num_bits,
pred;
731 VLC *vlc_tab, *delta_vlc;
749 vlc_tab = &ct_vlc_tabs[1];
750 delta_vlc = &ct_vlc_tabs[2];
789 for (ch_num = 0; ch_num < num_channels; ch_num++) {
813 VLC *vlc_tab, int16_t *
out,
const int num_specs)
822 for (pos = 0; pos < num_specs;) {
824 for (j = 0; j < group_size; j++) {
827 for (i = 0; i < num_coeffs; i++) {
828 cf = av_mod_uintp2(val, bits);
839 pos += group_size * num_coeffs;
854 int i, ch_num,
qu, wordlen, codetab, tab_index, num_specs;
858 for (ch_num = 0; ch_num < num_channels; ch_num++) {
876 tab_index = (chan->
table_type * 8 + codetab) * 7 + wordlen - 1;
884 &chan->
spectrum[ff_atrac3p_qu_to_spec_pos[qu]],
888 memcpy(&chan->
spectrum[ff_atrac3p_qu_to_spec_pos[qu]],
891 sizeof(chan->
spectrum[ff_atrac3p_qu_to_spec_pos[qu]]));
902 for (i = 0; i < num_specs; i++)
925 memset(out, 0, num_flags);
930 for (i = 0; i < num_flags; i++)
933 memset(out, 1, num_flags);
951 for (ch_num = 0; ch_num < num_channels; ch_num++)
966 int ch_num,
int coded_subbands)
968 int i,
delta, delta_bits, min_val;
974 for (i = 0; i < coded_subbands; i++)
978 for (i = 0; i < coded_subbands; i++)
981 gain_vlc_tabs[0].
bits, 1);
985 for (i = 0; i < coded_subbands; i++) {
986 delta =
get_vlc2(gb, gain_vlc_tabs[1].table,
987 gain_vlc_tabs[1].bits, 1);
993 get_vlc2(gb, gain_vlc_tabs[0].table,
994 gain_vlc_tabs[0].bits, 1);
996 for (i = 1; i < coded_subbands; i++) {
997 delta =
get_vlc2(gb, gain_vlc_tabs[1].table,
998 gain_vlc_tabs[1].bits, 1);
1006 for (i = 0; i < coded_subbands; i++)
1013 for (i = 0; i < coded_subbands; i++) {
1053 gain_vlc_tabs[2].
bits, 1);
1056 delta =
get_vlc2(gb, gain_vlc_tabs[3].table,
1057 gain_vlc_tabs[3].bits, 1);
1072 int ch_num,
int coded_subbands)
1074 int sb, i,
delta, delta_bits, min_val,
pred;
1080 for (sb = 0; sb < coded_subbands; sb++)
1086 for (sb = 0; sb < coded_subbands; sb++)
1089 gain_vlc_tabs[5].
bits, 1);
1095 for (sb = 0; sb < coded_subbands; sb++)
1101 for (sb = 0; sb < coded_subbands; sb++)
1113 for (sb = 1; sb < coded_subbands; sb++)
1116 gain_vlc_tabs[4].
bits, 1);
1125 for (sb = 0; sb < coded_subbands; sb++)
1132 for (sb = 0; sb < coded_subbands; sb++)
1158 if (!pos || dst->
loc_code[pos - 1] < 15)
1160 else if (dst->
loc_code[pos - 1] >= 30)
1191 : &gain_vlc_tabs[9];
1209 int ch_num,
int coded_subbands,
1212 int sb, i,
delta, delta_bits, min_val,
pred, more_than_ref;
1220 for (sb = 0; sb < coded_subbands; sb++)
1226 for (sb = 0; sb < coded_subbands; sb++) {
1234 gain_vlc_tabs[10].
bits, 1);
1242 if (more_than_ref) {
1244 get_vlc2(gb, gain_vlc_tabs[9].table,
1245 gain_vlc_tabs[9].bits, 1);
1254 tab = more_than_ref ? &gain_vlc_tabs[7]
1255 : &gain_vlc_tabs[10];
1265 for (sb = 0; sb < coded_subbands; sb++)
1270 for (sb = 0; sb < coded_subbands; sb++) {
1286 for (sb = 1; sb < coded_subbands; sb++) {
1294 gain_vlc_tabs[6].
bits, 1);
1304 2 + more_than_ref + 6];
1316 for (sb = 0; sb < coded_subbands; sb++)
1328 for (sb = 0; sb < coded_subbands; sb++)
1337 for (sb = 0; sb < coded_subbands; sb++) {
1343 "Invalid gain location: ch=%d, sb=%d, pos=%d, val=%d\n",
1365 int ch_num, coded_subbands, sb, ret;
1367 for (ch_num = 0; ch_num < num_channels; ch_num++) {
1372 coded_subbands =
get_bits(gb, 4) + 1;
1383 if (coded_subbands > 0) {
1406 int ch_num,
int band_has_tones[])
1414 if (!band_has_tones[sb])
1425 if (!band_has_tones[sb])
1447 int ch_num,
int band_has_tones[],
1458 if (band_has_tones[sb])
1463 if (band_has_tones[sb])
1466 tone_vlc_tabs[1].
bits, 1);
1470 if (band_has_tones[sb]) {
1471 delta =
get_vlc2(gb, tone_vlc_tabs[2].table,
1472 tone_vlc_tabs[2].bits, 1);
1479 if (band_has_tones[sb])
1486 if (band_has_tones[sb]) {
1489 "Too many tones: %d (max. 48), frame: %d!\n",
1511 int ch_num,
int band_has_tones[])
1513 int sb, i, direction, nbits,
pred,
delta;
1520 if (!band_has_tones[sb] || !dst[sb].num_wavs)
1525 if (dst[sb].num_wavs)
1527 for (i = dst[sb].num_wavs - 2; i >= 0 ; i--) {
1528 nbits =
av_log2(iwav[i+1].freq_index) + 1;
1532 for (i = 0; i < dst[sb].
num_wavs; i++) {
1533 if (!i || iwav[i - 1].freq_index < 512)
1536 nbits =
av_log2(1023 - iwav[i - 1].freq_index) + 1;
1538 1024 - (1 << nbits);
1545 if (!band_has_tones[sb] || !dst[sb].num_wavs)
1549 for (i = 0; i < dst[sb].
num_wavs; i++) {
1551 tone_vlc_tabs[6].
bits, 1);
1553 pred = (i < ref[sb].
num_wavs) ? iwav[i].freq_index :
1554 (ref[sb].num_wavs ? iwav[ref[sb].num_wavs - 1].freq_index : 0);
1571 int ch_num,
int band_has_tones[])
1575 int refwaves[48] = { 0 };
1581 if (!band_has_tones[sb] || !dst[sb].num_wavs)
1585 for (j = 0; j < dst[sb].
num_wavs; j++) {
1586 for (i = 0, fi = 0, maxdiff = 1024; i < ref[sb].
num_wavs; i++) {
1587 diff =
FFABS(wsrc[j].freq_index - wref[i].freq_index);
1588 if (diff < maxdiff) {
1596 else if (j < ref[sb].num_wavs)
1597 refwaves[dst[sb].start_index + j] = j + ref[sb].
start_index;
1599 refwaves[dst[sb].start_index + j] = -1;
1609 if (!band_has_tones[sb] || !dst[sb].num_wavs)
1612 for (i = 0; i < dst[sb].
num_wavs; i++)
1620 if (!band_has_tones[sb] || !dst[sb].num_wavs)
1623 for (i = 0; i < dst[sb].
num_wavs; i++)
1626 tone_vlc_tabs[3].
bits, 1) + 20;
1629 get_vlc2(gb, tone_vlc_tabs[4].table,
1630 tone_vlc_tabs[4].bits, 1) + 24;
1635 if (!band_has_tones[sb] || !dst[sb].num_wavs)
1637 for (i = 0; i < dst[sb].
num_wavs; i++) {
1639 tone_vlc_tabs[5].
bits, 1);
1649 if (!band_has_tones[sb])
1651 for (i = 0; i < dst[sb].
num_wavs; i++)
1671 int ch_num,
int band_has_tones[])
1678 if (!band_has_tones[sb])
1681 for (i = 0; i < dst[sb].
num_wavs; i++)
1682 wparam[i].phase_index =
get_bits(gb, 5);
1699 int band_has_tones[16];
1701 for (ch_num = 0; ch_num < num_channels; ch_num++)
1719 tone_vlc_tabs[0].
bits, 1) + 1;
1721 if (num_channels == 2) {
1729 for (ch_num = 0; ch_num < num_channels; ch_num++) {
1743 if (num_channels == 2) {
1766 "Invalid number of quantization units: %d!\n",
1790 if (num_channels == 2) {
static void unpack_vq_shape(int start_val, const int8_t *shape_vec, int *dst, int num_values)
Unpack vector quantization tables.
static av_cold void build_canonical_huff(const uint8_t *cb, const uint8_t *xlat, int *tab_offset, VLC *out_vlc)
Generate canonical VLC table from given descriptor.
static int get_num_ct_values(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, AVCodecContext *avctx)
Decode number of code table values.
static const uint8_t atrac3p_ct_huff_bits2[8]
const char const char void * val
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static void decode_tones_phase(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int band_has_tones[])
Decode phase information for each subband of a channel.
uint8_t bits
number of bits a single coefficient occupy
Atrac3pWaveParam waves[48]
static const uint8_t atrac3p_huff_gain_loc2_xlat[31]
static const uint8_t atrac3p_huff_freq_cb[13]
const uint16_t ff_atrac3p_qu_to_spec_pos[33]
Map quant unit number to its position in the spectrum.
static int decode_gainc_loc_codes(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int coded_subbands, AVCodecContext *avctx)
Decode location code for each gain control point.
uint8_t is_signed
1 - values in that table are signed ones, otherwise - absolute ones
static const uint8_t atrac3p_huff_wav_ampsf2_cb[7]
static const uint8_t atrac3p_ct_huff_code2[8]
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static const Atrac3pSpecCodeTab atrac3p_spectra_tabs[112]
static const uint8_t atrac3p_sf_huff_bits2[64]
static int decode_code_table_indexes(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode code table indexes for each channel.
int num_tone_bands
number of PQF bands with tones
int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size, const void *symbols, int symbols_wrap, int symbols_size, int flags)
static const uint8_t atrac3p_ct_huff_bits3[8]
int num_coded_subbands
number of subbands with coded spectrum
int table_type
table type: 0 - tone?, 1- noise?
static const uint8_t atrac3p_huff_gain_loc2_cb[8]
int num_wavs
number of sine waves in the group
static const uint8_t atrac3p_huff_gain_loc1_xlat[31]
int used_quant_units
number of quant units with coded spectrum
static const uint8_t atrac3p_huff_gain_npoints2_xlat[8]
static const uint8_t atrac3p_huff_gain_lev4_cb[11]
int lev_code[7]
level at corresponding control point
uint8_t negate_coeffs[ATRAC3P_SUBBANDS]
1 - subband-wise IMDCT coefficients negation
static const uint8_t atrac3p_ct_huff_xlat1[8]
#define ATRAC3P_SUBBANDS
Global unit sizes.
static const uint8_t atrac3p_wl_huff_code4[8]
static const uint16_t atrac3p_sf_huff_code2[64]
static VLC_TYPE tables_data[154276][2]
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static const uint8_t atrac3p_sf_huff_xlat2[64]
static double cb(void *priv, double x, double y)
static const uint8_t atrac3p_huff_gain_loc4_xlat[32]
static const uint8_t atrac3p_wl_huff_xlat2[5]
static const uint8_t atrac3p_huff_wav_ampsf2_xlat[32]
static const uint8_t atrac3p_huff_gain_loc4_cb[5]
static void gainc_level_mode3s(AtracGainInfo *dst, AtracGainInfo *ref)
Implements coding mode 3 (slave) for gain compensation levels.
int16_t spectrum[2048]
decoded IMDCT spectrum
static const uint8_t atrac3p_wl_huff_bits1[3]
static const uint8_t atrac3p_huff_gain_lev1_cb[9]
int stop_pos
stop position expressed in n*4 samples
static void decode_window_shape(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels)
Decode mdct window shape flags for all channels.
static const uint8_t atrac3p_wl_huff_bits3[8]
static int decode_gainc_levels(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int coded_subbands)
Decode level code for each gain control point.
int ff_atrac3p_decode_channel_unit(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode bitstream data of a channel unit.
uint8_t num_coeffs
1 - map index to a single value, > 1 - map index to a vector of values
Parameters of a single sine wave.
Atrac3pWaveEnvelope pend_env
pending envelope from the previous frame
static const int atrac3p_subband_to_num_powgrps[16]
Map subband number to number of power compensation groups.
int qu_sf_idx[32]
array of scale factor indexes for each quant unit
bitstream reader API header.
static void decode_spectrum(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode huffman-coded IMDCT spectrum for all channels.
int tones_index
total sum of tones in this unit
static const uint8_t atrac3p_huff_gain_lev3_cb[11]
int loc_code[7]
location of gain control points
static const uint8_t atrac3p_sf_huff_bits6[16]
uint8_t invert_phase[ATRAC3P_SUBBANDS]
1 - subband-wise phase inversion
static const uint16_t atrac3p_sf_huff_code1[64]
VLC tables for scale factor indexes.
uint8_t * wnd_shape
IMDCT window shape for current frame.
int noise_level_index
global noise level index
static const uint8_t atrac3p_qu_to_subband[32]
Map quant unit number to subband number.
static const uint8_t atrac3p_huff_freq_xlat[256]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint16_t mask[17]
static const int8_t atrac3p_sf_weights[2][32]
static void decode_tones_envelope(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int band_has_tones[])
Decode envelope for all tones of a channel.
static const uint8_t atrac3p_ct_huff_code1[4]
VLC tables for code table indexes.
static const uint8_t atrac3p_huff_gain_loc1_cb[9]
static const uint16_t atrac3p_sf_huff_code4[16]
static const struct endianess table[]
static const uint8_t atrac3p_huff_wav_ampsf3_cb[9]
Tables for spectrum coding.
Parameters of a group of sine waves.
static const uint8_t atrac3p_huff_gain_loc3_cb[7]
int noise_table_index
global noise RNG table index
static VLC wl_vlc_tabs[4]
simple assert() macros that are a bit more flexible than ISO C assert().
static VLC tone_vlc_tabs[7]
int qu_wordlen[32]
array of word lengths for each quant unit
static void gainc_level_mode1m(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, AtracGainInfo *dst)
Implements coding mode 1 (master) for gain compensation levels.
int amplitude_mode
1 - low range, 0 - high range
static const uint8_t atrac3p_sf_huff_xlat1[64]
#define ATRAC3P_POWER_COMP_OFF
Global constants.
static int decode_band_numwavs(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int band_has_tones[], AVCodecContext *avctx)
Decode number of tones for each subband of a channel.
static int get_subband_flags(GetBitContext *gb, uint8_t *out, int num_flags)
Retrieve specified amount of flag bits from the input bitstream.
static const uint8_t atrac3p_huff_gain_npoints1_cb[9]
static int decode_quant_wordlen(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode word length information for each channel.
uint8_t group_size
number of coefficients grouped together
static const uint8_t atrac3p_sf_huff_xlat5[16]
static void decode_qu_spectra(GetBitContext *gb, const Atrac3pSpecCodeTab *tab, VLC *vlc_tab, int16_t *out, const int num_specs)
Decode huffman-coded spectral lines for a given quant unit.
static const uint8_t atrac3p_qu_num_to_seg[32]
Ungroup table for word length segments.
static const uint8_t atrac3p_huff_gain_lev3_xlat[16]
static VLC ct_vlc_tabs[4]
static const uint8_t atrac3p_wl_huff_xlat1[3]
Atrac3pWavesData * tones_info
#define DEC_CT_IDX_COMMON(OP)
int use_full_table
1 - full table list, 0 - restricted one
static const uint8_t atrac3p_wl_huff_code1[3]
VLC tables for wordlen.
static const uint8_t atrac3p_ct_restricted_to_full[2][7][4]
static const uint8_t atrac3p_huff_numwavs1_cb[9]
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
int num_gain_subbands
number of subbands with gain control data
uint8_t swap_channels[ATRAC3P_SUBBANDS]
1 - perform subband-wise channel swapping
uint8_t tone_sharing[ATRAC3P_SUBBANDS]
1 - subband-wise tone sharing flags
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
int num_coded_vals
number of transmitted quant unit values
static const uint8_t atrac3p_sf_huff_bits1[64]
static const uint8_t atrac3p_huff_gain_loc5_xlat[32]
static const uint8_t atrac3p_huff_wav_ampsf1_xlat[32]
av_cold void ff_atrac3p_init_vlcs(void)
Initialize VLC tables for bitstream parsing.
static const uint8_t atrac3p_huff_gain_lev2_xlat[15]
static VLC sf_vlc_tabs[8]
static int decode_gainc_data(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode gain control data for all channels.
static const float pred[4]
static const uint8_t atrac3p_huff_gain_loc5_cb[9]
static const uint8_t atrac3p_huff_gain_lev2_cb[11]
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static const uint8_t atrac3p_sf_huff_bits5[16]
int start_index
start index into global tones table for that subband
int freq_index
wave frequency index
Gain control parameters for one subband.
Libavcodec external API header.
static void gainc_loc_mode1(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, AtracGainInfo *dst)
Implements coding mode 1 for gain compensation locations.
static const uint8_t atrac3p_huff_wav_ampsf3_xlat[32]
main external API structure.
static const uint8_t atrac3p_sf_huff_xlat4[16]
static const int8_t atrac3p_wl_weights[6][32]
static const uint8_t atrac3p_ct_huff_code3[8]
int amp_sf
quantized amplitude scale factor
Sound channel parameters.
static unsigned int get_bits1(GetBitContext *s)
static const uint16_t atrac3p_sf_huff_code6[16]
static const uint8_t atrac3p_huff_gain_lev4_xlat[16]
#define UNPACK_SF_VQ_SHAPE(gb, dst, num_vals)
static int decode_channel_code_tab(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, AVCodecContext *avctx)
Decode code table indexes for each quant unit of a channel.
static int subtract_sf_weights(Atrac3pChanUnitCtx *ctx, Atrac3pChanParams *chan, int wtab_idx, AVCodecContext *avctx)
Subtract weighting coefficients from decoded scalefactors.
static av_const int sign_extend(int val, unsigned bits)
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static int decode_channel_wordlen(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, AVCodecContext *avctx)
Decode word length for each quantization unit of a channel.
static int decode_channel_sf_idx(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, AVCodecContext *avctx)
Decode scale factor indexes for each quant unit of a channel.
int num_points
number of gain control points
static int num_coded_units(GetBitContext *gb, Atrac3pChanParams *chan, Atrac3pChanUnitCtx *ctx, AVCodecContext *avctx)
Decode number of coded quantization units.
static const uint8_t atrac3p_huff_tonebands_cb[8]
static const uint8_t atrac3p_huff_numwavs2_cb[8]
int redirect
if >= 0: tells which huffman table must be reused
int has_start_point
indicates start point within the GHA window
static const uint8_t atrac3p_huff_gain_loc3_xlat[32]
static int ref[MAX_W *MAX_W]
AtracGainInfo * gain_data
gain control data for next frame
static void decode_tones_frequency(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int band_has_tones[])
Decode frequency information for each subband of a channel.
int has_stop_point
indicates stop point within the GHA window
#define INIT_VLC_USE_NEW_STATIC
static VLC spec_vlc_tabs[112]
Atrac3pWaveSynthParams * waves_info
int qu_tab_idx[32]
array of code table indexes for each quant unit
int noise_present
1 - global noise info present
static const uint8_t atrac3p_wl_huff_bits2[5]
static av_always_inline int diff(const uint32_t a, const uint32_t b)
static const uint8_t atrac3p_huff_numwavs2_xlat[8]
static const int8_t atrac3p_wl_shapes[8][16][9]
3D base shape tables.
VLC_TYPE(* table)[2]
code, bits
Atrac3pChanParams channels[2]
static int decode_scale_factors(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode scale factor indexes for each channel.
static const uint8_t atrac3p_sf_huff_bits4[16]
static const uint8_t atrac3p_sf_huff_bits3[64]
int start_pos
start position expressed in n*4 samples
static const struct twinvq_data tab
static const uint8_t atrac3p_huff_wav_ampsf1_cb[7]
static const uint16_t atrac3p_sf_huff_code5[16]
static int decode_tones_info(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode tones info for all channels.
int frame_number
Frame counter, set by libavcodec.
static const uint8_t atrac3p_ct_huff_bits1[4]
static const uint8_t atrac3p_huff_gain_lev1_xlat[16]
static void gainc_loc_mode0(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, AtracGainInfo *dst, int pos)
Implements coding mode 0 for gain compensation locations.
#define FFSWAP(type, a, b)
static const uint8_t atrac3p_wl_huff_code2[5]
int tones_present
1 - tones info present
static int decode_gainc_npoints(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int coded_subbands)
Decode number of gain control points.
uint8_t tone_master[ATRAC3P_SUBBANDS]
1 - subband-wise tone channel swapping
static const uint8_t atrac3p_wl_huff_code3[8]
mode
Use these values in ebur128_init (or'ed).
Global structures, constants and data for ATRAC3+ decoder.
static VLC gain_vlc_tabs[11]
static int add_wordlen_weights(Atrac3pChanUnitCtx *ctx, Atrac3pChanParams *chan, int wtab_idx, AVCodecContext *avctx)
Add weighting coefficients to the decoded word-length information.
static av_always_inline int get_bitsz(GetBitContext *s, int n)
Read 0-25 bits.
static void decode_tones_amplitude(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int band_has_tones[])
Decode amplitude information for each subband of a channel.
static const uint16_t atrac3p_sf_huff_code3[64]
uint8_t power_levs[5]
power compensation levels
static const uint8_t atrac3p_wl_huff_bits4[8]