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.27 2001/12/20 01:00:29 segher Exp $
16 ********************************************************************/
28 /* psychoacoustic setup ********************************************/
33 typedef struct vp_couple{
34 int limit; /* sample post */
36 int outofphase_redundant_flip_p;
37 float outofphase_requant_limit;
43 typedef struct vp_couple_pass{
47 vp_couple couple_pass[8];
50 typedef struct vp_attenblock{
51 float block[P_BANDS][P_LEVELS];
54 #define NOISE_COMPAND_LEVELS 40
55 typedef struct vorbis_info_psy{
64 vp_attenblock toneatt;
68 vp_attenblock peakatt;
77 float noiseoff[P_BANDS];
78 float noisecompand[NOISE_COMPAND_LEVELS];
82 vp_couple_pass couple_pass[8];
87 int eighth_octave_lines;
89 /* for block long/short tuning; encode only */
90 float preecho_thresh[4];
91 float postecho_thresh[4];
92 float preecho_minenergy;
94 float ampmax_att_per_sec;
96 /* delay caching... how many samples to keep around prior to our
97 current block to aid in analysis? */
99 } vorbis_info_psy_global;
105 vorbis_info_psy_global *gi;
106 } vorbis_look_psy_global;
111 struct vorbis_info_psy *vi;
118 long *octave; /* in n.ocshift format */
123 int eighth_octave_lines; /* power of two, please */
124 int total_octave_lines;
125 long rate; /* cache it */
128 extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
129 vorbis_info_psy_global *gi,int n,long rate);
130 extern void _vp_psy_clear(vorbis_look_psy *p);
131 extern void *_vi_psy_dup(void *source);
133 extern void _vi_psy_free(vorbis_info_psy *i);
134 extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
136 extern void _vp_remove_floor(vorbis_look_psy *p,
141 extern void _vp_compute_mask(vorbis_look_psy *p,
145 float global_specmax,
147 float bitrate_noise_offset);
149 extern void _vp_quantize_couple(vorbis_look_psy *p,
150 vorbis_info_mapping0 *vi,
157 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);