28 #ifndef AVCODEC_ATRAC3PLUS_H 29 #define AVCODEC_ATRAC3PLUS_H 40 #define ATRAC3P_SUBBANDS 16 41 #define ATRAC3P_SUBBAND_SAMPLES 128
42 #define ATRAC3P_FRAME_SAMPLES (ATRAC3P_SUBBAND_SAMPLES * ATRAC3P_SUBBANDS)
44 #define ATRAC3P_PQF_FIR_LEN 12 47 #define ATRAC3P_POWER_COMP_OFF 15 98 int16_t spectrum[2048];
196 int ch_num,
int sb,
float *
out);
209 int ch_index,
float *
sp,
int rng_index,
int sb_num);
223 float *pOut,
int wind_id,
int sb);
235 const float *
in,
float *
out);
const float ff_atrac3p_sf_tab[64]
const uint16_t ff_atrac3p_qu_to_spec_pos[33]
Map quant unit number to its position in the spectrum.
void ff_atrac3p_init_wave_synth(void)
Initialize sine waves synthesizer.
int num_tone_bands
number of PQF bands with tones
Atrac3pWavesData * tones_info_prev
int num_coded_subbands
number of subbands with coded spectrum
int table_type
table type: 0 - tone?, 1- noise?
int num_wavs
number of sine waves in the group
int used_quant_units
number of quant units with coded spectrum
#define ATRAC3P_SUBBANDS
Global unit sizes.
AtracGainInfo * gain_data_prev
gain control data for previous frame
int ff_atrac3p_decode_channel_unit(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
Decode bitstream data of a channel unit.
int stop_pos
stop position expressed in n*4 samples
#define ATRAC3P_FRAME_SAMPLES
#define ATRAC3P_PQF_FIR_LEN
length of the prototype FIR of the PQF
int amp_index
quantized amplitude index
float buf2[ATRAC3P_PQF_FIR_LEN *2][8]
#define DECLARE_ALIGNED(n, t, v)
Declare a variable that is aligned in memory.
Parameters of a single sine wave.
Atrac3pWaveEnvelope pend_env
pending envelope from the previous frame
bitstream reader API header.
int tones_index
total sum of tones in this unit
uint8_t * wnd_shape
IMDCT window shape for current frame.
int noise_level_index
global noise level index
void ff_atrac3p_imdct(AVFloatDSPContext *fdsp, FFTContext *mdct_ctx, float *pIn, float *pOut, int wind_id, int sb)
Regular IMDCT and windowing without overlapping, with spectrum reversal in the odd subbands...
Amplitude envelope of a group of sine waves.
uint8_t * wnd_shape_prev
IMDCT window shape for previous frame.
void ff_atrac3p_ipqf(FFTContext *dct_ctx, Atrac3pIPQFChannelCtx *hist, const float *in, float *out)
Subband synthesis filter based on the polyphase quadrature (pseudo-QMF) filter bank.
Parameters of a group of sine waves.
int noise_table_index
global noise RNG table index
float buf1[ATRAC3P_PQF_FIR_LEN *2][8]
int amplitude_mode
1 - low range, 0 - high range
unit containing one coded channel
Atrac3pWavesData * tones_info
int use_full_table
1 - full table list, 0 - restricted one
int unit_type
unit type (mono/stereo)
int num_gain_subbands
number of subbands with gain control data
int num_coded_vals
number of transmitted quant unit values
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_init_imdct(AVCodecContext *avctx, FFTContext *mdct_ctx)
Initialize IMDCT transform.
int start_index
start index into global tones table for that subband
Gain control parameters for one subband.
int freq_index
wave frequency index
Libavcodec external API header.
int phase_index
quantized phase index
void ff_atrac3p_generate_tones(Atrac3pChanUnitCtx *ch_unit, AVFloatDSPContext *fdsp, int ch_num, int sb, float *out)
Synthesize sine waves for a particular subband.
main external API structure.
int amp_sf
quantized amplitude scale factor
Sound channel parameters.
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;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);return NULL;} return ac;} 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;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->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);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
Atrac3pWaveEnvelope curr_env
group envelope from the current frame
Per-channel IPQF history.
const float ff_atrac3p_mant_tab[8]
Atrac3pWaveSynthParams * waves_info_prev
void ff_atrac3p_init_vlcs(void)
Initialize VLC tables for bitstream parsing.
int has_start_point
indicates start point within the GHA window
AtracGainInfo * gain_data
gain control data for next frame
int has_stop_point
indicates stop point within the GHA window
unit containing two jointly-coded channels
Atrac3pWaveSynthParams * waves_info
int noise_present
1 - global noise info present
int start_pos
start position expressed in n*4 samples
int tones_present
1 - tones info present
unit containing extension information
Atrac3pChannelUnitTypes
ATRAC3+ channel unit types.