annotate src/libvorbis-1.3.3/lib/psy.h @ 83:ae30d91d2ffe

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