FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
atrac3plus.h File Reference
#include <stdint.h>
#include "libavutil/float_dsp.h"
#include "libavutil/mem_internal.h"
#include "libavutil/tx.h"
#include "atrac.h"
#include "avcodec.h"
#include "get_bits.h"

Go to the source code of this file.

Data Structures

struct  Atrac3pIPQFChannelCtx
 Per-channel IPQF history. More...
 
struct  Atrac3pWaveEnvelope
 Amplitude envelope of a group of sine waves. More...
 
struct  Atrac3pWavesData
 Parameters of a group of sine waves. More...
 
struct  Atrac3pWaveParam
 Parameters of a single sine wave. More...
 
struct  Atrac3pChanParams
 Sound channel parameters. More...
 
struct  Atrac3pWaveSynthParams
 
struct  Atrac3pChanUnitCtx
 Channel unit parameters. More...
 

Macros

#define ATRAC3P_SUBBANDS   16
 Global unit sizes. More...
 
#define ATRAC3P_SUBBAND_SAMPLES   128
 number of samples per subband More...
 
#define ATRAC3P_FRAME_SAMPLES   (ATRAC3P_SUBBAND_SAMPLES * ATRAC3P_SUBBANDS)
 
#define ATRAC3P_PQF_FIR_LEN   12
 length of the prototype FIR of the PQF More...
 
#define ATRAC3P_POWER_COMP_OFF   15
 Global constants. More...
 

Enumerations

enum  Atrac3pChannelUnitTypes { CH_UNIT_MONO = 0, CH_UNIT_STEREO = 1, CH_UNIT_EXTENSION = 2, CH_UNIT_TERMINATOR = 3 }
 ATRAC3+ channel unit types. More...
 

Functions

void ff_atrac3p_init_vlcs (void)
 Initialize VLC tables for bitstream parsing. More...
 
int ff_atrac3p_decode_channel_unit (GetBitContext *gb, Atrac3pChanUnitCtx *ctx, int num_channels, AVCodecContext *avctx)
 Decode bitstream data of a channel unit. More...
 
void ff_atrac3p_init_dsp_static (void)
 Initialize sine waves synthesizer and ff_sine_* tables. 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_num)
 Perform power compensation aka noise dithering. More...
 
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. More...
 
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. 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]
 

Detailed Description

Global structures, constants and data for ATRAC3+ decoder.

Definition in file atrac3plus.h.

Macro Definition Documentation

◆ ATRAC3P_SUBBANDS

#define ATRAC3P_SUBBANDS   16

Global unit sizes.

number of PQF subbands

Definition at line 42 of file atrac3plus.h.

◆ ATRAC3P_SUBBAND_SAMPLES

#define ATRAC3P_SUBBAND_SAMPLES   128

number of samples per subband

Definition at line 43 of file atrac3plus.h.

◆ ATRAC3P_FRAME_SAMPLES

#define ATRAC3P_FRAME_SAMPLES   (ATRAC3P_SUBBAND_SAMPLES * ATRAC3P_SUBBANDS)

Definition at line 44 of file atrac3plus.h.

◆ ATRAC3P_PQF_FIR_LEN

#define ATRAC3P_PQF_FIR_LEN   12

length of the prototype FIR of the PQF

Definition at line 46 of file atrac3plus.h.

◆ ATRAC3P_POWER_COMP_OFF

#define ATRAC3P_POWER_COMP_OFF   15

Global constants.

disable power compensation

Definition at line 49 of file atrac3plus.h.

Enumeration Type Documentation

◆ Atrac3pChannelUnitTypes

ATRAC3+ channel unit types.

Enumerator
CH_UNIT_MONO 

unit containing one coded channel

CH_UNIT_STEREO 

unit containing two jointly-coded channels

CH_UNIT_EXTENSION 

unit containing extension information

CH_UNIT_TERMINATOR 

unit sequence terminator

Definition at line 52 of file atrac3plus.h.

Function Documentation

◆ ff_atrac3p_init_vlcs()

void ff_atrac3p_init_vlcs ( void  )

Initialize VLC tables for bitstream parsing.

Definition at line 76 of file atrac3plus.c.

Referenced by atrac3p_init_static().

◆ ff_atrac3p_decode_channel_unit()

int ff_atrac3p_decode_channel_unit ( GetBitContext gb,
Atrac3pChanUnitCtx ctx,
int  num_channels,
AVCodecContext avctx 
)

Decode bitstream data of a channel unit.

Parameters
[in]gbthe GetBit context
[in,out]ctxptr to the channel unit context
[in]num_channelsnumber of channels to process
[in]avctxptr to the AVCodecContext
Returns
result code: 0 = OK, otherwise - error code

Definition at line 1662 of file atrac3plus.c.

Referenced by atrac3p_decode_frame().

◆ ff_atrac3p_init_dsp_static()

void ff_atrac3p_init_dsp_static ( void  )

Initialize sine waves synthesizer and ff_sine_* tables.

Definition at line 88 of file atrac3plusdsp.c.

Referenced by atrac3p_init_static().

◆ 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.

Parameters
[in]ch_unitpointer to the channel unit context
[in]fdsppointer to float DSP context
[in]ch_numwhich channel to process
[in]sbwhich subband to process
[out]outreceives processed data

Definition at line 178 of file atrac3plusdsp.c.

Referenced by reconstruct_frame().

◆ ff_atrac3p_power_compensation()

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.

Parameters
[in]ctxptr to the channel context
[in]fdsppointer to float DSP context
[in]ch_indexwhich channel to process
[in,out]spptr to channel spectrum to process
[in]rng_indexindicates which RNG table to use
[in]sb_numwhich subband to process

Definition at line 412 of file atrac3plusdsp.c.

Referenced by decode_residual_spectrum().

◆ ff_atrac3p_imdct()

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.

Parameters
[in]fdsppointer to float DSP context
[in]mdct_ctxpointer to MDCT transform context
[in]pInfloat input
[out]pOutfloat output
[in]wind_idwhich MDCT window to apply
[in]sbsubband number

Definition at line 458 of file atrac3plusdsp.c.

Referenced by reconstruct_frame().

◆ ff_atrac3p_ipqf()

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.

Parameters
[in]dct_ctxptr to the pre-initialized IDCT context
[in,out]histptr to the filter history
[in]ininput data to process
[out]outreceives processed data

Definition at line 600 of file atrac3plusdsp.c.

Referenced by reconstruct_frame().

Variable Documentation

◆ ff_atrac3p_qu_to_spec_pos

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().

◆ ff_atrac3p_sf_tab

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().

◆ ff_atrac3p_mant_tab

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().