dbf-halloween2015
diff libs/vorbis/psy.h @ 1:c3f5c32cb210
barfed all the libraries in the source tree to make porting easier
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 01 Nov 2015 00:36:56 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libs/vorbis/psy.h Sun Nov 01 00:36:56 2015 +0200 1.3 @@ -0,0 +1,154 @@ 1.4 +/******************************************************************** 1.5 + * * 1.6 + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * 1.7 + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * 1.8 + * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * 1.9 + * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * 1.10 + * * 1.11 + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * 1.12 + * by the Xiph.Org Foundation http://www.xiph.org/ * 1.13 + * * 1.14 + ******************************************************************** 1.15 + 1.16 + function: random psychoacoustics (not including preecho) 1.17 + last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $ 1.18 + 1.19 + ********************************************************************/ 1.20 + 1.21 +#ifndef _V_PSY_H_ 1.22 +#define _V_PSY_H_ 1.23 +#include "smallft.h" 1.24 + 1.25 +#include "backends.h" 1.26 +#include "envelope.h" 1.27 + 1.28 +#ifndef EHMER_MAX 1.29 +#define EHMER_MAX 56 1.30 +#endif 1.31 + 1.32 +/* psychoacoustic setup ********************************************/ 1.33 +#define P_BANDS 17 /* 62Hz to 16kHz */ 1.34 +#define P_LEVELS 8 /* 30dB to 100dB */ 1.35 +#define P_LEVEL_0 30. /* 30 dB */ 1.36 +#define P_NOISECURVES 3 1.37 + 1.38 +#define NOISE_COMPAND_LEVELS 40 1.39 +typedef struct vorbis_info_psy{ 1.40 + int blockflag; 1.41 + 1.42 + float ath_adjatt; 1.43 + float ath_maxatt; 1.44 + 1.45 + float tone_masteratt[P_NOISECURVES]; 1.46 + float tone_centerboost; 1.47 + float tone_decay; 1.48 + float tone_abs_limit; 1.49 + float toneatt[P_BANDS]; 1.50 + 1.51 + int noisemaskp; 1.52 + float noisemaxsupp; 1.53 + float noisewindowlo; 1.54 + float noisewindowhi; 1.55 + int noisewindowlomin; 1.56 + int noisewindowhimin; 1.57 + int noisewindowfixed; 1.58 + float noiseoff[P_NOISECURVES][P_BANDS]; 1.59 + float noisecompand[NOISE_COMPAND_LEVELS]; 1.60 + 1.61 + float max_curve_dB; 1.62 + 1.63 + int normal_p; 1.64 + int normal_start; 1.65 + int normal_partition; 1.66 + double normal_thresh; 1.67 +} vorbis_info_psy; 1.68 + 1.69 +typedef struct{ 1.70 + int eighth_octave_lines; 1.71 + 1.72 + /* for block long/short tuning; encode only */ 1.73 + float preecho_thresh[VE_BANDS]; 1.74 + float postecho_thresh[VE_BANDS]; 1.75 + float stretch_penalty; 1.76 + float preecho_minenergy; 1.77 + 1.78 + float ampmax_att_per_sec; 1.79 + 1.80 + /* channel coupling config */ 1.81 + int coupling_pkHz[PACKETBLOBS]; 1.82 + int coupling_pointlimit[2][PACKETBLOBS]; 1.83 + int coupling_prepointamp[PACKETBLOBS]; 1.84 + int coupling_postpointamp[PACKETBLOBS]; 1.85 + int sliding_lowpass[2][PACKETBLOBS]; 1.86 + 1.87 +} vorbis_info_psy_global; 1.88 + 1.89 +typedef struct { 1.90 + float ampmax; 1.91 + int channels; 1.92 + 1.93 + vorbis_info_psy_global *gi; 1.94 + int coupling_pointlimit[2][P_NOISECURVES]; 1.95 +} vorbis_look_psy_global; 1.96 + 1.97 + 1.98 +typedef struct { 1.99 + int n; 1.100 + struct vorbis_info_psy *vi; 1.101 + 1.102 + float ***tonecurves; 1.103 + float **noiseoffset; 1.104 + 1.105 + float *ath; 1.106 + long *octave; /* in n.ocshift format */ 1.107 + long *bark; 1.108 + 1.109 + long firstoc; 1.110 + long shiftoc; 1.111 + int eighth_octave_lines; /* power of two, please */ 1.112 + int total_octave_lines; 1.113 + long rate; /* cache it */ 1.114 + 1.115 + float m_val; /* Masking compensation value */ 1.116 + 1.117 +} vorbis_look_psy; 1.118 + 1.119 +extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, 1.120 + vorbis_info_psy_global *gi,int n,long rate); 1.121 +extern void _vp_psy_clear(vorbis_look_psy *p); 1.122 +extern void *_vi_psy_dup(void *source); 1.123 + 1.124 +extern void _vi_psy_free(vorbis_info_psy *i); 1.125 +extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i); 1.126 + 1.127 +extern void _vp_noisemask(vorbis_look_psy *p, 1.128 + float *logmdct, 1.129 + float *logmask); 1.130 + 1.131 +extern void _vp_tonemask(vorbis_look_psy *p, 1.132 + float *logfft, 1.133 + float *logmask, 1.134 + float global_specmax, 1.135 + float local_specmax); 1.136 + 1.137 +extern void _vp_offset_and_mix(vorbis_look_psy *p, 1.138 + float *noise, 1.139 + float *tone, 1.140 + int offset_select, 1.141 + float *logmask, 1.142 + float *mdct, 1.143 + float *logmdct); 1.144 + 1.145 +extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd); 1.146 + 1.147 +extern void _vp_couple_quantize_normalize(int blobno, 1.148 + vorbis_info_psy_global *g, 1.149 + vorbis_look_psy *p, 1.150 + vorbis_info_mapping0 *vi, 1.151 + float **mdct, 1.152 + int **iwork, 1.153 + int *nonzero, 1.154 + int sliding_lowpass, 1.155 + int ch); 1.156 + 1.157 +#endif