Debian Codegraph @

external/vorbis/vorbis_scales.h

raw symbols SCIP
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 https://xiph.org/ *
10 * *
11 ********************************************************************
12
13 function: linear scale -> dB, Bark and Mel scales
14
15 ********************************************************************/
16
17 #ifndef _vorbis_scales_h_
18 #define _vorbis_scales_h_cxx . . $ `external/vorbis/vorbis_scales.h:18:9`!
19
20 #include <math.h>
21 #include "vorbis_os.h"cxx . . $ `<file>/external/vorbis/vorbis_os.h`/
22
23 /* 20log10(x) */
24 #define VORBIS_IEEE_FLOAT32cxx . . $ `external/vorbis/vorbis_scales.h:24:9`! 1
25 #ifdef VORBIS_IEEE_FLOAT32cxx . . $ `external/vorbis/vorbis_scales.h:24:9`!
26
27 static inline float unitnormcxx . . $ unitnorm(fbcf3211dfe1bfd1).(float x){
28 unioncxx . . $ unitnorm(fbcf3211dfe1bfd1).$anonymous_type_0# {
29 ogg_uint32_tcxx . . $ ogg_uint32_t# icxx . . $ unitnorm(fbcf3211dfe1bfd1).$anonymous_type_0#i.;
30 float fcxx . . $ unitnorm(fbcf3211dfe1bfd1).$anonymous_type_0#f.;
31 } ix;
32 ix.fcxx . . $ unitnorm(fbcf3211dfe1bfd1).$anonymous_type_0#f. = x;
33 ix.icxx . . $ unitnorm(fbcf3211dfe1bfd1).$anonymous_type_0#i. = (ix.icxx . . $ unitnorm(fbcf3211dfe1bfd1).$anonymous_type_0#i. & 0x80000000U) | (0x3f800000U);
34 return ix.fcxx . . $ unitnorm(fbcf3211dfe1bfd1).$anonymous_type_0#f.;
35 }
36
37 /* Segher was off (too high) by ~ .3 decibel. Center the conversion correctly. */
38 static inline float todBcxx . . $ todB(bdb257eee332afa4).(const float *x){
39 unioncxx . . $ todB(bdb257eee332afa4).$anonymous_type_1# {
40 ogg_uint32_tcxx . . $ ogg_uint32_t# icxx . . $ todB(bdb257eee332afa4).$anonymous_type_1#i.;
41 float fcxx . . $ todB(bdb257eee332afa4).$anonymous_type_1#f.;
42 } ix;
43 ix.fcxx . . $ todB(bdb257eee332afa4).$anonymous_type_1#f. = *x;
44 ix.icxx . . $ todB(bdb257eee332afa4).$anonymous_type_1#i. = ix.icxx . . $ todB(bdb257eee332afa4).$anonymous_type_1#i.&0x7fffffff;
45 return (float)(ix.icxx . . $ todB(bdb257eee332afa4).$anonymous_type_1#i. * 7.17711438e-7f -764.6161886f);
46 }
47
48 #define todB_nncxx . . $ `external/vorbis/vorbis_scales.h:48:9`!(x) todB(x)
49
50 #else
51
52 static float unitnorm(float x){
53 if(x<0)return(-1.f);
54 return(1.f);
55 }
56
57 #define todB(x) (*(x)==0?-400.f:log(*(x)**(x))*4.34294480f)
58 #define todB_nn(x) (*(x)==0.f?-400.f:log(*(x))*8.6858896f)
59
60 #endif
61
62 #define fromdBcxx . . $ `external/vorbis/vorbis_scales.h:62:9`!(x) (exp((x)*.11512925f))
63
64 /* The bark scale equations are approximations, since the original
65 table was somewhat hand rolled. The below are chosen to have the
66 best possible fit to the rolled tables, thus their somewhat odd
67 appearance (these are more accurate and over a longer range than
68 the oft-quoted bark equations found in the texts I have). The
69 approximations are valid from 0 - 30kHz (nyquist) or so.
70
71 all f in Hz, z in Bark */
72
73 #define toBARKcxx . . $ `external/vorbis/vorbis_scales.h:73:9`!(n) (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n))
74 #define fromBARKcxx . . $ `external/vorbis/vorbis_scales.h:74:9`!(z) (102.f*(z)-2.f*pow(z,2.f)+.4f*pow(z,3.f)+pow(1.46f,z)-1.f)
75 #define toMELcxx . . $ `external/vorbis/vorbis_scales.h:75:9`!(n) (log(1.f+(n)*.001f)*1442.695f)
76 #define fromMELcxx . . $ `external/vorbis/vorbis_scales.h:76:9`!(m) (1000.f*exp((m)/1442.695f)-1000.f)
77
78 /* Frequency to octave. We arbitrarily declare 63.5 Hz to be octave
79 0.0 */
80
81 #define toOCcxx . . $ `external/vorbis/vorbis_scales.h:81:9`!(n) (log(n)*1.442695f-5.965784f)
82 #define fromOCcxx . . $ `external/vorbis/vorbis_scales.h:82:9`!(o) (exp(((o)+5.965784f)*.693147f))
83
84 #endif