You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+74-3
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,8 @@ Most of the code is available under the permissive BSD license, with some option
10
10
- The code of *libcsdr* was intended to be easy to follow.
11
11
-*libcsdr* was designed to use auto-vectorization available in *gcc*. It means that it can achieve some speedup by taking advantage of SIMD command sets available in today's CPUs (e.g. SSE on x86 and NEON on ARM).
12
12
13
+
Moreover, *libcsdr* serves as the base for the new, experimental <ahref="#sdr.js">sdr.js</a>, which takes Software Defined Radio DSP to today's web browsers that provide JavScript JIT compilation.
14
+
13
15
How to compile
14
16
--------------
15
17
The project was only tested on Linux. It has the following dependencies: `libfftw3-dev`
@@ -155,15 +157,33 @@ It multiplies all samples by `gain`.
155
157
156
158
It copies the input to the output.
157
159
160
+
none
161
+
162
+
The `csdr` process just exits with 0.
163
+
158
164
yes_f <to_repeat> [buf_times]
159
165
160
166
It outputs continously the `to_repeat` float number.
161
167
If `buf_times` is not given, it never stops.
162
168
Else, after outputing `buf_times` number of buffers (the size of which is stated in the `BUFSIZE` macro), it exits.
163
169
170
+
detect_nan_ff
171
+
172
+
Along with copying its input samples to the output, it prints a warning message to *stderr* if it finds any IEEE floating point NaN values among the samples.
173
+
174
+
floatdump_f
175
+
176
+
It prints any floating point input samples.
177
+
The format string used is `"%g "`.
178
+
179
+
flowcontrol <data_rate> <reads_per_second>
180
+
181
+
It limits the data rate of a stream to a given `data_rate` number of bytes per second.
182
+
It copies `data_rate / reads_per_second` bytes from the input to the output, doing it `reads_per_second` times every second.
183
+
164
184
shift_math_cc <rate>
165
185
166
-
It shifts the complex spectrum by `rate`.
186
+
It shifts the signal in the frequency domain by `rate`.
167
187
`rate` is a floating point number between -0.5 and 0.5.
168
188
`rate` is relative to the sampling rate.
169
189
@@ -179,6 +199,17 @@ Internally, this function uses trigonometric addition formulas to generate sine
179
199
180
200
This function was used to test the accuracy of the method above.
181
201
202
+
shift_table_cc <rate> [table_size]
203
+
204
+
Operation is the same as with `shift_math_cc`.
205
+
Internally, this function uses a look-up table (LUT) to recall the values of the sine function (for the first quadrant).
206
+
The higher the table size is, the smaller the phase error is.
207
+
208
+
decimating_shift_addition_cc <rate> [decimation]
209
+
210
+
It shifts the input signal in the frequency domain, and also decimates it, without filtering. It will be useful as a part of the FFT channelizer implementation (to be done).
211
+
It cannot be used as a channelizer by itself, use `fir_decimate_cc` instead.
212
+
182
213
dcblock_ff
183
214
184
215
This is a DC blocking IIR filter.
@@ -214,7 +245,7 @@ It uses fixed filters so it works only on predefined sample rates, for the actua
214
245
215
246
It is an AM demodulator that uses `sqrt`. On some architectures `sqrt` can be directly calculated by dedicated CPU instructions, but on others it may be slower.
216
247
217
-
amdemod_estimator_cf
248
+
amdemod_estimator_cf
218
249
219
250
It is an AM demodulator that uses an estimation method that is faster but less accurate than `amdemod_cf`.
220
251
@@ -296,10 +327,28 @@ FFTW can be faster if we let it optimalize a while before starting the first tra
296
327
It measures the time taken to process `fft_cycles` transforms of `fft_size`.
297
328
It lets FFTW optimalize if used with the `--benchmark` switch.
298
329
299
-
lowpower_cf [add_db]
330
+
logpower_cf [add_db]
300
331
301
332
Calculates `10*log10(i^2+q^2)+add_db` for the input complex samples. It is useful for drawing power spectrum graphs.
302
333
334
+
encode_ima_adpcm_i16_u8
335
+
336
+
Encodes the audio stream to IMA ADPCM, which decreases the size to 25% of the original.
337
+
338
+
decode_ima_adpcm_u8_i16
339
+
340
+
Decodes the audio stream from IMA ADPCM.
341
+
342
+
compress_fft_adpcm_f_u8 <fft_size>
343
+
344
+
Encodes the FFT output vectors of `fft_size`. It should be used on the data output from `logpower_cf`.
345
+
It resets the ADPCM encoder at the beginning of every vector, and to compensate it, `COMPRESS_FFT_PAD_N` samples are added at beginning (these equal to the first relevant sample).
346
+
The actual number of padding samples can be determined by running `cat csdr.c | grep "define COMPRESS_FFT_PAD_N"`.
347
+
348
+
fft_exchange_sides_ff <fft_size>
349
+
350
+
It exchanges the first and second part of the FFT vector, to prepare it for the waterfall/spectrum display. It should operate on the data output from `logpower_cf`.
351
+
303
352
#### Control via pipes
304
353
305
354
Some parameters can be changed while the `csdr` process is running. To achieve this, some `csdr` functions have special parameters. You have to supply a fifo previously created by the `mkfifo` command. Processing will only start after the first control command has been received by `csdr` over the FIFO.
@@ -326,6 +375,28 @@ E.g. you can send `-0.05 0.02\n`
326
375
327
376
`csdr` was tested with GNU Radio Companion flowgraphs. These flowgraphs are available under the directory `grc_tests`, and they require the <ahref="https://github.com/simonyiszk/gr-ha5kfu">gr-ha5kfu</a> set of blocks for GNU Radio.
328
377
378
+
## [sdr.js] (#sdr.js)
379
+
380
+
*sdr.js* is *libcsdr* compiled to JavaScript code with *Emscripten*. Nowadays JavaScript runs quite fast in browsers, as all major browser vendors included JavaScript JIT machines into their product. You can find a <ahref="https://kripken.github.io/mloc_emscripten_talk/cppcon.html">great introductory slideshow here</a> about *Emscripten*.
381
+
382
+
The purpose of *sdr.js* is to make SDR DSP processing available in the web browser. However, it is not easy to use in production yet. By now, only those functions have wrappers that the front-end of OpenWebRX uses.
383
+
384
+
To compile *sdr.js*, you will need <ahref="http://emscripten.org/">emscripten</a>. (It turns out that *emscripten* is already included in Ubuntu repositories.)
385
+
386
+
To install and build dependencies (for now, only FFTW3):
387
+
388
+
make emcc-get-deps
389
+
390
+
To compile *sdr.js* (which will be created in the `sdr.js` subdirectory):
391
+
392
+
make emcc
393
+
394
+
You can test *sdr.js* by opening *sdr.html*. It contains a test for *firdes_lowpass_f* for this time.
395
+
396
+
To remove *sdr.js* and the compiled dependencies:
397
+
398
+
make emcc-clean
399
+
329
400
## [Licensing] (#licensing)
330
401
331
402
Most of the code of `libcsdr` is under BSD license.
0 commit comments