Skip to content

Commit c39625c

Browse files
ghostop14michaelld
authored andcommitted
gr-filter: Add ichar/ishort decimator
Current resamplers do not support ichar and ishort as an input type. When processing streaming ichar data from external sources (such as the ATA), decimation in native ichar would be faster than converting to another data type then decimating. This block provides the ability to decimate the ichar stream directly. Support was also added to support ishort data in the same manner.
1 parent 458414c commit c39625c

11 files changed

+515
-4
lines changed
+299
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,299 @@
1+
options:
2+
parameters:
3+
author: ''
4+
catch_exceptions: 'True'
5+
category: '[GRC Hier Blocks]'
6+
cmake_opt: ''
7+
comment: ''
8+
copyright: ''
9+
description: ''
10+
gen_cmake: 'On'
11+
gen_linking: dynamic
12+
generate_options: qt_gui
13+
hier_block_src_path: '.:'
14+
id: test_ichar_decim
15+
max_nouts: '0'
16+
output_language: python
17+
placement: (0,0)
18+
qt_qss_theme: ''
19+
realtime_scheduling: ''
20+
run: 'True'
21+
run_command: '{python} -u {filename}'
22+
run_options: prompt
23+
sizing_mode: fixed
24+
thread_safe_setters: ''
25+
title: IChar Decimator
26+
states:
27+
bus_sink: false
28+
bus_source: false
29+
bus_structure: null
30+
coordinate: [8, 8]
31+
rotation: 0
32+
state: enabled
33+
34+
blocks:
35+
- name: decim
36+
id: variable
37+
parameters:
38+
comment: ''
39+
value: '5'
40+
states:
41+
bus_sink: false
42+
bus_source: false
43+
bus_structure: null
44+
coordinate: [381, 20]
45+
rotation: 0
46+
state: true
47+
- name: samp_rate
48+
id: variable
49+
parameters:
50+
comment: ''
51+
value: '500000'
52+
states:
53+
bus_sink: false
54+
bus_source: false
55+
bus_structure: null
56+
coordinate: [184, 12]
57+
rotation: 0
58+
state: enabled
59+
- name: analog_sig_source_x_0
60+
id: analog_sig_source_x
61+
parameters:
62+
affinity: ''
63+
alias: ''
64+
amp: '127'
65+
comment: ''
66+
freq: '1000'
67+
maxoutbuf: '0'
68+
minoutbuf: '0'
69+
offset: '0'
70+
phase: '0'
71+
samp_rate: samp_rate
72+
type: complex
73+
waveform: analog.GR_COS_WAVE
74+
states:
75+
bus_sink: false
76+
bus_source: false
77+
bus_structure: null
78+
coordinate: [41, 238]
79+
rotation: 0
80+
state: true
81+
- name: blocks_complex_to_interleaved_char_0
82+
id: blocks_complex_to_interleaved_char
83+
parameters:
84+
affinity: ''
85+
alias: ''
86+
comment: ''
87+
maxoutbuf: '0'
88+
minoutbuf: '0'
89+
scale_factor: '1.0'
90+
vector_output: 'False'
91+
states:
92+
bus_sink: false
93+
bus_source: false
94+
bus_structure: null
95+
coordinate: [488, 336]
96+
rotation: 0
97+
state: true
98+
- name: blocks_complex_to_interleaved_char_0_0
99+
id: blocks_complex_to_interleaved_char
100+
parameters:
101+
affinity: ''
102+
alias: ''
103+
comment: ''
104+
maxoutbuf: '0'
105+
minoutbuf: '0'
106+
scale_factor: '1.0'
107+
vector_output: 'False'
108+
states:
109+
bus_sink: false
110+
bus_source: false
111+
bus_structure: null
112+
coordinate: [714, 221]
113+
rotation: 0
114+
state: true
115+
- name: blocks_interleaved_char_to_complex_0
116+
id: blocks_interleaved_char_to_complex
117+
parameters:
118+
affinity: ''
119+
alias: ''
120+
comment: ''
121+
maxoutbuf: '0'
122+
minoutbuf: '0'
123+
scale_factor: '1.0'
124+
vector_input: 'False'
125+
states:
126+
bus_sink: false
127+
bus_source: false
128+
bus_structure: null
129+
coordinate: [934, 339]
130+
rotation: 0
131+
state: true
132+
- name: blocks_interleaved_char_to_complex_0_0
133+
id: blocks_interleaved_char_to_complex
134+
parameters:
135+
affinity: ''
136+
alias: ''
137+
comment: ''
138+
maxoutbuf: '0'
139+
minoutbuf: '0'
140+
scale_factor: '1.0'
141+
vector_input: 'False'
142+
states:
143+
bus_sink: false
144+
bus_source: false
145+
bus_structure: null
146+
coordinate: [935, 219]
147+
rotation: 0
148+
state: true
149+
- name: blocks_throttle_0
150+
id: blocks_throttle
151+
parameters:
152+
affinity: ''
153+
alias: ''
154+
comment: ''
155+
ignoretag: 'True'
156+
maxoutbuf: '0'
157+
minoutbuf: '0'
158+
samples_per_second: samp_rate
159+
type: complex
160+
vlen: '1'
161+
states:
162+
bus_sink: false
163+
bus_source: false
164+
bus_structure: null
165+
coordinate: [274, 278]
166+
rotation: 0
167+
state: true
168+
- name: ival_decimator_0
169+
id: ival_decimator
170+
parameters:
171+
affinity: ''
172+
alias: ''
173+
comment: ''
174+
datatype: byte
175+
decimation: decim
176+
maxoutbuf: '0'
177+
minoutbuf: '0'
178+
states:
179+
bus_sink: false
180+
bus_source: false
181+
bus_structure: null
182+
coordinate: [683, 346]
183+
rotation: 0
184+
state: true
185+
- name: qtgui_freq_sink_x_0
186+
id: qtgui_freq_sink_x
187+
parameters:
188+
affinity: ''
189+
alias: ''
190+
alpha1: '1.0'
191+
alpha10: '1.0'
192+
alpha2: '1.0'
193+
alpha3: '1.0'
194+
alpha4: '1.0'
195+
alpha5: '1.0'
196+
alpha6: '1.0'
197+
alpha7: '1.0'
198+
alpha8: '1.0'
199+
alpha9: '1.0'
200+
autoscale: 'False'
201+
average: '1.0'
202+
axislabels: 'True'
203+
bw: samp_rate/decim
204+
color1: '"blue"'
205+
color10: '"dark blue"'
206+
color2: '"red"'
207+
color3: '"green"'
208+
color4: '"black"'
209+
color5: '"cyan"'
210+
color6: '"magenta"'
211+
color7: '"yellow"'
212+
color8: '"dark red"'
213+
color9: '"dark green"'
214+
comment: ''
215+
ctrlpanel: 'False'
216+
fc: '0'
217+
fftsize: '1024'
218+
freqhalf: 'True'
219+
grid: 'False'
220+
gui_hint: ''
221+
label: Relative Gain
222+
label1: Resampler
223+
label10: ''''''
224+
label2: ichar decim
225+
label3: ''''''
226+
label4: ''''''
227+
label5: ''''''
228+
label6: ''''''
229+
label7: ''''''
230+
label8: ''''''
231+
label9: ''''''
232+
legend: 'True'
233+
maxoutbuf: '0'
234+
minoutbuf: '0'
235+
name: '""'
236+
nconnections: '2'
237+
showports: 'False'
238+
tr_chan: '0'
239+
tr_level: '0.0'
240+
tr_mode: qtgui.TRIG_MODE_FREE
241+
tr_tag: '""'
242+
type: complex
243+
units: dB
244+
update_time: '0.10'
245+
width1: '1'
246+
width10: '1'
247+
width2: '1'
248+
width3: '1'
249+
width4: '1'
250+
width5: '1'
251+
width6: '1'
252+
width7: '1'
253+
width8: '1'
254+
width9: '1'
255+
wintype: firdes.WIN_BLACKMAN_hARRIS
256+
ymax: '20'
257+
ymin: '-120'
258+
states:
259+
bus_sink: false
260+
bus_source: false
261+
bus_structure: null
262+
coordinate: [1178, 244]
263+
rotation: 0
264+
state: true
265+
- name: rational_resampler_xxx_0
266+
id: rational_resampler_xxx
267+
parameters:
268+
affinity: ''
269+
alias: ''
270+
comment: ''
271+
decim: decim
272+
fbw: '0'
273+
interp: '1'
274+
maxoutbuf: '0'
275+
minoutbuf: '0'
276+
taps: ''
277+
type: ccc
278+
states:
279+
bus_sink: false
280+
bus_source: false
281+
bus_structure: null
282+
coordinate: [482, 195]
283+
rotation: 0
284+
state: true
285+
286+
connections:
287+
- [analog_sig_source_x_0, '0', blocks_throttle_0, '0']
288+
- [blocks_complex_to_interleaved_char_0, '0', ival_decimator_0, '0']
289+
- [blocks_complex_to_interleaved_char_0_0, '0', blocks_interleaved_char_to_complex_0_0,
290+
'0']
291+
- [blocks_interleaved_char_to_complex_0, '0', qtgui_freq_sink_x_0, '1']
292+
- [blocks_interleaved_char_to_complex_0_0, '0', qtgui_freq_sink_x_0, '0']
293+
- [blocks_throttle_0, '0', blocks_complex_to_interleaved_char_0, '0']
294+
- [blocks_throttle_0, '0', rational_resampler_xxx_0, '0']
295+
- [ival_decimator_0, '0', blocks_interleaved_char_to_complex_0, '0']
296+
- [rational_resampler_xxx_0, '0', blocks_complex_to_interleaved_char_0_0, '0']
297+
298+
metadata:
299+
file_format: 1

gr-filter/grc/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2012 Free Software Foundation, Inc.
1+
# Copyright 2012,2020 Free Software Foundation, Inc.
22
#
33
# This file is part of GNU Radio
44
#
@@ -14,6 +14,7 @@ install(FILES
1414
filter_fir_filter_xxx.block.yml
1515
filter_filter_delay_fc.block.yml
1616
filter_filterbank_vcvcf.block.yml
17+
filter_ival_decimator.block.yml
1718
filter_mmse_interpolator_xx.block.yml
1819
filter_mmse_resampler_xx.block.yml
1920
filter_freq_xlating_fft_filter_ccc.block.yml

gr-filter/grc/filter.tree.yml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- pfb_arb_resampler_xxx
2727
- rational_resampler_xxx
2828
- rational_resampler_base_xxx
29+
- ival_decimator
2930
- Channelizers:
3031
- freq_xlating_fft_filter_ccc
3132
- freq_xlating_fir_filter_xxx
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
id: ival_decimator
2+
label: Interleaved Stream Decimator
3+
4+
parameters:
5+
- id: datatype
6+
label: Input Type
7+
dtype: enum
8+
options: [byte, short]
9+
option_attributes:
10+
datasize: [gr.sizeof_char, gr.sizeof_short]
11+
hide: part
12+
- id: decimation
13+
label: Decimation
14+
dtype: int
15+
default: '1'
16+
17+
inputs:
18+
- domain: stream
19+
dtype: ${ type }
20+
21+
outputs:
22+
- domain: stream
23+
dtype: ${ type }
24+
25+
templates:
26+
imports: from gnuradio import filter
27+
make: filter.ival_decimator(${decimation}, ${datatype.datasize})
28+
29+
documentation: |-
30+
This block will directly decimate an incoming stream made up of the specified complex samples.
31+
One example would be if you have a source streaming 8-bit complex at high speeds and you want to
32+
decimate directly from a high-speed source, or before writing to a file or network sink.
33+
34+
file_format: 1

gr-filter/include/gnuradio/filter/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2012,2014,2017 Free Software Foundation, Inc.
1+
# Copyright (C) 2012,2014,2017,2020 Free Software Foundation, Inc.
22
#
33
# This file is part of GNU Radio
44
#
@@ -15,6 +15,7 @@ install(FILES
1515
fir_filter_blk.h
1616
fir_filter_with_buffer.h
1717
fft_filter.h
18+
ival_decimator.h
1819
iir_filter.h
1920
interpolator_taps.h
2021
interp_fir_filter.h

0 commit comments

Comments
 (0)