28#ifndef AVCODEC_ATRAC3PLUS_H
29#define AVCODEC_ATRAC3PLUS_H
42#define ATRAC3P_SUBBANDS 16
43#define ATRAC3P_SUBBAND_SAMPLES 128
44#define ATRAC3P_FRAME_SAMPLES (ATRAC3P_SUBBAND_SAMPLES * ATRAC3P_SUBBANDS)
46#define ATRAC3P_PQF_FIR_LEN 12
49#define ATRAC3P_POWER_COMP_OFF 15
190 int ch_num,
int sb,
float *
out);
203 int ch_index,
float *sp,
int rng_index,
int sb_num);
217 av_tx_fn mdct_fn,
float *pIn,
float *pOut,
218 int wind_id,
int sb);
void ff_atrac3p_init_dsp_static(void)
Initialize sine waves synthesizer and ff_sine_* tables.
const uint16_t ff_atrac3p_qu_to_spec_pos[33]
Map quant unit number to its position in the spectrum.
#define ATRAC3P_FRAME_SAMPLES
#define ATRAC3P_PQF_FIR_LEN
length of the prototype FIR of the PQF
const float ff_atrac3p_mant_tab[8]
void ff_atrac3p_ipqf(AVTXContext *dct_ctx, av_tx_fn dct_fn, Atrac3pIPQFChannelCtx *hist, const float *in, float *out)
Subband synthesis filter based on the polyphase quadrature (pseudo-QMF) filter bank.
const float ff_atrac3p_sf_tab[64]
int ff_atrac3p_decode_channel_unit(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode bitstream data of a channel unit.
void ff_atrac3p_generate_tones(Atrac3pChanUnitCtx *ch_unit, AVFloatDSPContext *fdsp, int ch_num, int sb, float *out)
Synthesize sine waves for a particular subband.
#define ATRAC3P_SUBBANDS
Global unit sizes.
Atrac3pChannelUnitTypes
ATRAC3+ channel unit types.
@ CH_UNIT_TERMINATOR
unit sequence terminator
@ CH_UNIT_EXTENSION
unit containing extension information
@ CH_UNIT_STEREO
unit containing two jointly-coded channels
@ CH_UNIT_MONO
unit containing one coded channel
void ff_atrac3p_init_vlcs(void)
Initialize VLC tables for bitstream parsing.
void ff_atrac3p_power_compensation(Atrac3pChanUnitCtx *ctx, AVFloatDSPContext *fdsp, int ch_index, float *sp, int rng_index, int sb_num)
Perform power compensation aka noise dithering.
void ff_atrac3p_imdct(AVFloatDSPContext *fdsp, AVTXContext *mdct_ctx, av_tx_fn mdct_fn, float *pIn, float *pOut, int wind_id, int sb)
Regular IMDCT and windowing without overlapping, with spectrum reversal in the odd subbands.
Libavcodec external API header.
bitstream reader API header.
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
main external API structure.
Sound channel parameters.
uint8_t wnd_shape_hist[2][ATRAC3P_SUBBANDS]
IMDCT window shape, 0=sine/1=steep.
int qu_sf_idx[32]
array of scale factor indexes for each quant unit
int qu_tab_idx[32]
array of code table indexes for each quant unit
int qu_wordlen[32]
array of word lengths for each quant unit
uint8_t * wnd_shape
IMDCT window shape for current frame.
uint8_t power_levs[5]
power compensation levels
AtracGainInfo * gain_data_prev
gain control data for previous frame
int16_t spectrum[2048]
decoded IMDCT spectrum
uint8_t * wnd_shape_prev
IMDCT window shape for previous frame.
int num_gain_subbands
number of subbands with gain control data
int table_type
table type: 0 - tone?, 1- noise?
AtracGainInfo * gain_data
gain control data for next frame
int num_coded_vals
number of transmitted quant unit values
AtracGainInfo gain_data_hist[2][ATRAC3P_SUBBANDS]
gain control data for all subbands
Atrac3pWavesData * tones_info
Atrac3pWavesData * tones_info_prev
Atrac3pWavesData tones_info_hist[2][ATRAC3P_SUBBANDS]
Atrac3pWaveSynthParams wave_synth_hist[2]
waves synth history for two frames
Atrac3pWaveSynthParams * waves_info
int noise_level_index
global noise level index
int use_full_table
1 - full table list, 0 - restricted one
float prev_buf[2][ATRAC3P_FRAME_SAMPLES]
overlapping buffer
uint8_t swap_channels[ATRAC3P_SUBBANDS]
1 - perform subband-wise channel swapping
uint8_t negate_coeffs[ATRAC3P_SUBBANDS]
1 - subband-wise IMDCT coefficients negation
int noise_present
1 - global noise info present
int used_quant_units
number of quant units with coded spectrum
Atrac3pChanParams channels[2]
Atrac3pIPQFChannelCtx ipqf_ctx[2]
Atrac3pWaveSynthParams * waves_info_prev
int num_coded_subbands
number of subbands with coded spectrum
int unit_type
unit type (mono/stereo)
int noise_table_index
global noise RNG table index
Per-channel IPQF history.
float buf1[ATRAC3P_PQF_FIR_LEN *2][8]
float buf2[ATRAC3P_PQF_FIR_LEN *2][8]
Amplitude envelope of a group of sine waves.
int has_stop_point
indicates stop point within the GHA window
int has_start_point
indicates start point within the GHA window
int stop_pos
stop position expressed in n*4 samples
int start_pos
start position expressed in n*4 samples
Parameters of a single sine wave.
int phase_index
quantized phase index
int freq_index
wave frequency index
int amp_sf
quantized amplitude scale factor
int amp_index
quantized amplitude index
int tones_present
1 - tones info present
int amplitude_mode
1 - low range, 0 - high range
uint8_t invert_phase[ATRAC3P_SUBBANDS]
1 - subband-wise phase inversion
int tones_index
total sum of tones in this unit
uint8_t tone_sharing[ATRAC3P_SUBBANDS]
1 - subband-wise tone sharing flags
int num_tone_bands
number of PQF bands with tones
Atrac3pWaveParam waves[48]
uint8_t tone_master[ATRAC3P_SUBBANDS]
1 - subband-wise tone channel swapping
Parameters of a group of sine waves.
int num_wavs
number of sine waves in the group
Atrac3pWaveEnvelope pend_env
pending envelope from the previous frame
Atrac3pWaveEnvelope curr_env
group envelope from the current frame
int start_index
start index into global tones table for that subband
Gain control parameters for one subband.
static AVFormatContext * ctx
void(* av_tx_fn)(AVTXContext *s, void *out, void *in, ptrdiff_t stride)
Function pointer to a function to perform the transform.