summaryrefslogtreecommitdiff
path: root/lib/psy.h
diff options
context:
space:
mode:
authorMonty <xiphmont@xiph.org>2002-06-28 22:19:56 +0000
committerMonty <xiphmont@xiph.org>2002-06-28 22:19:56 +0000
commit0facd6654018ff525ab09290cd417ada62df3eae (patch)
tree1416f0631db0399a3e7fa3ee02639c8c2126c238 /lib/psy.h
parent53eb6a7cb991759d6f33f193489d6eedc2ad2b68 (diff)
downloadlibvorbis-git-0facd6654018ff525ab09290cd417ada62df3eae.tar.gz
The 'Grand Simplification' officially becomes the mainline toward rc4.
Currently, only 44/48kHz stereo is supported. svn path=/trunk/vorbis/; revision=3437
Diffstat (limited to 'lib/psy.h')
-rw-r--r--lib/psy.h150
1 files changed, 80 insertions, 70 deletions
diff --git a/lib/psy.h b/lib/psy.h
index 0844cef1..69d86940 100644
--- a/lib/psy.h
+++ b/lib/psy.h
@@ -11,7 +11,7 @@
********************************************************************
function: random psychoacoustics (not including preecho)
- last mod: $Id: psy.h,v 1.28 2002/03/29 07:10:39 xiphmont Exp $
+ last mod: $Id: psy.h,v 1.29 2002/06/28 22:19:37 xiphmont Exp $
********************************************************************/
@@ -27,46 +27,23 @@
#endif
/* psychoacoustic setup ********************************************/
-#define MAX_BARK 27
-#define P_BANDS 17
-#define P_LEVELS 11
-
-typedef struct vp_couple{
- int limit; /* sample post */
-
- int outofphase_redundant_flip_p;
- float outofphase_requant_limit;
-
- float amppost_point;
-
-} vp_couple;
-
-typedef struct vp_couple_pass{
- float granulem;
- float igranulem;
-
- vp_couple couple_pass[8];
-} vp_couple_pass;
-
-typedef struct vp_attenblock{
- float block[P_BANDS][P_LEVELS];
-} vp_attenblock;
+#define P_BANDS 17 /* 62Hz to 16kHz */
+#define P_LEVELS 8 /* 30dB to 100dB */
+#define P_LEVEL_0 30. /* 30 dB */
+#define P_NOISECURVES 3
#define NOISE_COMPAND_LEVELS 40
typedef struct vorbis_info_psy{
- float ath[27];
+ int blockflag;
- float ath_adjatt;
- float ath_maxatt;
+ float ath_adjatt;
+ float ath_maxatt;
- float tone_masteratt;
- float tone_guard;
+ float tone_masteratt[P_NOISECURVES];
+ float tone_centerboost;
+ float tone_decay;
float tone_abs_limit;
- vp_attenblock toneatt;
-
- int peakattp;
- int curvelimitp;
- vp_attenblock peakatt;
+ float toneatt[P_BANDS];
int noisemaskp;
float noisemaxsupp;
@@ -75,36 +52,44 @@ typedef struct vorbis_info_psy{
int noisewindowlomin;
int noisewindowhimin;
int noisewindowfixed;
- float noiseoff[P_BANDS];
+ float noiseoff[P_NOISECURVES][P_BANDS];
float noisecompand[NOISE_COMPAND_LEVELS];
float max_curve_dB;
- vp_couple_pass couple_pass[8];
-
+ int normal_channel_p;
+ int normal_point_p;
+ int normal_start;
+ int normal_partition;
+ double normal_thresh;
} vorbis_info_psy;
typedef struct{
- int eighth_octave_lines;
+ int eighth_octave_lines;
/* for block long/short tuning; encode only */
- float preecho_thresh[VE_BANDS];
- float postecho_thresh[VE_BANDS];
- float stretch_penalty;
- float preecho_minenergy;
+ float preecho_thresh[VE_BANDS];
+ float postecho_thresh[VE_BANDS];
+ float stretch_penalty;
+ float preecho_minenergy;
- float ampmax_att_per_sec;
+ float ampmax_att_per_sec;
+
+ /* channel coupling config */
+ int coupling_pkHz[PACKETBLOBS];
+ int coupling_pointlimit[2][PACKETBLOBS];
+ int coupling_prepointamp[PACKETBLOBS];
+ int coupling_postpointamp[PACKETBLOBS];
+ int sliding_lowpass[2][PACKETBLOBS];
- /* delay caching... how many samples to keep around prior to our
- current block to aid in analysis? */
- int delaycache;
} vorbis_info_psy_global;
typedef struct {
- float ampmax;
- int channels;
+ float ampmax;
+ int channels;
vorbis_info_psy_global *gi;
+ int coupling_pointlimit[2][P_NOISECURVES];
} vorbis_look_psy_global;
@@ -113,8 +98,7 @@ typedef struct {
struct vorbis_info_psy *vi;
float ***tonecurves;
- float *noisethresh;
- float *noiseoffset;
+ float **noiseoffset;
float *ath;
long *octave; /* in n.ocshift format */
@@ -137,27 +121,53 @@ extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
extern void _vp_remove_floor(vorbis_look_psy *p,
float *mdct,
- float *codedflr,
- float *residue);
-
-extern void _vp_compute_mask(vorbis_look_psy *p,
- float *fft,
- float *mdct,
- float *mask,
- float global_specmax,
- float local_specmax,
- float bitrate_noise_offset);
-
-extern void _vp_quantize_couple(vorbis_look_psy *p,
- vorbis_info_mapping0 *vi,
- float **pcm,
- float **sofar,
- float **quantized,
- int *nonzero,
- int passno);
+ int *icodedflr,
+ float *residue,
+ int sliding_lowpass);
+
+extern void _vp_noisemask(vorbis_look_psy *p,
+ float *logmdct,
+ float *logmask);
+
+extern void _vp_tonemask(vorbis_look_psy *p,
+ float *logfft,
+ float *logmask,
+ float global_specmax,
+ float local_specmax);
+
+extern void _vp_offset_and_mix(vorbis_look_psy *p,
+ float *noise,
+ float *tone,
+ int offset_select,
+ float *logmask);
extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
-#endif
+extern float **_vp_quantize_couple_memo(vorbis_block *vb,
+ vorbis_look_psy *p,
+ vorbis_info_mapping0 *vi,
+ float **mdct);
+
+extern void _vp_couple(int blobno,
+ vorbis_info_psy_global *g,
+ vorbis_look_psy *p,
+ vorbis_info_mapping0 *vi,
+ float **res,
+ float **mag_memo,
+ int **mag_sort,
+ int **ifloor,
+ int *nonzero);
+
+extern void _vp_noise_normalize(vorbis_look_psy *p,
+ float *in,float *out,int *sortedindex);
+extern void _vp_noise_normalize_sort(vorbis_look_psy *p,
+ float *magnitudes,int *sortedindex);
+
+extern int **_vp_quantize_couple_sort(vorbis_block *vb,
+ vorbis_look_psy *p,
+ vorbis_info_mapping0 *vi,
+ float **mags);
+
+#endif