Go to the documentation of this file.
51 int *tab_offset,
VLC *out_vlc)
61 for (
b = min_len;
b <= max_len;
b++) {
62 for (
i = *
cb++;
i > 0;
i--) {
77 *tab_offset += 1 << max_len;
82 int i, wl_vlc_offs, ct_vlc_offs, sf_vlc_offs, tab_offset;
84 static const uint8_t wl_nb_bits[4] = { 2, 3, 5, 5 };
85 static const uint8_t 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 uint8_t ct_nb_bits[4] = { 3, 4, 4, 4 };
99 static const uint8_t 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 uint8_t sf_nb_bits[8] = { 9, 9, 9, 9, 6, 6, 7, 7 };
113 static const uint8_t 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++) {
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 =
259 for (
i = 0;
i <
ctx->num_quant_units;
i++) {
263 "WL index out of range: pos=%d, val=%d!\n",
288 for (
i = 0;
i <
ctx->used_quant_units;
i++) {
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], \
348 for (
i = 0;
i <
ctx->num_quant_units;
i++)
373 "WL mode 1: invalid position!\n");
421 vlc_tab->
bits, 1)) & 7;
424 vlc_tab->
bits, 1)) & 7;
430 vlc_tab->
bits, 1)) & 7;
485 int i, weight_idx = 0,
delta,
diff, num_long_vals,
486 delta_bits, min_val, vlc_sel, start_val;
493 for (
i = 0;
i <
ctx->used_quant_units;
i++)
500 for (
i = 0;
i <
ctx->used_quant_units;
i++) {
506 if (weight_idx == 3) {
513 for (
i = 0;
i < num_long_vals;
i++)
518 for (
i = num_long_vals;
i <
ctx->used_quant_units;
i++)
525 if (num_long_vals >
ctx->used_quant_units || delta_bits == 7) {
527 "SF mode 1: invalid parameters!\n");
532 for (
i = 0;
i < num_long_vals;
i++)
536 for (
i = num_long_vals;
i <
ctx->used_quant_units;
i++)
549 for (
i = 1;
i <
ctx->used_quant_units;
i++) {
559 for (
i = 0;
i <
ctx->used_quant_units;
i++) {
569 for (
i = 0;
i <
ctx->used_quant_units;
i++)
576 if (weight_idx == 3) {
584 for (
i = 1;
i <
ctx->used_quant_units;
i++) {
593 for (
i = 1;
i <
ctx->used_quant_units;
i++) {
602 if (weight_idx && weight_idx < 3)
622 for (ch_num = 0; ch_num < num_channels; ch_num++) {
623 memset(
ctx->channels[ch_num].qu_wordlen, 0,
624 sizeof(
ctx->channels[ch_num].qu_wordlen));
632 for (
i =
ctx->num_quant_units - 1;
i >= 0;
i--)
633 if (
ctx->channels[0].qu_wordlen[
i] ||
634 (num_channels == 2 &&
ctx->channels[1].qu_wordlen[
i]))
636 ctx->used_quant_units =
i + 1;
655 if (!
ctx->used_quant_units)
658 for (ch_num = 0; ch_num < num_channels; ch_num++) {
659 memset(
ctx->channels[ch_num].qu_sf_idx, 0,
660 sizeof(
ctx->channels[ch_num].qu_sf_idx));
684 if (num_coded_vals >
ctx->used_quant_units) {
686 "Invalid number of code table indexes: %d!\n", num_coded_vals);
689 return num_coded_vals;
691 return ctx->used_quant_units;
694 #define DEC_CT_IDX_COMMON(OP) \
695 num_vals = get_num_ct_values(gb, ctx, avctx); \
699 for (i = 0; i < num_vals; i++) { \
700 if (chan->qu_wordlen[i]) { \
701 chan->qu_tab_idx[i] = OP; \
702 } else if (ch_num && ref_chan->qu_wordlen[i]) \
704 chan->qu_tab_idx[i] = get_bits1(gb); \
707 #define CODING_DIRECT get_bits(gb, num_bits)
709 #define CODING_VLC get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1)
711 #define CODING_VLC_DELTA \
713 : (pred + get_vlc2(gb, delta_vlc->table, \
714 delta_vlc->bits, 1)) & mask; \
715 pred = chan->qu_tab_idx[i]
717 #define CODING_VLC_DIFF \
718 (ref_chan->qu_tab_idx[i] + \
719 get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1)) & mask
733 int i, num_vals, num_bits,
pred;
734 int mask =
ctx->use_full_table ? 7 : 3;
735 VLC *vlc_tab, *delta_vlc;
743 num_bits =
ctx->use_full_table + 2;
752 if (
ctx->use_full_table) {
788 if (!
ctx->used_quant_units)
793 for (ch_num = 0; ch_num < num_channels; ch_num++) {
794 memset(
ctx->channels[ch_num].qu_tab_idx, 0,
795 sizeof(
ctx->channels[ch_num].qu_tab_idx));
817 VLC *vlc_tab, int16_t *
out,
const int num_specs)
820 int group_size =
tab->group_size;
821 int num_coeffs =
tab->num_coeffs;
823 int is_signed =
tab->is_signed;
826 for (
pos = 0;
pos < num_specs;) {
828 for (j = 0; j < group_size; j++) {
831 for (
i = 0;
i < num_coeffs;
i++) {
843 pos += group_size * num_coeffs;
858 int i, ch_num,
qu, wordlen, codetab, tab_index, num_specs;
862 for (ch_num = 0; ch_num < num_channels; ch_num++) {
863 chan = &
ctx->channels[ch_num];
870 for (
qu = 0;
qu <
ctx->used_quant_units;
qu++) {
877 if (!
ctx->use_full_table)
880 tab_index = (chan->
table_type * 8 + codetab) * 7 + wordlen - 1;
884 if (
tab->redirect >= 0)
885 tab_index =
tab->redirect;
890 }
else if (ch_num &&
ctx->channels[0].qu_wordlen[
qu] && !codetab) {
904 if (
ctx->used_quant_units > 2) {
906 for (
i = 0;
i < num_specs;
i++)
929 memset(
out, 0, num_flags);
934 for (
i = 0;
i < num_flags;
i++)
937 memset(
out, 1, num_flags);
955 for (ch_num = 0; ch_num < num_channels; ch_num++)
970 int ch_num,
int coded_subbands)
972 int i,
delta, delta_bits, min_val;
978 for (
i = 0;
i < coded_subbands;
i++)
982 for (
i = 0;
i < coded_subbands;
i++)
989 for (
i = 0;
i < coded_subbands;
i++) {
1000 for (
i = 1;
i < coded_subbands;
i++) {
1010 for (
i = 0;
i < coded_subbands;
i++)
1017 for (
i = 0;
i < coded_subbands;
i++) {
1076 int ch_num,
int coded_subbands)
1084 for (sb = 0; sb < coded_subbands; sb++)
1090 for (sb = 0; sb < coded_subbands; sb++)
1099 for (sb = 0; sb < coded_subbands; sb++)
1105 for (sb = 0; sb < coded_subbands; sb++)
1117 for (sb = 1; sb < coded_subbands; sb++)
1129 for (sb = 0; sb < coded_subbands; sb++)
1136 for (sb = 0; sb < coded_subbands; sb++)
1213 int ch_num,
int coded_subbands,
1216 int sb,
i,
delta, delta_bits, min_val,
pred, more_than_ref;
1224 for (sb = 0; sb < coded_subbands; sb++)
1230 for (sb = 0; sb < coded_subbands; sb++) {
1239 pred =
ref->num_points > 0 ?
ref->loc_code[0] : 0;
1243 more_than_ref =
i >=
ref->num_points;
1246 if (more_than_ref) {
1269 for (sb = 0; sb < coded_subbands; sb++)
1274 for (sb = 0; sb < coded_subbands; sb++) {
1290 for (sb = 1; sb < coded_subbands; sb++) {
1308 2 + more_than_ref + 6];
1320 for (sb = 0; sb < coded_subbands; sb++)
1332 for (sb = 0; sb < coded_subbands; sb++)
1341 for (sb = 0; sb < coded_subbands; sb++) {
1347 "Invalid gain location: ch=%d, sb=%d, pos=%d, val=%d\n",
1369 int ch_num, coded_subbands, sb,
ret;
1371 for (ch_num = 0; ch_num < num_channels; ch_num++) {
1372 memset(
ctx->channels[ch_num].gain_data, 0,
1376 coded_subbands =
get_bits(gb, 4) + 1;
1378 ctx->channels[ch_num].num_gain_subbands =
get_bits(gb, 4) + 1;
1380 ctx->channels[ch_num].num_gain_subbands = coded_subbands;
1387 if (coded_subbands > 0) {
1388 for (sb = coded_subbands; sb <
ctx->channels[ch_num].num_gain_subbands; sb++)
1389 ctx->channels[ch_num].gain_data[sb] =
1390 ctx->channels[ch_num].gain_data[sb - 1];
1393 ctx->channels[ch_num].num_gain_subbands = 0;
1410 int ch_num,
int band_has_tones[])
1417 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++) {
1418 if (!band_has_tones[sb])
1428 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++) {
1429 if (!band_has_tones[sb])
1451 int ch_num,
int band_has_tones[],
1461 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++)
1462 if (band_has_tones[sb])
1466 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++)
1467 if (band_has_tones[sb])
1473 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++)
1474 if (band_has_tones[sb]) {
1482 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++)
1483 if (band_has_tones[sb])
1489 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++)
1490 if (band_has_tones[sb]) {
1491 if (
ctx->waves_info->tones_index + dst[sb].
num_wavs > 48) {
1493 "Too many tones: %d (max. 48), frame: %d!\n",
1515 int ch_num,
int band_has_tones[])
1523 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++) {
1524 if (!band_has_tones[sb] || !dst[sb].num_wavs)
1529 if (dst[sb].num_wavs)
1531 for (
i = dst[sb].num_wavs - 2;
i >= 0 ;
i--) {
1532 nbits =
av_log2(iwav[
i+1].freq_index) + 1;
1537 if (!
i || iwav[
i - 1].freq_index < 512)
1540 nbits =
av_log2(1023 - iwav[
i - 1].freq_index) + 1;
1542 1024 - (1 << nbits);
1548 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++) {
1549 if (!band_has_tones[sb] || !dst[sb].num_wavs)
1551 iwav = &
ctx->waves_info->waves[
ref[sb].start_index];
1557 pred = (
i <
ref[sb].num_wavs) ? iwav[
i].freq_index :
1558 (
ref[sb].num_wavs ? iwav[
ref[sb].num_wavs - 1].freq_index : 0);
1575 int ch_num,
int band_has_tones[])
1579 int refwaves[48] = { 0 };
1584 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++) {
1585 if (!band_has_tones[sb] || !dst[sb].num_wavs)
1588 wref = &
ctx->waves_info->waves[
ref[sb].start_index];
1589 for (j = 0; j < dst[sb].
num_wavs; j++) {
1590 for (
i = 0, fi = 0, maxdiff = 1024;
i <
ref[sb].num_wavs;
i++) {
1591 diff =
FFABS(wsrc[j].freq_index - wref[
i].freq_index);
1592 if (
diff < maxdiff) {
1600 else if (j <
ref[sb].num_wavs)
1601 refwaves[dst[sb].start_index + j] = j +
ref[sb].start_index;
1603 refwaves[dst[sb].start_index + j] = -1;
1612 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++) {
1613 if (!band_has_tones[sb] || !dst[sb].num_wavs)
1615 if (
ctx->waves_info->amplitude_mode)
1623 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++) {
1624 if (!band_has_tones[sb] || !dst[sb].num_wavs)
1626 if (
ctx->waves_info->amplitude_mode)
1638 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++) {
1639 if (!band_has_tones[sb] || !dst[sb].num_wavs)
1646 ctx->waves_info->waves[refwaves[dst[sb].start_index +
i]].amp_sf : 34;
1647 ctx->waves_info->waves[dst[sb].start_index +
i].amp_sf = (
pred +
delta) & 0x3F;
1652 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++) {
1653 if (!band_has_tones[sb])
1675 int ch_num,
int band_has_tones[])
1681 for (sb = 0; sb <
ctx->waves_info->num_tone_bands; sb++) {
1682 if (!band_has_tones[sb])
1686 wparam[
i].phase_index =
get_bits(gb, 5);
1703 int band_has_tones[16];
1705 for (ch_num = 0; ch_num < num_channels; ch_num++)
1706 memset(
ctx->channels[ch_num].tones_info, 0,
1710 if (!
ctx->waves_info->tones_present)
1713 memset(
ctx->waves_info->waves, 0,
sizeof(
ctx->waves_info->waves));
1716 if (!
ctx->waves_info->amplitude_mode) {
1721 ctx->waves_info->num_tone_bands =
1725 if (num_channels == 2) {
1731 ctx->waves_info->tones_index = 0;
1733 for (ch_num = 0; ch_num < num_channels; ch_num++) {
1734 for (
i = 0;
i <
ctx->waves_info->num_tone_bands;
i++)
1735 band_has_tones[
i] = !ch_num ? 1 : !
ctx->waves_info->tone_sharing[
i];
1747 if (num_channels == 2) {
1748 for (
i = 0;
i <
ctx->waves_info->num_tone_bands;
i++) {
1749 if (
ctx->waves_info->tone_sharing[
i])
1750 ctx->channels[1].tones_info[
i] =
ctx->channels[0].tones_info[
i];
1752 if (
ctx->waves_info->tone_master[
i])
1754 ctx->channels[1].tones_info[
i]);
1768 if (
ctx->num_quant_units > 28 &&
ctx->num_quant_units < 32) {
1770 "Invalid number of quantization units: %d!\n",
1771 ctx->num_quant_units);
1782 ctx->num_coded_subbands =
ctx->used_quant_units
1794 if (num_channels == 2) {
1809 if (
ctx->noise_present) {
static const Atrac3pSpecCodeTab atrac3p_spectra_tabs[112]
static const uint8_t atrac3p_wl_huff_bits1[3]
static int get_num_ct_values(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, AVCodecContext *avctx)
Decode number of code table values.
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_freq_cb[13]
static const uint8_t atrac3p_huff_wav_ampsf1_cb[7]
static VLC wl_vlc_tabs[4]
static const uint8_t atrac3p_sf_huff_bits2[64]
static const uint8_t atrac3p_huff_freq_xlat[256]
int has_stop_point
indicates stop point within the GHA window
#define FFSWAP(type, a, b)
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 double cb(void *priv, double x, double y)
static const uint8_t atrac3p_ct_huff_bits2[8]
int qu_tab_idx[32]
array of code table indexes for each quant unit
static const uint8_t atrac3p_huff_wav_ampsf3_xlat[32]
int num_wavs
number of sine waves in the group
static const uint8_t atrac3p_qu_num_to_seg[32]
Ungroup table for word length segments.
static int decode_quant_wordlen(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode word length information for each channel.
static int decode_tones_info(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode tones info for all channels.
static const uint8_t atrac3p_huff_gain_lev2_cb[11]
static const uint16_t table[]
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
static const uint16_t atrac3p_sf_huff_code3[64]
static VLC ct_vlc_tabs[4]
static const uint8_t atrac3p_huff_gain_npoints1_cb[9]
static int decode_gainc_data(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode gain control data for all channels.
static const uint16_t atrac3p_sf_huff_code6[16]
#define DEC_CT_IDX_COMMON(OP)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static const uint8_t atrac3p_huff_gain_lev1_cb[9]
static const uint8_t atrac3p_ct_huff_code1[4]
VLC tables for code table indexes.
static const uint8_t atrac3p_wl_huff_code1[3]
VLC tables for wordlen.
static const uint8_t atrac3p_wl_huff_bits4[8]
static int subtract_sf_weights(Atrac3pChanUnitCtx *ctx, Atrac3pChanParams *chan, int wtab_idx, AVCodecContext *avctx)
Subtract weighting coefficients from decoded scalefactors.
static const struct twinvq_data tab
static double val(void *priv, double ch)
static const uint8_t atrac3p_sf_huff_bits5[16]
static const uint8_t atrac3p_wl_huff_bits3[8]
static const uint8_t atrac3p_sf_huff_bits4[16]
static const uint8_t atrac3p_wl_huff_bits2[5]
static const uint8_t atrac3p_huff_numwavs2_xlat[8]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static const uint8_t atrac3p_ct_huff_bits1[4]
static int num_coded_units(GetBitContext *gb, Atrac3pChanParams *chan, Atrac3pChanUnitCtx *ctx, AVCodecContext *avctx)
Decode number of coded quantization units.
static const uint16_t mask[17]
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.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int num_points
number of gain control points
static const uint8_t atrac3p_huff_gain_lev1_xlat[16]
static const uint8_t atrac3p_huff_numwavs2_cb[8]
const uint16_t ff_atrac3p_qu_to_spec_pos[33]
Map quant unit number to its position in the spectrum.
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.
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
static VLC sf_vlc_tabs[8]
and forward the result(frame or status change) to the corresponding input. If nothing is possible
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
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.
static const uint8_t atrac3p_huff_gain_loc5_cb[9]
static const uint8_t atrac3p_huff_gain_loc3_xlat[32]
static unsigned int get_bits1(GetBitContext *s)
Atrac3pWaveEnvelope pend_env
pending envelope from the previous frame
int16_t spectrum[2048]
decoded IMDCT spectrum
#define INIT_VLC_USE_NEW_STATIC
static const uint8_t atrac3p_sf_huff_bits3[64]
static const uint8_t atrac3p_sf_huff_xlat4[16]
static const uint8_t atrac3p_huff_gain_npoints2_xlat[8]
int num_coded_vals
number of transmitted quant unit values
static VLC spec_vlc_tabs[112]
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)
Gain control parameters for one subband.
static const uint8_t atrac3p_ct_huff_xlat1[8]
static const uint8_t atrac3p_huff_tonebands_cb[8]
int has_start_point
indicates start point within the GHA window
static const uint8_t atrac3p_huff_wav_ampsf2_xlat[32]
static const uint8_t atrac3p_ct_huff_bits3[8]
static void gainc_loc_mode1(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, AtracGainInfo *dst)
Implements coding mode 1 for gain compensation locations.
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_wl_huff_code3[8]
int start_index
start index into global tones table for that subband
static const uint8_t atrac3p_ct_huff_code2[8]
static const uint8_t atrac3p_wl_huff_xlat2[5]
av_cold void ff_atrac3p_init_vlcs(void)
Initialize VLC tables for bitstream parsing.
static int decode_gainc_levels(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int coded_subbands)
Decode level code for each gain control point.
#define UNPACK_SF_VQ_SHAPE(gb, dst, num_vals)
int loc_code[7]
location of gain control points
int qu_sf_idx[32]
array of scale factor indexes for each quant unit
static int decode_gainc_npoints(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int ch_num, int coded_subbands)
Decode number of gain control points.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static const uint8_t atrac3p_sf_huff_bits1[64]
static const int atrac3p_subband_to_num_powgrps[16]
Map subband number to number of power compensation groups.
static const uint16_t atrac3p_sf_huff_code5[16]
Sound channel parameters.
int ff_atrac3p_decode_channel_unit(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode bitstream data of a channel unit.
static const uint8_t atrac3p_huff_gain_loc1_xlat[31]
static void gainc_level_mode1m(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, AtracGainInfo *dst)
Implements coding mode 1 (master) for gain compensation levels.
static const uint8_t atrac3p_huff_gain_lev4_xlat[16]
static VLC_TYPE tables_data[154276][2]
static int add_wordlen_weights(Atrac3pChanUnitCtx *ctx, Atrac3pChanParams *chan, int wtab_idx, AVCodecContext *avctx)
Add weighting coefficients to the decoded word-length information.
static const uint8_t atrac3p_huff_gain_loc4_xlat[32]
static const uint8_t atrac3p_huff_gain_loc4_cb[5]
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.
static const uint16_t atrac3p_sf_huff_code2[64]
#define i(width, name, range_min, range_max)
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
static const uint8_t atrac3p_wl_huff_code2[5]
static const uint8_t atrac3p_sf_huff_xlat2[64]
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_bits6[16]
Parameters of a single sine wave.
static const int8_t atrac3p_wl_weights[6][32]
static const uint8_t atrac3p_huff_gain_loc5_xlat[32]
int stop_pos
stop position expressed in n*4 samples
static VLC tone_vlc_tabs[7]
static const int8_t atrac3p_wl_shapes[8][16][9]
3D base shape tables.
static const uint8_t atrac3p_huff_gain_loc3_cb[7]
static const float pred[4]
static const uint8_t atrac3p_huff_wav_ampsf2_cb[7]
static const uint8_t atrac3p_huff_wav_ampsf3_cb[9]
int lev_code[7]
level at corresponding control point
uint8_t power_levs[5]
power compensation levels
static const uint16_t atrac3p_sf_huff_code1[64]
VLC tables for scale factor indexes.
#define FF_ARRAY_ELEMS(a)
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.
int freq_index
wave frequency index
main external API structure.
Parameters of a group of sine waves.
Tables for spectrum coding.
static const uint8_t atrac3p_huff_gain_lev4_cb[11]
static const uint8_t atrac3p_huff_gain_lev2_xlat[15]
static av_const int sign_extend(int val, unsigned bits)
static int ref[MAX_W *MAX_W]
static VLC gain_vlc_tabs[11]
int table_type
table type: 0 - tone?, 1- noise?
static void gainc_level_mode3s(AtracGainInfo *dst, AtracGainInfo *ref)
Implements coding mode 3 (slave) for gain compensation levels.
static const uint8_t atrac3p_huff_gain_lev3_cb[11]
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 const uint8_t atrac3p_huff_gain_loc2_xlat[31]
static av_always_inline int get_bitsz(GetBitContext *s, int n)
Read 0-25 bits.
int frame_number
Frame counter, set by libavcodec.
static const uint8_t atrac3p_huff_numwavs1_cb[9]
static av_always_inline int diff(const uint32_t a, const uint32_t b)
static const uint8_t atrac3p_huff_gain_loc1_cb[9]
static const int8_t atrac3p_sf_weights[2][32]
#define ATRAC3P_SUBBANDS
Global unit sizes.
static const uint8_t atrac3p_sf_huff_xlat5[16]
static const uint8_t atrac3p_huff_wav_ampsf1_xlat[32]
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 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.
static const uint16_t atrac3p_sf_huff_code4[16]
static const uint8_t atrac3p_ct_restricted_to_full[2][7][4]
static void decode_spectrum(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode huffman-coded IMDCT spectrum for all channels.
static const uint8_t atrac3p_wl_huff_code4[8]
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int qu_wordlen[32]
array of word lengths for each quant unit
static int decode_code_table_indexes(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode code table indexes for each channel.
AtracGainInfo * gain_data
gain control data for next frame
static const uint8_t atrac3p_huff_gain_lev3_xlat[16]
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.
#define ATRAC3P_POWER_COMP_OFF
Global constants.
static void decode_window_shape(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels)
Decode mdct window shape flags for all channels.
int start_pos
start position expressed in n*4 samples
VLC_TYPE(* table)[2]
code, bits
static const uint8_t atrac3p_qu_to_subband[32]
Map quant unit number to subband number.
static const uint8_t atrac3p_huff_gain_loc2_cb[8]
static const uint8_t atrac3p_ct_huff_code3[8]
static const uint8_t atrac3p_sf_huff_xlat1[64]
static void gainc_loc_mode0(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, AtracGainInfo *dst, int pos)
Implements coding mode 0 for gain compensation locations.
static const uint8_t atrac3p_wl_huff_xlat1[3]
static void unpack_vq_shape(int start_val, const int8_t *shape_vec, int *dst, int num_values)
Unpack vector quantization tables.