rev |
line source |
nuclear@1
|
1 /********************************************************************
|
nuclear@1
|
2 * *
|
nuclear@1
|
3 * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
nuclear@1
|
4 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
nuclear@1
|
5 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
nuclear@1
|
6 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
nuclear@1
|
7 * *
|
nuclear@1
|
8 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
nuclear@1
|
9 * by the Xiph.Org Foundation http://www.xiph.org/ *
|
nuclear@1
|
10 * *
|
nuclear@1
|
11 ********************************************************************
|
nuclear@1
|
12
|
nuclear@1
|
13 function: random psychoacoustics (not including preecho)
|
nuclear@1
|
14 last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $
|
nuclear@1
|
15
|
nuclear@1
|
16 ********************************************************************/
|
nuclear@1
|
17
|
nuclear@1
|
18 #ifndef _V_PSY_H_
|
nuclear@1
|
19 #define _V_PSY_H_
|
nuclear@1
|
20 #include "smallft.h"
|
nuclear@1
|
21
|
nuclear@1
|
22 #include "backends.h"
|
nuclear@1
|
23 #include "envelope.h"
|
nuclear@1
|
24
|
nuclear@1
|
25 #ifndef EHMER_MAX
|
nuclear@1
|
26 #define EHMER_MAX 56
|
nuclear@1
|
27 #endif
|
nuclear@1
|
28
|
nuclear@1
|
29 /* psychoacoustic setup ********************************************/
|
nuclear@1
|
30 #define P_BANDS 17 /* 62Hz to 16kHz */
|
nuclear@1
|
31 #define P_LEVELS 8 /* 30dB to 100dB */
|
nuclear@1
|
32 #define P_LEVEL_0 30. /* 30 dB */
|
nuclear@1
|
33 #define P_NOISECURVES 3
|
nuclear@1
|
34
|
nuclear@1
|
35 #define NOISE_COMPAND_LEVELS 40
|
nuclear@1
|
36 typedef struct vorbis_info_psy{
|
nuclear@1
|
37 int blockflag;
|
nuclear@1
|
38
|
nuclear@1
|
39 float ath_adjatt;
|
nuclear@1
|
40 float ath_maxatt;
|
nuclear@1
|
41
|
nuclear@1
|
42 float tone_masteratt[P_NOISECURVES];
|
nuclear@1
|
43 float tone_centerboost;
|
nuclear@1
|
44 float tone_decay;
|
nuclear@1
|
45 float tone_abs_limit;
|
nuclear@1
|
46 float toneatt[P_BANDS];
|
nuclear@1
|
47
|
nuclear@1
|
48 int noisemaskp;
|
nuclear@1
|
49 float noisemaxsupp;
|
nuclear@1
|
50 float noisewindowlo;
|
nuclear@1
|
51 float noisewindowhi;
|
nuclear@1
|
52 int noisewindowlomin;
|
nuclear@1
|
53 int noisewindowhimin;
|
nuclear@1
|
54 int noisewindowfixed;
|
nuclear@1
|
55 float noiseoff[P_NOISECURVES][P_BANDS];
|
nuclear@1
|
56 float noisecompand[NOISE_COMPAND_LEVELS];
|
nuclear@1
|
57
|
nuclear@1
|
58 float max_curve_dB;
|
nuclear@1
|
59
|
nuclear@1
|
60 int normal_p;
|
nuclear@1
|
61 int normal_start;
|
nuclear@1
|
62 int normal_partition;
|
nuclear@1
|
63 double normal_thresh;
|
nuclear@1
|
64 } vorbis_info_psy;
|
nuclear@1
|
65
|
nuclear@1
|
66 typedef struct{
|
nuclear@1
|
67 int eighth_octave_lines;
|
nuclear@1
|
68
|
nuclear@1
|
69 /* for block long/short tuning; encode only */
|
nuclear@1
|
70 float preecho_thresh[VE_BANDS];
|
nuclear@1
|
71 float postecho_thresh[VE_BANDS];
|
nuclear@1
|
72 float stretch_penalty;
|
nuclear@1
|
73 float preecho_minenergy;
|
nuclear@1
|
74
|
nuclear@1
|
75 float ampmax_att_per_sec;
|
nuclear@1
|
76
|
nuclear@1
|
77 /* channel coupling config */
|
nuclear@1
|
78 int coupling_pkHz[PACKETBLOBS];
|
nuclear@1
|
79 int coupling_pointlimit[2][PACKETBLOBS];
|
nuclear@1
|
80 int coupling_prepointamp[PACKETBLOBS];
|
nuclear@1
|
81 int coupling_postpointamp[PACKETBLOBS];
|
nuclear@1
|
82 int sliding_lowpass[2][PACKETBLOBS];
|
nuclear@1
|
83
|
nuclear@1
|
84 } vorbis_info_psy_global;
|
nuclear@1
|
85
|
nuclear@1
|
86 typedef struct {
|
nuclear@1
|
87 float ampmax;
|
nuclear@1
|
88 int channels;
|
nuclear@1
|
89
|
nuclear@1
|
90 vorbis_info_psy_global *gi;
|
nuclear@1
|
91 int coupling_pointlimit[2][P_NOISECURVES];
|
nuclear@1
|
92 } vorbis_look_psy_global;
|
nuclear@1
|
93
|
nuclear@1
|
94
|
nuclear@1
|
95 typedef struct {
|
nuclear@1
|
96 int n;
|
nuclear@1
|
97 struct vorbis_info_psy *vi;
|
nuclear@1
|
98
|
nuclear@1
|
99 float ***tonecurves;
|
nuclear@1
|
100 float **noiseoffset;
|
nuclear@1
|
101
|
nuclear@1
|
102 float *ath;
|
nuclear@1
|
103 long *octave; /* in n.ocshift format */
|
nuclear@1
|
104 long *bark;
|
nuclear@1
|
105
|
nuclear@1
|
106 long firstoc;
|
nuclear@1
|
107 long shiftoc;
|
nuclear@1
|
108 int eighth_octave_lines; /* power of two, please */
|
nuclear@1
|
109 int total_octave_lines;
|
nuclear@1
|
110 long rate; /* cache it */
|
nuclear@1
|
111
|
nuclear@1
|
112 float m_val; /* Masking compensation value */
|
nuclear@1
|
113
|
nuclear@1
|
114 } vorbis_look_psy;
|
nuclear@1
|
115
|
nuclear@1
|
116 extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
|
nuclear@1
|
117 vorbis_info_psy_global *gi,int n,long rate);
|
nuclear@1
|
118 extern void _vp_psy_clear(vorbis_look_psy *p);
|
nuclear@1
|
119 extern void *_vi_psy_dup(void *source);
|
nuclear@1
|
120
|
nuclear@1
|
121 extern void _vi_psy_free(vorbis_info_psy *i);
|
nuclear@1
|
122 extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
|
nuclear@1
|
123
|
nuclear@1
|
124 extern void _vp_noisemask(vorbis_look_psy *p,
|
nuclear@1
|
125 float *logmdct,
|
nuclear@1
|
126 float *logmask);
|
nuclear@1
|
127
|
nuclear@1
|
128 extern void _vp_tonemask(vorbis_look_psy *p,
|
nuclear@1
|
129 float *logfft,
|
nuclear@1
|
130 float *logmask,
|
nuclear@1
|
131 float global_specmax,
|
nuclear@1
|
132 float local_specmax);
|
nuclear@1
|
133
|
nuclear@1
|
134 extern void _vp_offset_and_mix(vorbis_look_psy *p,
|
nuclear@1
|
135 float *noise,
|
nuclear@1
|
136 float *tone,
|
nuclear@1
|
137 int offset_select,
|
nuclear@1
|
138 float *logmask,
|
nuclear@1
|
139 float *mdct,
|
nuclear@1
|
140 float *logmdct);
|
nuclear@1
|
141
|
nuclear@1
|
142 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
|
nuclear@1
|
143
|
nuclear@1
|
144 extern void _vp_couple_quantize_normalize(int blobno,
|
nuclear@1
|
145 vorbis_info_psy_global *g,
|
nuclear@1
|
146 vorbis_look_psy *p,
|
nuclear@1
|
147 vorbis_info_mapping0 *vi,
|
nuclear@1
|
148 float **mdct,
|
nuclear@1
|
149 int **iwork,
|
nuclear@1
|
150 int *nonzero,
|
nuclear@1
|
151 int sliding_lowpass,
|
nuclear@1
|
152 int ch);
|
nuclear@1
|
153
|
nuclear@1
|
154 #endif
|