Fix DC offset, lower noise floor even more
This commit is contained in:
parent
15f05f2e4e
commit
5e841595f3
4 changed files with 62 additions and 101 deletions
1
grc/.gitignore
vendored
Normal file
1
grc/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/*.py
|
35
grc/base.grc
35
grc/base.grc
|
@ -11,7 +11,7 @@ options:
|
||||||
gen_linking: dynamic
|
gen_linking: dynamic
|
||||||
generate_options: qt_gui
|
generate_options: qt_gui
|
||||||
hier_block_src_path: '.:'
|
hier_block_src_path: '.:'
|
||||||
id: file
|
id: base
|
||||||
max_nouts: '0'
|
max_nouts: '0'
|
||||||
output_language: python
|
output_language: python
|
||||||
placement: (0,0)
|
placement: (0,0)
|
||||||
|
@ -53,7 +53,7 @@ blocks:
|
||||||
comment: ''
|
comment: ''
|
||||||
maxoutbuf: '0'
|
maxoutbuf: '0'
|
||||||
minoutbuf: '0'
|
minoutbuf: '0'
|
||||||
scale: '128'
|
scale: '127'
|
||||||
vlen: '1'
|
vlen: '1'
|
||||||
states:
|
states:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
|
@ -119,24 +119,6 @@ blocks:
|
||||||
coordinate: [592, 72.0]
|
coordinate: [592, 72.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: enabled
|
state: enabled
|
||||||
- name: dc_blocker_xx_0
|
|
||||||
id: dc_blocker_xx
|
|
||||||
parameters:
|
|
||||||
affinity: ''
|
|
||||||
alias: ''
|
|
||||||
comment: ''
|
|
||||||
length: '256'
|
|
||||||
long_form: 'True'
|
|
||||||
maxoutbuf: '0'
|
|
||||||
minoutbuf: '0'
|
|
||||||
type: ff
|
|
||||||
states:
|
|
||||||
bus_sink: false
|
|
||||||
bus_source: false
|
|
||||||
bus_structure: null
|
|
||||||
coordinate: [592, 272.0]
|
|
||||||
rotation: 0
|
|
||||||
state: enabled
|
|
||||||
- name: qtgui_freq_sink_x_0
|
- name: qtgui_freq_sink_x_0
|
||||||
id: qtgui_freq_sink_x
|
id: qtgui_freq_sink_x
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -153,7 +135,7 @@ blocks:
|
||||||
alpha8: '1.0'
|
alpha8: '1.0'
|
||||||
alpha9: '1.0'
|
alpha9: '1.0'
|
||||||
autoscale: 'False'
|
autoscale: 'False'
|
||||||
average: '0.2'
|
average: '1.0'
|
||||||
axislabels: 'True'
|
axislabels: 'True'
|
||||||
bw: samp_rate
|
bw: samp_rate
|
||||||
color1: '"blue"'
|
color1: '"blue"'
|
||||||
|
@ -210,7 +192,7 @@ blocks:
|
||||||
width9: '1'
|
width9: '1'
|
||||||
wintype: window.WIN_BLACKMAN_hARRIS
|
wintype: window.WIN_BLACKMAN_hARRIS
|
||||||
ymax: '0'
|
ymax: '0'
|
||||||
ymin: '-120'
|
ymin: '-140'
|
||||||
states:
|
states:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
|
@ -349,7 +331,7 @@ blocks:
|
||||||
grid: 'False'
|
grid: 'False'
|
||||||
gui_hint: ''
|
gui_hint: ''
|
||||||
int_max: '0'
|
int_max: '0'
|
||||||
int_min: '-120'
|
int_min: '-140'
|
||||||
label1: ''
|
label1: ''
|
||||||
label10: ''
|
label10: ''
|
||||||
label2: ''
|
label2: ''
|
||||||
|
@ -379,12 +361,11 @@ blocks:
|
||||||
|
|
||||||
connections:
|
connections:
|
||||||
- [blocks_char_to_float_0, '0', blocks_probe_rate_0, '0']
|
- [blocks_char_to_float_0, '0', blocks_probe_rate_0, '0']
|
||||||
- [blocks_char_to_float_0, '0', dc_blocker_xx_0, '0']
|
- [blocks_char_to_float_0, '0', qtgui_freq_sink_x_0, '0']
|
||||||
|
- [blocks_char_to_float_0, '0', qtgui_time_sink_x_0, '0']
|
||||||
|
- [blocks_char_to_float_0, '0', qtgui_waterfall_sink_x_0, '0']
|
||||||
- [blocks_file_source_0, '0', blocks_char_to_float_0, '0']
|
- [blocks_file_source_0, '0', blocks_char_to_float_0, '0']
|
||||||
- [blocks_probe_rate_0, rate, blocks_message_debug_0, print]
|
- [blocks_probe_rate_0, rate, blocks_message_debug_0, print]
|
||||||
- [dc_blocker_xx_0, '0', qtgui_freq_sink_x_0, '0']
|
|
||||||
- [dc_blocker_xx_0, '0', qtgui_time_sink_x_0, '0']
|
|
||||||
- [dc_blocker_xx_0, '0', qtgui_waterfall_sink_x_0, '0']
|
|
||||||
|
|
||||||
metadata:
|
metadata:
|
||||||
file_format: 1
|
file_format: 1
|
||||||
|
|
|
@ -11,7 +11,7 @@ options:
|
||||||
gen_linking: dynamic
|
gen_linking: dynamic
|
||||||
generate_options: qt_gui
|
generate_options: qt_gui
|
||||||
hier_block_src_path: '.:'
|
hier_block_src_path: '.:'
|
||||||
id: file
|
id: ir38
|
||||||
max_nouts: '0'
|
max_nouts: '0'
|
||||||
output_language: python
|
output_language: python
|
||||||
placement: (0,0)
|
placement: (0,0)
|
||||||
|
@ -49,7 +49,7 @@ blocks:
|
||||||
id: variable
|
id: variable
|
||||||
parameters:
|
parameters:
|
||||||
comment: ''
|
comment: ''
|
||||||
value: '64'
|
value: '32'
|
||||||
states:
|
states:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
|
@ -77,7 +77,7 @@ blocks:
|
||||||
comment: ''
|
comment: ''
|
||||||
maxoutbuf: '0'
|
maxoutbuf: '0'
|
||||||
minoutbuf: '0'
|
minoutbuf: '0'
|
||||||
scale: '128'
|
scale: '127'
|
||||||
vlen: '1'
|
vlen: '1'
|
||||||
states:
|
states:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
|
@ -86,8 +86,8 @@ blocks:
|
||||||
coordinate: [224, 280.0]
|
coordinate: [224, 280.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: enabled
|
state: enabled
|
||||||
- name: blocks_complex_to_mag_0
|
- name: blocks_complex_to_mag_squared_0
|
||||||
id: blocks_complex_to_mag
|
id: blocks_complex_to_mag_squared
|
||||||
parameters:
|
parameters:
|
||||||
affinity: ''
|
affinity: ''
|
||||||
alias: ''
|
alias: ''
|
||||||
|
@ -99,7 +99,7 @@ blocks:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
bus_structure: null
|
bus_structure: null
|
||||||
coordinate: [960, 448.0]
|
coordinate: [928, 448.0]
|
||||||
rotation: 180
|
rotation: 180
|
||||||
state: enabled
|
state: enabled
|
||||||
- name: blocks_file_source_0
|
- name: blocks_file_source_0
|
||||||
|
@ -154,7 +154,7 @@ blocks:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
bus_structure: null
|
bus_structure: null
|
||||||
coordinate: [744, 288.0]
|
coordinate: [680, 288.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: enabled
|
state: enabled
|
||||||
- name: blocks_message_debug_0
|
- name: blocks_message_debug_0
|
||||||
|
@ -181,7 +181,7 @@ blocks:
|
||||||
comment: ''
|
comment: ''
|
||||||
maxoutbuf: '0'
|
maxoutbuf: '0'
|
||||||
minoutbuf: '0'
|
minoutbuf: '0'
|
||||||
mintime: 1e3
|
mintime: 10e3
|
||||||
name: ''
|
name: ''
|
||||||
type: complex
|
type: complex
|
||||||
vlen: '1'
|
vlen: '1'
|
||||||
|
@ -192,24 +192,6 @@ blocks:
|
||||||
coordinate: [592, 72.0]
|
coordinate: [592, 72.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: enabled
|
state: enabled
|
||||||
- name: dc_blocker_xx_0
|
|
||||||
id: dc_blocker_xx
|
|
||||||
parameters:
|
|
||||||
affinity: ''
|
|
||||||
alias: ''
|
|
||||||
comment: ''
|
|
||||||
length: '32'
|
|
||||||
long_form: 'True'
|
|
||||||
maxoutbuf: '0'
|
|
||||||
minoutbuf: '0'
|
|
||||||
type: cc
|
|
||||||
states:
|
|
||||||
bus_sink: false
|
|
||||||
bus_source: false
|
|
||||||
bus_structure: null
|
|
||||||
coordinate: [592, 288.0]
|
|
||||||
rotation: 0
|
|
||||||
state: enabled
|
|
||||||
- name: fir_filter_xxx_0
|
- name: fir_filter_xxx_0
|
||||||
id: fir_filter_xxx
|
id: fir_filter_xxx
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -220,14 +202,22 @@ blocks:
|
||||||
maxoutbuf: '0'
|
maxoutbuf: '0'
|
||||||
minoutbuf: '0'
|
minoutbuf: '0'
|
||||||
samp_delay: '0'
|
samp_delay: '0'
|
||||||
taps: '[0.002855073321371961, 0.004217810045954073, 0.006070979752995526, 0.008513978883235714,
|
taps: '[0.001406713158940830, 0.001710044136011884, 0.002065729959831640, 0.002479729084898883,
|
||||||
0.011633445764465426, 0.015487673582478250, 0.020089356277603183, 0.025389133050128021,
|
0.002958008261689403, 0.003506380063969166, 0.004130313846119902, 0.004834722781341408,
|
||||||
0.031263078326193357, 0.037507457211444148, 0.043843530949484712, 0.049933894562348549,
|
0.005623731273043186, 0.006500428742502637, 0.007466617484016239, 0.008522563837635781,
|
||||||
0.055409900908815000, 0.059907517556544401, 0.063106964465950877, 0.064770205340986750,
|
0.009666763243126521, 0.010895730688633577, 0.012203828541343623, 0.013583143648022388,
|
||||||
0.064770205340986750, 0.063106964465950877, 0.059907517556544401, 0.055409900908815000,
|
0.015023424848037427, 0.016512090610851241, 0.018034314394853066, 0.019573192570893717,
|
||||||
0.049933894562348549, 0.043843530949484712, 0.037507457211444148, 0.031263078326193357,
|
0.021109996455252005, 0.022624506291803306, 0.024095421090913748, 0.025500834283291689,
|
||||||
0.025389133050128021, 0.020089356277603183, 0.015487673582478250, 0.011633445764465426,
|
0.026818761409887478, 0.028027702777307838, 0.029107221383386426, 0.030038514652248167,
|
||||||
0.008513978883235714, 0.006070979752995526, 0.004217810045954073, 0.002855073321371961]
|
0.030804957761237182, 0.031392596685491395, 0.031790570555833404, 0.031991445477584902,
|
||||||
|
0.031991445477584902, 0.031790570555833404, 0.031392596685491395, 0.030804957761237182,
|
||||||
|
0.030038514652248167, 0.029107221383386426, 0.028027702777307838, 0.026818761409887478,
|
||||||
|
0.025500834283291689, 0.024095421090913748, 0.022624506291803306, 0.021109996455252005,
|
||||||
|
0.019573192570893717, 0.018034314394853066, 0.016512090610851241, 0.015023424848037427,
|
||||||
|
0.013583143648022388, 0.012203828541343623, 0.010895730688633577, 0.009666763243126521,
|
||||||
|
0.008522563837635781, 0.007466617484016239, 0.006500428742502637, 0.005623731273043186,
|
||||||
|
0.004834722781341408, 0.004130313846119902, 0.003506380063969166, 0.002958008261689403,
|
||||||
|
0.002479729084898883, 0.002065729959831640, 0.001710044136011884, 0.001406713158940830]
|
||||||
|
|
||||||
'
|
'
|
||||||
type: ccf
|
type: ccf
|
||||||
|
@ -235,7 +225,7 @@ blocks:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
bus_structure: null
|
bus_structure: null
|
||||||
coordinate: [936, 288.0]
|
coordinate: [872, 288.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: enabled
|
state: enabled
|
||||||
- name: qtgui_freq_sink_x_0
|
- name: qtgui_freq_sink_x_0
|
||||||
|
@ -285,7 +275,7 @@ blocks:
|
||||||
label7: ''''''
|
label7: ''''''
|
||||||
label8: ''''''
|
label8: ''''''
|
||||||
label9: ''''''
|
label9: ''''''
|
||||||
legend: 'True'
|
legend: 'False'
|
||||||
maxoutbuf: '0'
|
maxoutbuf: '0'
|
||||||
minoutbuf: '0'
|
minoutbuf: '0'
|
||||||
name: '""'
|
name: '""'
|
||||||
|
@ -293,7 +283,7 @@ blocks:
|
||||||
norm_window: 'True'
|
norm_window: 'True'
|
||||||
showports: 'False'
|
showports: 'False'
|
||||||
tr_chan: '0'
|
tr_chan: '0'
|
||||||
tr_level: '0.0'
|
tr_level: '0'
|
||||||
tr_mode: qtgui.TRIG_MODE_FREE
|
tr_mode: qtgui.TRIG_MODE_FREE
|
||||||
tr_tag: '""'
|
tr_tag: '""'
|
||||||
type: complex
|
type: complex
|
||||||
|
@ -311,12 +301,12 @@ blocks:
|
||||||
width9: '1'
|
width9: '1'
|
||||||
wintype: window.WIN_BLACKMAN_hARRIS
|
wintype: window.WIN_BLACKMAN_hARRIS
|
||||||
ymax: '0'
|
ymax: '0'
|
||||||
ymin: '-100'
|
ymin: '-140'
|
||||||
states:
|
states:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
bus_structure: null
|
bus_structure: null
|
||||||
coordinate: [1176, 376.0]
|
coordinate: [1168, 376.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: enabled
|
state: enabled
|
||||||
- name: qtgui_time_sink_x_0
|
- name: qtgui_time_sink_x_0
|
||||||
|
@ -374,7 +364,7 @@ blocks:
|
||||||
marker9: '-1'
|
marker9: '-1'
|
||||||
name: '""'
|
name: '""'
|
||||||
nconnections: '1'
|
nconnections: '1'
|
||||||
size: '512'
|
size: '1024'
|
||||||
srate: data_rate
|
srate: data_rate
|
||||||
stemplot: 'True'
|
stemplot: 'True'
|
||||||
style1: '1'
|
style1: '1'
|
||||||
|
@ -389,7 +379,7 @@ blocks:
|
||||||
style9: '1'
|
style9: '1'
|
||||||
tr_chan: '0'
|
tr_chan: '0'
|
||||||
tr_delay: '0'
|
tr_delay: '0'
|
||||||
tr_level: '0.0'
|
tr_level: '0'
|
||||||
tr_mode: qtgui.TRIG_MODE_FREE
|
tr_mode: qtgui.TRIG_MODE_FREE
|
||||||
tr_slope: qtgui.TRIG_SLOPE_POS
|
tr_slope: qtgui.TRIG_SLOPE_POS
|
||||||
tr_tag: '""'
|
tr_tag: '""'
|
||||||
|
@ -413,7 +403,7 @@ blocks:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
bus_structure: null
|
bus_structure: null
|
||||||
coordinate: [1176, 280.0]
|
coordinate: [1168, 280.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: enabled
|
state: enabled
|
||||||
- name: qtgui_time_sink_x_0_0
|
- name: qtgui_time_sink_x_0_0
|
||||||
|
@ -471,7 +461,7 @@ blocks:
|
||||||
marker9: '-1'
|
marker9: '-1'
|
||||||
name: '""'
|
name: '""'
|
||||||
nconnections: '1'
|
nconnections: '1'
|
||||||
size: '512'
|
size: '1024'
|
||||||
srate: data_rate
|
srate: data_rate
|
||||||
stemplot: 'False'
|
stemplot: 'False'
|
||||||
style1: '1'
|
style1: '1'
|
||||||
|
@ -485,9 +475,9 @@ blocks:
|
||||||
style8: '1'
|
style8: '1'
|
||||||
style9: '1'
|
style9: '1'
|
||||||
tr_chan: '0'
|
tr_chan: '0'
|
||||||
tr_delay: '0'
|
tr_delay: 10e-3
|
||||||
tr_level: '0.0'
|
tr_level: 1e-6
|
||||||
tr_mode: qtgui.TRIG_MODE_FREE
|
tr_mode: qtgui.TRIG_MODE_AUTO
|
||||||
tr_slope: qtgui.TRIG_SLOPE_POS
|
tr_slope: qtgui.TRIG_SLOPE_POS
|
||||||
tr_tag: '""'
|
tr_tag: '""'
|
||||||
type: float
|
type: float
|
||||||
|
@ -503,14 +493,14 @@ blocks:
|
||||||
width8: '1'
|
width8: '1'
|
||||||
width9: '1'
|
width9: '1'
|
||||||
ylabel: Magnitude
|
ylabel: Magnitude
|
||||||
ymax: '1'
|
ymax: 10e-6
|
||||||
ymin: '-1'
|
ymin: '0'
|
||||||
yunit: '""'
|
yunit: '""'
|
||||||
states:
|
states:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
bus_structure: null
|
bus_structure: null
|
||||||
coordinate: [744, 424.0]
|
coordinate: [672, 424.0]
|
||||||
rotation: 180
|
rotation: 180
|
||||||
state: enabled
|
state: enabled
|
||||||
- name: qtgui_waterfall_sink_x_0
|
- name: qtgui_waterfall_sink_x_0
|
||||||
|
@ -547,7 +537,7 @@ blocks:
|
||||||
grid: 'False'
|
grid: 'False'
|
||||||
gui_hint: ''
|
gui_hint: ''
|
||||||
int_max: '0'
|
int_max: '0'
|
||||||
int_min: '-120'
|
int_min: '-140'
|
||||||
label1: ''
|
label1: ''
|
||||||
label10: ''
|
label10: ''
|
||||||
label2: ''
|
label2: ''
|
||||||
|
@ -571,20 +561,19 @@ blocks:
|
||||||
bus_sink: false
|
bus_sink: false
|
||||||
bus_source: false
|
bus_source: false
|
||||||
bus_structure: null
|
bus_structure: null
|
||||||
coordinate: [1176, 184.0]
|
coordinate: [1168, 184.0]
|
||||||
rotation: 0
|
rotation: 0
|
||||||
state: enabled
|
state: enabled
|
||||||
|
|
||||||
connections:
|
connections:
|
||||||
- [blocks_char_to_float_0, '0', blocks_float_to_complex_0, '0']
|
- [blocks_char_to_float_0, '0', blocks_float_to_complex_0, '0']
|
||||||
- [blocks_complex_to_mag_0, '0', qtgui_time_sink_x_0_0, '0']
|
- [blocks_complex_to_mag_squared_0, '0', qtgui_time_sink_x_0_0, '0']
|
||||||
- [blocks_file_source_0, '0', blocks_char_to_float_0, '0']
|
- [blocks_file_source_0, '0', blocks_char_to_float_0, '0']
|
||||||
|
- [blocks_float_to_complex_0, '0', blocks_freqshift_cc_0, '0']
|
||||||
- [blocks_float_to_complex_0, '0', blocks_probe_rate_0, '0']
|
- [blocks_float_to_complex_0, '0', blocks_probe_rate_0, '0']
|
||||||
- [blocks_float_to_complex_0, '0', dc_blocker_xx_0, '0']
|
|
||||||
- [blocks_freqshift_cc_0, '0', fir_filter_xxx_0, '0']
|
- [blocks_freqshift_cc_0, '0', fir_filter_xxx_0, '0']
|
||||||
- [blocks_probe_rate_0, rate, blocks_message_debug_0, print]
|
- [blocks_probe_rate_0, rate, blocks_message_debug_0, print]
|
||||||
- [dc_blocker_xx_0, '0', blocks_freqshift_cc_0, '0']
|
- [fir_filter_xxx_0, '0', blocks_complex_to_mag_squared_0, '0']
|
||||||
- [fir_filter_xxx_0, '0', blocks_complex_to_mag_0, '0']
|
|
||||||
- [fir_filter_xxx_0, '0', qtgui_freq_sink_x_0, '0']
|
- [fir_filter_xxx_0, '0', qtgui_freq_sink_x_0, '0']
|
||||||
- [fir_filter_xxx_0, '0', qtgui_time_sink_x_0, '0']
|
- [fir_filter_xxx_0, '0', qtgui_time_sink_x_0, '0']
|
||||||
- [fir_filter_xxx_0, '0', qtgui_waterfall_sink_x_0, '0']
|
- [fir_filter_xxx_0, '0', qtgui_waterfall_sink_x_0, '0']
|
28
src/main.c
28
src/main.c
|
@ -21,7 +21,7 @@
|
||||||
#define IRN_SM 1
|
#define IRN_SM 1
|
||||||
|
|
||||||
#define NUM_SAMPLES_BITS 10
|
#define NUM_SAMPLES_BITS 10
|
||||||
#define NUM_SAMPLES (1 << NUM_SAMPLES_BITS)
|
#define NUM_SAMPLES (1 << NUM_SAMPLES_BITS)
|
||||||
static uint16_t irp_buffer[NUM_SAMPLES] __aligned(2 * NUM_SAMPLES);
|
static uint16_t irp_buffer[NUM_SAMPLES] __aligned(2 * NUM_SAMPLES);
|
||||||
static int dma_ch_irp_rx;
|
static int dma_ch_irp_rx;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ static void init_pio_sm(pio_hw_t *pio, int sm, int rx_pin, int fb_pin)
|
||||||
pio_encode_jmp_x_dec(4),
|
pio_encode_jmp_x_dec(4),
|
||||||
pio_encode_in(pio_y, 16) | pio_encode_sideset_opt(1, 1),
|
pio_encode_in(pio_y, 16) | pio_encode_sideset_opt(1, 1),
|
||||||
pio_encode_mov(pio_x, pio_osr),
|
pio_encode_mov(pio_x, pio_osr),
|
||||||
pio_encode_nop() | pio_encode_sideset_opt(1, 0),
|
pio_encode_set(pio_y, 0) | pio_encode_sideset_opt(1, 0),
|
||||||
pio_encode_jmp_pin(6),
|
pio_encode_jmp_pin(6),
|
||||||
pio_encode_jmp(0) | pio_encode_sideset_opt(1, 1),
|
pio_encode_jmp(0) | pio_encode_sideset_opt(1, 1),
|
||||||
pio_encode_jmp_y_dec(0) | pio_encode_sideset_opt(1, 0),
|
pio_encode_jmp_y_dec(0) | pio_encode_sideset_opt(1, 0),
|
||||||
|
@ -94,27 +94,17 @@ static bool read_sample(int *sample)
|
||||||
if (tail == head)
|
if (tail == head)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint16_t next_pos = irp_buffer[tail];
|
int pos = irp_buffer[tail] << 16;
|
||||||
uint16_t next_neg = irn_buffer[tail];
|
int neg = irn_buffer[tail] << 16;
|
||||||
tail = (tail + 1) % NUM_SAMPLES;
|
tail = (tail + 1) % NUM_SAMPLES;
|
||||||
|
|
||||||
static uint16_t prev_pos;
|
int s = pos - neg;
|
||||||
int pos = prev_pos - next_pos;
|
|
||||||
prev_pos = next_pos;
|
|
||||||
|
|
||||||
static uint16_t prev_neg;
|
static int dc;
|
||||||
int neg = prev_neg - next_neg;
|
dc += (s - dc) >> 16;
|
||||||
prev_neg = next_neg;
|
s -= dc;
|
||||||
|
|
||||||
static int dc_pos;
|
*sample = s >> 16;
|
||||||
dc_pos += ((pos << 16) - dc_pos) >> 12;
|
|
||||||
pos -= (dc_pos >> 16);
|
|
||||||
|
|
||||||
static int dc_neg;
|
|
||||||
dc_neg += ((neg << 16) - dc_neg) >> 12;
|
|
||||||
neg -= (dc_neg >> 16);
|
|
||||||
|
|
||||||
*sample = pos - neg;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue