media/libvorbis/lib/psy.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial