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.24 2001/09/11 05:06: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 */
48 typedef struct vp_couple_pass{
52 vp_couple couple_pass[8];
55 typedef struct vp_attenblock{
56 float block[P_BANDS][P_LEVELS];
59 #define NOISE_COMPAND_LEVELS 40
60 typedef struct vorbis_info_psy{
69 vp_attenblock *toneatt;
73 vp_attenblock *peakatt;
82 float noiseoff[P_BANDS];
88 vp_couple_pass *couple_pass;
94 int eighth_octave_lines;
96 /* for block long/short tuning; encode only */
98 float preecho_thresh[4];
99 float postecho_thresh[4];
100 float preecho_minenergy;
102 float ampmax_att_per_sec;
104 /* delay caching... how many samples to keep around prior to our
105 current block to aid in analysis? */
107 } vorbis_info_psy_global;
115 vorbis_info_psy_global *gi;
116 } vorbis_look_psy_global;
121 struct vorbis_info_psy *vi;
128 long *octave; /* in n.ocshift format */
133 int eighth_octave_lines; /* power of two, please */
134 int total_octave_lines;
135 long rate; /* cache it */
138 extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
139 vorbis_info_psy_global *gi,int n,long rate);
140 extern void _vp_psy_clear(vorbis_look_psy *p);
141 extern void *_vi_psy_dup(void *source);
143 extern void _vi_psy_free(vorbis_info_psy *i);
144 extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
146 extern void _vp_remove_floor(vorbis_look_psy *p,
147 vorbis_look_psy_global *g,
152 float local_specmax);
154 extern void _vp_compute_mask(vorbis_look_psy *p,
155 vorbis_look_psy_global *g,
160 float global_specmax,
164 extern void _vp_quantize_couple(vorbis_look_psy *p,
165 vorbis_info_mapping0 *vi,
172 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);