Debian Codegraph @

libairspyhf/src/iqbalancer.h

raw ◀ ▶
Source reconstructed at patch state 1 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 /*
2 Copyright (c) 2016-2023, Youssef Touil <[email protected]>
3 Copyright (c) 2018, Leif Asbrink <[email protected]>
4
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8
9 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
11 documentation and/or other materials provided with the distribution.
12 Neither the name of Airspy HF+ nor the names of its contributors may be used to endorse or promote products derived from this software
13 without specific prior written permission.
14
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
16 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
20 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 */
22
23 #ifndef __IQ_BALANCER_H__
24 #define __IQ_BALANCER_H__
25
26 #include "airspyhf.h"
27
28 #define FFTBins (4 * 1024)
29 #define BoostFactor 100000.0
30 #define BinsToOptimize (FFTBins/25)
31 #define EdgeBinsToSkip (FFTBins/22)
32 #define CenterBinsToSkip 2
33 #define MaxLookback 4
34 #define PhaseStep 1e-2f
35 #define AmplitudeStep 1e-2f
36 #define MaxMu 50.0f
37 #define MinDeltaMu 0.1f
38 #define DcTimeConst 1e-4f
39 #define MinimumPower 0.01f
40 #define PowerThreshold 0.5f
41 #define BuffersToSkipOnReset 2
42 #define MaxPowerDecay 0.98f
43 #define MaxPowerRatio 0.8f
44 #define BoostWindowNorm (MaxPowerRatio / 95)
45
46 #if defined(__arm__) && !defined(__force_hiq__)
47 #define BuffersToSkip 4
48 #define FFTIntegration 2
49 #define FFTOverlap 1
50 #define CorrelationIntegration 4
51 #else
52 #define BuffersToSkip 2
53 #define FFTIntegration 4
54 #define FFTOverlap 2
55 #define CorrelationIntegration 16
56 #endif
57
58 struct iq_balancer_t;
59
60 typedef airspyhf_complex_float_t complex_t;
61
62 ADDAPI struct iq_balancer_t * ADDCALL iq_balancer_create(float initial_phase, float initial_amplitude);
63 ADDAPI void ADDCALL iq_balancer_set_optimal_point(struct iq_balancer_t *iq_balancer, float w);
64 ADDAPI void ADDCALL iq_balancer_configure(struct iq_balancer_t *iq_balancer, int buffers_to_skip, int fft_integration, int fft_overlap, int correlation_integration);
65 ADDAPI void ADDCALL iq_balancer_process(struct iq_balancer_t *iq_balancer, complex_t* iq, int length);
66 ADDAPI void ADDCALL iq_balancer_destroy(struct iq_balancer_t *iq_balancer);
67
68 #endif