FFmpeg
Loading...
Searching...
No Matches
aacpsy.c File Reference

AAC encoder psychoacoustic model. More...

#include "libavutil/attributes.h"
#include "libavutil/ffmath.h"
#include "libavutil/mem.h"
#include "avcodec.h"
#include "aac.h"
#include "psymodel.h"

Go to the source code of this file.

Data Structures

struct  AacPsyBand
 information for single band used by 3GPP TS26.403-inspired psychoacoustic model More...
 
struct  AacPsyChannel
 single/pair channel context for psychoacoustic model More...
 
struct  AacPsyCoeffs
 psychoacoustic model frame type-dependent coefficients More...
 
struct  AacPsyContext
 3GPP TS26.403-inspired psychoacoustic model specific data More...
 
struct  PsyLamePreset
 LAME psy model preset struct. More...
 

Macros

#define ATH_ADD   4
 

Functions

static float lame_calc_attack_threshold (int bitrate)
 Calculate the ABR attack threshold from the above LAME psymodel table.
 
static av_cold void lame_window_init (FFPsyContext *fctx, AacPsyContext *ctx, AVCodecContext *avctx)
 LAME psy model specific initialization.
 
static av_cold float calc_bark (float f)
 Calculate Bark value for given line.
 
static av_cold float ath (float f, float add)
 Calculate ATH value for given frequency.
 
static av_cold int psy_3gpp_init (FFPsyContext *ctx)
 
static float iir_filter (int in, float state[2])
 IIR filter used in block switching decision.
 
static av_unused FFPsyWindowInfo psy_3gpp_window (FFPsyContext *ctx, const int16_t *audio, const int16_t *la, int channel, int prev_type)
 Tell encoder which window types to use.
 
static int calc_bit_demand (AacPsyContext *ctx, float pe, int bits, int size, int short_window)
 
static float calc_pe_3gpp (AacPsyBand *band)
 
static float calc_reduction_3gpp (float a, float desired_pe, float pe, float active_lines)
 
static float calc_reduced_thr_3gpp (AacPsyBand *band, float min_snr, float reduction)
 
static void calc_thr_3gpp (const FFPsyWindowInfo *wi, const int num_bands, AacPsyChannel *pch, const uint8_t *band_sizes, const float *coefs, const int cutoff)
 
static void psy_hp_filter (const float *firbuf, float *hpfsmpl, const float *psy_fir_coeffs)
 
static void psy_3gpp_analyze_channel (FFPsyContext *ctx, int channel, const float *coefs, const FFPsyWindowInfo *wi)
 Calculate band thresholds as suggested in 3GPP TS26.403.
 
static void psy_3gpp_analyze (FFPsyContext *ctx, int channel, const float **coeffs, const FFPsyWindowInfo *wi)
 
static av_cold void psy_3gpp_end (FFPsyContext *apc)
 
static void lame_apply_block_type (AacPsyChannel *ctx, FFPsyWindowInfo *wi, int uselongblock)
 
static int psy_lame_detect (AacPsyContext *pctx, AacPsyChannel *pch, const float *la, int channel, int prev_type, int attacks[AAC_NUM_BLOCKS_SHORT+1])
 
static FFPsyWindowInfo psy_lame_apply (AacPsyContext *pctx, AacPsyChannel *pch, int uselongblock, const int attacks[AAC_NUM_BLOCKS_SHORT+1], int prev_type, int have_la)
 
static FFPsyWindowInfo psy_lame_window (FFPsyContext *ctx, const float *audio, const float *la, int channel, int prev_type)
 
static void psy_lame_window_pair (FFPsyContext *ctx, const float *audio0, const float *la0, const float *audio1, const float *la1, int channel0, int channel1, int prev_type0, int prev_type1, FFPsyWindowInfo wi[2])
 

Variables

static const PsyLamePreset psy_abr_map []
 LAME psy model preset table for ABR.
 
static const PsyLamePreset psy_vbr_map []
 LAME psy model preset table for constant quality.
 
static const float psy_fir_coeffs []
 LAME psy model FIR coefficient table.
 
static const uint8_t window_grouping [9]
 window grouping information stored as bits (0 - new group, 1 - group continues)
 
const FFPsyModel ff_aac_psy_model
 
#define PSY_3GPP_THR_SPREAD_HI   1.5f
 constants for 3GPP AAC psychoacoustic model
 
#define PSY_3GPP_THR_SPREAD_LOW   3.0f
 
#define PSY_3GPP_EN_SPREAD_HI_L1   2.0f
 
#define PSY_3GPP_EN_SPREAD_HI_L2   1.5f
 
#define PSY_3GPP_EN_SPREAD_HI_S   1.5f
 
#define PSY_3GPP_EN_SPREAD_LOW_L   3.0f
 
#define PSY_3GPP_EN_SPREAD_LOW_S   2.0f
 
#define PSY_3GPP_RPEMIN   0.01f
 
#define PSY_3GPP_RPELEV   2.0f
 
#define PSY_3GPP_C1   3.0f /* log2(8) */
 
#define PSY_3GPP_C2   1.3219281f /* log2(2.5) */
 
#define PSY_3GPP_C3   0.55935729f /* 1 - C2 / C1 */
 
#define PSY_SNR_1DB   7.9432821e-1f /* -1dB */
 
#define PSY_SNR_25DB   3.1622776e-3f /* -25dB */
 
#define PSY_3GPP_SAVE_SLOPE_L   -0.46666667f
 
#define PSY_3GPP_SAVE_SLOPE_S   -0.36363637f
 
#define PSY_3GPP_SAVE_ADD_L   -0.84285712f
 
#define PSY_3GPP_SAVE_ADD_S   -0.75f
 
#define PSY_3GPP_SPEND_SLOPE_L   0.66666669f
 
#define PSY_3GPP_SPEND_SLOPE_S   0.81818181f
 
#define PSY_3GPP_SPEND_ADD_L   -0.35f
 
#define PSY_3GPP_SPEND_ADD_S   -0.26111111f
 
#define PSY_3GPP_CLIP_LO_L   0.2f
 
#define PSY_3GPP_CLIP_LO_S   0.2f
 
#define PSY_3GPP_CLIP_HI_L   0.95f
 
#define PSY_3GPP_CLIP_HI_S   0.75f
 
#define PSY_THRFL_QUALITY   10.0f /* VBR/ABR depth, dB, all bands */
 
#define PSY_THRFL_CBR   6.0f /* CBR depth, dB */
 
#define PSY_THRFL_CBR_KNEE   8000.0f /* CBR: only above this frequency */
 
#define PSY_3GPP_DEMAND_SCALE   2.5f
 
#define PSY_3GPP_AH_THR_LONG   0.5f
 
#define PSY_3GPP_AH_THR_SHORT   0.63f
 
#define PSY_PE_FORGET_SLOPE   511
 
#define PSY_3GPP_BITS_TO_PE(bits)
 
#define PSY_3GPP_PE_TO_BITS(bits)
 
#define PSY_LAME_FIR_LEN   21
 LAME psy model FIR order.
 
#define AAC_BLOCK_SIZE_LONG   1024
 long block size
 
#define AAC_BLOCK_SIZE_SHORT   128
 short block size
 
#define AAC_NUM_BLOCKS_SHORT   8
 number of blocks in a short sequence
 
#define PSY_LAME_NUM_SUBBLOCKS   2
 Number of sub-blocks in each short block.
 
#define PSY_LAME_PE_GAP   12
 min consecutive long frames before the relaxation applies
 
#define PSY_LAME_PE_QUIET   0.4f
 pre-onset must be below this fraction of the frame peak
 
#define PSY_LAME_PE_RED   0.45f
 attack-threshold multiplier for a qualifying isolated onset
 
#define PSY_LAME_HIST   32
 HP sub-block peak history depth.
 
#define PSY_LAME_NOV_BACK   30
 novelty look-back in sub-blocks
 
#define PSY_LAME_HFN_REL   4.0f
 max derivative rise over the recent envelope
 
#define PSY_LAME_HFN_ABS   2000.0f
 max absolute derivative peak
 
#define PSY_LAME_HFN_PRE   8.0f
 max candidate rise over the ~5ms pre-attack minimum
 
#define PSY_LAME_GAP_DEPTH   6.0f
 a gap is this far below the peak-hold
 
#define PSY_LAME_GAP_BACK   24
 gap look-back in sub-blocks (<= PSY_LAME_HIST)
 
#define PSY_LAME_GAP_LEVEL   0.4f
 candidate must reach this fraction of the peak-hold
 
#define PSY_LAME_GAP_FLOOR   4000.0f
 and this absolute peak
 
#define PSY_LAME_GAP_TOWER   4.0f
 HP tower: rise over the whole look-back.
 
#define PSY_LAME_GRP_RATIO   2.5f
 max adjacent-window level ratio inside a group
 
#define PSY_LAME_GRP_MAX   4
 max windows per group
 
enum  { PSY_3GPP_AH_NONE , PSY_3GPP_AH_INACTIVE , PSY_3GPP_AH_ACTIVE }
 

Detailed Description

AAC encoder psychoacoustic model.

Definition in file aacpsy.c.

Macro Definition Documentation

◆ PSY_3GPP_THR_SPREAD_HI

#define PSY_3GPP_THR_SPREAD_HI   1.5f

constants for 3GPP AAC psychoacoustic model

Definition at line 45 of file aacpsy.c.

Referenced by psy_3gpp_init().

◆ PSY_3GPP_THR_SPREAD_LOW

#define PSY_3GPP_THR_SPREAD_LOW   3.0f

Definition at line 46 of file aacpsy.c.

Referenced by psy_3gpp_init().

◆ PSY_3GPP_EN_SPREAD_HI_L1

#define PSY_3GPP_EN_SPREAD_HI_L1   2.0f

Definition at line 48 of file aacpsy.c.

Referenced by psy_3gpp_init().

◆ PSY_3GPP_EN_SPREAD_HI_L2

#define PSY_3GPP_EN_SPREAD_HI_L2   1.5f

Definition at line 50 of file aacpsy.c.

◆ PSY_3GPP_EN_SPREAD_HI_S

#define PSY_3GPP_EN_SPREAD_HI_S   1.5f

Definition at line 52 of file aacpsy.c.

Referenced by psy_3gpp_init().

◆ PSY_3GPP_EN_SPREAD_LOW_L

#define PSY_3GPP_EN_SPREAD_LOW_L   3.0f

Definition at line 54 of file aacpsy.c.

Referenced by psy_3gpp_init().

◆ PSY_3GPP_EN_SPREAD_LOW_S

#define PSY_3GPP_EN_SPREAD_LOW_S   2.0f

Definition at line 56 of file aacpsy.c.

Referenced by psy_3gpp_init().

◆ PSY_3GPP_RPEMIN

#define PSY_3GPP_RPEMIN   0.01f

Definition at line 58 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel().

◆ PSY_3GPP_RPELEV

#define PSY_3GPP_RPELEV   2.0f

Definition at line 59 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel().

◆ PSY_3GPP_C1

#define PSY_3GPP_C1   3.0f /* log2(8) */

Definition at line 61 of file aacpsy.c.

Referenced by calc_pe_3gpp().

◆ PSY_3GPP_C2

#define PSY_3GPP_C2   1.3219281f /* log2(2.5) */

Definition at line 62 of file aacpsy.c.

Referenced by calc_pe_3gpp().

◆ PSY_3GPP_C3

#define PSY_3GPP_C3   0.55935729f /* 1 - C2 / C1 */

Definition at line 63 of file aacpsy.c.

Referenced by calc_pe_3gpp().

◆ PSY_SNR_1DB

#define PSY_SNR_1DB   7.9432821e-1f /* -1dB */

Definition at line 65 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel(), and psy_3gpp_init().

◆ PSY_SNR_25DB

#define PSY_SNR_25DB   3.1622776e-3f /* -25dB */

Definition at line 66 of file aacpsy.c.

Referenced by psy_3gpp_init().

◆ PSY_3GPP_SAVE_SLOPE_L

#define PSY_3GPP_SAVE_SLOPE_L   -0.46666667f

Definition at line 68 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_3GPP_SAVE_SLOPE_S

#define PSY_3GPP_SAVE_SLOPE_S   -0.36363637f

Definition at line 69 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_3GPP_SAVE_ADD_L

#define PSY_3GPP_SAVE_ADD_L   -0.84285712f

Definition at line 70 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_3GPP_SAVE_ADD_S

#define PSY_3GPP_SAVE_ADD_S   -0.75f

Definition at line 71 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_3GPP_SPEND_SLOPE_L

#define PSY_3GPP_SPEND_SLOPE_L   0.66666669f

Definition at line 72 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_3GPP_SPEND_SLOPE_S

#define PSY_3GPP_SPEND_SLOPE_S   0.81818181f

Definition at line 73 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_3GPP_SPEND_ADD_L

#define PSY_3GPP_SPEND_ADD_L   -0.35f

Definition at line 74 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_3GPP_SPEND_ADD_S

#define PSY_3GPP_SPEND_ADD_S   -0.26111111f

Definition at line 75 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_3GPP_CLIP_LO_L

#define PSY_3GPP_CLIP_LO_L   0.2f

Definition at line 76 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_3GPP_CLIP_LO_S

#define PSY_3GPP_CLIP_LO_S   0.2f

Definition at line 77 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_3GPP_CLIP_HI_L

#define PSY_3GPP_CLIP_HI_L   0.95f

Definition at line 78 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_3GPP_CLIP_HI_S

#define PSY_3GPP_CLIP_HI_S   0.75f

Definition at line 79 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_THRFL_QUALITY

#define PSY_THRFL_QUALITY   10.0f /* VBR/ABR depth, dB, all bands */

Definition at line 90 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel().

◆ PSY_THRFL_CBR

#define PSY_THRFL_CBR   6.0f /* CBR depth, dB */

Definition at line 91 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel().

◆ PSY_THRFL_CBR_KNEE

#define PSY_THRFL_CBR_KNEE   8000.0f /* CBR: only above this frequency */

Definition at line 92 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel().

◆ PSY_3GPP_DEMAND_SCALE

#define PSY_3GPP_DEMAND_SCALE   2.5f

Definition at line 103 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_3GPP_AH_THR_LONG

#define PSY_3GPP_AH_THR_LONG   0.5f

Definition at line 105 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel().

◆ PSY_3GPP_AH_THR_SHORT

#define PSY_3GPP_AH_THR_SHORT   0.63f

Definition at line 106 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel().

◆ PSY_PE_FORGET_SLOPE

#define PSY_PE_FORGET_SLOPE   511

Definition at line 108 of file aacpsy.c.

Referenced by calc_bit_demand().

◆ PSY_3GPP_BITS_TO_PE

#define PSY_3GPP_BITS_TO_PE ( bits)
Value:
((bits) * 1.18f)
static const uint8_t bits[8]
Definition fastaudio.c:100

Definition at line 116 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel(), and psy_3gpp_init().

◆ PSY_3GPP_PE_TO_BITS

#define PSY_3GPP_PE_TO_BITS ( bits)
Value:
((bits) / 1.18f)

Definition at line 117 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel().

◆ PSY_LAME_FIR_LEN

#define PSY_LAME_FIR_LEN   21

LAME psy model FIR order.

Definition at line 120 of file aacpsy.c.

Referenced by psy_hp_filter(), and psy_lame_detect().

◆ AAC_BLOCK_SIZE_LONG

#define AAC_BLOCK_SIZE_LONG   1024

long block size

Definition at line 121 of file aacpsy.c.

Referenced by psy_3gpp_init(), psy_hp_filter(), and psy_lame_detect().

◆ AAC_BLOCK_SIZE_SHORT

#define AAC_BLOCK_SIZE_SHORT   128

short block size

Definition at line 122 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ AAC_NUM_BLOCKS_SHORT

#define AAC_NUM_BLOCKS_SHORT   8

number of blocks in a short sequence

Definition at line 123 of file aacpsy.c.

Referenced by lame_window_init(), psy_lame_apply(), psy_lame_detect(), psy_lame_window(), and psy_lame_window_pair().

◆ PSY_LAME_NUM_SUBBLOCKS

#define PSY_LAME_NUM_SUBBLOCKS   2

Number of sub-blocks in each short block.

Definition at line 124 of file aacpsy.c.

Referenced by lame_window_init(), and psy_lame_detect().

◆ PSY_LAME_PE_GAP

#define PSY_LAME_PE_GAP   12

min consecutive long frames before the relaxation applies

Definition at line 130 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ PSY_LAME_PE_QUIET

#define PSY_LAME_PE_QUIET   0.4f

pre-onset must be below this fraction of the frame peak

Definition at line 131 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ PSY_LAME_PE_RED

#define PSY_LAME_PE_RED   0.45f

attack-threshold multiplier for a qualifying isolated onset

Definition at line 132 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ PSY_LAME_HIST

#define PSY_LAME_HIST   32

HP sub-block peak history depth.

Definition at line 136 of file aacpsy.c.

Referenced by lame_window_init(), and psy_lame_detect().

◆ PSY_LAME_NOV_BACK

#define PSY_LAME_NOV_BACK   30

novelty look-back in sub-blocks

Definition at line 137 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ PSY_LAME_HFN_REL

#define PSY_LAME_HFN_REL   4.0f

max derivative rise over the recent envelope

Definition at line 142 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ PSY_LAME_HFN_ABS

#define PSY_LAME_HFN_ABS   2000.0f

max absolute derivative peak

Definition at line 143 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ PSY_LAME_HFN_PRE

#define PSY_LAME_HFN_PRE   8.0f

max candidate rise over the ~5ms pre-attack minimum

Definition at line 144 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ PSY_LAME_GAP_DEPTH

#define PSY_LAME_GAP_DEPTH   6.0f

a gap is this far below the peak-hold

Definition at line 147 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ PSY_LAME_GAP_BACK

#define PSY_LAME_GAP_BACK   24

gap look-back in sub-blocks (<= PSY_LAME_HIST)

Definition at line 148 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ PSY_LAME_GAP_LEVEL

#define PSY_LAME_GAP_LEVEL   0.4f

candidate must reach this fraction of the peak-hold

Definition at line 149 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ PSY_LAME_GAP_FLOOR

#define PSY_LAME_GAP_FLOOR   4000.0f

and this absolute peak

Definition at line 150 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ PSY_LAME_GAP_TOWER

#define PSY_LAME_GAP_TOWER   4.0f

HP tower: rise over the whole look-back.

Definition at line 151 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ PSY_LAME_GRP_RATIO

#define PSY_LAME_GRP_RATIO   2.5f

max adjacent-window level ratio inside a group

Definition at line 154 of file aacpsy.c.

Referenced by psy_lame_apply().

◆ PSY_LAME_GRP_MAX

#define PSY_LAME_GRP_MAX   4

max windows per group

Definition at line 155 of file aacpsy.c.

Referenced by psy_lame_apply().

◆ ATH_ADD

#define ATH_ADD   4

Definition at line 365 of file aacpsy.c.

Referenced by psy_3gpp_init().

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PSY_3GPP_AH_NONE 
PSY_3GPP_AH_INACTIVE 
PSY_3GPP_AH_ACTIVE 

Definition at line 110 of file aacpsy.c.

Function Documentation

◆ lame_calc_attack_threshold()

static float lame_calc_attack_threshold ( int bitrate)
static

Calculate the ABR attack threshold from the above LAME psymodel table.

Definition at line 305 of file aacpsy.c.

Referenced by lame_window_init().

◆ lame_window_init()

static av_cold void lame_window_init ( FFPsyContext * fctx,
AacPsyContext * ctx,
AVCodecContext * avctx )
static

LAME psy model specific initialization.

Definition at line 335 of file aacpsy.c.

Referenced by psy_3gpp_init().

◆ calc_bark()

static av_cold float calc_bark ( float f)
static

Calculate Bark value for given line.

Definition at line 360 of file aacpsy.c.

Referenced by psy_3gpp_init().

◆ ath()

static av_cold float ath ( float f,
float add )
static

Calculate ATH value for given frequency.

Borrowed from Lame.

Definition at line 370 of file aacpsy.c.

Referenced by ath_init(), ath_init1(), psy_3gpp_init(), and unpack().

◆ psy_3gpp_init()

static av_cold int psy_3gpp_init ( FFPsyContext * ctx)
static

Definition at line 379 of file aacpsy.c.

◆ iir_filter()

static float iir_filter ( int in,
float state[2] )
static

IIR filter used in block switching decision.

Definition at line 469 of file aacpsy.c.

◆ psy_3gpp_window()

static av_unused FFPsyWindowInfo psy_3gpp_window ( FFPsyContext * ctx,
const int16_t * audio,
const int16_t * la,
int channel,
int prev_type )
static

Tell encoder which window types to use.

See also
3GPP TS26.403 5.4.1 "Blockswitching"

Definition at line 490 of file aacpsy.c.

◆ calc_bit_demand()

static int calc_bit_demand ( AacPsyContext * ctx,
float pe,
int bits,
int size,
int short_window )
static

Definition at line 576 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel().

◆ calc_pe_3gpp()

static float calc_pe_3gpp ( AacPsyBand * band)
static

Definition at line 620 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel().

◆ calc_reduction_3gpp()

static float calc_reduction_3gpp ( float a,
float desired_pe,
float pe,
float active_lines )
static

Definition at line 643 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel().

◆ calc_reduced_thr_3gpp()

static float calc_reduced_thr_3gpp ( AacPsyBand * band,
float min_snr,
float reduction )
static

Definition at line 657 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel().

◆ calc_thr_3gpp()

static void calc_thr_3gpp ( const FFPsyWindowInfo * wi,
const int num_bands,
AacPsyChannel * pch,
const uint8_t * band_sizes,
const float * coefs,
const int cutoff )
static

Definition at line 682 of file aacpsy.c.

Referenced by psy_3gpp_analyze_channel().

◆ psy_hp_filter()

static void psy_hp_filter ( const float * firbuf,
float * hpfsmpl,
const float * psy_fir_coeffs )
static

Definition at line 711 of file aacpsy.c.

Referenced by psy_lame_detect().

◆ psy_3gpp_analyze_channel()

static void psy_3gpp_analyze_channel ( FFPsyContext * ctx,
int channel,
const float * coefs,
const FFPsyWindowInfo * wi )
static

Calculate band thresholds as suggested in 3GPP TS26.403.

Definition at line 731 of file aacpsy.c.

Referenced by psy_3gpp_analyze().

◆ psy_3gpp_analyze()

static void psy_3gpp_analyze ( FFPsyContext * ctx,
int channel,
const float ** coeffs,
const FFPsyWindowInfo * wi )
static

Definition at line 990 of file aacpsy.c.

◆ psy_3gpp_end()

static av_cold void psy_3gpp_end ( FFPsyContext * apc)
static

Definition at line 1027 of file aacpsy.c.

◆ lame_apply_block_type()

static void lame_apply_block_type ( AacPsyChannel * ctx,
FFPsyWindowInfo * wi,
int uselongblock )
static

Definition at line 1035 of file aacpsy.c.

Referenced by psy_lame_apply().

◆ psy_lame_detect()

static int psy_lame_detect ( AacPsyContext * pctx,
AacPsyChannel * pch,
const float * la,
int channel,
int prev_type,
int attacks[AAC_NUM_BLOCKS_SHORT+1] )
static

Definition at line 1057 of file aacpsy.c.

Referenced by psy_lame_window(), and psy_lame_window_pair().

◆ psy_lame_apply()

static FFPsyWindowInfo psy_lame_apply ( AacPsyContext * pctx,
AacPsyChannel * pch,
int uselongblock,
const int attacks[AAC_NUM_BLOCKS_SHORT+1],
int prev_type,
int have_la )
static

Definition at line 1310 of file aacpsy.c.

Referenced by psy_lame_window(), and psy_lame_window_pair().

◆ psy_lame_window()

static FFPsyWindowInfo psy_lame_window ( FFPsyContext * ctx,
const float * audio,
const float * la,
int channel,
int prev_type )
static

Definition at line 1383 of file aacpsy.c.

◆ psy_lame_window_pair()

static void psy_lame_window_pair ( FFPsyContext * ctx,
const float * audio0,
const float * la0,
const float * audio1,
const float * la1,
int channel0,
int channel1,
int prev_type0,
int prev_type1,
FFPsyWindowInfo wi[2] )
static

Definition at line 1395 of file aacpsy.c.

Variable Documentation

◆ psy_abr_map

const PsyLamePreset psy_abr_map[]
static
Initial value:
= {
{ 8, 7.60},
{ 16, 7.60},
{ 24, 7.60},
{ 32, 7.60},
{ 40, 7.60},
{ 48, 7.60},
{ 56, 7.60},
{ 64, 7.40},
{ 80, 7.00},
{ 96, 6.60},
{112, 6.20},
{128, 6.20},
{160, 6.20}
}

LAME psy model preset table for ABR.

Definition at line 257 of file aacpsy.c.

Referenced by lame_calc_attack_threshold().

◆ psy_vbr_map

const PsyLamePreset psy_vbr_map[]
static
Initial value:
= {
{ 0, 4.20},
{ 1, 4.20},
{ 2, 4.20},
{ 3, 4.20},
{ 4, 4.20},
{ 5, 4.20},
{ 6, 4.20},
{ 7, 4.20},
{ 8, 4.20},
{ 9, 4.20},
{10, 4.20}
}

LAME psy model preset table for constant quality.

Definition at line 278 of file aacpsy.c.

Referenced by lame_window_init().

◆ psy_fir_coeffs

const float psy_fir_coeffs[]
static
Initial value:
= {
-8.65163e-18 * 2, -0.00851586 * 2, -6.74764e-18 * 2, 0.0209036 * 2,
-3.36639e-17 * 2, -0.0438162 * 2, -1.54175e-17 * 2, 0.0931738 * 2,
-5.52212e-17 * 2, -0.313819 * 2
}

LAME psy model FIR coefficient table.

Definition at line 296 of file aacpsy.c.

Referenced by psy_hp_filter(), and psy_lame_detect().

◆ window_grouping

const uint8_t window_grouping[9]
static
Initial value:
= {
0xB6, 0x6C, 0xD8, 0xB2, 0x66, 0xC6, 0x96, 0x36, 0x36
}

window grouping information stored as bits (0 - new group, 1 - group continues)

Definition at line 482 of file aacpsy.c.

Referenced by psy_3gpp_window(), and psy_lame_apply().

◆ ff_aac_psy_model

const FFPsyModel ff_aac_psy_model
Initial value:
=
{
.name = "3GPP TS 26.403-inspired model",
.init = psy_3gpp_init,
.window = psy_lame_window,
.analyze = psy_3gpp_analyze,
.end = psy_3gpp_end,
.window_pair = psy_lame_window_pair,
}
static void psy_lame_window_pair(FFPsyContext *ctx, const float *audio0, const float *la0, const float *audio1, const float *la1, int channel0, int channel1, int prev_type0, int prev_type1, FFPsyWindowInfo wi[2])
Definition aacpsy.c:1395
static void psy_3gpp_analyze(FFPsyContext *ctx, int channel, const float **coeffs, const FFPsyWindowInfo *wi)
Definition aacpsy.c:990
static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio, const float *la, int channel, int prev_type)
Definition aacpsy.c:1383
static av_cold int psy_3gpp_init(FFPsyContext *ctx)
Definition aacpsy.c:379
static av_cold void psy_3gpp_end(FFPsyContext *apc)
Definition aacpsy.c:1027

Definition at line 1437 of file aacpsy.c.

Referenced by ff_psy_init().