nuclear@1: /******************************************************************** nuclear@1: * * nuclear@1: * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * nuclear@1: * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * nuclear@1: * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * nuclear@1: * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * nuclear@1: * * nuclear@1: * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * nuclear@1: * by the Xiph.Org Foundation http://www.xiph.org/ * nuclear@1: * * nuclear@1: ******************************************************************** nuclear@1: nuclear@1: function: random psychoacoustics (not including preecho) nuclear@1: last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $ nuclear@1: nuclear@1: ********************************************************************/ nuclear@1: nuclear@1: #ifndef _V_PSY_H_ nuclear@1: #define _V_PSY_H_ nuclear@1: #include "smallft.h" nuclear@1: nuclear@1: #include "backends.h" nuclear@1: #include "envelope.h" nuclear@1: nuclear@1: #ifndef EHMER_MAX nuclear@1: #define EHMER_MAX 56 nuclear@1: #endif nuclear@1: nuclear@1: /* psychoacoustic setup ********************************************/ nuclear@1: #define P_BANDS 17 /* 62Hz to 16kHz */ nuclear@1: #define P_LEVELS 8 /* 30dB to 100dB */ nuclear@1: #define P_LEVEL_0 30. /* 30 dB */ nuclear@1: #define P_NOISECURVES 3 nuclear@1: nuclear@1: #define NOISE_COMPAND_LEVELS 40 nuclear@1: typedef struct vorbis_info_psy{ nuclear@1: int blockflag; nuclear@1: nuclear@1: float ath_adjatt; nuclear@1: float ath_maxatt; nuclear@1: nuclear@1: float tone_masteratt[P_NOISECURVES]; nuclear@1: float tone_centerboost; nuclear@1: float tone_decay; nuclear@1: float tone_abs_limit; nuclear@1: float toneatt[P_BANDS]; nuclear@1: nuclear@1: int noisemaskp; nuclear@1: float noisemaxsupp; nuclear@1: float noisewindowlo; nuclear@1: float noisewindowhi; nuclear@1: int noisewindowlomin; nuclear@1: int noisewindowhimin; nuclear@1: int noisewindowfixed; nuclear@1: float noiseoff[P_NOISECURVES][P_BANDS]; nuclear@1: float noisecompand[NOISE_COMPAND_LEVELS]; nuclear@1: nuclear@1: float max_curve_dB; nuclear@1: nuclear@1: int normal_p; nuclear@1: int normal_start; nuclear@1: int normal_partition; nuclear@1: double normal_thresh; nuclear@1: } vorbis_info_psy; nuclear@1: nuclear@1: typedef struct{ nuclear@1: int eighth_octave_lines; nuclear@1: nuclear@1: /* for block long/short tuning; encode only */ nuclear@1: float preecho_thresh[VE_BANDS]; nuclear@1: float postecho_thresh[VE_BANDS]; nuclear@1: float stretch_penalty; nuclear@1: float preecho_minenergy; nuclear@1: nuclear@1: float ampmax_att_per_sec; nuclear@1: nuclear@1: /* channel coupling config */ nuclear@1: int coupling_pkHz[PACKETBLOBS]; nuclear@1: int coupling_pointlimit[2][PACKETBLOBS]; nuclear@1: int coupling_prepointamp[PACKETBLOBS]; nuclear@1: int coupling_postpointamp[PACKETBLOBS]; nuclear@1: int sliding_lowpass[2][PACKETBLOBS]; nuclear@1: nuclear@1: } vorbis_info_psy_global; nuclear@1: nuclear@1: typedef struct { nuclear@1: float ampmax; nuclear@1: int channels; nuclear@1: nuclear@1: vorbis_info_psy_global *gi; nuclear@1: int coupling_pointlimit[2][P_NOISECURVES]; nuclear@1: } vorbis_look_psy_global; nuclear@1: nuclear@1: nuclear@1: typedef struct { nuclear@1: int n; nuclear@1: struct vorbis_info_psy *vi; nuclear@1: nuclear@1: float ***tonecurves; nuclear@1: float **noiseoffset; nuclear@1: nuclear@1: float *ath; nuclear@1: long *octave; /* in n.ocshift format */ nuclear@1: long *bark; nuclear@1: nuclear@1: long firstoc; nuclear@1: long shiftoc; nuclear@1: int eighth_octave_lines; /* power of two, please */ nuclear@1: int total_octave_lines; nuclear@1: long rate; /* cache it */ nuclear@1: nuclear@1: float m_val; /* Masking compensation value */ nuclear@1: nuclear@1: } vorbis_look_psy; nuclear@1: nuclear@1: extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, nuclear@1: vorbis_info_psy_global *gi,int n,long rate); nuclear@1: extern void _vp_psy_clear(vorbis_look_psy *p); nuclear@1: extern void *_vi_psy_dup(void *source); nuclear@1: nuclear@1: extern void _vi_psy_free(vorbis_info_psy *i); nuclear@1: extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i); nuclear@1: nuclear@1: extern void _vp_noisemask(vorbis_look_psy *p, nuclear@1: float *logmdct, nuclear@1: float *logmask); nuclear@1: nuclear@1: extern void _vp_tonemask(vorbis_look_psy *p, nuclear@1: float *logfft, nuclear@1: float *logmask, nuclear@1: float global_specmax, nuclear@1: float local_specmax); nuclear@1: nuclear@1: extern void _vp_offset_and_mix(vorbis_look_psy *p, nuclear@1: float *noise, nuclear@1: float *tone, nuclear@1: int offset_select, nuclear@1: float *logmask, nuclear@1: float *mdct, nuclear@1: float *logmdct); nuclear@1: nuclear@1: extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd); nuclear@1: nuclear@1: extern void _vp_couple_quantize_normalize(int blobno, nuclear@1: vorbis_info_psy_global *g, nuclear@1: vorbis_look_psy *p, nuclear@1: vorbis_info_mapping0 *vi, nuclear@1: float **mdct, nuclear@1: int **iwork, nuclear@1: int *nonzero, nuclear@1: int sliding_lowpass, nuclear@1: int ch); nuclear@1: nuclear@1: #endif