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.23 2001/09/01 06:14:50 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 #define NOISE_COMPAND_LEVELS 40
65 typedef struct vorbis_info_psy{
73 vp_attenblock *toneatt;
77 vp_attenblock *peakatt;
86 float noiseoff[P_BANDS];
92 vp_couple_pass *couple_pass;
98 int eighth_octave_lines;
100 /* for block long/short tuning; encode only */
102 float preecho_thresh[4];
103 float postecho_thresh[4];
104 float preecho_minenergy;
106 float ampmax_att_per_sec;
108 /* delay caching... how many samples to keep around prior to our
109 current block to aid in analysis? */
111 } vorbis_info_psy_global;
119 vorbis_info_psy_global *gi;
120 } vorbis_look_psy_global;
125 struct vorbis_info_psy *vi;
132 long *octave; /* in n.ocshift format */
137 int eighth_octave_lines; /* power of two, please */
138 int total_octave_lines;
139 long rate; /* cache it */
142 extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
143 vorbis_info_psy_global *gi,int n,long rate);
144 extern void _vp_psy_clear(vorbis_look_psy *p);
145 extern void *_vi_psy_dup(void *source);
147 extern void _vi_psy_free(vorbis_info_psy *i);
148 extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
150 extern void _vp_remove_floor(vorbis_look_psy *p,
151 vorbis_look_psy_global *g,
156 float local_specmax);
158 extern void _vp_compute_mask(vorbis_look_psy *p,
159 vorbis_look_psy_global *g,
164 float global_specmax,
168 extern void _vp_quantize_couple(vorbis_look_psy *p,
169 vorbis_info_mapping0 *vi,
176 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);