FFmpeg
4.0
|
DSP functions for ATRAC3+ decoder. More...
#include <math.h>
#include "libavutil/float_dsp.h"
#include "libavutil/libm.h"
#include "avcodec.h"
#include "sinewin.h"
#include "fft.h"
#include "atrac3plus.h"
Go to the source code of this file.
Macros | |
#define | ATRAC3P_MDCT_SIZE (ATRAC3P_SUBBAND_SAMPLES * 2) |
#define | TWOPI (2 * M_PI) |
#define | DEQUANT_PHASE(ph) (((ph) & 0x1F) << 6) |
Functions | |
av_cold void | ff_atrac3p_init_imdct (AVCodecContext *avctx, FFTContext *mdct_ctx) |
Initialize IMDCT transform. More... | |
av_cold void | ff_atrac3p_init_wave_synth (void) |
Initialize sine waves synthesizer. More... | |
static void | waves_synth (Atrac3pWaveSynthParams *synth_param, Atrac3pWavesData *waves_info, Atrac3pWaveEnvelope *envelope, AVFloatDSPContext *fdsp, int invert_phase, int reg_offset, float *out) |
Synthesize sine waves according to given parameters. More... | |
void | ff_atrac3p_generate_tones (Atrac3pChanUnitCtx *ch_unit, AVFloatDSPContext *fdsp, int ch_num, int sb, float *out) |
Synthesize sine waves for a particular subband. More... | |
void | ff_atrac3p_power_compensation (Atrac3pChanUnitCtx *ctx, AVFloatDSPContext *fdsp, int ch_index, float *sp, int rng_index, int sb) |
Perform power compensation aka noise dithering. More... | |
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. More... | |
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. More... | |
Variables | |
const uint16_t | ff_atrac3p_qu_to_spec_pos [33] |
Map quant unit number to its position in the spectrum. More... | |
const float | ff_atrac3p_sf_tab [64] |
const float | ff_atrac3p_mant_tab [8] |
static float | sine_table [2048] |
wave table More... | |
static float | hann_window [256] |
Hann windowing function. More... | |
static float | amp_sf_tab [64] |
scalefactors for quantized amplitudes More... | |
static const int | subband_to_powgrp [ATRAC3P_SUBBANDS] |
static const float | noise_tab [1024] |
static const float | pwc_levs [16] |
Noise level table for power compensation. More... | |
static const int | subband_to_qu [17] |
Map subband number to quant unit number. More... | |
static const int | mod23_lut [26] |
static const float | ipqf_coeffs1 [ATRAC3P_PQF_FIR_LEN][16] |
static const float | ipqf_coeffs2 [ATRAC3P_PQF_FIR_LEN][16] |
DSP functions for ATRAC3+ decoder.
Definition in file atrac3plusdsp.c.
#define ATRAC3P_MDCT_SIZE (ATRAC3P_SUBBAND_SAMPLES * 2) |
Definition at line 78 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_imdct().
#define TWOPI (2 * M_PI) |
Definition at line 89 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_init_wave_synth().
#define DEQUANT_PHASE | ( | ph | ) | (((ph) & 0x1F) << 6) |
Definition at line 91 of file atrac3plusdsp.c.
Referenced by waves_synth().
av_cold void ff_atrac3p_init_imdct | ( | AVCodecContext * | avctx, |
FFTContext * | mdct_ctx | ||
) |
Initialize IMDCT transform.
[in] | avctx | ptr to the AVCodecContext |
[in] | mdct_ctx | pointer to MDCT transform context |
Definition at line 80 of file atrac3plusdsp.c.
Referenced by atrac3p_decode_init().
Initialize sine waves synthesizer.
Definition at line 97 of file atrac3plusdsp.c.
Referenced by atrac3p_decode_init().
|
static |
Synthesize sine waves according to given parameters.
[in] | synth_param | ptr to common synthesis parameters |
[in] | waves_info | parameters for each sine wave |
[in] | envelope | envelope data for all waves in a group |
[in] | fdsp | ptr to floating-point DSP context |
[in] | invert_phase | flag indicating 180° phase shift |
[in] | reg_offset | region offset for trimming envelope data |
[out] | out | receives sythesized data |
Definition at line 125 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_generate_tones().
void ff_atrac3p_generate_tones | ( | Atrac3pChanUnitCtx * | ch_unit, |
AVFloatDSPContext * | fdsp, | ||
int | ch_num, | ||
int | sb, | ||
float * | out | ||
) |
Synthesize sine waves for a particular subband.
[in] | ch_unit | pointer to the channel unit context |
[in] | fdsp | pointer to float DSP context |
[in] | ch_num | which channel to process |
[in] | sb | which subband to process |
[out] | out | receives processed data |
Definition at line 184 of file atrac3plusdsp.c.
Referenced by reconstruct_frame().
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.
[in] | ctx | ptr to the channel context |
[in] | fdsp | pointer to float DSP context |
[in] | ch_index | which channel to process |
[in,out] | sp | ptr to channel spectrum to process |
[in] | rng_index | indicates which RNG table to use |
[in] | sb_num | which subband to process |
Definition at line 418 of file atrac3plusdsp.c.
Referenced by decode_residual_spectrum().
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.
[in] | fdsp | pointer to float DSP context |
[in] | mdct_ctx | pointer to MDCT transform context |
[in] | pIn | float input |
[out] | pOut | float output |
[in] | wind_id | which MDCT window to apply |
[in] | sb | subband number |
Definition at line 464 of file atrac3plusdsp.c.
Referenced by reconstruct_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.
[in] | dct_ctx | ptr to the pre-initialized IDCT context |
[in,out] | hist | ptr to the filter history |
[in] | in | input data to process |
[out] | out | receives processed data |
Definition at line 605 of file atrac3plusdsp.c.
Referenced by reconstruct_frame().
const uint16_t ff_atrac3p_qu_to_spec_pos[33] |
Map quant unit number to its position in the spectrum.
To get the number of spectral lines in each quant unit do the following: num_specs = qu_to_spec_pos[i+1] - qu_to_spec_pos[i]
Definition at line 42 of file atrac3plusdsp.c.
Referenced by decode_residual_spectrum(), decode_spectrum(), and ff_atrac3p_power_compensation().
const float ff_atrac3p_sf_tab[64] |
Definition at line 52 of file atrac3plusdsp.c.
Referenced by decode_residual_spectrum(), and ff_atrac3p_power_compensation().
const float ff_atrac3p_mant_tab[8] |
Definition at line 67 of file atrac3plusdsp.c.
Referenced by decode_residual_spectrum(), and ff_atrac3p_power_compensation().
|
static |
wave table
Definition at line 93 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_init_wave_synth(), and waves_synth().
|
static |
Hann windowing function.
Definition at line 94 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_generate_tones(), ff_atrac3p_init_wave_synth(), and waves_synth().
|
static |
scalefactors for quantized amplitudes
Definition at line 95 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_init_wave_synth(), and waves_synth().
|
static |
Definition at line 251 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_power_compensation().
|
static |
Definition at line 256 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_power_compensation().
|
static |
Noise level table for power compensation.
Equ: pow(2.0f, (double)(6 - i) / 3.0f) where i = 0...15
Definition at line 408 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_power_compensation().
|
static |
Map subband number to quant unit number.
Definition at line 414 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_power_compensation().
|
static |
Definition at line 496 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_ipqf().
|
static |
Definition at line 502 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_ipqf().
|
static |
Definition at line 554 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_ipqf().