FFmpeg
|
DSP functions for ATRAC3+ decoder. More...
#include <math.h>
#include "libavutil/float_dsp.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. | |
av_cold void | ff_atrac3p_init_wave_synth (void) |
Initialize sine waves synthesizer. | |
static void | waves_synth (Atrac3pWaveSynthParams *synth_param, Atrac3pWavesData *waves_info, Atrac3pWaveEnvelope *envelope, int phase_shift, int reg_offset, float *out) |
Synthesize sine waves according to given parameters. | |
void | ff_atrac3p_generate_tones (Atrac3pChanUnitCtx *ch_unit, AVFloatDSPContext *fdsp, int ch_num, int sb, float *out) |
Synthesize sine waves for a particular subband. | |
void | ff_atrac3p_power_compensation (Atrac3pChanUnitCtx *ctx, int ch_index, float *sp, int rng_index, int sb) |
Perform power compensation aka noise dithering. | |
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. | |
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. | |
Variables | |
const uint16_t | ff_atrac3p_qu_to_spec_pos [33] |
Map quant unit number to its position in the spectrum. | |
const float | ff_atrac3p_sf_tab [64] |
const float | ff_atrac3p_mant_tab [8] |
static float | sine_table [2048] |
wave table | |
static float | hann_window [256] |
Hann windowing function. | |
static float | amp_sf_tab [64] |
scalefactors for quantized amplitudes | |
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. | |
static const int | subband_to_qu [17] |
Map subband number to quant unit number. | |
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 77 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_imdct().
#define TWOPI (2 * M_PI) |
Definition at line 88 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_init_wave_synth().
#define DEQUANT_PHASE | ( | ph | ) | (((ph) & 0x1F) << 6) |
Definition at line 90 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 79 of file atrac3plusdsp.c.
Referenced by atrac3p_decode_init().
Initialize sine waves synthesizer.
Definition at line 96 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] | phase_shift | flag indicates 180° phase shift |
[in] | reg_offset | region offset for trimming envelope data |
[out] | out | receives sythesized data |
Definition at line 123 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 177 of file atrac3plusdsp.c.
Referenced by reconstruct_frame().
void ff_atrac3p_power_compensation | ( | Atrac3pChanUnitCtx * | ctx, |
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] | 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 411 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 457 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 598 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 41 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 51 of file atrac3plusdsp.c.
Referenced by decode_residual_spectrum(), and ff_atrac3p_power_compensation().
const float ff_atrac3p_mant_tab[8] |
Definition at line 66 of file atrac3plusdsp.c.
Referenced by decode_residual_spectrum(), and ff_atrac3p_power_compensation().
|
static |
wave table
Definition at line 92 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_init_wave_synth(), and waves_synth().
|
static |
Hann windowing function.
Definition at line 93 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 94 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_init_wave_synth(), and waves_synth().
|
static |
Definition at line 244 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_power_compensation().
|
static |
Definition at line 249 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 401 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_power_compensation().
|
static |
Map subband number to quant unit number.
Definition at line 407 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_power_compensation().
|
static |
Definition at line 489 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_ipqf().
|
static |
Definition at line 495 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_ipqf().
|
static |
Definition at line 547 of file atrac3plusdsp.c.
Referenced by ff_atrac3p_ipqf().