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-2001 *
9 * by the XIPHOPHORUS Company http://www.xiph.org/ *
11 ********************************************************************
13 function: random psychoacoustics (not including preecho)
14 last mod: $Id: psy.h,v 1.22 2001/08/13 01:36:57 xiphmont Exp $
16 ********************************************************************/
24 #define BLOCKTYPE_IMPULSE 0
25 #define BLOCKTYPE_PADDING 1
26 #define BLOCKTYPE_TRANSITION 0
27 #define BLOCKTYPE_LONG 1
34 /* psychoacoustic setup ********************************************/
39 typedef struct vp_couple{
40 int limit; /* sample post */
53 typedef struct vp_couple_pass{
57 vp_couple couple_pass[8];
60 typedef struct vp_attenblock{
61 float block[P_BANDS][P_LEVELS];
64 typedef struct vorbis_info_psy{
70 /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 */
71 /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
72 /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
76 vp_attenblock *toneatt;
80 vp_attenblock *peakatt;
89 float noiseoff[P_BANDS];
90 float noisethresh[P_BANDS];
95 vp_couple_pass *couple_pass;
101 int eighth_octave_lines;
103 /* for block long/short tuning; encode only */
105 float preecho_thresh[4];
106 float postecho_thresh[4];
107 float preecho_minenergy;
109 float ampmax_att_per_sec;
111 /* delay caching... how many samples to keep around prior to our
112 current block to aid in analysis? */
114 } vorbis_info_psy_global;
122 vorbis_info_psy_global *gi;
123 } vorbis_look_psy_global;
128 struct vorbis_info_psy *vi;
135 long *octave; /* in n.ocshift format */
140 int eighth_octave_lines; /* power of two, please */
141 int total_octave_lines;
142 long rate; /* cache it */
145 extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
146 vorbis_info_psy_global *gi,int n,long rate);
147 extern void _vp_psy_clear(vorbis_look_psy *p);
148 extern void *_vi_psy_dup(void *source);
150 extern void _vi_psy_free(vorbis_info_psy *i);
151 extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
153 extern void _vp_remove_floor(vorbis_look_psy *p,
154 vorbis_look_psy_global *g,
159 float local_specmax);
161 extern void _vp_compute_mask(vorbis_look_psy *p,
162 vorbis_look_psy_global *g,
167 float global_specmax,
171 extern void _vp_quantize_couple(vorbis_look_psy *p,
172 vorbis_info_mapping0 *vi,
179 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);