UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
aru.h
1 /* aru.h */
2 /* $Id: aru.h,v 1.5 2009/03/19 15:56:15 vlad Exp $ */
3 #ifndef __aru_h
4 #define __aru_h
5 
6 
7 #ifdef GE_BUILD
8 #define Fortran(x) x##_
9 #else
10 #include <mix/Types.h>
11 #endif
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif /* __cplusplus */
16 
17 
18 /***********************************************************************
19  * Automatic gain control for trace a[] to trace b[] with computation
20  * for destination trace of maximum amplitude and maximum of average
21  * amplitude in gap window. Amplitudes in b[] are ~10000.
22  * Parameters:
23  * int n - count of samples in a[] and b[];
24  * float a[] - input trace;
25  * float b[] - output trace (may be a[] to compute in-place);
26  * int w - width of gap window in samples (must be w < n);
27  * float *pBmax - optional maximum amplitude of b[] (absolute);
28  * float *pBavg - optional average amplitude of b[] (absolute).
29  ***********************************************************************/
30 void LightARU (int n, float a[], float b[], int w,
31  float* pBmax, float* pBavg);
32 
33 /***********************************************************************
34  * Automatic gain control for trace a[] to trace b[] with computation
35  * for destination trace of maximum amplitude and maximum of average
36  * amplitude in gap window. Amplitudes in b[] are ~10000.
37  * Parameters:
38  * int n - count of samples in a[] and b[];
39  * float a[] - input trace;
40  * float b[] - output trace (may be a[] to compute in-place);
41  * int w - width of gap window in samples (must be w < n);
42  * agcDynamicAmplify - AGC dynamic amplify koefficient (0..1);
43  * float *pBmax - optional maximum amplitude of b[] (absolute);
44  * float *pBavg - optional average amplitude of b[] (absolute).
45  ***********************************************************************/
46  void DynAmplLightARU (int n, float a[], float b[], int w, float agcDynamicAmplify,
47  float* pBmax, float* pBavg);
48 
49 /***********************************************************************
50  Automatic gain control procedure.
51  Input parameters:
52  A(N) - input vector of samples;
53  N - sample count;
54  M - half of AGC gap (2*M<N);
55  AT - desirable average amplitude in resulting vector;
56  EPS - dynamic emphasisity of trace fading (0..1);
57  Output parameters:
58  B(N) - resulting vector of samples (can be A());
59  BMAX - maximum among absolute amplitudes in B();
60  BAVG - average among absolute amplitudes in B();
61  ***********************************************************************/
62 void Fortran(aru)(const float A[], float B[],
63  const int* N, const int* M,
64  const float* AT, const float* EPS,
65  const float* BMAX, const float* BAVG);
66 
67 /***********************************************************************
68  Weight function calculation for automatic gain control procedure.
69  Input parameters:
70  A(N) - input vector of samples;
71  N - sample count;
72  M - half of AGC gap (2*M<N);
73  EPS - dynamic emphasisity of trace fading (0..1);
74  Output parameters:
75  W(N) - resulting vector of weight function;
76  WMAX - maximum among all W(1)..W(N)
77  ***********************************************************************/
78  void Fortran(aruwf)(const float A[], float W[], float* WMAX,
79  const int* N, const int* M, const float* EPS);
80 
81 /***********************************************************************
82  Compute absolute maximum of the vector.
83  Input parameters:
84  a[n] - input vector of samples;
85  n - sample count;
86  Output parameters:
87  amgl - absolute maximum among a(i), 0<=i<n
88  ***********************************************************************/
89 void Fortran(vmxabs)(const float a[], const int* n, float* amgl);
90 
91 /***********************************************************************
92  Compute minimum and maximum value of the vector.
93  Input parameters:
94  a(n) - input vector of samples;
95  n - sample count;
96  Output parameters:
97  mm[0] - minimum value
98  mm[1] - maximum value
99  ***********************************************************************/
100 void Fortran(vminmax)(const float a[], const int* n, float mm[2]);
101 
102 
103 #ifdef __cplusplus
104 };
105 #endif /* __cplusplus */
106 
107 #endif /* aru.h */