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.28 2002/03/29 07:10:39 xiphmont Exp $
16 ********************************************************************/
29 /* psychoacoustic setup ********************************************/
34 typedef struct vp_couple{
35 int limit; /* sample post */
37 int outofphase_redundant_flip_p;
38 float outofphase_requant_limit;
44 typedef struct vp_couple_pass{
48 vp_couple couple_pass[8];
51 typedef struct vp_attenblock{
52 float block[P_BANDS][P_LEVELS];
55 #define NOISE_COMPAND_LEVELS 40
56 typedef struct vorbis_info_psy{
65 vp_attenblock toneatt;
69 vp_attenblock peakatt;
78 float noiseoff[P_BANDS];
79 float noisecompand[NOISE_COMPAND_LEVELS];
83 vp_couple_pass couple_pass[8];
88 int eighth_octave_lines;
90 /* for block long/short tuning; encode only */
91 float preecho_thresh[VE_BANDS];
92 float postecho_thresh[VE_BANDS];
93 float stretch_penalty;
94 float preecho_minenergy;
96 float ampmax_att_per_sec;
98 /* delay caching... how many samples to keep around prior to our
99 current block to aid in analysis? */
101 } vorbis_info_psy_global;
107 vorbis_info_psy_global *gi;
108 } vorbis_look_psy_global;
113 struct vorbis_info_psy *vi;
120 long *octave; /* in n.ocshift format */
125 int eighth_octave_lines; /* power of two, please */
126 int total_octave_lines;
127 long rate; /* cache it */
130 extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
131 vorbis_info_psy_global *gi,int n,long rate);
132 extern void _vp_psy_clear(vorbis_look_psy *p);
133 extern void *_vi_psy_dup(void *source);
135 extern void _vi_psy_free(vorbis_info_psy *i);
136 extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
138 extern void _vp_remove_floor(vorbis_look_psy *p,
143 extern void _vp_compute_mask(vorbis_look_psy *p,
147 float global_specmax,
149 float bitrate_noise_offset);
151 extern void _vp_quantize_couple(vorbis_look_psy *p,
152 vorbis_info_mapping0 *vi,
159 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);