#include <config.h>
#include "lame.h"
#include "machine.h"
#include "encoder.h"
#include "util.h"
#include "psymodel.h"
#include "lame_global_flags.h"
#include "fft.h"
#include "lame-analysis.h"
Include dependency graph for psymodel.c:
Go to the source code of this file.
Defines | |
#define | NSFIRLEN 21 |
#define | LN_TO_LOG10 (M_LN10/10) |
#define | NON_LINEAR_SCALE_ITEM(x) (x) |
#define | NON_LINEAR_SCALE_SUM(x) (x) |
#define | NON_LINEAR_SCALE_ENERGY(x) (x) |
#define | I1LIMIT 8 |
#define | I2LIMIT 23 |
#define | MLIMIT 15 |
#define | frame_duration (576. * gfc->mode_gr / sfreq) |
Functions | |
static FLOAT | psycho_loudness_approx (FLOAT const *energy, lame_internal_flags const *gfc) |
static void | compute_ffts (lame_global_flags const *gfp, FLOAT fftenergy[HBLKSIZE], FLOAT(*fftenergy_s)[HBLKSIZE_s], FLOAT(*wsamp_l)[BLKSIZE], FLOAT(*wsamp_s)[3][BLKSIZE_s], int gr_out, int chn, const sample_t *buffer[2]) |
static void | init_mask_add_max_values (void) |
static FLOAT | mask_add (FLOAT m1, FLOAT m2, int kk, int b, lame_internal_flags const *gfc, int shortblock) |
static void | calc_interchannel_masking (lame_global_flags const *gfp, FLOAT ratio) |
static void | msfix1 (lame_internal_flags *gfc) |
static void | ns_msfix (lame_internal_flags *gfc, FLOAT msfix, FLOAT athadjust) |
static void | convert_partition2scalefac_s (lame_internal_flags *gfc, FLOAT const *eb, FLOAT const *thr, int chn, int sblock) |
static void | convert_partition2scalefac_l (lame_internal_flags *gfc, FLOAT const *eb, FLOAT const *thr, int chn) |
static void | compute_masking_s (lame_global_flags const *gfp, FLOAT const(*fftenergy_s)[HBLKSIZE_s], FLOAT *eb, FLOAT *thr, int chn, int sblock) |
static void | block_type_set (lame_global_flags const *gfp, int *uselongblock, int *blocktype_d, int *blocktype) |
static void | determine_block_type (lame_global_flags const *gfp, FLOAT const fftenergy_s[3][HBLKSIZE_s], int uselongblock[], int chn, int gr_out, FLOAT *pe) |
int | L3psycho_anal (lame_global_flags const *gfp, const sample_t *buffer[2], int gr_out, FLOAT *ms_ratio, FLOAT *ms_ratio_next, III_psy_ratio masking_ratio[2][2], III_psy_ratio masking_MS_ratio[2][2], FLOAT percep_entropy[2], FLOAT percep_MS_entropy[2], FLOAT energy[4], int blocktype_d[2]) |
static FLOAT | NS_INTERP (FLOAT x, FLOAT y, FLOAT r) |
static FLOAT | pecalc_s (III_psy_ratio const *mr, FLOAT masking_lower) |
static FLOAT | pecalc_l (III_psy_ratio const *mr, FLOAT masking_lower) |
int | L3psycho_anal_ns (lame_global_flags const *gfp, const sample_t *buffer[2], int gr_out, III_psy_ratio masking_ratio[2][2], III_psy_ratio masking_MS_ratio[2][2], FLOAT percep_entropy[2], FLOAT percep_MS_entropy[2], FLOAT energy[4], int blocktype_d[2]) |
static FLOAT | s3_func (FLOAT bark) |
static int | init_numline (int *numlines, int *bo, int *bm, FLOAT *bval, FLOAT *bval_width, FLOAT *mld, FLOAT *bo_w, FLOAT sfreq, int blksize, int const *scalepos, FLOAT deltafreq, int sbmax) |
static int | init_s3_values (lame_global_flags const *gfp, FLOAT **p, int(*s3ind)[2], int npart, FLOAT const *bval, FLOAT const *bval_width, FLOAT const *norm) |
int | psymodel_init (lame_global_flags *gfp) |
Variables | |
static FLOAT | ma_max_i1 |
static FLOAT | ma_max_i2 |
static FLOAT | ma_max_m |
#define frame_duration (576. * gfc->mode_gr / sfreq) |
#define I1LIMIT 8 |
#define I2LIMIT 23 |
#define LN_TO_LOG10 (M_LN10/10) |
#define MLIMIT 15 |
#define NON_LINEAR_SCALE_ENERGY | ( | x | ) | (x) |
#define NON_LINEAR_SCALE_ITEM | ( | x | ) | (x) |
#define NON_LINEAR_SCALE_SUM | ( | x | ) | (x) |
#define NSFIRLEN 21 |
static void block_type_set | ( | lame_global_flags const * | gfp, | |
int * | uselongblock, | |||
int * | blocktype_d, | |||
int * | blocktype | |||
) | [static] |
Definition at line 771 of file psymodel.c.
References lame_internal_flags::blocktype_old, lame_internal_flags::channels_out, gfc, gfp, lame_global_struct::internal_flags, NORM_TYPE, short_block_coupled, short_block_dispensed, short_block_forced, lame_global_struct::short_blocks, SHORT_TYPE, START_TYPE, and STOP_TYPE.
static void calc_interchannel_masking | ( | lame_global_flags const * | gfp, | |
FLOAT | ratio | |||
) | [static] |
Definition at line 476 of file psymodel.c.
References lame_internal_flags::channels_out, gfc, gfp, lame_global_struct::internal_flags, III_psy_xmin::l, III_psy_xmin::s, SBMAX_l, SBMAX_s, and lame_internal_flags::thm.
static void compute_ffts | ( | lame_global_flags const * | gfp, | |
FLOAT | fftenergy[HBLKSIZE], | |||
FLOAT * | fftenergy_s[HBLKSIZE_s], | |||
FLOAT * | wsamp_l[BLKSIZE], | |||
FLOAT * | wsamp_s[3][BLKSIZE_s], | |||
int | gr_out, | |||
int | chn, | |||
const sample_t * | buffer[2] | |||
) | [static] |
Definition at line 250 of file psymodel.c.
References lame_global_struct::analysis, plotting_data::energy, plotting_data::energy_save, f, fft_long(), fft_short(), gfc, gfp, lame_global_struct::internal_flags, NON_LINEAR_SCALE_ENERGY, lame_internal_flags::pe, plotting_data::pe, lame_internal_flags::pinfo, SQRT2, and lame_internal_flags::tot_ener.
Referenced by L3psycho_anal(), and L3psycho_anal_ns().
Here is the call graph for this function:
static void compute_masking_s | ( | lame_global_flags const * | gfp, | |
FLOAT const * | fftenergy_s[HBLKSIZE_s], | |||
FLOAT * | eb, | |||
FLOAT * | thr, | |||
int | chn, | |||
int | sblock | |||
) | [static] |
Definition at line 692 of file psymodel.c.
References lame_internal_flags::blocktype_old, CBANDS, gfc, gfp, i, lame_global_struct::internal_flags, mask_add(), Min, lame_internal_flags::minval_s, lame_internal_flags::nb_s1, lame_internal_flags::nb_s2, lame_internal_flags::npart_s, lame_internal_flags::numlines_s, rpelev2_s, rpelev_s, lame_internal_flags::s3_ss, lame_internal_flags::s3ind_s, SHORT_TYPE, lame_global_struct::VBR, vbr_mt, and vbr_mtrh.
Referenced by L3psycho_anal(), and L3psycho_anal_ns().
Here is the call graph for this function:
static void convert_partition2scalefac_l | ( | lame_internal_flags * | gfc, | |
FLOAT const * | eb, | |||
FLOAT const * | thr, | |||
int | chn | |||
) | [static] |
Definition at line 647 of file psymodel.c.
References lame_internal_flags::bo_l, PSY_t::bo_l_weight, lame_internal_flags::en, gfc, III_psy_xmin::l, lame_internal_flags::npart_l, lame_internal_flags::PSY, SBMAX_l, and lame_internal_flags::thm.
Referenced by L3psycho_anal(), and L3psycho_anal_ns().
static void convert_partition2scalefac_s | ( | lame_internal_flags * | gfc, | |
FLOAT const * | eb, | |||
FLOAT const * | thr, | |||
int | chn, | |||
int | sblock | |||
) | [static] |
Definition at line 601 of file psymodel.c.
References lame_internal_flags::bo_s, PSY_t::bo_s_weight, lame_internal_flags::en, gfc, lame_internal_flags::npart_s, lame_internal_flags::PSY, III_psy_xmin::s, SBMAX_s, and lame_internal_flags::thm.
Referenced by L3psycho_anal(), and L3psycho_anal_ns().
static void determine_block_type | ( | lame_global_flags const * | gfp, | |
FLOAT const | fftenergy_s[3][HBLKSIZE_s], | |||
int | uselongblock[], | |||
int | chn, | |||
int | gr_out, | |||
FLOAT * | pe | |||
) | [static] |
Definition at line 815 of file psymodel.c.
References lame_global_struct::analysis, plotting_data::ers, plotting_data::ers_save, FAST_LOG_X, gfc, gfp, lame_global_struct::internal_flags, Max, Min, and lame_internal_flags::pinfo.
Referenced by L3psycho_anal(), and L3psycho_anal_ns().
static void init_mask_add_max_values | ( | void | ) | [static] |
static int init_numline | ( | int * | numlines, | |
int * | bo, | |||
int * | bm, | |||
FLOAT * | bval, | |||
FLOAT * | bval_width, | |||
FLOAT * | mld, | |||
FLOAT * | bo_w, | |||
FLOAT | sfreq, | |||
int | blksize, | |||
int const * | scalepos, | |||
FLOAT | deltafreq, | |||
int | sbmax | |||
) | [static] |
Definition at line 1925 of file psymodel.c.
References CBANDS, DELBARK, freq2bark(), i, Min, and PI.
Referenced by psymodel_init().
Here is the call graph for this function:
static int init_s3_values | ( | lame_global_flags const * | gfp, | |
FLOAT ** | p, | |||
int * | s3ind[2], | |||
int | npart, | |||
FLOAT const * | bval, | |||
FLOAT const * | bval_width, | |||
FLOAT const * | norm | |||
) | [static] |
Definition at line 2016 of file psymodel.c.
References CBANDS, f, gfp, i, s3_func(), lame_global_struct::VBR, vbr_mt, and vbr_mtrh.
Here is the call graph for this function:
int L3psycho_anal | ( | lame_global_flags const * | gfp, | |
const sample_t * | buffer[2], | |||
int | gr_out, | |||
FLOAT * | ms_ratio, | |||
FLOAT * | ms_ratio_next, | |||
III_psy_ratio | masking_ratio[2][2], | |||
III_psy_ratio | masking_MS_ratio[2][2], | |||
FLOAT | percep_entropy[2], | |||
FLOAT | percep_MS_entropy[2], | |||
FLOAT | energy[4], | |||
int | blocktype_d[2] | |||
) |
Definition at line 865 of file psymodel.c.
References ATH_t::adjust, lame_internal_flags::ATH, lame_internal_flags::ax_sav, BLKSIZE, BLKSIZE_s, lame_internal_flags::blocktype_old, lame_internal_flags::bx_sav, ATH_t::cb_l, CBANDS, lame_internal_flags::channels_out, compute_ffts(), compute_masking_s(), CONV1, CONV2, convert_partition2scalefac_l(), convert_partition2scalefac_s(), lame_internal_flags::cw, CW_LOWER_INDEX, lame_internal_flags::cw_upper_index, determine_block_type(), lame_internal_flags::en, III_psy_ratio::en, f, FAST_LOG, FAST_LOG_X, gfc, gfp, i, lame_global_struct::internal_flags, JOINT_STEREO, LN_TO_LOG10, Max, Min, lame_internal_flags::minval_l, lame_global_struct::mode, lame_internal_flags::nb_1, lame_internal_flags::nb_2, NMT, NON_LINEAR_SCALE_ITEM, NON_LINEAR_SCALE_SUM, lame_internal_flags::npart_l, lame_internal_flags::npart_s, lame_internal_flags::numlines_l, lame_internal_flags::pe, rpelev, rpelev2, lame_internal_flags::rx_sav, lame_internal_flags::s3_ll, lame_internal_flags::s3ind, SHORT_TYPE, lame_internal_flags::thm, III_psy_ratio::thm, TMN, lame_internal_flags::tot_ener, lame_global_struct::VBR, vbr_mt, and vbr_mtrh.
Referenced by lame_encode_mp3_frame().
Here is the call graph for this function:
int L3psycho_anal_ns | ( | lame_global_flags const * | gfp, | |
const sample_t * | buffer[2], | |||
int | gr_out, | |||
III_psy_ratio | masking_ratio[2][2], | |||
III_psy_ratio | masking_MS_ratio[2][2], | |||
FLOAT | percep_entropy[2], | |||
FLOAT | percep_MS_entropy[2], | |||
FLOAT | energy[4], | |||
int | blocktype_d[2] | |||
) |
Definition at line 1376 of file psymodel.c.
References lame_global_struct::analysis, nsPsy_t::attackthre, nsPsy_t::attackthre_s, BLKSIZE, BLKSIZE_s, lame_internal_flags::blocktype_old, CBANDS, lame_internal_flags::channels_out, compute_ffts(), compute_masking_s(), convert_partition2scalefac_l(), convert_partition2scalefac_s(), determine_block_type(), lame_internal_flags::en, III_psy_ratio::en, plotting_data::ers, plotting_data::ers_save, f, FAST_LOG, gfc, gfp, i, lame_global_struct::internal_flags, JOINT_STEREO, nsPsy_t::last_attacks, nsPsy_t::last_en_subshort, mask_add(), Min, lame_internal_flags::minval_l, lame_global_struct::mode, lame_internal_flags::nb_1, lame_internal_flags::nb_2, lame_internal_flags::npart_l, lame_internal_flags::npart_s, NS_INTERP(), NS_PREECHO_ATT0, NS_PREECHO_ATT1, NS_PREECHO_ATT2, NSFIRLEN, lame_internal_flags::nsPsy, lame_internal_flags::numlines_l, lame_internal_flags::pinfo, lame_internal_flags::ResvMax, lame_internal_flags::ResvSize, lame_internal_flags::rnumlines_l, rpelev, rpelev2, III_psy_xmin::s, lame_internal_flags::s3_ll, lame_internal_flags::s3ind, SHORT_TYPE, lame_internal_flags::thm, III_psy_ratio::thm, lame_internal_flags::tot_ener, lame_global_struct::VBR, vbr_mt, vbr_mtrh, vbr_off, and vbr_rh.
Referenced by lame_encode_mp3_frame().
Here is the call graph for this function:
static FLOAT mask_add | ( | FLOAT | m1, | |
FLOAT | m2, | |||
int | kk, | |||
int | b, | |||
lame_internal_flags const * | gfc, | |||
int | shortblock | |||
) | [inline, static] |
Definition at line 367 of file psymodel.c.
References ATH_t::adjust, lame_internal_flags::ATH, ATH_t::cb_l, ATH_t::cb_s, f, FAST_LOG10_X, gfc, and i.
Referenced by compute_masking_s(), and L3psycho_anal_ns().
static void msfix1 | ( | lame_internal_flags * | gfc | ) | [static] |
Definition at line 505 of file psymodel.c.
References lame_internal_flags::en, gfc, III_psy_xmin::l, Max, Min, lame_internal_flags::mld_l, lame_internal_flags::mld_s, III_psy_xmin::s, SBMAX_l, SBMAX_s, and lame_internal_flags::thm.
static void ns_msfix | ( | lame_internal_flags * | gfc, | |
FLOAT | msfix, | |||
FLOAT | athadjust | |||
) | [static] |
Definition at line 549 of file psymodel.c.
References lame_internal_flags::ATH, BLKSIZE_s, lame_internal_flags::bm_l, lame_internal_flags::bm_s, ATH_t::cb_l, ATH_t::cb_s, f, gfc, III_psy_xmin::l, Max, Min, III_psy_xmin::s, SBMAX_l, SBMAX_s, and lame_internal_flags::thm.
static FLOAT pecalc_l | ( | III_psy_ratio const * | mr, | |
FLOAT | masking_lower | |||
) | [static] |
Definition at line 1328 of file psymodel.c.
References III_psy_ratio::en, FAST_LOG10, III_psy_xmin::l, LOG10, and III_psy_ratio::thm.
static FLOAT pecalc_s | ( | III_psy_ratio const * | mr, | |
FLOAT | masking_lower | |||
) | [static] |
Definition at line 1287 of file psymodel.c.
References III_psy_ratio::en, FAST_LOG10, LOG10, III_psy_xmin::s, and III_psy_ratio::thm.
static FLOAT psycho_loudness_approx | ( | FLOAT const * | energy, | |
lame_internal_flags const * | gfc | |||
) | [static] |
Definition at line 235 of file psymodel.c.
References lame_internal_flags::ATH, BLKSIZE, ATH_t::eql_w, gfc, i, and VO_SCALE.
int psymodel_init | ( | lame_global_flags * | gfp | ) |
Definition at line 2075 of file psymodel.c.
References BLKSIZE, lame_internal_flags::blocktype_old, lame_internal_flags::bm_l, lame_internal_flags::bo_l, PSY_t::bo_l_weight, CBANDS, lame_internal_flags::cw, CW_LOWER_INDEX, lame_internal_flags::cw_upper_index, PSY_t::cwlimit, lame_internal_flags::en, gfc, gfp, i, init_numline(), lame_global_struct::internal_flags, III_psy_xmin::l, scalefac_struct::l, nsPsy_t::last_attacks, nsPsy_t::last_en_subshort, lame_internal_flags::loudness_sq_save, lame_internal_flags::mld_l, lame_internal_flags::ms_ener_ratio_old, lame_internal_flags::nb_1, lame_internal_flags::nb_2, lame_internal_flags::nb_s1, lame_internal_flags::nb_s2, NORM_TYPE, lame_internal_flags::npart_l, lame_internal_flags::nsPsy, lame_internal_flags::numlines_l, lame_global_struct::out_samplerate, lame_internal_flags::PSY, lame_internal_flags::rnumlines_l, III_psy_xmin::s, lame_internal_flags::scalefac_band, and lame_internal_flags::thm.
Referenced by lame_init_params().
Here is the call graph for this function:
Definition at line 348 of file psymodel.c.
Definition at line 349 of file psymodel.c.
Definition at line 350 of file psymodel.c.