├── .gitignore ├── .gitlab-ci.yml ├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── README.md ├── cmake ├── Modules │ ├── FindGStreamer.cmake │ ├── FindLibUSB.cmake │ ├── FindSSE.cmake │ ├── FindThreads.cmake │ └── Version.cmake └── cmake_uninstall.cmake.in ├── matlab ├── DAB_ALL_RT.m ├── EnergyDispGen.m ├── FICDecoder_UT │ ├── ADCFreqCheck.m │ ├── BinToDec.m │ ├── CRC16.m │ ├── ComplexDataLoad.m │ ├── DAB_ALL_RTm1.m │ ├── DAB_ALL_RTm2.m │ ├── DAB_ALL_RTm3.m │ ├── DAB_ALL_RTm4.m │ ├── DAB_DECODER_OKfast.m │ ├── DAB_FIC.m │ ├── DAB_FIC_test.m │ ├── DAB_file_info.m │ ├── DataLoad.m │ ├── DataLoad_RT.m │ ├── DecToBin.m │ ├── DetFrameStart.m │ ├── DetFrameStartStreamTZ3e.m │ ├── DetFrameStartStream_RT.m │ ├── DetFreqOffset.m │ ├── DetModeX.m │ ├── EEPTab.m │ ├── EnergyDispGen.m │ ├── FIGType.m │ ├── FreqDeinterleaverTabGen.m │ ├── FreqDeinterleaving.m │ ├── FreqInterleaverTabGen.m │ ├── FreqInterleavingTab.m │ ├── PIDet.m │ ├── PhaseRefSymbGen.m │ ├── SuperFrameHandlingX.m │ ├── SymbolFFTStreamTZ3e.m │ ├── SymbolFFTStream_RT.m │ ├── SymbolFFT_TZ2.m │ ├── TabelIndex.m │ ├── TimeDeinterleavingStream.m │ ├── UEPTab.m │ ├── decodeFIC.m │ ├── decodeMSC.m │ ├── depuncturing.m │ └── read_complex_binary.m ├── FICDecoder_unittest.m ├── FIGType.m ├── MSCDecoder_UT │ ├── ADCFreqCheck.m │ ├── BinToDec.m │ ├── CRC16.m │ ├── ComplexDataLoad.m │ ├── DAB_ALL_RT_m1.m │ ├── DAB_ALL_RT_m2.m │ ├── DAB_ALL_RT_m3.m │ ├── DAB_ALL_RT_m4.m │ ├── DAB_DECODER_OKfast.m │ ├── DAB_FIC.m │ ├── DAB_FIC_test.m │ ├── DAB_file_info.m │ ├── DataLoad.m │ ├── DataLoad_RT.m │ ├── DecToBin.m │ ├── DetFrameStart.m │ ├── DetFrameStartStreamTZ3e.m │ ├── DetFrameStartStream_RT.m │ ├── DetFreqOffset.m │ ├── DetModeX.m │ ├── EEPTab.m │ ├── EnergyDispGen.m │ ├── FIGType.m │ ├── FreqDeinterleaverTabGen.m │ ├── FreqDeinterleaving.m │ ├── FreqInterleaverTabGen.m │ ├── FreqInterleavingTab.m │ ├── PIDet.m │ ├── PhaseRefSymbGen.m │ ├── SuperFrameHandlingX.m │ ├── SymbolFFTStreamTZ3e.m │ ├── SymbolFFTStream_RT.m │ ├── SymbolFFT_TZ2.m │ ├── TabelIndex.m │ ├── TimeDeinterleavingStream.m │ ├── UEPTab.m │ ├── decodeFIC.m │ ├── decodeMSCm1.m │ ├── decodeMSCm2.m │ ├── decodeMSCm3.m │ ├── decodeMSCm4.m │ ├── depuncturing.m │ └── read_complex_binary.m ├── MSCDecoder_unittest.m ├── PIDet.m ├── ReedSolomon_DataGeneration.m ├── ReedSolomon_MatlabDataSave_ForUnittest │ ├── ADCFreqCheck.m │ ├── BinToDec.m │ ├── CRC16.m │ ├── ComplexDataLoad.m │ ├── DAB_ALL_RT.m │ ├── DAB_DECODER_OKfast.m │ ├── DAB_FIC.m │ ├── DAB_FIC_test.m │ ├── DAB_file_info.m │ ├── DataLoad.m │ ├── DataLoad_RT.m │ ├── DecToBin.m │ ├── DetFrameStart.m │ ├── DetFrameStartStreamTZ3e.m │ ├── DetFrameStartStream_RT.m │ ├── DetFreqOffset.m │ ├── DetModeX.m │ ├── EEPTab.m │ ├── EnergyDispGen.m │ ├── FIGType.m │ ├── FreqDeinterleaverTabGen.m │ ├── FreqDeinterleaving.m │ ├── FreqInterleaverTabGen.m │ ├── FreqInterleavingTab.m │ ├── PIDet.m │ ├── PhaseRefSymbGen.m │ ├── SuperFrameHandlingX.m │ ├── SymbolFFTStreamTZ3e.m │ ├── SymbolFFTStream_RT.m │ ├── SymbolFFT_TZ2.m │ ├── TabelIndex.m │ ├── TimeDeinterleavingStream.m │ ├── UEPTab.m │ ├── decodeFIC.m │ ├── decodeMSC.m │ ├── depuncturing.m │ └── read_complex_binary.m ├── SuperFrame_UT │ ├── ADCFreqCheck.m │ ├── BinToDec.m │ ├── CRC16.m │ ├── ComplexDataLoad.m │ ├── DAB_ALL_RT_m1.m │ ├── DAB_ALL_RT_m2.m │ ├── DAB_ALL_RT_m3.m │ ├── DAB_ALL_RT_m4.m │ ├── DAB_DECODER_OKfast.m │ ├── DAB_FIC.m │ ├── DAB_FIC_test.m │ ├── DAB_file_info.m │ ├── DataLoad.m │ ├── DataLoad_RT.m │ ├── DecToBin.m │ ├── DetFrameStart.m │ ├── DetFrameStartStreamTZ3e.m │ ├── DetFrameStartStream_RT.m │ ├── DetFreqOffset.m │ ├── DetModeX.m │ ├── EEPTab.m │ ├── EnergyDispGen.m │ ├── FIGType.m │ ├── FreqDeinterleaverTabGen.m │ ├── FreqDeinterleaving.m │ ├── FreqInterleaverTabGen.m │ ├── FreqInterleavingTab.m │ ├── PIDet.m │ ├── PhaseRefSymbGen.m │ ├── SuperFrameHandlingXm1.m │ ├── SuperFrameHandlingXm2.m │ ├── SuperFrameHandlingXm3.m │ ├── SuperFrameHandlingXm4.m │ ├── SymbolFFTStreamTZ3e.m │ ├── SymbolFFTStream_RT.m │ ├── SymbolFFT_TZ2.m │ ├── TabelIndex.m │ ├── TimeDeinterleavingStream.m │ ├── UEPTab.m │ ├── decodeFIC.m │ ├── decodeMSCm1.m │ ├── decodeMSCm2.m │ ├── decodeMSCm3.m │ ├── decodeMSCm4.m │ ├── depuncturing.m │ └── read_complex_binary.m ├── SuperFrame_unittest.m ├── TimeDeinterleavingStream.m ├── Viterbi │ ├── ADCFreqCheck.m │ ├── BinToDec.m │ ├── CRC16.m │ ├── ComplexDataLoad.m │ ├── DAB_ALL_RT.m │ ├── DAB_DECODER_OKfast.m │ ├── DAB_FIC.m │ ├── DAB_FIC_test.m │ ├── DAB_file_info.m │ ├── DataLoad.m │ ├── DataLoad_RT.m │ ├── DecToBin.m │ ├── DetFrameStart.m │ ├── DetFrameStartStreamTZ3e.m │ ├── DetFrameStartStream_RT.m │ ├── DetFreqOffset.m │ ├── DetModeX.m │ ├── EEPTab.m │ ├── EnergyDispGen.m │ ├── FIGType.m │ ├── FreqDeinterleaverTabGen.m │ ├── FreqDeinterleaving.m │ ├── FreqInterleaverTabGen.m │ ├── FreqInterleavingTab.m │ ├── PIDet.m │ ├── PhaseRefSymbGen.m │ ├── SuperFrameHandlingX.m │ ├── SymbolFFTStreamTZ3e.m │ ├── SymbolFFTStream_RT.m │ ├── SymbolFFT_TZ2.m │ ├── TabelIndex.m │ ├── TimeDeinterleavingStream.m │ ├── UEPTab.m │ ├── decodeFIC.m │ ├── decodeMSC.m │ ├── depuncturing.m │ ├── read_complex_binary.m │ ├── writeComplex.m │ └── writeReal.m ├── ViterbiDecoder_FIC_MSC.m ├── all_generate.m ├── dat2raw.m ├── datadecoder_FIG_unittest │ ├── DAB_ALL_RT.m │ └── FIGType.m ├── datadecoder_generateCRC.m ├── datadecoder_generateDepuncturer.m ├── datadecoder_generateTimeDeInterleaver.m ├── dcremoval_data_generator.m ├── demodulator_deinterleaver_tab.m ├── demodulator_deqpsk.m ├── demodulator_frame_pos_fft.m ├── demodulator_process.m ├── demodulator_snr_calc.m ├── demodulator_unitest │ ├── ADCFreqCheck.m │ ├── BinToDec.m │ ├── CRC16.m │ ├── ComplexDataLoad.m │ ├── DAB_ALL_RT.m │ ├── DAB_DECODER_OKfast.m │ ├── DAB_FIC.m │ ├── DAB_FIC_test.m │ ├── DAB_file_info.m │ ├── DataLoad.m │ ├── DataLoad_RT.m │ ├── DecToBin.m │ ├── DetFrameStart.m │ ├── DetFrameStartStreamTZ3e.m │ ├── DetFrameStartStream_RT.m │ ├── DetFreqOffset.m │ ├── DetModeX.m │ ├── EEPTab.m │ ├── EnergyDispGen.m │ ├── FIGType.m │ ├── FreqDeinterleaverTabGen.m │ ├── FreqDeinterleaving.m │ ├── FreqInterleaverTabGen.m │ ├── FreqInterleavingTab.m │ ├── PIDet.m │ ├── PhaseRefSymbGen.m │ ├── SuperFrameHandlingX.m │ ├── SymbolFFTStreamTZ3e.m │ ├── SymbolFFTStream_RT.m │ ├── SymbolFFT_TZ2.m │ ├── TabelIndex.m │ ├── TimeDeinterleavingStream.m │ ├── UEPTab.m │ ├── decodeFIC.m │ ├── decodeMSC.m │ ├── depuncturing.m │ └── read_complex_binary.m ├── depuncturing.m ├── energy_disp_data_generator.m ├── fft_engine_unittest_ifft.m ├── fft_engine_unittest_vol1.m ├── inputdata │ ├── README │ └── download.sh ├── ref │ ├── ADCFreqCheck.m │ ├── BinToDec.m │ ├── CRC16.m │ ├── ComplexDataLoad.m │ ├── DAB_ALL_RT.m │ ├── DAB_DECODER_OKfast.m │ ├── DAB_FIC.m │ ├── DAB_FIC_test.m │ ├── DAB_file_info.m │ ├── DataLoad.m │ ├── DataLoad_RT.m │ ├── DecToBin.m │ ├── DetFrameStart.m │ ├── DetFrameStartStreamTZ3e.m │ ├── DetFrameStartStream_RT.m │ ├── DetFreqOffset.m │ ├── DetModeX.m │ ├── EEPTab.m │ ├── EnergyDispGen.m │ ├── FIGType.m │ ├── FreqDeinterleaverTabGen.m │ ├── FreqDeinterleaving.m │ ├── FreqInterleaverTabGen.m │ ├── FreqInterleavingTab.m │ ├── PIDet.m │ ├── PhaseRefSymbGen.m │ ├── SuperFrameHandlingX.m │ ├── SymbolFFTStreamTZ3e.m │ ├── SymbolFFTStream_RT.m │ ├── SymbolFFT_TZ2.m │ ├── TabelIndex.m │ ├── TimeDeinterleavingStream.m │ ├── UEPTab.m │ ├── decodeFIC.m │ ├── decodeMSC.m │ ├── depuncturing.m │ └── read_complex_binary.m ├── remodulate.m ├── remodulate_data_generator.m ├── resampler_interleaved.m ├── resampler_linear.m ├── synchronizer_SNR.m ├── synchronizer_unitest_all.m ├── synchronizer_unitest_all │ ├── ADCFreqCheck.m │ ├── BinToDec.m │ ├── CRC16.m │ ├── ComplexDataLoad.m │ ├── DAB_ALL_RT.m │ ├── DAB_DECODER_OKfast.m │ ├── DAB_FIC.m │ ├── DAB_FIC_test.m │ ├── DAB_file_info.m │ ├── DataLoad.m │ ├── DataLoad_RT.m │ ├── DecToBin.m │ ├── DetFrameStart.m │ ├── DetFrameStartStreamTZ3e.m │ ├── DetFrameStartStream_RT.m │ ├── DetFreqOffset.m │ ├── DetModeX.m │ ├── EEPTab.m │ ├── EnergyDispGen.m │ ├── FIGType.m │ ├── FreqDeinterleaverTabGen.m │ ├── FreqDeinterleaving.m │ ├── FreqInterleaverTabGen.m │ ├── FreqInterleavingTab.m │ ├── PIDet.m │ ├── PhaseRefSymbGen.m │ ├── SuperFrameHandlingX.m │ ├── SymbolFFTStreamTZ3e.m │ ├── SymbolFFTStream_RT.m │ ├── SymbolFFT_TZ2.m │ ├── TabelIndex.m │ ├── TimeDeinterleavingStream.m │ ├── UEPTab.m │ ├── decodeFIC.m │ ├── decodeMSC.m │ ├── depuncturing.m │ └── read_complex_binary.m └── synchronizer_unitest_phase_ref.m ├── scripts ├── _doxygen │ ├── sdrdab-cli.doxy │ ├── sdrdab-gui.doxy │ └── sdrdab.doxy ├── build.sh ├── common.sh ├── installDependencies.sh ├── runDownload.sh ├── runDoxygen.sh ├── runMatlab.sh ├── runSimpleDebug.sh ├── runTests.sh ├── runValgrindAntena.sh ├── runValgrindKatowice.sh ├── runValgrindUnittests.sh └── valgrind_supps │ ├── gst.supp │ └── nm.supp ├── sdrtool ├── src ├── rscode │ ├── .gitignore │ ├── CMakeLists.txt │ ├── LICENSE │ ├── Makefile │ ├── README │ ├── berlekamp.c │ ├── config.doc │ ├── crcgen.c │ ├── ecc.h │ ├── example.c │ ├── galois.c │ ├── gpl.txt │ ├── rs.c │ └── rs.doc ├── rtlsdr │ ├── .gitignore │ ├── .travis.yml │ ├── AUTHORS │ ├── CMakeLists.txt │ ├── COPYING │ ├── Doxyfile.in │ ├── Makefile.am │ ├── README │ ├── cmake │ │ ├── Modules │ │ │ ├── FindLibUSB.cmake │ │ │ ├── FindThreads.cmake │ │ │ └── Version.cmake │ │ └── cmake_uninstall.cmake.in │ ├── configure.ac │ ├── git-version-gen │ ├── include │ │ ├── CMakeLists.txt │ │ ├── Makefile.am │ │ ├── reg_field.h │ │ ├── rtl-sdr.h │ │ ├── rtl-sdr_export.h │ │ ├── rtlsdr_i2c.h │ │ ├── tuner_e4k.h │ │ ├── tuner_fc0012.h │ │ ├── tuner_fc0013.h │ │ ├── tuner_fc2580.h │ │ └── tuner_r82xx.h │ ├── librtlsdr.pc.in │ ├── m4 │ │ └── .gitignore │ ├── rtl-sdr.rules │ └── src │ │ ├── CMakeLists.txt │ │ ├── Makefile.am │ │ ├── convenience │ │ ├── convenience.c │ │ └── convenience.h │ │ ├── getopt │ │ ├── getopt.c │ │ └── getopt.h │ │ ├── librtlsdr.c │ │ ├── rtl_adsb.c │ │ ├── rtl_eeprom.c │ │ ├── rtl_fm.c │ │ ├── rtl_power.c │ │ ├── rtl_sdr.c │ │ ├── rtl_tcp.c │ │ ├── rtl_test.c │ │ ├── rtlsdr.rc.in │ │ ├── tuner_e4k.c │ │ ├── tuner_fc0012.c │ │ ├── tuner_fc0013.c │ │ ├── tuner_fc2580.c │ │ └── tuner_r82xx.c ├── sdrdab-cli │ ├── .gitignore │ ├── CMakeLists.txt │ ├── cli_scheduler.cc │ ├── cli_scheduler.h │ ├── read_line.cc │ ├── read_line.h │ ├── sdrdab-cli.cc │ ├── sdrdab-cli.doxyfile │ ├── user_data.cc │ ├── user_data.h │ ├── user_input.cc │ └── user_input.h ├── sdrdab-gui │ ├── CMakeLists.txt │ ├── main.cc │ ├── mainwindow.cc │ ├── mainwindow.h │ ├── mainwindow.ui │ ├── sdrdab-gui.pro │ ├── sdrdab-gui.pro.user │ ├── todo.txt │ ├── user_conf.cc │ ├── user_conf.h │ ├── user_data.cc │ └── user_data.h └── sdrdab │ ├── .gitignore │ ├── AudioDecoder │ ├── abstract_sink.cc │ ├── abstract_sink.h │ ├── abstract_src.cc │ ├── abstract_src.h │ ├── blocking_ring_buffer.cc │ ├── blocking_ring_buffer.h │ ├── fake_sink.cc │ ├── fake_sink.h │ ├── file_sink.cc │ ├── file_sink.h │ ├── file_src.cc │ ├── file_src.h │ ├── null_sink.cc │ ├── null_sink.h │ ├── ogg_sink.cc │ ├── ogg_sink.h │ ├── player.cc │ ├── player.h │ ├── pulse_sink.cc │ ├── pulse_sink.h │ ├── ring_src.cc │ └── ring_src.h │ ├── CMakeLists.txt │ ├── DataDecoder │ ├── data_decoder_data.h │ ├── depuncturer.cc │ ├── depuncturer.h │ ├── deviterbi.cc │ ├── deviterbi.h │ ├── energy_dispersal.cc │ ├── energy_dispersal.h │ ├── extract_from_bitstream.cc │ ├── extract_from_bitstream.h │ ├── reed_solomon.cc │ ├── reed_solomon.h │ ├── superframe.cc │ └── superframe.h │ ├── DataFeeder │ ├── abstract_data_feeder.cc │ ├── abstract_data_feeder.h │ ├── file_data_feeder.cc │ ├── file_data_feeder.h │ ├── rtl_data_feeder.cc │ └── rtl_data_feeder.h │ ├── Resampler │ ├── resampler.cc │ └── resampler.h │ ├── RingBuffer │ ├── resampling_ring_buffer.cc │ ├── resampling_ring_buffer.h │ └── ring_buffer.h │ ├── audio_decoder.cc │ ├── audio_decoder.h │ ├── data_decoder.cc │ ├── data_decoder.h │ ├── data_format.h │ ├── demodulator.cc │ ├── demodulator.h │ ├── fft_engine.cc │ ├── fft_engine.h │ ├── osx_compat.cc │ ├── osx_compat.h │ ├── scheduler.cc │ ├── scheduler.h │ ├── sdrdab.doxyfile │ ├── synchronizer.cc │ ├── synchronizer.h │ ├── synchronizer_data.h │ └── threading │ ├── blocking_queue.h │ ├── scoped_lock.cc │ ├── scoped_lock.h │ ├── signaled_worker_thread.cc │ ├── signaled_worker_thread.h │ └── wrapper_functions.h └── test ├── AbstractDataFeeder_Remodulator_unittest.cc ├── AudioDecoder_Test_unittest.cc ├── CMakeLists.txt ├── DataDecoder_BinToDEc_unittest.cc ├── DataDecoder_CRC16_unittest.cc ├── DataDecoder_FIC_unittest.cc ├── DataDecoder_FIGT0E00_unittest.cc ├── DataDecoder_FIGT0E01long_unittest.cc ├── DataDecoder_FIGT0E02msc_unittest.cc ├── DataDecoder_FIGT0E06_unittest.cc ├── DataDecoder_FIGT0E08fic1_unittest.cc ├── DataDecoder_FIGT0E09_unittest.cc ├── DataDecoder_FIGT0E10_unittest.cc ├── DataDecoder_FIGT0E13_unittest.cc ├── DataDecoder_FIGT0E17_unittest.cc ├── DataDecoder_FIGT0E21_unittest.cc ├── DataDecoder_FIGT1E00_unittest.cc ├── DataDecoder_FIGT1E01_unittest.cc ├── DataDecoder_ReedSolomon_unittest.cc ├── DataDecoder_TimeDeInterleaver_unittest.cc ├── DataDecoder_ViterbiDecoder_unittest.cc ├── DataFeeder_DCRemoval_unittest.cc ├── Demodulator_Gain42_Long_Test_unittest.cc ├── Demodulator_Test_unittest.cc ├── FFTEngine_Test_unittest.cc ├── FileDataFeeder_Remodulator_unittest.cc ├── Gprof_unittest.cc ├── MatlabIO.cc ├── MatlabIO.h ├── Resampler_Test_unittest.cc ├── RingBuffer_Test_unittest.cc ├── Scheduler_Test_unittest.cc ├── Synchronizer_SNR_unittest.cc ├── Threading_BlockingQueue_unittest.cc ├── Threading_ScopedLock_unittest.cc ├── Threading_SignaledWorkerThread_unittest.cc ├── _broken_ut ├── !!!Synchronizer_Test_unittest.cc ├── DataDecoder_Depuncturer_unittest.cc ├── DataDecoder_EnergyDispersal_unittest.cc ├── DataDecoder_MSC_unittest.cc ├── DataDecoder_Super_Frame_unittest.cc ├── ReedSolomon_unittest.cc ├── Synchronizer_Gain42_Test_unittest.cc └── Synchronizer_Phase_Reference_unittest.cc ├── gtest ├── CHANGES ├── CMakeLists.txt ├── CONTRIBUTORS ├── LICENSE ├── Makefile.am ├── Makefile.in ├── README ├── aclocal.m4 ├── build-aux │ ├── config.guess │ ├── config.h.in │ ├── config.sub │ ├── depcomp │ ├── install-sh │ ├── ltmain.sh │ └── missing ├── cmake │ └── internal_utils.cmake ├── codegear │ ├── gtest.cbproj │ ├── gtest.groupproj │ ├── gtest_all.cc │ ├── gtest_link.cc │ ├── gtest_main.cbproj │ └── gtest_unittest.cbproj ├── configure ├── configure.ac ├── fused-src │ └── gtest │ │ ├── gtest-all.cc │ │ ├── gtest.h │ │ └── gtest_main.cc ├── include │ └── gtest │ │ ├── gtest-death-test.h │ │ ├── gtest-message.h │ │ ├── gtest-param-test.h │ │ ├── gtest-param-test.h.pump │ │ ├── gtest-printers.h │ │ ├── gtest-spi.h │ │ ├── gtest-test-part.h │ │ ├── gtest-typed-test.h │ │ ├── gtest.h │ │ ├── gtest_pred_impl.h │ │ ├── gtest_prod.h │ │ └── internal │ │ ├── gtest-death-test-internal.h │ │ ├── gtest-filepath.h │ │ ├── gtest-internal.h │ │ ├── gtest-linked_ptr.h │ │ ├── gtest-param-util-generated.h │ │ ├── gtest-param-util-generated.h.pump │ │ ├── gtest-param-util.h │ │ ├── gtest-port.h │ │ ├── gtest-string.h │ │ ├── gtest-tuple.h │ │ ├── gtest-tuple.h.pump │ │ ├── gtest-type-util.h │ │ └── gtest-type-util.h.pump ├── m4 │ ├── acx_pthread.m4 │ ├── gtest.m4 │ ├── libtool.m4 │ ├── ltoptions.m4 │ ├── ltsugar.m4 │ ├── ltversion.m4 │ └── lt~obsolete.m4 ├── make │ └── Makefile ├── msvc │ ├── gtest-md.sln │ ├── gtest-md.vcproj │ ├── gtest.sln │ ├── gtest.vcproj │ ├── gtest_main-md.vcproj │ ├── gtest_main.vcproj │ ├── gtest_prod_test-md.vcproj │ ├── gtest_prod_test.vcproj │ ├── gtest_unittest-md.vcproj │ └── gtest_unittest.vcproj ├── samples │ ├── prime_tables.h │ ├── sample1.cc │ ├── sample1.h │ ├── sample10_unittest.cc │ ├── sample1_unittest.cc │ ├── sample2.cc │ ├── sample2.h │ ├── sample2_unittest.cc │ ├── sample3-inl.h │ ├── sample3_unittest.cc │ ├── sample4.cc │ ├── sample4.h │ ├── sample4_unittest.cc │ ├── sample5_unittest.cc │ ├── sample6_unittest.cc │ ├── sample7_unittest.cc │ ├── sample8_unittest.cc │ └── sample9_unittest.cc ├── scripts │ ├── fuse_gtest_files.py │ ├── gen_gtest_pred_impl.py │ ├── gtest-config.in │ ├── pump.py │ └── test │ │ └── Makefile ├── src │ ├── gtest-all.cc │ ├── gtest-death-test.cc │ ├── gtest-filepath.cc │ ├── gtest-internal-inl.h │ ├── gtest-port.cc │ ├── gtest-printers.cc │ ├── gtest-test-part.cc │ ├── gtest-typed-test.cc │ ├── gtest.cc │ └── gtest_main.cc ├── test │ ├── gtest-death-test_ex_test.cc │ ├── gtest-death-test_test.cc │ ├── gtest-filepath_test.cc │ ├── gtest-linked_ptr_test.cc │ ├── gtest-listener_test.cc │ ├── gtest-message_test.cc │ ├── gtest-options_test.cc │ ├── gtest-param-test2_test.cc │ ├── gtest-param-test_test.cc │ ├── gtest-param-test_test.h │ ├── gtest-port_test.cc │ ├── gtest-printers_test.cc │ ├── gtest-test-part_test.cc │ ├── gtest-tuple_test.cc │ ├── gtest-typed-test2_test.cc │ ├── gtest-typed-test_test.cc │ ├── gtest-typed-test_test.h │ ├── gtest-unittest-api_test.cc │ ├── gtest_all_test.cc │ ├── gtest_break_on_failure_unittest.py │ ├── gtest_break_on_failure_unittest_.cc │ ├── gtest_catch_exceptions_test.py │ ├── gtest_catch_exceptions_test_.cc │ ├── gtest_color_test.py │ ├── gtest_color_test_.cc │ ├── gtest_env_var_test.py │ ├── gtest_env_var_test_.cc │ ├── gtest_environment_test.cc │ ├── gtest_filter_unittest.py │ ├── gtest_filter_unittest_.cc │ ├── gtest_help_test.py │ ├── gtest_help_test_.cc │ ├── gtest_list_tests_unittest.py │ ├── gtest_list_tests_unittest_.cc │ ├── gtest_main_unittest.cc │ ├── gtest_no_test_unittest.cc │ ├── gtest_output_test.py │ ├── gtest_output_test_.cc │ ├── gtest_output_test_golden_lin.txt │ ├── gtest_pred_impl_unittest.cc │ ├── gtest_premature_exit_test.cc │ ├── gtest_prod_test.cc │ ├── gtest_repeat_test.cc │ ├── gtest_shuffle_test.py │ ├── gtest_shuffle_test_.cc │ ├── gtest_sole_header_test.cc │ ├── gtest_stress_test.cc │ ├── gtest_test_utils.py │ ├── gtest_throw_on_failure_ex_test.cc │ ├── gtest_throw_on_failure_test.py │ ├── gtest_throw_on_failure_test_.cc │ ├── gtest_uninitialized_test.py │ ├── gtest_uninitialized_test_.cc │ ├── gtest_unittest.cc │ ├── gtest_xml_outfile1_test_.cc │ ├── gtest_xml_outfile2_test_.cc │ ├── gtest_xml_outfiles_test.py │ ├── gtest_xml_output_unittest.py │ ├── gtest_xml_output_unittest_.cc │ ├── gtest_xml_test_utils.py │ ├── production.cc │ └── production.h └── xcode │ ├── Config │ ├── DebugProject.xcconfig │ ├── FrameworkTarget.xcconfig │ ├── General.xcconfig │ ├── ReleaseProject.xcconfig │ ├── StaticLibraryTarget.xcconfig │ └── TestTarget.xcconfig │ ├── Resources │ └── Info.plist │ ├── Samples │ └── FrameworkSample │ │ ├── Info.plist │ │ ├── WidgetFramework.xcodeproj │ │ └── project.pbxproj │ │ ├── runtests.sh │ │ ├── widget.cc │ │ ├── widget.h │ │ └── widget_test.cc │ ├── Scripts │ ├── runtests.sh │ └── versiongenerate.py │ └── gtest.xcodeproj │ └── project.pbxproj ├── gtest_main.cc ├── myTimer.cc ├── myTimer.h └── myTimer_unittest.cc /.gitignore: -------------------------------------------------------------------------------- 1 | *.pydevproject 2 | .gradle 3 | bin/ 4 | tmp/ 5 | *.tmp 6 | *.bak 7 | *.swp 8 | *~.nib 9 | local.properties 10 | .loadpath 11 | .idea 12 | *~ 13 | /src/sdrdab-gui/ui_*.h 14 | 15 | # Eclipse Core 16 | .metadata 17 | .settings/ 18 | 19 | # CDT-specific 20 | 21 | # JDT-specific (Eclipse Java Development Tools) 22 | .classpath 23 | 24 | # PDT-specific 25 | .buildpath 26 | 27 | # sbteclipse plugin 28 | .target 29 | 30 | # TeXlipse plugin 31 | .texlipse 32 | 33 | # Sublime ST3 34 | .sublime-project.sublime-workspace 35 | 36 | # CMake build dir 37 | build/ 38 | 39 | # Doxygen 40 | doc/ 41 | 42 | # Matlab 43 | matlab/**/*.aac 44 | 45 | # Data files 46 | data/ 47 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | build: 2 | script: 3 | - ./sdrtool build Debug 4 | only: 5 | - development 6 | 7 | unittest: 8 | script: 9 | - ./sdrtool build Unittest 10 | - rm -vr data 11 | - ln -s ~/sdrdab-test/data data 12 | - ./sdrtool run-unittests 13 | only: 14 | - development 15 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12.2) 2 | project(DAB-Decoder-2016) 3 | include("cmake/Modules/FindSSE.cmake") 4 | if(CXX_SSE3_FOUND) 5 | add_definitions( -DSSE3_FOUND=1 ) 6 | SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3 -O3" ) 7 | endif() 8 | 9 | if(PROFILING) 10 | add_definitions(-pg) 11 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") 12 | endif() 13 | 14 | add_subdirectory(src/rtlsdr) 15 | add_subdirectory(src/rscode) 16 | add_subdirectory(src/sdrdab) 17 | add_subdirectory(src/sdrdab-cli) 18 | 19 | # comment next line if you don't want to build Qt GUI 20 | add_subdirectory(src/sdrdab-gui) 21 | 22 | if(MAKE_TESTS) 23 | add_subdirectory(test) 24 | endif() 25 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | ========================================= 2 | Software Defined Radio - DAB+ (libsdrdab) 3 | ========================================= 4 | 5 | Version. 2.0, 2016-06-07 6 | ============================= 7 | - new Scheduler: faster, more stable, readable code 8 | - refactored DataDecoder 9 | - rewritten remodulation (fc): make use of LUT 10 | - Viterbi optimization by means of SSE3 (up to 3x improvement) 11 | - refactored Synchronizer 12 | - support legacy DAB (MPEG) and DAB+ (AAC) 13 | - added two versions of SNR calculation: from spectrum (RAW) and prefix 14 | - rewritten build system, now using cmake instead of Eclipse 15 | - MacOS X support 16 | - improved debug logging 17 | - refactored DataFeeder (needs even more refactoring) 18 | - simple GUI implementation (needs to be rewritten and improved) 19 | - acquired DAB+ signal for testing 20 | - upgraded sdrdab-cli (more parameters) 21 | - Matlab reference software for DAB(+) decoder 22 | - included UnitTests 23 | - MODE III still not supported 24 | 25 | Version. 1.0 BETA, 2015-07-07 26 | ============================= 27 | - x86, real-time implementation (i7-3520M: 20-100% CPU utilization depending on configuration) 28 | - decoding type: file2file, file2speaker, air2file, air2speaker 29 | - MODE I, MODE II, MODE IV (MODE III supported but buggy - does not works) 30 | - input devices: all tuners supported by rtlsdr (tested on RLT2832U + R820T, R820T2) 31 | - input file: biarny, 8 bits per I/Q sample (unsigned int, 127 == 0), format: IQIQIQIQIQ... 32 | - change carrier frequency on air2* mode 33 | - fine tune carrier frequency (ppm) 34 | - 2.048 MHz base sampling frequency (resampling if necessary in file2* mode) 35 | - decode station list with names 36 | - switch between stations in real-time 37 | - DAB+ (AAC) without XPAD, only audio (old DAB MPEG supported but buggy - does not works) 38 | -------------------------------------------------------------------------------- /cmake/Modules/FindLibUSB.cmake: -------------------------------------------------------------------------------- 1 | if(NOT LIBUSB_FOUND) 2 | pkg_check_modules (LIBUSB_PKG libusb-1.0) 3 | find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h 4 | PATHS 5 | ${LIBUSB_PKG_INCLUDE_DIRS} 6 | /usr/include/libusb-1.0 7 | /usr/include 8 | /usr/local/include 9 | ) 10 | 11 | #standard library name for libusb-1.0 12 | set(libusb1_library_names usb-1.0) 13 | 14 | #libusb-1.0 compatible library on freebsd 15 | if((CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") OR (CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD")) 16 | list(APPEND libusb1_library_names usb) 17 | endif() 18 | 19 | find_library(LIBUSB_LIBRARIES 20 | NAMES ${libusb1_library_names} 21 | PATHS 22 | ${LIBUSB_PKG_LIBRARY_DIRS} 23 | /usr/lib 24 | /usr/local/lib 25 | ) 26 | 27 | include(CheckFunctionExists) 28 | if(LIBUSB_INCLUDE_DIRS) 29 | set(CMAKE_REQUIRED_INCLUDES ${LIBUSB_INCLUDE_DIRS}) 30 | endif() 31 | if(LIBUSB_LIBRARIES) 32 | set(CMAKE_REQUIRED_LIBRARIES ${LIBUSB_LIBRARIES}) 33 | endif() 34 | 35 | CHECK_FUNCTION_EXISTS("libusb_handle_events_timeout_completed" HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED) 36 | if(HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED) 37 | add_definitions(-DHAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED=1) 38 | endif(HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED) 39 | 40 | CHECK_FUNCTION_EXISTS("libusb_error_name" HAVE_LIBUSB_ERROR_NAME) 41 | if(HAVE_LIBUSB_ERROR_NAME) 42 | add_definitions(-DHAVE_LIBUSB_ERROR_NAME=1) 43 | endif(HAVE_LIBUSB_ERROR_NAME) 44 | 45 | if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) 46 | set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found") 47 | message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}") 48 | else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) 49 | set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found") 50 | message(STATUS "libusb-1.0 not found.") 51 | endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) 52 | 53 | mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES) 54 | 55 | endif(NOT LIBUSB_FOUND) 56 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F 2 | 3 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 5 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 | 7 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 8 | STRING(REGEX REPLACE "\n" ";" files "${files}") 9 | FOREACH(file ${files}) 10 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | IF(EXISTS "$ENV{DESTDIR}${file}") 12 | EXEC_PROGRAM( 13 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 14 | OUTPUT_VARIABLE rm_out 15 | RETURN_VALUE rm_retval 16 | ) 17 | IF(NOT "${rm_retval}" STREQUAL 0) 18 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 19 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 20 | ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") 21 | EXEC_PROGRAM( 22 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 23 | OUTPUT_VARIABLE rm_out 24 | RETURN_VALUE rm_retval 25 | ) 26 | IF(NOT "${rm_retval}" STREQUAL 0) 27 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 28 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 29 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 30 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 31 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 32 | ENDFOREACH(file) 33 | -------------------------------------------------------------------------------- /matlab/EnergyDispGen.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Energy Dispersal Sequense Generation - ETSI pp. 128-129 19 | % ----------------------------------------------------------------------------------------- 20 | function [PRBS] = EnergyDispGen(size) 21 | Vector = [1 1 1 1 1 1 1 1 1]; % initialization word/register 22 | PRBS= zeros(1,size); 23 | CounterPRBS = 1; 24 | for i = 0 : size-1 25 | NewBit = xor(Vector(5),Vector(9)); % calculate a new bit 26 | Vector = [NewBit Vector(1:end-1)]; % store it in a work register 27 | PRBS(CounterPRBS) = NewBit; % write the bit into output sequense 28 | CounterPRBS = CounterPRBS + 1; % incease the counter 29 | end -------------------------------------------------------------------------------- /matlab/FICDecoder_UT/ADCFreqCheck.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | % ----------------------------------------------------------------------------------------- 19 | % Distance between consecutive frames in samples 20 | % ----------------------------------------------------------------------------------------- 21 | 22 | function [] = ADCFreqCheck(FrameStartpoints) 23 | 24 | x = FrameStartpoints(2:length(FrameStartpoints))-FrameStartpoints(1:length(FrameStartpoints)-1); 25 | y= find(x>195000); 26 | x = x(min(y):length(x)); 27 | figure('Name','DAB frame length differences - Histogram'); 28 | hist(x-196608) -------------------------------------------------------------------------------- /matlab/FICDecoder_UT/BinToDec.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Binary to decimal 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = BinToDec( ValueIn, BitsPerSign ) 21 | 22 | ValueOut= bin2dec( reshape( char(ValueIn+'0'), BitsPerSign, [])' )'; -------------------------------------------------------------------------------- /matlab/FICDecoder_UT/CRC16.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | function [Check] = CRC16(Data) 19 | 20 | CRC = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; % Initialization word 21 | Polynomial = [0 0 0 1 0 0 0 0 0 0 1 0 0 0 0]; % [MSB ... LSB] 22 | 23 | % size(Data) 24 | Data(end-15:end) = xor( Data(end-15:end),CRC ); % complement of 16 last data 25 | 26 | for i = 1:length(Data) % CRC calculation 27 | if( xor(CRC(1),Data(i)) == 1) 28 | CRC = [ xor( Polynomial,CRC(2:end) ) 1]; 29 | else 30 | CRC = [ CRC(2:end) 0 ]; 31 | end 32 | end 33 | 34 | if sum(CRC) == 0 % CRC verification 35 | Check = 1; 36 | else 37 | Check = 0; 38 | end -------------------------------------------------------------------------------- /matlab/FICDecoder_UT/DAB_DECODER_OKfast.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/FICDecoder_UT/DAB_DECODER_OKfast.m -------------------------------------------------------------------------------- /matlab/FICDecoder_UT/DAB_FIC.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/FICDecoder_UT/DAB_FIC.m -------------------------------------------------------------------------------- /matlab/FICDecoder_UT/DAB_FIC_test.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/FICDecoder_UT/DAB_FIC_test.m -------------------------------------------------------------------------------- /matlab/FICDecoder_UT/DecToBin.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Decimal to binary 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = DecToBin( ValueIn, NoBits ) 21 | 22 | string = dec2bin( ValueIn, NoBits ); 23 | for k = 1:NoBits 24 | ValueOut(k) = str2num( string(k) ); 25 | end 26 | -------------------------------------------------------------------------------- /matlab/FICDecoder_UT/EnergyDispGen.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Energy Dispersal Sequense Generation - ETSI pp. 128-129 19 | % ----------------------------------------------------------------------------------------- 20 | function [PRBS] = EnergyDispGen(size) 21 | Vector = [1 1 1 1 1 1 1 1 1]; % initialization word/register 22 | PRBS= zeros(1,size); 23 | CounterPRBS = 1; 24 | for i = 0 : size-1 25 | NewBit = xor(Vector(5),Vector(9)); % calculate a new bit 26 | Vector = [NewBit Vector(1:end-1)]; % store it in a work register 27 | PRBS(CounterPRBS) = NewBit; % write the bit into output sequense 28 | CounterPRBS = CounterPRBS + 1; % incease the counter 29 | end -------------------------------------------------------------------------------- /matlab/FICDecoder_UT/FreqDeinterleaverTabGen.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ---------------------------------------------------------------------------------------------- 18 | % Building frequency de-interleaving table (Standard Pages 157-161) 19 | % Function works for DAB modes I, II, III and IV 20 | % However examplary numbers in comments are given for mode=1 21 | % ---------------------------------------------------------------------------------------------- 22 | 23 | function [ DeinterleaverTab ] = BuildFreqDeInterleaverTab( InterleaverTab, Nfft ) 24 | 25 | % Calculate de-interleaving table from the interleaving one having Nfft rows: take only 2 columns: n and k 26 | DeinterleaverTab = sortrows( InterleaverTab(:, 4:5), 2 ); % sort row 4 (n) and 5 (k) according to column 2 (pi(i)) 27 | DeinterleaverTab = DeinterleaverTab( Nfft/4+1:end,: ); % remove initial 512 nulls/spaces [0,..,511] - not used 28 | 29 | % Calculate k-number of the carrier - append as a new column 3: in order 1,2,3,..., 1536 30 | DeinterleaverTab(:,3) = [ DeinterleaverTab( 1 : Nfft/8*3, 2 )+1 ;... % [ De(1:768,2)+1; 31 | DeinterleaverTab( Nfft/8*3+1 : Nfft/8*6, 2) ] ... % De(769:1536,2) 32 | + Nfft/8*3; % + 768 ] 33 | % Calculate n-number of the QPSK symbol - append as a new column 4: not in order (interleaved) 1,2,3,..., 1536 34 | DeinterleaverTab(:,4) = DeinterleaverTab(:,1)+1; 35 | % DeinterleaverTab(1:5,3:4), DeinterleaverTab(end-4:end,3:4), pause % Test only 36 | -------------------------------------------------------------------------------- /matlab/FICDecoder_UT/SuperFrameHandlingX.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/FICDecoder_UT/SuperFrameHandlingX.m -------------------------------------------------------------------------------- /matlab/FICDecoder_UT/read_complex_binary.m: -------------------------------------------------------------------------------- 1 | % 2 | % Copyright 2001 Free Software Foundation, Inc. 3 | % 4 | % This file is part of GNU Radio 5 | % 6 | % GNU Radio is free software; you can redistribute it and/or modify 7 | % it under the terms of the GNU General Public License as published by 8 | % the Free Software Foundation; either version 2, or (at your option) 9 | % any later version. 10 | % 11 | % GNU Radio is distributed in the hope that it will be useful, 12 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | % GNU General Public License for more details. 15 | % 16 | % You should have received a copy of the GNU General Public License 17 | % along with GNU Radio; see the file COPYING. If not, write to 18 | % the Free Software Foundation, Inc., 51 Franklin Street, 19 | % Boston, MA 02110-1301, USA. 20 | % 21 | 22 | function v = read_complex_binary(filename, count) 23 | 24 | %% usage: read_complex_binary (filename, [count]) 25 | %% 26 | %% open filename and return the contents as a column vector, 27 | %% treating them as 32 bit complex numbers 28 | %% 29 | 30 | m = nargchk (1,2,nargin); 31 | if (m) 32 | usage (m); 33 | end 34 | 35 | if (nargin < 2) 36 | count = Inf; 37 | end 38 | 39 | f = fopen(filename, 'rb'); 40 | if (f < 0) 41 | v = 0; 42 | else 43 | t = fread (f, [2, count], 'float'); 44 | fclose (f); 45 | v = t(1,:) + t(2,:)*i; 46 | [r, c] = size (v); 47 | v = reshape (v, c, r); 48 | end 49 | -------------------------------------------------------------------------------- /matlab/FICDecoder_unittest.m: -------------------------------------------------------------------------------- 1 | %% Start script 2 | cd FICDecoder_UT/ 3 | DAB_ALL_RTm1 4 | DAB_ALL_RTm2 5 | DAB_ALL_RTm3 6 | DAB_ALL_RTm4 7 | cd .. 8 | -------------------------------------------------------------------------------- /matlab/FIGType.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/FIGType.m -------------------------------------------------------------------------------- /matlab/MSCDecoder_UT/ADCFreqCheck.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | % ----------------------------------------------------------------------------------------- 19 | % Distance between consecutive frames in samples 20 | % ----------------------------------------------------------------------------------------- 21 | 22 | function [] = ADCFreqCheck(FrameStartpoints) 23 | 24 | x = FrameStartpoints(2:length(FrameStartpoints))-FrameStartpoints(1:length(FrameStartpoints)-1); 25 | y= find(x>195000); 26 | x = x(min(y):length(x)); 27 | figure('Name','DAB frame length differences - Histogram'); 28 | hist(x-196608) -------------------------------------------------------------------------------- /matlab/MSCDecoder_UT/BinToDec.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Binary to decimal 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = BinToDec( ValueIn, BitsPerSign ) 21 | 22 | ValueOut= bin2dec( reshape( char(ValueIn+'0'), BitsPerSign, [])' )'; -------------------------------------------------------------------------------- /matlab/MSCDecoder_UT/CRC16.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | function [Check] = CRC16(Data) 19 | 20 | CRC = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; % Initialization word 21 | Polynomial = [0 0 0 1 0 0 0 0 0 0 1 0 0 0 0]; % [MSB ... LSB] 22 | 23 | % size(Data) 24 | Data(end-15:end) = xor( Data(end-15:end),CRC ); % complement of 16 last data 25 | 26 | for i = 1:length(Data) % CRC calculation 27 | if( xor(CRC(1),Data(i)) == 1) 28 | CRC = [ xor( Polynomial,CRC(2:end) ) 1]; 29 | else 30 | CRC = [ CRC(2:end) 0 ]; 31 | end 32 | end 33 | 34 | if sum(CRC) == 0 % CRC verification 35 | Check = 1; 36 | else 37 | Check = 0; 38 | end -------------------------------------------------------------------------------- /matlab/MSCDecoder_UT/DAB_DECODER_OKfast.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/MSCDecoder_UT/DAB_DECODER_OKfast.m -------------------------------------------------------------------------------- /matlab/MSCDecoder_UT/DAB_FIC.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/MSCDecoder_UT/DAB_FIC.m -------------------------------------------------------------------------------- /matlab/MSCDecoder_UT/DAB_FIC_test.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/MSCDecoder_UT/DAB_FIC_test.m -------------------------------------------------------------------------------- /matlab/MSCDecoder_UT/DecToBin.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Decimal to binary 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = DecToBin( ValueIn, NoBits ) 21 | 22 | string = dec2bin( ValueIn, NoBits ); 23 | for k = 1:NoBits 24 | ValueOut(k) = str2num( string(k) ); 25 | end 26 | -------------------------------------------------------------------------------- /matlab/MSCDecoder_UT/EnergyDispGen.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Energy Dispersal Sequense Generation - ETSI pp. 128-129 19 | % ----------------------------------------------------------------------------------------- 20 | function [PRBS] = EnergyDispGen(size) 21 | Vector = [1 1 1 1 1 1 1 1 1]; % initialization word/register 22 | PRBS= zeros(1,size); 23 | CounterPRBS = 1; 24 | for i = 0 : size-1 25 | NewBit = xor(Vector(5),Vector(9)); % calculate a new bit 26 | Vector = [NewBit Vector(1:end-1)]; % store it in a work register 27 | PRBS(CounterPRBS) = NewBit; % write the bit into output sequense 28 | CounterPRBS = CounterPRBS + 1; % incease the counter 29 | end -------------------------------------------------------------------------------- /matlab/MSCDecoder_UT/SuperFrameHandlingX.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/MSCDecoder_UT/SuperFrameHandlingX.m -------------------------------------------------------------------------------- /matlab/MSCDecoder_UT/read_complex_binary.m: -------------------------------------------------------------------------------- 1 | % 2 | % Copyright 2001 Free Software Foundation, Inc. 3 | % 4 | % This file is part of GNU Radio 5 | % 6 | % GNU Radio is free software; you can redistribute it and/or modify 7 | % it under the terms of the GNU General Public License as published by 8 | % the Free Software Foundation; either version 2, or (at your option) 9 | % any later version. 10 | % 11 | % GNU Radio is distributed in the hope that it will be useful, 12 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | % GNU General Public License for more details. 15 | % 16 | % You should have received a copy of the GNU General Public License 17 | % along with GNU Radio; see the file COPYING. If not, write to 18 | % the Free Software Foundation, Inc., 51 Franklin Street, 19 | % Boston, MA 02110-1301, USA. 20 | % 21 | 22 | function v = read_complex_binary(filename, count) 23 | 24 | %% usage: read_complex_binary (filename, [count]) 25 | %% 26 | %% open filename and return the contents as a column vector, 27 | %% treating them as 32 bit complex numbers 28 | %% 29 | 30 | m = nargchk (1,2,nargin); 31 | if (m) 32 | usage (m); 33 | end 34 | 35 | if (nargin < 2) 36 | count = Inf; 37 | end 38 | 39 | f = fopen(filename, 'rb'); 40 | if (f < 0) 41 | v = 0; 42 | else 43 | t = fread (f, [2, count], 'float'); 44 | fclose (f); 45 | v = t(1,:) + t(2,:)*i; 46 | [r, c] = size (v); 47 | v = reshape (v, c, r); 48 | end 49 | -------------------------------------------------------------------------------- /matlab/MSCDecoder_unittest.m: -------------------------------------------------------------------------------- 1 | %% Start script 2 | cd MSCDecoder_UT/ 3 | DAB_ALL_RT_m1 4 | DAB_ALL_RT_m2 5 | DAB_ALL_RT_m3 6 | DAB_ALL_RT_m4 7 | cd .. 8 | -------------------------------------------------------------------------------- /matlab/ReedSolomon_DataGeneration.m: -------------------------------------------------------------------------------- 1 | %% Start script 2 | cd ReedSolomon_MatlabDataSave_ForUnittest/ 3 | DAB_ALL_RT 4 | cd .. -------------------------------------------------------------------------------- /matlab/ReedSolomon_MatlabDataSave_ForUnittest/ADCFreqCheck.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | % ----------------------------------------------------------------------------------------- 19 | % Distance between consecutive frames in samples 20 | % ----------------------------------------------------------------------------------------- 21 | 22 | function [] = ADCFreqCheck(FrameStartpoints) 23 | 24 | x = FrameStartpoints(2:length(FrameStartpoints))-FrameStartpoints(1:length(FrameStartpoints)-1); 25 | y= find(x>195000); 26 | x = x(min(y):length(x)); 27 | figure('Name','DAB frame length differences - Histogram'); 28 | hist(x-196608) -------------------------------------------------------------------------------- /matlab/ReedSolomon_MatlabDataSave_ForUnittest/BinToDec.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Binary to decimal 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = BinToDec( ValueIn, BitsPerSign ) 21 | 22 | ValueOut= bin2dec( reshape( char(ValueIn+'0'), BitsPerSign, [])' )'; -------------------------------------------------------------------------------- /matlab/ReedSolomon_MatlabDataSave_ForUnittest/CRC16.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | function [Check] = CRC16(Data) 19 | 20 | CRC = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; % Initialization word 21 | Polynomial = [0 0 0 1 0 0 0 0 0 0 1 0 0 0 0]; % [MSB ... LSB] 22 | 23 | % size(Data) 24 | Data(end-15:end) = xor( Data(end-15:end),CRC ); % complement of 16 last data 25 | 26 | for i = 1:length(Data) % CRC calculation 27 | if( xor(CRC(1),Data(i)) == 1) 28 | CRC = [ xor( Polynomial,CRC(2:end) ) 1]; 29 | else 30 | CRC = [ CRC(2:end) 0 ]; 31 | end 32 | end 33 | 34 | if sum(CRC) == 0 % CRC verification 35 | Check = 1; 36 | else 37 | Check = 0; 38 | end -------------------------------------------------------------------------------- /matlab/ReedSolomon_MatlabDataSave_ForUnittest/DAB_DECODER_OKfast.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/ReedSolomon_MatlabDataSave_ForUnittest/DAB_DECODER_OKfast.m -------------------------------------------------------------------------------- /matlab/ReedSolomon_MatlabDataSave_ForUnittest/DAB_FIC.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/ReedSolomon_MatlabDataSave_ForUnittest/DAB_FIC.m -------------------------------------------------------------------------------- /matlab/ReedSolomon_MatlabDataSave_ForUnittest/DAB_FIC_test.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/ReedSolomon_MatlabDataSave_ForUnittest/DAB_FIC_test.m -------------------------------------------------------------------------------- /matlab/ReedSolomon_MatlabDataSave_ForUnittest/DAB_file_info.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/ReedSolomon_MatlabDataSave_ForUnittest/DAB_file_info.m -------------------------------------------------------------------------------- /matlab/ReedSolomon_MatlabDataSave_ForUnittest/DecToBin.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Decimal to binary 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = DecToBin( ValueIn, NoBits ) 21 | 22 | string = dec2bin( ValueIn, NoBits ); 23 | for k = 1:NoBits 24 | ValueOut(k) = str2num( string(k) ); 25 | end 26 | -------------------------------------------------------------------------------- /matlab/ReedSolomon_MatlabDataSave_ForUnittest/EnergyDispGen.m: -------------------------------------------------------------------------------- 1 | 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | % Masterthesis 4 | % Zurcher Hochschule fur Angewandte Wissenschaften 5 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 6 | % (c) Michael Hoin 7 | % 12.4.2011 ZSN 8 | % info.zsn@zhaw.ch 9 | % 10 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 11 | % (c) Tomasz Zielinski 12 | % AGH University of Science and Technology 13 | % Telecommunications Department 14 | % Krakow, Poland 15 | % 15.03.2015 16 | % tzielin@agh.edu.pl 17 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 18 | % ----------------------------------------------------------------------------------------- 19 | % Energy Dispersal Sequense Generation - ETSI pp. 128-129 20 | % ----------------------------------------------------------------------------------------- 21 | function [PRBS] = EnergyDispGen(size) 22 | Vector = [1 1 1 1 1 1 1 1 1]; % initialization word/register 23 | PRBS= zeros(1,size); 24 | CounterPRBS = 1; 25 | for i = 0 : size-1 26 | NewBit = xor(Vector(5),Vector(9)); % calculate a new bit 27 | Vector = [NewBit Vector(1:end-1)]; % store it in a work register 28 | PRBS(CounterPRBS) = NewBit; % write the bit into output sequense 29 | CounterPRBS = CounterPRBS + 1; % incease the counter 30 | end -------------------------------------------------------------------------------- /matlab/ReedSolomon_MatlabDataSave_ForUnittest/SuperFrameHandlingX.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/ReedSolomon_MatlabDataSave_ForUnittest/SuperFrameHandlingX.m -------------------------------------------------------------------------------- /matlab/ReedSolomon_MatlabDataSave_ForUnittest/read_complex_binary.m: -------------------------------------------------------------------------------- 1 | % 2 | % Copyright 2001 Free Software Foundation, Inc. 3 | % 4 | % This file is part of GNU Radio 5 | % 6 | % GNU Radio is free software; you can redistribute it and/or modify 7 | % it under the terms of the GNU General Public License as published by 8 | % the Free Software Foundation; either version 2, or (at your option) 9 | % any later version. 10 | % 11 | % GNU Radio is distributed in the hope that it will be useful, 12 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | % GNU General Public License for more details. 15 | % 16 | % You should have received a copy of the GNU General Public License 17 | % along with GNU Radio; see the file COPYING. If not, write to 18 | % the Free Software Foundation, Inc., 51 Franklin Street, 19 | % Boston, MA 02110-1301, USA. 20 | % 21 | 22 | function v = read_complex_binary(filename, count) 23 | 24 | %% usage: read_complex_binary (filename, [count]) 25 | %% 26 | %% open filename and return the contents as a column vector, 27 | %% treating them as 32 bit complex numbers 28 | %% 29 | 30 | m = nargchk (1,2,nargin); 31 | if (m) 32 | usage (m); 33 | end 34 | 35 | if (nargin < 2) 36 | count = Inf; 37 | end 38 | 39 | f = fopen(filename, 'rb'); 40 | if (f < 0) 41 | v = 0; 42 | else 43 | t = fread (f, [2, count], 'float'); 44 | fclose (f); 45 | v = t(1,:) + t(2,:)*i; 46 | [r, c] = size (v); 47 | v = reshape (v, c, r); 48 | end 49 | -------------------------------------------------------------------------------- /matlab/SuperFrame_UT/ADCFreqCheck.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | % ----------------------------------------------------------------------------------------- 19 | % Distance between consecutive frames in samples 20 | % ----------------------------------------------------------------------------------------- 21 | 22 | function [] = ADCFreqCheck(FrameStartpoints) 23 | 24 | x = FrameStartpoints(2:length(FrameStartpoints))-FrameStartpoints(1:length(FrameStartpoints)-1); 25 | y= find(x>195000); 26 | x = x(min(y):length(x)); 27 | figure('Name','DAB frame length differences - Histogram'); 28 | hist(x-196608) -------------------------------------------------------------------------------- /matlab/SuperFrame_UT/BinToDec.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Binary to decimal 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = BinToDec( ValueIn, BitsPerSign ) 21 | 22 | ValueOut= bin2dec( reshape( char(ValueIn+'0'), BitsPerSign, [])' )'; -------------------------------------------------------------------------------- /matlab/SuperFrame_UT/CRC16.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | function [Check] = CRC16(Data) 19 | 20 | CRC = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; % Initialization word 21 | Polynomial = [0 0 0 1 0 0 0 0 0 0 1 0 0 0 0]; % [MSB ... LSB] 22 | 23 | % size(Data) 24 | Data(end-15:end) = xor( Data(end-15:end),CRC ); % complement of 16 last data 25 | 26 | for i = 1:length(Data) % CRC calculation 27 | if( xor(CRC(1),Data(i)) == 1) 28 | CRC = [ xor( Polynomial,CRC(2:end) ) 1]; 29 | else 30 | CRC = [ CRC(2:end) 0 ]; 31 | end 32 | end 33 | 34 | if sum(CRC) == 0 % CRC verification 35 | Check = 1; 36 | else 37 | Check = 0; 38 | end -------------------------------------------------------------------------------- /matlab/SuperFrame_UT/DAB_DECODER_OKfast.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/SuperFrame_UT/DAB_DECODER_OKfast.m -------------------------------------------------------------------------------- /matlab/SuperFrame_UT/DAB_FIC.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/SuperFrame_UT/DAB_FIC.m -------------------------------------------------------------------------------- /matlab/SuperFrame_UT/DAB_FIC_test.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/SuperFrame_UT/DAB_FIC_test.m -------------------------------------------------------------------------------- /matlab/SuperFrame_UT/DecToBin.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Decimal to binary 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = DecToBin( ValueIn, NoBits ) 21 | 22 | string = dec2bin( ValueIn, NoBits ); 23 | for k = 1:NoBits 24 | ValueOut(k) = str2num( string(k) ); 25 | end 26 | -------------------------------------------------------------------------------- /matlab/SuperFrame_UT/EnergyDispGen.m: -------------------------------------------------------------------------------- 1 | 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | % Masterthesis 4 | % Zurcher Hochschule fur Angewandte Wissenschaften 5 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 6 | % (c) Michael Hoin 7 | % 12.4.2011 ZSN 8 | % info.zsn@zhaw.ch 9 | % 10 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 11 | % (c) Tomasz Zielinski 12 | % AGH University of Science and Technology 13 | % Telecommunications Department 14 | % Krakow, Poland 15 | % 15.03.2015 16 | % tzielin@agh.edu.pl 17 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 18 | % ----------------------------------------------------------------------------------------- 19 | % Energy Dispersal Sequense Generation - ETSI pp. 128-129 20 | % ----------------------------------------------------------------------------------------- 21 | function [PRBS] = EnergyDispGen(size) 22 | Vector = [1 1 1 1 1 1 1 1 1]; % initialization word/register 23 | PRBS= zeros(1,size); 24 | CounterPRBS = 1; 25 | for i = 0 : size-1 26 | NewBit = xor(Vector(5),Vector(9)); % calculate a new bit 27 | Vector = [NewBit Vector(1:end-1)]; % store it in a work register 28 | PRBS(CounterPRBS) = NewBit; % write the bit into output sequense 29 | CounterPRBS = CounterPRBS + 1; % incease the counter 30 | end -------------------------------------------------------------------------------- /matlab/SuperFrame_UT/SuperFrameHandlingXm1.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/SuperFrame_UT/SuperFrameHandlingXm1.m -------------------------------------------------------------------------------- /matlab/SuperFrame_UT/SuperFrameHandlingXm2.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/SuperFrame_UT/SuperFrameHandlingXm2.m -------------------------------------------------------------------------------- /matlab/SuperFrame_UT/SuperFrameHandlingXm3.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/SuperFrame_UT/SuperFrameHandlingXm3.m -------------------------------------------------------------------------------- /matlab/SuperFrame_UT/SuperFrameHandlingXm4.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/SuperFrame_UT/SuperFrameHandlingXm4.m -------------------------------------------------------------------------------- /matlab/SuperFrame_UT/read_complex_binary.m: -------------------------------------------------------------------------------- 1 | % 2 | % Copyright 2001 Free Software Foundation, Inc. 3 | % 4 | % This file is part of GNU Radio 5 | % 6 | % GNU Radio is free software; you can redistribute it and/or modify 7 | % it under the terms of the GNU General Public License as published by 8 | % the Free Software Foundation; either version 2, or (at your option) 9 | % any later version. 10 | % 11 | % GNU Radio is distributed in the hope that it will be useful, 12 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | % GNU General Public License for more details. 15 | % 16 | % You should have received a copy of the GNU General Public License 17 | % along with GNU Radio; see the file COPYING. If not, write to 18 | % the Free Software Foundation, Inc., 51 Franklin Street, 19 | % Boston, MA 02110-1301, USA. 20 | % 21 | 22 | function v = read_complex_binary(filename, count) 23 | 24 | %% usage: read_complex_binary (filename, [count]) 25 | %% 26 | %% open filename and return the contents as a column vector, 27 | %% treating them as 32 bit complex numbers 28 | %% 29 | 30 | m = nargchk (1,2,nargin); 31 | if (m) 32 | usage (m); 33 | end 34 | 35 | if (nargin < 2) 36 | count = Inf; 37 | end 38 | 39 | f = fopen(filename, 'rb'); 40 | if (f < 0) 41 | v = 0; 42 | else 43 | t = fread (f, [2, count], 'float'); 44 | fclose (f); 45 | v = t(1,:) + t(2,:)*i; 46 | [r, c] = size (v); 47 | v = reshape (v, c, r); 48 | end 49 | -------------------------------------------------------------------------------- /matlab/SuperFrame_unittest.m: -------------------------------------------------------------------------------- 1 | %% Start script 2 | cd SuperFrame_UT/ 3 | DAB_ALL_RT_m1 4 | DAB_ALL_RT_m2 5 | DAB_ALL_RT_m3 6 | DAB_ALL_RT_m4 7 | cd .. 8 | -------------------------------------------------------------------------------- /matlab/Viterbi/ADCFreqCheck.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | % ----------------------------------------------------------------------------------------- 19 | % Distance between consecutive frames in samples 20 | % ----------------------------------------------------------------------------------------- 21 | 22 | function [] = ADCFreqCheck(FrameStartpoints) 23 | 24 | x = FrameStartpoints(2:length(FrameStartpoints))-FrameStartpoints(1:length(FrameStartpoints)-1); 25 | y= find(x>195000); 26 | x = x(min(y):length(x)); 27 | figure('Name','DAB frame length differences - Histogram'); 28 | hist(x-196608) -------------------------------------------------------------------------------- /matlab/Viterbi/BinToDec.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Binary to decimal 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = BinToDec( ValueIn, BitsPerSign ) 21 | 22 | ValueOut= bin2dec( reshape( char(ValueIn+'0'), BitsPerSign, [])' )'; -------------------------------------------------------------------------------- /matlab/Viterbi/CRC16.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | function [Check] = CRC16(Data) 19 | 20 | CRC = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; % Initialization word 21 | Polynomial = [0 0 0 1 0 0 0 0 0 0 1 0 0 0 0]; % [MSB ... LSB] 22 | 23 | % size(Data) 24 | Data(end-15:end) = xor( Data(end-15:end),CRC ); % complement of 16 last data 25 | 26 | for i = 1:length(Data) % CRC calculation 27 | if( xor(CRC(1),Data(i)) == 1) 28 | CRC = [ xor( Polynomial,CRC(2:end) ) 1]; 29 | else 30 | CRC = [ CRC(2:end) 0 ]; 31 | end 32 | end 33 | 34 | if sum(CRC) == 0 % CRC verification 35 | Check = 1; 36 | else 37 | Check = 0; 38 | end -------------------------------------------------------------------------------- /matlab/Viterbi/DAB_DECODER_OKfast.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/Viterbi/DAB_DECODER_OKfast.m -------------------------------------------------------------------------------- /matlab/Viterbi/DAB_FIC.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/Viterbi/DAB_FIC.m -------------------------------------------------------------------------------- /matlab/Viterbi/DAB_FIC_test.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/Viterbi/DAB_FIC_test.m -------------------------------------------------------------------------------- /matlab/Viterbi/DecToBin.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Decimal to binary 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = DecToBin( ValueIn, NoBits ) 21 | 22 | string = dec2bin( ValueIn, NoBits ); 23 | for k = 1:NoBits 24 | ValueOut(k) = str2num( string(k) ); 25 | end 26 | -------------------------------------------------------------------------------- /matlab/Viterbi/EnergyDispGen.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Energy Dispersal Sequense Generation - ETSI pp. 128-129 19 | % ----------------------------------------------------------------------------------------- 20 | function [PRBS] = EnergyDispGen(size) 21 | Vector = [1 1 1 1 1 1 1 1 1]; % initialization word/register 22 | PRBS= zeros(1,size); 23 | CounterPRBS = 1; 24 | for i = 0 : size-1 25 | NewBit = xor(Vector(5),Vector(9)); % calculate a new bit 26 | Vector = [NewBit Vector(1:end-1)]; % store it in a work register 27 | PRBS(CounterPRBS) = NewBit; % write the bit into output sequense 28 | CounterPRBS = CounterPRBS + 1; % incease the counter 29 | end -------------------------------------------------------------------------------- /matlab/Viterbi/FreqDeinterleaverTabGen.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ---------------------------------------------------------------------------------------------- 18 | % Building frequency de-interleaving table (Standard Pages 157-161) 19 | % Function works for DAB modes I, II, III and IV 20 | % However examplary numbers in comments are given for mode=1 21 | % ---------------------------------------------------------------------------------------------- 22 | 23 | function [ DeinterleaverTab ] = BuildFreqDeInterleaverTab( InterleaverTab, Nfft ) 24 | 25 | % Calculate de-interleaving table from the interleaving one having Nfft rows: take only 2 columns: n and k 26 | DeinterleaverTab = sortrows( InterleaverTab(:, 4:5), 2 ); % sort row 4 (n) and 5 (k) according to column 2 (pi(i)) 27 | DeinterleaverTab = DeinterleaverTab( Nfft/4+1:end,: ); % remove initial 512 nulls/spaces [0,..,511] - not used 28 | 29 | % Calculate k-number of the carrier - append as a new column 3: in order 1,2,3,..., 1536 30 | DeinterleaverTab(:,3) = [ DeinterleaverTab( 1 : Nfft/8*3, 2 )+1 ;... % [ De(1:768,2)+1; 31 | DeinterleaverTab( Nfft/8*3+1 : Nfft/8*6, 2) ] ... % De(769:1536,2) 32 | + Nfft/8*3; % + 768 ] 33 | % Calculate n-number of the QPSK symbol - append as a new column 4: not in order (interleaved) 1,2,3,..., 1536 34 | DeinterleaverTab(:,4) = DeinterleaverTab(:,1)+1; 35 | % DeinterleaverTab(1:5,3:4), DeinterleaverTab(end-4:end,3:4), pause % Test only 36 | -------------------------------------------------------------------------------- /matlab/Viterbi/SuperFrameHandlingX.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/Viterbi/SuperFrameHandlingX.m -------------------------------------------------------------------------------- /matlab/Viterbi/read_complex_binary.m: -------------------------------------------------------------------------------- 1 | % 2 | % Copyright 2001 Free Software Foundation, Inc. 3 | % 4 | % This file is part of GNU Radio 5 | % 6 | % GNU Radio is free software; you can redistribute it and/or modify 7 | % it under the terms of the GNU General Public License as published by 8 | % the Free Software Foundation; either version 2, or (at your option) 9 | % any later version. 10 | % 11 | % GNU Radio is distributed in the hope that it will be useful, 12 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | % GNU General Public License for more details. 15 | % 16 | % You should have received a copy of the GNU General Public License 17 | % along with GNU Radio; see the file COPYING. If not, write to 18 | % the Free Software Foundation, Inc., 51 Franklin Street, 19 | % Boston, MA 02110-1301, USA. 20 | % 21 | 22 | function v = read_complex_binary(filename, count) 23 | 24 | %% usage: read_complex_binary (filename, [count]) 25 | %% 26 | %% open filename and return the contents as a column vector, 27 | %% treating them as 32 bit complex numbers 28 | %% 29 | 30 | m = nargchk (1,2,nargin); 31 | if (m) 32 | usage (m); 33 | end 34 | 35 | if (nargin < 2) 36 | count = Inf; 37 | end 38 | 39 | f = fopen(filename, 'rb'); 40 | if (f < 0) 41 | v = 0; 42 | else 43 | t = fread (f, [2, count], 'float'); 44 | fclose (f); 45 | v = t(1,:) + t(2,:)*i; 46 | [r, c] = size (v); 47 | v = reshape (v, c, r); 48 | end 49 | -------------------------------------------------------------------------------- /matlab/Viterbi/writeComplex.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | function [ ] = writeComplex( data, name, length ) 19 | %UNTITLED2 Summary of this function goes here 20 | % Detailed explanation goes here 21 | 22 | fw = fopen( name, 'w' ); 23 | for x=1:length 24 | fprintf( fw, '%1.18f\n', real(data(x)) ); 25 | fprintf( fw, '%1.18f\n', imag(data(x)) ); 26 | end 27 | fclose( fw ); 28 | -------------------------------------------------------------------------------- /matlab/Viterbi/writeReal.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | function [ ] = writeReal( data, name, length ) 19 | %UNTITLED2 Summary of this function goes here 20 | % Detailed explanation goes here 21 | 22 | fw = fopen( name, 'w' ); 23 | for x=1:length 24 | fprintf( fw, '%1.18f\n', data(x) ); 25 | end 26 | fclose( fw ); 27 | -------------------------------------------------------------------------------- /matlab/ViterbiDecoder_FIC_MSC.m: -------------------------------------------------------------------------------- 1 | %% Start script 2 | cd Viterbi/ 3 | DAB_ALL_RT 4 | cd .. -------------------------------------------------------------------------------- /matlab/all_generate.m: -------------------------------------------------------------------------------- 1 | % Kwant 21.02.2015 2 | % generate all data for unit test 3 | 4 | clear; 5 | close all; 6 | clc; 7 | 8 | datadecoder_generateTimeDeInterleaver 9 | datadecoder_generateCRC 10 | datadecoder_generateDepuncturer 11 | dcremoval_data_generator 12 | remodulate 13 | remodulate_data_generator 14 | resampler_linear 15 | resampler_interleaved 16 | fft_engine_unittest_ifft 17 | fft_engine_unittest_vol1 18 | demodulator_deinterleaver_tab 19 | synchronizer_unitest_all 20 | synchronizer_unitest_phase_ref 21 | demodulator_deqpsk 22 | demodulator_frame_pos_fft 23 | demodulator_process 24 | ReedSolomon_DataGeneration 25 | ViterbiDecoder_FIC_MSC 26 | energy_disp_data_generator 27 | MSCDecoder_unittest 28 | FICDecoder_unittest 29 | SuperFrame_unittest 30 | synchronizer_SNR 31 | datadecoder_generateTimeDeInterleaver 32 | datadecoder_generateCRC 33 | datadecoder_generateDepuncturer 34 | dcremoval_data_generator 35 | remodulate 36 | resampler_linear 37 | resampler_interleaved 38 | fft_engine_unittest_ifft 39 | fft_engine_unittest_vol1 40 | demodulator_deinterleaver_tab 41 | synchronizer_unitest_all 42 | synchronizer_unitest_phase_ref 43 | demodulator_deqpsk 44 | demodulator_frame_pos_fft 45 | demodulator_process 46 | ViterbiDecoder_FIC_MSC 47 | ReedSolomon_DataGeneration 48 | energy_disp_data_generator 49 | MSCDecoder_unittest 50 | FICDecoder_unittest 51 | SuperFrame_unittest 52 | demodulator_snr_calc 53 | clc 54 | disp('Matlab finished successfully'); 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /matlab/datadecoder_generateCRC.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | function datadecoder_generateCRC 19 | clear; 20 | close all; 21 | 22 | crc = [128 12 141 183 119 33 44 89 27 11 0 77 32 2 33 25 85 29 141 148 138 35 32 216 40 34 16 133 14 220 232 203 22 35 25 1 97 221 69 171 186 172 183 140 216 191 111 255 179 194 110 159 215 142 57 175 245 129 101 157 212 29 28 214 9 80 40 191 81 168 20 63 35 106 21 230 58 176 202 203 104 224 216 81 82 103 170 219 80 33 73 0 12 184 25 57 88 240 139 39 228 242 152 119 83 227 239 23 66 203 133 230 50 159 32 137 108 231 76 2 244 29 250 97 248 63 229 56 104 13 45 173 116 115 249 111 124 105 78 42 228 228 136 245 213 50 254 136 246 138 64 57 236 142 42 126 105 70 160 152 109 236 154 217 215 2 93 193 179 171 177 66 130 14 200 22 1 68 96 32 100 48 14 66 134 156 131 175 220 117 249 58 29 107 238 194 153 21 117 143 152 73 169 129 137 62 151 203 34 53 160 128 79 53 58 146 12 9 104 221 142 157 91 233 219 119 255 171 185 34 7 23 98 119 155 215 18 10 250 39 210 183 221 107 238 72 0 176 135 76 34 30 81 100]; 23 | 24 | fp = fopen( '../data/ut/CRC_input.txt', 'w' ); 25 | for l=1:length(crc) 26 | fprintf( fp, '%d\n', crc(l) ); 27 | end 28 | fclose( fp ); 29 | -------------------------------------------------------------------------------- /matlab/dcremoval_data_generator.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | clear; 19 | close all; 20 | 21 | 22 | fs = 100; 23 | fc1 = 20; 24 | fc2 = 0.001; 25 | t = 0:1/fs:(1/fs*16384*35); 26 | x1 = sin(fc1*t); 27 | x2 = sin(fc2*t)+0.15; 28 | signal=x1+x2; 29 | 30 | 31 | fp = fopen('../data/ut/dcremoval_data.txt', 'w'); 32 | for i=1:length(signal) 33 | fprintf(fp, '%1.18f\n', signal(i)); 34 | end 35 | fclose(fp); 36 | 37 | last_dc_iterator = 1; 38 | dc_memory=zeros(1,5); 39 | 40 | for k=0:34 41 | subframe_mean = mean(signal(k*16384+1:2:(k+1)*16384)); 42 | %subframe_mean 43 | dc_memory(last_dc_iterator)=subframe_mean; 44 | if last_dc_iterator<5 45 | last_dc_iterator=last_dc_iterator+1; 46 | else 47 | last_dc_iterator = 1; 48 | end 49 | frame_mean = mean(dc_memory); 50 | %frame_mean 51 | signal(k*16384+1:2:(k+1)*16384) = signal(k*16384+1:2:(k+1)*16384) - frame_mean; 52 | %k 53 | end 54 | 55 | 56 | 57 | fp = fopen('../data/ut/dcremoval_expected_results.txt', 'w'); 58 | for i=1:length(signal) 59 | fprintf(fp, '%1.18f\n', signal(i)); 60 | end 61 | fclose(fp); 62 | -------------------------------------------------------------------------------- /matlab/demodulator_process.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | %% Clear environment 18 | clear all 19 | close all 20 | 21 | fprintf('\n*************** demodulator process generator started ***************\n\n'); 22 | 23 | %% Init parameters 24 | SuffixFileName = '_mode_1'; 25 | input_filename = 'Record3_katowice_iq.raw'; 26 | nr_test_files = 3; 27 | SubChStartAdr = 0; SubChSize = 84; 28 | 29 | %% Start script 30 | cd demodulator_unitest/ 31 | DAB_ALL_RT 32 | cd .. 33 | 34 | 35 | %% Init parameters 36 | clear all 37 | SuffixFileName = '_gain42_long'; 38 | input_filename = 'antena-1_dab_229072kHz_fs2048kHz_gain42_1_long.raw'; 39 | nr_test_files = 3; 40 | SubChStartAdr = 180; SubChSize = 84; 41 | 42 | %% Start script 43 | cd demodulator_unitest/ 44 | DAB_ALL_RT 45 | cd .. 46 | 47 | 48 | %% Init parameters 49 | clear all 50 | SuffixFileName = '_mode_2'; 51 | input_filename = 'Kielce_mode2_iq.raw'; 52 | nr_test_files = 3; 53 | SubChStartAdr = 0; SubChSize = 84; 54 | 55 | %% Start script 56 | cd demodulator_unitest/ 57 | DAB_ALL_RT 58 | cd .. -------------------------------------------------------------------------------- /matlab/demodulator_unitest/ADCFreqCheck.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | % ----------------------------------------------------------------------------------------- 19 | % Distance between consecutive frames in samples 20 | % ----------------------------------------------------------------------------------------- 21 | 22 | function [] = ADCFreqCheck(FrameStartpoints) 23 | 24 | x = FrameStartpoints(2:length(FrameStartpoints))-FrameStartpoints(1:length(FrameStartpoints)-1); 25 | y= find(x>195000); 26 | x = x(min(y):length(x)); 27 | figure('Name','DAB frame length differences - Histogram'); 28 | hist(x-196608) -------------------------------------------------------------------------------- /matlab/demodulator_unitest/BinToDec.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Binary to decimal 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = BinToDec( ValueIn, BitsPerSign ) 21 | 22 | ValueOut= bin2dec( reshape( char(ValueIn+'0'), BitsPerSign, [])' )'; -------------------------------------------------------------------------------- /matlab/demodulator_unitest/CRC16.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | function [Check] = CRC16(Data) 19 | 20 | CRC = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; % Initialization word 21 | Polynomial = [0 0 0 1 0 0 0 0 0 0 1 0 0 0 0]; % [MSB ... LSB] 22 | 23 | % size(Data) 24 | Data(end-15:end) = xor( Data(end-15:end),CRC ); % complement of 16 last data 25 | 26 | for i = 1:length(Data) % CRC calculation 27 | if( xor(CRC(1),Data(i)) == 1) 28 | CRC = [ xor( Polynomial,CRC(2:end) ) 1]; 29 | else 30 | CRC = [ CRC(2:end) 0 ]; 31 | end 32 | end 33 | 34 | if sum(CRC) == 0 % CRC verification 35 | Check = 1; 36 | else 37 | Check = 0; 38 | end -------------------------------------------------------------------------------- /matlab/demodulator_unitest/DAB_DECODER_OKfast.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/demodulator_unitest/DAB_DECODER_OKfast.m -------------------------------------------------------------------------------- /matlab/demodulator_unitest/DAB_FIC.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/demodulator_unitest/DAB_FIC.m -------------------------------------------------------------------------------- /matlab/demodulator_unitest/DAB_FIC_test.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/demodulator_unitest/DAB_FIC_test.m -------------------------------------------------------------------------------- /matlab/demodulator_unitest/DecToBin.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Decimal to binary 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = DecToBin( ValueIn, NoBits ) 21 | 22 | string = dec2bin( ValueIn, NoBits ); 23 | for k = 1:NoBits 24 | ValueOut(k) = str2num( string(k) ); 25 | end 26 | -------------------------------------------------------------------------------- /matlab/demodulator_unitest/EnergyDispGen.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Energy Dispersal Sequense Generation - ETSI pp. 128-129 19 | % ----------------------------------------------------------------------------------------- 20 | function [PRBS] = EnergyDispGen(size) 21 | Vector = [1 1 1 1 1 1 1 1 1]; % initialization word/register 22 | PRBS= zeros(1,size); 23 | CounterPRBS = 1; 24 | for i = 0 : size-1 25 | NewBit = xor(Vector(5),Vector(9)); % calculate a new bit 26 | Vector = [NewBit Vector(1:end-1)]; % store it in a work register 27 | PRBS(CounterPRBS) = NewBit; % write the bit into output sequense 28 | CounterPRBS = CounterPRBS + 1; % incease the counter 29 | end -------------------------------------------------------------------------------- /matlab/demodulator_unitest/SuperFrameHandlingX.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/demodulator_unitest/SuperFrameHandlingX.m -------------------------------------------------------------------------------- /matlab/demodulator_unitest/read_complex_binary.m: -------------------------------------------------------------------------------- 1 | % 2 | % Copyright 2001 Free Software Foundation, Inc. 3 | % 4 | % This file is part of GNU Radio 5 | % 6 | % GNU Radio is free software; you can redistribute it and/or modify 7 | % it under the terms of the GNU General Public License as published by 8 | % the Free Software Foundation; either version 2, or (at your option) 9 | % any later version. 10 | % 11 | % GNU Radio is distributed in the hope that it will be useful, 12 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | % GNU General Public License for more details. 15 | % 16 | % You should have received a copy of the GNU General Public License 17 | % along with GNU Radio; see the file COPYING. If not, write to 18 | % the Free Software Foundation, Inc., 51 Franklin Street, 19 | % Boston, MA 02110-1301, USA. 20 | % 21 | 22 | function v = read_complex_binary(filename, count) 23 | 24 | %% usage: read_complex_binary (filename, [count]) 25 | %% 26 | %% open filename and return the contents as a column vector, 27 | %% treating them as 32 bit complex numbers 28 | %% 29 | 30 | m = nargchk (1,2,nargin); 31 | if (m) 32 | usage (m); 33 | end 34 | 35 | if (nargin < 2) 36 | count = Inf; 37 | end 38 | 39 | f = fopen(filename, 'rb'); 40 | if (f < 0) 41 | v = 0; 42 | else 43 | t = fread (f, [2, count], 'float'); 44 | fclose (f); 45 | v = t(1,:) + t(2,:)*i; 46 | [r, c] = size (v); 47 | v = reshape (v, c, r); 48 | end 49 | -------------------------------------------------------------------------------- /matlab/fft_engine_unittest_ifft.m: -------------------------------------------------------------------------------- 1 | % Kwant 21.02.2015 2 | % gen data for FFT 3 | % data format: interleaved REAL and IMAG component 4 | 5 | clear; 6 | close all; 7 | 8 | fprintf('\n*************** IFFT generator started ***************\n\n'); 9 | 10 | rng( 1 ); % seed 11 | 12 | x = randn(4096, 1)+1i*randn(4096,1); 13 | x = single(x); % single precission 14 | X = ifft(x); 15 | 16 | fp = fopen( '../data/ut/fft_engine_ifft_input.txt', 'w' ); 17 | for l=1:length(x) 18 | fprintf( fp, '%1.18f\n', real(x(l)) ); 19 | fprintf( fp, '%1.18f\n', imag(x(l)) ); 20 | end 21 | fclose( fp ); 22 | 23 | fp = fopen( '../data/ut/fft_engine_ifft_expectedOutput.txt', 'w' ); 24 | for l=1:length(X) 25 | fprintf( fp, '%1.18f\n', real(X(l)) ); 26 | fprintf( fp, '%1.18f\n', imag(X(l)) ); 27 | end 28 | fclose( fp ); 29 | 30 | -------------------------------------------------------------------------------- /matlab/fft_engine_unittest_vol1.m: -------------------------------------------------------------------------------- 1 | % Kwant 21.02.2015 2 | % gen data for FFT 3 | % data format: interleaved REAL and IMAG component 4 | 5 | clear; 6 | close all; 7 | 8 | fprintf('\n*************** FFT generator started ***************\n\n'); 9 | 10 | rng( 1 ); % seed 11 | 12 | x = randn(4096, 1)+1i*randn(4096,1); 13 | x = single(x); % single precission 14 | X = fft(x); 15 | 16 | fp = fopen( '../data/ut/fft_engine_vol1_input.txt', 'w' ); 17 | for l=1:length(x) 18 | fprintf( fp, '%1.18f\n', real(x(l)) ); 19 | fprintf( fp, '%1.18f\n', imag(x(l)) ); 20 | end 21 | fclose( fp ); 22 | 23 | fp = fopen( '../data/ut/fft_engine_vol1_expectedOutput.txt', 'w' ); 24 | for l=1:length(X) 25 | fprintf( fp, '%1.18f\n', real(X(l)) ); 26 | fprintf( fp, '%1.18f\n', imag(X(l)) ); 27 | end 28 | fclose( fp ); 29 | 30 | -------------------------------------------------------------------------------- /matlab/inputdata/README: -------------------------------------------------------------------------------- 1 | input samples for matlab code, various type (clean, noise, etc...) 2 | 3 | describe all files here, entire directory added to .gitignore 4 | 5 | FILES: 6 | download.sh - download samples from http://sdr.kt.agh.edu.pl/... 7 | 8 | Record3_katowice_iq.dat - generated input signal, clean, no noise 9 | antena-1_dab_229072kHz_fs2048kHz_gain42_1.raw - real signal, acquired by rtl-sdr device, Krakow, Lipsk lab, standard antenna, good SNR 10 | 11 | -------------------------------------------------------------------------------- /matlab/inputdata/download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # download input samples from http://sdr.kt.agh.edu.pl/.... 3 | # kwant 2015.03.16 4 | 5 | wget http://sdr:sdr4nOOb@sdr.kt.agh.edu.pl/data/Record3_katowice_iq.dat 6 | wget http://sdr:sdr4nOOb@sdr.kt.agh.edu.pl/data/antena-1_dab_229072kHz_fs2048kHz_gain42_1.raw 7 | 8 | 9 | -------------------------------------------------------------------------------- /matlab/ref/ADCFreqCheck.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | % ----------------------------------------------------------------------------------------- 19 | % Distance between consecutive frames in samples 20 | % ----------------------------------------------------------------------------------------- 21 | 22 | function [] = ADCFreqCheck(FrameStartpoints) 23 | 24 | x = FrameStartpoints(2:length(FrameStartpoints))-FrameStartpoints(1:length(FrameStartpoints)-1); 25 | y= find(x>195000); 26 | x = x(min(y):length(x)); 27 | figure('Name','DAB frame length differences - Histogram'); 28 | hist(x-196608) -------------------------------------------------------------------------------- /matlab/ref/BinToDec.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Binary to decimal 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = BinToDec( ValueIn, BitsPerSign ) 21 | 22 | ValueOut= bin2dec( reshape( char(ValueIn+'0'), BitsPerSign, [])' )'; -------------------------------------------------------------------------------- /matlab/ref/CRC16.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | function [Check] = CRC16(Data) 19 | 20 | CRC = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; % Initialization word 21 | Polynomial = [0 0 0 1 0 0 0 0 0 0 1 0 0 0 0]; % [MSB ... LSB] 22 | 23 | % size(Data) 24 | Data(end-15:end) = xor( Data(end-15:end),CRC ); % complement of 16 last data 25 | 26 | for i = 1:length(Data) % CRC calculation 27 | if( xor(CRC(1),Data(i)) == 1) 28 | CRC = [ xor( Polynomial,CRC(2:end) ) 1]; 29 | else 30 | CRC = [ CRC(2:end) 0 ]; 31 | end 32 | end 33 | 34 | if sum(CRC) == 0 % CRC verification 35 | Check = 1; 36 | else 37 | Check = 0; 38 | end -------------------------------------------------------------------------------- /matlab/ref/DAB_DECODER_OKfast.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/ref/DAB_DECODER_OKfast.m -------------------------------------------------------------------------------- /matlab/ref/DAB_FIC.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/ref/DAB_FIC.m -------------------------------------------------------------------------------- /matlab/ref/DAB_FIC_test.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/ref/DAB_FIC_test.m -------------------------------------------------------------------------------- /matlab/ref/DecToBin.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Decimal to binary 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = DecToBin( ValueIn, NoBits ) 21 | 22 | string = dec2bin( ValueIn, NoBits ); 23 | for k = 1:NoBits 24 | ValueOut(k) = str2num( string(k) ); 25 | end 26 | -------------------------------------------------------------------------------- /matlab/ref/EnergyDispGen.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Energy Dispersal Sequense Generation - ETSI pp. 128-129 19 | % ----------------------------------------------------------------------------------------- 20 | function [PRBS] = EnergyDispGen(size) 21 | Vector = [1 1 1 1 1 1 1 1 1]; % initialization word/register 22 | PRBS= zeros(1,size); 23 | CounterPRBS = 1; 24 | for i = 0 : size-1 25 | NewBit = xor(Vector(5),Vector(9)); % calculate a new bit 26 | Vector = [NewBit Vector(1:end-1)]; % store it in a work register 27 | PRBS(CounterPRBS) = NewBit; % write the bit into output sequense 28 | CounterPRBS = CounterPRBS + 1; % incease the counter 29 | end -------------------------------------------------------------------------------- /matlab/ref/FreqDeinterleaverTabGen.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ---------------------------------------------------------------------------------------------- 18 | % Building frequency de-interleaving table (Standard Pages 157-161) 19 | % Function works for DAB modes I, II, III and IV 20 | % However examplary numbers in comments are given for mode=1 21 | % ---------------------------------------------------------------------------------------------- 22 | 23 | function [ DeinterleaverTab ] = BuildFreqDeInterleaverTab( InterleaverTab, Nfft ) 24 | 25 | % Calculate de-interleaving table from the interleaving one having Nfft rows: take only 2 columns: n and k 26 | DeinterleaverTab = sortrows( InterleaverTab(:, 4:5), 2 ); % sort row 4 (n) and 5 (k) according to column 2 (pi(i)) 27 | DeinterleaverTab = DeinterleaverTab( Nfft/4+1:end,: ); % remove initial 512 nulls/spaces [0,..,511] - not used 28 | 29 | % Calculate k-number of the carrier - append as a new column 3: in order 1,2,3,..., 1536 30 | DeinterleaverTab(:,3) = [ DeinterleaverTab( 1 : Nfft/8*3, 2 )+1 ;... % [ De(1:768,2)+1; 31 | DeinterleaverTab( Nfft/8*3+1 : Nfft/8*6, 2) ] ... % De(769:1536,2) 32 | + Nfft/8*3; % + 768 ] 33 | % Calculate n-number of the QPSK symbol - append as a new column 4: not in order (interleaved) 1,2,3,..., 1536 34 | DeinterleaverTab(:,4) = DeinterleaverTab(:,1)+1; 35 | % DeinterleaverTab(1:5,3:4), DeinterleaverTab(end-4:end,3:4), pause % Test only 36 | -------------------------------------------------------------------------------- /matlab/ref/SuperFrameHandlingX.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/ref/SuperFrameHandlingX.m -------------------------------------------------------------------------------- /matlab/ref/read_complex_binary.m: -------------------------------------------------------------------------------- 1 | % 2 | % Copyright 2001 Free Software Foundation, Inc. 3 | % 4 | % This file is part of GNU Radio 5 | % 6 | % GNU Radio is free software; you can redistribute it and/or modify 7 | % it under the terms of the GNU General Public License as published by 8 | % the Free Software Foundation; either version 2, or (at your option) 9 | % any later version. 10 | % 11 | % GNU Radio is distributed in the hope that it will be useful, 12 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | % GNU General Public License for more details. 15 | % 16 | % You should have received a copy of the GNU General Public License 17 | % along with GNU Radio; see the file COPYING. If not, write to 18 | % the Free Software Foundation, Inc., 51 Franklin Street, 19 | % Boston, MA 02110-1301, USA. 20 | % 21 | 22 | function v = read_complex_binary(filename, count) 23 | 24 | %% usage: read_complex_binary (filename, [count]) 25 | %% 26 | %% open filename and return the contents as a column vector, 27 | %% treating them as 32 bit complex numbers 28 | %% 29 | 30 | m = nargchk (1,2,nargin); 31 | if (m) 32 | usage (m); 33 | end 34 | 35 | if (nargin < 2) 36 | count = Inf; 37 | end 38 | 39 | f = fopen(filename, 'rb'); 40 | if (f < 0) 41 | v = 0; 42 | else 43 | t = fread (f, [2, count], 'float'); 44 | fclose (f); 45 | v = t(1,:) + t(2,:)*i; 46 | [r, c] = size (v); 47 | v = reshape (v, c, r); 48 | end 49 | -------------------------------------------------------------------------------- /matlab/remodulate.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | clear; 19 | close all 20 | 21 | 22 | x=randn(1,1024)+j*randn(1,1024); 23 | 24 | fp = fopen('../data/ut/remodulator_input.txt', 'w'); 25 | for i=1:length(x) 26 | fprintf(fp, '%1.18f\n', real(x(i))); 27 | fprintf(fp, '%1.18f\n', imag(x(i))); 28 | end 29 | fclose(fp); 30 | 31 | fs = 2.048e6; 32 | fc_offset=30e3; 33 | 34 | for i=1:length(x) 35 | z2(i) = x(i)* exp( j*2*pi*fc_offset/fs*(i-1) ); 36 | end 37 | 38 | fp = fopen('../data/ut/remodulator_expected_results.txt', 'w'); 39 | for i=1:length(z2) 40 | fprintf(fp, '%1.18f\n', real(z2(i))); 41 | fprintf(fp, '%1.18f\n', imag(z2(i))); 42 | end 43 | fclose(fp); 44 | -------------------------------------------------------------------------------- /matlab/resampler_interleaved.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | clear; 19 | close all; 20 | 21 | size = 4096; 22 | 23 | fs1 = 100; 24 | fc1 = 20; 25 | fs2 = 300; 26 | fc2 = 5; 27 | 28 | t1 = linspace(0, size/fs1-1/fs1, size); 29 | x1 = sin(fc1*t1); 30 | t2 = linspace(0, size/fs2-1/fs2, size); 31 | x2 = sin(fc2*t2); 32 | 33 | y1 = resample(x1, 3, 2); 34 | y2 = resample(x2, 3, 2); 35 | 36 | fp = fopen('../data/ut/resampler_interleaved_data.txt', 'w'); 37 | for i=1:length(x1) 38 | fprintf(fp, '%1.18f\n', x1(i)); 39 | fprintf(fp, '%1.18f\n', x2(i)); 40 | end 41 | fclose(fp); 42 | 43 | fp = fopen('../data/ut/resampler_interleaved_expected_results.txt', 'w'); 44 | for i=1:length(y1) 45 | fprintf(fp, '%1.18f\n', y1(i)); 46 | fprintf(fp, '%1.18f\n', y2(i)); 47 | end 48 | fclose(fp); 49 | -------------------------------------------------------------------------------- /matlab/resampler_linear.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | clear; 19 | close all; 20 | 21 | size = 4096; 22 | fs = 100; 23 | fc = 20; 24 | 25 | t = linspace(0, size/fs-1/fs, size); 26 | x = sin(fc*t); 27 | 28 | y = resample(x, 3, 2); 29 | 30 | fp = fopen('../data/ut/resampler_linear_data.txt', 'w'); 31 | for i=1:length(x) 32 | fprintf(fp, '%1.18f\n', x(i)); 33 | end 34 | fclose(fp); 35 | 36 | fp = fopen('../data/ut/resampler_linear_expected_results.txt', 'w'); 37 | for i=1:length(y) 38 | fprintf(fp, '%1.18f\n', y(i)); 39 | end 40 | fclose(fp); 41 | -------------------------------------------------------------------------------- /matlab/synchronizer_unitest_all.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | %% Clear environment 19 | clear all 20 | close all 21 | 22 | fprintf('\n*************** synchronizer_all generator started ***************\n'); 23 | 24 | %% Init parameters 25 | SuffixFileName = ''; 26 | input_filename = 'Record3_katowice_iq.raw'; 27 | nr_test_files = 3; 28 | 29 | %% Start script 30 | cd synchronizer_unitest_all/ 31 | DAB_ALL_RT 32 | cd .. 33 | 34 | %% Init parameters 35 | clear all 36 | SuffixFileName = '_gain42'; 37 | input_filename = 'antena-1_dab_229072kHz_fs2048kHz_gain42_1.raw'; 38 | nr_test_files = 3; 39 | 40 | %% Start script 41 | cd synchronizer_unitest_all/ 42 | DAB_ALL_RT 43 | cd .. -------------------------------------------------------------------------------- /matlab/synchronizer_unitest_all/ADCFreqCheck.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | % ----------------------------------------------------------------------------------------- 19 | % Distance between consecutive frames in samples 20 | % ----------------------------------------------------------------------------------------- 21 | 22 | function [] = ADCFreqCheck(FrameStartpoints) 23 | 24 | x = FrameStartpoints(2:length(FrameStartpoints))-FrameStartpoints(1:length(FrameStartpoints)-1); 25 | y= find(x>195000); 26 | x = x(min(y):length(x)); 27 | figure('Name','DAB frame length differences - Histogram'); 28 | hist(x-196608) -------------------------------------------------------------------------------- /matlab/synchronizer_unitest_all/BinToDec.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Binary to decimal 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = BinToDec( ValueIn, BitsPerSign ) 21 | 22 | ValueOut= bin2dec( reshape( char(ValueIn+'0'), BitsPerSign, [])' )'; -------------------------------------------------------------------------------- /matlab/synchronizer_unitest_all/CRC16.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | function [Check] = CRC16(Data) 19 | 20 | CRC = [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]; % Initialization word 21 | Polynomial = [0 0 0 1 0 0 0 0 0 0 1 0 0 0 0]; % [MSB ... LSB] 22 | 23 | % size(Data) 24 | Data(end-15:end) = xor( Data(end-15:end),CRC ); % complement of 16 last data 25 | 26 | for i = 1:length(Data) % CRC calculation 27 | if( xor(CRC(1),Data(i)) == 1) 28 | CRC = [ xor( Polynomial,CRC(2:end) ) 1]; 29 | else 30 | CRC = [ CRC(2:end) 0 ]; 31 | end 32 | end 33 | 34 | if sum(CRC) == 0 % CRC verification 35 | Check = 1; 36 | else 37 | Check = 0; 38 | end -------------------------------------------------------------------------------- /matlab/synchronizer_unitest_all/DAB_DECODER_OKfast.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/synchronizer_unitest_all/DAB_DECODER_OKfast.m -------------------------------------------------------------------------------- /matlab/synchronizer_unitest_all/DAB_FIC.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/synchronizer_unitest_all/DAB_FIC.m -------------------------------------------------------------------------------- /matlab/synchronizer_unitest_all/DAB_FIC_test.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/synchronizer_unitest_all/DAB_FIC_test.m -------------------------------------------------------------------------------- /matlab/synchronizer_unitest_all/DecToBin.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | % ----------------------------------------------------------------------------------------- 18 | % Decimal to binary 19 | % ----------------------------------------------------------------------------------------- 20 | function [ValueOut] = DecToBin( ValueIn, NoBits ) 21 | 22 | string = dec2bin( ValueIn, NoBits ); 23 | for k = 1:NoBits 24 | ValueOut(k) = str2num( string(k) ); 25 | end 26 | -------------------------------------------------------------------------------- /matlab/synchronizer_unitest_all/EnergyDispGen.m: -------------------------------------------------------------------------------- 1 | 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3 | % Masterthesis 4 | % Zurcher Hochschule fur Angewandte Wissenschaften 5 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 6 | % (c) Michael Hoin 7 | % 12.4.2011 ZSN 8 | % info.zsn@zhaw.ch 9 | % 10 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 11 | % (c) Tomasz Zielinski 12 | % AGH University of Science and Technology 13 | % Telecommunications Department 14 | % Krakow, Poland 15 | % 15.03.2015 16 | % tzielin@agh.edu.pl 17 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 18 | % ----------------------------------------------------------------------------------------- 19 | % Energy Dispersal Sequense Generation - ETSI pp. 128-129 20 | % ----------------------------------------------------------------------------------------- 21 | function [PRBS] = EnergyDispGen(size) 22 | Vector = [1 1 1 1 1 1 1 1 1]; % initialization word/register 23 | PRBS= zeros(1,size); 24 | CounterPRBS = 1; 25 | for i = 0 : size-1 26 | NewBit = xor(Vector(5),Vector(9)); % calculate a new bit 27 | Vector = [NewBit Vector(1:end-1)]; % store it in a work register 28 | PRBS(CounterPRBS) = NewBit; % write the bit into output sequense 29 | CounterPRBS = CounterPRBS + 1; % incease the counter 30 | end -------------------------------------------------------------------------------- /matlab/synchronizer_unitest_all/SuperFrameHandlingX.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kwanty/sdrdab/31e84e40a9872f3a608d787887bbb39795e65463/matlab/synchronizer_unitest_all/SuperFrameHandlingX.m -------------------------------------------------------------------------------- /matlab/synchronizer_unitest_all/read_complex_binary.m: -------------------------------------------------------------------------------- 1 | % 2 | % Copyright 2001 Free Software Foundation, Inc. 3 | % 4 | % This file is part of GNU Radio 5 | % 6 | % GNU Radio is free software; you can redistribute it and/or modify 7 | % it under the terms of the GNU General Public License as published by 8 | % the Free Software Foundation; either version 2, or (at your option) 9 | % any later version. 10 | % 11 | % GNU Radio is distributed in the hope that it will be useful, 12 | % but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | % GNU General Public License for more details. 15 | % 16 | % You should have received a copy of the GNU General Public License 17 | % along with GNU Radio; see the file COPYING. If not, write to 18 | % the Free Software Foundation, Inc., 51 Franklin Street, 19 | % Boston, MA 02110-1301, USA. 20 | % 21 | 22 | function v = read_complex_binary(filename, count) 23 | 24 | %% usage: read_complex_binary (filename, [count]) 25 | %% 26 | %% open filename and return the contents as a column vector, 27 | %% treating them as 32 bit complex numbers 28 | %% 29 | 30 | m = nargchk (1,2,nargin); 31 | if (m) 32 | usage (m); 33 | end 34 | 35 | if (nargin < 2) 36 | count = Inf; 37 | end 38 | 39 | f = fopen(filename, 'rb'); 40 | if (f < 0) 41 | v = 0; 42 | else 43 | t = fread (f, [2, count], 'float'); 44 | fclose (f); 45 | v = t(1,:) + t(2,:)*i; 46 | [r, c] = size (v); 47 | v = reshape (v, c, r); 48 | end 49 | -------------------------------------------------------------------------------- /matlab/synchronizer_unitest_phase_ref.m: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Masterthesis 3 | % Zurcher Hochschule fur Angewandte Wissenschaften 4 | % Zentrum fur Signalverarbeitung und Nachrichtentechnik 5 | % (c) Michael Hoin 6 | % 12.4.2011 ZSN 7 | % info.zsn@zhaw.ch 8 | % 9 | % Code modified/extended (to DAB+ and Modes 2,3,4) by: 10 | % (c) Tomasz Zielinski 11 | % AGH University of Science and Technology 12 | % Telecommunications Department 13 | % Krakow, Poland 14 | % 15.03.2015 15 | % tzielin@agh.edu.pl 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | 18 | %% Clear environment 19 | clear all 20 | close all 21 | 22 | fprintf('\n\n*************** PhaseReference generator started ***************\n\n'); 23 | 24 | %% Start script 25 | cd synchronizer_unitest_all/ 26 | global NSampPerGuard; 27 | for mode = 1:4 28 | switch mode 29 | case 1 30 | NSampPerGuard = 504; 31 | case 2 32 | NSampPerGuard = 126; 33 | case 3 34 | NSampPerGuard = 63; 35 | case 4 36 | NSampPerGuard = 252; 37 | end 38 | [PhaseRefSymb, sigPhaseRefSymb] = PhaseRefSymbGen( mode, 0 ); 39 | 40 | fp = fopen( sprintf('../../data/ut/synchronizer_phase_ref_symb_output%d.txt', mode), 'w' ); 41 | for l=1:length(sigPhaseRefSymb) 42 | fprintf( fp, '%1.18f\n%1.18f\n', real(sigPhaseRefSymb(l)), imag(sigPhaseRefSymb(l)) ); 43 | end 44 | fclose( fp ); 45 | 46 | end 47 | cd .. 48 | -------------------------------------------------------------------------------- /scripts/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BUILD_DIR_REL="./build" 3 | TESTDATA_DIR_REL="./data" 4 | SCRIPTS_DIR_REL="./scripts" 5 | -------------------------------------------------------------------------------- /scripts/installDependencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | 5 | sudo sh -c "apt-get update; apt-get install -y \ 6 | cmake \ 7 | doxygen \ 8 | rtl-sdr gqrx-sdr libgtest-dev libfftw3-dev libfftw3-bin libsndfile1 libsndfile1-dev libsamplerate0-dev libusb-1.0-0-dev \ 9 | libgstreamer1.0-0 libgstreamer1.0-dev libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-base1.0-0 libgstreamer-plugins-base1.0-dev gstreamer1.0-alsa gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-pulseaudio gstreamer1.0-tools \ 10 | graphviz libreadline6 libreadline6-dev \ 11 | qtbase5-dev \ 12 | " 13 | -------------------------------------------------------------------------------- /scripts/runDoxygen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source "scripts/common.sh" 4 | doxygen ${SCRIPTS_DIR_REL}/_doxygen/sdrdab.doxy 5 | doxygen ${SCRIPTS_DIR_REL}/_doxygen/sdrdab-cli.doxy 6 | doxygen ${SCRIPTS_DIR_REL}/_doxygen/sdrdab-gui.doxy 7 | -------------------------------------------------------------------------------- /scripts/runMatlab.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source "scripts/common.sh" 4 | 5 | # generate unittest I/O data 6 | cd matlab/ 7 | matlab -nodesktop -r "all_generate; exit" 8 | -------------------------------------------------------------------------------- /scripts/runSimpleDebug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # kwant 3 | # changelog 7.06.2015: 4 | # changelog 29.02.2016: 5 | # * changed the binary path, according to the new buildsystem 6 | 7 | source "scripts/common.sh" 8 | 9 | TESTFILE="antena-1_dab_229072kHz_fs2048kHz_gain42_1_long.raw" 10 | 11 | if [ $# -gt 0 ];then 12 | if [ "$1" == "antena" ];then 13 | TESTFILE="antena-1_dab_229072kHz_fs2048kHz_gain42_1_long.raw" 14 | fi 15 | if [ "$1" == "katowice" ];then 16 | TESTFILE="Record3_katowice_iq.raw" 17 | fi 18 | fi 19 | 20 | if [ "$2" = "-v" ];then 21 | vOpt="-v" 22 | else 23 | vOpt="" 24 | fi 25 | 26 | if [ ! -f "${BUILD_DIR_REL}/bin/sdrdab-cli" ];then 27 | echo -e "executable \033[31m.${BUILD_DIR_REL}/bin/sdrdab-cli\e[0m not found" 28 | echo "please build it: ./sdrtool build Debug" 29 | exit 1 30 | fi 31 | 32 | ${BUILD_DIR_REL}/bin/sdrdab-cli --open-file=${TESTDATA_DIR_REL}/${TESTFILE} $vOpt 33 | -------------------------------------------------------------------------------- /scripts/runTests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # ./test/*.cc refactored with: 4 | # sed -i 's/.\/test\/testdata\//.\/data\/ut\//g' *.cc 5 | 6 | 7 | 8 | set -e 9 | source "scripts/common.sh" 10 | 11 | if [ -f "${BUILD_DIR_REL}/bin/sdrdab-ut" ]; then 12 | ${BUILD_DIR_REL}/bin/sdrdab-ut "$@" 13 | else 14 | echo "Perhaps you should build UT first, shouldn't ya?" 15 | echo "" 16 | echo "type: ./sdrtool build Unittest" 17 | fi -------------------------------------------------------------------------------- /scripts/runValgrindAntena.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source "scripts/common.sh" 4 | 5 | iqFile="antena-1_dab_229072kHz_fs2048kHz_gain42_1_long.raw" 6 | 7 | valgrind --leak-check=yes --suppressions=./scripts/valgrind_supps/gst.supp --suppressions=./scripts/valgrind_supps/nm.supp ${BUILD_DIR_REL}/bin/sdrdab-cli --open-file=${TESTDATA_DIR_REL}/${iqFile} -------------------------------------------------------------------------------- /scripts/runValgrindKatowice.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source "scripts/common.sh" 4 | 5 | iqFile="Record3_katowice_iq.raw" 6 | 7 | valgrind --leak-check=yes --suppressions=./scripts/valgrind_supps/gst.supp --suppressions=./scripts/valgrind_supps/nm.supp ${BUILD_DIR_REL}/bin/sdrdab-cli --open-file=${TESTDATA_DIR_REL}/${iqFile} 8 | -------------------------------------------------------------------------------- /scripts/runValgrindUnittests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source "scripts/common.sh" 4 | 5 | valgrind --leak-check=yes --suppressions=./scripts/valgrind_supps/gst.supp --suppressions=./scripts/valgrind_supps/nm.supp ${BUILD_DIR_REL}/bin/sdrdab-ut -------------------------------------------------------------------------------- /src/rscode/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | -------------------------------------------------------------------------------- /src/rscode/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12.2) 2 | add_library("ecc" "rs.c" "galois.c" "berlekamp.c" "crcgen.c") 3 | -------------------------------------------------------------------------------- /src/rscode/LICENSE: -------------------------------------------------------------------------------- 1 | * (C) Henry Minsky (hqm@alum.mit.edu) 1991-2009 2 | * 3 | * This software library is licensed under terms of the GNU GENERAL 4 | * PUBLIC LICENSE. [See file gpl.txt] 5 | * 6 | * Commercial licensing is available under a separate license, please 7 | * contact author for details. 8 | * 9 | * Latest source code and other info at http://rscode.sourceforge.net 10 | 11 | -------------------------------------------------------------------------------- /src/rscode/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Cross Interleaved Reed Solomon encoder/decoder 2 | # 3 | # (c) Henry Minsky, Universal Access 1991-1996 4 | # 5 | 6 | RANLIB = ranlib 7 | AR = ar 8 | 9 | 10 | VERSION = 1.0 11 | DIRNAME= rscode-$(VERSION) 12 | 13 | 14 | CC = gcc 15 | # OPTIMIZE_FLAGS = -O69 16 | DEBUG_FLAGS = -O3 17 | CFLAGS = -fpic -Wall -Wstrict-prototypes $(OPTIMIZE_FLAGS) $(DEBUG_FLAGS) -I.. 18 | LDFLAGS = $(OPTIMIZE_FLAGS) $(DEBUG_FLAGS) 19 | 20 | LIB_CSRC = rs.c galois.c berlekamp.c crcgen.c 21 | LIB_HSRC = ecc.h 22 | LIB_OBJS = rs.o galois.o berlekamp.o crcgen.o 23 | 24 | TARGET_LIB = libecc.a 25 | TEST_PROGS = example 26 | 27 | TARGETS = $(TARGET_LIB) $(TEST_PROGS) 28 | 29 | all: $(TARGETS) 30 | 31 | $(TARGET_LIB): $(LIB_OBJS) 32 | $(RM) $@ 33 | $(AR) cq $@ $(LIB_OBJS) 34 | if [ "$(RANLIB)" ]; then $(RANLIB) $@; fi 35 | 36 | example: example.o galois.o berlekamp.o crcgen.o rs.o 37 | gcc -o example example.o -L. -lecc 38 | 39 | clean: 40 | rm -f *.o 41 | rm -f *~ 42 | 43 | static_lib: libecc.a 44 | 45 | dist: 46 | (cd ..; tar -cvf rscode-$(VERSION).tar $(DIRNAME)) 47 | 48 | depend: 49 | makedepend $(SRCS) 50 | 51 | # DO NOT DELETE THIS LINE -- make depend depends on it. 52 | 53 | -------------------------------------------------------------------------------- /src/rscode/README: -------------------------------------------------------------------------------- 1 | RSCODE version 1.3 2 | 3 | See the files 4 | 5 | config.doc documentation of some compile time parameters 6 | rs.doc overview of the Reed-Solomon coding program 7 | rs.man a man page, slightly outdated at this point 8 | example.c a simple example of encoding,decoding, and error correction 9 | 10 | Makefile should work on a Sun system, may require GNU make. 11 | 12 | 13 | Henry Minsky 14 | hqm@alum.mit.edu 15 | 16 | 17 | * (c) Henry Minsky (hqm@alum.mit.edu) 1991-2009 18 | * 19 | * This software library is licensed under terms of the GNU GENERAL 20 | * PUBLIC LICENSE. (See gpl.txt) 21 | * 22 | * Commercial licensing is available under a separate license, please 23 | * contact author for details. 24 | * 25 | * Source code is available at http://rscode.sourceforge.net 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/rscode/config.doc: -------------------------------------------------------------------------------- 1 | The basic coding parameters are defined using 2 | macros, and an executable can be made by compiling using macro 3 | definitions defining the values of the following names in the file 4 | "ecc.h": 5 | 6 | The important compile time parameter is the number of parity bytes, 7 | specified by the #define NPAR. 8 | 9 | The library is shipped with 10 | 11 | #define NPAR 4 12 | 13 | The error-correction routines are polynomial in the number of 14 | parity bytes, so try to keep NPAR small for high performance. 15 | 16 | Remember, the sum of the message length (in bytes) plus parity bytes 17 | must be less than or equal to 255. 18 | 19 | -------------------------------------------------------------------------------- /src/rscode/crcgen.c: -------------------------------------------------------------------------------- 1 | /***************************** 2 | * Copyright Henry Minsky (hqm@alum.mit.edu) 1991-2009 3 | * 4 | * This software library is licensed under terms of the GNU GENERAL 5 | * PUBLIC LICENSE 6 | * 7 | * RSCODE is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * RSCODE is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with Rscode. If not, see . 19 | 20 | * Commercial licensing is available under a separate license, please 21 | * contact author for details. 22 | * 23 | * Source code is available at http://rscode.sourceforge.net 24 | * 25 | * CRC-CCITT generator simulator for byte wide data. 26 | * 27 | * 28 | * CRC-CCITT = x^16 + x^12 + x^5 + 1 29 | * 30 | * 31 | ******************************/ 32 | 33 | 34 | #include "ecc.h" 35 | 36 | BIT16 crchware(BIT16 data, BIT16 genpoly, BIT16 accum); 37 | 38 | /* Computes the CRC-CCITT checksum on array of byte data, length len 39 | */ 40 | BIT16 crc_ccitt(unsigned char *msg, int len) 41 | { 42 | int i; 43 | BIT16 acc = 0; 44 | 45 | for (i = 0; i < len; i++) { 46 | acc = crchware((BIT16) msg[i], (BIT16) 0x1021, acc); 47 | } 48 | 49 | return(acc); 50 | } 51 | 52 | /* models crc hardware (minor variation on polynomial division algorithm) */ 53 | BIT16 crchware(BIT16 data, BIT16 genpoly, BIT16 accum) 54 | { 55 | static BIT16 i; 56 | data <<= 8; 57 | for (i = 8; i > 0; i--) { 58 | if ((data ^ accum) & 0x8000) 59 | accum = ((accum << 1) ^ genpoly) & 0xFFFF; 60 | else 61 | accum = (accum<<1) & 0xFFFF; 62 | data = (data<<1) & 0xFFFF; 63 | } 64 | return (accum); 65 | } 66 | 67 | -------------------------------------------------------------------------------- /src/rtlsdr/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | .deps 4 | .libs 5 | *.o 6 | *.lo 7 | *.la 8 | *.pc 9 | aclocal.m4 10 | acinclude.m4 11 | aminclude.am 12 | m4/*.m4 13 | autom4te.cache 14 | config.h* 15 | config.sub 16 | config.log 17 | config.status 18 | config.guess 19 | configure 20 | depcomp 21 | missing 22 | ltmain.sh 23 | install-sh 24 | stamp-h1 25 | libtool 26 | Doxyfile 27 | 28 | .tarball-version 29 | .version 30 | 31 | .*.swp 32 | 33 | doc/ 34 | 35 | src/rtl_sdr 36 | src/rtl_tcp 37 | 38 | -------------------------------------------------------------------------------- /src/rtlsdr/.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | compiler: 3 | - gcc 4 | - clang 5 | 6 | before_install: 7 | - sudo apt-get update -qq 8 | - sudo apt-get install -qq libusb-1.0-0-dev 9 | 10 | script: cmake . && make && sudo make install 11 | -------------------------------------------------------------------------------- /src/rtlsdr/AUTHORS: -------------------------------------------------------------------------------- 1 | Steve Markgraf 2 | Dimitri Stolnikov 3 | Hoernchen 4 | Kyle Keen 5 | -------------------------------------------------------------------------------- /src/rtlsdr/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 2 | ACLOCAL_AMFLAGS = -I m4 3 | 4 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 5 | SUBDIRS = include src 6 | 7 | pkgconfigdir = $(libdir)/pkgconfig 8 | pkgconfig_DATA = librtlsdr.pc 9 | 10 | BUILT_SOURCES = $(top_srcdir)/.version 11 | $(top_srcdir)/.version: 12 | echo $(VERSION) > $@-t && mv $@-t $@ 13 | dist-hook: 14 | echo $(VERSION) > $(distdir)/.tarball-version 15 | 16 | install-udev-rules: 17 | $(INSTALL_DATA) rtl-sdr.rules /etc/udev/rules.d 18 | 19 | uninstall-udev-rules: 20 | rm -rf /etc/udev/rules.d/rtl-sdr.rules 21 | 22 | EXTRA_DIST = git-version-gen 23 | 24 | if HAVE_DOXYGEN 25 | 26 | pkgdocdir=$(docdir)/$(PACKAGE)-$(VERSION) 27 | doc_htmldir=$(pkgdocdir)/html 28 | 29 | doc_html_DATA = $(top_builddir)/doc/html.tar 30 | 31 | $(doc_html_DATA): $(top_builddir)/doc/html/index.html 32 | cd $(top_builddir)/doc && tar cf html.tar html 33 | 34 | $(top_builddir)/doc/html/index.html: $(SOURCES) Doxyfile 35 | @rm -rf doc 36 | mkdir -p doc 37 | $(DOXYGEN) Doxyfile 38 | 39 | install-data-hook: 40 | cd $(DESTDIR)$(doc_htmldir) && tar xf html.tar --strip-components 1 && rm -f html.tar 41 | 42 | uninstall-hook: 43 | cd $(DESTDIR) && rm -rf $(doc_htmldir) 44 | 45 | DX_CLEAN = doc/{html,latex}/* doc/html.tar 46 | 47 | endif 48 | 49 | MOSTLYCLEANFILES = $(DX_CLEAN) 50 | -------------------------------------------------------------------------------- /src/rtlsdr/README: -------------------------------------------------------------------------------- 1 | rtl-sdr 2 | turns your Realtek RTL2832 based DVB dongle into a SDR receiver 3 | ====================================================================== 4 | 5 | For more information see: 6 | http://sdr.osmocom.org/trac/wiki/rtl-sdr 7 | -------------------------------------------------------------------------------- /src/rtlsdr/cmake/Modules/FindLibUSB.cmake: -------------------------------------------------------------------------------- 1 | if(NOT LIBUSB_FOUND) 2 | pkg_check_modules (LIBUSB_PKG libusb-1.0) 3 | find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h 4 | PATHS 5 | ${LIBUSB_PKG_INCLUDE_DIRS} 6 | /usr/include/libusb-1.0 7 | /usr/include 8 | /usr/local/include 9 | ) 10 | 11 | #standard library name for libusb-1.0 12 | set(libusb1_library_names usb-1.0) 13 | 14 | #libusb-1.0 compatible library on freebsd 15 | if((CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") OR (CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD")) 16 | list(APPEND libusb1_library_names usb) 17 | endif() 18 | 19 | find_library(LIBUSB_LIBRARIES 20 | NAMES ${libusb1_library_names} 21 | PATHS 22 | ${LIBUSB_PKG_LIBRARY_DIRS} 23 | /usr/lib 24 | /usr/local/lib 25 | ) 26 | 27 | include(CheckFunctionExists) 28 | if(LIBUSB_INCLUDE_DIRS) 29 | set(CMAKE_REQUIRED_INCLUDES ${LIBUSB_INCLUDE_DIRS}) 30 | endif() 31 | if(LIBUSB_LIBRARIES) 32 | set(CMAKE_REQUIRED_LIBRARIES ${LIBUSB_LIBRARIES}) 33 | endif() 34 | 35 | CHECK_FUNCTION_EXISTS("libusb_handle_events_timeout_completed" HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED) 36 | if(HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED) 37 | add_definitions(-DHAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED=1) 38 | endif(HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED) 39 | 40 | CHECK_FUNCTION_EXISTS("libusb_error_name" HAVE_LIBUSB_ERROR_NAME) 41 | if(HAVE_LIBUSB_ERROR_NAME) 42 | add_definitions(-DHAVE_LIBUSB_ERROR_NAME=1) 43 | endif(HAVE_LIBUSB_ERROR_NAME) 44 | 45 | if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) 46 | set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found") 47 | message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}") 48 | else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) 49 | set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found") 50 | message(STATUS "libusb-1.0 not found.") 51 | endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) 52 | 53 | mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES) 54 | 55 | endif(NOT LIBUSB_FOUND) 56 | -------------------------------------------------------------------------------- /src/rtlsdr/cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F 2 | 3 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 5 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 | 7 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 8 | STRING(REGEX REPLACE "\n" ";" files "${files}") 9 | FOREACH(file ${files}) 10 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | IF(EXISTS "$ENV{DESTDIR}${file}") 12 | EXEC_PROGRAM( 13 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 14 | OUTPUT_VARIABLE rm_out 15 | RETURN_VALUE rm_retval 16 | ) 17 | IF(NOT "${rm_retval}" STREQUAL 0) 18 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 19 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 20 | ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") 21 | EXEC_PROGRAM( 22 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 23 | OUTPUT_VARIABLE rm_out 24 | RETURN_VALUE rm_retval 25 | ) 26 | IF(NOT "${rm_retval}" STREQUAL 0) 27 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 28 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 29 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 30 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 31 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 32 | ENDFOREACH(file) 33 | -------------------------------------------------------------------------------- /src/rtlsdr/include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2012 OSMOCOM Project 2 | # 3 | # This file is part of rtl-sdr 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | ######################################################################## 21 | # Install public header files 22 | ######################################################################## 23 | install(FILES 24 | rtl-sdr.h 25 | rtl-sdr_export.h 26 | DESTINATION include 27 | ) 28 | -------------------------------------------------------------------------------- /src/rtlsdr/include/Makefile.am: -------------------------------------------------------------------------------- 1 | rtlsdr_HEADERS = rtl-sdr.h rtl-sdr_export.h 2 | 3 | noinst_HEADERS = reg_field.h rtlsdr_i2c.h tuner_e4k.h tuner_fc0012.h tuner_fc0013.h tuner_fc2580.h tuner_r82xx.h 4 | 5 | rtlsdrdir = $(includedir) 6 | -------------------------------------------------------------------------------- /src/rtlsdr/include/reg_field.h: -------------------------------------------------------------------------------- 1 | #ifndef _REG_FIELD_H 2 | #define _REG_FIELD_H 3 | 4 | #include 5 | #include 6 | 7 | enum cmd_op { 8 | CMD_OP_GET = (1 << 0), 9 | CMD_OP_SET = (1 << 1), 10 | CMD_OP_EXEC = (1 << 2), 11 | }; 12 | 13 | enum pstate { 14 | ST_IN_CMD, 15 | ST_IN_ARG, 16 | }; 17 | 18 | struct strbuf { 19 | uint8_t idx; 20 | char buf[32]; 21 | }; 22 | 23 | struct cmd_state { 24 | struct strbuf cmd; 25 | struct strbuf arg; 26 | enum pstate state; 27 | void (*out)(const char *format, va_list ap); 28 | }; 29 | 30 | struct cmd { 31 | const char *cmd; 32 | uint32_t ops; 33 | int (*cb)(struct cmd_state *cs, enum cmd_op op, const char *cmd, 34 | int argc, char **argv); 35 | const char *help; 36 | }; 37 | 38 | /* structure describing a field in a register */ 39 | struct reg_field { 40 | uint8_t reg; 41 | uint8_t shift; 42 | uint8_t width; 43 | }; 44 | 45 | struct reg_field_ops { 46 | const struct reg_field *fields; 47 | const char **field_names; 48 | uint32_t num_fields; 49 | void *data; 50 | int (*write_cb)(void *data, uint32_t reg, uint32_t val); 51 | uint32_t (*read_cb)(void *data, uint32_t reg); 52 | }; 53 | 54 | uint32_t reg_field_read(struct reg_field_ops *ops, struct reg_field *field); 55 | int reg_field_write(struct reg_field_ops *ops, struct reg_field *field, uint32_t val); 56 | int reg_field_cmd(struct cmd_state *cs, enum cmd_op op, 57 | const char *cmd, int argc, char **argv, 58 | struct reg_field_ops *ops); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/rtlsdr/include/rtl-sdr_export.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver 3 | * Copyright (C) 2012 by Hoernchen 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | #ifndef RTLSDR_EXPORT_H 20 | #define RTLSDR_EXPORT_H 21 | 22 | #if defined __GNUC__ 23 | # if __GNUC__ >= 4 24 | # define __SDR_EXPORT __attribute__((visibility("default"))) 25 | # define __SDR_IMPORT __attribute__((visibility("default"))) 26 | # else 27 | # define __SDR_EXPORT 28 | # define __SDR_IMPORT 29 | # endif 30 | #elif _MSC_VER 31 | # define __SDR_EXPORT __declspec(dllexport) 32 | # define __SDR_IMPORT __declspec(dllimport) 33 | #else 34 | # define __SDR_EXPORT 35 | # define __SDR_IMPORT 36 | #endif 37 | 38 | #ifndef rtlsdr_STATIC 39 | # ifdef rtlsdr_EXPORTS 40 | # define RTLSDR_API __SDR_EXPORT 41 | # else 42 | # define RTLSDR_API __SDR_IMPORT 43 | # endif 44 | #else 45 | #define RTLSDR_API 46 | #endif 47 | #endif /* RTLSDR_EXPORT_H */ 48 | -------------------------------------------------------------------------------- /src/rtlsdr/include/rtlsdr_i2c.h: -------------------------------------------------------------------------------- 1 | #ifndef __I2C_H 2 | #define __I2C_H 3 | 4 | uint32_t rtlsdr_get_tuner_clock(void *dev); 5 | int rtlsdr_i2c_write_fn(void *dev, uint8_t addr, uint8_t *buf, int len); 6 | int rtlsdr_i2c_read_fn(void *dev, uint8_t addr, uint8_t *buf, int len); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /src/rtlsdr/include/tuner_fc0012.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Fitipower FC0012 tuner driver 3 | * 4 | * Copyright (C) 2012 Hans-Frieder Vogt 5 | * 6 | * modified for use in librtlsdr 7 | * Copyright (C) 2012 Steve Markgraf 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | */ 24 | 25 | #ifndef _FC0012_H_ 26 | #define _FC0012_H_ 27 | 28 | #define FC0012_I2C_ADDR 0xc6 29 | #define FC0012_CHECK_ADDR 0x00 30 | #define FC0012_CHECK_VAL 0xa1 31 | 32 | int fc0012_init(void *dev); 33 | int fc0012_set_params(void *dev, uint32_t freq, uint32_t bandwidth); 34 | int fc0012_set_gain(void *dev, int gain); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/rtlsdr/include/tuner_fc0013.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Fitipower FC0013 tuner driver 3 | * 4 | * Copyright (C) 2012 Hans-Frieder Vogt 5 | * 6 | * modified for use in librtlsdr 7 | * Copyright (C) 2012 Steve Markgraf 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | */ 24 | 25 | #ifndef _FC0013_H_ 26 | #define _FC0013_H_ 27 | 28 | #define FC0013_I2C_ADDR 0xc6 29 | #define FC0013_CHECK_ADDR 0x00 30 | #define FC0013_CHECK_VAL 0xa3 31 | 32 | int fc0013_init(void *dev); 33 | int fc0013_set_params(void *dev, uint32_t freq, uint32_t bandwidth); 34 | int fc0013_set_gain_mode(void *dev, int manual); 35 | int fc0013_set_lna_gain(void *dev, int gain); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/rtlsdr/librtlsdr.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: RTL-SDR Library 7 | Description: C Utility Library 8 | Version: @VERSION@ 9 | Cflags: -I${includedir}/ @RTLSDR_PC_CFLAGS@ 10 | Libs: -L${libdir} -lrtlsdr 11 | Libs.private: @RTLSDR_PC_LIBS@ -lusb-1.0 @CMAKE_THREAD_LIBS_INIT@ 12 | -------------------------------------------------------------------------------- /src/rtlsdr/m4/.gitignore: -------------------------------------------------------------------------------- 1 | /libtool.m4 2 | /lt*.m4 3 | -------------------------------------------------------------------------------- /src/rtlsdr/src/Makefile.am: -------------------------------------------------------------------------------- 1 | # This is _NOT_ the library release version, it's an API version. 2 | # Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification 3 | LIBVERSION=0:5:0 4 | 5 | AUTOMAKE_OPTIONS = subdir-objects 6 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 7 | noinst_HEADERS = convenience/convenience.h 8 | AM_CFLAGS = ${CFLAGS} -fPIC ${SYMBOL_VISIBILITY} 9 | 10 | lib_LTLIBRARIES = librtlsdr.la 11 | 12 | librtlsdr_la_SOURCES = librtlsdr.c tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c 13 | librtlsdr_la_LDFLAGS = -version-info $(LIBVERSION) 14 | 15 | bin_PROGRAMS = rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power 16 | 17 | rtl_sdr_SOURCES = rtl_sdr.c convenience/convenience.c 18 | rtl_sdr_LDADD = librtlsdr.la 19 | 20 | rtl_tcp_SOURCES = rtl_tcp.c convenience/convenience.c 21 | rtl_tcp_LDADD = librtlsdr.la 22 | 23 | rtl_test_SOURCES = rtl_test.c convenience/convenience.c 24 | rtl_test_LDADD = librtlsdr.la $(LIBM) 25 | 26 | rtl_fm_SOURCES = rtl_fm.c convenience/convenience.c 27 | rtl_fm_LDADD = librtlsdr.la $(LIBM) 28 | 29 | rtl_eeprom_SOURCES = rtl_eeprom.c convenience/convenience.c 30 | rtl_eeprom_LDADD = librtlsdr.la $(LIBM) 31 | 32 | rtl_adsb_SOURCES = rtl_adsb.c convenience/convenience.c 33 | rtl_adsb_LDADD = librtlsdr.la $(LIBM) 34 | 35 | rtl_power_SOURCES = rtl_power.c convenience/convenience.c 36 | rtl_power_LDADD = librtlsdr.la $(LIBM) 37 | -------------------------------------------------------------------------------- /src/rtlsdr/src/rtlsdr.rc.in: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION 0,0,0,0 6 | PRODUCTVERSION 0,0,0,0 7 | FILEFLAGSMASK 0x3fL 8 | #ifndef NDEBUG 9 | FILEFLAGS 0x0L 10 | #else 11 | FILEFLAGS 0x1L 12 | #endif 13 | FILEOS VOS__WINDOWS32 14 | FILETYPE VFT_DLL 15 | FILESUBTYPE VFT2_DRV_INSTALLABLE 16 | BEGIN 17 | BLOCK "StringFileInfo" 18 | BEGIN 19 | BLOCK "040904b0" 20 | BEGIN 21 | VALUE "FileDescription", "osmocom rtl-sdr" 22 | VALUE "FileVersion", "@VERSION@" 23 | VALUE "InternalName", "rtl-sdr.dll" 24 | VALUE "LegalCopyright", "Licensed under GPLv2" 25 | VALUE "OriginalFilename", "rtl-sdr.dll" 26 | VALUE "ProductName", "osmocom rtl-sdr" 27 | VALUE "ProductVersion", "@VERSION@" 28 | END 29 | END 30 | BLOCK "VarFileInfo" 31 | BEGIN 32 | VALUE "Translation", 0x409, 1200 33 | END 34 | END 35 | -------------------------------------------------------------------------------- /src/sdrdab-cli/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug/ 2 | /Release/ 3 | /src/html/ 4 | sdrdab.doxytag 5 | *.db 6 | *.aac 7 | *.ogg 8 | <<<<<<< HEAD 9 | /matlab/*~ 10 | /matlab/ref/*~ 11 | <<<<<<< HEAD 12 | /matlab/*.png 13 | ======= 14 | ======= 15 | >>>>>>> refs/remotes/origin/development 16 | >>>>>>> branch 'performance_test' of https://sdr.kt.agh.edu.pl/developers/sdr.git 17 | /core 18 | /*_debug 19 | 20 | -------------------------------------------------------------------------------- /src/sdrdab-cli/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_DEFINITIONS(-std=c++98) 2 | 3 | cmake_minimum_required(VERSION 2.8.12.2) 4 | file( GLOB CLI_SOURCES "*.cc" ) 5 | set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") 6 | add_executable("sdrdab-cli" ${CLI_SOURCES}) 7 | 8 | target_include_directories("sdrdab" "PUBLIC" "../sdrdab/") 9 | 10 | find_package(PkgConfig REQUIRED) 11 | pkg_check_modules(GLIB_PKG glib-2.0) 12 | if (GLIB_PKG_FOUND) 13 | message(Found glib-2.0) 14 | include_directories(${GLIB_PKG_INCLUDE_DIRS}) 15 | ENDIF() 16 | 17 | target_link_libraries("sdrdab-cli" "sdrdab") 18 | target_link_libraries("sdrdab-cli" "gstreamer-1.0") 19 | target_link_libraries("sdrdab-cli" "gobject-2.0") 20 | target_link_libraries("sdrdab-cli" "gstapp-1.0") 21 | target_link_libraries("sdrdab-cli" "readline") 22 | 23 | if(APPLE) 24 | ADD_LIBRARY(libargp STATIC IMPORTED) 25 | SET_TARGET_PROPERTIES(libargp PROPERTIES 26 | IMPORTED_LOCATION /usr/local/opt/argp-standalone/lib/libargp.a) 27 | TARGET_LINK_LIBRARIES("sdrdab-cli" "libargp") 28 | 29 | set(CMAKE_LIBRARY_PATH /usr/local/lib/ ${CMAKE_LIBRARY_PATH}) #important, ignore unused prompt 30 | set(CMAKE_CXX_FLAGS "-L/usr/local/opt/readline/lib") #important, ignore unused prompt 31 | endif() 32 | 33 | add_dependencies("sdrdab-cli" "sdrdab") 34 | -------------------------------------------------------------------------------- /src/sdrdab-cli/sdrdab-cli.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * @file sdrdab-cli.cc 3 | * @brief main() function 4 | * 5 | * @author Krzysztof Szczęsny, kaszczesny@gmail.com 6 | * @date Created on: 9 April 2015 7 | * @version 1.0 8 | * @copyright Copyright (c) 2015 Krzysztof Szczęsny 9 | * @pre sdrdab + librtlsdr (dynamic linkage) 10 | * @pre libreadline6 11 | * @par License 12 | * 13 | * This program is free software: you can redistribute it and/or modify 14 | * it under the terms of the GNU General Public License as published by 15 | * the Free Software Foundation, either version 3 of the License, or 16 | * (at your option) any later version. 17 | * 18 | * This program is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public License 24 | * along with this program. If not, see \. 25 | */ 26 | 27 | #include "cli_scheduler.h" 28 | 29 | /** 30 | * Main function - initialization + recreation of CLIScheduler object in a loop 31 | * if requested. 32 | * @param[in] argc argc 33 | * @param[in] argv argv 34 | * @return EXIT_SUCCESS, CLIScheduler::PTHREAD_CREATE_FAIL, 35 | * Scheduler::scheduler_error_t or UserInput::ARGP_EXIT_ERR_CODE. 36 | */ 37 | int main(int argc, char **argv) { 38 | CLIScheduler *cli = new CLIScheduler(argc, argv); 39 | cli->SuppressStderr(); 40 | cli->RequestedList(); 41 | 42 | ReadLine::Init(); 43 | 44 | cli->FireSchedulerThread(); 45 | while (cli->Process() == true) { //event loop until user quits 46 | cli = cli->Revive(); 47 | cli->FireSchedulerThread(); 48 | } 49 | 50 | delete cli; 51 | return CLIScheduler::errno_; 52 | } 53 | -------------------------------------------------------------------------------- /src/sdrdab-gui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file( GLOB_RECURSE SDRDAB_GUI_SOURCES "*.cc" ) 2 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 3 | set(CMAKE_AUTOMOC ON) 4 | set(CMAKE_AUTOUIC ON) 5 | set(CMAKE_AUTORCC ON) 6 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 7 | 8 | find_package(PkgConfig REQUIRED) 9 | pkg_check_modules(GLIB_PKG glib-2.0) 10 | if (GLIB_PKG_FOUND) 11 | message(Found glib-2.0) 12 | include_directories(${GLIB_PKG_INCLUDE_DIRS}) 13 | ENDIF() 14 | 15 | 16 | 17 | find_package(Qt5Widgets) 18 | set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") 19 | add_executable("sdrdab-gui" ${SDRDAB_GUI_SOURCES}) 20 | target_link_libraries("sdrdab-gui" Qt5::Widgets) 21 | 22 | target_link_libraries("sdrdab-gui" sdrdab) 23 | -------------------------------------------------------------------------------- /src/sdrdab-gui/main.cc: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | #include 3 | 4 | int main(int argc, char *argv[]){ 5 | QApplication a(argc, argv); 6 | MainWindow w; 7 | w.show(); 8 | return a.exec(); 9 | } 10 | -------------------------------------------------------------------------------- /src/sdrdab-gui/sdrdab-gui.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2016-04-08T15:17:09 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui multimedia 8 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport 10 | 11 | TARGET = sdrdab-gui 12 | TEMPLATE = app 13 | 14 | 15 | SOURCES += main.cc mainwindow.cc gui_scheduler.cc \ 16 | user_conf.cc 17 | 18 | HEADERS += mainwindow.h gui_scheduler.h scheduler.h \ 19 | user_conf.h 20 | 21 | 22 | FORMS += mainwindow.ui 23 | 24 | 25 | INCLUDEPATH += /home/doszek/git/DAB-decoder-2016/src/sdrdab 26 | INCLUDEPATH += /home/doszek/git/DAB-decoder-2016/src/rtlsdr/include 27 | INCLUDEPATH += /home/doszek/git/DAB-decoder-2016/src/rscode 28 | INCLUDEPATH += /home/doszek/git/DAB-decoder-2016/src/gtest/include 29 | INCLUDEPATH += /usr/include/gstreamer-1.0 30 | INCLUDEPATH += /usr/include/glib-2.0 31 | INCLUDEPATH += /usr/include/ 32 | INCLUDEPATH += /usr/include/c++/4.8 33 | INCLUDEPATH += /usr/include/c++/4.8/backward 34 | INCLUDEPATH += /usr/include/x86_64-linux-gnu 35 | INCLUDEPATH += /usr/include/x86_64-linux-gnu/c+/4.8 36 | INCLUDEPATH += /usr/lib/gcc/x86_64-linux-gnu/4.8/include 37 | INCLUDEPATH += /usr/lib/gcc/x86_64-linux-gnu/include-fixed 38 | INCLUDEPATH += /usr/lib/x86_64-linux-gnu/glib-2.0/include 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/sdrdab-gui/todo.txt: -------------------------------------------------------------------------------- 1 | 1. ui_mainwindow.h should be autogenerated during build. In theory that's 2 | already implemented via CMAKE_AUTOUIC in CMakeLists.txt, but it doesn't work 3 | correctly due to a bug in CMake 2.8.12.2 (which is included in Ubuntu 14.04 as 4 | of 16 Sep 2016). ui_mainwindow.h should probably be removed from here as soon 5 | as we stop supporting Ubuntu 14.04 and CMake older than 3.1 6 | -------------------------------------------------------------------------------- /src/sdrdab/.gitignore: -------------------------------------------------------------------------------- 1 | /Debug/ 2 | /Unittest/ 3 | /test/testdata/* 4 | !/test/testdata/README 5 | !/test/testdata/download.sh 6 | /test/matlab/inputdata/* 7 | !/test/matlab/inputdata/README 8 | !/test/matlab/inputdata/download.sh 9 | *.aac 10 | /Release/ 11 | /src/html/ 12 | *.db 13 | 14 | /GprofTest/ 15 | -------------------------------------------------------------------------------- /src/sdrdab/AudioDecoder/abstract_sink.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * @class AbstractSink 3 | * 4 | * @author: Kacper Patro patro.kacper@gmail.com 5 | * @date May 13, 2015 6 | * 7 | * @version 1.0 beta 8 | * @copyright Copyright (c) 2015 Kacper Patro 9 | * @par License 10 | * 11 | * This library is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU Lesser General Public 13 | * License as published by the Free Software Foundation; either 14 | * version 2.1 of the License, or (at your option) any later version. 15 | * 16 | * This library is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public 22 | * License along with this library; if not, write to the Free Software 23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 24 | * 25 | */ 26 | 27 | #include "abstract_sink.h" 28 | #include 29 | 30 | AbstractSink::~AbstractSink() { 31 | } 32 | 33 | AbstractSink::AbstractSink() { 34 | } 35 | 36 | bool AbstractSink::operator ==(const AbstractSink &other) const { 37 | return !strcmp(name(), other.name()); 38 | } 39 | -------------------------------------------------------------------------------- /src/sdrdab/AudioDecoder/abstract_src.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * @class AbstractSrc 3 | * 4 | * @author: Kacper Patro patro.kacper@gmail.com 5 | * @date May 24, 2015 6 | * 7 | * @version 1.0 beta 8 | * @copyright Copyright (c) 2015 Kacper Patro 9 | * @par License 10 | * 11 | * This library is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU Lesser General Public 13 | * License as published by the Free Software Foundation; either 14 | * version 2.1 of the License, or (at your option) any later version. 15 | * 16 | * This library is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public 22 | * License along with this library; if not, write to the Free Software 23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 24 | * 25 | */ 26 | 27 | #include "abstract_src.h" 28 | 29 | AbstractSrc::AbstractSrc() { 30 | } 31 | 32 | AbstractSrc::~AbstractSrc() { 33 | } 34 | -------------------------------------------------------------------------------- /src/sdrdab/AudioDecoder/abstract_src.h: -------------------------------------------------------------------------------- 1 | /* 2 | * @class AbstractSrc 3 | * 4 | * @author: Kacper Patro patro.kacper@gmail.com 5 | * @date May 24, 2015 6 | * 7 | * @version 1.0 beta 8 | * @copyright Copyright (c) 2015 Kacper Patro 9 | * @par License 10 | * 11 | * This library is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU Lesser General Public 13 | * License as published by the Free Software Foundation; either 14 | * version 2.1 of the License, or (at your option) any later version. 15 | * 16 | * This library is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public 22 | * License along with this library; if not, write to the Free Software 23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 24 | * 25 | */ 26 | 27 | #ifndef SRC_ABSTRACT_SRC_H_ 28 | #define SRC_ABSTRACT_SRC_H_ 29 | 30 | /** 31 | * @class AbstractSrc 32 | * @brief Abstract class for sources 33 | * 34 | * @author Kacper Patro patro.kacper@gmail.com 35 | * @copyright Public domain 36 | * @pre 37 | */ 38 | class AbstractSrc { 39 | public: 40 | AbstractSrc(); 41 | virtual ~AbstractSrc(); 42 | 43 | /** 44 | * Sets source properties, before linking 45 | * @param[in,out] other_data Other data pointer, may be pointer to structure being linked 46 | */ 47 | virtual void SetSrc(void *other_data) = 0; 48 | 49 | /** 50 | * Links source element 51 | */ 52 | virtual void LinkSrc() = 0; 53 | 54 | /** 55 | * Returns element name 56 | * @return Element name 57 | */ 58 | virtual const char *name() const = 0; 59 | 60 | /** 61 | * Resets source state 62 | */ 63 | virtual void ResetSrc() = 0; 64 | 65 | }; 66 | 67 | #endif /* SRC_ABSTRACT_SRC_H_ */ 68 | -------------------------------------------------------------------------------- /src/sdrdab/AudioDecoder/file_src.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * @class FileSrc 3 | * 4 | * @author: Kacper Patro patro.kacper@gmail.com 5 | * @date May 13, 2015 6 | * 7 | * @version 1.0 beta 8 | * @copyright Copyright (c) 2015 Kacper Patro 9 | * @par License 10 | * 11 | * This library is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU Lesser General Public 13 | * License as published by the Free Software Foundation; either 14 | * version 2.1 of the License, or (at your option) any later version. 15 | * 16 | * This library is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU Lesser General Public 22 | * License along with this library; if not, write to the Free Software 23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 24 | * 25 | */ 26 | 27 | #include "file_src.h" 28 | 29 | FileSrc::FileSrc(const char *path): 30 | data_(new Data), 31 | path_(path) { 32 | data_->abstract_src = this; 33 | data_->player_data = NULL; 34 | } 35 | 36 | FileSrc::~FileSrc() { 37 | delete data_; 38 | } 39 | 40 | void FileSrc::SetSrc(void *player_data) { 41 | data_->player_data = reinterpret_cast(player_data); 42 | 43 | data_->src = gst_element_factory_make("filesrc", "src"); 44 | g_assert(data_->src); 45 | 46 | g_object_set(data_->src, "location", path_, NULL); 47 | 48 | gst_bin_add_many(GST_BIN(data_->player_data->pipeline), 49 | data_->src, 50 | NULL 51 | ); 52 | } 53 | 54 | const char *FileSrc::name() const { 55 | return "file_src"; 56 | } 57 | 58 | void FileSrc::LinkSrc() { 59 | g_assert(gst_element_link_many( 60 | data_->src, 61 | data_->player_data->iddemux, 62 | NULL) 63 | ); 64 | } 65 | 66 | void FileSrc::ResetSrc() { 67 | return; 68 | } 69 | -------------------------------------------------------------------------------- /src/sdrdab/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_DEFINITIONS(-std=c++98) 2 | ADD_DEFINITIONS(-Werror) 3 | 4 | IF( NOT CMAKE_BUILD_TYPE ) 5 | SET( CMAKE_BUILD_TYPE Debug ... FORCE ) 6 | ENDIF() 7 | 8 | file( GLOB_RECURSE SDRDAB_SOURCES "*.cc" ) 9 | 10 | add_library("sdrdab" ${SDRDAB_SOURCES}) 11 | include_directories(src) 12 | 13 | #include(../cmake/Modules/FindGStreamer.cmake) 14 | #include_directories( ${GSTREAMER_INCLUDE_DIR}) 15 | #add_definitions(${GSTREAMER_DEFINITIONS}) 16 | #target_link_libraries("sdrdab" ${GSTREAMER_LIBRARIES}) 17 | 18 | target_include_directories("sdrdab" "PUBLIC" "/usr/include/gstreamer-1.0/") #TODO 19 | target_include_directories("sdrdab" "PUBLIC" "/usr/lib/gstreamer-1.0/include") #TODO ARCH_COMPAT 20 | target_include_directories("sdrdab" "PUBLIC" "/usr/local/lib/gstreamer-1.0/include/") #TODO MAC_COMPAT 21 | target_include_directories("sdrdab" "PUBLIC" "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include/") #TODO UBUNTU_COMPAT 22 | target_include_directories("sdrdab" "PUBLIC" "/usr/local/include/gstreamer-1.0") #TODO MAC_COMPAT 23 | target_include_directories("sdrdab" "PUBLIC" "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include/") #TODO UBUNTU_COMPAT 24 | target_include_directories("sdrdab" "PUBLIC" "../rtlsdr/include/")#TODO 25 | target_link_libraries("sdrdab" "gstreamer-1.0") 26 | target_link_libraries("sdrdab" "gstapp-1.0") 27 | target_link_libraries("sdrdab" "gobject-2.0") 28 | target_link_libraries("sdrdab" "pthread") 29 | target_link_libraries("sdrdab" "fftw3f") 30 | target_link_libraries("sdrdab" "ecc") 31 | target_link_libraries("sdrdab" "rtlsdr_static_custom") 32 | target_link_libraries("sdrdab" "samplerate") 33 | 34 | target_link_libraries("sdrdab" "glib-2.0") 35 | 36 | find_package(PkgConfig REQUIRED) 37 | pkg_check_modules(GLIB_PKG glib-2.0) 38 | if (GLIB_PKG_FOUND) 39 | message(Found glib-2.0) 40 | include_directories(${GLIB_PKG_INCLUDE_DIRS}) 41 | ENDIF() 42 | -------------------------------------------------------------------------------- /src/sdrdab/DataDecoder/reed_solomon.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @class ReedSolomon 3 | * @brief Decoding with Reed-Solomon algorithm 4 | * 5 | * @author Michal Babiuch babiuch.michal@gmail.com (ReedSolomon::ReedSolomonCorrection) 6 | * @author Jaroslaw Bulat kwant@agh.edu.pl refactoring, cleanUP 7 | * 8 | * @date 7 July 2016 - version 2.0 beta 9 | * @date 1 November 2016 - version 2.0 10 | * @version 2.0 11 | * @copyright Copyright (c) 2016 Michał Jurczak 12 | * 13 | * @par License 14 | * 15 | * @todo:rewrite code from scratch, remove rscode 16 | * 17 | * This library is free software; you can redistribute it and/or 18 | * modify it under the terms of the GNU Lesser General Public 19 | * License as published by the Free Software Foundation; either 20 | * version 2.1 of the License, or (at your option) any later version. 21 | * 22 | * This library is distributed in the hope that it will be useful, 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25 | * Lesser General Public License for more details. 26 | * 27 | * You should have received a copy of the GNU Lesser General Public 28 | * License along with this library; if not, write to the Free Software 29 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 30 | */ 31 | 32 | 33 | #ifndef REEDSOLOMON_H_ 34 | #define REEDSOLOMON_H_ 35 | 36 | #include 37 | #include 38 | 39 | extern "C" { 40 | #include "../../rscode/ecc.h" 41 | } 42 | 43 | class ReedSolomon { 44 | public: 45 | 46 | /** 47 | * call rscode 48 | */ 49 | size_t ReedSolomonCorrection(uint8_t *data, int32_t size); 50 | }; 51 | 52 | #endif /* ReedSolomon_H_ */ 53 | -------------------------------------------------------------------------------- /src/sdrdab/RingBuffer/resampling_ring_buffer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @author: Paweł Szulc 3 | * @date 7 July 2015 - version 1.0 beta 4 | * @date 7 July 2016 - version 2.0 beta 5 | * @date 1 November 2016 - version 2.0 6 | * @version 2.0 7 | * @copyright Copyright (c) 2015 Paweł Szulc 8 | * @par License 9 | * 10 | * This library is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU Lesser General Public 12 | * License as published by the Free Software Foundation; either 13 | * version 2.1 of the License, or (at your option) any later version. 14 | * 15 | * This library is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | * Lesser General Public License for more details. 19 | * 20 | * You should have received a copy of the GNU Lesser General Public 21 | * License along with this library; if not, write to the Free Software 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 23 | */ 24 | 25 | 26 | #ifndef RESAMPLING_RING_BUFFER_H_ 27 | #define RESAMPLING_RING_BUFFER_H_ 28 | 29 | #include "ring_buffer.h" 30 | #include "Resampler/resampler.h" 31 | 32 | 33 | class ResamplingRingBuffer : public RingBuffer { 34 | public: 35 | 36 | ResamplingRingBuffer(int quality, size_t size, int channels); 37 | 38 | virtual ~ResamplingRingBuffer(); 39 | 40 | size_t WriteResampledInto(float* source_buffer, size_t number_to_read, float ratio); 41 | // size_t sWriteResampledInto(float* source_buffer, size_t number_to_read, float ratio); 42 | 43 | private: 44 | Resampler *resampler; 45 | }; 46 | 47 | #endif /* RESAMPLING_RING_BUFFER_H_ */ 48 | -------------------------------------------------------------------------------- /src/sdrdab/osx_compat.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file osx_compat.cc 3 | * 4 | * 5 | * @author Jakub Bernardy kbernady@gmail.com (clock_gettime() 90%,pthread_mutex_timedlock() 90%) 6 | * @author Adrian Włosiak adwlosiakh@gmail.com (clock_gettime() 10%, pthread_mutex_timedlock() 10%) 7 | * @date 7 July 2015 - version 1.0 beta 8 | * @date 7 July 2016 - version 2.0 beta 9 | * @date 1 November 2016 - version 2.0 10 | * @version 2.0 11 | * @copyright Copyright (c) 2016 Jakub Bernardy, Adrian Włosiak 12 | * 13 | * @par License 14 | * 15 | * This library is free software; you can redistribute it and/or 16 | * modify it under the terms of the GNU Lesser General Public 17 | * License as published by the Free Software Foundation; either 18 | * version 2.1 of the License, or (at your option) any later version. 19 | * 20 | * This library is distributed in the hope that it will be useful, 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | * Lesser General Public License for more details. 24 | * 25 | * You should have received a copy of the GNU Lesser General Public 26 | * License along with this library; if not, write to the Free Software 27 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 28 | */ 29 | 30 | #include 31 | #include 32 | #include 33 | 34 | #define TIME_UTC 1 35 | #define CLOCK_REALTIME 0 36 | 37 | // OS X does not have clock_gettime, use clock_get_time 38 | int clock_gettime(int clk_id, struct timespec *tp); 39 | 40 | //definition of pthread_mutex_timedlock for OSX: 41 | #if !(defined(_POSIX_TIMEOUTS) && (_POSIX_TIMEOUTS >= 200112L) && defined(_POSIX_THREADS) && (_POSIX_THREADS >= 200112L)) 42 | int pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *abstime); 43 | #endif 44 | -------------------------------------------------------------------------------- /src/sdrdab/threading/scoped_lock.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * @class ScopedLock 3 | * @brief Implementation of RAII (https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization) for mutex locking. 4 | * 5 | * @author Kacper Żuk 6 | * @date 7 July 2016 - version 2.0 beta 7 | * @date 1 November 2016 - version 2.0 8 | * @version 2.0 9 | * @copyright Copyright (c) 2016 Kacper Żuk 10 | * 11 | * @par License 12 | * 13 | * This library is free software; you can redistribute it and/or 14 | * modify it under the terms of the GNU Lesser General Public 15 | * License as published by the Free Software Foundation; either 16 | * version 2.1 of the License, or (at your option) any later version. 17 | * 18 | * This library is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | * Lesser General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU Lesser General Public 24 | * License along with this library; if not, write to the Free Software 25 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 26 | */ 27 | #include "scoped_lock.h" 28 | 29 | /** 30 | * Create ScopedLock instance, that will automatically lock mutex. Lock will be 31 | * automatically released by destructor when instance goes out of scope. 32 | * @param mutex mutex to lock 33 | */ 34 | ScopedLock::ScopedLock(pthread_mutex_t & mutex) { 35 | lock_ = &mutex; 36 | pthread_mutex_lock(lock_); 37 | } 38 | 39 | ScopedLock::~ScopedLock() { 40 | pthread_mutex_unlock(lock_); 41 | } 42 | -------------------------------------------------------------------------------- /src/sdrdab/threading/scoped_lock.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @class ScopedLock 3 | * @brief Implementation of RAII (https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization) for mutex locking. 4 | * 5 | * @author Kacper Żuk 6 | * @date 7 July 2016 - version 2.0 beta 7 | * @date 1 November 2016 - version 2.0 8 | * @version 2.0 9 | * @copyright Copyright (c) 2016 Kacper Żuk 10 | * 11 | * @par License 12 | * 13 | * This library is free software; you can redistribute it and/or 14 | * modify it under the terms of the GNU Lesser General Public 15 | * License as published by the Free Software Foundation; either 16 | * version 2.1 of the License, or (at your option) any later version. 17 | * 18 | * This library is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | * Lesser General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU Lesser General Public 24 | * License along with this library; if not, write to the Free Software 25 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 26 | */ 27 | 28 | #ifndef SCOPED_LOCK_H 29 | #define SCOPED_LOCK_H 30 | 31 | #include 32 | 33 | class ScopedLock { 34 | private: 35 | pthread_mutex_t *lock_; 36 | 37 | public: 38 | ScopedLock(pthread_mutex_t & mutex); 39 | ~ScopedLock(); 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(gtest) 2 | 3 | ADD_DEFINITIONS(-std=c++98) 4 | ADD_DEFINITIONS(-Werror) 5 | ADD_DEFINITIONS(-DGOOGLE_UNIT_TEST) 6 | 7 | cmake_minimum_required(VERSION 2.8.12.2) 8 | 9 | enable_testing() 10 | include_directories( 11 | ${gtest_SOURCE_DIR}/include 12 | ${gtest_SOURCE_DIR}) 13 | link_directories(${gtest_BINARY_DIR}/src) 14 | file( GLOB SDRDAB_UNITTESTS_SOURCES "*.cc" ) 15 | 16 | set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") 17 | add_executable("sdrdab-ut" ${SDRDAB_UNITTESTS_SOURCES}) 18 | 19 | find_package(PkgConfig REQUIRED) 20 | pkg_check_modules(GLIB_PKG glib-2.0) 21 | if (GLIB_PKG_FOUND) 22 | message(Found glib-2.0) 23 | include_directories(${GLIB_PKG_INCLUDE_DIRS}) 24 | ENDIF() 25 | 26 | target_include_directories("sdrdab-ut" PUBLIC ".") 27 | target_include_directories("sdrdab-ut" "PRIVATE" "${SDRDAB_SOURCES}/src/sdrdab/")#TODO 28 | target_include_directories("sdrdab-ut" "PUBLIC" "/usr/include/gstreamer-1.0/") #TODO 29 | target_include_directories("sdrdab-ut" "PUBLIC" "/usr/lib/gstreamer-1.0/include") #TODO ARCH_COMPAT 30 | target_include_directories("sdrdab-ut" "PUBLIC" "/usr/local/lib/gstreamer-1.0/include/") #TODO MAC_COMPAT 31 | target_include_directories("sdrdab-ut" "PUBLIC" "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include/") #TODO UBUNTU_COMPAT 32 | target_include_directories("sdrdab-ut" "PUBLIC" "/usr/local/include/gstreamer-1.0") #TODO MAC_COMPAT 33 | target_include_directories("sdrdab-ut" "PUBLIC" "/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include/") #TODO UBUNTU_COMPAT 34 | 35 | target_link_libraries("sdrdab-ut" "gstreamer-1.0") 36 | target_link_libraries("sdrdab-ut" "gobject-2.0") 37 | target_link_libraries("sdrdab-ut" "gstapp-1.0") 38 | 39 | target_link_libraries(sdrdab-ut sdrdab) 40 | target_link_libraries(sdrdab-ut gtest_main) 41 | -------------------------------------------------------------------------------- /test/DataDecoder_BinToDEc_unittest.cc: -------------------------------------------------------------------------------- 1 | #ifdef GOOGLE_UNIT_TEST 2 | 3 | #include "data_decoder.h" 4 | #include "gtest/gtest.h" 5 | #include "MatlabIO.h" 6 | 7 | using namespace std; 8 | 9 | class BinToDec : public ::testing::Test{ 10 | protected: 11 | BinToDec(){ 12 | ModeParameters param = {504, 2048, 2552, 76, 2656, 196608, 1536, 3, 12, 4, 5, 3, 3096, 768, 199264, 9216, 48, 18, DAB_MODE_I}; 13 | datadecoder = new DataDecoder(¶m); 14 | } 15 | 16 | virtual ~BinToDec(){ 17 | delete datadecoder; 18 | } 19 | 20 | virtual void SetUp(){ 21 | } 22 | DataDecoder * datadecoder; 23 | }; 24 | 25 | 26 | TEST_F(BinToDec, ShiftAndLengthFor12bitsLength) { 27 | uint16_t values[16]={0, 1, 2, 3, 11, 536, 1024, 0xFF, 0x0E00, 2959, 951, 1391, 684, 0, 3398, 1435 }; 28 | 29 | for( size_t val=0; val<16; ++val ){ 30 | for( size_t shift=0; shift<30; ++shift ){ 31 | uint8_t data[16]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; 32 | uint16_t value = values[val]; 33 | size_t dataLength = 12; 34 | while(dataLength){ 35 | uint8_t mask = 0xFE | (static_cast(value)&0x01); // least significant bit 36 | mask <<= (7-(shift+dataLength-1)%8); 37 | mask |= 0xFF >> (((shift+dataLength-1)%8)+1); 38 | data[(shift+dataLength-1)/8] &= mask; 39 | dataLength--; 40 | value >>=1; 41 | } 42 | uint16_t result = datadecoder->BinToDec(data, shift, 12); 43 | EXPECT_EQ(result, values[val]) << "BinToDec faild at value:" << values[val] << " shift:" << shift << " result:" << result; 44 | } 45 | } 46 | } 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /test/DataDecoder_CRC16_unittest.cc: -------------------------------------------------------------------------------- 1 | #ifdef GOOGLE_UNIT_TEST 2 | 3 | #include "DataDecoder/superframe.h" 4 | #include "gtest/gtest.h" 5 | #include "MatlabIO.h" 6 | 7 | using namespace std; 8 | 9 | class CRC16 : public ::testing::Test{ 10 | protected: 11 | CRC16(){ 12 | length = 254; 13 | data = new uint8_t[length]; 14 | 15 | dataLoaded = false; 16 | 17 | ModeParameters param = {504, 2048, 2552, 76, 2656, 196608, 1536, 3, 12, 4, 5, 3, 3096, 768, 199264, 9216, 48, 18, DAB_MODE_I}; 18 | superframe = new SuperFrame(¶m); 19 | } 20 | 21 | virtual ~CRC16(){ 22 | delete superframe; 23 | delete [] data; 24 | } 25 | 26 | virtual void SetUp(){ 27 | dataLoaded = MatlabIO::ReadData(data, "./data/ut/CRC_input.txt", length); 28 | } 29 | 30 | size_t length; 31 | bool dataLoaded; 32 | SuperFrame * superframe; 33 | uint8_t* data; 34 | 35 | }; 36 | 37 | 38 | TEST_F(CRC16, CRC16) { 39 | ASSERT_TRUE(dataLoaded) << "TESTING CODE FAILED... could not load expected data"; 40 | bool result = false; 41 | result = superframe->CRC16(data, length); 42 | 43 | EXPECT_EQ(result, true) << "CRC Check FAILED."; 44 | } 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /test/DataDecoder_FIGT0E17_unittest.cc: -------------------------------------------------------------------------------- 1 | #ifdef GOOGLE_UNIT_TEST 2 | 3 | #include "data_decoder.h" 4 | #include "gtest/gtest.h" 5 | #include "MatlabIO.h" 6 | 7 | using namespace std; 8 | 9 | class FIGTest017 : public ::testing::Test{ 10 | protected: 11 | FIGTest017(){ 12 | //FIRST SET OF DATA 13 | input1Loaded = false; 14 | output1Loaded = false; 15 | type1Loaded = false; 16 | length1 = 21; // TxExSize.txt 17 | lengthO = 1; 18 | input1 = new uint8_t[length1]; 19 | expectedOutput1 = new size_t[lengthO]; 20 | output1 = 0; 21 | type1 = 0; 22 | 23 | extractfrombitstream = new ExtractFromBitstream(); 24 | } 25 | 26 | virtual ~FIGTest017(){ 27 | delete extractfrombitstream; 28 | delete [] input1; 29 | } 30 | 31 | virtual void SetUp(){ 32 | //FIRST SET OF DATA 33 | input1Loaded = MatlabIO::ReadData( input1, "./data/ut/T0E17Input.txt", length1 ); 34 | output1Loaded = MatlabIO::ReadData( expectedOutput1, "./data/ut/T0E17FOutput.txt", lengthO); 35 | type1Loaded = MatlabIO::ReadData( &type1, "./data/ut/T0E17Type.txt", 1); 36 | } 37 | //FIRST SET OF DATA 38 | size_t length1; 39 | size_t lengthO; 40 | uint8_t* input1; 41 | size_t* expectedOutput1; 42 | uint8_t output1; 43 | uint8_t type1; 44 | bool input1Loaded; 45 | bool output1Loaded; 46 | bool type1Loaded; 47 | ExtractFromBitstream * extractfrombitstream; 48 | }; 49 | 50 | 51 | TEST_F(FIGTest017, T0E17TEST) { 52 | ASSERT_TRUE(input1Loaded) << "TESTING CODE FAILED... could not load input data"; 53 | ASSERT_TRUE(output1Loaded) << "TESTING CODE FAILED... could not load expected result"; 54 | ASSERT_TRUE(type1Loaded) << "TESTING CODE FAILED... could not load type"; 55 | output1 = extractfrombitstream->ExtractDataFromFIC(input1, length1, type1); 56 | 57 | EXPECT_EQ(static_cast(17), output1) << "EXTENSION CHECK FAILED"; 58 | 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /test/DataDecoder_FIGT0E21_unittest.cc: -------------------------------------------------------------------------------- 1 | #ifdef GOOGLE_UNIT_TEST 2 | 3 | #include "data_decoder.h" 4 | #include "gtest/gtest.h" 5 | #include "MatlabIO.h" 6 | 7 | using namespace std; 8 | 9 | class FIGTest021 : public ::testing::Test{ 10 | protected: 11 | FIGTest021(){ 12 | //FIRST SET OF DATA 13 | input1Loaded = false; 14 | output1Loaded = false; 15 | type1Loaded = false; 16 | length1 = 14; // TxExSize.txt 17 | lengthO = 1; 18 | input1 = new uint8_t[length1]; 19 | expectedOutput1 = new size_t[lengthO]; 20 | output1 = 0; 21 | type1 = 0; 22 | 23 | extractfrombitstream = new ExtractFromBitstream(); 24 | } 25 | 26 | virtual ~FIGTest021(){ 27 | delete extractfrombitstream; 28 | delete [] input1; 29 | } 30 | 31 | virtual void SetUp(){ 32 | //FIRST SET OF DATA 33 | input1Loaded = MatlabIO::ReadData( input1, "./data/ut/T0E21Input.txt", length1 ); 34 | output1Loaded = MatlabIO::ReadData( expectedOutput1, "./data/ut/T0E21FOutput.txt", lengthO); 35 | type1Loaded = MatlabIO::ReadData( &type1, "./data/ut/T0E21Type.txt", 1); 36 | } 37 | //FIRST SET OF DATA 38 | size_t length1; 39 | size_t lengthO; 40 | uint8_t* input1; 41 | size_t* expectedOutput1; 42 | uint8_t output1; 43 | uint8_t type1; 44 | bool input1Loaded; 45 | bool output1Loaded; 46 | bool type1Loaded; 47 | ExtractFromBitstream * extractfrombitstream; 48 | }; 49 | 50 | 51 | TEST_F(FIGTest021, T0E21TEST) { 52 | ASSERT_TRUE(input1Loaded) << "TESTING CODE FAILED... could not load input data"; 53 | ASSERT_TRUE(output1Loaded) << "TESTING CODE FAILED... could not load expected result"; 54 | ASSERT_TRUE(type1Loaded) << "TESTING CODE FAILED... could not load type"; 55 | output1 = extractfrombitstream->ExtractDataFromFIC(input1, length1, type1); 56 | 57 | EXPECT_EQ(static_cast(21), output1) << "EXTENSION CHECK FAILED"; 58 | 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /test/FileDataFeeder_Remodulator_unittest.cc: -------------------------------------------------------------------------------- 1 | /*#include "DataFeeder/file_data_feeder.h" 2 | #include "gtest/gtest.h" 3 | #include "MatlabIO.h" 4 | #include "../src/sdrdab/DataFeeder/file_data_feeder.h" 5 | 6 | class RemodulatorTest: public testing::Test { 7 | public: 8 | RemodulatorTest(){ 9 | data_1_loaded = false; 10 | data_2_loaded = false; 11 | mydatafeeder = NULL; 12 | our_buffer = new float[1024]; 13 | remodulator_exp_res = new float[1024]; 14 | fc_shift = 30000.0; 15 | }; 16 | virtual ~RemodulatorTest() { 17 | delete[] our_buffer; 18 | delete[] remodulator_exp_res; 19 | }; 20 | virtual void SetUp() { 21 | mydatafeeder = new FileDataFeeder("whatever.exe.dll",2048,2048000,229072000, 8); 22 | data_1_loaded = MatlabIO::ReadData(our_buffer, "./data/ut/remodulator_input.txt", 1024); 23 | data_2_loaded = MatlabIO::ReadData(remodulator_exp_res, "./data/ut/remodulator_expected_results.txt", 1024); 24 | }; 25 | virtual void TearDown() { 26 | delete mydatafeeder; 27 | }; 28 | float *our_buffer; 29 | float *remodulator_exp_res; 30 | float fc_shift; 31 | bool data_1_loaded, data_2_loaded; 32 | FileDataFeeder *mydatafeeder; 33 | }; 34 | 35 | TEST_F(RemodulatorTest, data_correct_test) { 36 | ASSERT_TRUE(data_1_loaded); 37 | ASSERT_TRUE(data_2_loaded); 38 | double abs_err = 0.0; 39 | mydatafeeder->Remodulate(our_buffer,1024,fc_shift); 40 | for (int i=0;i<1024;i++){ 41 | EXPECT_NEAR(remodulator_exp_res[i],our_buffer[i],0.001) << "WRONG\n!"; 42 | abs_err+=abs(remodulator_exp_res[i]-our_buffer[i])/1024; 43 | } 44 | std::cout<< "Absolute mean error: " << abs_err << std::endl; 45 | }; 46 | 47 | */; -------------------------------------------------------------------------------- /test/Gprof_unittest.cc: -------------------------------------------------------------------------------- 1 | #ifdef GOOGLE_UNIT_TEST 2 | 3 | /* 4 | * THIS REQUIRES THE FOLLOWING COMMAND EXECUTED TO RUN 5 | * "echo 0 > /proc/sys/kernel/kptr_restrict" 6 | */ 7 | 8 | 9 | #include "gtest/gtest.h" 10 | #include "scheduler.h" 11 | #include 12 | 13 | 14 | class GprofTest : public ::testing::Test{ 15 | protected: 16 | 17 | Scheduler sch; 18 | 19 | GprofTest(){ 20 | 21 | } 22 | 23 | virtual ~GprofTest(){ 24 | } 25 | 26 | virtual void SetUp(){ 27 | } 28 | 29 | }; 30 | 31 | 32 | TEST_F(GprofTest, GprofTest) { 33 | // katowice - 209936000 34 | // krakow - 229072000 35 | 36 | printf("start\n"); 37 | Scheduler sch; 38 | Scheduler::SchedulerConfig_t config; 39 | 40 | //const char * source = "./data/ut/Record3_katowice_iq.raw"; 41 | const char * source = "./data/ut/antena-1_dab_229072kHz_fs2048kHz_gain42_1.raw"; 42 | size_t freq = 229072000; 43 | 44 | config.data_source = Scheduler::DATA_FROM_FILE; 45 | config.input_filename = source; 46 | config.carrier_frequency = freq; 47 | 48 | sch.Start(config); 49 | 50 | printf("\nkoniec"); 51 | return; 52 | } 53 | 54 | 55 | #endif 56 | 57 | -------------------------------------------------------------------------------- /test/MatlabIO.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MatlabIO.h 3 | * 4 | * Created on: 23 lut 2015 5 | * Author: kwant 6 | */ 7 | 8 | #ifndef MATLABIO_H_ 9 | #define MATLABIO_H_ 10 | 11 | //#include 12 | 13 | using namespace std; 14 | 15 | /* 16 | * read/write data in txt format from file of "filename" name to data pointer 17 | * "data" have to be allocated, 18 | * data in file should be in decimal format, one number == one line 19 | * length is a number of elements (=number of lines) 20 | */ 21 | 22 | class MatlabIO { 23 | public: 24 | MatlabIO(); 25 | virtual ~MatlabIO(); 26 | //static bool ReadData( vector &data, const char* filename, size_t length ); 27 | //static bool WriteData( vector data, const char* filename, size_t length ); 28 | //no one seems to be using vector; uncomment if necessary 29 | static bool ReadData( float* data, const char* filename, size_t length ); 30 | static bool WriteData(const float* data, const char* filename, size_t length ); 31 | static bool ReadData( unsigned char* data, const char* filename, size_t length ); 32 | static bool WriteData( unsigned char* data, const char* filename, size_t length ); 33 | static bool ReadData( size_t* data, const char* filename, size_t length ); 34 | static bool WriteData( size_t* data, const char* filename, size_t length ); 35 | static bool ReadData(size_t datasize, const char* filename, unsigned char* ldata); 36 | 37 | }; 38 | 39 | #endif /* MATLABIO_H_ */ 40 | -------------------------------------------------------------------------------- /test/RingBuffer_Test_unittest.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * ring_buffer_test.cc 3 | * 4 | * Created on: May 24, 2015 5 | * Author: hipek 6 | */ 7 | 8 | #include "RingBuffer/ring_buffer.h" 9 | #include "gtest/gtest.h" 10 | #include "MatlabIO.h" 11 | 12 | using namespace std; 13 | 14 | class RingBufferTest: public testing::Test { 15 | public: 16 | 17 | RingBuffer *ring_buffer; 18 | 19 | RingBufferTest(){ 20 | ring_buffer = NULL; 21 | 22 | } 23 | virtual ~RingBufferTest(){ 24 | 25 | } 26 | 27 | virtual void SetUp(){ 28 | ring_buffer = new RingBuffer(4); 29 | } 30 | 31 | virtual void TearDown(){ 32 | delete ring_buffer; 33 | }; 34 | 35 | 36 | }; 37 | 38 | TEST_F(RingBufferTest, basic_func_test) { 39 | 40 | ring_buffer->WriteNext(2.2); 41 | ring_buffer->WriteNext(1.2); 42 | ring_buffer->WriteNext(2.2); 43 | ring_buffer->WriteNext(3.2); 44 | ring_buffer->WriteNext(4.2); 45 | ring_buffer->WriteNext(5.2); 46 | 47 | EXPECT_NEAR(14.8,ring_buffer->Sum(),1e-5); 48 | EXPECT_NEAR(3.7,ring_buffer->Mean(),1e-5); 49 | 50 | ring_buffer->Reset(); 51 | EXPECT_EQ(0.0,ring_buffer->Sum()); 52 | EXPECT_EQ(0,ring_buffer->DataStored()); 53 | 54 | ring_buffer->Initialize(0.0); 55 | EXPECT_EQ(0.0,ring_buffer->Sum()); 56 | EXPECT_EQ(4,ring_buffer->DataStored()); 57 | 58 | 59 | } 60 | 61 | TEST_F(RingBufferTest, buffer_copying_test) { 62 | float in_buf[3] = {1.1, 2.2, 3.3}; 63 | float out_buf[4]; 64 | 65 | // writing lots of data 66 | for (int i=0;i<9;i++) 67 | ring_buffer->WriteInto(in_buf,3); 68 | 69 | // some data from rear some from front of "linear buffer" 70 | ring_buffer->ReadFrom(out_buf,4); 71 | 72 | EXPECT_NEAR(3.3,out_buf[0],1e-5); 73 | EXPECT_NEAR(1.1,out_buf[1],1e-5); 74 | EXPECT_NEAR(2.2,out_buf[2],1e-5); 75 | EXPECT_NEAR(3.3,out_buf[3],1e-5); 76 | EXPECT_EQ(0,ring_buffer->DataStored()); 77 | 78 | 79 | // exit(0); 80 | } 81 | -------------------------------------------------------------------------------- /test/Scheduler_Test_unittest.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * data_feeder_test.cc 3 | * 4 | * Basic test of device 5 | * Won't work if stick not connected 6 | * Created on: Apr 21, 2015 7 | * Author: hipek 8 | */ 9 | 10 | #ifdef GOOGLE_UNIT_TEST 11 | 12 | #include "gtest/gtest.h" 13 | #include "scheduler.h" 14 | 15 | class SchedulerTest: public testing::Test { 16 | public: 17 | 18 | Scheduler sch; 19 | 20 | 21 | SchedulerTest(){ 22 | 23 | } 24 | 25 | ~SchedulerTest(){ 26 | 27 | } 28 | 29 | protected: 30 | 31 | }; 32 | 33 | TEST_F(SchedulerTest, data_processing_test) { 34 | 35 | // katowice - 209936000 36 | // krakow - 229072000 37 | /* 38 | size_t frequency = 229072000; 39 | pthread_mutex_t lock_buffer; 40 | pthread_t mythread = 0; 41 | modeParameters mode_parameters; 42 | syncDetect sync_detect = {DAB_MODE_UNKNOWN, 0}; 43 | syncRead sync_read; 44 | data_feeder_ctx_t data_write; 45 | demodReadWrite demod_read_write; 46 | decodReadWrite decod_read_write; 47 | syncFeedback sync_feedback; 48 | audioRead audio_read; 49 | std::list station_info_list; 50 | stationInfo station_info = {1,"FIC",0,0,0,0,0}; 51 | const char * source = "./data/ut/Record3_katowice_iq.raw"; 52 | //const char * source = "./data/ut/antena-1_dab_229072kHz_fs2048kHz_gain42_1.raw"; 53 | //const char * source = "0"; 54 | 55 | 56 | entireData data = {lock_buffer, mythread, mode_parameters, sync_detect, sync_read, data_write, 57 | demod_read_write, decod_read_write, sync_feedback, audio_read, station_info_list, 58 | station_info, source, frequency}; 59 | 60 | 61 | sch.Process(&data); 62 | */ 63 | 64 | } 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /test/Threading_ScopedLock_unittest.cc: -------------------------------------------------------------------------------- 1 | #ifdef GOOGLE_UNIT_TEST 2 | 3 | #include 4 | 5 | #include "gtest/gtest.h" 6 | #include "threading/scoped_lock.h" 7 | 8 | class ThreadingScopedLockTest : public ::testing::Test{ 9 | protected: 10 | ThreadingScopedLockTest(){ 11 | pthread_mutex_init(&lock_, NULL); 12 | } 13 | 14 | virtual ~ThreadingScopedLockTest(){ 15 | pthread_mutex_destroy(&lock_); 16 | } 17 | 18 | bool lock() { 19 | ScopedLock lock(lock_); 20 | return pthread_mutex_trylock(&lock_); 21 | } 22 | 23 | pthread_mutex_t lock_; 24 | }; 25 | 26 | 27 | TEST_F(ThreadingScopedLockTest, locking) { 28 | // make sure it was locked after initializing 29 | EXPECT_NE(lock(), 0); 30 | } 31 | 32 | TEST_F(ThreadingScopedLockTest, unlocking) { 33 | lock(); 34 | // make sure it was unlocked after leaving scope 35 | EXPECT_EQ(pthread_mutex_trylock(&lock_), 0); 36 | } 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /test/Threading_SignaledWorkerThread_unittest.cc: -------------------------------------------------------------------------------- 1 | #ifdef GOOGLE_UNIT_TEST 2 | 3 | #include 4 | 5 | #include "gtest/gtest.h" 6 | #include "threading/blocking_queue.h" 7 | #include "threading/signaled_worker_thread.h" 8 | 9 | void worker_process(void *x) { 10 | int *xi = reinterpret_cast(x); 11 | ++*xi; 12 | } 13 | 14 | TEST(ThreadingTest, SignaledWorkerThread) { 15 | BlockingQueue queue; 16 | SignaledWorkerThread worker; 17 | int x = 0; 18 | 19 | worker.init(&worker_process, &x, 0, &queue); 20 | 21 | // first pass 22 | worker.resume_thread(); 23 | usleep(1000*1); // sleep 1ms 24 | ASSERT_EQ(queue.size(), 1); 25 | queue.pull(); 26 | EXPECT_EQ(x, 1); 27 | 28 | // second pass 29 | worker.resume_thread(); 30 | usleep(1000*1); // sleep 1ms 31 | ASSERT_EQ(queue.size(), 1); 32 | queue.pull(); 33 | EXPECT_EQ(x, 2); 34 | } 35 | 36 | TEST(ThreadingTest, UninitializedIsSuspendedTest) { 37 | SignaledWorkerThread worker; 38 | ASSERT_TRUE(worker.is_suspended()) << "Not initialized thread should say it's suspended!"; 39 | } 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /test/gtest/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Testing Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Ajay Joshi 7 | Balázs Dán 8 | Bharat Mediratta 9 | Chandler Carruth 10 | Chris Prince 11 | Chris Taylor 12 | Dan Egnor 13 | Eric Roman 14 | Hady Zalek 15 | Jeffrey Yasskin 16 | Jói Sigurðsson 17 | Keir Mierle 18 | Keith Ray 19 | Kenton Varda 20 | Manuel Klimek 21 | Markus Heule 22 | Mika Raento 23 | Miklós Fazekas 24 | Pasi Valminen 25 | Patrick Hanna 26 | Patrick Riley 27 | Peter Kaminski 28 | Preston Jackson 29 | Rainer Klaffenboeck 30 | Russ Cox 31 | Russ Rufer 32 | Sean Mcafee 33 | Sigurður Ásgeirsson 34 | Tracy Bialik 35 | Vadim Berman 36 | Vlad Losev 37 | Zhanyong Wan 38 | -------------------------------------------------------------------------------- /test/gtest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /test/gtest/build-aux/config.h.in: -------------------------------------------------------------------------------- 1 | /* build-aux/config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file. */ 4 | #undef HAVE_DLFCN_H 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_INTTYPES_H 8 | 9 | /* Define to 1 if you have the header file. */ 10 | #undef HAVE_MEMORY_H 11 | 12 | /* Define if you have POSIX threads libraries and header files. */ 13 | #undef HAVE_PTHREAD 14 | 15 | /* Define to 1 if you have the header file. */ 16 | #undef HAVE_STDINT_H 17 | 18 | /* Define to 1 if you have the header file. */ 19 | #undef HAVE_STDLIB_H 20 | 21 | /* Define to 1 if you have the header file. */ 22 | #undef HAVE_STRINGS_H 23 | 24 | /* Define to 1 if you have the header file. */ 25 | #undef HAVE_STRING_H 26 | 27 | /* Define to 1 if you have the header file. */ 28 | #undef HAVE_SYS_STAT_H 29 | 30 | /* Define to 1 if you have the header file. */ 31 | #undef HAVE_SYS_TYPES_H 32 | 33 | /* Define to 1 if you have the header file. */ 34 | #undef HAVE_UNISTD_H 35 | 36 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 37 | */ 38 | #undef LT_OBJDIR 39 | 40 | /* Name of package */ 41 | #undef PACKAGE 42 | 43 | /* Define to the address where bug reports for this package should be sent. */ 44 | #undef PACKAGE_BUGREPORT 45 | 46 | /* Define to the full name of this package. */ 47 | #undef PACKAGE_NAME 48 | 49 | /* Define to the full name and version of this package. */ 50 | #undef PACKAGE_STRING 51 | 52 | /* Define to the one symbol short name of this package. */ 53 | #undef PACKAGE_TARNAME 54 | 55 | /* Define to the home page for this package. */ 56 | #undef PACKAGE_URL 57 | 58 | /* Define to the version of this package. */ 59 | #undef PACKAGE_VERSION 60 | 61 | /* Define to necessary symbol if this constant uses a non-standard name on 62 | your system. */ 63 | #undef PTHREAD_CREATE_JOINABLE 64 | 65 | /* Define to 1 if you have the ANSI C header files. */ 66 | #undef STDC_HEADERS 67 | 68 | /* Version number of package */ 69 | #undef VERSION 70 | -------------------------------------------------------------------------------- /test/gtest/codegear/gtest_all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // C++Builder's IDE cannot build a static library from files with hyphens 35 | // in their name. See http://qc.codegear.com/wc/qcmain.aspx?d=70977 . 36 | // This file serves as a workaround. 37 | 38 | #include "src/gtest-all.cc" 39 | -------------------------------------------------------------------------------- /test/gtest/codegear/gtest_link.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: Josh Kelley (joshkel@gmail.com) 31 | // 32 | // Google C++ Testing Framework (Google Test) 33 | // 34 | // Links gtest.lib and gtest_main.lib into the current project in C++Builder. 35 | // This means that these libraries can't be renamed, but it's the only way to 36 | // ensure that Debug versus Release test builds are linked against the 37 | // appropriate Debug or Release build of the libraries. 38 | 39 | #pragma link "gtest.lib" 40 | #pragma link "gtest_main.lib" 41 | -------------------------------------------------------------------------------- /test/gtest/fused-src/gtest/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | printf("Running main() from gtest_main.cc\n"); 36 | testing::InitGoogleTest(&argc, argv); 37 | return RUN_ALL_TESTS(); 38 | } 39 | -------------------------------------------------------------------------------- /test/gtest/m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3337 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4.2]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3337]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4.2' 20 | macro_revision='1.3337' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /test/gtest/samples/sample1.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #ifndef GTEST_SAMPLES_SAMPLE1_H_ 35 | #define GTEST_SAMPLES_SAMPLE1_H_ 36 | 37 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1. 38 | int Factorial(int n); 39 | 40 | // Returns true iff n is a prime number. 41 | bool IsPrime(int n); 42 | 43 | #endif // GTEST_SAMPLES_SAMPLE1_H_ 44 | -------------------------------------------------------------------------------- /test/gtest/samples/sample4.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | // 32 | // Author: wan@google.com (Zhanyong Wan) 33 | 34 | #include 35 | 36 | #include "sample4.h" 37 | 38 | // Returns the current counter value, and increments it. 39 | int Counter::Increment() { 40 | return counter_++; 41 | } 42 | 43 | // Prints the current counter value to STDOUT. 44 | void Counter::Print() const { 45 | printf("%d", counter_); 46 | } 47 | -------------------------------------------------------------------------------- /test/gtest/samples/sample4_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | #include "sample4.h" 34 | 35 | // Tests the Increment() method. 36 | TEST(Counter, Increment) { 37 | Counter c; 38 | 39 | // EXPECT_EQ() evaluates its arguments exactly once, so they 40 | // can have side effects. 41 | 42 | EXPECT_EQ(0, c.Increment()); 43 | EXPECT_EQ(1, c.Increment()); 44 | EXPECT_EQ(2, c.Increment()); 45 | } 46 | -------------------------------------------------------------------------------- /test/gtest/scripts/test/Makefile: -------------------------------------------------------------------------------- 1 | # A Makefile for fusing Google Test and building a sample test against it. 2 | # 3 | # SYNOPSIS: 4 | # 5 | # make [all] - makes everything. 6 | # make TARGET - makes the given target. 7 | # make check - makes everything and runs the built sample test. 8 | # make clean - removes all files generated by make. 9 | 10 | # Points to the root of fused Google Test, relative to where this file is. 11 | FUSED_GTEST_DIR = output 12 | 13 | # Paths to the fused gtest files. 14 | FUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h 15 | FUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 16 | 17 | # Where to find the sample test. 18 | SAMPLE_DIR = ../../samples 19 | 20 | # Where to find gtest_main.cc. 21 | GTEST_MAIN_CC = ../../src/gtest_main.cc 22 | 23 | # Flags passed to the preprocessor. 24 | # We have no idea here whether pthreads is available in the system, so 25 | # disable its use. 26 | CPPFLAGS += -I$(FUSED_GTEST_DIR) -DGTEST_HAS_PTHREAD=0 27 | 28 | # Flags passed to the C++ compiler. 29 | CXXFLAGS += -g 30 | 31 | all : sample1_unittest 32 | 33 | check : all 34 | ./sample1_unittest 35 | 36 | clean : 37 | rm -rf $(FUSED_GTEST_DIR) sample1_unittest *.o 38 | 39 | $(FUSED_GTEST_H) : 40 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 41 | 42 | $(FUSED_GTEST_ALL_CC) : 43 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 44 | 45 | gtest-all.o : $(FUSED_GTEST_H) $(FUSED_GTEST_ALL_CC) 46 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 47 | 48 | gtest_main.o : $(FUSED_GTEST_H) $(GTEST_MAIN_CC) 49 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_MAIN_CC) 50 | 51 | sample1.o : $(SAMPLE_DIR)/sample1.cc $(SAMPLE_DIR)/sample1.h 52 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1.cc 53 | 54 | sample1_unittest.o : $(SAMPLE_DIR)/sample1_unittest.cc \ 55 | $(SAMPLE_DIR)/sample1.h $(FUSED_GTEST_H) 56 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1_unittest.cc 57 | 58 | sample1_unittest : sample1.o sample1_unittest.o gtest-all.o gtest_main.o 59 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ 60 | -------------------------------------------------------------------------------- /test/gtest/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | printf("Running main() from gtest_main.cc\n"); 36 | testing::InitGoogleTest(&argc, argv); 37 | return RUN_ALL_TESTS(); 38 | } 39 | -------------------------------------------------------------------------------- /test/gtest/test/gtest_main_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | 34 | // Tests that we don't have to define main() when we link to 35 | // gtest_main instead of gtest. 36 | 37 | namespace { 38 | 39 | TEST(GTestMainTest, ShouldSucceed) { 40 | } 41 | 42 | } // namespace 43 | 44 | // We are using the main() function defined in src/gtest_main.cc, so 45 | // we don't define it here. 46 | -------------------------------------------------------------------------------- /test/gtest/test/gtest_uninitialized_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | 32 | #include "gtest/gtest.h" 33 | 34 | TEST(DummyTest, Dummy) { 35 | // This test doesn't verify anything. We just need it to create a 36 | // realistic stage for testing the behavior of Google Test when 37 | // RUN_ALL_TESTS() is called without testing::InitGoogleTest() being 38 | // called first. 39 | } 40 | 41 | int main() { 42 | return RUN_ALL_TESTS(); 43 | } 44 | -------------------------------------------------------------------------------- /test/gtest/test/production.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // This is part of the unit test for include/gtest/gtest_prod.h. 33 | 34 | #include "production.h" 35 | 36 | PrivateCode::PrivateCode() : x_(0) {} 37 | -------------------------------------------------------------------------------- /test/gtest/xcode/Config/DebugProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugProject.xcconfig 3 | // 4 | // These are Debug Configuration project settings for the gtest framework and 5 | // examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // No optimization 14 | GCC_OPTIMIZATION_LEVEL = 0 15 | 16 | // Deployment postprocessing is what triggers Xcode to strip, turn it off 17 | DEPLOYMENT_POSTPROCESSING = NO 18 | 19 | // Dead code stripping off 20 | DEAD_CODE_STRIPPING = NO 21 | 22 | // Debug symbols should be on obviously 23 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 24 | 25 | // Define the DEBUG macro in all debug builds 26 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1 27 | 28 | // These are turned off to avoid STL incompatibilities with client code 29 | // // Turns on special C++ STL checks to "encourage" good STL use 30 | // GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS 31 | -------------------------------------------------------------------------------- /test/gtest/xcode/Config/FrameworkTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // FrameworkTarget.xcconfig 3 | // 4 | // These are Framework target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Dynamic libs need to be position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Dynamic libs should not have their external symbols stripped. 14 | STRIP_STYLE = non-global 15 | 16 | // Let the user install by specifying the $DSTROOT with xcodebuild 17 | SKIP_INSTALL = NO 18 | -------------------------------------------------------------------------------- /test/gtest/xcode/Config/General.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // General.xcconfig 3 | // 4 | // These are General configuration settings for the gtest framework and 5 | // examples. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Build for PPC and Intel, 32- and 64-bit 11 | ARCHS = i386 x86_64 ppc ppc64 12 | 13 | // Zerolink prevents link warnings so turn it off 14 | ZERO_LINK = NO 15 | 16 | // Prebinding considered unhelpful in 10.3 and later 17 | PREBINDING = NO 18 | 19 | // Strictest warning policy 20 | WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow 21 | 22 | // Work around Xcode bugs by using external strip. See: 23 | // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html 24 | SEPARATE_STRIP = YES 25 | 26 | // Force C99 dialect 27 | GCC_C_LANGUAGE_STANDARD = c99 28 | 29 | // not sure why apple defaults this on, but it's pretty risky 30 | ALWAYS_SEARCH_USER_PATHS = NO 31 | 32 | // Turn on position dependent code for most cases (overridden where appropriate) 33 | GCC_DYNAMIC_NO_PIC = YES 34 | 35 | // Default SDK and minimum OS version is 10.4 36 | SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk 37 | MACOSX_DEPLOYMENT_TARGET = 10.4 38 | GCC_VERSION = 4.0 39 | 40 | // VERSIONING BUILD SETTINGS (used in Info.plist) 41 | GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc. 42 | -------------------------------------------------------------------------------- /test/gtest/xcode/Config/ReleaseProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseProject.xcconfig 3 | // 4 | // These are Release Configuration project settings for the gtest framework 5 | // and examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // subconfig/Release.xcconfig 14 | 15 | // Optimize for space and size (Apple recommendation) 16 | GCC_OPTIMIZATION_LEVEL = s 17 | 18 | // Deploment postprocessing is what triggers Xcode to strip 19 | DEPLOYMENT_POSTPROCESSING = YES 20 | 21 | // No symbols 22 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 23 | 24 | // Dead code strip does not affect ObjC code but can help for C 25 | DEAD_CODE_STRIPPING = YES 26 | 27 | // NDEBUG is used by things like assert.h, so define it for general compat. 28 | // ASSERT going away in release tends to create unused vars. 29 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable 30 | 31 | // When we strip we want to strip all symbols in release, but save externals. 32 | STRIP_STYLE = all 33 | -------------------------------------------------------------------------------- /test/gtest/xcode/Config/StaticLibraryTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // StaticLibraryTarget.xcconfig 3 | // 4 | // These are static library target settings for libgtest.a. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Static libs can be included in bundles so make them position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Static libs should not have their internal globals or external symbols 14 | // stripped. 15 | STRIP_STYLE = debugging 16 | 17 | // Let the user install by specifying the $DSTROOT with xcodebuild 18 | SKIP_INSTALL = NO 19 | -------------------------------------------------------------------------------- /test/gtest/xcode/Config/TestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // TestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME) 8 | HEADER_SEARCH_PATHS = ../include 9 | -------------------------------------------------------------------------------- /test/gtest/xcode/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.${PRODUCT_NAME} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | GTEST_VERSIONINFO_LONG 21 | CFBundleShortVersionString 22 | GTEST_VERSIONINFO_SHORT 23 | CFBundleGetInfoString 24 | ${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT} 25 | NSHumanReadableCopyright 26 | ${GTEST_VERSIONINFO_ABOUT} 27 | CSResourcesFileMapped 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /test/gtest/xcode/Samples/FrameworkSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.gtest.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /test/gtest_main.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * gtest_main.cc 3 | * 4 | * Created on: 23 lut 2015 5 | * Author: kwant 6 | */ 7 | 8 | 9 | #include 10 | #include "gtest/gtest.h" 11 | 12 | GTEST_API_ int main(int argc, char **argv) { 13 | ::testing::InitGoogleTest(&argc, argv); 14 | return RUN_ALL_TESTS(); 15 | } 16 | 17 | --------------------------------------------------------------------------------