zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
psy.h
Go to the documentation of this file.
1 /********************************************************************
2  * *
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. *
7  * *
8  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
9  * by the Xiph.Org Foundation http://www.xiph.org/ *
10  * *
11  ********************************************************************
12 
13  function: random psychoacoustics (not including preecho)
14  last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $
15 
16  ********************************************************************/
17 
18 #ifndef _V_PSY_H_
19 #define _V_PSY_H_
20 #include "smallft.h"
21 
22 #include "backends.h"
23 #include "envelope.h"
24 
25 #ifndef EHMER_MAX
26 #define EHMER_MAX 56
27 #endif
28 
29 /* psychoacoustic setup ********************************************/
30 #define P_BANDS 17 /* 62Hz to 16kHz */
31 #define P_LEVELS 8 /* 30dB to 100dB */
32 #define P_LEVEL_0 30. /* 30 dB */
33 #define P_NOISECURVES 3
34 
35 #define NOISE_COMPAND_LEVELS 40
36 typedef struct vorbis_info_psy{
37  int blockflag;
38 
39  float ath_adjatt;
40  float ath_maxatt;
41 
44  float tone_decay;
46  float toneatt[P_BANDS];
47 
49  float noisemaxsupp;
57 
58  float max_curve_dB;
59 
60  int normal_p;
63  double normal_thresh;
65 
66 typedef struct{
68 
69  /* for block long/short tuning; encode only */
70  float preecho_thresh[VE_BANDS];
71  float postecho_thresh[VE_BANDS];
74 
76 
77  /* channel coupling config */
78  int coupling_pkHz[PACKETBLOBS];
79  int coupling_pointlimit[2][PACKETBLOBS];
80  int coupling_prepointamp[PACKETBLOBS];
81  int coupling_postpointamp[PACKETBLOBS];
82  int sliding_lowpass[2][PACKETBLOBS];
83 
85 
86 typedef struct {
87  float ampmax;
88  int channels;
89 
91  int coupling_pointlimit[2][P_NOISECURVES];
93 
94 
95 typedef struct {
96  int n;
98 
99  float ***tonecurves;
100  float **noiseoffset;
101 
102  float *ath;
103  long *octave; /* in n.ocshift format */
104  long *bark;
105 
106  long firstoc;
107  long shiftoc;
108  int eighth_octave_lines; /* power of two, please */
110  long rate; /* cache it */
111 
112  float m_val; /* Masking compensation value */
113 
115 
117  vorbis_info_psy_global *gi,int n,long rate);
118 extern void _vp_psy_clear(vorbis_look_psy *p);
119 extern void *_vi_psy_dup(void *source);
120 
121 extern void _vi_psy_free(vorbis_info_psy *i);
123 
124 extern void _vp_noisemask(vorbis_look_psy *p,
125  float *logmdct,
126  float *logmask);
127 
128 extern void _vp_tonemask(vorbis_look_psy *p,
129  float *logfft,
130  float *logmask,
131  float global_specmax,
132  float local_specmax);
133 
135  float *noise,
136  float *tone,
137  int offset_select,
138  float *logmask,
139  float *mdct,
140  float *logmdct);
141 
142 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
143 
144 extern void _vp_couple_quantize_normalize(int blobno,
148  float **mdct,
149  int **iwork,
150  int *nonzero,
151  int sliding_lowpass,
152  int ch);
153 
154 #endif
#define PACKETBLOBS
void _vp_tonemask(vorbis_look_psy *p, float *logfft, float *logmask, float global_specmax, float local_specmax)
Definition: psy.c:747
float ** noiseoffset
Definition: psy.h:100
vorbis_info_psy * _vi_psy_copy(vorbis_info_psy *i)
#define VE_BANDS
Definition: envelope.h:28
float ath_adjatt
Definition: psy.h:39
GLboolean GLboolean g
Definition: glew.h:8736
float * ath
Definition: psy.h:102
int noisewindowlomin
Definition: psy.h:52
long * bark
Definition: psy.h:104
GLclampd n
Definition: glew.h:7287
void _vp_offset_and_mix(vorbis_look_psy *p, float *noise, float *tone, int offset_select, float *logmask, float *mdct, float *logmdct)
Definition: psy.c:772
float _vp_ampmax_decay(float amp, vorbis_dsp_state *vd)
Definition: psy.c:830
int noisewindowhimin
Definition: psy.h:53
float noisewindowhi
Definition: psy.h:51
long rate
Definition: psy.h:110
int eighth_octave_lines
Definition: psy.h:67
#define P_BANDS
Definition: psy.h:30
float tone_centerboost
Definition: psy.h:43
long firstoc
Definition: psy.h:106
float noisemaxsupp
Definition: psy.h:49
int normal_p
Definition: psy.h:60
long * octave
Definition: psy.h:103
struct vorbis_info_psy * vi
Definition: psy.h:97
float noiseoff[P_NOISECURVES][P_BANDS]
Definition: psy.h:55
float ath_maxatt
Definition: psy.h:40
void _vp_couple_quantize_normalize(int blobno, vorbis_info_psy_global *g, vorbis_look_psy *p, vorbis_info_mapping0 *vi, float **mdct, int **iwork, int *nonzero, int sliding_lowpass, int ch)
Definition: psy.c:1007
double normal_thresh
Definition: psy.h:63
vorbis_info_psy_global * gi
Definition: psy.h:90
float noisewindowlo
Definition: psy.h:50
float *** tonecurves
Definition: psy.h:99
float ampmax_att_per_sec
Definition: psy.h:75
void _vp_psy_clear(vorbis_look_psy *p)
Definition: psy.c:361
void _vp_psy_init(vorbis_look_psy *p, vorbis_info_psy *vi, vorbis_info_psy_global *gi, int n, long rate)
Definition: psy.c:267
int blockflag
Definition: psy.h:37
int noisemaskp
Definition: psy.h:48
GLfloat GLfloat p
Definition: glew.h:14938
int normal_partition
Definition: psy.h:62
#define NOISE_COMPAND_LEVELS
Definition: psy.h:35
#define P_NOISECURVES
Definition: psy.h:33
void _vi_psy_free(vorbis_info_psy *i)
Definition: psy.c:62
long shiftoc
Definition: psy.h:107
float noisecompand[NOISE_COMPAND_LEVELS]
Definition: psy.h:56
int eighth_octave_lines
Definition: psy.h:108
float tone_decay
Definition: psy.h:44
int noisewindowfixed
Definition: psy.h:54
float toneatt[P_BANDS]
Definition: psy.h:46
XVisualInfo * vi
float tone_masteratt[P_NOISECURVES]
Definition: psy.h:42
struct vorbis_info_psy vorbis_info_psy
float tone_abs_limit
Definition: psy.h:45
void * _vi_psy_dup(void *source)
int i
Definition: pngrutil.c:1377
float preecho_minenergy
Definition: psy.h:73
float max_curve_dB
Definition: psy.h:58
void _vp_noisemask(vorbis_look_psy *p, float *logmdct, float *logmask)
Definition: psy.c:699
float m_val
Definition: psy.h:112
GLsizei GLsizei GLchar * source
Definition: gl2ext.h:994
int total_octave_lines
Definition: psy.h:109
float stretch_penalty
Definition: psy.h:72
int normal_start
Definition: psy.h:61