1 /********************************************************************
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
11 ********************************************************************
13 function: random psychoacoustics (not including preecho)
14 last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $
16 ********************************************************************/
29 /* psychoacoustic setup ********************************************/
30 #define P_BANDS 17 /* 62Hz to 16kHz */
31 #define P_LEVELS 8 /* 30dB to 100dB */
32 #define P_LEVEL_0 30. /* 30 dB */
33 #define P_NOISECURVES 3
35 #define NOISE_COMPAND_LEVELS 40
36 typedef struct vorbis_info_psy{
42 float tone_masteratt[P_NOISECURVES];
43 float tone_centerboost;
46 float toneatt[P_BANDS];
55 float noiseoff[P_NOISECURVES][P_BANDS];
56 float noisecompand[NOISE_COMPAND_LEVELS];
67 int eighth_octave_lines;
69 /* for block long/short tuning; encode only */
70 float preecho_thresh[VE_BANDS];
71 float postecho_thresh[VE_BANDS];
72 float stretch_penalty;
73 float preecho_minenergy;
75 float ampmax_att_per_sec;
77 /* channel coupling config */
78 int coupling_pkHz[PACKETBLOBS];
79 int coupling_pointlimit[2][PACKETBLOBS];
80 int coupling_prepointamp[PACKETBLOBS];
81 int coupling_postpointamp[PACKETBLOBS];
82 int sliding_lowpass[2][PACKETBLOBS];
84 } vorbis_info_psy_global;
90 vorbis_info_psy_global *gi;
91 int coupling_pointlimit[2][P_NOISECURVES];
92 } vorbis_look_psy_global;
97 struct vorbis_info_psy *vi;
103 long *octave; /* in n.ocshift format */
108 int eighth_octave_lines; /* power of two, please */
109 int total_octave_lines;
110 long rate; /* cache it */
112 float m_val; /* Masking compensation value */
116 extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
117 vorbis_info_psy_global *gi,int n,long rate);
118 extern void _vp_psy_clear(vorbis_look_psy *p);
119 extern void *_vi_psy_dup(void *source);
121 extern void _vi_psy_free(vorbis_info_psy *i);
122 extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
124 extern void _vp_noisemask(vorbis_look_psy *p,
128 extern void _vp_tonemask(vorbis_look_psy *p,
131 float global_specmax,
132 float local_specmax);
134 extern void _vp_offset_and_mix(vorbis_look_psy *p,
142 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
144 extern void _vp_couple_quantize_normalize(int blobno,
145 vorbis_info_psy_global *g,
147 vorbis_info_mapping0 *vi,