libavcodec/aacpsy.c File Reference

AAC encoder psychoacoustic model. More...

#include "avcodec.h"
#include "aactab.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...

Defines

#define ATH_ADD   4
#define PSY_3GPP_SPREAD_HI   1.5f
 constants for 3GPP AAC psychoacoustic model
#define PSY_3GPP_SPREAD_LOW   3.0f
#define PSY_3GPP_RPEMIN   0.01f
#define PSY_3GPP_RPELEV   2.0f
#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   3
 Number of sub-blocks in each short block.

Functions

static float lame_calc_attack_threshold (int bitrate)
 calculates the attack threshold for ABR from the above table for the LAME psy model
static void lame_window_init (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 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 void psy_3gpp_analyze (FFPsyContext *ctx, int channel, const float *coefs, const FFPsyWindowInfo *wi)
 Calculate band thresholds as suggested in 3GPP TS26.403.
static av_cold void psy_3gpp_end (FFPsyContext *apc)
static void lame_apply_block_type (AacPsyChannel *ctx, FFPsyWindowInfo *wi, int uselongblock)
static FFPsyWindowInfo psy_lame_window (FFPsyContext *ctx, const int16_t *audio, const int16_t *la, int channel, int prev_type)

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


Detailed Description

AAC encoder psychoacoustic model.

Definition in file aacpsy.c.


Define Documentation

#define AAC_BLOCK_SIZE_LONG   1024

long block size

Definition at line 50 of file aacpsy.c.

#define AAC_BLOCK_SIZE_SHORT   128

short block size

Definition at line 51 of file aacpsy.c.

#define AAC_NUM_BLOCKS_SHORT   8

number of blocks in a short sequence

Definition at line 52 of file aacpsy.c.

Referenced by lame_window_init(), and psy_lame_window().

#define ATH_ADD   4

Definition at line 221 of file aacpsy.c.

Referenced by psy_3gpp_init().

#define PSY_3GPP_RPELEV   2.0f

Definition at line 46 of file aacpsy.c.

Referenced by psy_3gpp_analyze().

#define PSY_3GPP_RPEMIN   0.01f

Definition at line 45 of file aacpsy.c.

Referenced by psy_3gpp_analyze().

#define PSY_3GPP_SPREAD_HI   1.5f

constants for 3GPP AAC psychoacoustic model

Definition at line 42 of file aacpsy.c.

Referenced by psy_3gpp_init().

#define PSY_3GPP_SPREAD_LOW   3.0f

Definition at line 43 of file aacpsy.c.

Referenced by psy_3gpp_init().

#define PSY_LAME_FIR_LEN   21

LAME psy model FIR order.

Definition at line 49 of file aacpsy.c.

#define PSY_LAME_NUM_SUBBLOCKS   3

Number of sub-blocks in each short block.

Definition at line 53 of file aacpsy.c.

Referenced by lame_window_init().


Function Documentation

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

Calculate ATH value for given frequency.

Borrowed from Lame.

Definition at line 226 of file aacpsy.c.

Referenced by psy_3gpp_init().

static av_cold float calc_bark ( float  f  )  [static]

Calculate Bark value for given line.

Definition at line 216 of file aacpsy.c.

Referenced by psy_3gpp_init().

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

IIR filter used in block switching decision.

Definition at line 280 of file aacpsy.c.

Referenced by psy_3gpp_window().

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

Definition at line 439 of file aacpsy.c.

static float lame_calc_attack_threshold ( int  bitrate  )  [static]

calculates the attack threshold for ABR from the above table for the LAME psy model

Definition at line 167 of file aacpsy.c.

Referenced by lame_window_init().

static void lame_window_init ( AacPsyContext ctx,
AVCodecContext avctx 
) [static]

LAME psy model specific initialization.

Definition at line 197 of file aacpsy.c.

Referenced by psy_3gpp_init().

static void psy_3gpp_analyze ( FFPsyContext ctx,
int  channel,
const float *  coefs,
const FFPsyWindowInfo wi 
) [static]

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

Definition at line 389 of file aacpsy.c.

static av_cold void psy_3gpp_end ( FFPsyContext apc  )  [static]

Definition at line 432 of file aacpsy.c.

static av_cold int psy_3gpp_init ( FFPsyContext ctx  )  [static]

Definition at line 235 of file aacpsy.c.

static 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 301 of file aacpsy.c.

static FFPsyWindowInfo psy_lame_window ( FFPsyContext ctx,
const int16_t *  audio,
const int16_t *  la,
int  channel,
int  prev_type 
) [static]

Definition at line 457 of file aacpsy.c.


Variable Documentation

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,
}

Definition at line 619 of file aacpsy.c.

const PsyLamePreset psy_abr_map[] [static]

Initial value:

 {


    {  8,  6.60},
    { 16,  6.60},
    { 24,  6.60},
    { 32,  6.60},
    { 40,  6.60},
    { 48,  6.60},
    { 56,  6.60},
    { 64,  6.40},
    { 80,  6.00},
    { 96,  5.60},
    {112,  5.20},
    {128,  5.20},
    {160,  5.20}
}
LAME psy model preset table for ABR.

Definition at line 119 of file aacpsy.c.

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 158 of file aacpsy.c.

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 140 of file aacpsy.c.

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 293 of file aacpsy.c.

Referenced by psy_3gpp_window().


Generated on Mon May 2 19:50:14 2011 for FFmpeg by  doxygen 1.5.6