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 https://xiph.org/ *
11 ********************************************************************
13 function: random psychoacoustics (not including preecho)
15 ********************************************************************/
28 /* psychoacoustic setup ********************************************/
29 #define P_BANDS 17 /* 62Hz to 16kHz */
30 #define P_LEVELS 8 /* 30dB to 100dB */
31 #define P_LEVEL_0 30. /* 30 dB */
32 #define P_NOISECURVES 3
34 #define NOISE_COMPAND_LEVELS 40
35 typedef struct vorbis_info_psy{
41 float tone_masteratt[P_NOISECURVES];
42 float tone_centerboost;
45 float toneatt[P_BANDS];
54 float noiseoff[P_NOISECURVES][P_BANDS];
55 float noisecompand[NOISE_COMPAND_LEVELS];
66 int eighth_octave_lines;
68 /* for block long/short tuning; encode only */
69 float preecho_thresh[VE_BANDS];
70 float postecho_thresh[VE_BANDS];
71 float stretch_penalty;
72 float preecho_minenergy;
74 float ampmax_att_per_sec;
76 /* channel coupling config */
77 int coupling_pkHz[PACKETBLOBS];
78 int coupling_pointlimit[2][PACKETBLOBS];
79 int coupling_prepointamp[PACKETBLOBS];
80 int coupling_postpointamp[PACKETBLOBS];
81 int sliding_lowpass[2][PACKETBLOBS];
83 } vorbis_info_psy_global;
89 vorbis_info_psy_global *gi;
90 int coupling_pointlimit[2][P_NOISECURVES];
91 } vorbis_look_psy_global;
96 struct vorbis_info_psy *vi;
102 long *octave; /* in n.ocshift format */
107 int eighth_octave_lines; /* power of two, please */
108 int total_octave_lines;
109 long rate; /* cache it */
111 float m_val; /* Masking compensation value */
115 extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
116 vorbis_info_psy_global *gi,int n,long rate);
117 extern void _vp_psy_clear(vorbis_look_psy *p);
118 extern void *_vi_psy_dup(void *source);
120 extern void _vi_psy_free(vorbis_info_psy *i);
121 extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
123 extern void _vp_noisemask(vorbis_look_psy *p,
127 extern void _vp_tonemask(vorbis_look_psy *p,
130 float global_specmax,
131 float local_specmax);
133 extern void _vp_offset_and_mix(vorbis_look_psy *p,
141 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
143 extern void _vp_couple_quantize_normalize(int blobno,
144 vorbis_info_psy_global *g,
146 vorbis_info_mapping0 *vi,