summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py4
-rwxr-xr-xgr-analog/examples/tags/uhd_burst_detector.py2
-rw-r--r--gr-audio/examples/grc/cvsd_sweep.grc2
-rw-r--r--gr-audio/examples/grc/dial_tone.grc12
-rw-r--r--gr-digital/examples/demod/ber_simulation.grc14
-rw-r--r--gr-digital/examples/demod/pam_sync.grc278
-rw-r--r--gr-digital/examples/demod/pam_timing.grc348
-rw-r--r--gr-digital/python/gfsk.py2
-rw-r--r--gr-fcd/examples/grc/fcd_nfm_rx.grc10
-rw-r--r--gr-fft/grc/fft_fft_vxx.xml2
-rw-r--r--gr-fft/python/CMakeLists.txt1
-rw-r--r--gr-fft/python/__init__.py2
-rw-r--r--gr-fft/python/logpwrfft.py3
-rw-r--r--gr-fft/python/window.py (renamed from gr-filter/python/window.py)0
-rw-r--r--gr-filter/examples/resampler_demo.grc2
-rw-r--r--gr-filter/python/CMakeLists.txt1
-rw-r--r--gr-filter/python/__init__.py3
-rw-r--r--gr-noaa/examples/file_rx_hrpt.grc8
-rw-r--r--gr-noaa/examples/hrpt_demod.grc2
-rw-r--r--gr-pager/apps/usrp_rx_flex.grc20
-rwxr-xr-xgr-pager/apps/usrp_rx_flex.py4
-rw-r--r--gr-trellis/CMakeLists.txt18
-rw-r--r--gr-trellis/examples/grc/CMakeLists.txt (renamed from gr-trellis/src/examples/grc/CMakeLists.txt)0
-rw-r--r--gr-trellis/examples/grc/interference_cancellation.grc (renamed from gr-trellis/src/examples/grc/interference_cancellation.grc)200
-rw-r--r--gr-trellis/examples/grc/pccc.grc (renamed from gr-trellis/src/examples/grc/pccc.grc)44
-rw-r--r--gr-trellis/examples/grc/pccc1.grc (renamed from gr-trellis/src/examples/grc/pccc1.grc)42
-rw-r--r--gr-trellis/examples/grc/readme.txt (renamed from gr-trellis/src/examples/grc/readme.txt)0
-rw-r--r--gr-trellis/examples/grc/sccc.grc (renamed from gr-trellis/src/examples/grc/sccc.grc)42
-rw-r--r--gr-trellis/examples/grc/sccc1.grc (renamed from gr-trellis/src/examples/grc/sccc1.grc)42
-rw-r--r--gr-trellis/examples/python/CMakeLists.txt (renamed from gr-trellis/src/examples/python/CMakeLists.txt)0
-rw-r--r--gr-trellis/examples/python/README (renamed from gr-trellis/src/examples/python/README)0
-rw-r--r--gr-trellis/examples/python/fsm_files/awgn1o2_128.fsm (renamed from gr-trellis/src/examples/python/fsm_files/awgn1o2_128.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/awgn1o2_16.fsm (renamed from gr-trellis/src/examples/python/fsm_files/awgn1o2_16.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/awgn1o2_4.fsm (renamed from gr-trellis/src/examples/python/fsm_files/awgn1o2_4.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/awgn1o2_8.fsm (renamed from gr-trellis/src/examples/python/fsm_files/awgn1o2_8.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/awgn2o3_16.fsm (renamed from gr-trellis/src/examples/python/fsm_files/awgn2o3_16.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/awgn2o3_4.fsm (renamed from gr-trellis/src/examples/python/fsm_files/awgn2o3_4.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/awgn2o3_4_msb.fsm (renamed from gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msb.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/awgn2o3_4_msbG.fsm (renamed from gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msbG.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/awgn2o3_8.fsm (renamed from gr-trellis/src/examples/python/fsm_files/awgn2o3_8.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/awgn2o4_4.fsm (renamed from gr-trellis/src/examples/python/fsm_files/awgn2o4_4.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/disconnected.fsm (renamed from gr-trellis/src/examples/python/fsm_files/disconnected.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/irregular.fsm (renamed from gr-trellis/src/examples/python/fsm_files/irregular.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/joint_16_16.fsm (renamed from gr-trellis/src/examples/python/fsm_files/joint_16_16.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/joint_4_16.fsm (renamed from gr-trellis/src/examples/python/fsm_files/joint_4_16.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/rep3.fsm (renamed from gr-trellis/src/examples/python/fsm_files/rep3.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/rep5.fsm (renamed from gr-trellis/src/examples/python/fsm_files/rep5.fsm)0
-rw-r--r--gr-trellis/examples/python/fsm_files/simple.fsm (renamed from gr-trellis/src/examples/python/fsm_files/simple.fsm)0
-rwxr-xr-xgr-trellis/examples/python/fsm_utils.py (renamed from gr-trellis/src/examples/python/fsm_utils.py)0
-rwxr-xr-xgr-trellis/examples/python/test_cpm.py (renamed from gr-trellis/src/examples/python/test_cpm.py)40
-rwxr-xr-xgr-trellis/examples/python/test_pccc_turbo1.py (renamed from gr-trellis/src/examples/python/test_pccc_turbo1.py)0
-rwxr-xr-xgr-trellis/examples/python/test_sccc_hard.py (renamed from gr-trellis/src/examples/python/test_sccc_hard.py)0
-rwxr-xr-xgr-trellis/examples/python/test_sccc_soft.py (renamed from gr-trellis/src/examples/python/test_sccc_soft.py)0
-rwxr-xr-xgr-trellis/examples/python/test_sccc_turbo.py (renamed from gr-trellis/src/examples/python/test_sccc_turbo.py)0
-rwxr-xr-xgr-trellis/examples/python/test_sccc_turbo1.py (renamed from gr-trellis/src/examples/python/test_sccc_turbo1.py)0
-rwxr-xr-xgr-trellis/examples/python/test_sccc_turbo2.py (renamed from gr-trellis/src/examples/python/test_sccc_turbo2.py)0
-rwxr-xr-xgr-trellis/examples/python/test_tcm.py (renamed from gr-trellis/src/examples/python/test_tcm.py)0
-rwxr-xr-xgr-trellis/examples/python/test_tcm_bit.py (renamed from gr-trellis/src/examples/python/test_tcm_bit.py)0
-rwxr-xr-xgr-trellis/examples/python/test_tcm_combined.py (renamed from gr-trellis/src/examples/python/test_tcm_combined.py)0
-rwxr-xr-xgr-trellis/examples/python/test_tcm_parallel.py (renamed from gr-trellis/src/examples/python/test_tcm_parallel.py)0
-rwxr-xr-xgr-trellis/examples/python/test_turbo_equalization.py (renamed from gr-trellis/src/examples/python/test_turbo_equalization.py)0
-rwxr-xr-xgr-trellis/examples/python/test_turbo_equalization1.py (renamed from gr-trellis/src/examples/python/test_turbo_equalization1.py)0
-rwxr-xr-xgr-trellis/examples/python/test_turbo_equalization2.py (renamed from gr-trellis/src/examples/python/test_turbo_equalization2.py)0
-rwxr-xr-xgr-trellis/examples/python/test_viterbi_equalization.py (renamed from gr-trellis/src/examples/python/test_viterbi_equalization.py)0
-rwxr-xr-xgr-trellis/examples/python/test_viterbi_equalization1.py (renamed from gr-trellis/src/examples/python/test_viterbi_equalization1.py)0
-rw-r--r--gr-trellis/include/trellis/CMakeLists.txt103
-rw-r--r--gr-trellis/include/trellis/api.h (renamed from gr-trellis/src/lib/trellis_api.h)0
-rw-r--r--gr-trellis/include/trellis/base.h (renamed from gr-trellis/src/lib/base.h)23
-rw-r--r--gr-trellis/include/trellis/calc_metric.h54
-rw-r--r--gr-trellis/include/trellis/constellation_metrics_cf.h51
-rw-r--r--gr-trellis/include/trellis/core_algorithms.h124
-rw-r--r--gr-trellis/include/trellis/encoder_XX.h.t (renamed from gr-trellis/src/lib/trellis_encoder_XX.h.t)52
-rw-r--r--gr-trellis/include/trellis/fsm.h191
-rw-r--r--gr-trellis/include/trellis/interleaver.h (renamed from gr-trellis/src/lib/interleaver.h)52
-rw-r--r--gr-trellis/include/trellis/metrics_X.h.t58
-rw-r--r--gr-trellis/include/trellis/pccc_decoder_X.h.t69
-rw-r--r--gr-trellis/include/trellis/pccc_decoder_combined_XX.h.t79
-rw-r--r--gr-trellis/include/trellis/pccc_encoder_XX.h.t63
-rw-r--r--gr-trellis/include/trellis/permutation.h55
-rw-r--r--gr-trellis/include/trellis/quicksort_index.h (renamed from gr-trellis/src/lib/quicksort_index.h)19
-rw-r--r--gr-trellis/include/trellis/sccc_decoder_X.h.t69
-rw-r--r--gr-trellis/include/trellis/sccc_decoder_combined_XX.h.t79
-rw-r--r--gr-trellis/include/trellis/sccc_encoder_XX.h.t63
-rw-r--r--gr-trellis/include/trellis/siso_combined_f.h68
-rw-r--r--gr-trellis/include/trellis/siso_f.h61
-rw-r--r--gr-trellis/include/trellis/siso_type.h (renamed from gr-trellis/src/lib/siso_type.h)16
-rw-r--r--gr-trellis/include/trellis/viterbi_X.h.t (renamed from gr-trellis/src/lib/trellis_metrics_X.i.t)47
-rw-r--r--gr-trellis/include/trellis/viterbi_combined_XX.h.t64
-rw-r--r--gr-trellis/lib/CMakeLists.txt139
-rw-r--r--gr-trellis/lib/base.cc86
-rw-r--r--gr-trellis/lib/calc_metric.cc251
-rw-r--r--gr-trellis/lib/constellation_metrics_cf_impl.cc96
-rw-r--r--gr-trellis/lib/constellation_metrics_cf_impl.h57
-rw-r--r--gr-trellis/lib/core_algorithms.cc1324
-rw-r--r--gr-trellis/lib/encoder_XX_impl.cc.t82
-rw-r--r--gr-trellis/lib/encoder_XX_impl.h.t (renamed from gr-trellis/src/lib/trellis_viterbi_X.i.t)57
-rw-r--r--gr-trellis/lib/fsm.cc521
-rw-r--r--gr-trellis/lib/interleaver.cc147
-rw-r--r--gr-trellis/lib/metrics_X_impl.cc.t98
-rw-r--r--gr-trellis/lib/metrics_X_impl.h.t64
-rw-r--r--gr-trellis/lib/pccc_decoder_X_impl.cc.t120
-rw-r--r--gr-trellis/lib/pccc_decoder_X_impl.h.t80
-rw-r--r--gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t139
-rw-r--r--gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t93
-rw-r--r--gr-trellis/lib/pccc_encoder_XX_impl.cc.t91
-rw-r--r--gr-trellis/lib/pccc_encoder_XX_impl.h.t66
-rw-r--r--gr-trellis/lib/permutation_impl.cc90
-rw-r--r--gr-trellis/lib/permutation_impl.h58
-rw-r--r--gr-trellis/lib/quicksort_index.cc70
-rw-r--r--gr-trellis/lib/sccc_decoder_X_impl.cc.t118
-rw-r--r--gr-trellis/lib/sccc_decoder_X_impl.h.t80
-rw-r--r--gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t139
-rw-r--r--gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t93
-rw-r--r--gr-trellis/lib/sccc_encoder_XX_impl.cc.t93
-rw-r--r--gr-trellis/lib/sccc_encoder_XX_impl.h.t66
-rw-r--r--gr-trellis/lib/siso_combined_f_impl.cc180
-rw-r--r--gr-trellis/lib/siso_combined_f_impl.h79
-rw-r--r--gr-trellis/lib/siso_f_impl.cc171
-rw-r--r--gr-trellis/lib/siso_f_impl.h75
-rw-r--r--gr-trellis/lib/viterbi_X_impl.cc.t99
-rw-r--r--gr-trellis/lib/viterbi_X_impl.h.t65
-rw-r--r--gr-trellis/lib/viterbi_combined_XX_impl.cc.t112
-rw-r--r--gr-trellis/lib/viterbi_combined_XX_impl.h.t74
-rw-r--r--gr-trellis/python/CMakeLists.txt57
-rw-r--r--gr-trellis/python/__init__.py (renamed from gr-trellis/src/lib/generate_all.py)27
-rw-r--r--gr-trellis/python/awgn1o2_4.fsm (renamed from gr-trellis/src/python/awgn1o2_4.fsm)0
-rwxr-xr-xgr-trellis/python/qa_trellis.py (renamed from gr-trellis/src/python/qa_trellis.py)11
-rw-r--r--gr-trellis/src/lib/CMakeLists.txt224
-rw-r--r--gr-trellis/src/lib/Makefile.gen174
-rw-r--r--gr-trellis/src/lib/base.cc92
-rw-r--r--gr-trellis/src/lib/calc_metric.cc258
-rw-r--r--gr-trellis/src/lib/calc_metric.h48
-rw-r--r--gr-trellis/src/lib/core_algorithms.cc1437
-rw-r--r--gr-trellis/src/lib/core_algorithms.h140
-rw-r--r--gr-trellis/src/lib/fsm.cc548
-rw-r--r--gr-trellis/src/lib/fsm.h166
-rw-r--r--gr-trellis/src/lib/fsm.i59
-rw-r--r--gr-trellis/src/lib/generate_trellis.py129
-rw-r--r--gr-trellis/src/lib/interleaver.cc144
-rw-r--r--gr-trellis/src/lib/interleaver.i38
-rw-r--r--gr-trellis/src/lib/quicksort_index.cc68
-rw-r--r--gr-trellis/src/lib/trellis.i58
-rw-r--r--gr-trellis/src/lib/trellis_constellation_metrics_cf.cc90
-rw-r--r--gr-trellis/src/lib/trellis_constellation_metrics_cf.h69
-rw-r--r--gr-trellis/src/lib/trellis_constellation_metrics_cf.i31
-rw-r--r--gr-trellis/src/lib/trellis_encoder_XX.cc.t76
-rw-r--r--gr-trellis/src/lib/trellis_metrics_X.cc.t98
-rw-r--r--gr-trellis/src/lib/trellis_metrics_X.h.t70
-rw-r--r--gr-trellis/src/lib/trellis_pccc_decoder_X.cc.t124
-rw-r--r--gr-trellis/src/lib/trellis_pccc_decoder_X.h.t103
-rw-r--r--gr-trellis/src/lib/trellis_pccc_decoder_X.i.t60
-rw-r--r--gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t147
-rw-r--r--gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t125
-rw-r--r--gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t73
-rw-r--r--gr-trellis/src/lib/trellis_pccc_encoder_XX.cc.t90
-rw-r--r--gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t84
-rw-r--r--gr-trellis/src/lib/trellis_pccc_encoder_XX.i.t50
-rw-r--r--gr-trellis/src/lib/trellis_permutation.cc82
-rw-r--r--gr-trellis/src/lib/trellis_permutation.h61
-rw-r--r--gr-trellis/src/lib/trellis_permutation.i41
-rw-r--r--gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t124
-rw-r--r--gr-trellis/src/lib/trellis_sccc_decoder_X.h.t103
-rw-r--r--gr-trellis/src/lib/trellis_sccc_decoder_X.i.t60
-rw-r--r--gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.cc.t147
-rw-r--r--gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t125
-rw-r--r--gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.i.t73
-rw-r--r--gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t91
-rw-r--r--gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t84
-rw-r--r--gr-trellis/src/lib/trellis_sccc_encoder_XX.i.t50
-rw-r--r--gr-trellis/src/lib/trellis_siso_combined_f.cc357
-rw-r--r--gr-trellis/src/lib/trellis_siso_combined_f.h112
-rw-r--r--gr-trellis/src/lib/trellis_siso_combined_f.i64
-rw-r--r--gr-trellis/src/lib/trellis_siso_f.cc338
-rw-r--r--gr-trellis/src/lib/trellis_siso_f.h97
-rw-r--r--gr-trellis/src/lib/trellis_siso_f.i55
-rw-r--r--gr-trellis/src/lib/trellis_viterbi_X.cc.t183
-rw-r--r--gr-trellis/src/lib/trellis_viterbi_X.h.t91
-rw-r--r--gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t191
-rw-r--r--gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t99
-rw-r--r--gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t59
-rw-r--r--gr-trellis/swig/CMakeLists.txt57
-rw-r--r--gr-trellis/swig/trellis_swig.i216
-rw-r--r--gr-uhd/examples/grc/uhd_dpsk_mod.grc8
-rw-r--r--gr-uhd/examples/grc/uhd_two_tone_loopback.grc12
-rw-r--r--gr-uhd/examples/grc/uhd_tx_dpsk.grc10
-rw-r--r--gr-uhd/examples/grc/uhd_wbfm_receive.grc8
-rw-r--r--gr-utils/CMakeLists.txt4
-rw-r--r--gr-utils/python/CMakeLists.txt (renamed from gr-utils/src/python/CMakeLists.txt)0
-rw-r--r--gr-utils/python/README.plot (renamed from gr-utils/src/python/README.plot)0
-rwxr-xr-xgr-utils/python/create-gnuradio-out-of-tree-project (renamed from gr-utils/src/python/create-gnuradio-out-of-tree-project)0
-rwxr-xr-xgr-utils/python/gr_plot_char (renamed from gr-utils/src/python/gr_plot_char)0
-rwxr-xr-xgr-utils/python/gr_plot_const (renamed from gr-utils/src/python/gr_plot_const)0
-rw-r--r--gr-utils/python/gr_plot_fft (renamed from gr-utils/src/python/gr_plot_fft)0
-rwxr-xr-xgr-utils/python/gr_plot_fft_c (renamed from gr-utils/src/python/gr_plot_fft_c)0
-rwxr-xr-xgr-utils/python/gr_plot_fft_f (renamed from gr-utils/src/python/gr_plot_fft_f)0
-rwxr-xr-xgr-utils/python/gr_plot_float (renamed from gr-utils/src/python/gr_plot_float)0
-rwxr-xr-xgr-utils/python/gr_plot_int (renamed from gr-utils/src/python/gr_plot_int)0
-rwxr-xr-xgr-utils/python/gr_plot_iq (renamed from gr-utils/src/python/gr_plot_iq)0
-rw-r--r--gr-utils/python/gr_plot_psd (renamed from gr-utils/src/python/gr_plot_psd)0
-rwxr-xr-xgr-utils/python/gr_plot_psd_c (renamed from gr-utils/src/python/gr_plot_psd_c)0
-rwxr-xr-xgr-utils/python/gr_plot_psd_f (renamed from gr-utils/src/python/gr_plot_psd_f)0
-rwxr-xr-xgr-utils/python/gr_plot_qt (renamed from gr-utils/src/python/gr_plot_qt)0
-rwxr-xr-xgr-utils/python/gr_plot_short (renamed from gr-utils/src/python/gr_plot_short)0
-rw-r--r--gr-utils/python/gr_read_file_metadata (renamed from gr-utils/src/python/gr_read_file_metadata)0
-rwxr-xr-xgr-utils/python/grcc (renamed from gr-utils/src/python/grcc)0
-rw-r--r--gr-utils/python/plot_data.py (renamed from gr-utils/src/python/plot_data.py)0
-rwxr-xr-xgr-utils/python/plot_fft_base.py (renamed from gr-utils/src/python/plot_fft_base.py)0
-rwxr-xr-xgr-utils/python/plot_psd_base.py (renamed from gr-utils/src/python/plot_psd_base.py)0
-rw-r--r--gr-utils/python/pyqt_filter.py (renamed from gr-utils/src/python/pyqt_filter.py)0
-rw-r--r--gr-utils/python/pyqt_filter.ui (renamed from gr-utils/src/python/pyqt_filter.ui)0
-rw-r--r--gr-utils/python/pyqt_plot.py (renamed from gr-utils/src/python/pyqt_plot.py)0
-rw-r--r--gr-utils/python/pyqt_plot.ui (renamed from gr-utils/src/python/pyqt_plot.ui)0
-rw-r--r--gr-video-sdl/CMakeLists.txt10
-rw-r--r--gr-video-sdl/include/video_sdl/CMakeLists.txt (renamed from gr-trellis/src/CMakeLists.txt)18
-rw-r--r--gr-video-sdl/include/video_sdl/api.h (renamed from gr-video-sdl/src/video_sdl_api.h)0
-rw-r--r--gr-video-sdl/include/video_sdl/sink_s.h56
-rw-r--r--gr-video-sdl/include/video_sdl/sink_uc.h56
-rw-r--r--gr-video-sdl/lib/CMakeLists.txt56
-rw-r--r--gr-video-sdl/lib/sink_s_impl.cc322
-rw-r--r--gr-video-sdl/lib/sink_s_impl.h80
-rw-r--r--gr-video-sdl/lib/sink_uc_impl.cc318
-rw-r--r--gr-video-sdl/lib/sink_uc_impl.h80
-rw-r--r--gr-video-sdl/python/CMakeLists.txt (renamed from gr-trellis/src/python/CMakeLists.txt)24
-rw-r--r--gr-video-sdl/python/__init__.py27
-rwxr-xr-xgr-video-sdl/python/qa_video_sdl.py (renamed from gr-video-sdl/src/qa_video_sdl.py)2
-rw-r--r--gr-video-sdl/src/CMakeLists.txt112
-rw-r--r--gr-video-sdl/src/video_sdl.i65
-rw-r--r--gr-video-sdl/src/video_sdl_sink_s.cc301
-rw-r--r--gr-video-sdl/src/video_sdl_sink_s.h91
-rw-r--r--gr-video-sdl/src/video_sdl_sink_uc.cc291
-rw-r--r--gr-video-sdl/src/video_sdl_sink_uc.h91
-rw-r--r--gr-video-sdl/swig/CMakeLists.txt58
-rw-r--r--gr-video-sdl/swig/video_sdl_swig.i (renamed from gr-trellis/src/lib/trellis_encoder_XX.i.t)27
-rw-r--r--gr-wxgui/grc/wxgui_fftsink2.xml2
-rw-r--r--gr-wxgui/grc/wxgui_waterfallsink2.xml2
-rw-r--r--gr-wxgui/src/python/fftsink_gl.py5
236 files changed, 8460 insertions, 9385 deletions
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py b/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py
index 39b5d781e2..f80188c9fc 100755
--- a/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py
+++ b/gnuradio-core/src/python/gnuradio/gr/qa_kludged_imports.py
@@ -30,10 +30,6 @@ class test_kludged_imports (gr_unittest.TestCase):
def tearDown(self):
pass
- def test_blks_import(self):
- # make sure that this somewhat magic import works
- from gnuradio import blks2
-
def test_gru_import(self):
# make sure that this somewhat magic import works
from gnuradio import gru
diff --git a/gr-analog/examples/tags/uhd_burst_detector.py b/gr-analog/examples/tags/uhd_burst_detector.py
index 18c74a80a8..8d846bbae8 100755
--- a/gr-analog/examples/tags/uhd_burst_detector.py
+++ b/gr-analog/examples/tags/uhd_burst_detector.py
@@ -24,7 +24,7 @@ from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import filter, analog, blocks
from gnuradio import uhd
-from gnuradio import window
+from gnuradio.fft import window
from gnuradio.eng_option import eng_option
from gnuradio.gr import firdes
from optparse import OptionParser
diff --git a/gr-audio/examples/grc/cvsd_sweep.grc b/gr-audio/examples/grc/cvsd_sweep.grc
index b5735ddf0f..88629f15c2 100644
--- a/gr-audio/examples/grc/cvsd_sweep.grc
+++ b/gr-audio/examples/grc/cvsd_sweep.grc
@@ -204,7 +204,7 @@
</param>
</block>
<block>
- <key>gr_char_to_float</key>
+ <key>blocks_char_to_float</key>
<param>
<key>id</key>
<value>c2f</value>
diff --git a/gr-audio/examples/grc/dial_tone.grc b/gr-audio/examples/grc/dial_tone.grc
index 557edbd441..2503fed640 100644
--- a/gr-audio/examples/grc/dial_tone.grc
+++ b/gr-audio/examples/grc/dial_tone.grc
@@ -229,10 +229,10 @@
</param>
</block>
<block>
- <key>gr_add_xx</key>
+ <key>blocks_add_xx</key>
<param>
<key>id</key>
- <value>gr_add_xx</value>
+ <value>blocks_add_xx</value>
</param>
<param>
<key>_enabled</key>
@@ -381,26 +381,26 @@
</param>
</block>
<connection>
- <source_block_id>gr_add_xx</source_block_id>
+ <source_block_id>blocks_add_xx</source_block_id>
<sink_block_id>audio_sink</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_sig_source_x_0</source_block_id>
- <sink_block_id>gr_add_xx</sink_block_id>
+ <sink_block_id>blocks_add_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_sig_source_x_1</source_block_id>
- <sink_block_id>gr_add_xx</sink_block_id>
+ <sink_block_id>blocks_add_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
<source_block_id>analog_noise_source_x_0</source_block_id>
- <sink_block_id>gr_add_xx</sink_block_id>
+ <sink_block_id>blocks_add_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>2</sink_key>
</connection>
diff --git a/gr-digital/examples/demod/ber_simulation.grc b/gr-digital/examples/demod/ber_simulation.grc
index 2a3e27a496..9f67504b5a 100644
--- a/gr-digital/examples/demod/ber_simulation.grc
+++ b/gr-digital/examples/demod/ber_simulation.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Sat Nov 10 15:31:44 2012</timestamp>
+ <timestamp>Thu Dec 27 13:06:26 2012</timestamp>
<block>
<key>options</key>
<param>
@@ -510,10 +510,10 @@
</param>
</block>
<block>
- <key>gr_add_xx</key>
+ <key>blocks_add_xx</key>
<param>
<key>id</key>
- <value>gr_add_xx</value>
+ <value>blocks_add_xx</value>
</param>
<param>
<key>_enabled</key>
@@ -594,7 +594,7 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx</source_block_id>
+ <source_block_id>blocks_add_xx</source_block_id>
<sink_block_id>wxgui_scopesink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -606,7 +606,7 @@
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx</source_block_id>
+ <source_block_id>blocks_add_xx</source_block_id>
<sink_block_id>digital_constellation_decoder_cb_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -619,13 +619,13 @@
</connection>
<connection>
<source_block_id>digital_chunks_to_symbols_xx_0</source_block_id>
- <sink_block_id>gr_add_xx</sink_block_id>
+ <sink_block_id>blocks_add_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_noise_source_x_0</source_block_id>
- <sink_block_id>gr_add_xx</sink_block_id>
+ <sink_block_id>blocks_add_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
diff --git a/gr-digital/examples/demod/pam_sync.grc b/gr-digital/examples/demod/pam_sync.grc
index 11c625467b..d9afb3100c 100644
--- a/gr-digital/examples/demod/pam_sync.grc
+++ b/gr-digital/examples/demod/pam_sync.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Mon Jul 16 21:25:28 2012</timestamp>
+ <timestamp>Thu Dec 27 13:26:17 2012</timestamp>
<block>
<key>options</key>
<param>
@@ -311,61 +311,6 @@
</param>
</block>
<block>
- <key>digital_pfb_clock_sync_xxx</key>
- <param>
- <key>id</key>
- <value>digital_pfb_clock_sync_xxx_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>type</key>
- <value>ccf</value>
- </param>
- <param>
- <key>sps</key>
- <value>spb</value>
- </param>
- <param>
- <key>alpha</key>
- <value>time_alpha</value>
- </param>
- <param>
- <key>beta</key>
- <value>time_beta</value>
- </param>
- <param>
- <key>taps</key>
- <value>rrctaps</value>
- </param>
- <param>
- <key>filter_size</key>
- <value>nfilts</value>
- </param>
- <param>
- <key>init_phase</key>
- <value>nfilts/2</value>
- </param>
- <param>
- <key>max_dev</key>
- <value>1.5</value>
- </param>
- <param>
- <key>osps</key>
- <value>1</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(601, 254)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>wxgui_scopesink2</key>
<param>
<key>id</key>
@@ -452,7 +397,7 @@
</param>
<param>
<key>label</key>
- <value>Channel Noise</value>
+ <value>Channels_Channel Noise</value>
</param>
<param>
<key>value</key>
@@ -703,10 +648,10 @@
</param>
</block>
<block>
- <key>channel_model</key>
+ <key>channels_channel_model</key>
<param>
<key>id</key>
- <value>channel_model_0</value>
+ <value>channels_channel_model_0</value>
</param>
<param>
<key>_enabled</key>
@@ -966,116 +911,6 @@
<key>variable_slider</key>
<param>
<key>id</key>
- <value>time_alpha</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>label</key>
- <value>Timing Alpha</value>
- </param>
- <param>
- <key>value</key>
- <value>0</value>
- </param>
- <param>
- <key>min</key>
- <value>0</value>
- </param>
- <param>
- <key>max</key>
- <value>1</value>
- </param>
- <param>
- <key>num_steps</key>
- <value>1000</value>
- </param>
- <param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
- </param>
- <param>
- <key>converver</key>
- <value>float_converter</value>
- </param>
- <param>
- <key>grid_pos</key>
- <value>(5,2,1,1)</value>
- </param>
- <param>
- <key>notebook</key>
- <value></value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(557, 431)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
- <key>variable_slider</key>
- <param>
- <key>id</key>
- <value>time_beta</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>label</key>
- <value>Timing Beta</value>
- </param>
- <param>
- <key>value</key>
- <value>0</value>
- </param>
- <param>
- <key>min</key>
- <value>0.0</value>
- </param>
- <param>
- <key>max</key>
- <value>0.1</value>
- </param>
- <param>
- <key>num_steps</key>
- <value>1000</value>
- </param>
- <param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
- </param>
- <param>
- <key>converver</key>
- <value>float_converter</value>
- </param>
- <param>
- <key>grid_pos</key>
- <value>(6,2,1,1)</value>
- </param>
- <param>
- <key>notebook</key>
- <value></value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(694, 430)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>180</value>
- </param>
- </block>
- <block>
- <key>variable_slider</key>
- <param>
- <key>id</key>
<value>freq_bw</value>
</param>
<param>
@@ -1219,10 +1054,10 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
+ <key>blocks_multiply_const_vxx</key>
<param>
<key>id</key>
- <value>gr_multiply_const_vxx_0</value>
+ <value>blocks_multiply_const_vxx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1307,6 +1142,10 @@
<value>32</value>
</param>
<param>
+ <key>atten</key>
+ <value>100</value>
+ </param>
+ <param>
<key>_coordinate</key>
<value>(468, 72)</value>
</param>
@@ -1355,58 +1194,105 @@
</param>
</block>
<block>
- <key>options</key>
+ <key>digital_pfb_clock_sync_xxx</key>
<param>
<key>id</key>
- <value>pam_sync</value>
+ <value>digital_pfb_clock_sync_xxx_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>title</key>
- <value></value>
+ <key>type</key>
+ <value>ccf</value>
</param>
<param>
- <key>author</key>
- <value></value>
+ <key>sps</key>
+ <value>spb</value>
</param>
<param>
- <key>description</key>
- <value></value>
+ <key>loop_bw</key>
+ <value>timing_loop_bw</value>
</param>
<param>
- <key>window_size</key>
- <value>1280, 1024</value>
+ <key>taps</key>
+ <value>rrctaps</value>
</param>
<param>
- <key>generate_options</key>
- <value>wx_gui</value>
+ <key>filter_size</key>
+ <value>nfilts</value>
</param>
<param>
- <key>category</key>
- <value>Custom</value>
+ <key>init_phase</key>
+ <value>nfilts/2</value>
</param>
<param>
- <key>run_options</key>
- <value>prompt</value>
+ <key>max_dev</key>
+ <value>1.5</value>
</param>
<param>
- <key>run</key>
+ <key>osps</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(601, 254)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_slider</key>
+ <param>
+ <key>id</key>
+ <value>timing_loop_bw</value>
+ </param>
+ <param>
+ <key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>max_nouts</key>
+ <key>label</key>
+ <value>Timing Loop Bandwidth</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>6.28/100.0</value>
+ </param>
+ <param>
+ <key>min</key>
<value>0</value>
</param>
<param>
- <key>realtime_scheduling</key>
+ <key>max</key>
+ <value>0.2</value>
+ </param>
+ <param>
+ <key>num_steps</key>
+ <value>1000</value>
+ </param>
+ <param>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>(5,2,1,1)</value>
+ </param>
+ <param>
+ <key>notebook</key>
<value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(-1, 0)</value>
+ <value>(557, 431)</value>
</param>
<param>
<key>_rotation</key>
@@ -1438,7 +1324,7 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_0</source_block_id>
+ <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
<sink_block_id>gr_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -1462,20 +1348,20 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>channel_model_0</source_block_id>
+ <source_block_id>channels_channel_model_0</source_block_id>
<sink_block_id>virtual_sink_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>channel_model_0</source_block_id>
+ <source_block_id>channels_channel_model_0</source_block_id>
<sink_block_id>digital_fll_band_edge_cc_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>gr_throttle_0</source_block_id>
- <sink_block_id>channel_model_0</sink_block_id>
+ <sink_block_id>channels_channel_model_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
@@ -1487,7 +1373,7 @@
</connection>
<connection>
<source_block_id>pfb_arb_resampler_xxx_0</source_block_id>
- <sink_block_id>gr_multiply_const_vxx_0</sink_block_id>
+ <sink_block_id>blocks_multiply_const_vxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/examples/demod/pam_timing.grc b/gr-digital/examples/demod/pam_timing.grc
index 6465d25fd0..b5e8d8822e 100644
--- a/gr-digital/examples/demod/pam_timing.grc
+++ b/gr-digital/examples/demod/pam_timing.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Thu Jul 5 17:55:51 2012</timestamp>
+ <timestamp>Thu Dec 27 13:05:12 2012</timestamp>
<block>
<key>options</key>
<param>
@@ -61,10 +61,10 @@
</param>
</block>
<block>
- <key>gr_uchar_to_float</key>
+ <key>blocks_uchar_to_float</key>
<param>
<key>id</key>
- <value>gr_uchar_to_float_0</value>
+ <value>blocks_uchar_to_float_0</value>
</param>
<param>
<key>_enabled</key>
@@ -80,10 +80,10 @@
</param>
</block>
<block>
- <key>gr_uchar_to_float</key>
+ <key>blocks_uchar_to_float</key>
<param>
<key>id</key>
- <value>gr_uchar_to_float_0_0</value>
+ <value>blocks_uchar_to_float_0_0</value>
</param>
<param>
<key>_enabled</key>
@@ -232,10 +232,10 @@
</param>
</block>
<block>
- <key>const_source_x</key>
+ <key>analog_const_source_x</key>
<param>
<key>id</key>
- <value>const_source_x_0</value>
+ <value>analog_const_source_x_0</value>
</param>
<param>
<key>_enabled</key>
@@ -259,10 +259,10 @@
</param>
</block>
<block>
- <key>const_source_x</key>
+ <key>analog_const_source_x</key>
<param>
<key>id</key>
- <value>const_source_x_0_0</value>
+ <value>analog_const_source_x_0_0</value>
</param>
<param>
<key>_enabled</key>
@@ -321,10 +321,10 @@
</param>
</block>
<block>
- <key>gr_add_xx</key>
+ <key>blocks_add_xx</key>
<param>
<key>id</key>
- <value>gr_add_xx_0</value>
+ <value>blocks_add_xx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -352,10 +352,10 @@
</param>
</block>
<block>
- <key>gr_add_xx</key>
+ <key>blocks_add_xx</key>
<param>
<key>id</key>
- <value>gr_add_xx_0_1</value>
+ <value>blocks_add_xx_0_1</value>
</param>
<param>
<key>_enabled</key>
@@ -516,61 +516,6 @@
</param>
</block>
<block>
- <key>variable_slider</key>
- <param>
- <key>id</key>
- <value>alpha</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>label</key>
- <value>Timing Alpha</value>
- </param>
- <param>
- <key>value</key>
- <value>0</value>
- </param>
- <param>
- <key>min</key>
- <value>0</value>
- </param>
- <param>
- <key>max</key>
- <value>1</value>
- </param>
- <param>
- <key>num_steps</key>
- <value>1000</value>
- </param>
- <param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
- </param>
- <param>
- <key>converver</key>
- <value>float_converter</value>
- </param>
- <param>
- <key>grid_pos</key>
- <value></value>
- </param>
- <param>
- <key>notebook</key>
- <value></value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(552, 4)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>variable</key>
<param>
<key>id</key>
@@ -692,61 +637,6 @@
</param>
</block>
<block>
- <key>digital_pfb_clock_sync_xxx</key>
- <param>
- <key>id</key>
- <value>digital_pfb_clock_sync_xxx_0</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
- <param>
- <key>type</key>
- <value>ccf</value>
- </param>
- <param>
- <key>sps</key>
- <value>spb</value>
- </param>
- <param>
- <key>alpha</key>
- <value>alpha</value>
- </param>
- <param>
- <key>beta</key>
- <value>beta</value>
- </param>
- <param>
- <key>taps</key>
- <value>rrctaps</value>
- </param>
- <param>
- <key>filter_size</key>
- <value>nfilts</value>
- </param>
- <param>
- <key>init_phase</key>
- <value>nfilts/2</value>
- </param>
- <param>
- <key>max_dev</key>
- <value>1.5</value>
- </param>
- <param>
- <key>osps</key>
- <value>1</value>
- </param>
- <param>
- <key>_coordinate</key>
- <value>(492, 519)</value>
- </param>
- <param>
- <key>_rotation</key>
- <value>0</value>
- </param>
- </block>
- <block>
<key>gr_throttle</key>
<param>
<key>id</key>
@@ -778,10 +668,10 @@
</param>
</block>
<block>
- <key>channel_model</key>
+ <key>channels_channel_model</key>
<param>
<key>id</key>
- <value>channel_model_0</value>
+ <value>channels_channel_model_0</value>
</param>
<param>
<key>_enabled</key>
@@ -817,10 +707,10 @@
</param>
</block>
<block>
- <key>gr_float_to_complex</key>
+ <key>blocks_float_to_complex</key>
<param>
<key>id</key>
- <value>gr_float_to_complex_0</value>
+ <value>blocks_float_to_complex_0</value>
</param>
<param>
<key>_enabled</key>
@@ -866,6 +756,10 @@
<value>32</value>
</param>
<param>
+ <key>atten</key>
+ <value>100</value>
+ </param>
+ <param>
<key>_coordinate</key>
<value>(788, 173)</value>
</param>
@@ -875,10 +769,10 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
+ <key>blocks_multiply_const_vxx</key>
<param>
<key>id</key>
- <value>gr_multiply_const_vxx_0</value>
+ <value>blocks_multiply_const_vxx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1206,113 +1100,119 @@
</param>
</block>
<block>
- <key>variable_slider</key>
+ <key>variable</key>
<param>
<key>id</key>
- <value>beta</value>
+ <value>pam_amp</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>label</key>
- <value>Timing Beta</value>
+ <key>value</key>
+ <value>2</value>
</param>
<param>
- <key>value</key>
+ <key>_coordinate</key>
+ <value>(277, 12)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
<value>0</value>
</param>
+ </block>
+ <block>
+ <key>variable</key>
<param>
- <key>min</key>
- <value>0.0</value>
+ <key>id</key>
+ <value>samp_rate</value>
</param>
<param>
- <key>max</key>
- <value>0.1</value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>num_steps</key>
- <value>1000</value>
+ <key>value</key>
+ <value>32000</value>
</param>
<param>
- <key>style</key>
- <value>wx.SL_HORIZONTAL</value>
+ <key>_coordinate</key>
+ <value>(182, 12)</value>
</param>
<param>
- <key>converver</key>
- <value>float_converter</value>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>sig_amp</value>
</param>
<param>
- <key>grid_pos</key>
- <value></value>
+ <key>_enabled</key>
+ <value>True</value>
</param>
<param>
- <key>notebook</key>
- <value></value>
+ <key>value</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(673, 5)</value>
+ <value>(369, 12)</value>
</param>
<param>
<key>_rotation</key>
- <value>180</value>
+ <value>0</value>
</param>
</block>
<block>
- <key>options</key>
+ <key>digital_pfb_clock_sync_xxx</key>
<param>
<key>id</key>
- <value>pam_timing</value>
+ <value>digital_pfb_clock_sync_xxx_0</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>title</key>
- <value></value>
- </param>
- <param>
- <key>author</key>
- <value></value>
- </param>
- <param>
- <key>description</key>
- <value></value>
+ <key>type</key>
+ <value>ccf</value>
</param>
<param>
- <key>window_size</key>
- <value>1280, 1024</value>
+ <key>sps</key>
+ <value>spb</value>
</param>
<param>
- <key>generate_options</key>
- <value>wx_gui</value>
+ <key>loop_bw</key>
+ <value>loop_bw</value>
</param>
<param>
- <key>category</key>
- <value>Custom</value>
+ <key>taps</key>
+ <value>rrctaps</value>
</param>
<param>
- <key>run_options</key>
- <value>prompt</value>
+ <key>filter_size</key>
+ <value>nfilts</value>
</param>
<param>
- <key>run</key>
- <value>True</value>
+ <key>init_phase</key>
+ <value>nfilts/2</value>
</param>
<param>
- <key>max_nouts</key>
- <value>0</value>
+ <key>max_dev</key>
+ <value>1.5</value>
</param>
<param>
- <key>realtime_scheduling</key>
- <value></value>
+ <key>osps</key>
+ <value>1</value>
</param>
<param>
<key>_coordinate</key>
- <value>(10, 10)</value>
+ <value>(492, 519)</value>
</param>
<param>
<key>_rotation</key>
@@ -1320,68 +1220,54 @@
</param>
</block>
<block>
- <key>variable</key>
+ <key>variable_slider</key>
<param>
<key>id</key>
- <value>pam_amp</value>
+ <value>loop_bw</value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
- <key>value</key>
- <value>2</value>
+ <key>label</key>
+ <value>Loop Bandwidth</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(277, 12)</value>
+ <key>value</key>
+ <value>6.28/100.0</value>
</param>
<param>
- <key>_rotation</key>
+ <key>min</key>
<value>0</value>
</param>
- </block>
- <block>
- <key>variable</key>
- <param>
- <key>id</key>
- <value>samp_rate</value>
- </param>
- <param>
- <key>_enabled</key>
- <value>True</value>
- </param>
<param>
- <key>value</key>
- <value>32000</value>
+ <key>max</key>
+ <value>0.2</value>
</param>
<param>
- <key>_coordinate</key>
- <value>(182, 12)</value>
+ <key>num_steps</key>
+ <value>1000</value>
</param>
<param>
- <key>_rotation</key>
- <value>0</value>
+ <key>style</key>
+ <value>wx.SL_HORIZONTAL</value>
</param>
- </block>
- <block>
- <key>variable</key>
<param>
- <key>id</key>
- <value>sig_amp</value>
+ <key>converver</key>
+ <value>float_converter</value>
</param>
<param>
- <key>_enabled</key>
- <value>True</value>
+ <key>grid_pos</key>
+ <value></value>
</param>
<param>
- <key>value</key>
- <value>1</value>
+ <key>notebook</key>
+ <value></value>
</param>
<param>
<key>_coordinate</key>
- <value>(369, 12)</value>
+ <value>(552, 4)</value>
</param>
<param>
<key>_rotation</key>
@@ -1390,54 +1276,54 @@
</block>
<connection>
<source_block_id>random_source_x_0</source_block_id>
- <sink_block_id>gr_uchar_to_float_0</sink_block_id>
+ <sink_block_id>blocks_uchar_to_float_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_uchar_to_float_0</source_block_id>
- <sink_block_id>gr_add_xx_0</sink_block_id>
+ <source_block_id>blocks_uchar_to_float_0</source_block_id>
+ <sink_block_id>blocks_add_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>const_source_x_0</source_block_id>
- <sink_block_id>gr_add_xx_0</sink_block_id>
+ <source_block_id>analog_const_source_x_0</source_block_id>
+ <sink_block_id>blocks_add_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_uchar_to_float_0_0</source_block_id>
- <sink_block_id>gr_add_xx_0_1</sink_block_id>
+ <source_block_id>blocks_uchar_to_float_0_0</source_block_id>
+ <sink_block_id>blocks_add_xx_0_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>const_source_x_0_0</source_block_id>
- <sink_block_id>gr_add_xx_0_1</sink_block_id>
+ <source_block_id>analog_const_source_x_0_0</source_block_id>
+ <sink_block_id>blocks_add_xx_0_1</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
<source_block_id>random_source_x_0_0</source_block_id>
- <sink_block_id>gr_uchar_to_float_0_0</sink_block_id>
+ <sink_block_id>blocks_uchar_to_float_0_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_0</source_block_id>
- <sink_block_id>gr_float_to_complex_0</sink_block_id>
+ <source_block_id>blocks_add_xx_0</source_block_id>
+ <sink_block_id>blocks_float_to_complex_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_0_1</source_block_id>
- <sink_block_id>gr_float_to_complex_0</sink_block_id>
+ <source_block_id>blocks_add_xx_0_1</source_block_id>
+ <sink_block_id>blocks_float_to_complex_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_0</source_block_id>
+ <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
<sink_block_id>wxgui_scopesink2_0_0_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -1473,26 +1359,26 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>channel_model_0</source_block_id>
+ <source_block_id>channels_channel_model_0</source_block_id>
<sink_block_id>gr_throttle_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_0</source_block_id>
- <sink_block_id>channel_model_0</sink_block_id>
+ <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
+ <sink_block_id>channels_channel_model_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_float_to_complex_0</source_block_id>
+ <source_block_id>blocks_float_to_complex_0</source_block_id>
<sink_block_id>pfb_arb_resampler_xxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>pfb_arb_resampler_xxx_0</source_block_id>
- <sink_block_id>gr_multiply_const_vxx_0</sink_block_id>
+ <sink_block_id>blocks_multiply_const_vxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-digital/python/gfsk.py b/gr-digital/python/gfsk.py
index d6a81c37fc..42d65d36ce 100644
--- a/gr-digital/python/gfsk.py
+++ b/gr-digital/python/gfsk.py
@@ -26,7 +26,7 @@
from gnuradio import gr
from gnuradio import analog
-from gnuradio import blocksx
+from gnuradio import blocks
import modulation_utils
import digital_swig as digital
from math import pi
diff --git a/gr-fcd/examples/grc/fcd_nfm_rx.grc b/gr-fcd/examples/grc/fcd_nfm_rx.grc
index 98d06d9ef1..96d6f55e2e 100644
--- a/gr-fcd/examples/grc/fcd_nfm_rx.grc
+++ b/gr-fcd/examples/grc/fcd_nfm_rx.grc
@@ -379,10 +379,10 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
+ <key>blocks_multiply_const_vxx</key>
<param>
<key>id</key>
- <value>gr_multiply_const_vxx_1</value>
+ <value>blocks_multiply_const_vxx_1</value>
</param>
<param>
<key>_enabled</key>
@@ -997,20 +997,20 @@
</param>
</block>
<connection>
- <source_block_id>gr_multiply_const_vxx_1</source_block_id>
+ <source_block_id>blocks_multiply_const_vxx_1</source_block_id>
<sink_block_id>audio_sink</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_1</source_block_id>
+ <source_block_id>blocks_multiply_const_vxx_1</source_block_id>
<sink_block_id>audio_sink</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>nbfm_normal</source_block_id>
- <sink_block_id>gr_multiply_const_vxx_1</sink_block_id>
+ <sink_block_id>blocks_multiply_const_vxx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-fft/grc/fft_fft_vxx.xml b/gr-fft/grc/fft_fft_vxx.xml
index 69f12ace77..028721fe25 100644
--- a/gr-fft/grc/fft_fft_vxx.xml
+++ b/gr-fft/grc/fft_fft_vxx.xml
@@ -8,7 +8,7 @@
<name>FFT</name>
<key>fft_vxx</key>
<import>from gnuradio import fft</import>
- <import>from gnuradio import window</import>
+ <import>from gnuradio.fft import window</import>
<make>#if $type() == "complex"
fft.fft_vcc($fft_size, $forward, $window, $shift, $nthreads)
#else
diff --git a/gr-fft/python/CMakeLists.txt b/gr-fft/python/CMakeLists.txt
index b437b88a84..415d87e2e8 100644
--- a/gr-fft/python/CMakeLists.txt
+++ b/gr-fft/python/CMakeLists.txt
@@ -24,6 +24,7 @@ GR_PYTHON_INSTALL(
FILES
__init__.py
logpwrfft.py
+ window.py
DESTINATION ${GR_PYTHON_DIR}/gnuradio/fft
COMPONENT "fft_python"
)
diff --git a/gr-fft/python/__init__.py b/gr-fft/python/__init__.py
index a532109b70..093cc3c696 100644
--- a/gr-fft/python/__init__.py
+++ b/gr-fft/python/__init__.py
@@ -25,4 +25,4 @@ processing blocks for FFT and related functions.
'''
from fft_swig import *
-from logpwrfft import *
+from window import *
diff --git a/gr-fft/python/logpwrfft.py b/gr-fft/python/logpwrfft.py
index 18ccb356d0..0513169275 100644
--- a/gr-fft/python/logpwrfft.py
+++ b/gr-fft/python/logpwrfft.py
@@ -19,11 +19,12 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio import gr, window
+from gnuradio import gr
from gnuradio import blocks
import sys, math
import fft_swig as fft
+import window
try:
from gnuradio import filter
diff --git a/gr-filter/python/window.py b/gr-fft/python/window.py
index 0065a08a61..0065a08a61 100644
--- a/gr-filter/python/window.py
+++ b/gr-fft/python/window.py
diff --git a/gr-filter/examples/resampler_demo.grc b/gr-filter/examples/resampler_demo.grc
index 7616d0bccd..9c19cd7dcc 100644
--- a/gr-filter/examples/resampler_demo.grc
+++ b/gr-filter/examples/resampler_demo.grc
@@ -511,7 +511,7 @@
</param>
</block>
<block>
- <key>gr_add_const_vxx</key>
+ <key>blocks_add_const_vxx</key>
<param>
<key>id</key>
<value>adder</value>
diff --git a/gr-filter/python/CMakeLists.txt b/gr-filter/python/CMakeLists.txt
index 1243a8f8c4..1ef5b35641 100644
--- a/gr-filter/python/CMakeLists.txt
+++ b/gr-filter/python/CMakeLists.txt
@@ -27,7 +27,6 @@ GR_PYTHON_INSTALL(
optfir.py
pfb.py
rational_resampler.py
- window.py
DESTINATION ${GR_PYTHON_DIR}/gnuradio/filter
COMPONENT "filter_python"
)
diff --git a/gr-filter/python/__init__.py b/gr-filter/python/__init__.py
index d7fb112790..ad2f116d72 100644
--- a/gr-filter/python/__init__.py
+++ b/gr-filter/python/__init__.py
@@ -29,3 +29,6 @@ from filterbank import *
from rational_resampler import *
import pfb
import optfir
+
+# Pull this into the filter module
+from gnuradio.fft import window
diff --git a/gr-noaa/examples/file_rx_hrpt.grc b/gr-noaa/examples/file_rx_hrpt.grc
index 4097e83d36..664b200a5f 100644
--- a/gr-noaa/examples/file_rx_hrpt.grc
+++ b/gr-noaa/examples/file_rx_hrpt.grc
@@ -419,10 +419,10 @@
</param>
</block>
<block>
- <key>gr_interleaved_short_to_complex</key>
+ <key>blocks_interleaved_short_to_complex</key>
<param>
<key>id</key>
- <value>gr_interleaved_short_to_complex_0</value>
+ <value>blocks_interleaved_short_to_complex_0</value>
</param>
<param>
<key>_enabled</key>
@@ -871,14 +871,14 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_interleaved_short_to_complex_0</source_block_id>
+ <source_block_id>blocks_interleaved_short_to_complex_0</source_block_id>
<sink_block_id>agc</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>throttle</source_block_id>
- <sink_block_id>gr_interleaved_short_to_complex_0</sink_block_id>
+ <sink_block_id>blocks_interleaved_short_to_complex_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-noaa/examples/hrpt_demod.grc b/gr-noaa/examples/hrpt_demod.grc
index f5833b864c..54dbf73ce7 100644
--- a/gr-noaa/examples/hrpt_demod.grc
+++ b/gr-noaa/examples/hrpt_demod.grc
@@ -231,7 +231,7 @@
</param>
</block>
<block>
- <key>gr_interleaved_short_to_complex</key>
+ <key>blocks_interleaved_short_to_complex</key>
<param>
<key>id</key>
<value>cs2cf</value>
diff --git a/gr-pager/apps/usrp_rx_flex.grc b/gr-pager/apps/usrp_rx_flex.grc
index b9461a57f8..79312a4148 100644
--- a/gr-pager/apps/usrp_rx_flex.grc
+++ b/gr-pager/apps/usrp_rx_flex.grc
@@ -330,10 +330,10 @@
</param>
</block>
<block>
- <key>gr_freq_xlating_fir_filter_xxx</key>
+ <key>filter_freq_xlating_fir_filter_xxx</key>
<param>
<key>id</key>
- <value>gr_freq_xlating_fir_filter_xxx_0</value>
+ <value>filter_freq_xlating_fir_filter_xxx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1086,7 +1086,7 @@
</param>
</block>
<block>
- <key>gr_quadrature_demod_cf</key>
+ <key>analog_quadrature_demod_cf</key>
<param>
<key>id</key>
<value>fm_demod</value>
@@ -1466,10 +1466,10 @@
</param>
</block>
<block>
- <key>gr_char_to_float</key>
+ <key>blocks_char_to_float</key>
<param>
<key>id</key>
- <value>gr_char_to_float_0</value>
+ <value>blocks_char_to_float_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1688,14 +1688,14 @@
</param>
</block>
<connection>
- <source_block_id>gr_freq_xlating_fir_filter_xxx_0</source_block_id>
+ <source_block_id>filter_freq_xlating_fir_filter_xxx_0</source_block_id>
<sink_block_id>wxgui_fftsink2_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>usrp_source</source_block_id>
- <sink_block_id>gr_freq_xlating_fir_filter_xxx_0</sink_block_id>
+ <sink_block_id>filter_freq_xlating_fir_filter_xxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
@@ -1706,7 +1706,7 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_freq_xlating_fir_filter_xxx_0</source_block_id>
+ <source_block_id>filter_freq_xlating_fir_filter_xxx_0</source_block_id>
<sink_block_id>fm_demod</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -1743,12 +1743,12 @@
</connection>
<connection>
<source_block_id>pager_slicer_fb_0</source_block_id>
- <sink_block_id>gr_char_to_float_0</sink_block_id>
+ <sink_block_id>blocks_char_to_float_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_char_to_float_0</source_block_id>
+ <source_block_id>blocks_char_to_float_0</source_block_id>
<sink_block_id>wxgui_scopesink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
diff --git a/gr-pager/apps/usrp_rx_flex.py b/gr-pager/apps/usrp_rx_flex.py
index 2d02009a85..6bb93ee756 100755
--- a/gr-pager/apps/usrp_rx_flex.py
+++ b/gr-pager/apps/usrp_rx_flex.py
@@ -9,9 +9,9 @@ from gnuradio import eng_notation
from gnuradio import gr
from gnuradio import filter
from gnuradio import pager
-from gnuradio import window
from gnuradio.eng_option import eng_option
-from gnuradio.gr import firdes
+from gnuradio.filter import window
+from gnuradio.filter import firdes
from gnuradio.wxgui import fftsink2
from gnuradio.wxgui import forms
from gnuradio.wxgui import scopesink2
diff --git a/gr-trellis/CMakeLists.txt b/gr-trellis/CMakeLists.txt
index dc09cf7823..b764998e8c 100644
--- a/gr-trellis/CMakeLists.txt
+++ b/gr-trellis/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -29,13 +29,18 @@ include(GrComponent)
GR_REGISTER_COMPONENT("gr-trellis" ENABLE_GR_TRELLIS
Boost_FOUND
ENABLE_GR_CORE
+ ENABLE_GR_ANALOG
ENABLE_GR_BLOCKS
ENABLE_GR_DIGITAL
)
GR_SET_GLOBAL(GR_TRELLIS_INCLUDE_DIRS
- ${CMAKE_CURRENT_BINARY_DIR}/src/lib
- ${CMAKE_CURRENT_SOURCE_DIR}/src/lib
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_BINARY_DIR}/include
+)
+
+GR_SET_GLOBAL(GR_TRELLIS_SWIG_INCLUDE_DIRS
+ ${CMAKE_CURRENT_SOURCE_DIR}/swig
)
SET(GR_PKG_TRELLIS_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/trellis)
@@ -95,9 +100,14 @@ CPACK_COMPONENT("trellis_swig"
########################################################################
# Add subdirectories
########################################################################
-add_subdirectory(src)
+add_subdirectory(include/trellis)
+add_subdirectory(lib)
add_subdirectory(doc)
if(ENABLE_PYTHON)
+ add_subdirectory(swig)
+ add_subdirectory(python)
+ add_subdirectory(examples/python)
+ add_subdirectory(examples/grc)
add_subdirectory(grc)
endif(ENABLE_PYTHON)
diff --git a/gr-trellis/src/examples/grc/CMakeLists.txt b/gr-trellis/examples/grc/CMakeLists.txt
index 46b825d888..46b825d888 100644
--- a/gr-trellis/src/examples/grc/CMakeLists.txt
+++ b/gr-trellis/examples/grc/CMakeLists.txt
diff --git a/gr-trellis/src/examples/grc/interference_cancellation.grc b/gr-trellis/examples/grc/interference_cancellation.grc
index 129ee87905..891426660a 100644
--- a/gr-trellis/src/examples/grc/interference_cancellation.grc
+++ b/gr-trellis/examples/grc/interference_cancellation.grc
@@ -272,10 +272,10 @@
</param>
</block>
<block>
- <key>gr_sub_xx</key>
+ <key>blocks_sub_xx</key>
<param>
<key>id</key>
- <value>gr_sub_xx_0</value>
+ <value>blocks_sub_xx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -303,10 +303,10 @@
</param>
</block>
<block>
- <key>gr_multiply_xx</key>
+ <key>blocks_multiply_xx</key>
<param>
<key>id</key>
- <value>gr_multiply_xx_0</value>
+ <value>blocks_multiply_xx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -334,10 +334,10 @@
</param>
</block>
<block>
- <key>gr_short_to_float</key>
+ <key>blocks_short_to_float</key>
<param>
<key>id</key>
- <value>gr_short_to_float_0</value>
+ <value>blocks_short_to_float_0</value>
</param>
<param>
<key>_enabled</key>
@@ -361,10 +361,10 @@
</param>
</block>
<block>
- <key>gr_sub_xx</key>
+ <key>blocks_sub_xx</key>
<param>
<key>id</key>
- <value>gr_sub_xx_3</value>
+ <value>blocks_sub_xx_3</value>
</param>
<param>
<key>_enabled</key>
@@ -392,10 +392,10 @@
</param>
</block>
<block>
- <key>gr_multiply_xx</key>
+ <key>blocks_multiply_xx</key>
<param>
<key>id</key>
- <value>gr_multiply_xx_1</value>
+ <value>blocks_multiply_xx_1</value>
</param>
<param>
<key>_enabled</key>
@@ -423,10 +423,10 @@
</param>
</block>
<block>
- <key>gr_short_to_float</key>
+ <key>blocks_short_to_float</key>
<param>
<key>id</key>
- <value>gr_short_to_float_2</value>
+ <value>blocks_short_to_float_2</value>
</param>
<param>
<key>_enabled</key>
@@ -450,10 +450,10 @@
</param>
</block>
<block>
- <key>gr_sub_xx</key>
+ <key>blocks_sub_xx</key>
<param>
<key>id</key>
- <value>gr_sub_xx_2</value>
+ <value>blocks_sub_xx_2</value>
</param>
<param>
<key>_enabled</key>
@@ -481,10 +481,10 @@
</param>
</block>
<block>
- <key>gr_sub_xx</key>
+ <key>blocks_sub_xx</key>
<param>
<key>id</key>
- <value>gr_sub_xx_1</value>
+ <value>blocks_sub_xx_1</value>
</param>
<param>
<key>_enabled</key>
@@ -512,10 +512,10 @@
</param>
</block>
<block>
- <key>gr_multiply_xx</key>
+ <key>blocks_multiply_xx</key>
<param>
<key>id</key>
- <value>gr_multiply_xx_2</value>
+ <value>blocks_multiply_xx_2</value>
</param>
<param>
<key>_enabled</key>
@@ -543,10 +543,10 @@
</param>
</block>
<block>
- <key>gr_short_to_float</key>
+ <key>blocks_short_to_float</key>
<param>
<key>id</key>
- <value>gr_short_to_float_1</value>
+ <value>blocks_short_to_float_1</value>
</param>
<param>
<key>_enabled</key>
@@ -570,10 +570,10 @@
</param>
</block>
<block>
- <key>gr_sub_xx</key>
+ <key>blocks_sub_xx</key>
<param>
<key>id</key>
- <value>gr_sub_xx_2_0</value>
+ <value>blocks_sub_xx_2_0</value>
</param>
<param>
<key>_enabled</key>
@@ -601,10 +601,10 @@
</param>
</block>
<block>
- <key>gr_sub_xx</key>
+ <key>blocks_sub_xx</key>
<param>
<key>id</key>
- <value>gr_sub_xx_1_0</value>
+ <value>blocks_sub_xx_1_0</value>
</param>
<param>
<key>_enabled</key>
@@ -632,10 +632,10 @@
</param>
</block>
<block>
- <key>gr_multiply_xx</key>
+ <key>blocks_multiply_xx</key>
<param>
<key>id</key>
- <value>gr_multiply_xx_2_0</value>
+ <value>blocks_multiply_xx_2_0</value>
</param>
<param>
<key>_enabled</key>
@@ -663,10 +663,10 @@
</param>
</block>
<block>
- <key>gr_short_to_float</key>
+ <key>blocks_short_to_float</key>
<param>
<key>id</key>
- <value>gr_short_to_float_1_0</value>
+ <value>blocks_short_to_float_1_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1410,10 +1410,10 @@
</param>
</block>
<block>
- <key>gr_add_xx</key>
+ <key>blocks_add_xx</key>
<param>
<key>id</key>
- <value>gr_add_xx_1</value>
+ <value>blocks_add_xx_1</value>
</param>
<param>
<key>_enabled</key>
@@ -1441,10 +1441,10 @@
</param>
</block>
<block>
- <key>gr_add_xx</key>
+ <key>blocks_add_xx</key>
<param>
<key>id</key>
- <value>gr_add_xx_0</value>
+ <value>blocks_add_xx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1538,10 +1538,10 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
+ <key>blocks_multiply_const_vxx</key>
<param>
<key>id</key>
- <value>gr_multiply_const_vxx_0</value>
+ <value>blocks_multiply_const_vxx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1608,10 +1608,10 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
+ <key>blocks_multiply_const_vxx</key>
<param>
<key>id</key>
- <value>gr_multiply_const_vxx_1</value>
+ <value>blocks_multiply_const_vxx_1</value>
</param>
<param>
<key>_enabled</key>
@@ -1748,10 +1748,10 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
+ <key>blocks_multiply_const_vxx</key>
<param>
<key>id</key>
- <value>gr_multiply_const_vxx_2</value>
+ <value>blocks_multiply_const_vxx_2</value>
</param>
<param>
<key>_enabled</key>
@@ -1810,10 +1810,10 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
+ <key>blocks_multiply_const_vxx</key>
<param>
<key>id</key>
- <value>gr_multiply_const_vxx_2_0</value>
+ <value>blocks_multiply_const_vxx_2_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1917,50 +1917,50 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_0</source_block_id>
- <sink_block_id>gr_add_xx_0</sink_block_id>
+ <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
+ <sink_block_id>blocks_add_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_0</source_block_id>
- <sink_block_id>gr_add_xx_1</sink_block_id>
+ <source_block_id>blocks_add_xx_0</source_block_id>
+ <sink_block_id>blocks_add_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_1</source_block_id>
- <sink_block_id>gr_add_xx_0</sink_block_id>
+ <source_block_id>blocks_multiply_const_vxx_1</source_block_id>
+ <sink_block_id>blocks_add_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_0</source_block_id>
- <sink_block_id>gr_multiply_xx_0</sink_block_id>
+ <source_block_id>blocks_sub_xx_0</source_block_id>
+ <sink_block_id>blocks_multiply_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_0</source_block_id>
- <sink_block_id>gr_multiply_xx_0</sink_block_id>
+ <source_block_id>blocks_sub_xx_0</source_block_id>
+ <sink_block_id>blocks_multiply_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_xx_0</source_block_id>
- <sink_block_id>gr_short_to_float_0</sink_block_id>
+ <source_block_id>blocks_multiply_xx_0</source_block_id>
+ <sink_block_id>blocks_short_to_float_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_short_to_float_0</source_block_id>
+ <source_block_id>blocks_short_to_float_0</source_block_id>
<sink_block_id>wxgui_numbersink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_xx_2</source_block_id>
- <sink_block_id>gr_short_to_float_1</sink_block_id>
+ <source_block_id>blocks_multiply_xx_2</source_block_id>
+ <sink_block_id>blocks_short_to_float_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
@@ -1971,62 +1971,62 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_1</source_block_id>
+ <source_block_id>blocks_add_xx_1</source_block_id>
<sink_block_id>trellis_viterbi_combined_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>random_source_x_0</source_block_id>
- <sink_block_id>gr_sub_xx_0</sink_block_id>
+ <sink_block_id>blocks_sub_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>trellis_viterbi_combined_xx_1</source_block_id>
- <sink_block_id>gr_sub_xx_0</sink_block_id>
+ <sink_block_id>blocks_sub_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
<source_block_id>trellis_viterbi_combined_xx_0</source_block_id>
- <sink_block_id>gr_sub_xx_1</sink_block_id>
+ <sink_block_id>blocks_sub_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
<source_block_id>random_source_x_1</source_block_id>
- <sink_block_id>gr_sub_xx_1</sink_block_id>
+ <sink_block_id>blocks_sub_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_1</source_block_id>
- <sink_block_id>gr_multiply_xx_2</sink_block_id>
+ <source_block_id>blocks_sub_xx_1</source_block_id>
+ <sink_block_id>blocks_multiply_xx_2</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_1</source_block_id>
- <sink_block_id>gr_multiply_xx_2</sink_block_id>
+ <source_block_id>blocks_sub_xx_1</source_block_id>
+ <sink_block_id>blocks_multiply_xx_2</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_2</source_block_id>
+ <source_block_id>blocks_sub_xx_2</source_block_id>
<sink_block_id>trellis_viterbi_combined_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_1</source_block_id>
- <sink_block_id>gr_sub_xx_2</sink_block_id>
+ <source_block_id>blocks_add_xx_1</source_block_id>
+ <sink_block_id>blocks_sub_xx_2</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_2</source_block_id>
- <sink_block_id>gr_sub_xx_2</sink_block_id>
+ <source_block_id>blocks_multiply_const_vxx_2</source_block_id>
+ <sink_block_id>blocks_sub_xx_2</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
@@ -2037,49 +2037,49 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_xx_1</source_block_id>
- <sink_block_id>gr_short_to_float_2</sink_block_id>
+ <source_block_id>blocks_multiply_xx_1</source_block_id>
+ <sink_block_id>blocks_short_to_float_2</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_short_to_float_2</source_block_id>
+ <source_block_id>blocks_short_to_float_2</source_block_id>
<sink_block_id>wxgui_numbersink2_2</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>trellis_viterbi_combined_xx_2</source_block_id>
- <sink_block_id>gr_sub_xx_3</sink_block_id>
+ <sink_block_id>blocks_sub_xx_3</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_3</source_block_id>
- <sink_block_id>gr_multiply_xx_1</sink_block_id>
+ <source_block_id>blocks_sub_xx_3</source_block_id>
+ <sink_block_id>blocks_multiply_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_3</source_block_id>
- <sink_block_id>gr_multiply_xx_1</sink_block_id>
+ <source_block_id>blocks_sub_xx_3</source_block_id>
+ <sink_block_id>blocks_multiply_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_1</source_block_id>
+ <source_block_id>blocks_add_xx_1</source_block_id>
<sink_block_id>trellis_viterbi_combined_xx_2</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>random_source_x_1</source_block_id>
- <sink_block_id>gr_sub_xx_3</sink_block_id>
+ <sink_block_id>blocks_sub_xx_3</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_short_to_float_1</source_block_id>
+ <source_block_id>blocks_short_to_float_1</source_block_id>
<sink_block_id>wxgui_numbersink2_3</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -2091,61 +2091,61 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_xx_2_0</source_block_id>
- <sink_block_id>gr_short_to_float_1_0</sink_block_id>
+ <source_block_id>blocks_multiply_xx_2_0</source_block_id>
+ <sink_block_id>blocks_short_to_float_1_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>trellis_viterbi_combined_xx_0_0</source_block_id>
- <sink_block_id>gr_sub_xx_1_0</sink_block_id>
+ <sink_block_id>blocks_sub_xx_1_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_1_0</source_block_id>
- <sink_block_id>gr_multiply_xx_2_0</sink_block_id>
+ <source_block_id>blocks_sub_xx_1_0</source_block_id>
+ <sink_block_id>blocks_multiply_xx_2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_1_0</source_block_id>
- <sink_block_id>gr_multiply_xx_2_0</sink_block_id>
+ <source_block_id>blocks_sub_xx_1_0</source_block_id>
+ <sink_block_id>blocks_multiply_xx_2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_2_0</source_block_id>
+ <source_block_id>blocks_sub_xx_2_0</source_block_id>
<sink_block_id>trellis_viterbi_combined_xx_0_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_short_to_float_1_0</source_block_id>
+ <source_block_id>blocks_short_to_float_1_0</source_block_id>
<sink_block_id>wxgui_numbersink2_3_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_1</source_block_id>
- <sink_block_id>gr_sub_xx_2_0</sink_block_id>
+ <source_block_id>blocks_add_xx_1</source_block_id>
+ <sink_block_id>blocks_sub_xx_2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>random_source_x_0</source_block_id>
- <sink_block_id>gr_sub_xx_1_0</sink_block_id>
+ <sink_block_id>blocks_sub_xx_1_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_2_0</source_block_id>
- <sink_block_id>gr_sub_xx_2_0</sink_block_id>
+ <source_block_id>blocks_multiply_const_vxx_2_0</source_block_id>
+ <sink_block_id>blocks_sub_xx_2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_1</source_block_id>
+ <source_block_id>blocks_add_xx_1</source_block_id>
<sink_block_id>wxgui_scopesink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -2158,7 +2158,7 @@
</connection>
<connection>
<source_block_id>analog_noise_source_x_0</source_block_id>
- <sink_block_id>gr_add_xx_1</sink_block_id>
+ <sink_block_id>blocks_add_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
@@ -2170,13 +2170,13 @@
</connection>
<connection>
<source_block_id>digital_chunks_to_symbols_xx_0</source_block_id>
- <sink_block_id>gr_multiply_const_vxx_0</sink_block_id>
+ <sink_block_id>blocks_multiply_const_vxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>digital_chunks_to_symbols_xx_0_0</source_block_id>
- <sink_block_id>gr_multiply_const_vxx_1</sink_block_id>
+ <sink_block_id>blocks_multiply_const_vxx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
@@ -2194,7 +2194,7 @@
</connection>
<connection>
<source_block_id>digital_chunks_to_symbols_xx_0_0_0</source_block_id>
- <sink_block_id>gr_multiply_const_vxx_2</sink_block_id>
+ <sink_block_id>blocks_multiply_const_vxx_2</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
@@ -2206,7 +2206,7 @@
</connection>
<connection>
<source_block_id>digital_chunks_to_symbols_xx_0_0_1</source_block_id>
- <sink_block_id>gr_multiply_const_vxx_2_0</sink_block_id>
+ <sink_block_id>blocks_multiply_const_vxx_2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-trellis/src/examples/grc/pccc.grc b/gr-trellis/examples/grc/pccc.grc
index 06fa9cd69f..a9f65cf856 100644
--- a/gr-trellis/src/examples/grc/pccc.grc
+++ b/gr-trellis/examples/grc/pccc.grc
@@ -1,6 +1,6 @@
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
- <timestamp>Sat Nov 10 15:37:00 2012</timestamp>
+ <timestamp>Thu Dec 27 13:49:53 2012</timestamp>
<block>
<key>options</key>
<param>
@@ -185,10 +185,10 @@
</param>
</block>
<block>
- <key>gr_multiply_xx</key>
+ <key>blocks_multiply_xx</key>
<param>
<key>id</key>
- <value>gr_multiply_xx_2_0</value>
+ <value>blocks_multiply_xx_2_0</value>
</param>
<param>
<key>_enabled</key>
@@ -216,10 +216,10 @@
</param>
</block>
<block>
- <key>gr_short_to_float</key>
+ <key>blocks_short_to_float</key>
<param>
<key>id</key>
- <value>gr_short_to_float_1_0</value>
+ <value>blocks_short_to_float_1_0</value>
</param>
<param>
<key>_enabled</key>
@@ -597,10 +597,10 @@
</param>
</block>
<block>
- <key>gr_sub_xx</key>
+ <key>blocks_sub_xx</key>
<param>
<key>id</key>
- <value>gr_sub_xx_0</value>
+ <value>blocks_sub_xx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -733,10 +733,10 @@
</param>
</block>
<block>
- <key>gr_add_xx</key>
+ <key>blocks_add_xx</key>
<param>
<key>id</key>
- <value>gr_add_xx_1</value>
+ <value>blocks_add_xx_1</value>
</param>
<param>
<key>_enabled</key>
@@ -765,37 +765,37 @@
</block>
<connection>
<source_block_id>random_source_x_0</source_block_id>
- <sink_block_id>gr_sub_xx_0</sink_block_id>
+ <sink_block_id>blocks_sub_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_1</source_block_id>
+ <source_block_id>blocks_add_xx_1</source_block_id>
<sink_block_id>wxgui_scopesink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_xx_2_0</source_block_id>
- <sink_block_id>gr_short_to_float_1_0</sink_block_id>
+ <source_block_id>blocks_multiply_xx_2_0</source_block_id>
+ <sink_block_id>blocks_short_to_float_1_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_short_to_float_1_0</source_block_id>
+ <source_block_id>blocks_short_to_float_1_0</source_block_id>
<sink_block_id>wxgui_numbersink2_3_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_0</source_block_id>
- <sink_block_id>gr_multiply_xx_2_0</sink_block_id>
+ <source_block_id>blocks_sub_xx_0</source_block_id>
+ <sink_block_id>blocks_multiply_xx_2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_0</source_block_id>
- <sink_block_id>gr_multiply_xx_2_0</sink_block_id>
+ <source_block_id>blocks_sub_xx_0</source_block_id>
+ <sink_block_id>blocks_multiply_xx_2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
@@ -812,20 +812,20 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_1</source_block_id>
+ <source_block_id>blocks_add_xx_1</source_block_id>
<sink_block_id>trellis_pccc_decoder_combined_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>trellis_pccc_decoder_combined_xx_0</source_block_id>
- <sink_block_id>gr_sub_xx_0</sink_block_id>
+ <sink_block_id>blocks_sub_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
<source_block_id>analog_noise_source_x_0</source_block_id>
- <sink_block_id>gr_add_xx_1</sink_block_id>
+ <sink_block_id>blocks_add_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
@@ -837,7 +837,7 @@
</connection>
<connection>
<source_block_id>digital_chunks_to_symbols_xx_0</source_block_id>
- <sink_block_id>gr_add_xx_1</sink_block_id>
+ <sink_block_id>blocks_add_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-trellis/src/examples/grc/pccc1.grc b/gr-trellis/examples/grc/pccc1.grc
index c111ebd3ec..1bc0e189d0 100644
--- a/gr-trellis/src/examples/grc/pccc1.grc
+++ b/gr-trellis/examples/grc/pccc1.grc
@@ -185,10 +185,10 @@
</param>
</block>
<block>
- <key>gr_multiply_xx</key>
+ <key>blocks_multiply_xx</key>
<param>
<key>id</key>
- <value>gr_multiply_xx_2_0</value>
+ <value>blocks_multiply_xx_2_0</value>
</param>
<param>
<key>_enabled</key>
@@ -216,10 +216,10 @@
</param>
</block>
<block>
- <key>gr_short_to_float</key>
+ <key>blocks_short_to_float</key>
<param>
<key>id</key>
- <value>gr_short_to_float_1_0</value>
+ <value>blocks_short_to_float_1_0</value>
</param>
<param>
<key>_enabled</key>
@@ -444,10 +444,10 @@
</param>
</block>
<block>
- <key>gr_sub_xx</key>
+ <key>blocks_sub_xx</key>
<param>
<key>id</key>
- <value>gr_sub_xx_0</value>
+ <value>blocks_sub_xx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -678,10 +678,10 @@
</param>
</block>
<block>
- <key>gr_add_xx</key>
+ <key>blocks_add_xx</key>
<param>
<key>id</key>
- <value>gr_add_xx_1</value>
+ <value>blocks_add_xx_1</value>
</param>
<param>
<key>_enabled</key>
@@ -784,42 +784,42 @@
</block>
<connection>
<source_block_id>random_source_x_0</source_block_id>
- <sink_block_id>gr_sub_xx_0</sink_block_id>
+ <sink_block_id>blocks_sub_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_1</source_block_id>
+ <source_block_id>blocks_add_xx_1</source_block_id>
<sink_block_id>wxgui_scopesink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_xx_2_0</source_block_id>
- <sink_block_id>gr_short_to_float_1_0</sink_block_id>
+ <source_block_id>blocks_multiply_xx_2_0</source_block_id>
+ <sink_block_id>blocks_short_to_float_1_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_short_to_float_1_0</source_block_id>
+ <source_block_id>blocks_short_to_float_1_0</source_block_id>
<sink_block_id>wxgui_numbersink2_3_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_0</source_block_id>
- <sink_block_id>gr_multiply_xx_2_0</sink_block_id>
+ <source_block_id>blocks_sub_xx_0</source_block_id>
+ <sink_block_id>blocks_multiply_xx_2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_0</source_block_id>
- <sink_block_id>gr_multiply_xx_2_0</sink_block_id>
+ <source_block_id>blocks_sub_xx_0</source_block_id>
+ <sink_block_id>blocks_multiply_xx_2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_1</source_block_id>
+ <source_block_id>blocks_add_xx_1</source_block_id>
<sink_block_id>trellis_metrics_x_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -844,7 +844,7 @@
</connection>
<connection>
<source_block_id>trellis_pccc_decoder_x_0</source_block_id>
- <sink_block_id>gr_sub_xx_0</sink_block_id>
+ <sink_block_id>blocks_sub_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
@@ -856,13 +856,13 @@
</connection>
<connection>
<source_block_id>digital_chunks_to_symbols_xx_0</source_block_id>
- <sink_block_id>gr_add_xx_1</sink_block_id>
+ <sink_block_id>blocks_add_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_noise_source_x_0</source_block_id>
- <sink_block_id>gr_add_xx_1</sink_block_id>
+ <sink_block_id>blocks_add_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
diff --git a/gr-trellis/src/examples/grc/readme.txt b/gr-trellis/examples/grc/readme.txt
index a5261ac0b2..a5261ac0b2 100644
--- a/gr-trellis/src/examples/grc/readme.txt
+++ b/gr-trellis/examples/grc/readme.txt
diff --git a/gr-trellis/src/examples/grc/sccc.grc b/gr-trellis/examples/grc/sccc.grc
index 36657f5441..abfbeb8b81 100644
--- a/gr-trellis/src/examples/grc/sccc.grc
+++ b/gr-trellis/examples/grc/sccc.grc
@@ -169,10 +169,10 @@
</param>
</block>
<block>
- <key>gr_sub_xx</key>
+ <key>blocks_sub_xx</key>
<param>
<key>id</key>
- <value>gr_sub_xx_0</value>
+ <value>blocks_sub_xx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -200,10 +200,10 @@
</param>
</block>
<block>
- <key>gr_multiply_xx</key>
+ <key>blocks_multiply_xx</key>
<param>
<key>id</key>
- <value>gr_multiply_xx_2_0</value>
+ <value>blocks_multiply_xx_2_0</value>
</param>
<param>
<key>_enabled</key>
@@ -231,10 +231,10 @@
</param>
</block>
<block>
- <key>gr_short_to_float</key>
+ <key>blocks_short_to_float</key>
<param>
<key>id</key>
- <value>gr_short_to_float_1_0</value>
+ <value>blocks_short_to_float_1_0</value>
</param>
<param>
<key>_enabled</key>
@@ -659,10 +659,10 @@
</param>
</block>
<block>
- <key>gr_add_xx</key>
+ <key>blocks_add_xx</key>
<param>
<key>id</key>
- <value>gr_add_xx_1</value>
+ <value>blocks_add_xx_1</value>
</param>
<param>
<key>_enabled</key>
@@ -765,12 +765,12 @@
</block>
<connection>
<source_block_id>random_source_x_0</source_block_id>
- <sink_block_id>gr_sub_xx_0</sink_block_id>
+ <sink_block_id>blocks_sub_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_1</source_block_id>
+ <source_block_id>blocks_add_xx_1</source_block_id>
<sink_block_id>wxgui_scopesink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -788,38 +788,38 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_1</source_block_id>
+ <source_block_id>blocks_add_xx_1</source_block_id>
<sink_block_id>trellis_sccc_decoder_combined_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>trellis_sccc_decoder_combined_xx_0</source_block_id>
- <sink_block_id>gr_sub_xx_0</sink_block_id>
+ <sink_block_id>blocks_sub_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_xx_2_0</source_block_id>
- <sink_block_id>gr_short_to_float_1_0</sink_block_id>
+ <source_block_id>blocks_multiply_xx_2_0</source_block_id>
+ <sink_block_id>blocks_short_to_float_1_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_short_to_float_1_0</source_block_id>
+ <source_block_id>blocks_short_to_float_1_0</source_block_id>
<sink_block_id>wxgui_numbersink2_3_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_0</source_block_id>
- <sink_block_id>gr_multiply_xx_2_0</sink_block_id>
+ <source_block_id>blocks_sub_xx_0</source_block_id>
+ <sink_block_id>blocks_multiply_xx_2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_0</source_block_id>
- <sink_block_id>gr_multiply_xx_2_0</sink_block_id>
+ <source_block_id>blocks_sub_xx_0</source_block_id>
+ <sink_block_id>blocks_multiply_xx_2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
@@ -831,13 +831,13 @@
</connection>
<connection>
<source_block_id>analog_noise_source_x_0</source_block_id>
- <sink_block_id>gr_add_xx_1</sink_block_id>
+ <sink_block_id>blocks_add_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
<source_block_id>digital_chunks_to_symbols_xx_0</source_block_id>
- <sink_block_id>gr_add_xx_1</sink_block_id>
+ <sink_block_id>blocks_add_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-trellis/src/examples/grc/sccc1.grc b/gr-trellis/examples/grc/sccc1.grc
index 17626e3dce..906ca25389 100644
--- a/gr-trellis/src/examples/grc/sccc1.grc
+++ b/gr-trellis/examples/grc/sccc1.grc
@@ -357,10 +357,10 @@
</param>
</block>
<block>
- <key>gr_sub_xx</key>
+ <key>blocks_sub_xx</key>
<param>
<key>id</key>
- <value>gr_sub_xx_0</value>
+ <value>blocks_sub_xx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -388,10 +388,10 @@
</param>
</block>
<block>
- <key>gr_multiply_xx</key>
+ <key>blocks_multiply_xx</key>
<param>
<key>id</key>
- <value>gr_multiply_xx_2_0</value>
+ <value>blocks_multiply_xx_2_0</value>
</param>
<param>
<key>_enabled</key>
@@ -419,10 +419,10 @@
</param>
</block>
<block>
- <key>gr_short_to_float</key>
+ <key>blocks_short_to_float</key>
<param>
<key>id</key>
- <value>gr_short_to_float_1_0</value>
+ <value>blocks_short_to_float_1_0</value>
</param>
<param>
<key>_enabled</key>
@@ -717,10 +717,10 @@
</param>
</block>
<block>
- <key>gr_add_xx</key>
+ <key>blocks_add_xx</key>
<param>
<key>id</key>
- <value>gr_add_xx_1</value>
+ <value>blocks_add_xx_1</value>
</param>
<param>
<key>_enabled</key>
@@ -784,12 +784,12 @@
</block>
<connection>
<source_block_id>random_source_x_0</source_block_id>
- <sink_block_id>gr_sub_xx_0</sink_block_id>
+ <sink_block_id>blocks_sub_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_1</source_block_id>
+ <source_block_id>blocks_add_xx_1</source_block_id>
<sink_block_id>wxgui_scopesink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -807,31 +807,31 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_xx_2_0</source_block_id>
- <sink_block_id>gr_short_to_float_1_0</sink_block_id>
+ <source_block_id>blocks_multiply_xx_2_0</source_block_id>
+ <sink_block_id>blocks_short_to_float_1_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_short_to_float_1_0</source_block_id>
+ <source_block_id>blocks_short_to_float_1_0</source_block_id>
<sink_block_id>wxgui_numbersink2_3_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_0</source_block_id>
- <sink_block_id>gr_multiply_xx_2_0</sink_block_id>
+ <source_block_id>blocks_sub_xx_0</source_block_id>
+ <sink_block_id>blocks_multiply_xx_2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_sub_xx_0</source_block_id>
- <sink_block_id>gr_multiply_xx_2_0</sink_block_id>
+ <source_block_id>blocks_sub_xx_0</source_block_id>
+ <sink_block_id>blocks_multiply_xx_2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
- <source_block_id>gr_add_xx_1</source_block_id>
+ <source_block_id>blocks_add_xx_1</source_block_id>
<sink_block_id>trellis_metrics_x_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -844,7 +844,7 @@
</connection>
<connection>
<source_block_id>trellis_sccc_decoder_x_0</source_block_id>
- <sink_block_id>gr_sub_xx_0</sink_block_id>
+ <sink_block_id>blocks_sub_xx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
@@ -856,13 +856,13 @@
</connection>
<connection>
<source_block_id>digital_chunks_to_symbols_xx_0</source_block_id>
- <sink_block_id>gr_add_xx_1</sink_block_id>
+ <sink_block_id>blocks_add_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_noise_source_x_0</source_block_id>
- <sink_block_id>gr_add_xx_1</sink_block_id>
+ <sink_block_id>blocks_add_xx_1</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
diff --git a/gr-trellis/src/examples/python/CMakeLists.txt b/gr-trellis/examples/python/CMakeLists.txt
index e2c7e70ff7..e2c7e70ff7 100644
--- a/gr-trellis/src/examples/python/CMakeLists.txt
+++ b/gr-trellis/examples/python/CMakeLists.txt
diff --git a/gr-trellis/src/examples/python/README b/gr-trellis/examples/python/README
index d51f231ac3..d51f231ac3 100644
--- a/gr-trellis/src/examples/python/README
+++ b/gr-trellis/examples/python/README
diff --git a/gr-trellis/src/examples/python/fsm_files/awgn1o2_128.fsm b/gr-trellis/examples/python/fsm_files/awgn1o2_128.fsm
index 4b47007c50..4b47007c50 100644
--- a/gr-trellis/src/examples/python/fsm_files/awgn1o2_128.fsm
+++ b/gr-trellis/examples/python/fsm_files/awgn1o2_128.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/awgn1o2_16.fsm b/gr-trellis/examples/python/fsm_files/awgn1o2_16.fsm
index cdab41359e..cdab41359e 100644
--- a/gr-trellis/src/examples/python/fsm_files/awgn1o2_16.fsm
+++ b/gr-trellis/examples/python/fsm_files/awgn1o2_16.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/awgn1o2_4.fsm b/gr-trellis/examples/python/fsm_files/awgn1o2_4.fsm
index fb316b5ef8..fb316b5ef8 100644
--- a/gr-trellis/src/examples/python/fsm_files/awgn1o2_4.fsm
+++ b/gr-trellis/examples/python/fsm_files/awgn1o2_4.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/awgn1o2_8.fsm b/gr-trellis/examples/python/fsm_files/awgn1o2_8.fsm
index 604bac6c2c..604bac6c2c 100644
--- a/gr-trellis/src/examples/python/fsm_files/awgn1o2_8.fsm
+++ b/gr-trellis/examples/python/fsm_files/awgn1o2_8.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_16.fsm b/gr-trellis/examples/python/fsm_files/awgn2o3_16.fsm
index 9630cd9afb..9630cd9afb 100644
--- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_16.fsm
+++ b/gr-trellis/examples/python/fsm_files/awgn2o3_16.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4.fsm b/gr-trellis/examples/python/fsm_files/awgn2o3_4.fsm
index 3ac57be18d..3ac57be18d 100644
--- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4.fsm
+++ b/gr-trellis/examples/python/fsm_files/awgn2o3_4.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msb.fsm b/gr-trellis/examples/python/fsm_files/awgn2o3_4_msb.fsm
index d834c52718..d834c52718 100644
--- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msb.fsm
+++ b/gr-trellis/examples/python/fsm_files/awgn2o3_4_msb.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msbG.fsm b/gr-trellis/examples/python/fsm_files/awgn2o3_4_msbG.fsm
index 8956c53da2..8956c53da2 100644
--- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_4_msbG.fsm
+++ b/gr-trellis/examples/python/fsm_files/awgn2o3_4_msbG.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o3_8.fsm b/gr-trellis/examples/python/fsm_files/awgn2o3_8.fsm
index 34deeb68cb..34deeb68cb 100644
--- a/gr-trellis/src/examples/python/fsm_files/awgn2o3_8.fsm
+++ b/gr-trellis/examples/python/fsm_files/awgn2o3_8.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/awgn2o4_4.fsm b/gr-trellis/examples/python/fsm_files/awgn2o4_4.fsm
index a895be8965..a895be8965 100644
--- a/gr-trellis/src/examples/python/fsm_files/awgn2o4_4.fsm
+++ b/gr-trellis/examples/python/fsm_files/awgn2o4_4.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/disconnected.fsm b/gr-trellis/examples/python/fsm_files/disconnected.fsm
index 847963e7b2..847963e7b2 100644
--- a/gr-trellis/src/examples/python/fsm_files/disconnected.fsm
+++ b/gr-trellis/examples/python/fsm_files/disconnected.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/irregular.fsm b/gr-trellis/examples/python/fsm_files/irregular.fsm
index 80b82b889d..80b82b889d 100644
--- a/gr-trellis/src/examples/python/fsm_files/irregular.fsm
+++ b/gr-trellis/examples/python/fsm_files/irregular.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/joint_16_16.fsm b/gr-trellis/examples/python/fsm_files/joint_16_16.fsm
index 293ff4e7c6..293ff4e7c6 100644
--- a/gr-trellis/src/examples/python/fsm_files/joint_16_16.fsm
+++ b/gr-trellis/examples/python/fsm_files/joint_16_16.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/joint_4_16.fsm b/gr-trellis/examples/python/fsm_files/joint_4_16.fsm
index 427a182071..427a182071 100644
--- a/gr-trellis/src/examples/python/fsm_files/joint_4_16.fsm
+++ b/gr-trellis/examples/python/fsm_files/joint_4_16.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/rep3.fsm b/gr-trellis/examples/python/fsm_files/rep3.fsm
index ef1bd1f025..ef1bd1f025 100644
--- a/gr-trellis/src/examples/python/fsm_files/rep3.fsm
+++ b/gr-trellis/examples/python/fsm_files/rep3.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/rep5.fsm b/gr-trellis/examples/python/fsm_files/rep5.fsm
index 2aa5d77cfb..2aa5d77cfb 100644
--- a/gr-trellis/src/examples/python/fsm_files/rep5.fsm
+++ b/gr-trellis/examples/python/fsm_files/rep5.fsm
diff --git a/gr-trellis/src/examples/python/fsm_files/simple.fsm b/gr-trellis/examples/python/fsm_files/simple.fsm
index f27f6b4b05..f27f6b4b05 100644
--- a/gr-trellis/src/examples/python/fsm_files/simple.fsm
+++ b/gr-trellis/examples/python/fsm_files/simple.fsm
diff --git a/gr-trellis/src/examples/python/fsm_utils.py b/gr-trellis/examples/python/fsm_utils.py
index 06855ea775..06855ea775 100755
--- a/gr-trellis/src/examples/python/fsm_utils.py
+++ b/gr-trellis/examples/python/fsm_utils.py
diff --git a/gr-trellis/src/examples/python/test_cpm.py b/gr-trellis/examples/python/test_cpm.py
index 8448da2b4f..8d1e2024c1 100755
--- a/gr-trellis/src/examples/python/test_cpm.py
+++ b/gr-trellis/examples/python/test_cpm.py
@@ -95,18 +95,18 @@ def run_test(seed,blocksize):
##################################################
random_source_x_0 = gr.vector_source_b(data.tolist(), False)
digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bf((-1, 1), 1)
- gr_interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff(Q, p)
- gr_frequency_modulator_fc_0 = analog.frequency_modulator_fc(2*math.pi*h*(1.0/Q))
+ filter_interp_fir_filter_xxx_0 = filter.interp_fir_filter_fff(Q, p)
+ analog_frequency_modulator_fc_0 = analog.frequency_modulator_fc(2*math.pi*h*(1.0/Q))
- gr_add_vxx_0 = blocks.add_vcc(1)
- gr_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, (N0/2.0)**0.5, -long(seed))
+ blocks_add_vxx_0 = blocks.add_vcc(1)
+ analog_noise_source_x_0 = analog.noise_source_c(analog.GR_GAUSSIAN, (N0/2.0)**0.5, -long(seed))
- gr_multiply_vxx_0 = blocks.multiply_vcc(1)
- gr_sig_source_x_0 = analog.sig_source_c(Q, analog.GR_COS_WAVE, -f0T, 1, 0)
+ blokcs_multiply_vxx_0 = blocks.multiply_vcc(1)
+ analog_sig_source_x_0 = analog.sig_source_c(Q, analog.GR_COS_WAVE, -f0T, 1, 0)
# only works for N=2, do it manually for N>2...
- gr_fir_filter_xxx_0_0 = filter.fir_filter_ccc(Q, MF[0].conjugate())
- gr_fir_filter_xxx_0_0_0 = filter.fir_filter_ccc(Q, MF[1].conjugate())
- gr_streams_to_stream_0 = blocks.streams_to_stream(gr.sizeof_gr_complex*1, int(N))
+ filter_fir_filter_xxx_0_0 = filter.fir_filter_ccc(Q, MF[0].conjugate())
+ filter_fir_filter_xxx_0_0_0 = filter.fir_filter_ccc(Q, MF[1].conjugate())
+ blocks_streams_to_stream_0 = blocks.streams_to_stream(gr.sizeof_gr_complex*1, int(N))
gr_skiphead_0 = gr.skiphead(gr.sizeof_gr_complex*1, int(N*(1+0)))
viterbi = trellis.viterbi_combined_cb(f, head+blocksize+tail, 0, -1, int(N),
constellation, digital.TRELLIS_EUCLIDEAN)
@@ -117,17 +117,17 @@ def run_test(seed,blocksize):
# Connections
##################################################
tb.connect((random_source_x_0, 0), (digital_chunks_to_symbols_xx_0, 0))
- tb.connect((digital_chunks_to_symbols_xx_0, 0), (gr_interp_fir_filter_xxx_0, 0))
- tb.connect((gr_interp_fir_filter_xxx_0, 0), (gr_frequency_modulator_fc_0, 0))
- tb.connect((gr_frequency_modulator_fc_0, 0), (gr_add_vxx_0, 0))
- tb.connect((gr_noise_source_x_0, 0), (gr_add_vxx_0, 1))
- tb.connect((gr_add_vxx_0, 0), (gr_multiply_vxx_0, 0))
- tb.connect((gr_sig_source_x_0, 0), (gr_multiply_vxx_0, 1))
- tb.connect((gr_multiply_vxx_0, 0), (gr_fir_filter_xxx_0_0, 0))
- tb.connect((gr_multiply_vxx_0, 0), (gr_fir_filter_xxx_0_0_0, 0))
- tb.connect((gr_fir_filter_xxx_0_0, 0), (gr_streams_to_stream_0, 0))
- tb.connect((gr_fir_filter_xxx_0_0_0, 0), (gr_streams_to_stream_0, 1))
- tb.connect((gr_streams_to_stream_0, 0), (gr_skiphead_0, 0))
+ tb.connect((digital_chunks_to_symbols_xx_0, 0), (filter_interp_fir_filter_xxx_0, 0))
+ tb.connect((filter_interp_fir_filter_xxx_0, 0), (analog_frequency_modulator_fc_0, 0))
+ tb.connect((analog_frequency_modulator_fc_0, 0), (blocks_add_vxx_0, 0))
+ tb.connect((analog_noise_source_x_0, 0), (blocks_add_vxx_0, 1))
+ tb.connect((blocks_add_vxx_0, 0), (blocks_multiply_vxx_0, 0))
+ tb.connect((analog_sig_source_x_0, 0), (blocks_multiply_vxx_0, 1))
+ tb.connect((blocks_multiply_vxx_0, 0), (filter_fir_filter_xxx_0_0, 0))
+ tb.connect((blocks_multiply_vxx_0, 0), (filter_fir_filter_xxx_0_0_0, 0))
+ tb.connect((filter_fir_filter_xxx_0_0, 0), (blocks_streams_to_stream_0, 0))
+ tb.connect((filter_fir_filter_xxx_0_0_0, 0), (blocks_streams_to_stream_0, 1))
+ tb.connect((blocks_streams_to_stream_0, 0), (gr_skiphead_0, 0))
tb.connect((gr_skiphead_0, 0), (viterbi, 0))
tb.connect((viterbi, 0), (gr_vector_sink_x_0, 0))
diff --git a/gr-trellis/src/examples/python/test_pccc_turbo1.py b/gr-trellis/examples/python/test_pccc_turbo1.py
index 121659ccf5..121659ccf5 100755
--- a/gr-trellis/src/examples/python/test_pccc_turbo1.py
+++ b/gr-trellis/examples/python/test_pccc_turbo1.py
diff --git a/gr-trellis/src/examples/python/test_sccc_hard.py b/gr-trellis/examples/python/test_sccc_hard.py
index 8676a6064d..8676a6064d 100755
--- a/gr-trellis/src/examples/python/test_sccc_hard.py
+++ b/gr-trellis/examples/python/test_sccc_hard.py
diff --git a/gr-trellis/src/examples/python/test_sccc_soft.py b/gr-trellis/examples/python/test_sccc_soft.py
index 1885934a46..1885934a46 100755
--- a/gr-trellis/src/examples/python/test_sccc_soft.py
+++ b/gr-trellis/examples/python/test_sccc_soft.py
diff --git a/gr-trellis/src/examples/python/test_sccc_turbo.py b/gr-trellis/examples/python/test_sccc_turbo.py
index 677c07a05c..677c07a05c 100755
--- a/gr-trellis/src/examples/python/test_sccc_turbo.py
+++ b/gr-trellis/examples/python/test_sccc_turbo.py
diff --git a/gr-trellis/src/examples/python/test_sccc_turbo1.py b/gr-trellis/examples/python/test_sccc_turbo1.py
index 62a0b6e318..62a0b6e318 100755
--- a/gr-trellis/src/examples/python/test_sccc_turbo1.py
+++ b/gr-trellis/examples/python/test_sccc_turbo1.py
diff --git a/gr-trellis/src/examples/python/test_sccc_turbo2.py b/gr-trellis/examples/python/test_sccc_turbo2.py
index 510748a68a..510748a68a 100755
--- a/gr-trellis/src/examples/python/test_sccc_turbo2.py
+++ b/gr-trellis/examples/python/test_sccc_turbo2.py
diff --git a/gr-trellis/src/examples/python/test_tcm.py b/gr-trellis/examples/python/test_tcm.py
index aca06f783e..aca06f783e 100755
--- a/gr-trellis/src/examples/python/test_tcm.py
+++ b/gr-trellis/examples/python/test_tcm.py
diff --git a/gr-trellis/src/examples/python/test_tcm_bit.py b/gr-trellis/examples/python/test_tcm_bit.py
index 4438db91ac..4438db91ac 100755
--- a/gr-trellis/src/examples/python/test_tcm_bit.py
+++ b/gr-trellis/examples/python/test_tcm_bit.py
diff --git a/gr-trellis/src/examples/python/test_tcm_combined.py b/gr-trellis/examples/python/test_tcm_combined.py
index a0cd58c6df..a0cd58c6df 100755
--- a/gr-trellis/src/examples/python/test_tcm_combined.py
+++ b/gr-trellis/examples/python/test_tcm_combined.py
diff --git a/gr-trellis/src/examples/python/test_tcm_parallel.py b/gr-trellis/examples/python/test_tcm_parallel.py
index 0bd6f739c1..0bd6f739c1 100755
--- a/gr-trellis/src/examples/python/test_tcm_parallel.py
+++ b/gr-trellis/examples/python/test_tcm_parallel.py
diff --git a/gr-trellis/src/examples/python/test_turbo_equalization.py b/gr-trellis/examples/python/test_turbo_equalization.py
index b0889bdcef..b0889bdcef 100755
--- a/gr-trellis/src/examples/python/test_turbo_equalization.py
+++ b/gr-trellis/examples/python/test_turbo_equalization.py
diff --git a/gr-trellis/src/examples/python/test_turbo_equalization1.py b/gr-trellis/examples/python/test_turbo_equalization1.py
index ae7e3e374b..ae7e3e374b 100755
--- a/gr-trellis/src/examples/python/test_turbo_equalization1.py
+++ b/gr-trellis/examples/python/test_turbo_equalization1.py
diff --git a/gr-trellis/src/examples/python/test_turbo_equalization2.py b/gr-trellis/examples/python/test_turbo_equalization2.py
index eed5675fe5..eed5675fe5 100755
--- a/gr-trellis/src/examples/python/test_turbo_equalization2.py
+++ b/gr-trellis/examples/python/test_turbo_equalization2.py
diff --git a/gr-trellis/src/examples/python/test_viterbi_equalization.py b/gr-trellis/examples/python/test_viterbi_equalization.py
index 21236d2870..21236d2870 100755
--- a/gr-trellis/src/examples/python/test_viterbi_equalization.py
+++ b/gr-trellis/examples/python/test_viterbi_equalization.py
diff --git a/gr-trellis/src/examples/python/test_viterbi_equalization1.py b/gr-trellis/examples/python/test_viterbi_equalization1.py
index df46046ae3..df46046ae3 100755
--- a/gr-trellis/src/examples/python/test_viterbi_equalization1.py
+++ b/gr-trellis/examples/python/test_viterbi_equalization1.py
diff --git a/gr-trellis/include/trellis/CMakeLists.txt b/gr-trellis/include/trellis/CMakeLists.txt
new file mode 100644
index 0000000000..294481368a
--- /dev/null
+++ b/gr-trellis/include/trellis/CMakeLists.txt
@@ -0,0 +1,103 @@
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+# generate helper scripts to expand templated files
+########################################################################
+include(GrPython)
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
+#!${PYTHON_EXECUTABLE}
+
+import sys, os, re
+sys.path.append('${GR_CORE_PYTHONPATH}')
+os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
+os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
+
+if __name__ == '__main__':
+ import build_utils
+ root, inp = sys.argv[1:3]
+ for sig in sys.argv[3:]:
+ name = re.sub ('X+', sig, root)
+ d = build_utils.standard_dict2(name, sig, 'trellis')
+ build_utils.expand_template(d, inp)
+
+")
+
+macro(expand_h root)
+ #make a list of all the generated files
+ unset(expanded_files_h)
+ foreach(sig ${ARGN})
+ string(REGEX REPLACE "X+" ${sig} name ${root})
+ list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
+ endforeach(sig)
+
+ #create a command to generate the files
+ add_custom_command(
+ OUTPUT ${expanded_files_h}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}.h.t ${ARGN}
+ )
+
+ #install rules for the generated h files
+ list(APPEND generated_includes ${expanded_files_h})
+endmacro(expand_h)
+
+########################################################################
+# Invoke macro to generate various sources
+#######################################################################
+expand_h(encoder_XX bb bs bi ss si ii)
+expand_h(sccc_encoder_XX bb bs bi ss si ii)
+expand_h(pccc_encoder_XX bb bs bi ss si ii)
+expand_h(metrics_X s i f c)
+expand_h(viterbi_X b s i)
+expand_h(viterbi_combined_XX sb ss si ib is ii fb fs fi cb cs ci)
+expand_h(sccc_decoder_X b s i)
+expand_h(sccc_decoder_combined_XX fb fs fi cb cs ci)
+expand_h(pccc_decoder_X b s i)
+expand_h(pccc_decoder_combined_XX fb fs fi cb cs ci)
+
+add_custom_target(trellis_generated_includes DEPENDS
+ ${generated_includes}
+)
+MESSAGE(STATUS "GENERATED INCLUDES: ${trellis_generated_includes}")
+
+########################################################################
+# Install header files
+########################################################################
+install(FILES
+ ${trellis_generated_includes}
+ api.h
+ base.h
+ calc_metric.h
+ constellation_metrics_cf.h
+ core_algorithms.h
+ fsm.h
+ interleaver.h
+ permutation.h
+ quicksort_index.h
+ siso_type.h
+ siso_combined_f.h
+ siso_f.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/trellis
+ COMPONENT "trellis_devel"
+)
+
diff --git a/gr-trellis/src/lib/trellis_api.h b/gr-trellis/include/trellis/api.h
index c09b340d6d..c09b340d6d 100644
--- a/gr-trellis/src/lib/trellis_api.h
+++ b/gr-trellis/include/trellis/api.h
diff --git a/gr-trellis/src/lib/base.h b/gr-trellis/include/trellis/base.h
index aa407cbec1..c69500d0df 100644
--- a/gr-trellis/src/lib/base.h
+++ b/gr-trellis/include/trellis/base.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002 Free Software Foundation, Inc.
+ * Copyright 2002,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,14 +25,19 @@
#include <vector>
-/*!
- * \brief change base
- */
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief change base
+ */
+ bool dec2base(unsigned int num, int base, std::vector<int> &s);
+ bool dec2bases(unsigned int num, const std::vector<int> &bases, std::vector<int> &s);
+ unsigned int base2dec(const std::vector<int> &s, int base);
+ unsigned int bases2dec(const std::vector<int> &s, const std::vector<int> &bases);
-bool dec2base(unsigned int num, int base, std::vector<int> &s);
-bool dec2bases(unsigned int num, const std::vector<int> &bases, std::vector<int> &s);
-unsigned int base2dec(const std::vector<int> &s, int base);
-unsigned int bases2dec(const std::vector<int> &s, const std::vector<int> &bases);
+ } /* namespace trellis */
+} /* namespace gr */
-#endif
+#endif /* INCLUDED_TRELLIS_BASE_H */
diff --git a/gr-trellis/include/trellis/calc_metric.h b/gr-trellis/include/trellis/calc_metric.h
new file mode 100644
index 0000000000..b39267dc84
--- /dev/null
+++ b/gr-trellis/include/trellis/calc_metric.h
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_CALC_METRIC_H
+#define INCLUDED_CALC_METRIC_H
+
+#include <vector>
+#include <gr_complex.h>
+#include <digital/metric_type.h>
+
+namespace gr {
+ namespace trellis {
+
+ template <class T>
+ void calc_metric(int O, int D, const std::vector<T> &TABLE, const T *input,
+ float *metric, digital::trellis_metric_type_t type);
+
+ /*
+ void calc_metric(int O, int D, const std::vector<short> &TABLE, const short *input,
+ float *metric, digital::trellis_metric_type_t type);
+
+ void calc_metric(int O, int D, const std::vector<int> &TABLE, const int *input,
+ float *metric, digital::trellis_metric_type_t type);
+
+ void calc_metric(int O, int D, const std::vector<float> &TABLE, const float *input,
+ float *metric, digital::trellis_metric_type_t type);
+ */
+
+ void calc_metric(int O, int D, const std::vector<gr_complex> &TABLE, const gr_complex *input,
+ float *metric, digital::trellis_metric_type_t type);
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_CALC_METRIC_H */
diff --git a/gr-trellis/include/trellis/constellation_metrics_cf.h b/gr-trellis/include/trellis/constellation_metrics_cf.h
new file mode 100644
index 0000000000..2dca6f7b5b
--- /dev/null
+++ b/gr-trellis/include/trellis/constellation_metrics_cf.h
@@ -0,0 +1,51 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H
+#define INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H
+
+#include <trellis/api.h>
+#include <gr_block.h>
+#include <digital/constellation.h>
+#include <digital/metric_type.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief Evaluate metrics for use by the Viterbi algorithm.
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API constellation_metrics_cf : virtual public gr_block
+ {
+ public:
+ // gr::trellis::constellation_metrics_cf::sptr
+ typedef boost::shared_ptr<constellation_metrics_cf> sptr;
+
+ static sptr make(digital::constellation_sptr constellation,
+ digital::trellis_metric_type_t TYPE);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H */
diff --git a/gr-trellis/include/trellis/core_algorithms.h b/gr-trellis/include/trellis/core_algorithms.h
new file mode 100644
index 0000000000..2292845629
--- /dev/null
+++ b/gr-trellis/include/trellis/core_algorithms.h
@@ -0,0 +1,124 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_CORE_ALGORITHMS_H
+#define INCLUDED_CORE_ALGORITHMS_H
+
+#include <cmath>
+#include <vector>
+#include <digital/metric_type.h>
+#include <trellis/fsm.h>
+#include <trellis/interleaver.h>
+
+namespace gr {
+ namespace trellis {
+
+ float min(float a, float b);
+ float min_star(float a, float b);
+
+ template <class T>
+ void viterbi_algorithm(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ const float *in, T *out);
+
+ template <class Ti, class To>
+ void viterbi_algorithm_combined(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<Ti> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const Ti *in, To *out);
+
+ void siso_algorithm(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ bool POSTI, bool POSTO,
+ float (*p2mymin)(float,float),
+ const float *priori, const float *prioro, float *post);
+
+ template <class T>
+ void siso_algorithm_combined(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ bool POSTI, bool POSTO,
+ float (*p2mymin)(float,float),
+ int D,
+ const std::vector<T> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const float *priori, const T *observations, float *post);
+
+ template<class T>
+ void sccc_decoder(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength, int iterations,
+ float (*p2mymin)(float,float),
+ const float *iprioro, T *data);
+
+ template<class Ti, class To>
+ void sccc_decoder_combined(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength, int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<Ti> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const Ti *observations, To *data);
+
+ template<class T>
+ void pccc_decoder(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength, int iterations,
+ float (*p2mymin)(float,float),
+ const float *cprioro, T *data);
+
+ template<class Ti, class To>
+ void pccc_decoder_combined(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength, int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<Ti> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const Ti *observations, To *data);
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_CORE_ALGORITHMS_H */
diff --git a/gr-trellis/src/lib/trellis_encoder_XX.h.t b/gr-trellis/include/trellis/encoder_XX.h.t
index 7c4250a929..c10b283f87 100644
--- a/gr-trellis/src/lib/trellis_encoder_XX.h.t
+++ b/gr-trellis/include/trellis/encoder_XX.h.t
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,34 +25,30 @@
#ifndef @GUARD_NAME@
#define @GUARD_NAME@
-#include <trellis_api.h>
-#include "fsm.h"
+#include <trellis/api.h>
+#include <trellis/fsm.h>
#include <gr_sync_block.h>
-class @NAME@;
-typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
+namespace gr {
+ namespace trellis {
-TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (const fsm &FSM, int ST);
+ /*!
+ * \brief Convolutional encoder.
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
-/*!
- * \brief Convolutional encoder.
- * \ingroup coding_blk
- */
-class TRELLIS_API @NAME@ : public gr_sync_block
-{
-private:
- friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (const fsm &FSM, int ST);
- fsm d_FSM;
- int d_ST;
- @NAME@ (const fsm &FSM, int ST);
-
-public:
- fsm FSM () const { return d_FSM; }
- int ST () const { return d_ST; }
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
+ static sptr make(const fsm &FSM, int ST);
+
+ virtual fsm FSM() const = 0;
+ virtual int ST() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/trellis/fsm.h b/gr-trellis/include/trellis/fsm.h
new file mode 100644
index 0000000000..a69925c1c7
--- /dev/null
+++ b/gr-trellis/include/trellis/fsm.h
@@ -0,0 +1,191 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2011-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_FSM_H
+#define INCLUDED_TRELLIS_FSM_H
+
+#include <trellis/api.h>
+#include <vector>
+#include <iosfwd>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief Finite State Machine Specification class.
+ *
+ * An instance of this class represents a finite state machine
+ * specification (FSMS) rather than the FSM itself. It particular
+ * the state of the FSM is not stored within an instance of this
+ * class.
+ */
+ class TRELLIS_API fsm
+ {
+ private:
+ // Input alphabet cardinality.
+ int d_I;
+
+ // Number of states.
+ int d_S;
+
+ // Output alphabet cardinality.
+ int d_O;
+
+ // NS means Next State.
+ // next_state = d_NS[current_state * d_I + input_symbol]
+ std::vector<int> d_NS;
+
+ // OS means Output Symbol.
+ // output_symbol = d_OS[current_state * d_I + input_symbol]
+ std::vector<int> d_OS;
+
+ // PS means Previous State.
+ std::vector< std::vector<int> > d_PS;
+
+ // PI means Previous Input Symbol.
+ // d_PS[current_state][k] and d_PI[current_state][k], is a pair of the form
+ // (previous_state, previous_input_symbol) that could have produced the
+ // current state.
+ std::vector< std::vector<int> > d_PI;
+
+ // TM means Termination matrix.
+ // d_TMl[s*d_S+es] is the shortest number of steps to get from state s to
+ // state es.
+ std::vector<int> d_TMl;
+
+ // d_TMi[s*d_S+es] is the input symbol required to set off on the shortest
+ // path from state s to es.
+ std::vector<int> d_TMi;
+ void generate_PS_PI ();
+ void generate_TM ();
+ bool find_es(int es);
+
+ public:
+ /*!
+ * \brief Constructor to create an uninitialized FSMS.
+ */
+ fsm();
+
+ /*!
+ * \brief Constructor to copy an FSMS.
+ */
+ fsm(const fsm &FSM);
+
+ /*!
+ * \brief Constructor to to create an FSMS.
+ *
+ * \param I The number of possible input symbols.
+ * \param S The number of possible FSM states.
+ * \param O The number of possible output symbols.
+ * \param NS A mapping from (current state, input symbol) to next state.
+ * next_state = NS[current_state * I + input_symbol]
+ * \param OS A mapping from (current state, input symbol) to output symbol.
+ * output_symbol = OS[current_state * I + input_symbol]
+ *
+ */
+ fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS);
+
+ /*!
+ * \brief Constructor to create an FSMS from file contents.
+ *
+ * \param name filename
+ *
+ */
+ fsm(const char *name);
+
+ /*!
+ * \brief Creates an FSMS from the generator matrix of a (n, k) binary convolutional code.
+ *
+ * \param k ???
+ * \param n ???
+ * \param G ???
+ *
+ */
+ fsm(int k, int n, const std::vector<int> &G);
+
+ /*!
+ * \brief Creates an FSMS describing ISI.
+ *
+ * \param mod_size modulation size
+ * \param ch_length channel length
+ *
+ */
+ fsm(int mod_size, int ch_length);
+
+ /*!
+ * \brief Creates an FSMS describing the trellis for a CPM.
+ *
+ * \param P ???? h=K/P (relatively prime)
+ * \param M alphabet size
+ * \param L pulse duration
+ *
+ * This FSM is based on the paper by B. Rimoldi
+ * "A decomposition approach to CPM", IEEE Trans. Info Theory, March 1988
+ * See also my own notes at http://www.eecs.umich.edu/~anastas/docs/cpm.pdf
+ */
+ fsm(int P, int M, int L);
+
+ /*!
+ * \brief Creates an FSMS describing the joint trellis of two FSMs.
+ *
+ * \param FSM1 first FSMS
+ * \param FSM2 second FSMS
+ */
+ fsm(const fsm &FSM1, const fsm &FSM2);
+
+ /*!
+ * \brief Creates an FSMS representing n stages through the originial FSM (AKA radix-n FSM).
+ *
+ * \param FSM Original FSMs
+ * \param n Number of stages.
+ */
+ fsm(const fsm &FSM, int n);
+ int I() const { return d_I; }
+ int S() const { return d_S; }
+ int O() const { return d_O; }
+ const std::vector<int> & NS() const { return d_NS; }
+ const std::vector<int> & OS() const { return d_OS; }
+ const std::vector< std::vector<int> > & PS() const { return d_PS; }
+ const std::vector< std::vector<int> > & PI() const { return d_PI; }
+ const std::vector<int> & TMi() const { return d_TMi; }
+ const std::vector<int> & TMl() const { return d_TMl; }
+
+ /*!
+ * \brief Creates an svg image of the trellis representation.
+ *
+ * \param filename filename
+ * \param number_stages ????
+ */
+ void write_trellis_svg(std::string filename ,int number_stages);
+
+ /*!
+ * \brief Write the FSMS to a file.
+ *
+ * \param filename filename
+ */
+ void write_fsm_txt(std::string filename);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_FSM_H */
diff --git a/gr-trellis/src/lib/interleaver.h b/gr-trellis/include/trellis/interleaver.h
index fbd378d621..7465f17986 100644
--- a/gr-trellis/src/lib/interleaver.h
+++ b/gr-trellis/include/trellis/interleaver.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002 Free Software Foundation, Inc.
+ * Copyright 2002,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,27 +23,35 @@
#ifndef INCLUDED_TRELLIS_INTERLEAVER_H
#define INCLUDED_TRELLIS_INTERLEAVER_H
-#include <trellis_api.h>
+#include <trellis/api.h>
#include <vector>
-/*!
- * \brief INTERLEAVER class
- */
-class TRELLIS_API interleaver {
-private:
- int d_K;
- std::vector<int> d_INTER;
- std::vector<int> d_DEINTER;
-public:
- interleaver();
- interleaver(const interleaver & INTERLEAVER);
- interleaver(int K, const std::vector<int> & INTER);
- interleaver(const char *name);
- interleaver(int K, int seed);
- int K () const { return d_K; }
- const std::vector<int> & INTER () const { return d_INTER; }
- const std::vector<int> & DEINTER () const { return d_DEINTER; }
- void write_interleaver_txt(std::string filename);
-};
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief INTERLEAVER class
+ */
+ class TRELLIS_API interleaver
+ {
+ private:
+ int d_K;
+ std::vector<int> d_INTER;
+ std::vector<int> d_DEINTER;
+
+ public:
+ interleaver();
+ interleaver(const interleaver & INTERLEAVER);
+ interleaver(int K, const std::vector<int> & INTER);
+ interleaver(const char *name);
+ interleaver(int K, int seed);
+ int K () const { return d_K; }
+ const std::vector<int> & INTER() const { return d_INTER; }
+ const std::vector<int> & DEINTER() const { return d_DEINTER; }
+ void write_interleaver_txt(std::string filename);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
-#endif
+#endif /* INCLUDED_TRELLIS_INTERLEAVER_H */
diff --git a/gr-trellis/include/trellis/metrics_X.h.t b/gr-trellis/include/trellis/metrics_X.h.t
new file mode 100644
index 0000000000..5605130c24
--- /dev/null
+++ b/gr-trellis/include/trellis/metrics_X.h.t
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/api.h>
+#include <trellis/calc_metric.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief Evaluate metrics for use by the Viterbi algorithm.
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public gr_block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(int O, int D, const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t TYPE);
+
+ virtual int O() const = 0;
+ virtual int D() const = 0;
+ virtual digital::trellis_metric_type_t TYPE() const = 0;
+ virtual std::vector<@I_TYPE@> TABLE() const = 0;
+ virtual void set_TABLE(const std::vector<@I_TYPE@> &table) = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/trellis/pccc_decoder_X.h.t b/gr-trellis/include/trellis/pccc_decoder_X.h.t
new file mode 100644
index 0000000000..4ab1c088a5
--- /dev/null
+++ b/gr-trellis/include/trellis/pccc_decoder_X.h.t
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/api.h>
+#include <trellis/fsm.h>
+#include <trellis/interleaver.h>
+#include <trellis/siso_type.h>
+#include <gr_block.h>
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public gr_block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE);
+
+ virtual fsm FSM1() const = 0;
+ virtual fsm FSM2() const = 0;
+ virtual int ST10() const = 0;
+ virtual int ST1K() const = 0;
+ virtual int ST20() const = 0;
+ virtual int ST2K() const = 0;
+ virtual interleaver INTERLEAVER() const = 0;
+ virtual int blocklength() const = 0;
+ virtual int repetitions() const = 0;
+ virtual siso_type_t SISO_TYPE() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/trellis/pccc_decoder_combined_XX.h.t b/gr-trellis/include/trellis/pccc_decoder_combined_XX.h.t
new file mode 100644
index 0000000000..1ea53329c4
--- /dev/null
+++ b/gr-trellis/include/trellis/pccc_decoder_combined_XX.h.t
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/api.h>
+#include <trellis/fsm.h>
+#include <trellis/interleaver.h>
+#include <trellis/calc_metric.h>
+#include <trellis/siso_type.h>
+#include <gr_block.h>
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public gr_block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE,
+ int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling);
+
+ virtual fsm FSM1() const = 0;
+ virtual fsm FSM2() const = 0;
+ virtual int ST10() const = 0;
+ virtual int ST1K() const = 0;
+ virtual int ST20() const = 0;
+ virtual int ST2K() const = 0;
+ virtual interleaver INTERLEAVER() const = 0;
+ virtual int blocklength() const = 0;
+ virtual int repetitions() const = 0;
+ virtual int D() const = 0;
+ virtual std::vector<@I_TYPE@> TABLE() const = 0;
+ virtual digital::trellis_metric_type_t METRIC_TYPE() const = 0;
+ virtual siso_type_t SISO_TYPE() const = 0;
+ virtual float scaling() const = 0;
+ virtual void set_scaling(float scaling) = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/trellis/pccc_encoder_XX.h.t b/gr-trellis/include/trellis/pccc_encoder_XX.h.t
new file mode 100644
index 0000000000..103301eecd
--- /dev/null
+++ b/gr-trellis/include/trellis/pccc_encoder_XX.h.t
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/api.h>
+#include <trellis/fsm.h>
+#include <trellis/interleaver.h>
+#include <gr_sync_block.h>
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief SCCC encoder.
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSM1, int ST1,
+ const fsm &FSM2, int ST2,
+ const interleaver &INTERLEAVER,
+ int blocklength);
+
+ virtual fsm FSM1 () const = 0;
+ virtual int ST1 () const = 0;
+ virtual fsm FSM2 () const = 0;
+ virtual int ST2 () const = 0;
+ virtual interleaver INTERLEAVER () const = 0;
+ virtual int blocklength () const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/trellis/permutation.h b/gr-trellis/include/trellis/permutation.h
new file mode 100644
index 0000000000..adfe44a576
--- /dev/null
+++ b/gr-trellis/include/trellis/permutation.h
@@ -0,0 +1,55 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_PERMUTATION_H
+#define INCLUDED_TRELLIS_PERMUTATION_H
+
+#include <trellis/api.h>
+#include <vector>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief Permutation.
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API permutation : virtual public gr_sync_block
+ {
+ public:
+ // gr::trellis::permutation::sptr
+ typedef boost::shared_ptr<permutation> sptr;
+
+ static sptr make(int K, const std::vector<int> &TABLE,
+ int SYMS_PER_BLOCK, size_t NBYTES);
+
+ virtual int K() const = 0;
+ virtual const std::vector<int> & TABLE() const = 0;
+ virtual int SYMS_PER_BLOCK() const = 0;
+ virtual size_t BYTES_PER_SYMBOL() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_PERMUTATION_H */
diff --git a/gr-trellis/src/lib/quicksort_index.h b/gr-trellis/include/trellis/quicksort_index.h
index 9583955db9..402962172a 100644
--- a/gr-trellis/src/lib/quicksort_index.h
+++ b/gr-trellis/include/trellis/quicksort_index.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2007 Free Software Foundation, Inc.
+ * Copyright 2004,2007,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,10 +25,17 @@
#include <vector>
-template <class T>
-void SWAP (T & a, T & b);
+namespace gr {
+ namespace trellis {
-template <class T>
-void quicksort_index (std::vector<T> & p, std::vector<int> & index, int left, int right);
+ template <class T>
+ void SWAP(T &a, T &b);
-#endif
+ template <class T>
+ void quicksort_index(std::vector<T> &p, std::vector<int> &index,
+ int left, int right);
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_QUICKSORT_INDEX_H */
diff --git a/gr-trellis/include/trellis/sccc_decoder_X.h.t b/gr-trellis/include/trellis/sccc_decoder_X.h.t
new file mode 100644
index 0000000000..f2faa97e26
--- /dev/null
+++ b/gr-trellis/include/trellis/sccc_decoder_X.h.t
@@ -0,0 +1,69 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/api.h>
+#include <trellis/fsm.h>
+#include <trellis/interleaver.h>
+#include <trellis/siso_type.h>
+#include <gr_block.h>
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public gr_block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE);
+
+ virtual fsm FSMo() const = 0;
+ virtual fsm FSMi() const = 0;
+ virtual int STo0() const = 0;
+ virtual int SToK() const = 0;
+ virtual int STi0() const = 0;
+ virtual int STiK() const = 0;
+ virtual interleaver INTERLEAVER() const = 0;
+ virtual int blocklength() const = 0;
+ virtual int repetitions() const = 0;
+ virtual siso_type_t SISO_TYPE() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/trellis/sccc_decoder_combined_XX.h.t b/gr-trellis/include/trellis/sccc_decoder_combined_XX.h.t
new file mode 100644
index 0000000000..fbc3d8d668
--- /dev/null
+++ b/gr-trellis/include/trellis/sccc_decoder_combined_XX.h.t
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/api.h>
+#include <trellis/fsm.h>
+#include <trellis/interleaver.h>
+#include <trellis/calc_metric.h>
+#include <trellis/siso_type.h>
+#include <gr_block.h>
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public gr_block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE,
+ int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling);
+
+ virtual fsm FSMo() const = 0;
+ virtual fsm FSMi() const = 0;
+ virtual int STo0() const = 0;
+ virtual int SToK() const = 0;
+ virtual int STi0() const = 0;
+ virtual int STiK() const = 0;
+ virtual interleaver INTERLEAVER() const = 0;
+ virtual int blocklength() const = 0;
+ virtual int repetitions() const = 0;
+ virtual int D() const = 0;
+ virtual std::vector<@I_TYPE@> TABLE() const = 0;
+ virtual digital::trellis_metric_type_t METRIC_TYPE() const = 0;
+ virtual siso_type_t SISO_TYPE() const = 0;
+ virtual float scaling() const = 0;
+ virtual void set_scaling(float scaling) = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/trellis/sccc_encoder_XX.h.t b/gr-trellis/include/trellis/sccc_encoder_XX.h.t
new file mode 100644
index 0000000000..7702d06faf
--- /dev/null
+++ b/gr-trellis/include/trellis/sccc_encoder_XX.h.t
@@ -0,0 +1,63 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/api.h>
+#include <trellis/fsm.h>
+#include <trellis/interleaver.h>
+#include <gr_sync_block.h>
+#include <vector>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \brief SCCC encoder.
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public gr_sync_block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSMo, int STo,
+ const fsm &FSMi, int STi,
+ const interleaver &INTERLEAVER,
+ int blocklength);
+
+ virtual fsm FSMo() const = 0;
+ virtual int STo() const = 0;
+ virtual fsm FSMi() const = 0;
+ virtual int STi() const = 0;
+ virtual interleaver INTERLEAVER() const = 0;
+ virtual int blocklength() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/trellis/siso_combined_f.h b/gr-trellis/include/trellis/siso_combined_f.h
new file mode 100644
index 0000000000..c67a296885
--- /dev/null
+++ b/gr-trellis/include/trellis/siso_combined_f.h
@@ -0,0 +1,68 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_SISO_COMBINED_F_H
+#define INCLUDED_TRELLIS_SISO_COMBINED_F_H
+
+#include <trellis/api.h>
+#include <trellis/fsm.h>
+#include <trellis/siso_type.h>
+#include <trellis/calc_metric.h>
+#include <trellis/core_algorithms.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API siso_combined_f : virtual public gr_block
+ {
+ public:
+ // gr::trellis::siso_combined_f::sptr
+ typedef boost::shared_ptr<siso_combined_f> sptr;
+
+ static sptr make(const fsm &FSM, int K,
+ int S0, int SK,
+ bool POSTI, bool POSTO,
+ siso_type_t d_SISO_TYPE,
+ int D,
+ const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t TYPE);
+
+ virtual fsm FSM() const = 0;
+ virtual int K() const = 0;
+ virtual int S0() const = 0;
+ virtual int SK() const = 0;
+ virtual bool POSTI() const = 0;
+ virtual bool POSTO() const = 0;
+ virtual siso_type_t SISO_TYPE() const = 0;
+ virtual int D() const = 0;
+ virtual std::vector<float> TABLE() const = 0;
+ virtual digital::trellis_metric_type_t TYPE() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_SISO_COMBINED_F_H */
diff --git a/gr-trellis/include/trellis/siso_f.h b/gr-trellis/include/trellis/siso_f.h
new file mode 100644
index 0000000000..da35e14a0b
--- /dev/null
+++ b/gr-trellis/include/trellis/siso_f.h
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_SISO_F_H
+#define INCLUDED_TRELLIS_SISO_F_H
+
+#include <trellis/api.h>
+#include <trellis/fsm.h>
+#include <trellis/siso_type.h>
+#include <trellis/core_algorithms.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API siso_f : virtual public gr_block
+ {
+ public:
+ // gr::trellis::siso_f::sptr
+ typedef boost::shared_ptr<siso_f> sptr;
+
+ static sptr make(const fsm &FSM, int K,
+ int S0, int SK,
+ bool POSTI, bool POSTO,
+ siso_type_t d_SISO_TYPE);
+
+ virtual fsm FSM() const = 0;
+ virtual int K() const = 0;
+ virtual int S0() const = 0;
+ virtual int SK() const = 0;
+ virtual bool POSTI() const = 0;
+ virtual bool POSTO() const = 0;
+ virtual siso_type_t SISO_TYPE() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_SISO_F_H */
diff --git a/gr-trellis/src/lib/siso_type.h b/gr-trellis/include/trellis/siso_type.h
index 3a7163d02a..9167381164 100644
--- a/gr-trellis/src/lib/siso_type.h
+++ b/gr-trellis/include/trellis/siso_type.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -23,9 +23,15 @@
#ifndef INCLUDED_TRELLIS_SISO_TYPE_H
#define INCLUDED_TRELLIS_SISO_TYPE_H
-typedef enum {
- TRELLIS_MIN_SUM = 200, TRELLIS_SUM_PRODUCT
-} trellis_siso_type_t;
+namespace gr {
+ namespace trellis {
-#endif
+ typedef enum {
+ TRELLIS_MIN_SUM = 200,
+ TRELLIS_SUM_PRODUCT
+ } siso_type_t;
+
+ } /* namespace trellis */
+} /* namespace gr */
+#endif /* INCLUDED_TRELLIS_SISO_TYPE_H */
diff --git a/gr-trellis/src/lib/trellis_metrics_X.i.t b/gr-trellis/include/trellis/viterbi_X.h.t
index b53594f3a6..6931eb37e5 100644
--- a/gr-trellis/src/lib/trellis_metrics_X.i.t
+++ b/gr-trellis/include/trellis/viterbi_X.h.t
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -22,21 +22,36 @@
// @WARNING@
-GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
-@SPTR_NAME@ trellis_make_@BASE_NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
+#include <trellis/api.h>
+#include <trellis/fsm.h>
+#include <trellis/core_algorithms.h>
+#include <gr_block.h>
-class @NAME@ : public gr_block
-{
-private:
- @NAME@ (int O, int D, const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
+namespace gr {
+ namespace trellis {
-public:
- int O () const { return d_O; }
- int D () const { return d_D; }
- gr::digital::trellis_metric_type_t TYPE () const { return d_TYPE; }
- void set_TABLE (const std::vector<@I_TYPE@> &table);
- std::vector<@I_TYPE@> TABLE () const { return d_TABLE; }
-};
+ /*!
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public gr_block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSM, int K,
+ int S0, int SK);
+
+ virtual fsm FSM() const = 0;
+ virtual int K() const = 0;
+ virtual int S0() const = 0;
+ virtual int SK() const = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/include/trellis/viterbi_combined_XX.h.t b/gr-trellis/include/trellis/viterbi_combined_XX.h.t
new file mode 100644
index 0000000000..77fc5a5a60
--- /dev/null
+++ b/gr-trellis/include/trellis/viterbi_combined_XX.h.t
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/api.h>
+#include <trellis/fsm.h>
+#include <trellis/calc_metric.h>
+#include <trellis/core_algorithms.h>
+#include <gr_block.h>
+
+namespace gr {
+ namespace trellis {
+
+ /*!
+ * \ingroup coding_blk
+ */
+ class TRELLIS_API @NAME@ : virtual public gr_block
+ {
+ public:
+ // gr::trellis::@BASE_NAME@::sptr
+ typedef boost::shared_ptr<@BASE_NAME@> sptr;
+
+ static sptr make(const fsm &FSM, int K,
+ int S0, int SK, int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t TYPE);
+
+ virtual fsm FSM() const = 0;
+ virtual int K() const = 0;
+ virtual int S0() const = 0;
+ virtual int SK() const = 0;
+ virtual int D() const = 0;
+ virtual std::vector<@I_TYPE@> TABLE() const = 0;
+ virtual digital::trellis_metric_type_t TYPE() const = 0;
+ virtual void set_TABLE (const std::vector<@I_TYPE@> &table) = 0;
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/lib/CMakeLists.txt b/gr-trellis/lib/CMakeLists.txt
new file mode 100644
index 0000000000..5bd0227de6
--- /dev/null
+++ b/gr-trellis/lib/CMakeLists.txt
@@ -0,0 +1,139 @@
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${GNURADIO_CORE_INCLUDE_DIRS}
+ ${GR_TRELLIS_INCLUDE_DIRS}
+ ${GR_DIGITAL_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}/../include
+)
+
+include_directories(${Boost_INCLUDE_DIRS})
+link_directories(${Boost_LIBRARY_DIRS})
+
+if(ENABLE_GR_CTRLPORT)
+ ADD_DEFINITIONS(-DGR_CTRLPORT)
+endif(ENABLE_GR_CTRLPORT)
+
+#######################################################################
+# generate the python helper script which calls into the build utils
+########################################################################
+include(GrPython)
+
+file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
+#!${PYTHON_EXECUTABLE}
+
+import sys, os, re
+sys.path.append('${GR_CORE_PYTHONPATH}')
+os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
+os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
+
+if __name__ == '__main__':
+ import build_utils
+ root, inp = sys.argv[1:3]
+ for sig in sys.argv[3:]:
+ name = re.sub ('X+', sig, root)
+ d = build_utils.standard_impl_dict2(name, sig, 'trellis')
+ build_utils.expand_template(d, inp)
+")
+
+macro(expand_cc root)
+ #make a list of all the generated files
+ unset(expanded_files_cc)
+ unset(expanded_files_h)
+ foreach(sig ${ARGN})
+ string(REGEX REPLACE "X+" ${sig} name ${root})
+ list(APPEND expanded_files_cc ${CMAKE_CURRENT_BINARY_DIR}/${name}.cc)
+ list(APPEND expanded_files_h ${CMAKE_CURRENT_BINARY_DIR}/${name}.h)
+ endforeach(sig)
+
+ #create a command to generate the source files
+ add_custom_command(
+ OUTPUT ${expanded_files_cc}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.cc.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}.cc.t ${ARGN}
+ )
+
+ #create a command to generate the header file
+ add_custom_command(
+ OUTPUT ${expanded_files_h}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.h.t
+ COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
+ ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
+ ${root} ${root}.h.t ${ARGN}
+ )
+
+ #make source files depends on headers to force generation
+ set_source_files_properties(${expanded_files_cc}
+ PROPERTIES OBJECT_DEPENDS "${expanded_files_h}"
+ )
+
+ #install rules for the generated cc files
+ list(APPEND generated_sources ${expanded_files_cc})
+ list(APPEND generated_headers ${expanded_files_h})
+endmacro(expand_cc)
+
+########################################################################
+# Invoke macro to generate various sources
+########################################################################
+expand_cc(encoder_XX_impl bb bs bi ss si ii)
+expand_cc(sccc_encoder_XX_impl bb bs bi ss si ii)
+expand_cc(pccc_encoder_XX_impl bb bs bi ss si ii)
+expand_cc(metrics_X_impl s i f c)
+expand_cc(viterbi_X_impl b s i)
+expand_cc(viterbi_combined_XX_impl sb ss si ib is ii fb fs fi cb cs ci)
+expand_cc(sccc_decoder_X_impl b s i)
+expand_cc(sccc_decoder_combined_XX_impl fb fs fi cb cs ci)
+expand_cc(pccc_decoder_X_impl b s i)
+expand_cc(pccc_decoder_combined_XX_impl fb fs fi cb cs ci)
+
+########################################################################
+# Setup library
+########################################################################
+list(APPEND trellis_sources
+ ${generated_sources}
+ base.cc
+ calc_metric.cc
+ core_algorithms.cc
+ fsm.cc
+ interleaver.cc
+ quicksort_index.cc
+ constellation_metrics_cf_impl.cc
+ permutation_impl.cc
+ siso_f_impl.cc
+ siso_combined_f_impl.cc
+)
+
+list(APPEND trellis_libs
+ gnuradio-core
+ gnuradio-digital
+ ${Boost_LIBRARIES}
+)
+
+add_library(gnuradio-trellis SHARED ${trellis_sources})
+target_link_libraries(gnuradio-trellis ${trellis_libs})
+GR_LIBRARY_FOO(gnuradio-trellis RUNTIME_COMPONENT "trellis_runtime" DEVEL_COMPONENT "trellis_devel")
+add_dependencies(gnuradio-trellis
+ trellis_generated_includes trellis_generated_swigs
+ gnuradio-core gnuradio-digital)
diff --git a/gr-trellis/lib/base.cc b/gr-trellis/lib/base.cc
new file mode 100644
index 0000000000..e9d0141e70
--- /dev/null
+++ b/gr-trellis/lib/base.cc
@@ -0,0 +1,86 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <cstdio>
+#include <stdexcept>
+#include <cmath>
+#include <trellis/base.h>
+
+namespace gr {
+ namespace trellis {
+
+ bool
+ dec2base(unsigned int num, int base, std::vector<int> &s)
+ {
+ int l = s.size();
+ unsigned int n=num;
+ for(int i=0;i<l;i++) {
+ s[l-i-1] = n % base; //MSB first
+ n /= base;
+ }
+ if(n!=0) {
+ printf("Number %d requires more than %d digits.",num,l);
+ return false;
+ }
+ else
+ return true;
+ }
+
+ unsigned int
+ base2dec(const std::vector<int> &s, int base)
+ {
+ int l = s.size();
+ unsigned int num=0;
+ for(int i=0;i<l;i++)
+ num=num*base+s[i];
+ return num;
+ }
+
+ bool
+ dec2bases(unsigned int num, const std::vector<int> &bases, std::vector<int> &s)
+ {
+ int l = s.size();
+ unsigned int n=num;
+ for(int i=0;i<l;i++) {
+ s[l-i-1] = n % bases[l-i-1];
+ n /= bases[l-i-1];
+ }
+ if(n!=0) {
+ printf("Number %d requires more than %d digits.",num,l);
+ return false;
+ }
+ else
+ return true;
+ }
+
+ unsigned int
+ bases2dec(const std::vector<int> &s, const std::vector<int> &bases)
+ {
+ int l = s.size();
+ unsigned int num=0;
+ for(int i=0;i<l;i++)
+ num = num * bases[i] + s[i];
+ return num;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/calc_metric.cc b/gr-trellis/lib/calc_metric.cc
new file mode 100644
index 0000000000..3c474e30fe
--- /dev/null
+++ b/gr-trellis/lib/calc_metric.cc
@@ -0,0 +1,251 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <float.h>
+#include <stdexcept>
+#include <trellis/calc_metric.h>
+
+namespace gr {
+ namespace trellis {
+
+ template <class T>
+ void calc_metric(int O, int D, const std::vector<T> &TABLE, const T *input,
+ float *metric, digital::trellis_metric_type_t type)
+ {
+ float minm = FLT_MAX;
+ int minmi = 0;
+
+ switch(type) {
+ case digital::TRELLIS_EUCLIDEAN:
+ for(int o = 0; o < O; o++) {
+ metric[o] = 0.0;
+ for(int m = 0; m < D; m++) {
+ T s = input[m]-TABLE[o*D+m];
+ //gr_complex sc(1.0*s,0);
+ //metric[o] += (sc*conj(sc)).real();
+ metric[o] += s * s;
+ }
+ }
+ break;
+ case digital::TRELLIS_HARD_SYMBOL:
+ for(int o = 0; o < O; o++) {
+ metric[o] = 0.0;
+ for(int m = 0; m < D; m++) {
+ T s = input[m]-TABLE[o*D+m];
+ //gr_complex sc(1.0*s,0);
+ //metric[o] + =(sc*conj(sc)).real();
+ metric[o] += s * s;
+ }
+ if(metric[o] < minm) {
+ minm = metric[o];
+ minmi = o;
+ }
+ }
+ for(int o = 0; o < O; o++) {
+ metric[o] = (o == minmi ? 0.0 : 1.0);
+ }
+ break;
+ case digital::TRELLIS_HARD_BIT:
+ throw std::runtime_error("calc_metric: Invalid metric type (not yet implemented).");
+ break;
+ default:
+ throw std::runtime_error("calc_metric: Invalid metric type.");
+ }
+ }
+
+ template
+ void calc_metric<short>(int O, int D, const std::vector<short> &TABLE, const short *input,
+ float *metric, digital::trellis_metric_type_t type);
+
+ template
+ void calc_metric<int>(int O, int D, const std::vector<int> &TABLE, const int *input,
+ float *metric, digital::trellis_metric_type_t type);
+
+ template
+ void calc_metric<float>(int O, int D, const std::vector<float> &TABLE, const float *input,
+ float *metric, digital::trellis_metric_type_t type);
+
+ void calc_metric(int O, int D, const std::vector<short> &TABLE, const short *input,
+ float *metric, digital::trellis_metric_type_t type)
+ {
+ float minm = FLT_MAX;
+ int minmi = 0;
+
+ switch(type) {
+ case digital::TRELLIS_EUCLIDEAN:
+ for(int o = 0; o < O; o++) {
+ metric[o] = 0.0;
+ for(int m = 0; m < D; m++) {
+ float s = input[m]-TABLE[o*D+m];
+ metric[o] += s*s;
+ }
+ }
+ break;
+ case digital::TRELLIS_HARD_SYMBOL:
+ for(int o = 0; o < O; o++) {
+ metric[o] = 0.0;
+ for(int m = 0; m < D; m++) {
+ float s = input[m]-TABLE[o*D+m];
+ metric[o] += s*s;
+ }
+ if(metric[o] < minm) {
+ minm = metric[o];
+ minmi = o;
+ }
+ }
+ for(int o = 0; o < O; o++) {
+ metric[o] = (o == minmi ? 0.0 : 1.0);
+ }
+ break;
+ case digital::TRELLIS_HARD_BIT:
+ throw std::runtime_error("calc_metric: Invalid metric type (not yet implemented).");
+ break;
+ default:
+ throw std::runtime_error("calc_metric: Invalid metric type.");
+ }
+ }
+
+ /*
+ void calc_metric(int O, int D, const std::vector<int> &TABLE, const int *input,
+ float *metric, digital::trellis_metric_type_t type)
+ {
+ float minm = FLT_MAX;
+ int minmi = 0;
+
+ switch(type){
+ case digital::TRELLIS_EUCLIDEAN:
+ for(int o=0;o<O;o++) {
+ metric[o]=0.0;
+ for(int m=0;m<D;m++) {
+ float s=input[m]-TABLE[o*D+m];
+ metric[o]+=s*s;
+ }
+ }
+ break;
+ case digital::TRELLIS_HARD_SYMBOL:
+ for(int o=0;o<O;o++) {
+ metric[o]=0.0;
+ for(int m=0;m<D;m++) {
+ float s=input[m]-TABLE[o*D+m];
+ metric[o]+=s*s;
+ }
+ if(metric[o]<minm) {
+ minm=metric[o];
+ minmi=o;
+ }
+ }
+ for(int o=0;o<O;o++) {
+ metric[o] = (o==minmi?0.0:1.0);
+ }
+ break;
+ case digital::TRELLIS_HARD_BIT:
+ throw std::runtime_error("calc_metric: Invalid metric type (not yet implemented).");
+ break;
+ default:
+ throw std::runtime_error("calc_metric: Invalid metric type.");
+ }
+ }
+
+ void calc_metric(int O, int D, const std::vector<float> &TABLE, const float *input,
+ float *metric, digital::trellis_metric_type_t type)
+ {
+ float minm = FLT_MAX;
+ int minmi = 0;
+
+ switch(type) {
+ case digital::TRELLIS_EUCLIDEAN:
+ for(int o=0;o<O;o++) {
+ metric[o]=0.0;
+ for(int m=0;m<D;m++) {
+ float s=input[m]-TABLE[o*D+m];
+ metric[o]+=s*s;
+ }
+ }
+ break;
+ case digital::TRELLIS_HARD_SYMBOL:
+ for(int o=0;o<O;o++) {
+ metric[o]=0.0;
+ for(int m=0;m<D;m++) {
+ float s=input[m]-TABLE[o*D+m];
+ metric[o]+=s*s;
+ }
+ if(metric[o]<minm) {
+ minm=metric[o];
+ minmi=o;
+ }
+ }
+ for(int o=0;o<O;o++) {
+ metric[o] = (o==minmi?0.0:1.0);
+ }
+ break;
+ case digital::TRELLIS_HARD_BIT:
+ throw std::runtime_error("calc_metric: Invalid metric type (not yet implemented).");
+ break;
+ default:
+ throw std::runtime_error("calc_metric: Invalid metric type.");
+ }
+ }
+*/
+
+ void calc_metric(int O, int D, const std::vector<gr_complex> &TABLE, const gr_complex *input,
+ float *metric, digital::trellis_metric_type_t type)
+ {
+ float minm = FLT_MAX;
+ int minmi = 0;
+
+ switch(type) {
+ case digital::TRELLIS_EUCLIDEAN:
+ for(int o = 0; o < O; o++) {
+ metric[o] = 0.0;
+ for(int m = 0; m < D; m++) {
+ gr_complex s = input[m]-TABLE[o*D+m];
+ metric[o] += s.real()*s.real()+s.imag()*s.imag();
+ }
+ }
+ break;
+ case digital::TRELLIS_HARD_SYMBOL:
+ for(int o = 0; o < O; o++) {
+ metric[o] = 0.0;
+ for(int m = 0; m < D; m++) {
+ gr_complex s = input[m]-TABLE[o*D+m];
+ metric[o] += s.real()*s.real()+s.imag()*s.imag();
+ }
+ if(metric[o] < minm) {
+ minm = metric[o];
+ minmi = o;
+ }
+ }
+ for(int o = 0; o < O; o++) {
+ metric[o] = (o == minmi ? 0.0 : 1.0);
+ }
+ break;
+ case digital::TRELLIS_HARD_BIT:
+ throw std::runtime_error("calc_metric: Invalid metric type (not yet implemented).");
+ break;
+ default:
+ throw std::runtime_error("calc_metric: Invalid metric type.");
+ }
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
+
diff --git a/gr-trellis/lib/constellation_metrics_cf_impl.cc b/gr-trellis/lib/constellation_metrics_cf_impl.cc
new file mode 100644
index 0000000000..18d3095802
--- /dev/null
+++ b/gr-trellis/lib/constellation_metrics_cf_impl.cc
@@ -0,0 +1,96 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "constellation_metrics_cf_impl.h"
+#include <gr_io_signature.h>
+#include <assert.h>
+#include <stdexcept>
+#include <iostream>
+
+namespace gr {
+ namespace trellis {
+
+ constellation_metrics_cf::sptr
+ constellation_metrics_cf::make(digital::constellation_sptr constellation,
+ digital::trellis_metric_type_t TYPE)
+ {
+ return gnuradio::get_initial_sptr
+ (new constellation_metrics_cf_impl(constellation, TYPE));
+ }
+
+ constellation_metrics_cf_impl::constellation_metrics_cf_impl(digital::constellation_sptr constellation,
+ digital::trellis_metric_type_t TYPE)
+ : gr_block("constellation_metrics_cf",
+ gr_make_io_signature(1, -1, sizeof(gr_complex)),
+ gr_make_io_signature(1, -1, sizeof(float))),
+ d_constellation(constellation),
+ d_TYPE(TYPE),
+ d_O(constellation->arity()),
+ d_D(constellation->dimensionality())
+ {
+ set_relative_rate(1.0 * d_O / ((double) d_D));
+ set_output_multiple((int)d_O);
+ }
+
+ constellation_metrics_cf_impl::~constellation_metrics_cf_impl()
+ {
+ }
+
+ void
+ constellation_metrics_cf_impl::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ assert(noutput_items % d_O == 0);
+
+ unsigned int input_required = d_D * noutput_items / d_O;
+ unsigned int ninputs = ninput_items_required.size();
+ for(unsigned int i = 0; i < ninputs; i++)
+ ninput_items_required[i] = input_required;
+ }
+
+ int
+ constellation_metrics_cf_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ unsigned int nstreams = input_items.size();
+
+ for(unsigned int m=0;m<nstreams;m++) {
+ const gr_complex *in = (gr_complex*)input_items[m];
+ float *out = (float*)output_items[m];
+
+ for(unsigned int i = 0; i < noutput_items / d_O ; i++) {
+ d_constellation->calc_metric(&(in[i*d_D]), &(out[i*d_O]), d_TYPE);
+ }
+ }
+
+ consume_each(d_D * noutput_items / d_O);
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/constellation_metrics_cf_impl.h b/gr-trellis/lib/constellation_metrics_cf_impl.h
new file mode 100644
index 0000000000..52018c4baa
--- /dev/null
+++ b/gr-trellis/lib/constellation_metrics_cf_impl.h
@@ -0,0 +1,57 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010-2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_IMPL_H
+#define INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_IMPL_H
+
+#include <trellis/api.h>
+#include <trellis/constellation_metrics_cf.h>
+
+namespace gr {
+ namespace trellis {
+
+ class constellation_metrics_cf_impl : public constellation_metrics_cf
+ {
+ private:
+ digital::constellation_sptr d_constellation;
+ digital::trellis_metric_type_t d_TYPE;
+ unsigned int d_O;
+ unsigned int d_D;
+
+ public:
+ constellation_metrics_cf_impl(digital::constellation_sptr constellation,
+ digital::trellis_metric_type_t TYPE);
+ ~constellation_metrics_cf_impl();
+
+ void forecast(int noutput_items,
+ gr_vector_int &ninput_items_required);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_IMPL_H */
diff --git a/gr-trellis/lib/core_algorithms.cc b/gr-trellis/lib/core_algorithms.cc
new file mode 100644
index 0000000000..a704e5f9a6
--- /dev/null
+++ b/gr-trellis/lib/core_algorithms.cc
@@ -0,0 +1,1324 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <cstring>
+#include <stdexcept>
+#include <iostream>
+#include <trellis/core_algorithms.h>
+#include <trellis/calc_metric.h>
+
+namespace gr {
+ namespace trellis {
+
+ static const float INF = 1.0e9;
+
+ float
+ min(float a, float b)
+ {
+ return a <= b ? a : b;
+ }
+
+ float
+ min_star(float a, float b)
+ {
+ return (a <= b ? a : b)-log(1+exp(a <= b ? a-b : b-a));
+ }
+
+ template <class T> void
+ viterbi_algorithm(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ const float *in, T *out)//,
+ //std::vector<int> &trace)
+ {
+ std::vector<int> trace(S*K);
+ std::vector<float> alpha(S*2);
+ int alphai;
+ float norm,mm,minm;
+ int minmi;
+ int st;
+
+ if(S0<0) { // initial state not specified
+ for(int i=0;i<S;i++) alpha[0*S+i]=0;
+ }
+ else {
+ for(int i=0;i<S;i++) alpha[0*S+i]=INF;
+ alpha[0*S+S0]=0.0;
+ }
+
+ alphai=0;
+ for(int k=0;k<K;k++) {
+ norm=INF;
+ for(int j=0;j<S;j++) { // for each next state do ACS
+ minm=INF;
+ minmi=0;
+ for(unsigned int i=0;i<PS[j].size();i++) {
+ //int i0 = j*I+i;
+ if((mm=alpha[alphai*S+PS[j][i]]+in[k*O+OS[PS[j][i]*I+PI[j][i]]])<minm)
+ minm=mm,minmi=i;
+ }
+ trace[k*S+j]=minmi;
+ alpha[((alphai+1)%2)*S+j]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int j=0;j<S;j++)
+ alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode
+ alphai=(alphai+1)%2;
+ }
+
+ if(SK<0) { // final state not specified
+ minm=INF;
+ minmi=0;
+ for(int i=0;i<S;i++)
+ if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i;
+ st=minmi;
+ }
+ else {
+ st=SK;
+ }
+
+ for(int k=K-1;k>=0;k--) { // traceback
+ int i0=trace[k*S+st];
+ out[k]= (T) PI[st][i0];
+ st=PS[st][i0];
+ }
+ }
+
+ template void
+ viterbi_algorithm<unsigned char>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ const float *in, unsigned char *out);
+
+ template void
+ viterbi_algorithm<short>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ const float *in, short *out);
+
+ template void
+ viterbi_algorithm<int>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ const float *in, int *out);
+
+ //==============================================
+
+ template <class Ti, class To> void
+ viterbi_algorithm_combined(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<Ti> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const Ti *in, To *out)
+ {
+ std::vector<int> trace(S*K);
+ std::vector<float> alpha(S*2);
+ float *metric = new float[O];
+ int alphai;
+ float norm,mm,minm;
+ int minmi;
+ int st;
+
+ if(S0<0) { // initial state not specified
+ for(int i=0;i<S;i++) alpha[0*S+i]=0;
+ }
+ else {
+ for(int i=0;i<S;i++) alpha[0*S+i]=INF;
+ alpha[0*S+S0]=0.0;
+ }
+
+ alphai=0;
+ for(int k=0;k<K;k++) {
+ calc_metric(O, D, TABLE, &(in[k*D]), metric,TYPE); // calc metrics
+ norm=INF;
+ for(int j=0;j<S;j++) { // for each next state do ACS
+ minm=INF;
+ minmi=0;
+ for(unsigned int i=0;i<PS[j].size();i++) {
+ //int i0 = j*I+i;
+ if((mm=alpha[alphai*S+PS[j][i]]+metric[OS[PS[j][i]*I+PI[j][i]]])<minm)
+ minm=mm,minmi=i;
+ }
+ trace[k*S+j]=minmi;
+ alpha[((alphai+1)%2)*S+j]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int j=0;j<S;j++)
+ alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode
+ alphai=(alphai+1)%2;
+ }
+
+ if(SK<0) { // final state not specified
+ minm=INF;
+ minmi=0;
+ for(int i=0;i<S;i++)
+ if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i;
+ st=minmi;
+ }
+ else {
+ st=SK;
+ }
+
+ for(int k=K-1;k>=0;k--) { // traceback
+ int i0=trace[k*S+st];
+ out[k]= (To) PI[st][i0];
+ st=PS[st][i0];
+ }
+
+ delete [] metric;
+ }
+
+ // Ti = s i f c
+ // To = b s i
+
+ //---------------
+
+ template void
+ viterbi_algorithm_combined<short,unsigned char>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<short> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const short *in, unsigned char *out);
+
+ template void
+ viterbi_algorithm_combined<int,unsigned char>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<int> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const int *in, unsigned char *out);
+
+ template void
+ viterbi_algorithm_combined<float,unsigned char>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const float *in, unsigned char *out);
+
+ template void
+ viterbi_algorithm_combined<gr_complex,unsigned char>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<gr_complex> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const gr_complex *in, unsigned char *out);
+
+ //---------------
+
+ template void
+ viterbi_algorithm_combined<short,short>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<short> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const short *in, short *out);
+
+ template void
+ viterbi_algorithm_combined<int,short>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<int> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const int *in, short *out);
+
+ template void
+ viterbi_algorithm_combined<float,short>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const float *in, short *out);
+
+ template void
+ viterbi_algorithm_combined<gr_complex,short>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<gr_complex> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const gr_complex *in, short *out);
+
+ //--------------
+
+ template void
+ viterbi_algorithm_combined<short,int>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<short> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const short *in, int *out);
+
+ template void
+ viterbi_algorithm_combined<int,int>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<int> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const int *in, int *out);
+
+ template void
+ viterbi_algorithm_combined<float,int>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const float *in, int *out);
+
+ template void
+ viterbi_algorithm_combined<gr_complex,int>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ int D,
+ const std::vector<gr_complex> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const gr_complex *in, int *out);
+
+ //===============================================
+
+ void
+ siso_algorithm(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ bool POSTI, bool POSTO,
+ float (*p2mymin)(float,float),
+ const float *priori, const float *prioro, float *post//,
+ //std::vector<float> &alpha,
+ //std::vector<float> &beta
+ )
+ {
+ float norm,mm,minm;
+ std::vector<float> alpha(S*(K+1));
+ std::vector<float> beta(S*(K+1));
+
+ if(S0<0) { // initial state not specified
+ for(int i=0;i<S;i++) alpha[0*S+i]=0;
+ }
+ else {
+ for(int i=0;i<S;i++) alpha[0*S+i]=INF;
+ alpha[0*S+S0]=0.0;
+ }
+
+ for(int k=0;k<K;k++) { // forward recursion
+ norm=INF;
+ for(int j=0;j<S;j++) {
+ minm=INF;
+ for(unsigned int i=0;i<PS[j].size();i++) {
+ //int i0 = j*I+i;
+ mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]];
+ minm=(*p2mymin)(minm,mm);
+ }
+ alpha[(k+1)*S+j]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int j=0;j<S;j++)
+ alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode
+ }
+
+ if(SK<0) { // final state not specified
+ for(int i=0;i<S;i++) beta[K*S+i]=0;
+ }
+ else {
+ for(int i=0;i<S;i++) beta[K*S+i]=INF;
+ beta[K*S+SK]=0.0;
+ }
+
+ for(int k=K-1;k>=0;k--) { // backward recursion
+ norm=INF;
+ for(int j=0;j<S;j++) {
+ minm=INF;
+ for(int i=0;i<I;i++) {
+ int i0 = j*I+i;
+ mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]];
+ minm=(*p2mymin)(minm,mm);
+ }
+ beta[k*S+j]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int j=0;j<S;j++)
+ beta[k*S+j]-=norm; // normalize total metrics so they do not explode
+ }
+
+ if(POSTI && POSTO)
+ {
+ for(int k=0;k<K;k++) { // input combining
+ norm=INF;
+ for(int i=0;i<I;i++) {
+ minm=INF;
+ for(int j=0;j<S;j++) {
+ mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]];
+ minm=(*p2mymin)(minm,mm);
+ }
+ post[k*(I+O)+i]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int i=0;i<I;i++)
+ post[k*(I+O)+i]-=norm; // normalize metrics
+ }
+
+ for(int k=0;k<K;k++) { // output combining
+ norm=INF;
+ for(int n=0;n<O;n++) {
+ minm=INF;
+ for(int j=0;j<S;j++) {
+ for(int i=0;i<I;i++) {
+ mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF);
+ minm=(*p2mymin)(minm,mm);
+ }
+ }
+ post[k*(I+O)+I+n]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int n=0;n<O;n++)
+ post[k*(I+O)+I+n]-=norm; // normalize metrics
+ }
+ }
+ else if(POSTI)
+ {
+ for(int k=0;k<K;k++) { // input combining
+ norm=INF;
+ for(int i=0;i<I;i++) {
+ minm=INF;
+ for(int j=0;j<S;j++) {
+ mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]];
+ minm=(*p2mymin)(minm,mm);
+ }
+ post[k*I+i]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int i=0;i<I;i++)
+ post[k*I+i]-=norm; // normalize metrics
+ }
+ }
+ else if(POSTO)
+ {
+ for(int k=0;k<K;k++) { // output combining
+ norm=INF;
+ for(int n=0;n<O;n++) {
+ minm=INF;
+ for(int j=0;j<S;j++) {
+ for(int i=0;i<I;i++) {
+ mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF);
+ minm=(*p2mymin)(minm,mm);
+ }
+ }
+ post[k*O+n]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int n=0;n<O;n++)
+ post[k*O+n]-=norm; // normalize metrics
+ }
+ }
+ else
+ throw std::runtime_error("Not both POSTI and POSTO can be false.");
+ }
+
+ //===========================================================
+
+ template <class T> void
+ siso_algorithm_combined(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ bool POSTI, bool POSTO,
+ float (*p2mymin)(float,float),
+ int D,
+ const std::vector<T> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const float *priori, const T *observations, float *post)
+ {
+ float norm,mm,minm;
+ std::vector<float> alpha(S*(K+1));
+ std::vector<float> beta(S*(K+1));
+ float *prioro = new float[O*K];
+
+ if(S0<0) { // initial state not specified
+ for(int i=0;i<S;i++) alpha[0*S+i]=0;
+ }
+ else {
+ for(int i=0;i<S;i++) alpha[0*S+i]=INF;
+ alpha[0*S+S0]=0.0;
+ }
+
+ for(int k=0;k<K;k++) { // forward recursion
+ calc_metric(O, D, TABLE, &(observations[k*D]), &(prioro[k*O]),TYPE); // calc metrics
+ norm=INF;
+ for(int j=0;j<S;j++) {
+ minm=INF;
+ for(unsigned int i=0;i<PS[j].size();i++) {
+ //int i0 = j*I+i;
+ mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]];
+ minm=(*p2mymin)(minm,mm);
+ }
+ alpha[(k+1)*S+j]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int j=0;j<S;j++)
+ alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode
+ }
+
+ if(SK<0) { // final state not specified
+ for(int i=0;i<S;i++) beta[K*S+i]=0;
+ }
+ else {
+ for(int i=0;i<S;i++) beta[K*S+i]=INF;
+ beta[K*S+SK]=0.0;
+ }
+
+ for(int k=K-1;k>=0;k--) { // backward recursion
+ norm=INF;
+ for(int j=0;j<S;j++) {
+ minm=INF;
+ for(int i=0;i<I;i++) {
+ int i0 = j*I+i;
+ mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]];
+ minm=(*p2mymin)(minm,mm);
+ }
+ beta[k*S+j]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int j=0;j<S;j++)
+ beta[k*S+j]-=norm; // normalize total metrics so they do not explode
+ }
+
+ if(POSTI && POSTO)
+ {
+ for(int k=0;k<K;k++) { // input combining
+ norm=INF;
+ for(int i=0;i<I;i++) {
+ minm=INF;
+ for(int j=0;j<S;j++) {
+ mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]];
+ minm=(*p2mymin)(minm,mm);
+ }
+ post[k*(I+O)+i]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int i=0;i<I;i++)
+ post[k*(I+O)+i]-=norm; // normalize metrics
+ }
+
+ for(int k=0;k<K;k++) { // output combining
+ norm=INF;
+ for(int n=0;n<O;n++) {
+ minm=INF;
+ for(int j=0;j<S;j++) {
+ for(int i=0;i<I;i++) {
+ mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF);
+ minm=(*p2mymin)(minm,mm);
+ }
+ }
+ post[k*(I+O)+I+n]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int n=0;n<O;n++)
+ post[k*(I+O)+I+n]-=norm; // normalize metrics
+ }
+ }
+ else if(POSTI)
+ {
+ for(int k=0;k<K;k++) { // input combining
+ norm=INF;
+ for(int i=0;i<I;i++) {
+ minm=INF;
+ for(int j=0;j<S;j++) {
+ mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]];
+ minm=(*p2mymin)(minm,mm);
+ }
+ post[k*I+i]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int i=0;i<I;i++)
+ post[k*I+i]-=norm; // normalize metrics
+ }
+ }
+ else if(POSTO) {
+ for(int k=0;k<K;k++) { // output combining
+ norm=INF;
+ for(int n=0;n<O;n++) {
+ minm=INF;
+ for(int j=0;j<S;j++) {
+ for(int i=0;i<I;i++) {
+ mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF);
+ minm=(*p2mymin)(minm,mm);
+ }
+ }
+ post[k*O+n]=minm;
+ if(minm<norm) norm=minm;
+ }
+ for(int n=0;n<O;n++)
+ post[k*O+n]-=norm; // normalize metrics
+ }
+ }
+ else
+ throw std::runtime_error ("Not both POSTI and POSTO can be false.");
+
+ delete [] prioro;
+ }
+
+ //---------
+
+ template void
+ siso_algorithm_combined<short>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ bool POSTI, bool POSTO,
+ float (*p2mymin)(float,float),
+ int D,
+ const std::vector<short> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const float *priori, const short *observations, float *post);
+
+ template void
+ siso_algorithm_combined<int>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ bool POSTI, bool POSTO,
+ float (*p2mymin)(float,float),
+ int D,
+ const std::vector<int> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const float *priori, const int *observations, float *post);
+
+ template void
+ siso_algorithm_combined<float>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ bool POSTI, bool POSTO,
+ float (*p2mymin)(float,float),
+ int D,
+ const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const float *priori, const float *observations, float *post);
+
+ template void
+ siso_algorithm_combined<gr_complex>(int I, int S, int O,
+ const std::vector<int> &NS,
+ const std::vector<int> &OS,
+ const std::vector< std::vector<int> > &PS,
+ const std::vector< std::vector<int> > &PI,
+ int K,
+ int S0,int SK,
+ bool POSTI, bool POSTO,
+ float (*p2mymin)(float,float),
+ int D,
+ const std::vector<gr_complex> &TABLE,
+ digital::trellis_metric_type_t TYPE,
+ const float *priori, const gr_complex *observations, float *post);
+
+ //=========================================================
+
+ template<class Ti, class To> void
+ sccc_decoder_combined(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength, int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<Ti> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const Ti *observations, To *data)
+ {
+ //allocate space for priori, prioro and posti of inner FSM
+ std::vector<float> ipriori(blocklength*FSMi.I(),0.0);
+ std::vector<float> iprioro(blocklength*FSMi.O());
+ std::vector<float> iposti(blocklength*FSMi.I());
+
+ //allocate space for priori, prioro and posto of outer FSM
+ std::vector<float> opriori(blocklength*FSMo.I(),0.0);
+ std::vector<float> oprioro(blocklength*FSMo.O());
+ std::vector<float> oposti(blocklength*FSMo.I());
+ std::vector<float> oposto(blocklength*FSMo.O());
+
+ // turn observations to neg-log-priors
+ for(int k=0;k<blocklength;k++) {
+ calc_metric(FSMi.O(), D, TABLE, &(observations[k*D]), &(iprioro[k*FSMi.O()]),METRIC_TYPE);
+ iprioro[k*FSMi.O()] *= scaling;
+ }
+
+ for(int rep=0;rep<iterations;rep++) {
+ // run inner SISO
+ siso_algorithm(FSMi.I(),FSMi.S(),FSMi.O(),
+ FSMi.NS(), FSMi.OS(), FSMi.PS(), FSMi.PI(),
+ blocklength,
+ STi0,STiK,
+ true, false,
+ p2mymin,
+ &(ipriori[0]), &(iprioro[0]), &(iposti[0]));
+
+ //interleave soft info inner -> outer
+ for(int k=0;k<blocklength;k++) {
+ int ki = INTERLEAVER.DEINTER()[k];
+ //for(int i=0;i<FSMi.I();i++) {
+ //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i];
+ //}
+ memcpy(&(oprioro[k*FSMi.I()]),&(iposti[ki*FSMi.I()]),FSMi.I()*sizeof(float));
+ }
+
+ // run outer SISO
+
+ if(rep<iterations-1) { // do not produce posti
+ siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(),
+ FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(),
+ blocklength,
+ STo0,SToK,
+ false, true,
+ p2mymin,
+ &(opriori[0]), &(oprioro[0]), &(oposto[0]));
+
+ //interleave soft info outer --> inner
+ for(int k=0;k<blocklength;k++) {
+ int ki = INTERLEAVER.DEINTER()[k];
+ //for(int i=0;i<FSMi.I();i++) {
+ //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i];
+ //}
+ memcpy(&(ipriori[ki*FSMi.I()]),&(oposto[k*FSMi.I()]),FSMi.I()*sizeof(float));
+ }
+ }
+ else // produce posti but not posto
+
+ siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(),
+ FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(),
+ blocklength,
+ STo0,SToK,
+ true, false,
+ p2mymin,
+ &(opriori[0]), &(oprioro[0]), &(oposti[0]));
+
+ /*
+ viterbi_algorithm(FSMo.I(),FSMo.S(),FSMo.O(),
+ FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(),
+ blocklength,
+ STo0,SToK,
+ &(oprioro[0]), data
+ );
+ */
+ }
+
+ // generate hard decisions
+ for(int k=0;k<blocklength;k++) {
+ float min=INF;
+ int mini=0;
+ for(int i=0;i<FSMo.I();i++) {
+ if(oposti[k*FSMo.I()+i]<min) {
+ min=oposti[k*FSMo.I()+i];
+ mini=i;
+ }
+ }
+ data[k]=(To)mini;
+ }
+ }
+
+ //-------
+
+ template void
+ sccc_decoder_combined<float,unsigned char>(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const float *observations, unsigned char *data);
+
+ template void
+ sccc_decoder_combined<float,short>(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const float *observations, short *data);
+
+ template void
+ sccc_decoder_combined<float,int>(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const float *observations, int *data);
+
+ template void
+ sccc_decoder_combined<gr_complex,unsigned char>(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<gr_complex> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const gr_complex *observations, unsigned char *data
+ );
+
+ template void
+ sccc_decoder_combined<gr_complex,short>(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<gr_complex> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const gr_complex *observations, short *data);
+
+ template void
+ sccc_decoder_combined<gr_complex,int>(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<gr_complex> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const gr_complex *observations, int *data);
+
+ //=========================================================
+
+ template<class T> void
+ sccc_decoder(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength, int iterations,
+ float (*p2mymin)(float,float),
+ const float *iprioro, T *data)
+ {
+ //allocate space for priori, and posti of inner FSM
+ std::vector<float> ipriori(blocklength*FSMi.I(),0.0);
+ std::vector<float> iposti(blocklength*FSMi.I());
+
+ //allocate space for priori, prioro and posto of outer FSM
+ std::vector<float> opriori(blocklength*FSMo.I(),0.0);
+ std::vector<float> oprioro(blocklength*FSMo.O());
+ std::vector<float> oposti(blocklength*FSMo.I());
+ std::vector<float> oposto(blocklength*FSMo.O());
+
+ for(int rep=0;rep<iterations;rep++) {
+ // run inner SISO
+ siso_algorithm(FSMi.I(),FSMi.S(),FSMi.O(),
+ FSMi.NS(), FSMi.OS(), FSMi.PS(), FSMi.PI(),
+ blocklength,
+ STi0,STiK,
+ true, false,
+ p2mymin,
+ &(ipriori[0]), &(iprioro[0]), &(iposti[0]));
+
+ //interleave soft info inner -> outer
+ for(int k=0;k<blocklength;k++) {
+ int ki = INTERLEAVER.DEINTER()[k];
+ //for(int i=0;i<FSMi.I();i++) {
+ //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i];
+ //}
+ memcpy(&(oprioro[k*FSMi.I()]),&(iposti[ki*FSMi.I()]),FSMi.I()*sizeof(float));
+ }
+
+ // run outer SISO
+
+ if(rep<iterations-1) { // do not produce posti
+ siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(),
+ FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(),
+ blocklength,
+ STo0,SToK,
+ false, true,
+ p2mymin,
+ &(opriori[0]), &(oprioro[0]), &(oposto[0]));
+
+ //interleave soft info outer --> inner
+ for(int k=0;k<blocklength;k++) {
+ int ki = INTERLEAVER.DEINTER()[k];
+ //for(int i=0;i<FSMi.I();i++) {
+ //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i];
+ //}
+ memcpy(&(ipriori[ki*FSMi.I()]),&(oposto[k*FSMi.I()]),FSMi.I()*sizeof(float));
+ }
+ }
+ else {// produce posti but not posto
+ siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(),
+ FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(),
+ blocklength,
+ STo0,SToK,
+ true, false,
+ p2mymin,
+ &(opriori[0]), &(oprioro[0]), &(oposti[0]));
+
+ /*
+ viterbi_algorithm(FSMo.I(),FSMo.S(),FSMo.O(),
+ FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(),
+ blocklength,
+ STo0,SToK,
+ &(oprioro[0]), data);
+ */
+ }
+ } // end iterations
+
+ // generate hard decisions
+ for(int k=0;k<blocklength;k++) {
+ float min=INF;
+ int mini=0;
+ for(int i=0;i<FSMo.I();i++) {
+ if(oposti[k*FSMo.I()+i]<min) {
+ min=oposti[k*FSMo.I()+i];
+ mini=i;
+ }
+ }
+ data[k]=(T)mini;
+ }
+ }
+
+ //-------
+
+ template void
+ sccc_decoder<unsigned char>(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ const float *iprioro, unsigned char *data);
+
+ template void
+ sccc_decoder<short>(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ const float *iprioro, short *data);
+
+ template void
+ sccc_decoder<int>(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ const float *iprioro, int *data);
+
+ //====================================================
+
+ template<class T> void
+ pccc_decoder(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ const float *cprioro, T *data)
+ {
+ //allocate space for priori, prioro and posti of FSM1
+ std::vector<float> priori1(blocklength*FSM1.I(),0.0);
+ std::vector<float> prioro1(blocklength*FSM1.O());
+ std::vector<float> posti1(blocklength*FSM1.I());
+
+ //allocate space for priori, prioro and posti of FSM2
+ std::vector<float> priori2(blocklength*FSM2.I(),0.0);
+ std::vector<float> prioro2(blocklength*FSM2.O());
+ std::vector<float> posti2(blocklength*FSM2.I());
+
+ //generate prioro1,2 (metrics are not updated per iteration: this is not the best you can do...)
+ for(int k=0;k<blocklength;k++) {
+ //std::cout << k << std::endl;
+ for(int i=0;i<FSM1.O();i++) {
+ float x=cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+0];
+ for(int j=1;j<FSM2.O();j++)
+ x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+j]);
+ prioro1[k*FSM1.O()+i]=x;
+ //std::cout << prioro1[k*FSM1.O()+i] << ", ";
+ }
+ //std::cout << std::endl;
+ for(int i=0;i<FSM2.O();i++) {
+ float x=cprioro[k*FSM1.O()*FSM2.O()+0*FSM1.O()+i];
+ for(int j=1;j<FSM1.O();j++)
+ x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+j*FSM1.O()+i]);
+ prioro2[k*FSM2.O()+i]=x;
+ }
+ }
+
+ for(int rep=0;rep<iterations;rep++) {
+ // run SISO 1
+ siso_algorithm(FSM1.I(),FSM1.S(),FSM1.O(),
+ FSM1.NS(), FSM1.OS(), FSM1.PS(), FSM1.PI(),
+ blocklength,
+ ST10,ST1K,
+ true, false,
+ p2mymin,
+ &(priori1[0]), &(prioro1[0]), &(posti1[0]));
+
+ //for(int k=0;k<blocklength;k++){
+ //for(int i=0;i<FSM1.I();i++)
+ //std::cout << posti1[k*FSM1.I()+i] << ", ";
+ //std::cout << std::endl;
+ //}
+
+ //interleave soft info 1 -> 2
+ for(int k=0;k<blocklength;k++) {
+ int ki = INTERLEAVER.INTER()[k];
+ //for(int i=0;i<FSMi.I();i++) {
+ //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i];
+ //}
+ memcpy(&(priori2[k*FSM2.I()]),&(posti1[ki*FSM1.I()]),FSM1.I()*sizeof(float));
+ }
+
+ // run SISO 2
+ siso_algorithm(FSM2.I(),FSM2.S(),FSM2.O(),
+ FSM2.NS(), FSM2.OS(), FSM2.PS(), FSM2.PI(),
+ blocklength,
+ ST20,ST2K,
+ true, false,
+ p2mymin,
+ &(priori2[0]), &(prioro2[0]), &(posti2[0]));
+
+ //interleave soft info 2 --> 1
+ for(int k=0;k<blocklength;k++) {
+ int ki = INTERLEAVER.INTER()[k];
+ //for(int i=0;i<FSMi.I();i++) {
+ //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i];
+ //}
+ memcpy(&(priori1[ki*FSM1.I()]),&(posti2[k*FSM2.I()]),FSM1.I()*sizeof(float));
+ }
+ } // end iterations
+
+ // generate hard decisions
+ for(int k=0;k<blocklength;k++) {
+ for(int i=0;i<FSM1.I();i++)
+ posti1[k*FSM1.I()+i] = (*p2mymin)(priori1[k*FSM1.I()+i],posti1[k*FSM1.I()+i]);
+ float min=INF;
+ int mini=0;
+ for(int i=0;i<FSM1.I();i++) {
+ if(posti1[k*FSM1.I()+i]<min) {
+ min=posti1[k*FSM1.I()+i];
+ mini=i;
+ }
+ }
+ data[k]=(T)mini;
+ //std::cout << data[k] << ", "<< std::endl;
+ }
+ //std::cout << std::endl;
+ }
+
+ //----------------
+
+ template void
+ pccc_decoder<unsigned char>(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ const float *cprioro, unsigned char *data);
+
+ template void
+ pccc_decoder<short>(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ const float *cprioro, short *data);
+
+ template void
+ pccc_decoder<int>(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ const float *cprioro, int *data);
+
+ //----------------
+
+ template<class Ti, class To> void
+ pccc_decoder_combined(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<Ti> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const Ti *observations, To *data)
+ {
+ //allocate space for cprioro
+ std::vector<float> cprioro(blocklength*FSM1.O()*FSM2.O(),0.0);
+
+ //allocate space for priori, prioro and posti of FSM1
+ std::vector<float> priori1(blocklength*FSM1.I(),0.0);
+ std::vector<float> prioro1(blocklength*FSM1.O());
+ std::vector<float> posti1(blocklength*FSM1.I());
+
+ //allocate space for priori, prioro and posti of FSM2
+ std::vector<float> priori2(blocklength*FSM2.I(),0.0);
+ std::vector<float> prioro2(blocklength*FSM2.O());
+ std::vector<float> posti2(blocklength*FSM2.I());
+
+ // turn observations to neg-log-priors for cprioiro
+ int O=FSM1.O()*FSM2.O();
+ for(int k=0;k<blocklength;k++) {
+ calc_metric(O, D, TABLE, &(observations[k*D]), &(cprioro[k*O]),METRIC_TYPE);
+ cprioro[k*O] *= scaling;
+ }
+
+ //generate prioro1,2 (metrics are not updated per iteration: this is not the best you can do...)
+ for(int k=0;k<blocklength;k++) {
+ //std::cout << k << std::endl;
+ for(int i=0;i<FSM1.O();i++) {
+ float x=cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+0];
+ for(int j=1;j<FSM2.O();j++)
+ x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+j]);
+ prioro1[k*FSM1.O()+i]=x;
+ //std::cout << prioro1[k*FSM1.O()+i] << ", ";
+ }
+ //std::cout << std::endl;
+ for(int i=0;i<FSM2.O();i++) {
+ float x=cprioro[k*FSM1.O()*FSM2.O()+0*FSM1.O()+i];
+ for(int j=1;j<FSM1.O();j++)
+ x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+j*FSM1.O()+i]);
+ prioro2[k*FSM2.O()+i]=x;
+ }
+ }
+
+ for(int rep=0;rep<iterations;rep++) {
+ // run SISO 1
+ siso_algorithm(FSM1.I(),FSM1.S(),FSM1.O(),
+ FSM1.NS(), FSM1.OS(), FSM1.PS(), FSM1.PI(),
+ blocklength,
+ ST10,ST1K,
+ true, false,
+ p2mymin,
+ &(priori1[0]), &(prioro1[0]), &(posti1[0]));
+
+ //for(int k=0;k<blocklength;k++){
+ //for(int i=0;i<FSM1.I();i++)
+ //std::cout << posti1[k*FSM1.I()+i] << ", ";
+ //std::cout << std::endl;
+ //}
+
+ //interleave soft info 1 -> 2
+ for(int k=0;k<blocklength;k++) {
+ int ki = INTERLEAVER.INTER()[k];
+ //for(int i=0;i<FSMi.I();i++) {
+ //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i];
+ //}
+ memcpy(&(priori2[k*FSM2.I()]),&(posti1[ki*FSM1.I()]),FSM1.I()*sizeof(float));
+ }
+
+ // run SISO 2
+ siso_algorithm(FSM2.I(),FSM2.S(),FSM2.O(),
+ FSM2.NS(), FSM2.OS(), FSM2.PS(), FSM2.PI(),
+ blocklength,
+ ST20,ST2K,
+ true, false,
+ p2mymin,
+ &(priori2[0]), &(prioro2[0]), &(posti2[0]));
+
+ //interleave soft info 2 --> 1
+ for(int k=0;k<blocklength;k++) {
+ int ki = INTERLEAVER.INTER()[k];
+ //for(int i=0;i<FSMi.I();i++) {
+ //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i];
+ //}
+ memcpy(&(priori1[ki*FSM1.I()]),&(posti2[k*FSM2.I()]),FSM1.I()*sizeof(float));
+ }
+ } // end iterations
+
+ // generate hard decisions
+ for(int k=0;k<blocklength;k++) {
+ for(int i=0;i<FSM1.I();i++)
+ posti1[k*FSM1.I()+i] = (*p2mymin)(priori1[k*FSM1.I()+i],posti1[k*FSM1.I()+i]);
+ float min=INF;
+ int mini=0;
+ for(int i=0;i<FSM1.I();i++) {
+ if(posti1[k*FSM1.I()+i]<min) {
+ min=posti1[k*FSM1.I()+i];
+ mini=i;
+ }
+ }
+ data[k]=(To)mini;
+ //std::cout << data[k] << ", "<< std::endl;
+ }
+ //std::cout << std::endl;
+ }
+
+ template void
+ pccc_decoder_combined(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const float *observations, unsigned char *data);
+
+ template void
+ pccc_decoder_combined(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const float *observations, short *data);
+
+ template void
+ pccc_decoder_combined(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const float *observations, int *data);
+
+ template void
+ pccc_decoder_combined(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<gr_complex> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const gr_complex *observations, unsigned char *data);
+
+ template void
+ pccc_decoder_combined(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<gr_complex> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const gr_complex *observations, short *data);
+
+ template void
+ pccc_decoder_combined(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER, int blocklength,
+ int iterations,
+ float (*p2mymin)(float,float),
+ int D, const std::vector<gr_complex> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling,
+ const gr_complex *observations, int *data);
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/encoder_XX_impl.cc.t b/gr-trellis/lib/encoder_XX_impl.cc.t
new file mode 100644
index 0000000000..fdda593d45
--- /dev/null
+++ b/gr-trellis/lib/encoder_XX_impl.cc.t
@@ -0,0 +1,82 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@NAME@.h"
+#include <gr_io_signature.h>
+#include <iostream>
+
+namespace gr {
+ namespace trellis {
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(const fsm &FSM, int ST)
+ {
+ return gnuradio::get_initial_sptr
+ (new @IMPL_NAME@(FSM,ST));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM, int ST)
+ : gr_sync_block("@BASE_NAME@",
+ gr_make_io_signature(1, -1, sizeof(@I_TYPE@)),
+ gr_make_io_signature(1, -1, sizeof(@O_TYPE@))),
+ d_FSM(FSM),
+ d_ST(ST)
+ {
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ }
+
+ int
+ @IMPL_NAME@::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int ST_tmp = 0;
+ int nstreams = input_items.size();
+
+ for(int m=0;m<nstreams;m++) {
+ const @I_TYPE@ *in = (const @I_TYPE@*)input_items[m];
+ @O_TYPE@ *out = (@O_TYPE@ *) output_items[m];
+ ST_tmp = d_ST;
+
+ // per stream processing
+ for(int i = 0; i < noutput_items; i++) {
+ out[i] = (@O_TYPE@)d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]]; // direction of time?
+ ST_tmp = (int)d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]];
+ }
+ // end per stream processing
+ }
+ d_ST = ST_tmp;
+
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/src/lib/trellis_viterbi_X.i.t b/gr-trellis/lib/encoder_XX_impl.h.t
index 063f4a1b39..949f1182de 100644
--- a/gr-trellis/src/lib/trellis_viterbi_X.i.t
+++ b/gr-trellis/lib/encoder_XX_impl.h.t
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -22,28 +22,33 @@
// @WARNING@
-GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
-
-@SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK);
-
-
-class @NAME@ : public gr_block
-{
-private:
- @NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK);
-
-public:
- fsm FSM () const { return d_FSM; }
- int K () const { return d_K; }
- int S0 () const { return d_S0; }
- int SK () const { return d_SK; }
- //std::vector<short> trace () const { return d_trace; }
-};
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/@BASE_NAME@.h>
+
+namespace gr {
+ namespace trellis {
+
+ class @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ fsm d_FSM;
+ int d_ST;
+
+ public:
+ @IMPL_NAME@(const fsm &FSM, int ST);
+ ~@IMPL_NAME@();
+
+ fsm FSM() const { return d_FSM; }
+ int ST() const { return d_ST; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/lib/fsm.cc b/gr-trellis/lib/fsm.cc
new file mode 100644
index 0000000000..16efcd10f2
--- /dev/null
+++ b/gr-trellis/lib/fsm.cc
@@ -0,0 +1,521 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <cstdio>
+#include <string>
+#include <iostream>
+#include <fstream>
+#include <stdexcept>
+#include <cmath>
+#include <stdlib.h>
+#include <trellis/base.h>
+#include <trellis/fsm.h>
+
+namespace gr {
+ namespace trellis {
+
+ fsm::fsm()
+ {
+ d_I=0;
+ d_S=0;
+ d_O=0;
+ d_NS.resize(0);
+ d_OS.resize(0);
+ d_PS.resize(0);
+ d_PI.resize(0);
+ d_TMi.resize(0);
+ d_TMl.resize(0);
+ }
+
+ fsm::fsm(const fsm &FSM)
+ {
+ d_I=FSM.I();
+ d_S=FSM.S();
+ d_O=FSM.O();
+ d_NS=FSM.NS();
+ d_OS=FSM.OS();
+ d_PS=FSM.PS(); // is this going to make a deep copy?
+ d_PI=FSM.PI();
+ d_TMi=FSM.TMi();
+ d_TMl=FSM.TMl();
+ }
+
+ fsm::fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS)
+ {
+ d_I=I;
+ d_S=S;
+ d_O=O;
+ d_NS=NS;
+ d_OS=OS;
+
+ generate_PS_PI();
+ generate_TM();
+ }
+
+ //######################################################################
+ //# Read an FSM specification from a file.
+ //# Format (hopefully will become more flexible in the future...):
+ //# I S O (in the first line)
+ //# blank line
+ //# Next state matrix (S lines, each with I integers separated by spaces)
+ //# blank line
+ //# output symbol matrix (S lines, each with I integers separated by spaces)
+ //# optional comments
+ //######################################################################
+ fsm::fsm(const char *name)
+ {
+ FILE *fsmfile;
+
+ if((fsmfile=fopen(name,"r"))==NULL)
+ throw std::runtime_error ("fsm::fsm(const char *name): file open error\n");
+ //printf("file open error in fsm()\n");
+
+ if(fscanf(fsmfile,"%d %d %d\n",&d_I,&d_S,&d_O) == EOF) {
+ if(ferror(fsmfile) != 0)
+ throw std::runtime_error ("fsm::fsm(const char *name): file read error\n");
+ }
+
+ d_NS.resize(d_I*d_S);
+ d_OS.resize(d_I*d_S);
+
+ for(int i=0;i<d_S;i++) {
+ for(int j=0;j<d_I;j++) {
+ if(fscanf(fsmfile,"%d",&(d_NS[i*d_I+j])) == EOF) {
+ if(ferror(fsmfile) != 0)
+ throw std::runtime_error ("fsm::fsm(const char *name): file read error\n");
+ }
+ }
+ }
+ for(int i=0;i<d_S;i++) {
+ for(int j=0;j<d_I;j++) {
+ if(fscanf(fsmfile,"%d",&(d_OS[i*d_I+j])) == EOF) {
+ if(ferror(fsmfile) != 0)
+ throw std::runtime_error ("fsm::fsm(const char *name): file read error\n");
+ }
+ }
+ }
+
+ fclose(fsmfile);
+
+ generate_PS_PI();
+ generate_TM();
+ }
+
+ //######################################################################
+ //# Automatically generate the FSM from the generator matrix
+ //# of a (n,k) binary convolutional code
+ //######################################################################
+ fsm::fsm(int k, int n, const std::vector<int> &G)
+ {
+ // calculate maximum memory requirements for each input stream
+ std::vector<int> max_mem_x(k,-1);
+ int max_mem = -1;
+ for(int i=0;i<k;i++) {
+ for(int j=0;j<n;j++) {
+ int mem = -1;
+ if(G[i*n+j]!=0)
+ mem=(int)(log(double(G[i*n+j]))/log(2.0));
+ if(mem>max_mem_x[i])
+ max_mem_x[i]=mem;
+ if(mem>max_mem)
+ max_mem=mem;
+ }
+ }
+
+ //printf("max_mem_x\n");
+ //for(int j=0;j<max_mem_x.size();j++) printf("%d ",max_mem_x[j]); printf("\n");
+
+ // calculate total memory requirements to set S
+ int sum_max_mem = 0;
+ for(int i=0;i<k;i++)
+ sum_max_mem += max_mem_x[i];
+
+ //printf("sum_max_mem = %d\n",sum_max_mem);
+
+ d_I=1<<k;
+ d_S=1<<sum_max_mem;
+ d_O=1<<n;
+
+ // binary representation of the G matrix
+ std::vector<std::vector<int> > Gb(k*n);
+ for(int j=0;j<k*n;j++) {
+ Gb[j].resize(max_mem+1);
+ dec2base(G[j],2,Gb[j]);
+ //printf("Gb\n");
+ //for(int m=0;m<Gb[j].size();m++) printf("%d ",Gb[j][m]); printf("\n");
+ }
+
+ // alphabet size of each shift register
+ std::vector<int> bases_x(k);
+ for(int j=0;j<k ;j++)
+ bases_x[j] = 1 << max_mem_x[j];
+ //printf("bases_x\n");
+ //for(int j=0;j<max_mem_x.size();j++) printf("%d ",max_mem_x[j]); printf("\n");
+
+ d_NS.resize(d_I*d_S);
+ d_OS.resize(d_I*d_S);
+
+ std::vector<int> sx(k);
+ std::vector<int> nsx(k);
+ std::vector<int> tx(k);
+ std::vector<std::vector<int> > tb(k);
+ for(int j=0;j<k;j++)
+ tb[j].resize(max_mem+1);
+ std::vector<int> inb(k);
+ std::vector<int> outb(n);
+
+ for(int s=0;s<d_S;s++) {
+ dec2bases(s,bases_x,sx); // split s into k values, each representing one of the k shift registers
+ //printf("state = %d \nstates = ",s);
+ //for(int j=0;j<sx.size();j++) printf("%d ",sx[j]); printf("\n");
+ for(int i=0;i<d_I;i++) {
+ dec2base(i,2,inb); // input in binary
+ //printf("input = %d \ninputs = ",i);
+ //for(int j=0;j<inb.size();j++) printf("%d ",inb[j]); printf("\n");
+
+ // evaluate next state
+ for(int j=0;j<k;j++)
+ nsx[j] = (inb[j]*bases_x[j]+sx[j])/2; // next state (for each shift register) MSB first
+ d_NS[s*d_I+i]=bases2dec(nsx,bases_x); // collect all values into the new state
+
+ // evaluate transitions
+ for(int j=0;j<k;j++)
+ tx[j] = inb[j]*bases_x[j]+sx[j]; // transition (for each shift register)MSB first
+ for(int j=0;j<k;j++) {
+ dec2base(tx[j],2,tb[j]); // transition in binary
+ //printf("transition = %d \ntransitions = ",tx[j]);
+ //for(int m=0;m<tb[j].size();m++) printf("%d ",tb[j][m]); printf("\n");
+ }
+
+ // evaluate outputs
+ for(int nn=0;nn<n;nn++) {
+ outb[nn] = 0;
+ for(int j=0;j<k;j++) {
+ for(int m=0;m<max_mem+1;m++)
+ outb[nn] = (outb[nn] + Gb[j*n+nn][m]*tb[j][m]) % 2; // careful: polynomial 1+D ir represented as 110, not as 011
+ //printf("output %d equals %d\n",nn,outb[nn]);
+ }
+ }
+ d_OS[s*d_I+i] = base2dec(outb,2);
+ }
+ }
+
+ generate_PS_PI();
+ generate_TM();
+ }
+
+ //######################################################################
+ //# Automatically generate an FSM specification describing the
+ //# ISI for a channel
+ //# of length ch_length and a modulation of size mod_size
+ //######################################################################
+ fsm::fsm(int mod_size, int ch_length)
+ {
+ d_I=mod_size;
+ d_S=(int) (pow(1.0*d_I,1.0*ch_length-1)+0.5);
+ d_O=d_S*d_I;
+
+ d_NS.resize(d_I*d_S);
+ d_OS.resize(d_I*d_S);
+
+ for(int s=0;s<d_S;s++) {
+ for(int i=0;i<d_I;i++) {
+ int t=i*d_S+s;
+ d_NS[s*d_I+i] = t/d_I;
+ d_OS[s*d_I+i] = t;
+ }
+ }
+
+ generate_PS_PI();
+ generate_TM();
+ }
+
+ //######################################################################
+ //# Automatically generate an FSM specification describing the
+ //# the trellis for a CPM with h=K/P (relatively prime),
+ //# alphabet size M, and frequency pulse duration L symbols
+ //#
+ //# This FSM is based on the paper by B. Rimoldi
+ //# "A decomposition approach to CPM", IEEE Trans. Info Theory, March 1988
+ //# See also my own notes at http://www.eecs.umich.edu/~anastas/docs/cpm.pdf
+ //######################################################################
+ fsm::fsm(int P, int M, int L)
+ {
+ d_I=M;
+ d_S=(int)(pow(1.0*M,1.0*L-1)+0.5)*P;
+ d_O=(int)(pow(1.0*M,1.0*L)+0.5)*P;
+
+ d_NS.resize(d_I*d_S);
+ d_OS.resize(d_I*d_S);
+ int nv;
+ for(int s=0;s<d_S;s++) {
+ for(int i=0;i<d_I;i++) {
+ int s1=s/P;
+ int v=s%P;
+ int ns1= (i*(int)(pow(1.0*M,1.0*(L-1))+0.5)+s1)/M;
+ if (L==1)
+ nv=(i+v)%P;
+ else
+ nv=(s1%M+v)%P;
+ d_NS[s*d_I+i] = ns1*P+nv;
+ d_OS[s*d_I+i] = i*d_S+s;
+ }
+ }
+
+ generate_PS_PI();
+ generate_TM();
+ }
+
+ //######################################################################
+ //# Automatically generate an FSM specification describing the
+ //# the joint trellis of fsm1 and fsm2
+ //######################################################################
+ fsm::fsm(const fsm &FSM1, const fsm &FSM2)
+ {
+ d_I=FSM1.I()*FSM2.I();
+ d_S=FSM1.S()*FSM2.S();
+ d_O=FSM1.O()*FSM2.O();
+
+ d_NS.resize(d_I*d_S);
+ d_OS.resize(d_I*d_S);
+
+ for(int s=0;s<d_S;s++) {
+ for(int i=0;i<d_I;i++) {
+ int s1=s/FSM2.S();
+ int s2=s%FSM2.S();
+ int i1=i/FSM2.I();
+ int i2=i%FSM2.I();
+ d_NS[s*d_I+i] = FSM1.NS()[s1 * FSM1.I() + i1] * FSM2.S() + FSM2.NS()[s2 * FSM2.I() + i2];
+ d_OS[s*d_I+i] = FSM1.OS()[s1 * FSM1.I() + i1] * FSM2.O() + FSM2.OS()[s2 * FSM2.I() + i2];
+ }
+ }
+
+ generate_PS_PI();
+ generate_TM();
+ }
+
+ //######################################################################
+ //# Generate a new FSM representing n stages through the original FSM
+ //# AKA radix-n FSM
+ //######################################################################
+ fsm::fsm(const fsm &FSM, int n)
+ {
+ d_I=(int) (pow(1.0*FSM.I(),1.0*n)+0.5);
+ d_S=FSM.S();
+ d_O=(int) (pow(1.0*FSM.O(),1.0*n)+0.5);
+
+ d_NS.resize(d_I*d_S);
+ d_OS.resize(d_I*d_S);
+
+ for(int s=0;s<d_S;s++ ) {
+ for(int i=0;i<d_I;i++ ) {
+ std::vector<int> ii(n);
+ dec2base(i,FSM.I(),ii);
+ std::vector<int> oo(n);
+ int ns=s;
+ for(int k=0;k<n;k++) {
+ oo[k]=FSM.OS()[ns*FSM.I()+ii[k]];
+ ns=FSM.NS()[ns*FSM.I()+ii[k]];
+ }
+ d_NS[s*d_I+i]=ns;
+ d_OS[s*d_I+i]=base2dec(oo,FSM.O());
+ }
+ }
+
+ generate_PS_PI();
+ generate_TM();
+ }
+
+ //######################################################################
+ //# generate the PS and PI tables for later use
+ //######################################################################
+ void
+ fsm::generate_PS_PI()
+ {
+ d_PS.resize(d_S);
+ d_PI.resize(d_S);
+
+ for(int i=0;i<d_S;i++) {
+ d_PS[i].resize(d_I*d_S); // max possible size
+ d_PI[i].resize(d_I*d_S);
+ int j=0;
+ for(int ii=0;ii<d_S;ii++) for(int jj=0;jj<d_I;jj++) {
+ if(d_NS[ii*d_I+jj]!=i) continue;
+ d_PS[i][j]=ii;
+ d_PI[i][j]=jj;
+ j++;
+ }
+ d_PS[i].resize(j);
+ d_PI[i].resize(j);
+ }
+ }
+
+ //######################################################################
+ //# generate the termination matrices TMl and TMi for later use
+ //######################################################################
+ void
+ fsm::generate_TM()
+ {
+ d_TMi.resize(d_S*d_S);
+ d_TMl.resize(d_S*d_S);
+
+ for(int i=0;i<d_S*d_S;i++) {
+ d_TMi[i] = -1; // no meaning
+ d_TMl[i] = d_S; //infinity: you need at most S-1 steps
+ if (i/d_S == i%d_S)
+ d_TMl[i] = 0;
+ }
+
+ for(int s=0;s<d_S;s++) {
+ bool done = false;
+ int attempts = 0;
+ while (done == false && attempts < d_S-1) {
+ done = find_es(s);
+ attempts ++;
+ }
+ if (done == false && d_S > 1) {
+ //throw std::runtime_error ("fsm::generate_TM(): FSM appears to be disconnected\n");
+ printf("fsm::generate_TM(): FSM appears to be disconnected\n");
+ printf("state %d cannot be reached from all other states\n",s);
+ }
+ }
+ }
+
+ // find a path from any state to the ending state "es"
+ bool
+ fsm::find_es(int es)
+ {
+ bool done = true;
+ for(int s=0;s<d_S;s++) {
+ if(d_TMl[s*d_S+es] < d_S)
+ continue;
+ int minl=d_S;
+ int mini=-1;
+ for(int i=0;i<d_I;i++) {
+ if( 1 + d_TMl[d_NS[s*d_I+i]*d_S+es] < minl) {
+ minl = 1 + d_TMl[d_NS[s*d_I+i]*d_S+es];
+ mini = i;
+ }
+ }
+ if (mini != -1) {
+ d_TMl[s*d_S+es]=minl;
+ d_TMi[s*d_S+es]=mini;
+ }
+ else
+ done = false;
+ }
+ return done;
+ }
+
+ //######################################################################
+ //# generate trellis representation of FSM as an SVG file
+ //######################################################################
+ void
+ fsm::write_trellis_svg(std::string filename, int number_stages)
+ {
+ std::ofstream trellis_fname (filename.c_str());
+ if(!trellis_fname) {
+ std::cout << "file not found " << std::endl ; exit(-1);
+ }
+ const int TRELLIS_Y_OFFSET = 30;
+ const int TRELLIS_X_OFFSET = 20;
+ const int STAGE_LABEL_Y_OFFSET = 25;
+ const int STAGE_LABEL_X_OFFSET = 20;
+ const int STATE_LABEL_Y_OFFSET = 30;
+ const int STATE_LABEL_X_OFFSET = 5;
+ const int STAGE_STATE_OFFSETS = 10;
+ // std::cout << "################## BEGIN SVG TRELLIS PIC #####################" << std::endl;
+ trellis_fname << "<svg viewBox = \"0 0 200 200\" version = \"1.1\">" << std::endl;
+
+ for(int stage_num = 0;stage_num < number_stages;stage_num ++) {
+ // draw states
+ for(int state_num = 0;state_num < d_S ; state_num ++ ) {
+ trellis_fname << "<circle cx = \"" << stage_num * STAGE_STATE_OFFSETS + TRELLIS_X_OFFSET <<
+ "\" cy = \"" << state_num * STAGE_STATE_OFFSETS + TRELLIS_Y_OFFSET << "\" r = \"1\"/>" << std::endl;
+ //draw branches
+ if(stage_num != number_stages-1) {
+ for(int branch_num = 0;branch_num < d_I; branch_num++) {
+ trellis_fname << "<line x1 =\"" << STAGE_STATE_OFFSETS * stage_num+ TRELLIS_X_OFFSET << "\" ";
+ trellis_fname << "y1 =\"" << state_num * STAGE_STATE_OFFSETS + TRELLIS_Y_OFFSET<< "\" ";
+ trellis_fname << "x2 =\"" << STAGE_STATE_OFFSETS *stage_num + STAGE_STATE_OFFSETS+ TRELLIS_X_OFFSET << "\" ";
+ trellis_fname << "y2 =\"" << d_NS[d_I * state_num + branch_num] * STAGE_STATE_OFFSETS + TRELLIS_Y_OFFSET << "\" ";
+ trellis_fname << " stroke-dasharray = \"3," << branch_num << "\" ";
+ trellis_fname << " stroke = \"black\" stroke-width = \"0.3\"/>" << std::endl;
+ }
+ }
+ }
+ }
+ // label the stages
+ trellis_fname << "<g font-size = \"4\" font= \"times\" fill = \"black\">" << std::endl;
+ for(int stage_num = 0;stage_num < number_stages ;stage_num ++) {
+ trellis_fname << "<text x = \"" << stage_num * STAGE_STATE_OFFSETS + STAGE_LABEL_X_OFFSET <<
+ "\" y = \"" << STAGE_LABEL_Y_OFFSET << "\" >" << std::endl;
+ trellis_fname << stage_num << std::endl;
+ trellis_fname << "</text>" << std::endl;
+ }
+ trellis_fname << "</g>" << std::endl;
+
+ // label the states
+ trellis_fname << "<g font-size = \"4\" font= \"times\" fill = \"black\">" << std::endl;
+ for(int state_num = 0;state_num < d_S ; state_num ++) {
+ trellis_fname << "<text y = \"" << state_num * STAGE_STATE_OFFSETS + STATE_LABEL_Y_OFFSET <<
+ "\" x = \"" << STATE_LABEL_X_OFFSET << "\" >" << std::endl;
+ trellis_fname << state_num << std::endl;
+ trellis_fname << "</text>" << std::endl;
+ }
+ trellis_fname << "</g>" << std::endl;
+
+ trellis_fname << "</svg>" << std::endl;
+ // std::cout << "################## END SVG TRELLIS PIC ##################### " << std::endl;
+ trellis_fname.close();
+ }
+
+ //######################################################################
+ //# Write trellis specification to a text file,
+ //# in the same format used when reading FSM files
+ //######################################################################
+ void
+ fsm::write_fsm_txt(std::string filename)
+ {
+ std::ofstream trellis_fname (filename.c_str());
+ if(!trellis_fname) {
+ std::cout << "file not found " << std::endl ; exit(-1);
+ }
+ trellis_fname << d_I << ' ' << d_S << ' ' << d_O << std::endl;
+ trellis_fname << std::endl;
+ for(int i=0;i<d_S;i++) {
+ for(int j=0;j<d_I;j++)
+ trellis_fname << d_NS[i*d_I+j] << ' ';
+ trellis_fname << std::endl;
+ }
+ trellis_fname << std::endl;
+ for(int i=0;i<d_S;i++) {
+ for(int j=0;j<d_I;j++)
+ trellis_fname << d_OS[i*d_I+j] << ' ';
+ trellis_fname << std::endl;
+ }
+ trellis_fname << std::endl;
+ trellis_fname.close();
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/interleaver.cc b/gr-trellis/lib/interleaver.cc
new file mode 100644
index 0000000000..27248a6d43
--- /dev/null
+++ b/gr-trellis/lib/interleaver.cc
@@ -0,0 +1,147 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2002,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <cstdlib>
+#include <cstdio>
+#include <iostream>
+#include <string>
+#include <fstream>
+#include <stdexcept>
+#include <cmath>
+#include <trellis/quicksort_index.h>
+#include <trellis/interleaver.h>
+
+namespace gr {
+ namespace trellis {
+
+ interleaver::interleaver()
+ {
+ d_K=0;
+ d_INTER.resize(0);
+ d_DEINTER.resize(0);
+ }
+
+ interleaver::interleaver(const interleaver &INTERLEAVER)
+ {
+ d_K=INTERLEAVER.K();
+ d_INTER=INTERLEAVER.INTER();
+ d_DEINTER=INTERLEAVER.DEINTER();
+ }
+
+ interleaver::interleaver(int K, const std::vector<int> &INTER)
+ {
+ d_K=K;
+ d_INTER=INTER;
+ d_DEINTER.resize(d_K);
+
+ // generate DEINTER table
+ for(int i=0;i<d_K;i++) {
+ d_DEINTER[d_INTER[i]]=i;
+ }
+ }
+
+ //######################################################################
+ //# Read an INTERLEAVER specification from a file.
+ //# Format (hopefully will become more flexible in the future...):
+ //# K
+ //# blank line
+ //# list of space separated K integers from 0 to K-1 in appropriate order
+ //# optional comments
+ //######################################################################
+ interleaver::interleaver(const char *name)
+ {
+ FILE *interleaverfile;
+
+ if((interleaverfile=fopen(name,"r")) == NULL)
+ throw std::runtime_error ("file open error in interleaver()");
+ //printf("file open error in interleaver()\n");
+
+ if(fscanf(interleaverfile,"%d\n",&d_K) == EOF) {
+ if(ferror(interleaverfile) != 0)
+ throw std::runtime_error ("interleaver::interleaver(const char *name): file read error\n");
+ }
+
+ d_INTER.resize(d_K);
+ d_DEINTER.resize(d_K);
+
+ for(int i=0;i<d_K;i++) {
+ if(fscanf(interleaverfile,"%d",&(d_INTER[i])) == EOF) {
+ if(ferror(interleaverfile) != 0)
+ throw std::runtime_error("interleaver::interleaver(const char *name): file read error\n");
+ }
+ }
+
+ // generate DEINTER table
+ for(int i=0;i<d_K;i++) {
+ d_DEINTER[d_INTER[i]]=i;
+ }
+ }
+
+ //######################################################################
+ //# Generate a random interleaver
+ //######################################################################
+ interleaver::interleaver(int K, int seed)
+ {
+ d_K=K;
+ d_INTER.resize(d_K);
+ d_DEINTER.resize(d_K);
+
+ if(seed>=0)
+ srand((unsigned int)seed);
+ std::vector<int> tmp(d_K);
+ for(int i=0;i<d_K;i++) {
+ d_INTER[i]=i;
+ tmp[i] = rand();
+ }
+ quicksort_index <int> (tmp,d_INTER,0,d_K-1);
+
+ // generate DEINTER table
+ for(int i=0;i<d_K;i++) {
+ d_DEINTER[d_INTER[i]]=i;
+ }
+ }
+
+ //######################################################################
+ //# Write an INTERLEAVER specification to a file.
+ //# Format
+ //# K
+ //# blank line
+ //# list of space separated K integers from 0 to K-1 in appropriate order
+ //# optional comments
+ //######################################################################
+ void
+ interleaver::write_interleaver_txt(std::string filename)
+ {
+ std::ofstream interleaver_fname (filename.c_str());
+ if(!interleaver_fname) {
+ std::cout << "file not found " << std::endl ; exit(-1);
+ }
+ interleaver_fname << d_K << std::endl;
+ interleaver_fname << std::endl;
+ for(int i=0;i<d_K;i++)
+ interleaver_fname << d_INTER[i] << ' ';
+ interleaver_fname << std::endl;
+ interleaver_fname.close();
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/metrics_X_impl.cc.t b/gr-trellis/lib/metrics_X_impl.cc.t
new file mode 100644
index 0000000000..c74051c53e
--- /dev/null
+++ b/gr-trellis/lib/metrics_X_impl.cc.t
@@ -0,0 +1,98 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@NAME@.h"
+#include <gr_io_signature.h>
+#include <assert.h>
+#include <stdexcept>
+#include <iostream>
+
+namespace gr {
+ namespace trellis {
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(int O, int D, const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t TYPE)
+ {
+ return gnuradio::get_initial_sptr
+ (new @IMPL_NAME@(O,D,TABLE,TYPE));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(int O, int D, const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t TYPE)
+ : gr_block("@BASE_NAME@",
+ gr_make_io_signature(1, -1, sizeof (@I_TYPE@)),
+ gr_make_io_signature(1, -1, sizeof (float))),
+ d_O(O), d_D(D), d_TYPE(TYPE), d_TABLE(TABLE)
+ {
+ set_relative_rate (1.0 * d_O / ((double) d_D));
+ set_output_multiple ((int)d_O);
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ }
+
+ void
+ @IMPL_NAME@::set_TABLE(const std::vector<@I_TYPE@> &table)
+ {
+ d_TABLE = table;
+ }
+
+ void
+ @IMPL_NAME@::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ int input_required = d_D * noutput_items / d_O;
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned int i = 0; i < ninputs; i++)
+ ninput_items_required[i] = input_required;
+ }
+
+ int
+ @IMPL_NAME@::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int nstreams = input_items.size();
+
+ for(int m = 0; m < nstreams; m++) {
+ const @I_TYPE@ *in = (@I_TYPE@*)input_items[m];
+ float *out = (float*)output_items[m];
+
+ for(int i = 0; i < noutput_items / d_O ; i++) {
+ calc_metric(d_O, d_D, d_TABLE,&(in[i*d_D]), &(out[i*d_O]), d_TYPE);
+ }
+ }
+
+ consume_each(d_D * noutput_items / d_O);
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/metrics_X_impl.h.t b/gr-trellis/lib/metrics_X_impl.h.t
new file mode 100644
index 0000000000..0f52a8bc40
--- /dev/null
+++ b/gr-trellis/lib/metrics_X_impl.h.t
@@ -0,0 +1,64 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/@BASE_NAME@.h>
+
+namespace gr {
+ namespace trellis {
+
+ class @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ int d_O;
+ int d_D;
+ digital::trellis_metric_type_t d_TYPE;
+ std::vector<@I_TYPE@> d_TABLE;
+
+ public:
+ @IMPL_NAME@(int O, int D, const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t TYPE);
+ ~@IMPL_NAME@();
+
+ int O() const { return d_O; }
+ int D() const { return d_D; }
+ digital::trellis_metric_type_t TYPE() const { return d_TYPE; }
+ std::vector<@I_TYPE@> TABLE() const { return d_TABLE; }
+ void set_TABLE(const std::vector<@I_TYPE@> &table);
+
+ void forecast(int noutput_items,
+ gr_vector_int &ninput_items_required);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/lib/pccc_decoder_X_impl.cc.t b/gr-trellis/lib/pccc_decoder_X_impl.cc.t
new file mode 100644
index 0000000000..9bf85bc614
--- /dev/null
+++ b/gr-trellis/lib/pccc_decoder_X_impl.cc.t
@@ -0,0 +1,120 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@NAME@.h"
+#include <gr_io_signature.h>
+#include <iostream>
+#include <trellis/core_algorithms.h>
+
+namespace gr {
+ namespace trellis {
+
+ static const float INF = 1.0e9;
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE)
+ {
+ return gnuradio::get_initial_sptr
+ (new @IMPL_NAME@(FSM1, ST10, ST1K,
+ FSM2, ST20, ST2K,
+ INTERLEAVER,
+ blocklength,
+ repetitions,
+ SISO_TYPE));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE)
+ : gr_block("@BASE_NAME@",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(@O_TYPE@))),
+ d_FSM1(FSM1), d_ST10(ST10), d_ST1K(ST1K),
+ d_FSM2(FSM2), d_ST20(ST20), d_ST2K(ST2K),
+ d_INTERLEAVER(INTERLEAVER),
+ d_blocklength(blocklength),
+ d_repetitions(repetitions),
+ d_SISO_TYPE(SISO_TYPE)
+ {
+ set_relative_rate (1.0 / ((double) d_FSM1.O() * d_FSM2.O()));
+ set_output_multiple (d_blocklength);
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ }
+
+ void
+ @IMPL_NAME@::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ int input_required = d_FSM1.O() * d_FSM2.O() * noutput_items;
+ ninput_items_required[0] = input_required;
+ }
+
+ //===========================================================
+
+ int
+ @IMPL_NAME@::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int nblocks = noutput_items / d_blocklength;
+
+ float (*p2min)(float, float) = NULL;
+ if(d_SISO_TYPE == TRELLIS_MIN_SUM)
+ p2min = &min;
+ else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
+ p2min = &min_star;
+
+ const float *in = (const float *) input_items[0];
+ @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
+ for(int n=0;n<nblocks;n++) {
+ pccc_decoder(d_FSM1, d_ST10, d_ST1K,
+ d_FSM2, d_ST20, d_ST2K,
+ d_INTERLEAVER, d_blocklength, d_repetitions,
+ p2min,
+ &(in[n*d_blocklength*d_FSM1.O()*d_FSM2.O()]),
+ &(out[n*d_blocklength]));
+ }
+
+ consume_each(d_FSM1.O() * d_FSM2.O() * noutput_items);
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/pccc_decoder_X_impl.h.t b/gr-trellis/lib/pccc_decoder_X_impl.h.t
new file mode 100644
index 0000000000..9b61e34fde
--- /dev/null
+++ b/gr-trellis/lib/pccc_decoder_X_impl.h.t
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/@BASE_NAME@.h>
+
+namespace gr {
+ namespace trellis {
+
+ class @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ fsm d_FSM1;
+ int d_ST10;
+ int d_ST1K;
+ fsm d_FSM2;
+ int d_ST20;
+ int d_ST2K;
+ interleaver d_INTERLEAVER;
+ int d_blocklength;
+ int d_repetitions;
+ siso_type_t d_SISO_TYPE;
+ std::vector<float> d_buffer;
+
+ public:
+ @IMPL_NAME@(const fsm &FSM1, int ST10, int ST1K,
+ const fsm &FSM2, int ST20, int ST2K,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE);
+ ~@IMPL_NAME@();
+
+ fsm FSM1() const { return d_FSM1; }
+ fsm FSM2() const { return d_FSM2; }
+ int ST10() const { return d_ST10; }
+ int ST1K() const { return d_ST1K; }
+ int ST20() const { return d_ST20; }
+ int ST2K() const { return d_ST2K; }
+ interleaver INTERLEAVER() const { return d_INTERLEAVER; }
+ int blocklength() const { return d_blocklength; }
+ int repetitions() const { return d_repetitions; }
+ siso_type_t SISO_TYPE() const { return d_SISO_TYPE; }
+
+ void forecast(int noutput_items,
+ gr_vector_int &ninput_items_required);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t b/gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t
new file mode 100644
index 0000000000..21a5c0b3ae
--- /dev/null
+++ b/gr-trellis/lib/pccc_decoder_combined_XX_impl.cc.t
@@ -0,0 +1,139 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@NAME@.h"
+#include <gr_io_signature.h>
+#include <iostream>
+#include <trellis/core_algorithms.h>
+
+namespace gr {
+ namespace trellis {
+
+ static const float INF = 1.0e9;
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE,
+ int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling)
+ {
+ return gnuradio::get_initial_sptr
+ (new @NAME@(FSMo, STo0, SToK, FSMi, STi0, STiK,
+ INTERLEAVER, blocklength, repetitions,
+ SISO_TYPE, D, TABLE,METRIC_TYPE, scaling));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE,
+ int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling)
+ : gr_block("@BASE_NAME@",
+ gr_make_io_signature(1, 1, sizeof(@I_TYPE@)),
+ gr_make_io_signature(1, 1, sizeof(@O_TYPE@))),
+ d_FSMo(FSMo), d_STo0(STo0), d_SToK(SToK),
+ d_FSMi(FSMi), d_STi0(STi0), d_STiK(STiK),
+ d_INTERLEAVER(INTERLEAVER),
+ d_blocklength(blocklength),
+ d_repetitions(repetitions),
+ d_SISO_TYPE(SISO_TYPE),
+ d_D(D),
+ d_TABLE(TABLE),
+ d_METRIC_TYPE(METRIC_TYPE),
+ d_scaling(scaling)
+ {
+ assert(d_FSMo.I() == d_FSMi.I());
+ set_relative_rate (1.0 / ((double) d_D));
+ set_output_multiple (d_blocklength);
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ }
+
+ void
+ @IMPL_NAME@::set_scaling(float scaling)
+ {
+ d_scaling = scaling;
+ }
+
+ void
+ @IMPL_NAME@::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ int input_required = d_D * noutput_items;
+ ninput_items_required[0] = input_required;
+ }
+
+ //===========================================================
+
+ int
+ @IMPL_NAME@::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int nblocks = noutput_items / d_blocklength;
+
+ float (*p2min)(float, float) = NULL;
+ if(d_SISO_TYPE == TRELLIS_MIN_SUM)
+ p2min = &min;
+ else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
+ p2min = &min_star;
+
+ const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0];
+ @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
+ for (int n=0;n<nblocks;n++) {
+ pccc_decoder_combined(d_FSMo, d_STo0, d_SToK,
+ d_FSMi, d_STi0, d_STiK,
+ d_INTERLEAVER, d_blocklength, d_repetitions,
+ p2min,
+ d_D,d_TABLE,
+ d_METRIC_TYPE,
+ d_scaling,
+ &(in[n*d_blocklength*d_D]),
+ &(out[n*d_blocklength]));
+ }
+
+ consume_each(d_D * noutput_items);
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t b/gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t
new file mode 100644
index 0000000000..4c3655f40d
--- /dev/null
+++ b/gr-trellis/lib/pccc_decoder_combined_XX_impl.h.t
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/@BASE_NAME@.h>
+
+namespace gr {
+ namespace trellis {
+
+ class @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ fsm d_FSMo;
+ int d_STo0;
+ int d_SToK;
+ fsm d_FSMi;
+ int d_STi0;
+ int d_STiK;
+ interleaver d_INTERLEAVER;
+ int d_blocklength;
+ int d_repetitions;
+ siso_type_t d_SISO_TYPE;
+ int d_D;
+ std::vector<@I_TYPE@> d_TABLE;
+ digital::trellis_metric_type_t d_METRIC_TYPE;
+ float d_scaling;
+ std::vector<float> d_buffer;
+
+ public:
+ @IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE,
+ int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling);
+ ~@IMPL_NAME@();
+
+ fsm FSM1() const { return d_FSMo; }
+ fsm FSM2() const { return d_FSMi; }
+ int ST10() const { return d_STo0; }
+ int ST1K() const { return d_SToK; }
+ int ST20() const { return d_STi0; }
+ int ST2K() const { return d_STiK; }
+ interleaver INTERLEAVER() const { return d_INTERLEAVER; }
+ int blocklength() const { return d_blocklength; }
+ int repetitions() const { return d_repetitions; }
+ int D() const { return d_D; }
+ std::vector<@I_TYPE@> TABLE() const { return d_TABLE; }
+ digital::trellis_metric_type_t METRIC_TYPE() const { return d_METRIC_TYPE; }
+ siso_type_t SISO_TYPE() const { return d_SISO_TYPE; }
+ float scaling() const { return d_scaling; }
+ void set_scaling(float scaling);
+
+ void forecast(int noutput_items,
+ gr_vector_int &ninput_items_required);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/lib/pccc_encoder_XX_impl.cc.t b/gr-trellis/lib/pccc_encoder_XX_impl.cc.t
new file mode 100644
index 0000000000..4e804729a2
--- /dev/null
+++ b/gr-trellis/lib/pccc_encoder_XX_impl.cc.t
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@NAME@.h"
+#include <gr_io_signature.h>
+#include <iostream>
+
+namespace gr {
+ namespace trellis {
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(const fsm &FSM1, int ST1,
+ const fsm &FSM2, int ST2,
+ const interleaver &INTERLEAVER,
+ int blocklength)
+ {
+ return gnuradio::get_initial_sptr
+ (new @IMPL_NAME@(FSM1, ST1, FSM2, ST2, INTERLEAVER, blocklength));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM1, int ST1,
+ const fsm &FSM2, int ST2,
+ const interleaver &INTERLEAVER,
+ int blocklength)
+ : gr_sync_block("@BASE_NAME@",
+ gr_make_io_signature(1, 1, sizeof(@I_TYPE@)),
+ gr_make_io_signature(1, 1, sizeof(@O_TYPE@))),
+ d_FSM1(FSM1), d_ST1(ST1),
+ d_FSM2(FSM2), d_ST2(ST2),
+ d_INTERLEAVER(INTERLEAVER),
+ d_blocklength(blocklength)
+ {
+ assert(d_FSM1.I() == d_FSM2.I());
+ set_output_multiple(d_blocklength);
+ d_buffer.resize(d_blocklength);
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ }
+
+ int
+ @NAME@::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ for(int b = 0 ; b<noutput_items/d_blocklength; b++) {
+ const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0]+b*d_blocklength;
+ @O_TYPE@ *out = (@O_TYPE@*)output_items[0]+b*d_blocklength;
+
+ int ST1_tmp = d_ST1;
+ int ST2_tmp = d_ST2;
+ for(int i = 0; i < d_blocklength; i++) {
+ int k = d_INTERLEAVER.INTER()[i];
+ int o1 = d_FSM1.OS()[ST1_tmp*d_FSM1.I()+in[i]];
+ ST1_tmp = (int) d_FSM1.NS()[ST1_tmp*d_FSM1.I()+in[i]];
+ int o2 = d_FSM2.OS()[ST2_tmp*d_FSM2.I()+in[k]];
+ ST2_tmp = (int) d_FSM2.NS()[ST2_tmp*d_FSM2.I()+in[k]];
+ out[i] = (@O_TYPE@) (o1*d_FSM1.O() + o2);
+ }
+ }
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/pccc_encoder_XX_impl.h.t b/gr-trellis/lib/pccc_encoder_XX_impl.h.t
new file mode 100644
index 0000000000..1eed3702be
--- /dev/null
+++ b/gr-trellis/lib/pccc_encoder_XX_impl.h.t
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/@BASE_NAME@.h>
+
+namespace gr {
+ namespace trellis {
+
+ class @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ fsm d_FSM1;
+ int d_ST1;
+ fsm d_FSM2;
+ int d_ST2;
+ interleaver d_INTERLEAVER;
+ int d_blocklength;
+ std::vector<int> d_buffer;
+
+ public:
+ @IMPL_NAME@(const fsm &FSM1, int ST1,
+ const fsm &FSM2, int ST2,
+ const interleaver &INTERLEAVER,
+ int blocklength);
+ ~@IMPL_NAME@();
+
+ fsm FSM1() const { return d_FSM1; }
+ int ST1() const { return d_ST1; }
+ fsm FSM2() const { return d_FSM2; }
+ int ST2() const { return d_ST2; }
+ interleaver INTERLEAVER() const { return d_INTERLEAVER; }
+ int blocklength() const { return d_blocklength; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/lib/permutation_impl.cc b/gr-trellis/lib/permutation_impl.cc
new file mode 100644
index 0000000000..da82e46832
--- /dev/null
+++ b/gr-trellis/lib/permutation_impl.cc
@@ -0,0 +1,90 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "permutation_impl.h"
+#include <gr_io_signature.h>
+#include <iostream>
+#include <string.h>
+
+namespace gr {
+ namespace trellis {
+
+ permutation::sptr
+ permutation::make(int K, const std::vector<int> &TABLE,
+ int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL)
+ {
+ return gnuradio::get_initial_sptr
+ (new permutation_impl(K,TABLE,SYMS_PER_BLOCK,BYTES_PER_SYMBOL));
+ }
+
+ permutation_impl::permutation_impl(int K, const std::vector<int> &TABLE,
+ int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL)
+ : gr_sync_block("permutation",
+ gr_make_io_signature(1, -1, BYTES_PER_SYMBOL),
+ gr_make_io_signature(1, -1, BYTES_PER_SYMBOL)),
+ d_K(K), d_TABLE(TABLE),
+ d_SYMS_PER_BLOCK(SYMS_PER_BLOCK),
+ d_BYTES_PER_SYMBOL(BYTES_PER_SYMBOL)
+ {
+ set_output_multiple(d_K*SYMS_PER_BLOCK);
+ //std::cout << d_K << "\n";
+ }
+
+ permutation_impl::~permutation_impl()
+ {
+ }
+
+ int
+ permutation_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int nstreams = input_items.size();
+
+ for(int m=0;m<nstreams;m++) {
+ const char *in = (const char *) input_items[m];
+ char *out = (char *) output_items[m];
+
+ // per stream processing
+ for(int i = 0; i < noutput_items/d_SYMS_PER_BLOCK; i++) {
+ // Index i refers to blocks.
+ // Begining of packet (in blocks)
+ int i0 = d_K*(i/d_K);
+ // position of block within packet (in blocks)
+ int j0 = i%d_K;
+ // new position of block within packet (in blocks)
+ int k0 = d_TABLE[j0];
+ memcpy(&(out[i*d_SYMS_PER_BLOCK*d_BYTES_PER_SYMBOL]),
+ &(in[(i0+k0)*d_SYMS_PER_BLOCK*d_BYTES_PER_SYMBOL]),
+ d_BYTES_PER_SYMBOL*d_SYMS_PER_BLOCK);
+ }
+ // end per stream processing
+ }
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/permutation_impl.h b/gr-trellis/lib/permutation_impl.h
new file mode 100644
index 0000000000..6e3ca2b2d7
--- /dev/null
+++ b/gr-trellis/lib/permutation_impl.h
@@ -0,0 +1,58 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_PERMUTATION_IMPL_H
+#define INCLUDED_TRELLIS_PERMUTATION_IMPL_H
+
+#include <trellis/api.h>
+#include <trellis/permutation.h>
+
+namespace gr {
+ namespace trellis {
+
+ class permutation_impl : public permutation
+ {
+ private:
+ int d_K;
+ std::vector<int> d_TABLE;
+ int d_SYMS_PER_BLOCK;
+ size_t d_BYTES_PER_SYMBOL;
+
+ public:
+ permutation_impl(int K, const std::vector<int> &TABLE,
+ int SYMS_PER_BLOCK, size_t NBYTES);
+ ~permutation_impl();
+
+ int K() const { return d_K; }
+ const std::vector<int> & TABLE() const { return d_TABLE; }
+ int SYMS_PER_BLOCK() const { return d_SYMS_PER_BLOCK; }
+ size_t BYTES_PER_SYMBOL() const { return d_BYTES_PER_SYMBOL; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_PERMUTATION_IMPL_H */
diff --git a/gr-trellis/lib/quicksort_index.cc b/gr-trellis/lib/quicksort_index.cc
new file mode 100644
index 0000000000..02cd8a9134
--- /dev/null
+++ b/gr-trellis/lib/quicksort_index.cc
@@ -0,0 +1,70 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <trellis/quicksort_index.h>
+
+namespace gr {
+ namespace trellis {
+
+ template <class T> void
+ SWAP(T & a, T & b)
+ {
+ T temp = a;
+ a = b;
+ b = temp;
+ }
+
+ template <class T> void
+ quicksort_index (std::vector<T> & p, std::vector<int> & index,
+ int left, int right)
+ {
+ if(left < right) {
+ int i = left;
+ int j = right + 1;
+ T pivot = p[left];
+ do {
+ do
+ i++;
+ while ((p[i] < pivot) && (i < right));
+ do
+ j--;
+ while ((p[j] > pivot) && (j > left));
+ if (i < j) {
+ SWAP <T> (p[i],p[j]);
+ SWAP <int> (index[i],index[j]);
+ }
+ } while (i < j);
+ SWAP <T> (p[left], p[j]);
+ SWAP <int> (index[left], index[j]);
+ quicksort_index <T> (p,index, left, j-1);
+ quicksort_index <T> (p,index, j+1, right);
+ }
+ }
+
+ // instantiate an <int> version of the quicksort_index
+ //template <int> void SWAP (int & a, int & b);
+ template void
+ quicksort_index<int>(std::vector<int> & p, std::vector<int> & index,
+ int left, int right);
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/sccc_decoder_X_impl.cc.t b/gr-trellis/lib/sccc_decoder_X_impl.cc.t
new file mode 100644
index 0000000000..6eef46518d
--- /dev/null
+++ b/gr-trellis/lib/sccc_decoder_X_impl.cc.t
@@ -0,0 +1,118 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@NAME@.h"
+#include <gr_io_signature.h>
+#include <iostream>
+#include <trellis/core_algorithms.h>
+
+namespace gr {
+ namespace trellis {
+
+ static const float INF = 1.0e9;
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE)
+ {
+ return gnuradio::get_initial_sptr
+ (new @IMPL_NAME@(FSMo, STo0, SToK, FSMi, STi0, STiK,
+ INTERLEAVER, blocklength, repetitions,
+ SISO_TYPE));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE)
+ : gr_block("@BASE_NAME@",
+ gr_make_io_signature(1, 1, sizeof(float)),
+ gr_make_io_signature(1, 1, sizeof(@O_TYPE@))),
+ d_FSMo(FSMo), d_STo0(STo0), d_SToK(SToK),
+ d_FSMi(FSMi), d_STi0(STi0), d_STiK(STiK),
+ d_INTERLEAVER(INTERLEAVER),
+ d_blocklength(blocklength),
+ d_repetitions(repetitions),
+ d_SISO_TYPE(SISO_TYPE)
+ {
+ set_relative_rate(1.0 / ((double) d_FSMi.O()));
+ set_output_multiple(d_blocklength);
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ }
+
+ void
+ @IMPL_NAME@::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ int input_required = d_FSMi.O() * noutput_items ;
+ ninput_items_required[0] = input_required;
+ }
+
+ //===========================================================
+
+ int
+ @IMPL_NAME@::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int nblocks = noutput_items / d_blocklength;
+ float (*p2min)(float, float) = NULL;
+
+ if(d_SISO_TYPE == TRELLIS_MIN_SUM)
+ p2min = &min;
+ else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
+ p2min = &min_star;
+
+ const float *in = (const float*)input_items[0];
+ @O_TYPE@ *out = (@O_TYPE@*)output_items[0];
+
+ for(int n = 0; n < nblocks; n++) {
+ sccc_decoder(d_FSMo, d_STo0, d_SToK,
+ d_FSMi, d_STi0, d_STiK,
+ d_INTERLEAVER, d_blocklength, d_repetitions,
+ p2min,
+ &(in[n*d_blocklength*d_FSMi.O()]),
+ &(out[n*d_blocklength]));
+ }
+
+ consume_each(d_FSMi.O() * noutput_items );
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/sccc_decoder_X_impl.h.t b/gr-trellis/lib/sccc_decoder_X_impl.h.t
new file mode 100644
index 0000000000..31f4edc4b8
--- /dev/null
+++ b/gr-trellis/lib/sccc_decoder_X_impl.h.t
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/@BASE_NAME@.h>
+
+namespace gr {
+ namespace trellis {
+
+ class @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ fsm d_FSMo;
+ int d_STo0;
+ int d_SToK;
+ fsm d_FSMi;
+ int d_STi0;
+ int d_STiK;
+ interleaver d_INTERLEAVER;
+ int d_blocklength;
+ int d_repetitions;
+ siso_type_t d_SISO_TYPE;
+ std::vector<float> d_buffer;
+
+ public:
+ @IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE);
+ ~@IMPL_NAME@();
+
+ fsm FSMo() const { return d_FSMo; }
+ fsm FSMi() const { return d_FSMi; }
+ int STo0() const { return d_STo0; }
+ int SToK() const { return d_SToK; }
+ int STi0() const { return d_STi0; }
+ int STiK() const { return d_STiK; }
+ interleaver INTERLEAVER() const { return d_INTERLEAVER; }
+ int blocklength() const { return d_blocklength; }
+ int repetitions() const { return d_repetitions; }
+ siso_type_t SISO_TYPE() const { return d_SISO_TYPE; }
+
+ void forecast(int noutput_items,
+ gr_vector_int &ninput_items_required);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t b/gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t
new file mode 100644
index 0000000000..717f2c8e49
--- /dev/null
+++ b/gr-trellis/lib/sccc_decoder_combined_XX_impl.cc.t
@@ -0,0 +1,139 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@NAME@.h"
+#include <gr_io_signature.h>
+#include <iostream>
+#include <trellis/core_algorithms.h>
+
+namespace gr {
+ namespace trellis {
+
+ static const float INF = 1.0e9;
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE,
+ int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling)
+ {
+ return gnuradio::get_initial_sptr
+ (new @IMPL_NAME@(FSMo, STo0, SToK, FSMi, STi0, STiK,
+ INTERLEAVER, blocklength, repetitions,
+ SISO_TYPE, D, TABLE,METRIC_TYPE, scaling));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE,
+ int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling)
+ : gr_block("@BASE_NAME@",
+ gr_make_io_signature(1, 1, sizeof(@I_TYPE@)),
+ gr_make_io_signature(1, 1, sizeof(@O_TYPE@))),
+ d_FSMo(FSMo), d_STo0(STo0), d_SToK(SToK),
+ d_FSMi(FSMi), d_STi0(STi0), d_STiK(STiK),
+ d_INTERLEAVER(INTERLEAVER),
+ d_blocklength(blocklength),
+ d_repetitions(repetitions),
+ d_SISO_TYPE(SISO_TYPE),
+ d_D(D),
+ d_TABLE(TABLE),
+ d_METRIC_TYPE(METRIC_TYPE),
+ d_scaling(scaling)
+ {
+ set_relative_rate(1.0 / ((double) d_D));
+ set_output_multiple(d_blocklength);
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ }
+
+ void
+ @IMPL_NAME@::set_scaling(float scaling)
+ {
+ d_scaling = scaling;
+ }
+
+ void
+ @IMPL_NAME@::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ int input_required = d_D * noutput_items ;
+ ninput_items_required[0] = input_required;
+ }
+
+ //===========================================================
+
+ int
+ @IMPL_NAME@::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int nblocks = noutput_items / d_blocklength;
+ float (*p2min)(float, float) = NULL;
+
+ if(d_SISO_TYPE == TRELLIS_MIN_SUM)
+ p2min = &min;
+ else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
+ p2min = &min_star;
+
+ const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0];
+ @O_TYPE@ *out = (@O_TYPE@*)output_items[0];
+
+ for(int n = 0; n < nblocks; n++) {
+ sccc_decoder_combined(d_FSMo, d_STo0, d_SToK,
+ d_FSMi, d_STi0, d_STiK,
+ d_INTERLEAVER, d_blocklength, d_repetitions,
+ p2min,
+ d_D,d_TABLE,
+ d_METRIC_TYPE,
+ d_scaling,
+ &(in[n*d_blocklength*d_D]),
+ &(out[n*d_blocklength]));
+ }
+
+ consume_each(d_D * noutput_items);
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t b/gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t
new file mode 100644
index 0000000000..f3dbd1b4bb
--- /dev/null
+++ b/gr-trellis/lib/sccc_decoder_combined_XX_impl.h.t
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/@BASE_NAME@.h>
+
+namespace gr {
+ namespace trellis {
+
+ class @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ fsm d_FSMo;
+ int d_STo0;
+ int d_SToK;
+ fsm d_FSMi;
+ int d_STi0;
+ int d_STiK;
+ interleaver d_INTERLEAVER;
+ int d_blocklength;
+ int d_repetitions;
+ siso_type_t d_SISO_TYPE;
+ int d_D;
+ std::vector<@I_TYPE@> d_TABLE;
+ digital::trellis_metric_type_t d_METRIC_TYPE;
+ float d_scaling;
+ std::vector<float> d_buffer;
+
+ public:
+ @IMPL_NAME@(const fsm &FSMo, int STo0, int SToK,
+ const fsm &FSMi, int STi0, int STiK,
+ const interleaver &INTERLEAVER,
+ int blocklength,
+ int repetitions,
+ siso_type_t SISO_TYPE,
+ int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t METRIC_TYPE,
+ float scaling);
+ ~@IMPL_NAME@();
+
+ fsm FSMo() const { return d_FSMo; }
+ fsm FSMi() const { return d_FSMi; }
+ int STo0() const { return d_STo0; }
+ int SToK() const { return d_SToK; }
+ int STi0() const { return d_STi0; }
+ int STiK() const { return d_STiK; }
+ interleaver INTERLEAVER() const { return d_INTERLEAVER; }
+ int blocklength() const { return d_blocklength; }
+ int repetitions() const { return d_repetitions; }
+ int D() const { return d_D; }
+ std::vector<@I_TYPE@> TABLE() const { return d_TABLE; }
+ digital::trellis_metric_type_t METRIC_TYPE() const { return d_METRIC_TYPE; }
+ siso_type_t SISO_TYPE() const { return d_SISO_TYPE; }
+ float scaling() const { return d_scaling; }
+ void set_scaling(float scaling);
+
+ void forecast(int noutput_items,
+ gr_vector_int &ninput_items_required);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/lib/sccc_encoder_XX_impl.cc.t b/gr-trellis/lib/sccc_encoder_XX_impl.cc.t
new file mode 100644
index 0000000000..390e65c4f3
--- /dev/null
+++ b/gr-trellis/lib/sccc_encoder_XX_impl.cc.t
@@ -0,0 +1,93 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@NAME@.h"
+#include <gr_io_signature.h>
+#include <iostream>
+
+namespace gr {
+ namespace trellis {
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(const fsm &FSMo, int STo,
+ const fsm &FSMi, int STi,
+ const interleaver &INTERLEAVER,
+ int blocklength)
+ {
+ return gnuradio::get_initial_sptr
+ (new @IMPL_NAME@(FSMo, STo, FSMi, STi, INTERLEAVER, blocklength));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(const fsm &FSMo, int STo,
+ const fsm &FSMi, int STi,
+ const interleaver &INTERLEAVER,
+ int blocklength)
+ : gr_sync_block("@BASE_NAME@",
+ gr_make_io_signature(1, 1, sizeof(@I_TYPE@)),
+ gr_make_io_signature(1, 1, sizeof(@O_TYPE@))),
+ d_FSMo(FSMo), d_STo(STo),
+ d_FSMi(FSMi), d_STi(STi),
+ d_INTERLEAVER(INTERLEAVER),
+ d_blocklength(blocklength)
+ {
+ set_output_multiple(d_blocklength);
+ d_buffer.resize(d_blocklength);
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ }
+
+ int
+ @IMPL_NAME@::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ for(int b = 0; b < noutput_items/d_blocklength; b++) {
+ const @I_TYPE@ *in = (const @I_TYPE@*)input_items[0]+b*d_blocklength;
+ @O_TYPE@ *out = (@O_TYPE@*)output_items[0]+b*d_blocklength;
+
+ int STo_tmp = d_STo;
+ for(int i = 0; i < d_blocklength; i++) {
+ d_buffer[i] = d_FSMo.OS()[STo_tmp*d_FSMo.I()+in[i]];
+ STo_tmp = (int) d_FSMo.NS()[STo_tmp*d_FSMo.I()+in[i]];
+ }
+
+ int STi_tmp = d_STi;
+ for(int i = 0; i < d_blocklength; i++) {
+ int k = d_INTERLEAVER.INTER()[i];
+ out[i] = (@O_TYPE@) d_FSMi.OS()[STi_tmp*d_FSMi.I()+d_buffer[k]];
+ STi_tmp = (int) d_FSMi.NS()[STi_tmp*d_FSMi.I()+d_buffer[k]];
+ }
+ }
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
+
diff --git a/gr-trellis/lib/sccc_encoder_XX_impl.h.t b/gr-trellis/lib/sccc_encoder_XX_impl.h.t
new file mode 100644
index 0000000000..a3e582b5a0
--- /dev/null
+++ b/gr-trellis/lib/sccc_encoder_XX_impl.h.t
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/@BASE_NAME@.h>
+
+namespace gr {
+ namespace trellis {
+
+ class @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ fsm d_FSMo;
+ int d_STo;
+ fsm d_FSMi;
+ int d_STi;
+ interleaver d_INTERLEAVER;
+ int d_blocklength;
+ std::vector<int> d_buffer;
+
+ public:
+ @IMPL_NAME@(const fsm &FSMo, int STo,
+ const fsm &FSMi, int STi,
+ const interleaver &INTERLEAVER,
+ int blocklength);
+ ~@IMPL_NAME@();
+
+ fsm FSMo() const { return d_FSMo; }
+ int STo() const { return d_STo; }
+ fsm FSMi() const { return d_FSMi; }
+ int STi() const { return d_STi; }
+ interleaver INTERLEAVER() const { return d_INTERLEAVER; }
+ int blocklength() const { return d_blocklength; }
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/lib/siso_combined_f_impl.cc b/gr-trellis/lib/siso_combined_f_impl.cc
new file mode 100644
index 0000000000..7514d46747
--- /dev/null
+++ b/gr-trellis/lib/siso_combined_f_impl.cc
@@ -0,0 +1,180 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "siso_combined_f_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <assert.h>
+#include <iostream>
+
+namespace gr {
+ namespace trellis {
+
+ static const float INF = 1.0e9;
+
+ siso_combined_f::sptr
+ siso_combined_f::make(const fsm &FSM, int K,
+ int S0, int SK,
+ bool POSTI, bool POSTO,
+ siso_type_t SISO_TYPE,
+ int D, const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t TYPE)
+ {
+ return gnuradio::get_initial_sptr
+ (new siso_combined_f_impl(FSM, K, S0, SK, POSTI, POSTO,
+ SISO_TYPE, D, TABLE, TYPE));
+ }
+
+ siso_combined_f_impl::siso_combined_f_impl(const fsm &FSM, int K,
+ int S0, int SK,
+ bool POSTI, bool POSTO,
+ siso_type_t SISO_TYPE,
+ int D, const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t TYPE)
+ : gr_block("siso_combined_f",
+ gr_make_io_signature(1, -1, sizeof(float)),
+ gr_make_io_signature(1, -1, sizeof(float))),
+ d_FSM(FSM), d_K(K), d_S0(S0), d_SK(SK),
+ d_POSTI(POSTI), d_POSTO(POSTO),
+ d_SISO_TYPE(SISO_TYPE),
+ d_D(D), d_TABLE(TABLE), d_TYPE(TYPE)//,
+ //d_alpha(FSM.S()*(K+1)),
+ //d_beta(FSM.S()*(K+1))
+ {
+ int multiple;
+ if(d_POSTI && d_POSTO)
+ multiple = d_FSM.I()+d_FSM.O();
+ else if(d_POSTI)
+ multiple = d_FSM.I();
+ else if(d_POSTO)
+ multiple = d_FSM.O();
+ else
+ throw std::runtime_error ("Not both POSTI and POSTO can be false.");
+
+ //printf("constructor: Multiple = %d\n",multiple);
+ set_output_multiple(d_K*multiple);
+
+ //what is the meaning of relative rate for a block with 2 inputs?
+ //set_relative_rate ( multiple / ((double) d_FSM.I()) );
+ // it turns out that the above gives problems in the scheduler, so
+ // let's try (assumption O>I)
+ //set_relative_rate ( multiple / ((double) d_FSM.O()) );
+ // I am tempted to automate like this
+ if(d_FSM.I() <= d_D)
+ set_relative_rate(multiple / ((double)d_D));
+ else
+ set_relative_rate(multiple / ((double)d_FSM.I()));
+ }
+
+ siso_combined_f_impl::~siso_combined_f_impl()
+ {
+ }
+
+ void
+ siso_combined_f_impl::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ int multiple;
+ if(d_POSTI && d_POSTO)
+ multiple = d_FSM.I()+d_FSM.O();
+ else if(d_POSTI)
+ multiple = d_FSM.I();
+ else if(d_POSTO)
+ multiple = d_FSM.O();
+ else
+ throw std::runtime_error ("Not both POSTI and POSTO can be false.");
+
+ //printf("forecast: Multiple = %d\n",multiple);
+ int input_required1 = d_FSM.I() * (noutput_items/multiple) ;
+ int input_required2 = d_D * (noutput_items/multiple) ;
+ //printf("forecast: Output requirements: %d\n",noutput_items);
+ //printf("forecast: Input requirements: %d %d\n",input_required1,input_required2);
+ unsigned ninputs = ninput_items_required.size();
+
+ for(unsigned int i = 0; i < ninputs/2; i++) {
+ ninput_items_required[2*i] = input_required1;
+ ninput_items_required[2*i+1] = input_required2;
+ }
+ }
+
+ int
+ siso_combined_f_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int nstreams = output_items.size();
+ //printf("general_work:Streams: %d\n",nstreams);
+
+ int multiple;
+ if(d_POSTI && d_POSTO)
+ multiple = d_FSM.I()+d_FSM.O();
+ else if(d_POSTI)
+ multiple = d_FSM.I();
+ else if(d_POSTO)
+ multiple = d_FSM.O();
+ else
+ throw std::runtime_error("siso_combined_f_impl:: Not both POSTI and POSTO can be false.");
+
+ int nblocks = noutput_items / (d_K*multiple);
+ //printf("general_work:Blocks: %d\n",nblocks);
+ //for(int i=0;i<ninput_items.size();i++)
+ //printf("general_work:Input items available: %d\n",ninput_items[i]);
+
+ float (*p2min)(float, float) = NULL;
+ if(d_SISO_TYPE == TRELLIS_MIN_SUM)
+ p2min = &min;
+ else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
+ p2min = &min_star;
+
+ for(int m=0;m<nstreams;m++) {
+ const float *in1 = (const float*)input_items[2*m];
+ const float *in2 = (const float*)input_items[2*m+1];
+ float *out = (float *) output_items[m];
+ for(int n=0;n<nblocks;n++) {
+ siso_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),
+ d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),
+ d_K,d_S0,d_SK,
+ d_POSTI,d_POSTO,
+ p2min,
+ d_D,d_TABLE,d_TYPE,
+ &(in1[n*d_K*d_FSM.I()]),&(in2[n*d_K*d_D]),
+ &(out[n*d_K*multiple])//,
+ //d_alpha,d_beta
+ );
+ }
+ }
+
+ for(unsigned int i = 0; i < input_items.size()/2; i++) {
+ consume(2*i,d_FSM.I() * noutput_items / multiple );
+ consume(2*i+1,d_D * noutput_items / multiple );
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/siso_combined_f_impl.h b/gr-trellis/lib/siso_combined_f_impl.h
new file mode 100644
index 0000000000..27cef5e334
--- /dev/null
+++ b/gr-trellis/lib/siso_combined_f_impl.h
@@ -0,0 +1,79 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_SISO_COMBINED_F_IMPL_H
+#define INCLUDED_TRELLIS_SISO_COMBINED_F_IMPL_H
+
+#include <trellis/siso_combined_f.h>
+
+namespace gr {
+ namespace trellis {
+
+ class siso_combined_f_impl : public siso_combined_f
+ {
+ private:
+ fsm d_FSM;
+ int d_K;
+ int d_S0;
+ int d_SK;
+ bool d_POSTI;
+ bool d_POSTO;
+ siso_type_t d_SISO_TYPE;
+ int d_D;
+ std::vector<float> d_TABLE;
+ digital::trellis_metric_type_t d_TYPE;
+ //std::vector<float> d_alpha;
+ //std::vector<float> d_beta;
+
+ public:
+ siso_combined_f_impl(const fsm &FSM, int K,
+ int S0, int SK,
+ bool POSTI, bool POSTO,
+ siso_type_t d_SISO_TYPE,
+ int D, const std::vector<float> &TABLE,
+ digital::trellis_metric_type_t TYPE);
+ ~siso_combined_f_impl();
+
+ fsm FSM() const { return d_FSM; }
+ int K() const { return d_K; }
+ int S0() const { return d_S0; }
+ int SK() const { return d_SK; }
+ bool POSTI() const { return d_POSTI; }
+ bool POSTO() const { return d_POSTO; }
+ siso_type_t SISO_TYPE() const { return d_SISO_TYPE; }
+ int D() const { return d_D; }
+ std::vector<float> TABLE() const { return d_TABLE; }
+ digital::trellis_metric_type_t TYPE() const { return d_TYPE; }
+
+ void forecast(int noutput_items,
+ gr_vector_int &ninput_items_required);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_SISO_COMBINED_F_IMPL_H */
diff --git a/gr-trellis/lib/siso_f_impl.cc b/gr-trellis/lib/siso_f_impl.cc
new file mode 100644
index 0000000000..b0484f6f37
--- /dev/null
+++ b/gr-trellis/lib/siso_f_impl.cc
@@ -0,0 +1,171 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "siso_f_impl.h"
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <assert.h>
+#include <iostream>
+
+namespace gr {
+ namespace trellis {
+
+ static const float INF = 1.0e9;
+
+ siso_f::sptr
+ siso_f::make(const fsm &FSM, int K,
+ int S0, int SK,
+ bool POSTI, bool POSTO,
+ siso_type_t SISO_TYPE)
+ {
+ return gnuradio::get_initial_sptr
+ (new siso_f_impl(FSM, K, S0, SK, POSTI, POSTO, SISO_TYPE));
+ }
+
+ siso_f_impl::siso_f_impl(const fsm &FSM, int K,
+ int S0, int SK,
+ bool POSTI, bool POSTO,
+ siso_type_t SISO_TYPE)
+ : gr_block("siso_f",
+ gr_make_io_signature(1, -1, sizeof(float)),
+ gr_make_io_signature(1, -1, sizeof(float))),
+ d_FSM(FSM), d_K(K),
+ d_S0(S0),d_SK(SK),
+ d_POSTI(POSTI), d_POSTO(POSTO),
+ d_SISO_TYPE(SISO_TYPE)//,
+ //d_alpha(FSM.S()*(K+1)),
+ //d_beta(FSM.S()*(K+1))
+ {
+ int multiple;
+ if(d_POSTI && d_POSTO)
+ multiple = d_FSM.I()+d_FSM.O();
+ else if(d_POSTI)
+ multiple = d_FSM.I();
+ else if(d_POSTO)
+ multiple = d_FSM.O();
+ else
+ throw std::runtime_error ("Not both POSTI and POSTO can be false.");
+
+ //printf("constructor: Multiple = %d\n",multiple);
+ set_output_multiple (d_K*multiple);
+
+ //what is the meaning of relative rate for a block with 2 inputs?
+ //set_relative_rate ( multiple / ((double) d_FSM.I()) );
+ // it turns out that the above gives problems in the scheduler, so
+ // let's try (assumption O>I)
+ //set_relative_rate ( multiple / ((double) d_FSM.O()) );
+ // I am tempted to automate like this
+ if(d_FSM.I() <= d_FSM.O())
+ set_relative_rate(multiple / ((double) d_FSM.O()));
+ else
+ set_relative_rate(multiple / ((double) d_FSM.I()));
+ }
+
+ siso_f_impl::~siso_f_impl()
+ {
+ }
+
+ void
+ siso_f_impl::forecast(int noutput_items, gr_vector_int &ninput_items_required)
+ {
+ int multiple;
+ if(d_POSTI && d_POSTO)
+ multiple = d_FSM.I()+d_FSM.O();
+ else if(d_POSTI)
+ multiple = d_FSM.I();
+ else if(d_POSTO)
+ multiple = d_FSM.O();
+ else
+ throw std::runtime_error ("Not both POSTI and POSTO can be false.");
+
+ //printf("forecast: Multiple = %d\n",multiple);
+ int input_required1 = d_FSM.I() * (noutput_items/multiple) ;
+ int input_required2 = d_FSM.O() * (noutput_items/multiple) ;
+ //printf("forecast: Output requirements: %d\n",noutput_items);
+ //printf("forecast: Input requirements: %d %d\n",input_required1,input_required2);
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned int i = 0; i < ninputs/2; i++) {
+ ninput_items_required[2*i] = input_required1;
+ ninput_items_required[2*i+1] = input_required2;
+ }
+ }
+
+ int
+ siso_f_impl::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int nstreams = output_items.size();
+ //printf("general_work:Streams: %d\n",nstreams);
+ int multiple;
+ if(d_POSTI && d_POSTO)
+ multiple = d_FSM.I()+d_FSM.O();
+ else if(d_POSTI)
+ multiple = d_FSM.I();
+ else if(d_POSTO)
+ multiple = d_FSM.O();
+ else
+ throw std::runtime_error("siso_f_impl: Not both POSTI and POSTO can be false.\n");
+
+ int nblocks = noutput_items / (d_K*multiple);
+ //printf("general_work:Blocks: %d\n",nblocks);
+ //for(int i=0;i<ninput_items.size();i++)
+ //printf("general_work:Input items available: %d\n",ninput_items[i]);
+
+ float (*p2min)(float, float) = NULL;
+ if(d_SISO_TYPE == TRELLIS_MIN_SUM)
+ p2min = &min;
+ else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
+ p2min = &min_star;
+
+ for(int m = 0; m < nstreams; m++) {
+ const float *in1 = (const float*)input_items[2*m];
+ const float *in2 = (const float*)input_items[2*m+1];
+ float *out = (float*)output_items[m];
+ for(int n = 0;n < nblocks; n++) {
+ siso_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),
+ d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),
+ d_K,d_S0,d_SK,
+ d_POSTI,d_POSTO,
+ p2min,
+ &(in1[n*d_K*d_FSM.I()]),&(in2[n*d_K*d_FSM.O()]),
+ &(out[n*d_K*multiple])//,
+ //d_alpha,d_beta
+ );
+ }
+ }
+
+ for(unsigned int i = 0; i < input_items.size()/2; i++) {
+ consume(2*i,d_FSM.I() * noutput_items / multiple );
+ consume(2*i+1,d_FSM.O() * noutput_items / multiple );
+ }
+
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/siso_f_impl.h b/gr-trellis/lib/siso_f_impl.h
new file mode 100644
index 0000000000..40766b97fa
--- /dev/null
+++ b/gr-trellis/lib/siso_f_impl.h
@@ -0,0 +1,75 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_TRELLIS_SISO_F_IMPL_H
+#define INCLUDED_TRELLIS_SISO_F_IMPL_H
+
+#include <trellis/api.h>
+#include <trellis/fsm.h>
+#include <trellis/siso_type.h>
+#include <trellis/core_algorithms.h>
+#include <trellis/siso_f.h>
+
+namespace gr {
+ namespace trellis {
+
+ class siso_f_impl : public siso_f
+ {
+ private:
+ fsm d_FSM;
+ int d_K;
+ int d_S0;
+ int d_SK;
+ bool d_POSTI;
+ bool d_POSTO;
+ siso_type_t d_SISO_TYPE;
+ //std::vector<float> d_alpha;
+ //std::vector<float> d_beta;
+
+ public:
+ siso_f_impl(const fsm &FSM, int K,
+ int S0, int SK,
+ bool POSTI, bool POSTO,
+ siso_type_t d_SISO_TYPE);
+ ~siso_f_impl();
+
+ fsm FSM() const { return d_FSM; }
+ int K() const { return d_K; }
+ int S0() const { return d_S0; }
+ int SK() const { return d_SK; }
+ bool POSTI() const { return d_POSTI; }
+ bool POSTO() const { return d_POSTO; }
+ siso_type_t SISO_TYPE() const { return d_SISO_TYPE; }
+
+ void forecast(int noutput_items,
+ gr_vector_int &ninput_items_required);
+
+ int general_work (int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* INCLUDED_TRELLIS_SISO_F_IMPL_H */
diff --git a/gr-trellis/lib/viterbi_X_impl.cc.t b/gr-trellis/lib/viterbi_X_impl.cc.t
new file mode 100644
index 0000000000..5097cc2053
--- /dev/null
+++ b/gr-trellis/lib/viterbi_X_impl.cc.t
@@ -0,0 +1,99 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@NAME@.h"
+#include <gr_io_signature.h>
+#include <iostream>
+
+namespace gr {
+ namespace trellis {
+
+ static const float INF = 1.0e9;
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(const fsm &FSM, int K,
+ int S0, int SK)
+ {
+ return gnuradio::get_initial_sptr
+ (new @IMPL_NAME@(FSM, K, S0, SK));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM, int K,
+ int S0, int SK)
+ : gr_block("@BASE_NAME@",
+ gr_make_io_signature(1, -1, sizeof(float)),
+ gr_make_io_signature(1, -1, sizeof(@TYPE@))),
+ d_FSM(FSM), d_K(K), d_S0(S0), d_SK(SK)//,
+ //d_trace(FSM.S()*K)
+ {
+ set_relative_rate(1.0 / ((double)d_FSM.O()));
+ set_output_multiple(d_K);
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ }
+
+ void
+ @IMPL_NAME@::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ int input_required = d_FSM.O() * noutput_items;
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned int i = 0; i < ninputs; i++) {
+ ninput_items_required[i] = input_required;
+ }
+ }
+
+ int
+ @IMPL_NAME@::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int nstreams = input_items.size();
+ int nblocks = noutput_items / d_K;
+
+ for(int m = 0; m < nstreams; m++) {
+ const float *in = (const float*)input_items[m];
+ @TYPE@ *out = (@TYPE@*)output_items[m];
+
+ for(int n = 0; n < nblocks; n++) {
+ viterbi_algorithm(d_FSM.I(), d_FSM.S(), d_FSM.O(),
+ d_FSM.NS(), d_FSM.OS(), d_FSM.PS(),
+ d_FSM.PI(), d_K,d_S0, d_SK,
+ &(in[n*d_K*d_FSM.O()]), &(out[n*d_K]));
+ }
+ }
+
+ consume_each(d_FSM.O() * noutput_items);
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
diff --git a/gr-trellis/lib/viterbi_X_impl.h.t b/gr-trellis/lib/viterbi_X_impl.h.t
new file mode 100644
index 0000000000..accaacc158
--- /dev/null
+++ b/gr-trellis/lib/viterbi_X_impl.h.t
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/@BASE_NAME@.h>
+
+namespace gr {
+ namespace trellis {
+
+ class @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ fsm d_FSM;
+ int d_K;
+ int d_S0;
+ int d_SK;
+ //std::vector<int> d_trace;
+
+ public:
+ @IMPL_NAME@(const fsm &FSM, int K,
+ int S0, int SK);
+ ~@IMPL_NAME@();
+
+ fsm FSM() const { return d_FSM; }
+ int K() const { return d_K; }
+ int S0() const { return d_S0; }
+ int SK() const { return d_SK; }
+
+ //std::vector<int> trace () const { return d_trace; }
+
+ void forecast(int noutput_items,
+ gr_vector_int &ninput_items_required);
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/lib/viterbi_combined_XX_impl.cc.t b/gr-trellis/lib/viterbi_combined_XX_impl.cc.t
new file mode 100644
index 0000000000..95175bef95
--- /dev/null
+++ b/gr-trellis/lib/viterbi_combined_XX_impl.cc.t
@@ -0,0 +1,112 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "@NAME@.h"
+#include <gr_io_signature.h>
+#include <iostream>
+
+namespace gr {
+ namespace trellis {
+
+ static const float INF = 1.0e9;
+
+ @BASE_NAME@::sptr
+ @BASE_NAME@::make(const fsm &FSM, int K,
+ int S0, int SK, int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t TYPE)
+ {
+ return gnuradio::get_initial_sptr
+ (new @NAME@(FSM, K, S0, SK, D, TABLE,TYPE));
+ }
+
+ @IMPL_NAME@::@IMPL_NAME@(const fsm &FSM, int K,
+ int S0, int SK, int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t TYPE)
+ : gr_block("@BASE_NAME@",
+ gr_make_io_signature(1, -1, sizeof(@I_TYPE@)),
+ gr_make_io_signature(1, -1, sizeof(@O_TYPE@))),
+ d_FSM(FSM), d_K(K), d_S0(S0), d_SK(SK), d_D(D),
+ d_TABLE(TABLE), d_TYPE(TYPE)//,
+ //d_trace(FSM.S()*K)
+ {
+ set_relative_rate(1.0 / ((double)d_D));
+ set_output_multiple(d_K);
+ }
+
+ @IMPL_NAME@::~@IMPL_NAME@()
+ {
+ }
+
+ void
+ @IMPL_NAME@::set_TABLE(const std::vector<@I_TYPE@> &table)
+ {
+ d_TABLE = table;
+ }
+
+ void
+ @IMPL_NAME@::forecast(int noutput_items,
+ gr_vector_int &ninput_items_required)
+ {
+ int input_required = d_D * noutput_items;
+ unsigned ninputs = ninput_items_required.size();
+ for(unsigned int i = 0; i < ninputs; i++) {
+ ninput_items_required[i] = input_required;
+ }
+ }
+
+ int
+ @IMPL_NAME@::general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ int nstreams = input_items.size();
+ int nblocks = noutput_items / d_K;
+
+ for(int m=0;m<nstreams;m++) {
+ const @I_TYPE@ *in = (const @I_TYPE@*)input_items[m];
+ @O_TYPE@ *out = (@O_TYPE@*)output_items[m];
+
+ for(int n=0;n<nblocks;n++) {
+ viterbi_algorithm_combined(d_FSM.I(), d_FSM.S(), d_FSM.O(),
+ d_FSM.NS(), d_FSM.OS(), d_FSM.PS(),
+ d_FSM.PI(), d_K,d_S0, d_SK, d_D,
+ d_TABLE, d_TYPE,
+ &(in[n*d_K*d_D]), &(out[n*d_K]));
+ }
+ }
+
+ consume_each(d_D * noutput_items);
+ return noutput_items;
+ }
+
+ } /* namespace trellis */
+} /* namespace gr */
+
diff --git a/gr-trellis/lib/viterbi_combined_XX_impl.h.t b/gr-trellis/lib/viterbi_combined_XX_impl.h.t
new file mode 100644
index 0000000000..df62001110
--- /dev/null
+++ b/gr-trellis/lib/viterbi_combined_XX_impl.h.t
@@ -0,0 +1,74 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2004,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+// @WARNING@
+
+#ifndef @GUARD_NAME@
+#define @GUARD_NAME@
+
+#include <trellis/@BASE_NAME@.h>
+
+namespace gr {
+ namespace trellis {
+
+ class @IMPL_NAME@ : public @BASE_NAME@
+ {
+ private:
+ fsm d_FSM;
+ int d_K;
+ int d_S0;
+ int d_SK;
+ int d_D;
+ std::vector<@I_TYPE@> d_TABLE;
+ digital::trellis_metric_type_t d_TYPE;
+ //std::vector<int> d_trace;
+
+ public:
+ @IMPL_NAME@(const fsm &FSM, int K,
+ int S0, int SK, int D,
+ const std::vector<@I_TYPE@> &TABLE,
+ digital::trellis_metric_type_t TYPE);
+ ~@IMPL_NAME@();
+
+ fsm FSM() const { return d_FSM; }
+ int K() const { return d_K; }
+ int S0() const { return d_S0; }
+ int SK() const { return d_SK; }
+ int D() const { return d_D; }
+ std::vector<@I_TYPE@> TABLE() const { return d_TABLE; }
+ digital::trellis_metric_type_t TYPE() const { return d_TYPE; }
+ //std::vector<int> trace() const { return d_trace; }
+ void set_TABLE(const std::vector<@I_TYPE@> &table);
+
+ void forecast(int noutput_items,
+ gr_vector_int &ninput_items_required);
+
+ int general_work(int noutput_items,
+ gr_vector_int &ninput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace trellis */
+} /* namespace gr */
+
+#endif /* @GUARD_NAME@ */
diff --git a/gr-trellis/python/CMakeLists.txt b/gr-trellis/python/CMakeLists.txt
new file mode 100644
index 0000000000..a166764fbe
--- /dev/null
+++ b/gr-trellis/python/CMakeLists.txt
@@ -0,0 +1,57 @@
+# Copyright 2011-2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+# Setup python install
+########################################################################
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ FILES
+ __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/trellis
+ COMPONENT "trellis_python"
+)
+
+########################################################################
+# Handle the unit tests
+########################################################################
+if(ENABLE_TESTING)
+
+list(APPEND GR_TEST_PYTHON_DIRS
+ ${CMAKE_BINARY_DIR}/gr-trellis/python
+ ${CMAKE_BINARY_DIR}/gr-trellis/swig
+ ${CMAKE_BINARY_DIR}/gr-blocks/python
+ ${CMAKE_BINARY_DIR}/gr-blocks/swig
+ ${CMAKE_BINARY_DIR}/gr-filter/python
+ ${CMAKE_BINARY_DIR}/gr-filter/swig
+ ${CMAKE_BINARY_DIR}/gr-analog/python
+ ${CMAKE_BINARY_DIR}/gr-analog/swig
+ ${CMAKE_BINARY_DIR}/gr-digital/python
+ ${CMAKE_BINARY_DIR}/gr-digital/swig
+)
+list(APPEND GR_TEST_TARGET_DEPS gnuradio-trellis gnuradio-digital gnuradio-analog gnuradio-filter)
+
+include(GrTest)
+file(GLOB py_qa_test_files "qa_*.py")
+foreach(py_qa_test_file ${py_qa_test_files})
+ get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
+ GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
+endforeach(py_qa_test_file)
+endif(ENABLE_TESTING)
diff --git a/gr-trellis/src/lib/generate_all.py b/gr-trellis/python/__init__.py
index 78e36270cc..a1792bc9b4 100644
--- a/gr-trellis/src/lib/generate_all.py
+++ b/gr-trellis/python/__init__.py
@@ -1,32 +1,27 @@
-#!/usr/bin/env python
-#
-# Copyright 2006,2007 Free Software Foundation, Inc.
-#
+# Copyright 2012 Free Software Foundation, Inc.
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
-from build_utils import output_glue
+'''
+Blocks and utilities for trellis coding and related.
+'''
-import generate_trellis
+# The presence of this file turns this directory into a Python package
-def generate_all ():
- generate_trellis.generate ()
- output_glue ('trellis')
-
-if __name__ == '__main__':
- generate_all ()
+from trellis_swig import *
diff --git a/gr-trellis/src/python/awgn1o2_4.fsm b/gr-trellis/python/awgn1o2_4.fsm
index 9245c69ac1..9245c69ac1 100644
--- a/gr-trellis/src/python/awgn1o2_4.fsm
+++ b/gr-trellis/python/awgn1o2_4.fsm
diff --git a/gr-trellis/src/python/qa_trellis.py b/gr-trellis/python/qa_trellis.py
index 2560e30131..0e1ddc61b2 100755
--- a/gr-trellis/src/python/qa_trellis.py
+++ b/gr-trellis/python/qa_trellis.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2004,2010 Free Software Foundation, Inc.
+# Copyright 2004,2010,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -21,14 +21,11 @@
#
import math
+import os
+from gnuradio import gr, gr_unittest
-from gnuradio import gr, gr_unittest, blks2
-# It's pretty ugly that we can't import trellis from gnuradio in this test
-# but because it runs on the non-installed python code it's all a mess.
-import trellis
-
-import os
+import trellis_swig as trellis
import digital_swig as digital
import analog_swig as analog
import blocks_swig as blocks
diff --git a/gr-trellis/src/lib/CMakeLists.txt b/gr-trellis/src/lib/CMakeLists.txt
deleted file mode 100644
index 3463ba8037..0000000000
--- a/gr-trellis/src/lib/CMakeLists.txt
+++ /dev/null
@@ -1,224 +0,0 @@
-# Copyright 2011 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-include(GrPython)
-
-########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${GNURADIO_CORE_INCLUDE_DIRS}
- ${GR_TRELLIS_INCLUDE_DIRS}
- ${GR_DIGITAL_INCLUDE_DIRS}
-)
-
-include_directories(${Boost_INCLUDE_DIRS})
-link_directories(${Boost_LIBRARY_DIRS})
-
-########################################################################
-# generate the python helper script which calls into the build utils
-########################################################################
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py "
-#!${PYTHON_EXECUTABLE}
-
-import sys, os, re
-sys.path.append('${GR_CORE_PYTHONPATH}')
-sys.path.append('${CMAKE_CURRENT_SOURCE_DIR}')
-os.environ['srcdir'] = '${CMAKE_CURRENT_SOURCE_DIR}'
-os.chdir('${CMAKE_CURRENT_BINARY_DIR}')
-
-if __name__ == '__main__':
- import build_utils, generate_trellis
- root, inp = sys.argv[1:3]
- for sig in sys.argv[3:]:
- name = re.sub ('X+', sig, root)
- d = generate_trellis.standard_dict(name, sig)
- build_utils.expand_template(d, inp)
-
-")
-
-########################################################################
-# generation helper macro to generate various files from template
-########################################################################
-macro(expand_h_cc_i root)
-
- foreach(ext h cc i)
- #make a list of all the generated files
- unset(expanded_files_${ext})
- foreach(sig ${ARGN})
- string(REGEX REPLACE "X+" ${sig} name ${root})
- list(APPEND expanded_files_${ext} ${CMAKE_CURRENT_BINARY_DIR}/${name}.${ext})
- endforeach(sig)
-
- #create a command to generate the files
- add_custom_command(
- OUTPUT ${expanded_files_${ext}}
- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${root}.${ext}.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B}
- ${CMAKE_CURRENT_BINARY_DIR}/generate_helper.py
- ${root} ${root}.${ext}.t ${ARGN}
- )
- endforeach(ext)
-
- #make source files depends on headers to force generation
- set_source_files_properties(${expanded_files_cc}
- PROPERTIES OBJECT_DEPENDS "${expanded_files_h}"
- )
-
- #install rules for the generated cc, h, and i files
- list(APPEND generated_trellis_sources ${expanded_files_cc})
- list(APPEND generated_trellis_includes ${expanded_files_h})
- list(APPEND generated_trellis_swigs ${expanded_files_i})
-
-endmacro(expand_h_cc_i)
-
-########################################################################
-# Invoke macro to generate various sources
-########################################################################
-expand_h_cc_i(trellis_encoder_XX bb bs bi ss si ii)
-expand_h_cc_i(trellis_sccc_encoder_XX bb bs bi ss si ii)
-expand_h_cc_i(trellis_pccc_encoder_XX bb bs bi ss si ii)
-expand_h_cc_i(trellis_metrics_X s i f c)
-expand_h_cc_i(trellis_viterbi_X b s i)
-expand_h_cc_i(trellis_viterbi_combined_XX sb ss si ib is ii fb fs fi cb cs ci)
-expand_h_cc_i(trellis_sccc_decoder_X b s i)
-expand_h_cc_i(trellis_sccc_decoder_combined_XX fb fs fi cb cs ci)
-expand_h_cc_i(trellis_pccc_decoder_X b s i)
-expand_h_cc_i(trellis_pccc_decoder_combined_XX fb fs fi cb cs ci)
-
-########################################################################
-# Create the master trellis swig include files
-########################################################################
-set(generated_index ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i.in)
-file(WRITE ${generated_index} "
-//
-// This file is machine generated. All edits will be overwritten
-//
-")
-
-file(APPEND ${generated_index} "%{\n")
-foreach(swig_file ${generated_trellis_swigs})
- get_filename_component(name ${swig_file} NAME_WE)
- file(APPEND ${generated_index} "#include<${name}.h>\n")
-endforeach(swig_file)
-file(APPEND ${generated_index} "%}\n")
-
-foreach(swig_file ${generated_trellis_swigs})
- get_filename_component(name ${swig_file} NAME)
- file(APPEND ${generated_index} "%include<${name}>\n")
-endforeach(swig_file)
-
-execute_process(
- COMMAND ${CMAKE_COMMAND} -E copy_if_different
- ${generated_index} ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i
-)
-
-########################################################################
-# Setup library
-########################################################################
-list(APPEND gr_trellis_sources
- fsm.cc
- quicksort_index.cc
- base.cc
- interleaver.cc
- calc_metric.cc
- core_algorithms.cc
- trellis_permutation.cc
- trellis_siso_f.cc
- trellis_siso_combined_f.cc
- trellis_constellation_metrics_cf.cc
- ${generated_trellis_sources}
-)
-
-list(APPEND trellis_libs
- gnuradio-core
- gnuradio-digital
- ${Boost_LIBRARIES}
-)
-
-add_library(gnuradio-trellis SHARED ${gr_trellis_sources})
-target_link_libraries(gnuradio-trellis ${trellis_libs})
-GR_LIBRARY_FOO(gnuradio-trellis RUNTIME_COMPONENT "trellis_runtime" DEVEL_COMPONENT "trellis_devel")
-
-########################################################################
-# Handle the generated sources + a few non-generated ones
-########################################################################
-install(FILES
- ${generated_trellis_includes}
- trellis_api.h
- fsm.h
- quicksort_index.h
- base.h
- interleaver.h
- calc_metric.h
- core_algorithms.h
- trellis_permutation.h
- siso_type.h
- trellis_siso_f.h
- trellis_siso_combined_f.h
- trellis_constellation_metrics_cf.h
- DESTINATION ${GR_INCLUDE_DIR}/gnuradio
- COMPONENT "trellis_devel"
-)
-
-if(ENABLE_PYTHON)
- install(FILES
- trellis.i
- ${generated_trellis_swigs}
- fsm.i
- interleaver.i
- trellis_permutation.i
- trellis_siso_f.i
- trellis_siso_combined_f.i
- trellis_constellation_metrics_cf.i
- ${CMAKE_CURRENT_BINARY_DIR}/trellis_generated.i
- ${CMAKE_CURRENT_BINARY_DIR}/trellis_swig_doc.i
- DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
- COMPONENT "trellis_swig"
- )
-
-########################################################################
-# Setup swig generation
-########################################################################
-include(GrPython)
-include(GrSwig)
-
-set(GR_SWIG_SOURCE_DEPS
- ${generated_trellis_includes}
- ${generated_trellis_swigs}
-)
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_TRELLIS_INCLUDE_DIRS}
- ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
- ${GR_DIGITAL_SWIG_INCLUDE_DIRS}
-)
-
-set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/trellis_swig_doc.i)
-set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
-
-set(GR_SWIG_LIBRARIES gnuradio-trellis gnuradio-digital gnuradio-analog gnuradio-fft)
-GR_SWIG_MAKE(trellis trellis.i)
-
-GR_SWIG_INSTALL(
- TARGETS trellis
- DESTINATION ${GR_PYTHON_DIR}/gnuradio
- COMPONENT "trellis_python"
-)
-
-endif(ENABLE_PYTHON)
diff --git a/gr-trellis/src/lib/Makefile.gen b/gr-trellis/src/lib/Makefile.gen
deleted file mode 100644
index b9b9afb1f7..0000000000
--- a/gr-trellis/src/lib/Makefile.gen
+++ /dev/null
@@ -1,174 +0,0 @@
-#
-# This file is machine generated. All edits will be overwritten
-#
-GENERATED_H = \
- trellis_encoder_bb.h \
- trellis_encoder_bi.h \
- trellis_encoder_bs.h \
- trellis_encoder_ii.h \
- trellis_encoder_si.h \
- trellis_encoder_ss.h \
- trellis_metrics_c.h \
- trellis_metrics_f.h \
- trellis_metrics_i.h \
- trellis_metrics_s.h \
- trellis_pccc_decoder_b.h \
- trellis_pccc_decoder_combined_cb.h \
- trellis_pccc_decoder_combined_ci.h \
- trellis_pccc_decoder_combined_cs.h \
- trellis_pccc_decoder_combined_fb.h \
- trellis_pccc_decoder_combined_fi.h \
- trellis_pccc_decoder_combined_fs.h \
- trellis_pccc_decoder_i.h \
- trellis_pccc_decoder_s.h \
- trellis_pccc_encoder_bb.h \
- trellis_pccc_encoder_bi.h \
- trellis_pccc_encoder_bs.h \
- trellis_pccc_encoder_ii.h \
- trellis_pccc_encoder_si.h \
- trellis_pccc_encoder_ss.h \
- trellis_sccc_decoder_b.h \
- trellis_sccc_decoder_combined_cb.h \
- trellis_sccc_decoder_combined_ci.h \
- trellis_sccc_decoder_combined_cs.h \
- trellis_sccc_decoder_combined_fb.h \
- trellis_sccc_decoder_combined_fi.h \
- trellis_sccc_decoder_combined_fs.h \
- trellis_sccc_decoder_i.h \
- trellis_sccc_decoder_s.h \
- trellis_sccc_encoder_bb.h \
- trellis_sccc_encoder_bi.h \
- trellis_sccc_encoder_bs.h \
- trellis_sccc_encoder_ii.h \
- trellis_sccc_encoder_si.h \
- trellis_sccc_encoder_ss.h \
- trellis_viterbi_b.h \
- trellis_viterbi_combined_cb.h \
- trellis_viterbi_combined_ci.h \
- trellis_viterbi_combined_cs.h \
- trellis_viterbi_combined_fb.h \
- trellis_viterbi_combined_fi.h \
- trellis_viterbi_combined_fs.h \
- trellis_viterbi_combined_ib.h \
- trellis_viterbi_combined_ii.h \
- trellis_viterbi_combined_is.h \
- trellis_viterbi_combined_sb.h \
- trellis_viterbi_combined_si.h \
- trellis_viterbi_combined_ss.h \
- trellis_viterbi_i.h \
- trellis_viterbi_s.h
-
-GENERATED_I = \
- trellis_encoder_bb.i \
- trellis_encoder_bi.i \
- trellis_encoder_bs.i \
- trellis_encoder_ii.i \
- trellis_encoder_si.i \
- trellis_encoder_ss.i \
- trellis_metrics_c.i \
- trellis_metrics_f.i \
- trellis_metrics_i.i \
- trellis_metrics_s.i \
- trellis_pccc_decoder_b.i \
- trellis_pccc_decoder_combined_cb.i \
- trellis_pccc_decoder_combined_ci.i \
- trellis_pccc_decoder_combined_cs.i \
- trellis_pccc_decoder_combined_fb.i \
- trellis_pccc_decoder_combined_fi.i \
- trellis_pccc_decoder_combined_fs.i \
- trellis_pccc_decoder_i.i \
- trellis_pccc_decoder_s.i \
- trellis_pccc_encoder_bb.i \
- trellis_pccc_encoder_bi.i \
- trellis_pccc_encoder_bs.i \
- trellis_pccc_encoder_ii.i \
- trellis_pccc_encoder_si.i \
- trellis_pccc_encoder_ss.i \
- trellis_sccc_decoder_b.i \
- trellis_sccc_decoder_combined_cb.i \
- trellis_sccc_decoder_combined_ci.i \
- trellis_sccc_decoder_combined_cs.i \
- trellis_sccc_decoder_combined_fb.i \
- trellis_sccc_decoder_combined_fi.i \
- trellis_sccc_decoder_combined_fs.i \
- trellis_sccc_decoder_i.i \
- trellis_sccc_decoder_s.i \
- trellis_sccc_encoder_bb.i \
- trellis_sccc_encoder_bi.i \
- trellis_sccc_encoder_bs.i \
- trellis_sccc_encoder_ii.i \
- trellis_sccc_encoder_si.i \
- trellis_sccc_encoder_ss.i \
- trellis_viterbi_b.i \
- trellis_viterbi_combined_cb.i \
- trellis_viterbi_combined_ci.i \
- trellis_viterbi_combined_cs.i \
- trellis_viterbi_combined_fb.i \
- trellis_viterbi_combined_fi.i \
- trellis_viterbi_combined_fs.i \
- trellis_viterbi_combined_ib.i \
- trellis_viterbi_combined_ii.i \
- trellis_viterbi_combined_is.i \
- trellis_viterbi_combined_sb.i \
- trellis_viterbi_combined_si.i \
- trellis_viterbi_combined_ss.i \
- trellis_viterbi_i.i \
- trellis_viterbi_s.i
-
-GENERATED_CC = \
- trellis_encoder_bb.cc \
- trellis_encoder_bi.cc \
- trellis_encoder_bs.cc \
- trellis_encoder_ii.cc \
- trellis_encoder_si.cc \
- trellis_encoder_ss.cc \
- trellis_metrics_c.cc \
- trellis_metrics_f.cc \
- trellis_metrics_i.cc \
- trellis_metrics_s.cc \
- trellis_pccc_decoder_b.cc \
- trellis_pccc_decoder_combined_cb.cc \
- trellis_pccc_decoder_combined_ci.cc \
- trellis_pccc_decoder_combined_cs.cc \
- trellis_pccc_decoder_combined_fb.cc \
- trellis_pccc_decoder_combined_fi.cc \
- trellis_pccc_decoder_combined_fs.cc \
- trellis_pccc_decoder_i.cc \
- trellis_pccc_decoder_s.cc \
- trellis_pccc_encoder_bb.cc \
- trellis_pccc_encoder_bi.cc \
- trellis_pccc_encoder_bs.cc \
- trellis_pccc_encoder_ii.cc \
- trellis_pccc_encoder_si.cc \
- trellis_pccc_encoder_ss.cc \
- trellis_sccc_decoder_b.cc \
- trellis_sccc_decoder_combined_cb.cc \
- trellis_sccc_decoder_combined_ci.cc \
- trellis_sccc_decoder_combined_cs.cc \
- trellis_sccc_decoder_combined_fb.cc \
- trellis_sccc_decoder_combined_fi.cc \
- trellis_sccc_decoder_combined_fs.cc \
- trellis_sccc_decoder_i.cc \
- trellis_sccc_decoder_s.cc \
- trellis_sccc_encoder_bb.cc \
- trellis_sccc_encoder_bi.cc \
- trellis_sccc_encoder_bs.cc \
- trellis_sccc_encoder_ii.cc \
- trellis_sccc_encoder_si.cc \
- trellis_sccc_encoder_ss.cc \
- trellis_viterbi_b.cc \
- trellis_viterbi_combined_cb.cc \
- trellis_viterbi_combined_ci.cc \
- trellis_viterbi_combined_cs.cc \
- trellis_viterbi_combined_fb.cc \
- trellis_viterbi_combined_fi.cc \
- trellis_viterbi_combined_fs.cc \
- trellis_viterbi_combined_ib.cc \
- trellis_viterbi_combined_ii.cc \
- trellis_viterbi_combined_is.cc \
- trellis_viterbi_combined_sb.cc \
- trellis_viterbi_combined_si.cc \
- trellis_viterbi_combined_ss.cc \
- trellis_viterbi_i.cc \
- trellis_viterbi_s.cc
-
diff --git a/gr-trellis/src/lib/base.cc b/gr-trellis/src/lib/base.cc
deleted file mode 100644
index 002c964cd5..0000000000
--- a/gr-trellis/src/lib/base.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2002 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <cstdio>
-#include <stdexcept>
-#include <cmath>
-#include "base.h"
-
-
-bool dec2base(unsigned int num, int base, std::vector<int> &s)
-{
- int l = s.size();
- unsigned int n=num;
- for(int i=0;i<l;i++) {
- s[l-i-1] = n % base; //MSB first
- n /= base;
- }
- if(n!=0) {
- printf("Number %d requires more than %d digits.",num,l);
- return false;
- }
- else
- return true;
-}
-
-
-unsigned int base2dec(const std::vector<int> &s, int base)
-{
- int l = s.size();
- unsigned int num=0;
- for(int i=0;i<l;i++)
- num=num*base+s[i];
- return num;
-}
-
-
-bool dec2bases(unsigned int num, const std::vector<int> &bases, std::vector<int> &s)
-{
- int l = s.size();
- unsigned int n=num;
- for(int i=0;i<l;i++) {
- s[l-i-1] = n % bases[l-i-1];
- n /= bases[l-i-1];
- }
- if(n!=0) {
- printf("Number %d requires more than %d digits.",num,l);
- return false;
- }
- else
- return true;
-}
-
-
-
-unsigned int bases2dec(const std::vector<int> &s, const std::vector<int> &bases)
-{
- int l = s.size();
- unsigned int num=0;
- for(int i=0;i<l;i++)
- num = num * bases[i] + s[i];
- return num;
-}
-
-
-
-
-
-
-
-
-
-
-
diff --git a/gr-trellis/src/lib/calc_metric.cc b/gr-trellis/src/lib/calc_metric.cc
deleted file mode 100644
index 4d58a05482..0000000000
--- a/gr-trellis/src/lib/calc_metric.cc
+++ /dev/null
@@ -1,258 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <float.h>
-#include <stdexcept>
-#include "calc_metric.h"
-
-
-
-template <class T>
-void calc_metric(int O, int D, const std::vector<T> &TABLE, const T *in,
- float *metric, gr::digital::trellis_metric_type_t type)
-{
- float minm = FLT_MAX;
- int minmi = 0;
-
-
- switch (type){
- case gr::digital::TRELLIS_EUCLIDEAN:
- for(int o=0;o<O;o++) {
- metric[o]=0.0;
- for (int m=0;m<D;m++) {
- T s=in[m]-TABLE[o*D+m];
- //gr_complex sc(1.0*s,0);
- //metric[o]+=(sc*conj(sc)).real();
- metric[o]+= s * s;
- }
- }
- break;
- case gr::digital::TRELLIS_HARD_SYMBOL:
- for(int o=0;o<O;o++) {
- metric[o]=0.0;
- for (int m=0;m<D;m++) {
- T s=in[m]-TABLE[o*D+m];
- //gr_complex sc(1.0*s,0);
- //metric[o]+=(sc*conj(sc)).real();
- metric[o]+= s * s;
- }
- if(metric[o]<minm) {
- minm=metric[o];
- minmi=o;
- }
- }
- for(int o=0;o<O;o++) {
- metric[o] = (o==minmi?0.0:1.0);
- }
- break;
- case gr::digital::TRELLIS_HARD_BIT:
- throw std::runtime_error ("Invalid metric type (not yet implemented).");
- break;
- default:
- throw std::runtime_error ("Invalid metric type.");
- }
-}
-
-
-
-template
-void calc_metric<short>(int O, int D, const std::vector<short> &TABLE, const short *in,
- float *metric, gr::digital::trellis_metric_type_t type);
-
-template
-void calc_metric<int>(int O, int D, const std::vector<int> &TABLE, const int *in,
- float *metric, gr::digital::trellis_metric_type_t type);
-
-template
-void calc_metric<float>(int O, int D, const std::vector<float> &TABLE, const float *in,
- float *metric, gr::digital::trellis_metric_type_t type);
-
-
-/*
-void calc_metric(int O, int D, const std::vector<short> &TABLE, const short *in,
- float *metric, gr::digital::trellis_metric_type_t type)
-{
- float minm = FLT_MAX;
- int minmi = 0;
-
- switch (type){
- case gr::digital::TRELLIS_EUCLIDEAN:
- for(int o=0;o<O;o++) {
- metric[o]=0.0;
- for (int m=0;m<D;m++) {
- float s=in[m]-TABLE[o*D+m];
- metric[o]+=s*s;
- }
- }
- break;
- case gr::digital::TRELLIS_HARD_SYMBOL:
- for(int o=0;o<O;o++) {
- metric[o]=0.0;
- for (int m=0;m<D;m++) {
- float s=in[m]-TABLE[o*D+m];
- metric[o]+=s*s;
- }
- if(metric[o]<minm) {
- minm=metric[o];
- minmi=o;
- }
- }
- for(int o=0;o<O;o++) {
- metric[o] = (o==minmi?0.0:1.0);
- }
- break;
- case gr::digital::TRELLIS_HARD_BIT:
- throw std::runtime_error ("Invalid metric type (not yet implemented).");
- break;
- default:
- throw std::runtime_error ("Invalid metric type.");
- }
-}
-
-
-void calc_metric(int O, int D, const std::vector<int> &TABLE, const int *in,
- float *metric, gr::digital::trellis_metric_type_t type)
-{
- float minm = FLT_MAX;
- int minmi = 0;
-
- switch (type){
- case gr::digital::TRELLIS_EUCLIDEAN:
- for(int o=0;o<O;o++) {
- metric[o]=0.0;
- for (int m=0;m<D;m++) {
- float s=in[m]-TABLE[o*D+m];
- metric[o]+=s*s;
- }
- }
- break;
- case gr::digital::TRELLIS_HARD_SYMBOL:
- for(int o=0;o<O;o++) {
- metric[o]=0.0;
- for (int m=0;m<D;m++) {
- float s=in[m]-TABLE[o*D+m];
- metric[o]+=s*s;
- }
- if(metric[o]<minm) {
- minm=metric[o];
- minmi=o;
- }
- }
- for(int o=0;o<O;o++) {
- metric[o] = (o==minmi?0.0:1.0);
- }
- break;
- case gr::digital::TRELLIS_HARD_BIT:
- throw std::runtime_error ("Invalid metric type (not yet implemented).");
- break;
- default:
- throw std::runtime_error ("Invalid metric type.");
- }
-}
-
-
-
-void calc_metric(int O, int D, const std::vector<float> &TABLE, const float *in,
- float *metric, gr::digital::trellis_metric_type_t type)
-{
- float minm = FLT_MAX;
- int minmi = 0;
-
- switch (type){
- case gr::digital::TRELLIS_EUCLIDEAN:
- for(int o=0;o<O;o++) {
- metric[o]=0.0;
- for (int m=0;m<D;m++) {
- float s=in[m]-TABLE[o*D+m];
- metric[o]+=s*s;
- }
- }
- break;
- case gr::digital::TRELLIS_HARD_SYMBOL:
- for(int o=0;o<O;o++) {
- metric[o]=0.0;
- for (int m=0;m<D;m++) {
- float s=in[m]-TABLE[o*D+m];
- metric[o]+=s*s;
- }
- if(metric[o]<minm) {
- minm=metric[o];
- minmi=o;
- }
- }
- for(int o=0;o<O;o++) {
- metric[o] = (o==minmi?0.0:1.0);
- }
- break;
- case gr::digital::TRELLIS_HARD_BIT:
- throw std::runtime_error ("Invalid metric type (not yet implemented).");
- break;
- default:
- throw std::runtime_error ("Invalid metric type.");
- }
-}
-*/
-
-
-
-
-
-void calc_metric(int O, int D, const std::vector<gr_complex> &TABLE, const gr_complex *in,
- float *metric, gr::digital::trellis_metric_type_t type)
-{
- float minm = FLT_MAX;
- int minmi = 0;
-
-
- switch (type){
- case gr::digital::TRELLIS_EUCLIDEAN:
- for(int o=0;o<O;o++) {
- metric[o]=0.0;
- for (int m=0;m<D;m++) {
- gr_complex s=in[m]-TABLE[o*D+m];
- metric[o]+=s.real()*s.real()+s.imag()*s.imag();
- }
- }
- break;
- case gr::digital::TRELLIS_HARD_SYMBOL:
- for(int o=0;o<O;o++) {
- metric[o]=0.0;
- for (int m=0;m<D;m++) {
- gr_complex s=in[m]-TABLE[o*D+m];
- metric[o]+=s.real()*s.real()+s.imag()*s.imag();
- }
- if(metric[o]<minm) {
- minm=metric[o];
- minmi=o;
- }
- }
- for(int o=0;o<O;o++) {
- metric[o] = (o==minmi?0.0:1.0);
- }
- break;
- case gr::digital::TRELLIS_HARD_BIT:
- throw std::runtime_error ("Invalid metric type (not yet implemented).");
- break;
- default:
- throw std::runtime_error ("Invalid metric type.");
- }
-}
diff --git a/gr-trellis/src/lib/calc_metric.h b/gr-trellis/src/lib/calc_metric.h
deleted file mode 100644
index cc0a12878d..0000000000
--- a/gr-trellis/src/lib/calc_metric.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_CALC_METRIC_H
-#define INCLUDED_CALC_METRIC_H
-
-#include <vector>
-#include <gr_complex.h>
-#include <digital/metric_type.h>
-
-
-template <class T>
-void calc_metric(int O, int D, const std::vector<T> &TABLE, const T *in,
- float *metric, gr::digital::trellis_metric_type_t type);
-
-/*
-void calc_metric(int O, int D, const std::vector<short> &TABLE, const short *in, float *metric, gr::digital::trellis_metric_type_t type);
-
-void calc_metric(int O, int D, const std::vector<int> &TABLE, const int *in, float *metric, gr::digital::trellis_metric_type_t type);
-
-void calc_metric(int O, int D, const std::vector<float> &TABLE, const float *in, float *metric, gr::digital::trellis_metric_type_t type);
-*/
-
-void calc_metric(int O, int D, const std::vector<gr_complex> &TABLE, const gr_complex *in,
- float *metric, gr::digital::trellis_metric_type_t type);
-
-
-
-#endif
diff --git a/gr-trellis/src/lib/core_algorithms.cc b/gr-trellis/src/lib/core_algorithms.cc
deleted file mode 100644
index 442565054a..0000000000
--- a/gr-trellis/src/lib/core_algorithms.cc
+++ /dev/null
@@ -1,1437 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <cstring>
-#include <stdexcept>
-//#include <cstdio>
-#include <iostream>
-#include "core_algorithms.h"
-#include "calc_metric.h"
-
-static const float INF = 1.0e9;
-
-float min(float a, float b)
-{
- return a <= b ? a : b;
-}
-
-float min_star(float a, float b)
-{
- return (a <= b ? a : b)-log(1+exp(a <= b ? a-b : b-a));
-}
-
-
-
-
-template <class T>
-void viterbi_algorithm(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- const float *in, T *out)//,
- //std::vector<int> &trace)
-{
- std::vector<int> trace(S*K);
- std::vector<float> alpha(S*2);
- int alphai;
- float norm,mm,minm;
- int minmi;
- int st;
-
-
- if(S0<0) { // initial state not specified
- for(int i=0;i<S;i++) alpha[0*S+i]=0;
- }
- else {
- for(int i=0;i<S;i++) alpha[0*S+i]=INF;
- alpha[0*S+S0]=0.0;
- }
-
- alphai=0;
- for(int k=0;k<K;k++) {
- norm=INF;
- for(int j=0;j<S;j++) { // for each next state do ACS
- minm=INF;
- minmi=0;
- for(unsigned int i=0;i<PS[j].size();i++) {
- //int i0 = j*I+i;
- if((mm=alpha[alphai*S+PS[j][i]]+in[k*O+OS[PS[j][i]*I+PI[j][i]]])<minm)
- minm=mm,minmi=i;
- }
- trace[k*S+j]=minmi;
- alpha[((alphai+1)%2)*S+j]=minm;
- if(minm<norm) norm=minm;
- }
- for(int j=0;j<S;j++)
- alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode
- alphai=(alphai+1)%2;
- }
-
- if(SK<0) { // final state not specified
- minm=INF;
- minmi=0;
- for(int i=0;i<S;i++)
- if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i;
- st=minmi;
- }
- else {
- st=SK;
- }
-
- for(int k=K-1;k>=0;k--) { // traceback
- int i0=trace[k*S+st];
- out[k]= (T) PI[st][i0];
- st=PS[st][i0];
- }
-
-}
-
-
-template
-void viterbi_algorithm<unsigned char>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- const float *in, unsigned char *out);
-
-
-template
-void viterbi_algorithm<short>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- const float *in, short *out);
-
-template
-void viterbi_algorithm<int>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- const float *in, int *out);
-
-
-
-//==============================================
-
-template <class Ti, class To>
-void viterbi_algorithm_combined(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<Ti> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const Ti *in, To *out
-)
-{
- std::vector<int> trace(S*K);
- std::vector<float> alpha(S*2);
- float *metric = new float[O];
- int alphai;
- float norm,mm,minm;
- int minmi;
- int st;
-
- if(S0<0) { // initial state not specified
- for(int i=0;i<S;i++) alpha[0*S+i]=0;
- }
- else {
- for(int i=0;i<S;i++) alpha[0*S+i]=INF;
- alpha[0*S+S0]=0.0;
- }
-
- alphai=0;
- for(int k=0;k<K;k++) {
- calc_metric(O, D, TABLE, &(in[k*D]), metric,TYPE); // calc metrics
- norm=INF;
- for(int j=0;j<S;j++) { // for each next state do ACS
- minm=INF;
- minmi=0;
- for(unsigned int i=0;i<PS[j].size();i++) {
- //int i0 = j*I+i;
- if((mm=alpha[alphai*S+PS[j][i]]+metric[OS[PS[j][i]*I+PI[j][i]]])<minm)
- minm=mm,minmi=i;
- }
- trace[k*S+j]=minmi;
- alpha[((alphai+1)%2)*S+j]=minm;
- if(minm<norm) norm=minm;
- }
- for(int j=0;j<S;j++)
- alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode
- alphai=(alphai+1)%2;
- }
-
- if(SK<0) { // final state not specified
- minm=INF;
- minmi=0;
- for(int i=0;i<S;i++)
- if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i;
- st=minmi;
- }
- else {
- st=SK;
- }
-
- for(int k=K-1;k>=0;k--) { // traceback
- int i0=trace[k*S+st];
- out[k]= (To) PI[st][i0];
- st=PS[st][i0];
- }
-
- delete [] metric;
-
-}
-
-// Ti = s i f c
-// To = b s i
-
-//---------------
-
-template
-void viterbi_algorithm_combined<short,unsigned char>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<short> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const short *in, unsigned char *out
-);
-
-template
-void viterbi_algorithm_combined<int,unsigned char>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<int> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const int *in, unsigned char *out
-);
-
-template
-void viterbi_algorithm_combined<float,unsigned char>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const float *in, unsigned char *out
-);
-
-template
-void viterbi_algorithm_combined<gr_complex,unsigned char>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<gr_complex> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const gr_complex *in, unsigned char *out
-);
-
-//---------------
-
-template
-void viterbi_algorithm_combined<short,short>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<short> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const short *in, short *out
-);
-
-template
-void viterbi_algorithm_combined<int,short>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<int> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const int *in, short *out
-);
-
-template
-void viterbi_algorithm_combined<float,short>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const float *in, short *out
-);
-
-template
-void viterbi_algorithm_combined<gr_complex,short>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<gr_complex> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const gr_complex *in, short *out
-);
-
-//--------------
-
-template
-void viterbi_algorithm_combined<short,int>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<short> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const short *in, int *out
-);
-
-template
-void viterbi_algorithm_combined<int,int>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<int> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const int *in, int *out
-);
-
-template
-void viterbi_algorithm_combined<float,int>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const float *in, int *out
-);
-
-template
-void viterbi_algorithm_combined<gr_complex,int>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<gr_complex> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const gr_complex *in, int *out
-);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-//===============================================
-
-
-void siso_algorithm(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- bool POSTI, bool POSTO,
- float (*p2mymin)(float,float),
- const float *priori, const float *prioro, float *post//,
- //std::vector<float> &alpha,
- //std::vector<float> &beta
- )
-{
- float norm,mm,minm;
- std::vector<float> alpha(S*(K+1));
- std::vector<float> beta(S*(K+1));
-
-
- if(S0<0) { // initial state not specified
- for(int i=0;i<S;i++) alpha[0*S+i]=0;
- }
- else {
- for(int i=0;i<S;i++) alpha[0*S+i]=INF;
- alpha[0*S+S0]=0.0;
- }
-
- for(int k=0;k<K;k++) { // forward recursion
- norm=INF;
- for(int j=0;j<S;j++) {
- minm=INF;
- for(unsigned int i=0;i<PS[j].size();i++) {
- //int i0 = j*I+i;
- mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]];
- minm=(*p2mymin)(minm,mm);
- }
- alpha[(k+1)*S+j]=minm;
- if(minm<norm) norm=minm;
- }
- for(int j=0;j<S;j++)
- alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode
- }
-
- if(SK<0) { // final state not specified
- for(int i=0;i<S;i++) beta[K*S+i]=0;
- }
- else {
- for(int i=0;i<S;i++) beta[K*S+i]=INF;
- beta[K*S+SK]=0.0;
- }
-
- for(int k=K-1;k>=0;k--) { // backward recursion
- norm=INF;
- for(int j=0;j<S;j++) {
- minm=INF;
- for(int i=0;i<I;i++) {
- int i0 = j*I+i;
- mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]];
- minm=(*p2mymin)(minm,mm);
- }
- beta[k*S+j]=minm;
- if(minm<norm) norm=minm;
- }
- for(int j=0;j<S;j++)
- beta[k*S+j]-=norm; // normalize total metrics so they do not explode
- }
-
-
-if (POSTI && POSTO)
-{
- for(int k=0;k<K;k++) { // input combining
- norm=INF;
- for(int i=0;i<I;i++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]];
- minm=(*p2mymin)(minm,mm);
- }
- post[k*(I+O)+i]=minm;
- if(minm<norm) norm=minm;
- }
- for(int i=0;i<I;i++)
- post[k*(I+O)+i]-=norm; // normalize metrics
- }
-
-
- for(int k=0;k<K;k++) { // output combining
- norm=INF;
- for(int n=0;n<O;n++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- for(int i=0;i<I;i++) {
- mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF);
- minm=(*p2mymin)(minm,mm);
- }
- }
- post[k*(I+O)+I+n]=minm;
- if(minm<norm) norm=minm;
- }
- for(int n=0;n<O;n++)
- post[k*(I+O)+I+n]-=norm; // normalize metrics
- }
-}
-else if(POSTI)
-{
- for(int k=0;k<K;k++) { // input combining
- norm=INF;
- for(int i=0;i<I;i++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]];
- minm=(*p2mymin)(minm,mm);
- }
- post[k*I+i]=minm;
- if(minm<norm) norm=minm;
- }
- for(int i=0;i<I;i++)
- post[k*I+i]-=norm; // normalize metrics
- }
-}
-else if(POSTO)
-{
- for(int k=0;k<K;k++) { // output combining
- norm=INF;
- for(int n=0;n<O;n++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- for(int i=0;i<I;i++) {
- mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF);
- minm=(*p2mymin)(minm,mm);
- }
- }
- post[k*O+n]=minm;
- if(minm<norm) norm=minm;
- }
- for(int n=0;n<O;n++)
- post[k*O+n]-=norm; // normalize metrics
- }
-}
-else
- throw std::runtime_error ("Not both POSTI and POSTO can be false.");
-
-}
-
-
-//===========================================================
-
-template <class T>
-void siso_algorithm_combined(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- bool POSTI, bool POSTO,
- float (*p2mymin)(float,float),
- int D,
- const std::vector<T> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const float *priori, const T *observations, float *post
-)
-{
- float norm,mm,minm;
- std::vector<float> alpha(S*(K+1));
- std::vector<float> beta(S*(K+1));
- float *prioro = new float[O*K];
-
-
- if(S0<0) { // initial state not specified
- for(int i=0;i<S;i++) alpha[0*S+i]=0;
- }
- else {
- for(int i=0;i<S;i++) alpha[0*S+i]=INF;
- alpha[0*S+S0]=0.0;
- }
-
- for(int k=0;k<K;k++) { // forward recursion
- calc_metric(O, D, TABLE, &(observations[k*D]), &(prioro[k*O]),TYPE); // calc metrics
- norm=INF;
- for(int j=0;j<S;j++) {
- minm=INF;
- for(unsigned int i=0;i<PS[j].size();i++) {
- //int i0 = j*I+i;
- mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]];
- minm=(*p2mymin)(minm,mm);
- }
- alpha[(k+1)*S+j]=minm;
- if(minm<norm) norm=minm;
- }
- for(int j=0;j<S;j++)
- alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode
- }
-
- if(SK<0) { // final state not specified
- for(int i=0;i<S;i++) beta[K*S+i]=0;
- }
- else {
- for(int i=0;i<S;i++) beta[K*S+i]=INF;
- beta[K*S+SK]=0.0;
- }
-
- for(int k=K-1;k>=0;k--) { // backward recursion
- norm=INF;
- for(int j=0;j<S;j++) {
- minm=INF;
- for(int i=0;i<I;i++) {
- int i0 = j*I+i;
- mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]];
- minm=(*p2mymin)(minm,mm);
- }
- beta[k*S+j]=minm;
- if(minm<norm) norm=minm;
- }
- for(int j=0;j<S;j++)
- beta[k*S+j]-=norm; // normalize total metrics so they do not explode
- }
-
-
- if (POSTI && POSTO)
- {
- for(int k=0;k<K;k++) { // input combining
- norm=INF;
- for(int i=0;i<I;i++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]];
- minm=(*p2mymin)(minm,mm);
- }
- post[k*(I+O)+i]=minm;
- if(minm<norm) norm=minm;
- }
- for(int i=0;i<I;i++)
- post[k*(I+O)+i]-=norm; // normalize metrics
- }
-
-
- for(int k=0;k<K;k++) { // output combining
- norm=INF;
- for(int n=0;n<O;n++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- for(int i=0;i<I;i++) {
- mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF);
- minm=(*p2mymin)(minm,mm);
- }
- }
- post[k*(I+O)+I+n]=minm;
- if(minm<norm) norm=minm;
- }
- for(int n=0;n<O;n++)
- post[k*(I+O)+I+n]-=norm; // normalize metrics
- }
- }
- else if(POSTI)
- {
- for(int k=0;k<K;k++) { // input combining
- norm=INF;
- for(int i=0;i<I;i++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]];
- minm=(*p2mymin)(minm,mm);
- }
- post[k*I+i]=minm;
- if(minm<norm) norm=minm;
- }
- for(int i=0;i<I;i++)
- post[k*I+i]-=norm; // normalize metrics
- }
- }
- else if(POSTO)
- {
- for(int k=0;k<K;k++) { // output combining
- norm=INF;
- for(int n=0;n<O;n++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- for(int i=0;i<I;i++) {
- mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF);
- minm=(*p2mymin)(minm,mm);
- }
- }
- post[k*O+n]=minm;
- if(minm<norm) norm=minm;
- }
- for(int n=0;n<O;n++)
- post[k*O+n]-=norm; // normalize metrics
- }
- }
- else
- throw std::runtime_error ("Not both POSTI and POSTO can be false.");
-
- delete [] prioro;
-
-}
-
-//---------
-
-template
-void siso_algorithm_combined<short>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- bool POSTI, bool POSTO,
- float (*p2mymin)(float,float),
- int D,
- const std::vector<short> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const float *priori, const short *observations, float *post
-);
-
-template
-void siso_algorithm_combined<int>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- bool POSTI, bool POSTO,
- float (*p2mymin)(float,float),
- int D,
- const std::vector<int> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const float *priori, const int *observations, float *post
-);
-
-template
-void siso_algorithm_combined<float>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- bool POSTI, bool POSTO,
- float (*p2mymin)(float,float),
- int D,
- const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const float *priori, const float *observations, float *post
-);
-
-template
-void siso_algorithm_combined<gr_complex>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- bool POSTI, bool POSTO,
- float (*p2mymin)(float,float),
- int D,
- const std::vector<gr_complex> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const float *priori, const gr_complex *observations, float *post
-);
-
-//=========================================================
-
-template<class Ti, class To>
-void sccc_decoder_combined(
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<Ti> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const Ti *observations, To *data
-)
-{
-
-//allocate space for priori, prioro and posti of inner FSM
-std::vector<float> ipriori(blocklength*FSMi.I(),0.0);
-std::vector<float> iprioro(blocklength*FSMi.O());
-std::vector<float> iposti(blocklength*FSMi.I());
-
-//allocate space for priori, prioro and posto of outer FSM
-std::vector<float> opriori(blocklength*FSMo.I(),0.0);
-std::vector<float> oprioro(blocklength*FSMo.O());
-std::vector<float> oposti(blocklength*FSMo.I());
-std::vector<float> oposto(blocklength*FSMo.O());
-
-// turn observations to neg-log-priors
-for(int k=0;k<blocklength;k++) {
- calc_metric(FSMi.O(), D, TABLE, &(observations[k*D]), &(iprioro[k*FSMi.O()]),METRIC_TYPE);
- iprioro[k*FSMi.O()] *= scaling;
-}
-
-for(int rep=0;rep<iterations;rep++) {
- // run inner SISO
- siso_algorithm(FSMi.I(),FSMi.S(),FSMi.O(),
- FSMi.NS(), FSMi.OS(), FSMi.PS(), FSMi.PI(),
- blocklength,
- STi0,STiK,
- true, false,
- p2mymin,
- &(ipriori[0]), &(iprioro[0]), &(iposti[0])
- );
-
- //interleave soft info inner -> outer
- for(int k=0;k<blocklength;k++) {
- int ki = INTERLEAVER.DEINTER()[k];
- //for(int i=0;i<FSMi.I();i++) {
- //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i];
- //}
- memcpy(&(oprioro[k*FSMi.I()]),&(iposti[ki*FSMi.I()]),FSMi.I()*sizeof(float));
- }
-
- // run outer SISO
-
- if(rep<iterations-1) { // do not produce posti
- siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(),
- FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(),
- blocklength,
- STo0,SToK,
- false, true,
- p2mymin,
- &(opriori[0]), &(oprioro[0]), &(oposto[0])
- );
-
- //interleave soft info outer --> inner
- for(int k=0;k<blocklength;k++) {
- int ki = INTERLEAVER.DEINTER()[k];
- //for(int i=0;i<FSMi.I();i++) {
- //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i];
- //}
- memcpy(&(ipriori[ki*FSMi.I()]),&(oposto[k*FSMi.I()]),FSMi.I()*sizeof(float));
- }
- }
- else // produce posti but not posto
-
- siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(),
- FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(),
- blocklength,
- STo0,SToK,
- true, false,
- p2mymin,
- &(opriori[0]), &(oprioro[0]), &(oposti[0])
- );
-
- /*
- viterbi_algorithm(FSMo.I(),FSMo.S(),FSMo.O(),
- FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(),
- blocklength,
- STo0,SToK,
- &(oprioro[0]), data
- );
- */
-
-}
-
-
-// generate hard decisions
-for(int k=0;k<blocklength;k++) {
- float min=INF;
- int mini=0;
- for(int i=0;i<FSMo.I();i++) {
- if(oposti[k*FSMo.I()+i]<min) {
- min=oposti[k*FSMo.I()+i];
- mini=i;
- }
- }
- data[k]=(To)mini;
-}
-
-
-
-}
-
-//-------
-
-template
-void sccc_decoder_combined<float,unsigned char>(
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const float *observations, unsigned char *data
-);
-
-template
-void sccc_decoder_combined<float,short>(
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const float *observations, short *data
-);
-
-template
-void sccc_decoder_combined<float,int>(
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const float *observations, int *data
-);
-
-template
-void sccc_decoder_combined<gr_complex,unsigned char>(
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<gr_complex> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const gr_complex *observations, unsigned char *data
-);
-
-template
-void sccc_decoder_combined<gr_complex,short>(
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<gr_complex> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const gr_complex *observations, short *data
-);
-
-template
-void sccc_decoder_combined<gr_complex,int>(
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<gr_complex> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const gr_complex *observations, int *data
-);
-
-
-
-//=========================================================
-
-template<class T>
-void sccc_decoder(
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- const float *iprioro, T *data
-)
-{
- //allocate space for priori, and posti of inner FSM
- std::vector<float> ipriori(blocklength*FSMi.I(),0.0);
- std::vector<float> iposti(blocklength*FSMi.I());
-
- //allocate space for priori, prioro and posto of outer FSM
- std::vector<float> opriori(blocklength*FSMo.I(),0.0);
- std::vector<float> oprioro(blocklength*FSMo.O());
- std::vector<float> oposti(blocklength*FSMo.I());
- std::vector<float> oposto(blocklength*FSMo.O());
-
- for(int rep=0;rep<iterations;rep++) {
- // run inner SISO
- siso_algorithm(FSMi.I(),FSMi.S(),FSMi.O(),
- FSMi.NS(), FSMi.OS(), FSMi.PS(), FSMi.PI(),
- blocklength,
- STi0,STiK,
- true, false,
- p2mymin,
- &(ipriori[0]), &(iprioro[0]), &(iposti[0])
- );
-
- //interleave soft info inner -> outer
- for(int k=0;k<blocklength;k++) {
- int ki = INTERLEAVER.DEINTER()[k];
- //for(int i=0;i<FSMi.I();i++) {
- //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i];
- //}
- memcpy(&(oprioro[k*FSMi.I()]),&(iposti[ki*FSMi.I()]),FSMi.I()*sizeof(float));
- }
-
- // run outer SISO
-
- if(rep<iterations-1) { // do not produce posti
- siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(),
- FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(),
- blocklength,
- STo0,SToK,
- false, true,
- p2mymin,
- &(opriori[0]), &(oprioro[0]), &(oposto[0])
- );
-
- //interleave soft info outer --> inner
- for(int k=0;k<blocklength;k++) {
- int ki = INTERLEAVER.DEINTER()[k];
- //for(int i=0;i<FSMi.I();i++) {
- //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i];
- //}
- memcpy(&(ipriori[ki*FSMi.I()]),&(oposto[k*FSMi.I()]),FSMi.I()*sizeof(float));
- }
- }
- else {// produce posti but not posto
-
- siso_algorithm(FSMo.I(),FSMo.S(),FSMo.O(),
- FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(),
- blocklength,
- STo0,SToK,
- true, false,
- p2mymin,
- &(opriori[0]), &(oprioro[0]), &(oposti[0])
- );
-
- /*
- viterbi_algorithm(FSMo.I(),FSMo.S(),FSMo.O(),
- FSMo.NS(), FSMo.OS(), FSMo.PS(), FSMo.PI(),
- blocklength,
- STo0,SToK,
- &(oprioro[0]), data
- );
- */
- }
-
- } // end iterations
-
- // generate hard decisions
- for(int k=0;k<blocklength;k++) {
- float min=INF;
- int mini=0;
- for(int i=0;i<FSMo.I();i++) {
- if(oposti[k*FSMo.I()+i]<min) {
- min=oposti[k*FSMo.I()+i];
- mini=i;
- }
- }
- data[k]=(T)mini;
- }
-
-
-
-}
-
-//-------
-
-template
-void sccc_decoder<unsigned char>(
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- const float *iprioro, unsigned char *data
-);
-
-template
-void sccc_decoder<short>(
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- const float *iprioro, short *data
-);
-
-template
-void sccc_decoder<int>(
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- const float *iprioro, int *data
-);
-
-
-//====================================================
-
-template<class T>
-void pccc_decoder(
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- const float *cprioro, T *data
-)
-{
-
- //allocate space for priori, prioro and posti of FSM1
- std::vector<float> priori1(blocklength*FSM1.I(),0.0);
- std::vector<float> prioro1(blocklength*FSM1.O());
- std::vector<float> posti1(blocklength*FSM1.I());
-
- //allocate space for priori, prioro and posti of FSM2
- std::vector<float> priori2(blocklength*FSM2.I(),0.0);
- std::vector<float> prioro2(blocklength*FSM2.O());
- std::vector<float> posti2(blocklength*FSM2.I());
-
- //generate prioro1,2 (metrics are not updated per iteration: this is not the best you can do...)
- for (int k=0;k<blocklength;k++) {
- //std::cout << k << std::endl;
- for(int i=0;i<FSM1.O();i++) {
- float x=cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+0];
- for(int j=1;j<FSM2.O();j++)
- x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+j]);
- prioro1[k*FSM1.O()+i]=x;
- //std::cout << prioro1[k*FSM1.O()+i] << ", ";
- }
- //std::cout << std::endl;
- for(int i=0;i<FSM2.O();i++) {
- float x=cprioro[k*FSM1.O()*FSM2.O()+0*FSM1.O()+i];
- for(int j=1;j<FSM1.O();j++)
- x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+j*FSM1.O()+i]);
- prioro2[k*FSM2.O()+i]=x;
- }
- }
-
- for(int rep=0;rep<iterations;rep++) {
- // run SISO 1
- siso_algorithm(FSM1.I(),FSM1.S(),FSM1.O(),
- FSM1.NS(), FSM1.OS(), FSM1.PS(), FSM1.PI(),
- blocklength,
- ST10,ST1K,
- true, false,
- p2mymin,
- &(priori1[0]), &(prioro1[0]), &(posti1[0])
- );
-
- //for(int k=0;k<blocklength;k++){
- //for(int i=0;i<FSM1.I();i++)
- //std::cout << posti1[k*FSM1.I()+i] << ", ";
- //std::cout << std::endl;
- //}
-
- //interleave soft info 1 -> 2
- for(int k=0;k<blocklength;k++) {
- int ki = INTERLEAVER.INTER()[k];
- //for(int i=0;i<FSMi.I();i++) {
- //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i];
- //}
- memcpy(&(priori2[k*FSM2.I()]),&(posti1[ki*FSM1.I()]),FSM1.I()*sizeof(float));
- }
-
- // run SISO 2
- siso_algorithm(FSM2.I(),FSM2.S(),FSM2.O(),
- FSM2.NS(), FSM2.OS(), FSM2.PS(), FSM2.PI(),
- blocklength,
- ST20,ST2K,
- true, false,
- p2mymin,
- &(priori2[0]), &(prioro2[0]), &(posti2[0])
- );
-
- //interleave soft info 2 --> 1
- for(int k=0;k<blocklength;k++) {
- int ki = INTERLEAVER.INTER()[k];
- //for(int i=0;i<FSMi.I();i++) {
- //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i];
- //}
- memcpy(&(priori1[ki*FSM1.I()]),&(posti2[k*FSM2.I()]),FSM1.I()*sizeof(float));
- }
-
- } // end iterations
-
- // generate hard decisions
- for(int k=0;k<blocklength;k++) {
- for(int i=0;i<FSM1.I();i++)
- posti1[k*FSM1.I()+i] = (*p2mymin)(priori1[k*FSM1.I()+i],posti1[k*FSM1.I()+i]);
- float min=INF;
- int mini=0;
- for(int i=0;i<FSM1.I();i++) {
- if(posti1[k*FSM1.I()+i]<min) {
- min=posti1[k*FSM1.I()+i];
- mini=i;
- }
- }
- data[k]=(T)mini;
- //std::cout << data[k] << ", "<< std::endl;
- }
- //std::cout << std::endl;
-
-}
-
-//----------------
-
-template
-void pccc_decoder<unsigned char>(
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- const float *cprioro, unsigned char *data
-);
-
-template
-void pccc_decoder<short>(
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- const float *cprioro, short *data
-);
-
-template
-void pccc_decoder<int>(
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- const float *cprioro, int *data
-);
-
-
-
-//----------------
-
-
-template<class Ti, class To>
-void pccc_decoder_combined(
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<Ti> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const Ti *observations, To *data
-)
-{
-
- //allocate space for cprioro
- std::vector<float> cprioro(blocklength*FSM1.O()*FSM2.O(),0.0);
-
- //allocate space for priori, prioro and posti of FSM1
- std::vector<float> priori1(blocklength*FSM1.I(),0.0);
- std::vector<float> prioro1(blocklength*FSM1.O());
- std::vector<float> posti1(blocklength*FSM1.I());
-
- //allocate space for priori, prioro and posti of FSM2
- std::vector<float> priori2(blocklength*FSM2.I(),0.0);
- std::vector<float> prioro2(blocklength*FSM2.O());
- std::vector<float> posti2(blocklength*FSM2.I());
-
- // turn observations to neg-log-priors for cprioiro
- int O=FSM1.O()*FSM2.O();
- for(int k=0;k<blocklength;k++) {
- calc_metric(O, D, TABLE, &(observations[k*D]), &(cprioro[k*O]),METRIC_TYPE);
- cprioro[k*O] *= scaling;
- }
-
- //generate prioro1,2 (metrics are not updated per iteration: this is not the best you can do...)
- for (int k=0;k<blocklength;k++) {
- //std::cout << k << std::endl;
- for(int i=0;i<FSM1.O();i++) {
- float x=cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+0];
- for(int j=1;j<FSM2.O();j++)
- x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+i*FSM1.O()+j]);
- prioro1[k*FSM1.O()+i]=x;
- //std::cout << prioro1[k*FSM1.O()+i] << ", ";
- }
- //std::cout << std::endl;
- for(int i=0;i<FSM2.O();i++) {
- float x=cprioro[k*FSM1.O()*FSM2.O()+0*FSM1.O()+i];
- for(int j=1;j<FSM1.O();j++)
- x = (*p2mymin)(x,cprioro[k*FSM1.O()*FSM2.O()+j*FSM1.O()+i]);
- prioro2[k*FSM2.O()+i]=x;
- }
- }
-
- for(int rep=0;rep<iterations;rep++) {
- // run SISO 1
- siso_algorithm(FSM1.I(),FSM1.S(),FSM1.O(),
- FSM1.NS(), FSM1.OS(), FSM1.PS(), FSM1.PI(),
- blocklength,
- ST10,ST1K,
- true, false,
- p2mymin,
- &(priori1[0]), &(prioro1[0]), &(posti1[0])
- );
-
- //for(int k=0;k<blocklength;k++){
- //for(int i=0;i<FSM1.I();i++)
- //std::cout << posti1[k*FSM1.I()+i] << ", ";
- //std::cout << std::endl;
- //}
-
- //interleave soft info 1 -> 2
- for(int k=0;k<blocklength;k++) {
- int ki = INTERLEAVER.INTER()[k];
- //for(int i=0;i<FSMi.I();i++) {
- //oprioro[k*FSMi.I()+i]=iposti[ki*FSMi.I()+i];
- //}
- memcpy(&(priori2[k*FSM2.I()]),&(posti1[ki*FSM1.I()]),FSM1.I()*sizeof(float));
- }
-
- // run SISO 2
- siso_algorithm(FSM2.I(),FSM2.S(),FSM2.O(),
- FSM2.NS(), FSM2.OS(), FSM2.PS(), FSM2.PI(),
- blocklength,
- ST20,ST2K,
- true, false,
- p2mymin,
- &(priori2[0]), &(prioro2[0]), &(posti2[0])
- );
-
- //interleave soft info 2 --> 1
- for(int k=0;k<blocklength;k++) {
- int ki = INTERLEAVER.INTER()[k];
- //for(int i=0;i<FSMi.I();i++) {
- //ipriori[ki*FSMi.I()+i]=oposto[k*FSMi.I()+i];
- //}
- memcpy(&(priori1[ki*FSM1.I()]),&(posti2[k*FSM2.I()]),FSM1.I()*sizeof(float));
- }
-
- } // end iterations
-
- // generate hard decisions
- for(int k=0;k<blocklength;k++) {
- for(int i=0;i<FSM1.I();i++)
- posti1[k*FSM1.I()+i] = (*p2mymin)(priori1[k*FSM1.I()+i],posti1[k*FSM1.I()+i]);
- float min=INF;
- int mini=0;
- for(int i=0;i<FSM1.I();i++) {
- if(posti1[k*FSM1.I()+i]<min) {
- min=posti1[k*FSM1.I()+i];
- mini=i;
- }
- }
- data[k]=(To)mini;
- //std::cout << data[k] << ", "<< std::endl;
- }
- //std::cout << std::endl;
-
-}
-
-
-template
-void pccc_decoder_combined(
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const float *observations, unsigned char *data
-);
-
-
-template
-void pccc_decoder_combined(
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const float *observations, short *data
-);
-
-
-template
-void pccc_decoder_combined(
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const float *observations, int *data
-);
-
-
-template
-void pccc_decoder_combined(
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<gr_complex> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const gr_complex *observations, unsigned char *data
-);
-
-
-template
-void pccc_decoder_combined(
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<gr_complex> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const gr_complex *observations, short *data
-);
-
-
-template
-void pccc_decoder_combined(
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<gr_complex> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const gr_complex *observations, int *data
-);
diff --git a/gr-trellis/src/lib/core_algorithms.h b/gr-trellis/src/lib/core_algorithms.h
deleted file mode 100644
index 4efcc91235..0000000000
--- a/gr-trellis/src/lib/core_algorithms.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_CORE_ALGORITHMS_H
-#define INCLUDED_CORE_ALGORITHMS_H
-
-#include <cmath>
-#include <vector>
-//#include <gr_complex.h>
-#include "digital/metric_type.h"
-#include "fsm.h"
-#include "interleaver.h"
-
-
-float min(float a, float b);
-float min_star(float a, float b);
-
-template <class T>
-void viterbi_algorithm(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- const float *in, T *out
-);
-
-template <class Ti, class To>
-void viterbi_algorithm_combined(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<Ti> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const Ti *in, To *out
-);
-
-
-
-void siso_algorithm(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- bool POSTI, bool POSTO,
- float (*p2mymin)(float,float),
- const float *priori, const float *prioro, float *post
-);
-
-
-template <class T>
-void siso_algorithm_combined(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- bool POSTI, bool POSTO,
- float (*p2mymin)(float,float),
- int D,
- const std::vector<T> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const float *priori, const T *observations, float *post
-);
-
-
-template<class T>
-void sccc_decoder(
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- const float *iprioro, T *data
-);
-
-
-template<class Ti, class To>
-void sccc_decoder_combined(
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<Ti> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const Ti *observations, To *data
-);
-
-template<class T>
-void pccc_decoder(
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- const float *cprioro, T *data
-);
-
-template<class Ti, class To>
-void pccc_decoder_combined(
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER, int blocklength, int iterations,
- float (*p2mymin)(float,float),
- int D, const std::vector<Ti> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling,
- const Ti *observations, To *data
-);
-
-
-
-
-#endif
diff --git a/gr-trellis/src/lib/fsm.cc b/gr-trellis/src/lib/fsm.cc
deleted file mode 100644
index fb2b4d2c9f..0000000000
--- a/gr-trellis/src/lib/fsm.cc
+++ /dev/null
@@ -1,548 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2002 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <cstdio>
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <stdexcept>
-#include <cmath>
-#include <stdlib.h>
-#include "base.h"
-#include "fsm.h"
-
-
-fsm::fsm()
-{
- d_I=0;
- d_S=0;
- d_O=0;
- d_NS.resize(0);
- d_OS.resize(0);
- d_PS.resize(0);
- d_PI.resize(0);
- d_TMi.resize(0);
- d_TMl.resize(0);
-}
-
-fsm::fsm(const fsm &FSM)
-{
- d_I=FSM.I();
- d_S=FSM.S();
- d_O=FSM.O();
- d_NS=FSM.NS();
- d_OS=FSM.OS();
- d_PS=FSM.PS(); // is this going to make a deep copy?
- d_PI=FSM.PI();
- d_TMi=FSM.TMi();
- d_TMl=FSM.TMl();
-}
-
-fsm::fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS)
-{
- d_I=I;
- d_S=S;
- d_O=O;
- d_NS=NS;
- d_OS=OS;
-
- generate_PS_PI();
- generate_TM();
-}
-
-//######################################################################
-//# Read an FSM specification from a file.
-//# Format (hopefully will become more flexible in the future...):
-//# I S O (in the first line)
-//# blank line
-//# Next state matrix (S lines, each with I integers separated by spaces)
-//# blank line
-//# output symbol matrix (S lines, each with I integers separated by spaces)
-//# optional comments
-//######################################################################
-fsm::fsm(const char *name)
-{
- FILE *fsmfile;
-
- if((fsmfile=fopen(name,"r"))==NULL)
- throw std::runtime_error ("fsm::fsm(const char *name): file open error\n");
- //printf("file open error in fsm()\n");
-
- if(fscanf(fsmfile,"%d %d %d\n",&d_I,&d_S,&d_O) == EOF) {
- if(ferror(fsmfile) != 0)
- throw std::runtime_error ("fsm::fsm(const char *name): file read error\n");
- }
-
- d_NS.resize(d_I*d_S);
- d_OS.resize(d_I*d_S);
-
- for(int i=0;i<d_S;i++) {
- for(int j=0;j<d_I;j++) {
- if(fscanf(fsmfile,"%d",&(d_NS[i*d_I+j])) == EOF) {
- if(ferror(fsmfile) != 0)
- throw std::runtime_error ("fsm::fsm(const char *name): file read error\n");
- }
- }
- }
- for(int i=0;i<d_S;i++) {
- for(int j=0;j<d_I;j++) {
- if(fscanf(fsmfile,"%d",&(d_OS[i*d_I+j])) == EOF) {
- if(ferror(fsmfile) != 0)
- throw std::runtime_error ("fsm::fsm(const char *name): file read error\n");
- }
- }
- }
-
- fclose(fsmfile);
-
- generate_PS_PI();
- generate_TM();
-}
-
-
-
-//######################################################################
-//# Automatically generate the FSM from the generator matrix
-//# of a (n,k) binary convolutional code
-//######################################################################
-fsm::fsm(int k, int n, const std::vector<int> &G)
-{
-
- // calculate maximum memory requirements for each input stream
- std::vector<int> max_mem_x(k,-1);
- int max_mem = -1;
- for(int i=0;i<k;i++) {
- for(int j=0;j<n;j++) {
- int mem = -1;
- if(G[i*n+j]!=0)
- mem=(int)(log(double(G[i*n+j]))/log(2.0));
- if(mem>max_mem_x[i])
- max_mem_x[i]=mem;
- if(mem>max_mem)
- max_mem=mem;
- }
- }
-
-//printf("max_mem_x\n");
-//for(int j=0;j<max_mem_x.size();j++) printf("%d ",max_mem_x[j]); printf("\n");
-
- // calculate total memory requirements to set S
- int sum_max_mem = 0;
- for(int i=0;i<k;i++)
- sum_max_mem += max_mem_x[i];
-
-//printf("sum_max_mem = %d\n",sum_max_mem);
-
- d_I=1<<k;
- d_S=1<<sum_max_mem;
- d_O=1<<n;
-
- // binary representation of the G matrix
- std::vector<std::vector<int> > Gb(k*n);
- for(int j=0;j<k*n;j++) {
- Gb[j].resize(max_mem+1);
- dec2base(G[j],2,Gb[j]);
-//printf("Gb\n");
-//for(int m=0;m<Gb[j].size();m++) printf("%d ",Gb[j][m]); printf("\n");
- }
-
- // alphabet size of each shift register
- std::vector<int> bases_x(k);
- for(int j=0;j<k ;j++)
- bases_x[j] = 1 << max_mem_x[j];
-//printf("bases_x\n");
-//for(int j=0;j<max_mem_x.size();j++) printf("%d ",max_mem_x[j]); printf("\n");
-
- d_NS.resize(d_I*d_S);
- d_OS.resize(d_I*d_S);
-
- std::vector<int> sx(k);
- std::vector<int> nsx(k);
- std::vector<int> tx(k);
- std::vector<std::vector<int> > tb(k);
- for(int j=0;j<k;j++)
- tb[j].resize(max_mem+1);
- std::vector<int> inb(k);
- std::vector<int> outb(n);
-
-
- for(int s=0;s<d_S;s++) {
- dec2bases(s,bases_x,sx); // split s into k values, each representing one of the k shift registers
-//printf("state = %d \nstates = ",s);
-//for(int j=0;j<sx.size();j++) printf("%d ",sx[j]); printf("\n");
- for(int i=0;i<d_I;i++) {
- dec2base(i,2,inb); // input in binary
-//printf("input = %d \ninputs = ",i);
-//for(int j=0;j<inb.size();j++) printf("%d ",inb[j]); printf("\n");
-
- // evaluate next state
- for(int j=0;j<k;j++)
- nsx[j] = (inb[j]*bases_x[j]+sx[j])/2; // next state (for each shift register) MSB first
- d_NS[s*d_I+i]=bases2dec(nsx,bases_x); // collect all values into the new state
-
- // evaluate transitions
- for(int j=0;j<k;j++)
- tx[j] = inb[j]*bases_x[j]+sx[j]; // transition (for each shift register)MSB first
- for(int j=0;j<k;j++) {
- dec2base(tx[j],2,tb[j]); // transition in binary
-//printf("transition = %d \ntransitions = ",tx[j]);
-//for(int m=0;m<tb[j].size();m++) printf("%d ",tb[j][m]); printf("\n");
- }
-
- // evaluate outputs
- for(int nn=0;nn<n;nn++) {
- outb[nn] = 0;
- for(int j=0;j<k;j++) {
- for(int m=0;m<max_mem+1;m++)
- outb[nn] = (outb[nn] + Gb[j*n+nn][m]*tb[j][m]) % 2; // careful: polynomial 1+D ir represented as 110, not as 011
-//printf("output %d equals %d\n",nn,outb[nn]);
- }
- }
- d_OS[s*d_I+i] = base2dec(outb,2);
- }
- }
-
- generate_PS_PI();
- generate_TM();
-}
-
-
-
-
-//######################################################################
-//# Automatically generate an FSM specification describing the
-//# ISI for a channel
-//# of length ch_length and a modulation of size mod_size
-//######################################################################
-fsm::fsm(int mod_size, int ch_length)
-{
- d_I=mod_size;
- d_S=(int) (pow(1.0*d_I,1.0*ch_length-1)+0.5);
- d_O=d_S*d_I;
-
- d_NS.resize(d_I*d_S);
- d_OS.resize(d_I*d_S);
-
- for(int s=0;s<d_S;s++) {
- for(int i=0;i<d_I;i++) {
- int t=i*d_S+s;
- d_NS[s*d_I+i] = t/d_I;
- d_OS[s*d_I+i] = t;
- }
- }
-
- generate_PS_PI();
- generate_TM();
-}
-
-
-
-
-//######################################################################
-//# Automatically generate an FSM specification describing the
-//# the trellis for a CPM with h=K/P (relatively prime),
-//# alphabet size M, and frequency pulse duration L symbols
-//#
-//# This FSM is based on the paper by B. Rimoldi
-//# "A decomposition approach to CPM", IEEE Trans. Info Theory, March 1988
-//# See also my own notes at http://www.eecs.umich.edu/~anastas/docs/cpm.pdf
-//######################################################################
-fsm::fsm(int P, int M, int L)
-{
- d_I=M;
- d_S=(int)(pow(1.0*M,1.0*L-1)+0.5)*P;
- d_O=(int)(pow(1.0*M,1.0*L)+0.5)*P;
-
- d_NS.resize(d_I*d_S);
- d_OS.resize(d_I*d_S);
- int nv;
- for(int s=0;s<d_S;s++) {
- for(int i=0;i<d_I;i++) {
- int s1=s/P;
- int v=s%P;
- int ns1= (i*(int)(pow(1.0*M,1.0*(L-1))+0.5)+s1)/M;
- if (L==1)
- nv=(i+v)%P;
- else
- nv=(s1%M+v)%P;
- d_NS[s*d_I+i] = ns1*P+nv;
- d_OS[s*d_I+i] = i*d_S+s;
- }
- }
-
- generate_PS_PI();
- generate_TM();
-}
-
-
-
-
-
-
-
-
-
-
-//######################################################################
-//# Automatically generate an FSM specification describing the
-//# the joint trellis of fsm1 and fsm2
-//######################################################################
-fsm::fsm(const fsm &FSM1, const fsm &FSM2)
-{
- d_I=FSM1.I()*FSM2.I();
- d_S=FSM1.S()*FSM2.S();
- d_O=FSM1.O()*FSM2.O();
-
- d_NS.resize(d_I*d_S);
- d_OS.resize(d_I*d_S);
-
- for(int s=0;s<d_S;s++) {
- for(int i=0;i<d_I;i++) {
- int s1=s/FSM2.S();
- int s2=s%FSM2.S();
- int i1=i/FSM2.I();
- int i2=i%FSM2.I();
- d_NS[s*d_I+i] = FSM1.NS()[s1 * FSM1.I() + i1] * FSM2.S() + FSM2.NS()[s2 * FSM2.I() + i2];
- d_OS[s*d_I+i] = FSM1.OS()[s1 * FSM1.I() + i1] * FSM2.O() + FSM2.OS()[s2 * FSM2.I() + i2];
- }
- }
-
- generate_PS_PI();
- generate_TM();
-}
-
-
-
-
-//######################################################################
-//# Generate a new FSM representing n stages through the original FSM
-//# AKA radix-n FSM
-//######################################################################
-fsm::fsm(const fsm &FSM, int n)
-{
- d_I=(int) (pow(1.0*FSM.I(),1.0*n)+0.5);
- d_S=FSM.S();
- d_O=(int) (pow(1.0*FSM.O(),1.0*n)+0.5);
-
- d_NS.resize(d_I*d_S);
- d_OS.resize(d_I*d_S);
-
- for(int s=0;s<d_S;s++ ) {
- for(int i=0;i<d_I;i++ ) {
- std::vector<int> ii(n);
- dec2base(i,FSM.I(),ii);
- std::vector<int> oo(n);
- int ns=s;
- for(int k=0;k<n;k++) {
- oo[k]=FSM.OS()[ns*FSM.I()+ii[k]];
- ns=FSM.NS()[ns*FSM.I()+ii[k]];
- }
- d_NS[s*d_I+i]=ns;
- d_OS[s*d_I+i]=base2dec(oo,FSM.O());
- }
- }
-
- generate_PS_PI();
- generate_TM();
-}
-
-
-
-
-
-
-
-
-
-//######################################################################
-//# generate the PS and PI tables for later use
-//######################################################################
-void fsm::generate_PS_PI()
-{
- d_PS.resize(d_S);
- d_PI.resize(d_S);
-
- for(int i=0;i<d_S;i++) {
- d_PS[i].resize(d_I*d_S); // max possible size
- d_PI[i].resize(d_I*d_S);
- int j=0;
- for(int ii=0;ii<d_S;ii++) for(int jj=0;jj<d_I;jj++) {
- if(d_NS[ii*d_I+jj]!=i) continue;
- d_PS[i][j]=ii;
- d_PI[i][j]=jj;
- j++;
- }
- d_PS[i].resize(j);
- d_PI[i].resize(j);
- }
-}
-
-
-//######################################################################
-//# generate the termination matrices TMl and TMi for later use
-//######################################################################
-void fsm::generate_TM()
-{
- d_TMi.resize(d_S*d_S);
- d_TMl.resize(d_S*d_S);
-
- for(int i=0;i<d_S*d_S;i++) {
- d_TMi[i] = -1; // no meaning
- d_TMl[i] = d_S; //infinity: you need at most S-1 steps
- if (i/d_S == i%d_S)
- d_TMl[i] = 0;
- }
-
- for(int s=0;s<d_S;s++) {
- bool done = false;
- int attempts = 0;
- while (done == false && attempts < d_S-1) {
- done = find_es(s);
- attempts ++;
- }
- if (done == false && d_S > 1) {
- //throw std::runtime_error ("fsm::generate_TM(): FSM appears to be disconnected\n");
- printf("fsm::generate_TM(): FSM appears to be disconnected\n");
- printf("state %d cannot be reached from all other states\n",s);
- }
- }
-}
-
-
-// find a path from any state to the ending state "es"
-bool fsm::find_es(int es)
-{
- bool done = true;
- for(int s=0;s<d_S;s++) {
- if(d_TMl[s*d_S+es] < d_S)
- continue;
- int minl=d_S;
- int mini=-1;
- for(int i=0;i<d_I;i++) {
- if( 1 + d_TMl[d_NS[s*d_I+i]*d_S+es] < minl) {
- minl = 1 + d_TMl[d_NS[s*d_I+i]*d_S+es];
- mini = i;
- }
- }
- if (mini != -1) {
- d_TMl[s*d_S+es]=minl;
- d_TMi[s*d_S+es]=mini;
- }
- else
- done = false;
- }
- return done;
-}
-
-
-
-
-
-//######################################################################
-//# generate trellis representation of FSM as an SVG file
-//######################################################################
-void fsm::write_trellis_svg( std::string filename ,int number_stages)
-{
- std::ofstream trellis_fname (filename.c_str());
- if (!trellis_fname) {std::cout << "file not found " << std::endl ; exit(-1);}
- const int TRELLIS_Y_OFFSET = 30;
- const int TRELLIS_X_OFFSET = 20;
- const int STAGE_LABEL_Y_OFFSET = 25;
- const int STAGE_LABEL_X_OFFSET = 20;
- const int STATE_LABEL_Y_OFFSET = 30;
- const int STATE_LABEL_X_OFFSET = 5;
- const int STAGE_STATE_OFFSETS = 10;
-// std::cout << "################## BEGIN SVG TRELLIS PIC #####################" << std::endl;
- trellis_fname << "<svg viewBox = \"0 0 200 200\" version = \"1.1\">" << std::endl;
-
- for( int stage_num = 0;stage_num < number_stages;stage_num ++){
- // draw states
- for ( int state_num = 0;state_num < d_S ; state_num ++ ) {
- trellis_fname << "<circle cx = \"" << stage_num * STAGE_STATE_OFFSETS + TRELLIS_X_OFFSET <<
- "\" cy = \"" << state_num * STAGE_STATE_OFFSETS + TRELLIS_Y_OFFSET << "\" r = \"1\"/>" << std::endl;
- //draw branches
- if(stage_num != number_stages-1){
- for( int branch_num = 0;branch_num < d_I; branch_num++){
- trellis_fname << "<line x1 =\"" << STAGE_STATE_OFFSETS * stage_num+ TRELLIS_X_OFFSET << "\" ";
- trellis_fname << "y1 =\"" << state_num * STAGE_STATE_OFFSETS + TRELLIS_Y_OFFSET<< "\" ";
- trellis_fname << "x2 =\"" << STAGE_STATE_OFFSETS *stage_num + STAGE_STATE_OFFSETS+ TRELLIS_X_OFFSET << "\" ";
- trellis_fname << "y2 =\"" << d_NS[d_I * state_num + branch_num] * STAGE_STATE_OFFSETS + TRELLIS_Y_OFFSET << "\" ";
- trellis_fname << " stroke-dasharray = \"3," << branch_num << "\" ";
- trellis_fname << " stroke = \"black\" stroke-width = \"0.3\"/>" << std::endl;
- }
- }
- }
- }
- // label the stages
- trellis_fname << "<g font-size = \"4\" font= \"times\" fill = \"black\">" << std::endl;
- for( int stage_num = 0;stage_num < number_stages ;stage_num ++){
- trellis_fname << "<text x = \"" << stage_num * STAGE_STATE_OFFSETS + STAGE_LABEL_X_OFFSET <<
- "\" y = \"" << STAGE_LABEL_Y_OFFSET << "\" >" << std::endl;
- trellis_fname << stage_num << std::endl;
- trellis_fname << "</text>" << std::endl;
- }
- trellis_fname << "</g>" << std::endl;
-
- // label the states
- trellis_fname << "<g font-size = \"4\" font= \"times\" fill = \"black\">" << std::endl;
- for( int state_num = 0;state_num < d_S ; state_num ++){
- trellis_fname << "<text y = \"" << state_num * STAGE_STATE_OFFSETS + STATE_LABEL_Y_OFFSET <<
- "\" x = \"" << STATE_LABEL_X_OFFSET << "\" >" << std::endl;
- trellis_fname << state_num << std::endl;
- trellis_fname << "</text>" << std::endl;
- }
- trellis_fname << "</g>" << std::endl;
-
-
- trellis_fname << "</svg>" << std::endl;
-// std::cout << "################## END SVG TRELLIS PIC ##################### " << std::endl;
- trellis_fname.close();
-}
-
-
-
-
-
-
-//######################################################################
-//# Write trellis specification to a text file,
-//# in the same format used when reading FSM files
-//######################################################################
-void fsm::write_fsm_txt(std::string filename)
-{
- std::ofstream trellis_fname (filename.c_str());
- if (!trellis_fname) {std::cout << "file not found " << std::endl ; exit(-1);}
- trellis_fname << d_I << ' ' << d_S << ' ' << d_O << std::endl;
- trellis_fname << std::endl;
- for(int i=0;i<d_S;i++) {
- for(int j=0;j<d_I;j++) trellis_fname << d_NS[i*d_I+j] << ' ';
- trellis_fname << std::endl;
- }
- trellis_fname << std::endl;
- for(int i=0;i<d_S;i++) {
- for(int j=0;j<d_I;j++) trellis_fname << d_OS[i*d_I+j] << ' ';
- trellis_fname << std::endl;
- }
- trellis_fname << std::endl;
- trellis_fname.close();
-}
-
diff --git a/gr-trellis/src/lib/fsm.h b/gr-trellis/src/lib/fsm.h
deleted file mode 100644
index 47e467898a..0000000000
--- a/gr-trellis/src/lib/fsm.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2002,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_TRELLIS_FSM_H
-#define INCLUDED_TRELLIS_FSM_H
-
-#include <trellis_api.h>
-#include <vector>
-#include <iosfwd>
-
-/*!
- * \brief Finite State Machine Specification class.
- *
- * An instance of this class represents a finite state machine specification (FSMS)
- * rather than the FSM itself. It particular the state of the FSM
- * is not stored within an instance of this class.
- */
-class TRELLIS_API fsm {
-private:
- // Input alphabet cardinality.
- int d_I;
- // Number of states.
- int d_S;
- // Output alphabet cardinality.
- int d_O;
- // NS means Next State.
- // next_state = d_NS[current_state * d_I + input_symbol]
- std::vector<int> d_NS;
- // OS means Output Symbol.
- // output_symbol = d_OS[current_state * d_I + input_symbol]
- std::vector<int> d_OS;
- // PS means Previous State.
- std::vector< std::vector<int> > d_PS;
- // PI means Previous Input Symbol.
- // d_PS[current_state][k] and d_PI[current_state][k], is a pair of the form
- // (previous_state, previous_input_symbol) that could have produced the
- // current state.
- std::vector< std::vector<int> > d_PI;
- // TM means Termination matrix.
- // d_TMl[s*d_S+es] is the shortest number of steps to get from state s to
- // state es.
- std::vector<int> d_TMl;
- // d_TMi[s*d_S+es] is the input symbol required to set off on the shortest
- // path from state s to es.
- std::vector<int> d_TMi;
- void generate_PS_PI ();
- void generate_TM ();
- bool find_es(int es);
-public:
- /*!
- * \brief Constructor to create an uninitialized FSMS.
- */
- fsm();
- /*!
- * \brief Constructor to copy an FSMS.
- */
- fsm(const fsm &FSM);
- /*!
- * \brief Constructor to to create an FSMS.
- *
- * \param I The number of possible input symbols.
- * \param S The number of possible FSM states.
- * \param O The number of possible output symbols.
- * \param NS A mapping from (current state, input symbol) to next state.
- * next_state = NS[current_state * I + input_symbol]
- * \param OS A mapping from (current state, input symbol) to output symbol.
- * output_symbol = OS[current_state * I + input_symbol]
- *
- */
- fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS);
- /*!
- * \brief Constructor to create an FSMS from file contents.
- *
- * \param name filename
- *
- */
- fsm(const char *name);
- /*!
- * \brief Creates an FSMS from the generator matrix of a (n, k) binary convolutional code.
- *
- * \param k ???
- * \param n ???
- * \param G ???
- *
- */
- fsm(int k, int n, const std::vector<int> &G);
- /*!
- * \brief Creates an FSMS describing ISI.
- *
- * \param mod_size modulation size
- * \param ch_length channel length
- *
- */
- fsm(int mod_size, int ch_length);
- /*!
- * \brief Creates an FSMS describing the trellis for a CPM.
- *
- * \param P ???? h=K/P (relatively prime)
- * \param M alphabet size
- * \param L pulse duration
- *
- * This FSM is based on the paper by B. Rimoldi
- * "A decomposition approach to CPM", IEEE Trans. Info Theory, March 1988
- * See also my own notes at http://www.eecs.umich.edu/~anastas/docs/cpm.pdf
- */
- fsm(int P, int M, int L);
- /*!
- * \brief Creates an FSMS describing the joint trellis of two FSMs.
- *
- * \param FSM1 first FSMS
- * \param FSM2 second FSMS
- */
- fsm(const fsm &FSM1, const fsm &FSM2);
- /*!
- * \brief Creates an FSMS representing n stages through the originial FSM (AKA radix-n FSM).
- *
- * \param FSM Original FSMs
- * \param n Number of stages.
- */
- fsm(const fsm &FSM, int n);
- int I () const { return d_I; }
- int S () const { return d_S; }
- int O () const { return d_O; }
- const std::vector<int> & NS () const { return d_NS; }
- const std::vector<int> & OS () const { return d_OS; }
- const std::vector< std::vector<int> > & PS () const { return d_PS; }
- const std::vector< std::vector<int> > & PI () const { return d_PI; }
- const std::vector<int> & TMi () const { return d_TMi; }
- const std::vector<int> & TMl () const { return d_TMl; }
- /*!
- * \brief Creates an svg image of the trellis representation.
- *
- * \param filename filename
- * \param number_stages ????
- *
- */
- void write_trellis_svg(std::string filename ,int number_stages);
- /*!
- * \brief Write the FSMS to a file.
- *
- * \param filename filename
- *
- */
- void write_fsm_txt(std::string filename);
-};
-
-#endif
diff --git a/gr-trellis/src/lib/fsm.i b/gr-trellis/src/lib/fsm.i
deleted file mode 100644
index 1e9c7ad8f5..0000000000
--- a/gr-trellis/src/lib/fsm.i
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2002 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-class fsm {
-private:
- int d_I;
- int d_S;
- int d_O;
- std::vector<int> d_NS;
- std::vector<int> d_OS;
- std::vector< std::vector<int> > d_PS;
- std::vector< std::vector<int> > d_PI;
- std::vector<int> d_TMi;
- std::vector<int> d_TMl;
- void generate_PS_PI ();
- void generate_TM ();
-public:
- fsm();
- fsm(const fsm &FSM);
- fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS);
- fsm(const char *name);
- fsm(int k, int n, const std::vector<int> &G);
- fsm(int mod_size, int ch_length);
- fsm(int P, int M, int L);
- fsm(const fsm &FSM1, const fsm &FSM2);
- fsm(const fsm &FSM, int n);
- int I () const { return d_I; }
- int S () const { return d_S; }
- int O () const { return d_O; }
- const std::vector<int> & NS () const { return d_NS; }
- const std::vector<int> & OS () const { return d_OS; }
- // disable these accessors until we find out how to swig them
- //const std::vector< std::vector<int> > & PS () const { return d_PS; }
- //const std::vector< std::vector<int> > & PI () const { return d_PI; }
- const std::vector<int> & TMi () const { return d_TMi; }
- const std::vector<int> & TMl () const { return d_TMl; }
- void fsm::write_trellis_svg(std::string filename ,int number_stages);
- void fsm::write_fsm_txt(std::string filename);
-};
-
diff --git a/gr-trellis/src/lib/generate_trellis.py b/gr-trellis/src/lib/generate_trellis.py
deleted file mode 100644
index 60a81f77a8..0000000000
--- a/gr-trellis/src/lib/generate_trellis.py
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2006,2007 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from build_utils import expand_template, copyright, open_and_log_name
-from build_utils_codes import *
-import re
-
-# regular blocks
-
-other_roots = [
- 'trellis_encoder_XX',
- 'trellis_sccc_encoder_XX',
- 'trellis_pccc_encoder_XX',
- 'trellis_metrics_X',
- 'trellis_viterbi_X',
- 'trellis_viterbi_combined_XX',
- 'trellis_sccc_decoder_X',
- 'trellis_sccc_decoder_combined_XX',
- 'trellis_pccc_decoder_X',
- 'trellis_pccc_decoder_combined_XX',
- ]
-
-other_signatures = (
- ['bb','bs','bi','ss','si','ii'],
- ['bb','bs','bi','ss','si','ii'],
- ['bb','bs','bi','ss','si','ii'],
- ['s','i','f','c'],
- ['b','s','i'],
- ['sb','ss','si','ib','is','ii','fb','fs','fi','cb','cs','ci'],
- ['b','s','i'],
- ['fb','fs','fi','cb','cs','ci'],
- ['b','s','i'],
- ['fb','fs','fi','cb','cs','ci'],
- )
-
-
-def is_byte (code3):
- if i_code (code3) == 'b' or o_code (code3) == 'b':
- return '1'
- else:
- return '0'
-
-
-def is_short (code3):
- if i_code (code3) == 's' or o_code (code3) == 's':
- return '1'
- else:
- return '0'
-
-
-def is_int (code3):
- if i_code (code3) == 'i' or o_code (code3) == 'i':
- return '1'
- else:
- return '0'
-
-
-def is_float (code3):
- if i_code (code3) == 'f' or o_code (code3) == 'f':
- return '1'
- else:
- return '0'
-
-
-def is_complex (code3):
- if i_code (code3) == 'c' or o_code (code3) == 'c':
- return '1'
- else:
- return '0'
-
-
-def standard_dict (name, code3):
- d = {}
- d['NAME'] = name
- d['GUARD_NAME'] = 'INCLUDED_%s_H' % name.upper ()
- d['BASE_NAME'] = re.sub ('^trellis_', '', name)
- d['SPTR_NAME'] = '%s_sptr' % name
- d['WARNING'] = 'WARNING: this file is machine generated. Edits will be over written'
- d['COPYRIGHT'] = copyright
- d['TYPE'] = i_type (code3)
- d['I_TYPE'] = i_type (code3)
- d['O_TYPE'] = o_type (code3)
- d['TAP_TYPE'] = tap_type (code3)
- d['IS_BYTE'] = is_byte (code3)
- d['IS_SHORT'] = is_short (code3)
- d['IS_INT'] = is_int (code3)
- d['IS_FLOAT'] = is_float (code3)
- d['IS_COMPLEX'] = is_complex (code3)
- return d
-
-
-def expand_h_cc_i (root, sig):
- # root looks like 'gr_vector_sink_X'
- name = re.sub ('X+', sig, root)
- d = standard_dict (name, sig)
- expand_template (d, root + '.h.t')
- expand_template (d, root + '.cc.t')
- expand_template (d, root + '.i.t')
-
-
-def generate ():
- i=0
- for r in other_roots :
- for s in other_signatures[i]:
- expand_h_cc_i (r, s)
- i=i+1
-
-
-if __name__ == '__main__':
- generate ()
diff --git a/gr-trellis/src/lib/interleaver.cc b/gr-trellis/src/lib/interleaver.cc
deleted file mode 100644
index 740f33ab39..0000000000
--- a/gr-trellis/src/lib/interleaver.cc
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2002 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <cstdlib>
-#include <cstdio>
-#include <iostream>
-#include <string>
-#include <fstream>
-#include <stdexcept>
-#include <cmath>
-#include "quicksort_index.h"
-#include "interleaver.h"
-
-
-
-
-interleaver::interleaver()
-{
- d_K=0;
- d_INTER.resize(0);
- d_DEINTER.resize(0);
-}
-
-interleaver::interleaver(const interleaver &INTERLEAVER)
-{
- d_K=INTERLEAVER.K();
- d_INTER=INTERLEAVER.INTER();
- d_DEINTER=INTERLEAVER.DEINTER();
-}
-
-interleaver::interleaver(int K, const std::vector<int> &INTER)
-{
- d_K=K;
- d_INTER=INTER;
- d_DEINTER.resize(d_K);
-
- // generate DEINTER table
- for(int i=0;i<d_K;i++) {
- d_DEINTER[d_INTER[i]]=i;
- }
-}
-
-//######################################################################
-//# Read an INTERLEAVER specification from a file.
-//# Format (hopefully will become more flexible in the future...):
-//# K
-//# blank line
-//# list of space separated K integers from 0 to K-1 in appropriate order
-//# optional comments
-//######################################################################
-interleaver::interleaver(const char *name)
-{
- FILE *interleaverfile;
-
- if((interleaverfile=fopen(name,"r"))==NULL)
- throw std::runtime_error ("file open error in interleaver()");
- //printf("file open error in interleaver()\n");
-
- if(fscanf(interleaverfile,"%d\n",&d_K) == EOF) {
- if(ferror(interleaverfile) != 0)
- throw std::runtime_error ("interleaver::interleaver(const char *name): file read error\n");
- }
-
- d_INTER.resize(d_K);
- d_DEINTER.resize(d_K);
-
- for(int i=0;i<d_K;i++) {
- if(fscanf(interleaverfile,"%d",&(d_INTER[i])) == EOF) {
- if(ferror(interleaverfile) != 0)
- throw std::runtime_error ("interleaver::interleaver(const char *name): file read error\n");
- }
- }
-
- // generate DEINTER table
- for(int i=0;i<d_K;i++) {
- d_DEINTER[d_INTER[i]]=i;
- }
-}
-
-//######################################################################
-//# Generate a random interleaver
-//######################################################################
-interleaver::interleaver(int K, int seed)
-{
- d_K=K;
- d_INTER.resize(d_K);
- d_DEINTER.resize(d_K);
-
- if(seed>=0) srand((unsigned int)seed);
- std::vector<int> tmp(d_K);
- for(int i=0;i<d_K;i++) {
- d_INTER[i]=i;
- tmp[i] = rand();
- }
- quicksort_index <int> (tmp,d_INTER,0,d_K-1);
-
- // generate DEINTER table
- for(int i=0;i<d_K;i++) {
- d_DEINTER[d_INTER[i]]=i;
- }
-}
-
-
-
-
-
-//######################################################################
-//# Write an INTERLEAVER specification to a file.
-//# Format
-//# K
-//# blank line
-//# list of space separated K integers from 0 to K-1 in appropriate order
-//# optional comments
-//######################################################################
-void interleaver::write_interleaver_txt(std::string filename)
-{
- std::ofstream interleaver_fname (filename.c_str());
- if (!interleaver_fname) {std::cout << "file not found " << std::endl ; exit(-1);}
- interleaver_fname << d_K << std::endl;
- interleaver_fname << std::endl;
- for(int i=0;i<d_K;i++)
- interleaver_fname << d_INTER[i] << ' ';
- interleaver_fname << std::endl;
- interleaver_fname.close();
-}
diff --git a/gr-trellis/src/lib/interleaver.i b/gr-trellis/src/lib/interleaver.i
deleted file mode 100644
index bb9078b1bd..0000000000
--- a/gr-trellis/src/lib/interleaver.i
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2002 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-class interleaver {
-private:
- int d_K;
- std::vector<int> d_INTER;
- std::vector<int> d_DEINTER;
-public:
- interleaver();
- interleaver(const interleaver & INTERLEAVER);
- interleaver(int K, const std::vector<int> & INTER);
- interleaver(const char *name);
- interleaver(int K, int seed);
- int K () const { return d_K; }
- const std::vector<int> & INTER () const { return d_INTER; }
- const std::vector<int> & DEINTER () const { return d_DEINTER; }
- void write_interleaver_txt(std::string filename);
-};
diff --git a/gr-trellis/src/lib/quicksort_index.cc b/gr-trellis/src/lib/quicksort_index.cc
deleted file mode 100644
index cf37e862e2..0000000000
--- a/gr-trellis/src/lib/quicksort_index.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "quicksort_index.h"
-
-template <class T>
-void
-SWAP
-(T & a, T & b)
-{
- T temp = a;
- a = b;
- b = temp;
-}
-
-template <class T>
-void
-quicksort_index
-(std::vector<T> & p, std::vector<int> & index, int left, int right)
-{
- if (left < right) {
- int i = left;
- int j = right + 1;
- T pivot = p[left];
- do {
- do
- i++;
- while ((p[i] < pivot) && (i < right));
- do
- j--;
- while ((p[j] > pivot) && (j > left));
- if (i < j) {
- SWAP <T> (p[i],p[j]);
- SWAP <int> (index[i],index[j]);
- }
- } while (i < j);
- SWAP <T> (p[left], p[j]);
- SWAP <int> (index[left], index[j]);
- quicksort_index <T> (p,index, left, j-1);
- quicksort_index <T> (p,index, j+1, right);
- }
-}
-
-// instantiate an <int> version of the quicksort_index
-//template <int> void SWAP (int & a, int & b);
-template
-void
-quicksort_index<int>
-(std::vector<int> & p, std::vector<int> & index, int left, int right);
diff --git a/gr-trellis/src/lib/trellis.i b/gr-trellis/src/lib/trellis.i
deleted file mode 100644
index d0b3707d05..0000000000
--- a/gr-trellis/src/lib/trellis.i
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-%module(docstring="Generic coding/decoding.") trellis
-
-#define DIGITAL_API
-
-%include "gnuradio.i" // the common stuff
-
-//load generated python docstrings
-%include "trellis_swig_doc.i"
-
-%{
-#include "digital/constellation.h"
-#include "digital/metric_type.h"
-#include "fsm.h"
-#include "interleaver.h"
-#include "trellis_permutation.h"
-#include "trellis_siso_f.h"
-#include "trellis_siso_combined_f.h"
-#include "trellis_constellation_metrics_cf.h"
-%}
-
-%include "digital/constellation.h"
-%include "digital/metric_type.h"
-%include "constellation.i"
-
-// ----------------------------------------------------------------
-
-%include "fsm.i"
-%include "interleaver.i"
-%include "trellis_permutation.i"
-%include "trellis_siso_f.i"
-%include "trellis_siso_combined_f.i"
-
-%include "siso_type.h"
-
-%include "trellis_constellation_metrics_cf.i"
-
-%include "trellis_generated.i"
diff --git a/gr-trellis/src/lib/trellis_constellation_metrics_cf.cc b/gr-trellis/src/lib/trellis_constellation_metrics_cf.cc
deleted file mode 100644
index d7a7aba1d4..0000000000
--- a/gr-trellis/src/lib/trellis_constellation_metrics_cf.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <trellis_constellation_metrics_cf.h>
-#include <gr_io_signature.h>
-#include <assert.h>
-#include <stdexcept>
-#include <iostream>
-
-trellis_constellation_metrics_cf_sptr
-trellis_make_constellation_metrics_cf(constellation_sptr constellation,
- trellis_metric_type_t TYPE)
-{
- return gnuradio::get_initial_sptr
- (new trellis_constellation_metrics_cf(constellation, TYPE));
-}
-
-
-trellis_constellation_metrics_cf::trellis_constellation_metrics_cf(constellation_sptr constellation,
- trellis_metric_type_t TYPE)
- : gr_block ("constellation_metrics_cf",
- gr_make_io_signature (1, -1, sizeof (gr_complex)),
- gr_make_io_signature (1, -1, sizeof (float))),
- d_constellation (constellation),
- d_TYPE (TYPE),
- d_O (constellation->arity()),
- d_D (constellation->dimensionality())
-{
- set_relative_rate (1.0 * d_O / ((double) d_D));
- set_output_multiple ((int)d_O);
-}
-
-void
-trellis_constellation_metrics_cf::forecast(int noutput_items, gr_vector_int &ninput_items_required)
-{
- assert (noutput_items % d_O == 0);
- unsigned int input_required = d_D * noutput_items / d_O;
- unsigned int ninputs = ninput_items_required.size();
- for (unsigned int i = 0; i < ninputs; i++)
- ninput_items_required[i] = input_required;
-}
-
-
-
-int
-trellis_constellation_metrics_cf::general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
-
- assert (noutput_items % d_O == 0);
- assert (input_items.size() == output_items.size());
- unsigned int nstreams = input_items.size();
-
-for (unsigned int m=0;m<nstreams;m++) {
- const gr_complex *in = (gr_complex *) input_items[m];
- float *out = (float *) output_items[m];
-
- for (unsigned int i = 0; i < noutput_items / d_O ; i++){
- d_constellation->calc_metric(&(in[i*d_D]), &(out[i*d_O]), d_TYPE);
- }
-}
-
- consume_each (d_D * noutput_items / d_O);
- return noutput_items;
-}
diff --git a/gr-trellis/src/lib/trellis_constellation_metrics_cf.h b/gr-trellis/src/lib/trellis_constellation_metrics_cf.h
deleted file mode 100644
index 91ab30986b..0000000000
--- a/gr-trellis/src/lib/trellis_constellation_metrics_cf.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H
-#define INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H
-
-#include <trellis_api.h>
-#include <gr_block.h>
-#include <digital/constellation.h>
-#include <digital/metric_type.h>
-
-using namespace gr::digital;
-
-class trellis_constellation_metrics_cf;
-typedef boost::shared_ptr<trellis_constellation_metrics_cf> trellis_constellation_metrics_cf_sptr;
-
-TRELLIS_API trellis_constellation_metrics_cf_sptr
- trellis_make_constellation_metrics_cf(constellation_sptr constellation,
- trellis_metric_type_t TYPE);
-
-/*!
- * \brief Evaluate metrics for use by the Viterbi algorithm.
- * \ingroup coding_blk
- */
-class TRELLIS_API trellis_constellation_metrics_cf : public gr_block
-{
- public:
- void forecast(int noutput_items,
- gr_vector_int &ninput_items_required);
- int general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
- protected:
- trellis_constellation_metrics_cf(constellation_sptr constellation,
- trellis_metric_type_t TYPE);
-
- private:
- constellation_sptr d_constellation;
- trellis_metric_type_t d_TYPE;
- unsigned int d_O;
- unsigned int d_D;
- friend TRELLIS_API trellis_constellation_metrics_cf_sptr
- trellis_make_constellation_metrics_cf(constellation_sptr constellation,
- trellis_metric_type_t TYPE);
-
-};
-
-
-#endif
diff --git a/gr-trellis/src/lib/trellis_constellation_metrics_cf.i b/gr-trellis/src/lib/trellis_constellation_metrics_cf.i
deleted file mode 100644
index 13b11c0b06..0000000000
--- a/gr-trellis/src/lib/trellis_constellation_metrics_cf.i
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2011 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(trellis,constellation_metrics_cf);
-
-trellis_constellation_metrics_cf_sptr
-trellis_make_constellation_metrics_cf(gr::digital::constellation_sptr constellation,
- gr::digital::trellis_metric_type_t TYPE);
-
-class trellis_constellation_metrics_cf : public gr_block
-{
-};
diff --git a/gr-trellis/src/lib/trellis_encoder_XX.cc.t b/gr-trellis/src/lib/trellis_encoder_XX.cc.t
deleted file mode 100644
index dca92b08f3..0000000000
--- a/gr-trellis/src/lib/trellis_encoder_XX.cc.t
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME@.h>
-#include <gr_io_signature.h>
-#include <iostream>
-
-@SPTR_NAME@
-trellis_make_@BASE_NAME@ (const fsm &FSM, int ST)
-{
- return gnuradio::get_initial_sptr (new @NAME@ (FSM,ST));
-}
-
-@NAME@::@NAME@ (const fsm &FSM, int ST)
- : gr_sync_block ("@BASE_NAME@",
- gr_make_io_signature (1, -1, sizeof (@I_TYPE@)),
- gr_make_io_signature (1, -1, sizeof (@O_TYPE@))),
- d_FSM (FSM),
- d_ST (ST)
-{
-}
-
-
-
-int
-@NAME@::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- int ST_tmp=0;
-
- assert (input_items.size() == output_items.size());
- int nstreams = input_items.size();
-
- for (int m=0;m<nstreams;m++) {
- const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[m];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[m];
- ST_tmp = d_ST;
-
- // per stream processing
- for (int i = 0; i < noutput_items; i++){
- out[i] = (@O_TYPE@) d_FSM.OS()[ST_tmp*d_FSM.I()+in[i]]; // direction of time?
- ST_tmp = (int) d_FSM.NS()[ST_tmp*d_FSM.I()+in[i]];
- }
- // end per stream processing
- }
- d_ST = ST_tmp;
-
- return noutput_items;
-}
-
diff --git a/gr-trellis/src/lib/trellis_metrics_X.cc.t b/gr-trellis/src/lib/trellis_metrics_X.cc.t
deleted file mode 100644
index 756ac92a31..0000000000
--- a/gr-trellis/src/lib/trellis_metrics_X.cc.t
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME@.h>
-#include <gr_io_signature.h>
-#include <assert.h>
-#include <stdexcept>
-#include <iostream>
-
-
-@SPTR_NAME@
-trellis_make_@BASE_NAME@(int O, int D, const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE)
-{
- return gnuradio::get_initial_sptr(new @NAME@(O,D,TABLE,TYPE));
-}
-
-
-
-@NAME@::@NAME@(int O, int D, const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE)
- : gr_block("@BASE_NAME@",
- gr_make_io_signature(1, -1, sizeof (@I_TYPE@)),
- gr_make_io_signature(1, -1, sizeof (float))),
- d_O (O),
- d_D (D),
- d_TYPE (TYPE),
- d_TABLE (TABLE)
-{
- set_relative_rate (1.0 * d_O / ((double) d_D));
- set_output_multiple ((int)d_O);
-}
-
-void @NAME@::set_TABLE(const std::vector<@I_TYPE@> &table)
-{
- d_TABLE = table;
-}
-
-
-void
-@NAME@::forecast(int noutput_items, gr_vector_int &ninput_items_required)
-{
- assert (noutput_items % d_O == 0);
- int input_required = d_D * noutput_items / d_O;
- unsigned ninputs = ninput_items_required.size();
- for (unsigned int i = 0; i < ninputs; i++)
- ninput_items_required[i] = input_required;
-}
-
-
-
-int
-@NAME@::general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert (noutput_items % d_O == 0);
- assert (input_items.size() == output_items.size());
- int nstreams = input_items.size();
-
- for (int m=0;m<nstreams;m++) {
- const @I_TYPE@ *in = (@I_TYPE@ *) input_items[m];
- float *out = (float *) output_items[m];
-
- for(int i = 0; i < noutput_items / d_O ; i++) {
- calc_metric(d_O, d_D, d_TABLE,&(in[i*d_D]),&(out[i*d_O]), d_TYPE);
- }
- }
-
- consume_each(d_D * noutput_items / d_O);
- return noutput_items;
-}
diff --git a/gr-trellis/src/lib/trellis_metrics_X.h.t b/gr-trellis/src/lib/trellis_metrics_X.h.t
deleted file mode 100644
index 9a671bc121..0000000000
--- a/gr-trellis/src/lib/trellis_metrics_X.h.t
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <trellis_api.h>
-#include <gr_block.h>
-#include "calc_metric.h"
-
-class @NAME@;
-typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
-
-TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@(int O, int D, const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
-
-/*!
- * \brief Evaluate metrics for use by the Viterbi algorithm.
- * \ingroup coding_blk
- */
-class TRELLIS_API @NAME@ : public gr_block
-{
- int d_O;
- int d_D;
- gr::digital::trellis_metric_type_t d_TYPE;
- std::vector<@I_TYPE@> d_TABLE;
-
- friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@(int O, int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
- @NAME@(int O, int D, const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
-
-public:
- int O() const { return d_O; }
- int D() const { return d_D; }
- gr::digital::trellis_metric_type_t TYPE() const { return d_TYPE; }
- std::vector<@I_TYPE@> TABLE() const { return d_TABLE; }
- void set_TABLE(const std::vector<@I_TYPE@> &table);
- void forecast(int noutput_items,
- gr_vector_int &ninput_items_required);
- int general_work(int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-
-#endif
diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_X.cc.t b/gr-trellis/src/lib/trellis_pccc_decoder_X.cc.t
deleted file mode 100644
index d79192491e..0000000000
--- a/gr-trellis/src/lib/trellis_pccc_decoder_X.cc.t
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME@.h>
-#include <gr_io_signature.h>
-#include <assert.h>
-#include <iostream>
-#include "core_algorithms.h"
-
-
-static const float INF = 1.0e9;
-
-@SPTR_NAME@
-trellis_make_@BASE_NAME@ (
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE
-)
-{
- return gnuradio::get_initial_sptr (new @NAME@ (
- FSM1, ST10, ST1K,
- FSM2, ST20, ST2K,
- INTERLEAVER,
- blocklength,
- repetitions,
- SISO_TYPE
- ));
-}
-
-@NAME@::@NAME@ (
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE
-)
- : gr_block ("@BASE_NAME@",
- gr_make_io_signature (1, 1, sizeof (float)),
- gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
- d_FSM1 (FSM1), d_ST10 (ST10), d_ST1K (ST1K),
- d_FSM2 (FSM2), d_ST20 (ST20), d_ST2K (ST2K),
- d_INTERLEAVER (INTERLEAVER),
- d_blocklength (blocklength),
- d_repetitions (repetitions),
- d_SISO_TYPE (SISO_TYPE)
-{
- assert(d_FSM1.I() == d_FSM2.I());
- set_relative_rate (1.0 / ((double) d_FSM1.O() * d_FSM2.O()));
- set_output_multiple (d_blocklength);
-}
-
-
-void
-@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required)
-{
- assert (noutput_items % d_blocklength == 0);
- int input_required = d_FSM1.O() * d_FSM2.O() * noutput_items ;
- ninput_items_required[0] = input_required;
-}
-
-
-
-//===========================================================
-
-int
-@NAME@::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert (noutput_items % d_blocklength == 0);
- int nblocks = noutput_items / d_blocklength;
-
- float (*p2min)(float, float) = NULL;
- if(d_SISO_TYPE == TRELLIS_MIN_SUM)
- p2min = &min;
- else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
- p2min = &min_star;
-
-
- const float *in = (const float *) input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
- for (int n=0;n<nblocks;n++) {
- pccc_decoder(
- d_FSM1, d_ST10, d_ST1K,
- d_FSM2, d_ST20, d_ST2K,
- d_INTERLEAVER, d_blocklength, d_repetitions,
- p2min,
- &(in[n*d_blocklength*d_FSM1.O()*d_FSM2.O()]),&(out[n*d_blocklength])
- );
- }
-
- consume_each (d_FSM1.O() * d_FSM2.O() * noutput_items );
- return noutput_items;
-}
diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_X.h.t b/gr-trellis/src/lib/trellis_pccc_decoder_X.h.t
deleted file mode 100644
index e9bc946818..0000000000
--- a/gr-trellis/src/lib/trellis_pccc_decoder_X.h.t
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <trellis_api.h>
-#include "fsm.h"
-#include "interleaver.h"
-#include <gr_block.h>
-#include <vector>
-#include "siso_type.h"
-
-class @NAME@;
-typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
-
-TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE // perform "min-sum" or "sum-product" combining
-);
-
-
-/*!
- * \ingroup coding_blk
- */
-class TRELLIS_API @NAME@ : public gr_block
-{
- fsm d_FSM1;
- int d_ST10;
- int d_ST1K;
- fsm d_FSM2;
- int d_ST20;
- int d_ST2K;
- interleaver d_INTERLEAVER;
- int d_blocklength;
- int d_repetitions;
- trellis_siso_type_t d_SISO_TYPE;
- std::vector<float> d_buffer;
-
- friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE
- );
-
- @NAME@ (
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE
- );
-
-public:
- fsm FSM1 () const { return d_FSM1; }
- fsm FSM2 () const { return d_FSM2; }
- int ST10 () const { return d_ST10; }
- int ST1K () const { return d_ST1K; }
- int ST20 () const { return d_ST20; }
- int ST2K () const { return d_ST2K; }
- interleaver INTERLEAVER () const { return d_INTERLEAVER; }
- int blocklength () const { return d_blocklength; }
- int repetitions () const { return d_repetitions; }
- trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; }
-
- void forecast (int noutput_items,
- gr_vector_int &ninput_items_required);
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_X.i.t b/gr-trellis/src/lib/trellis_pccc_decoder_X.i.t
deleted file mode 100644
index 83d7fe969d..0000000000
--- a/gr-trellis/src/lib/trellis_pccc_decoder_X.i.t
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
-
-@SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE
-);
-
-
-class @NAME@ : public gr_block
-{
-private:
- @NAME@ (
- const fsm &FSM1, int ST10, int ST1K,
- const fsm &FSM2, int ST20, int ST2K,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE
- );
-
-public:
- fsm FSM1 () const { return d_FSM1; }
- fsm FSM2 () const { return d_FSM2; }
- int ST10 () const { return d_ST10; }
- int ST1K () const { return d_ST1K; }
- int ST20 () const { return d_ST20; }
- int ST2K () const { return d_ST2K; }
- interleaver INTERLEAVER () const { return d_INTERLEAVER; }
- int blocklength () const { return d_blocklength; }
- int repetitions () const { return d_repetitions; }
- trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; }
-};
diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t
deleted file mode 100644
index e8f9f7296e..0000000000
--- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.cc.t
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME@.h>
-#include <gr_io_signature.h>
-#include <assert.h>
-#include <iostream>
-#include "core_algorithms.h"
-
-
-static const float INF = 1.0e9;
-
-@SPTR_NAME@
-trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
-)
-{
- return gnuradio::get_initial_sptr (new @NAME@ (
- FSMo, STo0, SToK,
- FSMi, STi0, STiK,
- INTERLEAVER,
- blocklength,
- repetitions,
- SISO_TYPE,
- D,
- TABLE,METRIC_TYPE,
- scaling
- ));
-}
-
-@NAME@::@NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
-)
- : gr_block ("@BASE_NAME@",
- gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
- gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
- d_FSMo (FSMo), d_STo0 (STo0), d_SToK (SToK),
- d_FSMi (FSMi), d_STi0 (STi0), d_STiK (STiK),
- d_INTERLEAVER (INTERLEAVER),
- d_blocklength (blocklength),
- d_repetitions (repetitions),
- d_SISO_TYPE (SISO_TYPE),
- d_D (D),
- d_TABLE (TABLE),
- d_METRIC_TYPE (METRIC_TYPE),
- d_scaling (scaling)
-{
- assert(d_FSMo.I() == d_FSMi.I());
- set_relative_rate (1.0 / ((double) d_D));
- set_output_multiple (d_blocklength);
-}
-
-void @NAME@::set_scaling(float scaling)
-{
- d_scaling = scaling;
-}
-
-
-void
-@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required)
-{
- assert (noutput_items % d_blocklength == 0);
- int input_required = d_D * noutput_items ;
- ninput_items_required[0] = input_required;
-}
-
-
-
-//===========================================================
-
-int
-@NAME@::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert (noutput_items % d_blocklength == 0);
- int nblocks = noutput_items / d_blocklength;
-
- float (*p2min)(float, float) = NULL;
- if(d_SISO_TYPE == TRELLIS_MIN_SUM)
- p2min = &min;
- else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
- p2min = &min_star;
-
-
- const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
- for (int n=0;n<nblocks;n++) {
- pccc_decoder_combined(
- d_FSMo, d_STo0, d_SToK,
- d_FSMi, d_STi0, d_STiK,
- d_INTERLEAVER, d_blocklength, d_repetitions,
- p2min,
- d_D,d_TABLE,
- d_METRIC_TYPE,
- d_scaling,
- &(in[n*d_blocklength*d_D]),&(out[n*d_blocklength])
- );
- }
-
- consume_each (d_D * noutput_items );
- return noutput_items;
-}
diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t
deleted file mode 100644
index 81d9abbc1f..0000000000
--- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.h.t
+++ /dev/null
@@ -1,125 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <trellis_api.h>
-#include "fsm.h"
-#include "interleaver.h"
-#include <gr_block.h>
-#include <vector>
-#include "calc_metric.h"
-#include "siso_type.h"
-
-class @NAME@;
-typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
-
-TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE, // perform "min-sum" or "sum-product" combining
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
-);
-
-
-/*!
- * \ingroup coding_blk
- */
-class TRELLIS_API @NAME@ : public gr_block
-{
- fsm d_FSMo;
- int d_STo0;
- int d_SToK;
- fsm d_FSMi;
- int d_STi0;
- int d_STiK;
- interleaver d_INTERLEAVER;
- int d_blocklength;
- int d_repetitions;
- trellis_siso_type_t d_SISO_TYPE;
- int d_D;
- std::vector<@I_TYPE@> d_TABLE;
- gr::digital::trellis_metric_type_t d_METRIC_TYPE;
- float d_scaling;
- std::vector<float> d_buffer;
-
- friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
- );
-
- @NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
- );
-
-public:
- fsm FSM1 () const { return d_FSMo; }
- fsm FSM2 () const { return d_FSMi; }
- int ST10 () const { return d_STo0; }
- int ST1K () const { return d_SToK; }
- int ST20 () const { return d_STi0; }
- int ST2K () const { return d_STiK; }
- interleaver INTERLEAVER () const { return d_INTERLEAVER; }
- int blocklength () const { return d_blocklength; }
- int repetitions () const { return d_repetitions; }
- int D () const { return d_D; }
- std::vector<@I_TYPE@> TABLE () const { return d_TABLE; }
- gr::digital::trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; }
- trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; }
- float scaling () const { return d_scaling; }
- void set_scaling (float scaling);
-
- void forecast (int noutput_items,
- gr_vector_int &ninput_items_required);
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t b/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t
deleted file mode 100644
index 8684ff650c..0000000000
--- a/gr-trellis/src/lib/trellis_pccc_decoder_combined_XX.i.t
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
-
-@SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
-);
-
-
-class @NAME@ : public gr_block
-{
-private:
- @NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
- );
-
-public:
- fsm FSM1 () const { return d_FSMo; }
- fsm FSM2 () const { return d_FSMi; }
- int ST10 () const { return d_STo0; }
- int ST1K () const { return d_SToK; }
- int ST20 () const { return d_STi0; }
- int ST2K () const { return d_STiK; }
- interleaver INTERLEAVER () const { return d_INTERLEAVER; }
- int blocklength () const { return d_blocklength; }
- int repetitions () const { return d_repetitions; }
- int D () const { return d_D; }
- std::vector<@I_TYPE@> TABLE () const { return d_TABLE; }
- gr::digital::trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; }
- trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; }
- float scaling() const { return d_scaling; }
- void set_scaling (float scaling);
-};
diff --git a/gr-trellis/src/lib/trellis_pccc_encoder_XX.cc.t b/gr-trellis/src/lib/trellis_pccc_encoder_XX.cc.t
deleted file mode 100644
index 6cab858cd5..0000000000
--- a/gr-trellis/src/lib/trellis_pccc_encoder_XX.cc.t
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME@.h>
-#include <gr_io_signature.h>
-#include <iostream>
-
-@SPTR_NAME@
-trellis_make_@BASE_NAME@ (
- const fsm &FSM1, int ST1,
- const fsm &FSM2, int ST2,
- const interleaver &INTERLEAVER,
- int blocklength
-)
-{
- return gnuradio::get_initial_sptr (new @NAME@ (FSM1,ST1,FSM2,ST2,INTERLEAVER,blocklength));
-}
-
-@NAME@::@NAME@ (
- const fsm &FSM1, int ST1,
- const fsm &FSM2, int ST2,
- const interleaver &INTERLEAVER,
- int blocklength
-)
- : gr_sync_block ("@BASE_NAME@",
- gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
- gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
- d_FSM1 (FSM1),
- d_ST1 (ST1),
- d_FSM2 (FSM2),
- d_ST2 (ST2),
- d_INTERLEAVER (INTERLEAVER),
- d_blocklength (blocklength)
-{
- assert(d_FSM1.I() == d_FSM2.I());
- set_output_multiple(d_blocklength);
- d_buffer.resize(d_blocklength);
-}
-
-
-
-int
-@NAME@::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert(noutput_items%d_blocklength ==0);
- for (int b = 0 ; b<noutput_items/d_blocklength; b++) {
- const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]+b*d_blocklength;
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]+b*d_blocklength;
-
- int ST1_tmp = d_ST1;
- int ST2_tmp = d_ST2;
- for (int i = 0; i < d_blocklength; i++){
- int k = d_INTERLEAVER.INTER()[i];
- int o1 = d_FSM1.OS()[ST1_tmp*d_FSM1.I()+in[i]];
- ST1_tmp = (int) d_FSM1.NS()[ST1_tmp*d_FSM1.I()+in[i]];
- int o2 = d_FSM2.OS()[ST2_tmp*d_FSM2.I()+in[k]];
- ST2_tmp = (int) d_FSM2.NS()[ST2_tmp*d_FSM2.I()+in[k]];
- out[i] = (@O_TYPE@) (o1*d_FSM1.O() + o2);
- }
- }
- return noutput_items;
-}
-
diff --git a/gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t b/gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t
deleted file mode 100644
index 75a22b829c..0000000000
--- a/gr-trellis/src/lib/trellis_pccc_encoder_XX.h.t
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <trellis_api.h>
-#include <vector>
-#include "fsm.h"
-#include "interleaver.h"
-#include <gr_sync_block.h>
-
-class @NAME@;
-typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
-
-TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSM1, int ST1,
- const fsm &FSM2, int ST2,
- const interleaver &INTERLEAVER,
- int blocklength
-);
-
-/*!
- * \brief SCCC encoder.
- * \ingroup coding_blk
- */
-class TRELLIS_API @NAME@ : public gr_sync_block
-{
-private:
- friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSM1, int ST1,
- const fsm &FSM2, int ST2,
- const interleaver &INTERLEAVER,
- int blocklength
- );
- fsm d_FSM1;
- int d_ST1;
- fsm d_FSM2;
- int d_ST2;
- interleaver d_INTERLEAVER;
- int d_blocklength;
- std::vector<int> d_buffer;
- @NAME@ (
- const fsm &FSM1, int ST1,
- const fsm &FSM2, int ST2,
- const interleaver &INTERLEAVER,
- int blocklength
- );
-
-public:
- fsm FSM1 () const { return d_FSM1; }
- int ST1 () const { return d_ST1; }
- fsm FSM2 () const { return d_FSM2; }
- int ST2 () const { return d_ST2; }
- interleaver INTERLEAVER () const { return d_INTERLEAVER; }
- int blocklength () const { return d_blocklength; }
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-trellis/src/lib/trellis_pccc_encoder_XX.i.t b/gr-trellis/src/lib/trellis_pccc_encoder_XX.i.t
deleted file mode 100644
index c02ee428a3..0000000000
--- a/gr-trellis/src/lib/trellis_pccc_encoder_XX.i.t
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
-
-@SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSM1, int ST1,
- const fsm &FSM2, int ST2,
- const interleaver &INTERLEAVER,
- int blocklength
-);
-
-class @NAME@ : public gr_sync_block
-{
-private:
- @NAME@ (
- const fsm &FSM1, int ST1,
- const fsm &FSM2, int ST2,
- const interleaver &INTERLEAVER,
- int blocklength
- );
-public:
- fsm FSM1 () const { return d_FSM1; }
- int ST1 () const { return d_ST1; }
- fsm FSM2 () const { return d_FSM2; }
- int ST2 () const { return d_ST2; }
- interleaver INTERLEAVER () const { return d_INTERLEAVER; }
- int blocklength () const { return d_blocklength; }
-};
diff --git a/gr-trellis/src/lib/trellis_permutation.cc b/gr-trellis/src/lib/trellis_permutation.cc
deleted file mode 100644
index 57c6d26938..0000000000
--- a/gr-trellis/src/lib/trellis_permutation.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <trellis_permutation.h>
-#include <gr_io_signature.h>
-#include <iostream>
-#include <string.h>
-
-trellis_permutation_sptr
-trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL)
-{
- return gnuradio::get_initial_sptr(new trellis_permutation (K,TABLE,SYMS_PER_BLOCK,BYTES_PER_SYMBOL));
-}
-
-trellis_permutation::trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL)
- : gr_sync_block ("permutation",
- gr_make_io_signature (1, -1, BYTES_PER_SYMBOL),
- gr_make_io_signature (1, -1, BYTES_PER_SYMBOL)),
- d_K (K),
- d_TABLE (TABLE),
- d_SYMS_PER_BLOCK (SYMS_PER_BLOCK),
- d_BYTES_PER_SYMBOL (BYTES_PER_SYMBOL)
-{
- set_output_multiple (d_K*SYMS_PER_BLOCK);
- //std::cout << d_K << "\n";
-}
-
-
-
-int
-trellis_permutation::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- int nstreams = input_items.size();
- assert (input_items.size() == output_items.size());
- assert (noutput_items % d_K ==0);
-
- for (int m=0;m<nstreams;m++) {
- const char *in = (const char *) input_items[m];
- char *out = (char *) output_items[m];
-
- // per stream processing
- for (int i = 0; i < noutput_items/d_SYMS_PER_BLOCK; i++){
- // Index i refers to blocks.
- // Begining of packet (in blocks)
- int i0 = d_K*(i/d_K);
- // position of block within packet (in blocks)
- int j0 = i%d_K;
- // new position of block within packet (in blocks)
- int k0 = d_TABLE[j0];
- memcpy(&(out[i*d_SYMS_PER_BLOCK*d_BYTES_PER_SYMBOL]),
- &(in[(i0+k0)*d_SYMS_PER_BLOCK*d_BYTES_PER_SYMBOL]),
- d_BYTES_PER_SYMBOL*d_SYMS_PER_BLOCK);
- }
- // end per stream processing
- }
- return noutput_items;
-}
diff --git a/gr-trellis/src/lib/trellis_permutation.h b/gr-trellis/src/lib/trellis_permutation.h
deleted file mode 100644
index cc40518c2c..0000000000
--- a/gr-trellis/src/lib/trellis_permutation.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-
-#ifndef INCLUDED_TRELLIS_PERMUTATION_H
-#define INCLUDED_TRELLIS_PERMUTATION_H
-
-#include <trellis_api.h>
-#include <vector>
-#include <gr_sync_block.h>
-
-class trellis_permutation;
-typedef boost::shared_ptr<trellis_permutation> trellis_permutation_sptr;
-
-TRELLIS_API trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL);
-
-/*!
- * \brief Permutation.
- * \ingroup coding_blk
- */
-class TRELLIS_API trellis_permutation : public gr_sync_block
-{
-private:
- friend TRELLIS_API trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL);
- int d_K;
- std::vector<int> d_TABLE;
- int d_SYMS_PER_BLOCK;
- size_t d_BYTES_PER_SYMBOL;
- trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t NBYTES);
-
-public:
- int K () const { return d_K; }
- const std::vector<int> & TABLE () const { return d_TABLE; }
- int SYMS_PER_BLOCK () const { return d_SYMS_PER_BLOCK; }
- size_t BYTES_PER_SYMBOL () const { return d_BYTES_PER_SYMBOL; }
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-trellis/src/lib/trellis_permutation.i b/gr-trellis/src/lib/trellis_permutation.i
deleted file mode 100644
index fdfaa44d33..0000000000
--- a/gr-trellis/src/lib/trellis_permutation.i
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(trellis,permutation);
-
-trellis_permutation_sptr trellis_make_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL);
-
-class trellis_permutation : public gr_sync_block
-{
-private:
- int d_K;
- std::vector<int> d_TABLE;
- int d_SYMS_PER_BLOCK;
- size_t d_BYTES_PER_SYMBOL;
- trellis_permutation (int K, const std::vector<int> &TABLE, int SYMS_PER_BLOCK, size_t BYTES_PER_SYMBOL);
-
-public:
- int K () const { return d_K; }
- const std::vector<int> & TABLE () const { return d_TABLE; }
- int SYMS_PER_BLOCK () const { return d_SYMS_PER_BLOCK; }
- size_t BYTES_PER_SYMBOL () const { return d_BYTES_PER_SYMBOL; }
-};
diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t b/gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t
deleted file mode 100644
index c9b78aa8f6..0000000000
--- a/gr-trellis/src/lib/trellis_sccc_decoder_X.cc.t
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME@.h>
-#include <gr_io_signature.h>
-#include <assert.h>
-#include <iostream>
-#include "core_algorithms.h"
-
-
-static const float INF = 1.0e9;
-
-@SPTR_NAME@
-trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE
-)
-{
- return gnuradio::get_initial_sptr (new @NAME@ (
- FSMo, STo0, SToK,
- FSMi, STi0, STiK,
- INTERLEAVER,
- blocklength,
- repetitions,
- SISO_TYPE
- ));
-}
-
-@NAME@::@NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE
-)
- : gr_block ("@BASE_NAME@",
- gr_make_io_signature (1, 1, sizeof (float)),
- gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
- d_FSMo (FSMo), d_STo0 (STo0), d_SToK (SToK),
- d_FSMi (FSMi), d_STi0 (STi0), d_STiK (STiK),
- d_INTERLEAVER (INTERLEAVER),
- d_blocklength (blocklength),
- d_repetitions (repetitions),
- d_SISO_TYPE (SISO_TYPE)
-{
- assert(d_FSMo.O() == d_FSMi.I());
- set_relative_rate (1.0 / ((double) d_FSMi.O()));
- set_output_multiple (d_blocklength);
-}
-
-
-void
-@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required)
-{
- assert (noutput_items % d_blocklength == 0);
- int input_required = d_FSMi.O() * noutput_items ;
- ninput_items_required[0] = input_required;
-}
-
-
-
-//===========================================================
-
-int
-@NAME@::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert (noutput_items % d_blocklength == 0);
- int nblocks = noutput_items / d_blocklength;
-
- float (*p2min)(float, float) = NULL;
- if(d_SISO_TYPE == TRELLIS_MIN_SUM)
- p2min = &min;
- else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
- p2min = &min_star;
-
-
- const float *in = (const float *) input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
- for (int n=0;n<nblocks;n++) {
- sccc_decoder(
- d_FSMo, d_STo0, d_SToK,
- d_FSMi, d_STi0, d_STiK,
- d_INTERLEAVER, d_blocklength, d_repetitions,
- p2min,
- &(in[n*d_blocklength*d_FSMi.O()]),&(out[n*d_blocklength])
- );
- }
-
- consume_each (d_FSMi.O() * noutput_items );
- return noutput_items;
-}
diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_X.h.t b/gr-trellis/src/lib/trellis_sccc_decoder_X.h.t
deleted file mode 100644
index d6fb72f682..0000000000
--- a/gr-trellis/src/lib/trellis_sccc_decoder_X.h.t
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <trellis_api.h>
-#include "fsm.h"
-#include "interleaver.h"
-#include <gr_block.h>
-#include <vector>
-#include "siso_type.h"
-
-class @NAME@;
-typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
-
-TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE // perform "min-sum" or "sum-product" combining
-);
-
-
-/*!
- * \ingroup coding_blk
- */
-class TRELLIS_API @NAME@ : public gr_block
-{
- fsm d_FSMo;
- int d_STo0;
- int d_SToK;
- fsm d_FSMi;
- int d_STi0;
- int d_STiK;
- interleaver d_INTERLEAVER;
- int d_blocklength;
- int d_repetitions;
- trellis_siso_type_t d_SISO_TYPE;
- std::vector<float> d_buffer;
-
- friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE
- );
-
- @NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE
- );
-
-public:
- fsm FSMo () const { return d_FSMo; }
- fsm FSMi () const { return d_FSMi; }
- int STo0 () const { return d_STo0; }
- int SToK () const { return d_SToK; }
- int STi0 () const { return d_STi0; }
- int STiK () const { return d_STiK; }
- interleaver INTERLEAVER () const { return d_INTERLEAVER; }
- int blocklength () const { return d_blocklength; }
- int repetitions () const { return d_repetitions; }
- trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; }
-
- void forecast (int noutput_items,
- gr_vector_int &ninput_items_required);
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_X.i.t b/gr-trellis/src/lib/trellis_sccc_decoder_X.i.t
deleted file mode 100644
index a4392ee6fa..0000000000
--- a/gr-trellis/src/lib/trellis_sccc_decoder_X.i.t
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
-
-@SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE
-);
-
-
-class @NAME@ : public gr_block
-{
-private:
- @NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE
- );
-
-public:
- fsm FSMo () const { return d_FSMo; }
- fsm FSMi () const { return d_FSMi; }
- int STo0 () const { return d_STo0; }
- int SToK () const { return d_SToK; }
- int STi0 () const { return d_STi0; }
- int STiK () const { return d_STiK; }
- interleaver INTERLEAVER () const { return d_INTERLEAVER; }
- int blocklength () const { return d_blocklength; }
- int repetitions () const { return d_repetitions; }
- trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; }
-};
diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.cc.t b/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.cc.t
deleted file mode 100644
index 0fcfc70a68..0000000000
--- a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.cc.t
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME@.h>
-#include <gr_io_signature.h>
-#include <assert.h>
-#include <iostream>
-#include "core_algorithms.h"
-
-
-static const float INF = 1.0e9;
-
-@SPTR_NAME@
-trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
-)
-{
- return gnuradio::get_initial_sptr (new @NAME@ (
- FSMo, STo0, SToK,
- FSMi, STi0, STiK,
- INTERLEAVER,
- blocklength,
- repetitions,
- SISO_TYPE,
- D,
- TABLE,METRIC_TYPE,
- scaling
- ));
-}
-
-@NAME@::@NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
-)
- : gr_block ("@BASE_NAME@",
- gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
- gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
- d_FSMo (FSMo), d_STo0 (STo0), d_SToK (SToK),
- d_FSMi (FSMi), d_STi0 (STi0), d_STiK (STiK),
- d_INTERLEAVER (INTERLEAVER),
- d_blocklength (blocklength),
- d_repetitions (repetitions),
- d_SISO_TYPE (SISO_TYPE),
- d_D (D),
- d_TABLE (TABLE),
- d_METRIC_TYPE (METRIC_TYPE),
- d_scaling (scaling)
-{
- assert(d_FSMo.O() == d_FSMi.I());
- set_relative_rate (1.0 / ((double) d_D));
- set_output_multiple (d_blocklength);
-}
-
-void @NAME@::set_scaling(float scaling)
-{
- d_scaling = scaling;
-}
-
-
-void
-@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required)
-{
- assert (noutput_items % d_blocklength == 0);
- int input_required = d_D * noutput_items ;
- ninput_items_required[0] = input_required;
-}
-
-
-
-//===========================================================
-
-int
-@NAME@::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert (noutput_items % d_blocklength == 0);
- int nblocks = noutput_items / d_blocklength;
-
- float (*p2min)(float, float) = NULL;
- if(d_SISO_TYPE == TRELLIS_MIN_SUM)
- p2min = &min;
- else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
- p2min = &min_star;
-
-
- const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0];
- for (int n=0;n<nblocks;n++) {
- sccc_decoder_combined(
- d_FSMo, d_STo0, d_SToK,
- d_FSMi, d_STi0, d_STiK,
- d_INTERLEAVER, d_blocklength, d_repetitions,
- p2min,
- d_D,d_TABLE,
- d_METRIC_TYPE,
- d_scaling,
- &(in[n*d_blocklength*d_D]),&(out[n*d_blocklength])
- );
- }
-
- consume_each (d_D * noutput_items );
- return noutput_items;
-}
diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t b/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t
deleted file mode 100644
index 2cf03eaa55..0000000000
--- a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.h.t
+++ /dev/null
@@ -1,125 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <trellis_api.h>
-#include "fsm.h"
-#include "interleaver.h"
-#include <gr_block.h>
-#include <vector>
-#include "calc_metric.h"
-#include "siso_type.h"
-
-class @NAME@;
-typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
-
-TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE, // perform "min-sum" or "sum-product" combining
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
-);
-
-
-/*!
- * \ingroup coding_blk
- */
-class TRELLIS_API @NAME@ : public gr_block
-{
- fsm d_FSMo;
- int d_STo0;
- int d_SToK;
- fsm d_FSMi;
- int d_STi0;
- int d_STiK;
- interleaver d_INTERLEAVER;
- int d_blocklength;
- int d_repetitions;
- trellis_siso_type_t d_SISO_TYPE;
- int d_D;
- std::vector<@I_TYPE@> d_TABLE;
- gr::digital::trellis_metric_type_t d_METRIC_TYPE;
- float d_scaling;
- std::vector<float> d_buffer;
-
- friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
- );
-
- @NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
- );
-
-public:
- fsm FSMo () const { return d_FSMo; }
- fsm FSMi () const { return d_FSMi; }
- int STo0 () const { return d_STo0; }
- int SToK () const { return d_SToK; }
- int STi0 () const { return d_STi0; }
- int STiK () const { return d_STiK; }
- interleaver INTERLEAVER () const { return d_INTERLEAVER; }
- int blocklength () const { return d_blocklength; }
- int repetitions () const { return d_repetitions; }
- int D () const { return d_D; }
- std::vector<@I_TYPE@> TABLE () const { return d_TABLE; }
- gr::digital::trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; }
- trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; }
- float scaling () const { return d_scaling; }
- void set_scaling (float scaling);
-
- void forecast (int noutput_items,
- gr_vector_int &ninput_items_required);
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.i.t b/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.i.t
deleted file mode 100644
index 872afcad09..0000000000
--- a/gr-trellis/src/lib/trellis_sccc_decoder_combined_XX.i.t
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
-
-@SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
-);
-
-
-class @NAME@ : public gr_block
-{
-private:
- @NAME@ (
- const fsm &FSMo, int STo0, int SToK,
- const fsm &FSMi, int STi0, int STiK,
- const interleaver &INTERLEAVER,
- int blocklength,
- int repetitions,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t METRIC_TYPE,
- float scaling
- );
-
-public:
- fsm FSMo () const { return d_FSMo; }
- fsm FSMi () const { return d_FSMi; }
- int STo0 () const { return d_STo0; }
- int SToK () const { return d_SToK; }
- int STi0 () const { return d_STi0; }
- int STiK () const { return d_STiK; }
- interleaver INTERLEAVER () const { return d_INTERLEAVER; }
- int blocklength () const { return d_blocklength; }
- int repetitions () const { return d_repetitions; }
- int D () const { return d_D; }
- std::vector<@I_TYPE@> TABLE () const { return d_TABLE; }
- gr::digital::trellis_metric_type_t METRIC_TYPE () const { return d_METRIC_TYPE; }
- trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; }
- float scaling() const { return d_scaling; }
- void set_scaling (float scaling);
-};
diff --git a/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t b/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t
deleted file mode 100644
index 8054909db8..0000000000
--- a/gr-trellis/src/lib/trellis_sccc_encoder_XX.cc.t
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME@.h>
-#include <gr_io_signature.h>
-#include <iostream>
-
-@SPTR_NAME@
-trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo,
- const fsm &FSMi, int STi,
- const interleaver &INTERLEAVER,
- int blocklength
-)
-{
- return gnuradio::get_initial_sptr (new @NAME@ (FSMo,STo,FSMi,STi,INTERLEAVER,blocklength));
-}
-
-@NAME@::@NAME@ (
- const fsm &FSMo, int STo,
- const fsm &FSMi, int STi,
- const interleaver &INTERLEAVER,
- int blocklength
-)
- : gr_sync_block ("@BASE_NAME@",
- gr_make_io_signature (1, 1, sizeof (@I_TYPE@)),
- gr_make_io_signature (1, 1, sizeof (@O_TYPE@))),
- d_FSMo (FSMo),
- d_STo (STo),
- d_FSMi (FSMi),
- d_STi (STi),
- d_INTERLEAVER (INTERLEAVER),
- d_blocklength (blocklength)
-{
- assert(d_FSMo.O() == d_FSMi.I());
- set_output_multiple(d_blocklength);
- d_buffer.resize(d_blocklength);
-}
-
-
-
-int
-@NAME@::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert(noutput_items%d_blocklength ==0);
- for (int b = 0 ; b<noutput_items/d_blocklength; b++) {
- const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[0]+b*d_blocklength;
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[0]+b*d_blocklength;
-
- int STo_tmp = d_STo;
- for (int i = 0; i < d_blocklength; i++){
- d_buffer[i] = d_FSMo.OS()[STo_tmp*d_FSMo.I()+in[i]];
- STo_tmp = (int) d_FSMo.NS()[STo_tmp*d_FSMo.I()+in[i]];
- }
- int STi_tmp = d_STi;
- for (int i = 0; i < d_blocklength; i++){
- int k = d_INTERLEAVER.INTER()[i];
- out[i] = (@O_TYPE@) d_FSMi.OS()[STi_tmp*d_FSMi.I()+d_buffer[k]];
- STi_tmp = (int) d_FSMi.NS()[STi_tmp*d_FSMi.I()+d_buffer[k]];
- }
- }
- return noutput_items;
-}
-
diff --git a/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t b/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t
deleted file mode 100644
index b16d7ffca9..0000000000
--- a/gr-trellis/src/lib/trellis_sccc_encoder_XX.h.t
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <trellis_api.h>
-#include <vector>
-#include "fsm.h"
-#include "interleaver.h"
-#include <gr_sync_block.h>
-
-class @NAME@;
-typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
-
-TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo,
- const fsm &FSMi, int STi,
- const interleaver &INTERLEAVER,
- int blocklength
-);
-
-/*!
- * \brief SCCC encoder.
- * \ingroup coding_blk
- */
-class TRELLIS_API @NAME@ : public gr_sync_block
-{
-private:
- friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo,
- const fsm &FSMi, int STi,
- const interleaver &INTERLEAVER,
- int blocklength
- );
- fsm d_FSMo;
- int d_STo;
- fsm d_FSMi;
- int d_STi;
- interleaver d_INTERLEAVER;
- int d_blocklength;
- std::vector<int> d_buffer;
- @NAME@ (
- const fsm &FSMo, int STo,
- const fsm &FSMi, int STi,
- const interleaver &INTERLEAVER,
- int blocklength
- );
-
-public:
- fsm FSMo () const { return d_FSMo; }
- int STo () const { return d_STo; }
- fsm FSMi () const { return d_FSMi; }
- int STi () const { return d_STi; }
- interleaver INTERLEAVER () const { return d_INTERLEAVER; }
- int blocklength () const { return d_blocklength; }
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-trellis/src/lib/trellis_sccc_encoder_XX.i.t b/gr-trellis/src/lib/trellis_sccc_encoder_XX.i.t
deleted file mode 100644
index ca6b561992..0000000000
--- a/gr-trellis/src/lib/trellis_sccc_encoder_XX.i.t
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
-
-@SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSMo, int STo,
- const fsm &FSMi, int STi,
- const interleaver &INTERLEAVER,
- int blocklength
-);
-
-class @NAME@ : public gr_sync_block
-{
-private:
- @NAME@ (
- const fsm &FSMo, int STo,
- const fsm &FSMi, int STi,
- const interleaver &INTERLEAVER,
- int blocklength
- );
-public:
- fsm FSMo () const { return d_FSMo; }
- int STo () const { return d_STo; }
- fsm FSMi () const { return d_FSMi; }
- int STi () const { return d_STi; }
- interleaver INTERLEAVER () const { return d_INTERLEAVER; }
- int blocklength () const { return d_blocklength; }
-};
diff --git a/gr-trellis/src/lib/trellis_siso_combined_f.cc b/gr-trellis/src/lib/trellis_siso_combined_f.cc
deleted file mode 100644
index d956c47854..0000000000
--- a/gr-trellis/src/lib/trellis_siso_combined_f.cc
+++ /dev/null
@@ -1,357 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <trellis_siso_combined_f.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-#include <assert.h>
-#include <iostream>
-
-static const float INF = 1.0e9;
-
-trellis_siso_combined_f_sptr
-trellis_make_siso_combined_f (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- bool POSTI,
- bool POSTO,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t TYPE)
-{
- return gnuradio::get_initial_sptr(new trellis_siso_combined_f (FSM,K,S0,SK,POSTI,POSTO,SISO_TYPE,D,TABLE,TYPE));
-}
-
-trellis_siso_combined_f::trellis_siso_combined_f (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- bool POSTI,
- bool POSTO,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t TYPE)
- : gr_block ("siso_combined_f",
- gr_make_io_signature (1, -1, sizeof (float)),
- gr_make_io_signature (1, -1, sizeof (float))),
- d_FSM (FSM),
- d_K (K),
- d_S0 (S0),
- d_SK (SK),
- d_POSTI (POSTI),
- d_POSTO (POSTO),
- d_SISO_TYPE (SISO_TYPE),
- d_D (D),
- d_TABLE (TABLE),
- d_TYPE (TYPE)//,
- //d_alpha(FSM.S()*(K+1)),
- //d_beta(FSM.S()*(K+1))
-{
- int multiple;
- if (d_POSTI && d_POSTO)
- multiple = d_FSM.I()+d_FSM.O();
- else if(d_POSTI)
- multiple = d_FSM.I();
- else if(d_POSTO)
- multiple = d_FSM.O();
- else
- throw std::runtime_error ("Not both POSTI and POSTO can be false.");
- //printf("constructor: Multiple = %d\n",multiple);
- set_output_multiple (d_K*multiple);
- //what is the meaning of relative rate for a block with 2 inputs?
- //set_relative_rate ( multiple / ((double) d_FSM.I()) );
- // it turns out that the above gives problems in the scheduler, so
- // let's try (assumption O>I)
- //set_relative_rate ( multiple / ((double) d_FSM.O()) );
- // I am tempted to automate like this
- if(d_FSM.I() <= d_D)
- set_relative_rate ( multiple / ((double) d_D) );
- else
- set_relative_rate ( multiple / ((double) d_FSM.I()) );
-}
-
-
-void
-trellis_siso_combined_f::forecast (int noutput_items, gr_vector_int &ninput_items_required)
-{
- int multiple;
- if (d_POSTI && d_POSTO)
- multiple = d_FSM.I()+d_FSM.O();
- else if(d_POSTI)
- multiple = d_FSM.I();
- else if(d_POSTO)
- multiple = d_FSM.O();
- else
- throw std::runtime_error ("Not both POSTI and POSTO can be false.");
- //printf("forecast: Multiple = %d\n",multiple);
- assert (noutput_items % (d_K*multiple) == 0);
- int input_required1 = d_FSM.I() * (noutput_items/multiple) ;
- int input_required2 = d_D * (noutput_items/multiple) ;
- //printf("forecast: Output requirements: %d\n",noutput_items);
- //printf("forecast: Input requirements: %d %d\n",input_required1,input_required2);
- unsigned ninputs = ninput_items_required.size();
- assert(ninputs % 2 == 0);
- for (unsigned int i = 0; i < ninputs/2; i++) {
- ninput_items_required[2*i] = input_required1;
- ninput_items_required[2*i+1] = input_required2;
- }
-}
-
-
-
-
-
-/*
-
-
-inline float min(float a, float b)
-{
- return a <= b ? a : b;
-}
-
-inline float min_star(float a, float b)
-{
- return (a <= b ? a : b)-log(1+exp(a <= b ? a-b : b-a));
-}
-
-void siso_algorithm_combined(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- bool POSTI, bool POSTO,
- float (*p2mymin)(float,float),
- int D,
- const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const float *priori, const float *observations, float *post//,
- //std::vector<float> &alpha,
- //std::vector<float> &beta
- )
-{
- float norm,mm,minm;
- std::vector<float> alpha(S*(K+1));
- std::vector<float> beta(S*(K+1));
- float *prioro = new float[O*K];
-
-
- if(S0<0) { // initial state not specified
- for(int i=0;i<S;i++) alpha[0*S+i]=0;
- }
- else {
- for(int i=0;i<S;i++) alpha[0*S+i]=INF;
- alpha[0*S+S0]=0.0;
- }
-
- for(int k=0;k<K;k++) { // forward recursion
- calc_metric(O, D, TABLE, &(observations[k*D]), &(prioro[k*O]),TYPE); // calc metrics
- norm=INF;
- for(int j=0;j<S;j++) {
- minm=INF;
- for(unsigned int i=0;i<PS[j].size();i++) {
- //int i0 = j*I+i;
- mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]];
- minm=(*p2mymin)(minm,mm);
- }
- alpha[(k+1)*S+j]=minm;
- if(minm<norm) norm=minm;
- }
- for(int j=0;j<S;j++)
- alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode
- }
-
- if(SK<0) { // final state not specified
- for(int i=0;i<S;i++) beta[K*S+i]=0;
- }
- else {
- for(int i=0;i<S;i++) beta[K*S+i]=INF;
- beta[K*S+SK]=0.0;
- }
-
- for(int k=K-1;k>=0;k--) { // backward recursion
- norm=INF;
- for(int j=0;j<S;j++) {
- minm=INF;
- for(int i=0;i<I;i++) {
- int i0 = j*I+i;
- mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]];
- minm=(*p2mymin)(minm,mm);
- }
- beta[k*S+j]=minm;
- if(minm<norm) norm=minm;
- }
- for(int j=0;j<S;j++)
- beta[k*S+j]-=norm; // normalize total metrics so they do not explode
- }
-
-
- if (POSTI && POSTO)
- {
- for(int k=0;k<K;k++) { // input combining
- norm=INF;
- for(int i=0;i<I;i++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]];
- minm=(*p2mymin)(minm,mm);
- }
- post[k*(I+O)+i]=minm;
- if(minm<norm) norm=minm;
- }
- for(int i=0;i<I;i++)
- post[k*(I+O)+i]-=norm; // normalize metrics
- }
-
-
- for(int k=0;k<K;k++) { // output combining
- norm=INF;
- for(int n=0;n<O;n++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- for(int i=0;i<I;i++) {
- mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF);
- minm=(*p2mymin)(minm,mm);
- }
- }
- post[k*(I+O)+I+n]=minm;
- if(minm<norm) norm=minm;
- }
- for(int n=0;n<O;n++)
- post[k*(I+O)+I+n]-=norm; // normalize metrics
- }
- }
- else if(POSTI)
- {
- for(int k=0;k<K;k++) { // input combining
- norm=INF;
- for(int i=0;i<I;i++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]];
- minm=(*p2mymin)(minm,mm);
- }
- post[k*I+i]=minm;
- if(minm<norm) norm=minm;
- }
- for(int i=0;i<I;i++)
- post[k*I+i]-=norm; // normalize metrics
- }
- }
- else if(POSTO)
- {
- for(int k=0;k<K;k++) { // output combining
- norm=INF;
- for(int n=0;n<O;n++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- for(int i=0;i<I;i++) {
- mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF);
- minm=(*p2mymin)(minm,mm);
- }
- }
- post[k*O+n]=minm;
- if(minm<norm) norm=minm;
- }
- for(int n=0;n<O;n++)
- post[k*O+n]-=norm; // normalize metrics
- }
- }
- else
- throw std::runtime_error ("Not both POSTI and POSTO can be false.");
-
- delete [] prioro;
-
-}
-
-*/
-
-
-
-
-int
-trellis_siso_combined_f::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert (input_items.size() == 2*output_items.size());
- int nstreams = output_items.size();
- //printf("general_work:Streams: %d\n",nstreams);
- int multiple;
- if (d_POSTI && d_POSTO)
- multiple = d_FSM.I()+d_FSM.O();
- else if(d_POSTI)
- multiple = d_FSM.I();
- else if(d_POSTO)
- multiple = d_FSM.O();
- else
- throw std::runtime_error ("Not both POSTI and POSTO can be false.");
-
- assert (noutput_items % (d_K*multiple) == 0);
- int nblocks = noutput_items / (d_K*multiple);
- //printf("general_work:Blocks: %d\n",nblocks);
- //for(int i=0;i<ninput_items.size();i++)
- //printf("general_work:Input items available: %d\n",ninput_items[i]);
-
- float (*p2min)(float, float) = NULL;
- if(d_SISO_TYPE == TRELLIS_MIN_SUM)
- p2min = &min;
- else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
- p2min = &min_star;
-
-
- for (int m=0;m<nstreams;m++) {
- const float *in1 = (const float *) input_items[2*m];
- const float *in2 = (const float *) input_items[2*m+1];
- float *out = (float *) output_items[m];
- for (int n=0;n<nblocks;n++) {
- siso_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),
- d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),
- d_K,d_S0,d_SK,
- d_POSTI,d_POSTO,
- p2min,
- d_D,d_TABLE,d_TYPE,
- &(in1[n*d_K*d_FSM.I()]),&(in2[n*d_K*d_D]),
- &(out[n*d_K*multiple])//,
- //d_alpha,d_beta
- );
- }
- }
-
- for (unsigned int i = 0; i < input_items.size()/2; i++) {
- consume(2*i,d_FSM.I() * noutput_items / multiple );
- consume(2*i+1,d_D * noutput_items / multiple );
- }
-
- return noutput_items;
-}
diff --git a/gr-trellis/src/lib/trellis_siso_combined_f.h b/gr-trellis/src/lib/trellis_siso_combined_f.h
deleted file mode 100644
index 47fa20fb65..0000000000
--- a/gr-trellis/src/lib/trellis_siso_combined_f.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_TRELLIS_SISO_COMBINED_F_H
-#define INCLUDED_TRELLIS_SISO_COMBINED_F_H
-
-#include <trellis_api.h>
-#include "fsm.h"
-#include "siso_type.h"
-#include "calc_metric.h"
-#include "core_algorithms.h"
-#include <gr_block.h>
-
-class trellis_siso_combined_f;
-typedef boost::shared_ptr<trellis_siso_combined_f> trellis_siso_combined_f_sptr;
-
-TRELLIS_API trellis_siso_combined_f_sptr trellis_make_siso_combined_f (
- const fsm &FSM, // underlying FSM
- int K, // block size in trellis steps
- int S0, // initial state (put -1 if not specified)
- int SK, // final state (put -1 if not specified)
- bool POSTI, // true if you want a-posteriori info about the input symbols to be mux-ed in the output
- bool POSTO, // true if you want a-posteriori info about the output symbols to be mux-ed in the output
- trellis_siso_type_t d_SISO_TYPE, // perform "min-sum" or "sum-product" combining
- int D,
- const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t TYPE
-);
-
-/*!
- * \ingroup coding_blk
- */
-class TRELLIS_API trellis_siso_combined_f : public gr_block
-{
- fsm d_FSM;
- int d_K;
- int d_S0;
- int d_SK;
- bool d_POSTI;
- bool d_POSTO;
- trellis_siso_type_t d_SISO_TYPE;
- int d_D;
- std::vector<float> d_TABLE;
- gr::digital::trellis_metric_type_t d_TYPE;
- //std::vector<float> d_alpha;
- //std::vector<float> d_beta;
-
- friend TRELLIS_API trellis_siso_combined_f_sptr trellis_make_siso_combined_f (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- bool POSTI,
- bool POSTO,
- trellis_siso_type_t d_SISO_TYPE,
- int D,
- const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
-
-
- trellis_siso_combined_f (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- bool POSTI,
- bool POSTO,
- trellis_siso_type_t d_SISO_TYPE,
- int D,
- const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
-
-
-public:
- fsm FSM () const { return d_FSM; }
- int K () const { return d_K; }
- int S0 () const { return d_S0; }
- int SK () const { return d_SK; }
- bool POSTI () const { return d_POSTI; }
- bool POSTO () const { return d_POSTO; }
- trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; }
- int D () const { return d_D; }
- std::vector<float> TABLE () const { return d_TABLE; }
- gr::digital::trellis_metric_type_t TYPE () const { return d_TYPE; }
- void forecast (int noutput_items,
- gr_vector_int &ninput_items_required);
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-trellis/src/lib/trellis_siso_combined_f.i b/gr-trellis/src/lib/trellis_siso_combined_f.i
deleted file mode 100644
index 228cdd1218..0000000000
--- a/gr-trellis/src/lib/trellis_siso_combined_f.i
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(trellis,siso_combined_f);
-
-trellis_siso_combined_f_sptr trellis_make_siso_combined_f (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- bool POSTI,
- bool POSTO,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
-
-
-class trellis_siso_combined_f : public gr_block
-{
-private:
- trellis_siso_combined_f (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- bool POSTI,
- bool POSTO,
- trellis_siso_type_t SISO_TYPE,
- int D,
- const std::vector<float> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
-
-public:
- fsm FSM () const { return d_FSM; }
- int K () const { return d_K; }
- int S0 () const { return d_S0; }
- int SK () const { return d_SK; }
- bool POSTI () const { return d_POSTI; }
- bool POSTO () const { return d_POSTO; }
- trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; }
- int D () const { return d_D; }
- std::vector<float> TABLE () const { return d_TABLE; }
- gr::digital::trellis_metric_type_t TYPE () const { return d_TYPE; }
-};
diff --git a/gr-trellis/src/lib/trellis_siso_f.cc b/gr-trellis/src/lib/trellis_siso_f.cc
deleted file mode 100644
index ffebf1928a..0000000000
--- a/gr-trellis/src/lib/trellis_siso_f.cc
+++ /dev/null
@@ -1,338 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <trellis_siso_f.h>
-#include <gr_io_signature.h>
-#include <stdexcept>
-#include <assert.h>
-#include <iostream>
-
-static const float INF = 1.0e9;
-
-trellis_siso_f_sptr
-trellis_make_siso_f (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- bool POSTI,
- bool POSTO,
- trellis_siso_type_t SISO_TYPE)
-{
- return gnuradio::get_initial_sptr(new trellis_siso_f (FSM,K,S0,SK,POSTI,POSTO,SISO_TYPE));
-}
-
-trellis_siso_f::trellis_siso_f (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- bool POSTI,
- bool POSTO,
- trellis_siso_type_t SISO_TYPE)
- : gr_block ("siso_f",
- gr_make_io_signature (1, -1, sizeof (float)),
- gr_make_io_signature (1, -1, sizeof (float))),
- d_FSM (FSM),
- d_K (K),
- d_S0 (S0),
- d_SK (SK),
- d_POSTI (POSTI),
- d_POSTO (POSTO),
- d_SISO_TYPE (SISO_TYPE)//,
- //d_alpha(FSM.S()*(K+1)),
- //d_beta(FSM.S()*(K+1))
-{
- int multiple;
- if (d_POSTI && d_POSTO)
- multiple = d_FSM.I()+d_FSM.O();
- else if(d_POSTI)
- multiple = d_FSM.I();
- else if(d_POSTO)
- multiple = d_FSM.O();
- else
- throw std::runtime_error ("Not both POSTI and POSTO can be false.");
- //printf("constructor: Multiple = %d\n",multiple);
- set_output_multiple (d_K*multiple);
- //what is the meaning of relative rate for a block with 2 inputs?
- //set_relative_rate ( multiple / ((double) d_FSM.I()) );
- // it turns out that the above gives problems in the scheduler, so
- // let's try (assumption O>I)
- //set_relative_rate ( multiple / ((double) d_FSM.O()) );
- // I am tempted to automate like this
- if(d_FSM.I() <= d_FSM.O())
- set_relative_rate ( multiple / ((double) d_FSM.O()) );
- else
- set_relative_rate ( multiple / ((double) d_FSM.I()) );
-}
-
-
-void
-trellis_siso_f::forecast (int noutput_items, gr_vector_int &ninput_items_required)
-{
- int multiple;
- if (d_POSTI && d_POSTO)
- multiple = d_FSM.I()+d_FSM.O();
- else if(d_POSTI)
- multiple = d_FSM.I();
- else if(d_POSTO)
- multiple = d_FSM.O();
- else
- throw std::runtime_error ("Not both POSTI and POSTO can be false.");
- //printf("forecast: Multiple = %d\n",multiple);
- assert (noutput_items % (d_K*multiple) == 0);
- int input_required1 = d_FSM.I() * (noutput_items/multiple) ;
- int input_required2 = d_FSM.O() * (noutput_items/multiple) ;
- //printf("forecast: Output requirements: %d\n",noutput_items);
- //printf("forecast: Input requirements: %d %d\n",input_required1,input_required2);
- unsigned ninputs = ninput_items_required.size();
- assert(ninputs % 2 == 0);
- for (unsigned int i = 0; i < ninputs/2; i++) {
- ninput_items_required[2*i] = input_required1;
- ninput_items_required[2*i+1] = input_required2;
- }
-}
-
-
-
-
-/* Moved it to "core_algorithms.cc" */
-/*
-inline float min(float a, float b)
-{
- return a <= b ? a : b;
-}
-
-inline float min_star(float a, float b)
-{
- return (a <= b ? a : b)-log(1+exp(a <= b ? a-b : b-a));
-}
-
-void siso_algorithm(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- bool POSTI, bool POSTO,
- float (*p2mymin)(float,float),
- const float *priori, const float *prioro, float *post//,
- //std::vector<float> &alpha,
- //std::vector<float> &beta
- )
-{
- float norm,mm,minm;
- std::vector<float> alpha(S*(K+1));
- std::vector<float> beta(S*(K+1));
-
-
- if(S0<0) { // initial state not specified
- for(int i=0;i<S;i++) alpha[0*S+i]=0;
- }
- else {
- for(int i=0;i<S;i++) alpha[0*S+i]=INF;
- alpha[0*S+S0]=0.0;
- }
-
- for(int k=0;k<K;k++) { // forward recursion
- norm=INF;
- for(int j=0;j<S;j++) {
- minm=INF;
- for(unsigned int i=0;i<PS[j].size();i++) {
- //int i0 = j*I+i;
- mm=alpha[k*S+PS[j][i]]+priori[k*I+PI[j][i]]+prioro[k*O+OS[PS[j][i]*I+PI[j][i]]];
- minm=(*p2mymin)(minm,mm);
- }
- alpha[(k+1)*S+j]=minm;
- if(minm<norm) norm=minm;
- }
- for(int j=0;j<S;j++)
- alpha[(k+1)*S+j]-=norm; // normalize total metrics so they do not explode
- }
-
- if(SK<0) { // final state not specified
- for(int i=0;i<S;i++) beta[K*S+i]=0;
- }
- else {
- for(int i=0;i<S;i++) beta[K*S+i]=INF;
- beta[K*S+SK]=0.0;
- }
-
- for(int k=K-1;k>=0;k--) { // backward recursion
- norm=INF;
- for(int j=0;j<S;j++) {
- minm=INF;
- for(int i=0;i<I;i++) {
- int i0 = j*I+i;
- mm=beta[(k+1)*S+NS[i0]]+priori[k*I+i]+prioro[k*O+OS[i0]];
- minm=(*p2mymin)(minm,mm);
- }
- beta[k*S+j]=minm;
- if(minm<norm) norm=minm;
- }
- for(int j=0;j<S;j++)
- beta[k*S+j]-=norm; // normalize total metrics so they do not explode
- }
-
-
-if (POSTI && POSTO)
-{
- for(int k=0;k<K;k++) { // input combining
- norm=INF;
- for(int i=0;i<I;i++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]];
- minm=(*p2mymin)(minm,mm);
- }
- post[k*(I+O)+i]=minm;
- if(minm<norm) norm=minm;
- }
- for(int i=0;i<I;i++)
- post[k*(I+O)+i]-=norm; // normalize metrics
- }
-
-
- for(int k=0;k<K;k++) { // output combining
- norm=INF;
- for(int n=0;n<O;n++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- for(int i=0;i<I;i++) {
- mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF);
- minm=(*p2mymin)(minm,mm);
- }
- }
- post[k*(I+O)+I+n]=minm;
- if(minm<norm) norm=minm;
- }
- for(int n=0;n<O;n++)
- post[k*(I+O)+I+n]-=norm; // normalize metrics
- }
-}
-else if(POSTI)
-{
- for(int k=0;k<K;k++) { // input combining
- norm=INF;
- for(int i=0;i<I;i++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- mm=alpha[k*S+j]+prioro[k*O+OS[j*I+i]]+beta[(k+1)*S+NS[j*I+i]];
- minm=(*p2mymin)(minm,mm);
- }
- post[k*I+i]=minm;
- if(minm<norm) norm=minm;
- }
- for(int i=0;i<I;i++)
- post[k*I+i]-=norm; // normalize metrics
- }
-}
-else if(POSTO)
-{
- for(int k=0;k<K;k++) { // output combining
- norm=INF;
- for(int n=0;n<O;n++) {
- minm=INF;
- for(int j=0;j<S;j++) {
- for(int i=0;i<I;i++) {
- mm= (n==OS[j*I+i] ? alpha[k*S+j]+priori[k*I+i]+beta[(k+1)*S+NS[j*I+i]] : INF);
- minm=(*p2mymin)(minm,mm);
- }
- }
- post[k*O+n]=minm;
- if(minm<norm) norm=minm;
- }
- for(int n=0;n<O;n++)
- post[k*O+n]-=norm; // normalize metrics
- }
-}
-else
- throw std::runtime_error ("Not both POSTI and POSTO can be false.");
-
-}
-
-*/
-
-
-
-
-int
-trellis_siso_f::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert (input_items.size() == 2*output_items.size());
- int nstreams = output_items.size();
- //printf("general_work:Streams: %d\n",nstreams);
- int multiple;
- if (d_POSTI && d_POSTO)
- multiple = d_FSM.I()+d_FSM.O();
- else if(d_POSTI)
- multiple = d_FSM.I();
- else if(d_POSTO)
- multiple = d_FSM.O();
- else
- throw std::runtime_error ("Not both POSTI and POSTO can be false.");
-
- assert (noutput_items % (d_K*multiple) == 0);
- int nblocks = noutput_items / (d_K*multiple);
- //printf("general_work:Blocks: %d\n",nblocks);
- //for(int i=0;i<ninput_items.size();i++)
- //printf("general_work:Input items available: %d\n",ninput_items[i]);
-
- float (*p2min)(float, float) = NULL;
- if(d_SISO_TYPE == TRELLIS_MIN_SUM)
- p2min = &min;
- else if(d_SISO_TYPE == TRELLIS_SUM_PRODUCT)
- p2min = &min_star;
-
-
- for (int m=0;m<nstreams;m++) {
- const float *in1 = (const float *) input_items[2*m];
- const float *in2 = (const float *) input_items[2*m+1];
- float *out = (float *) output_items[m];
- for (int n=0;n<nblocks;n++) {
- siso_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),
- d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),
- d_K,d_S0,d_SK,
- d_POSTI,d_POSTO,
- p2min,
- &(in1[n*d_K*d_FSM.I()]),&(in2[n*d_K*d_FSM.O()]),
- &(out[n*d_K*multiple])//,
- //d_alpha,d_beta
- );
- }
- }
-
- for (unsigned int i = 0; i < input_items.size()/2; i++) {
- consume(2*i,d_FSM.I() * noutput_items / multiple );
- consume(2*i+1,d_FSM.O() * noutput_items / multiple );
- }
-
- return noutput_items;
-}
diff --git a/gr-trellis/src/lib/trellis_siso_f.h b/gr-trellis/src/lib/trellis_siso_f.h
deleted file mode 100644
index 9341f24683..0000000000
--- a/gr-trellis/src/lib/trellis_siso_f.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_TRELLIS_SISO_F_H
-#define INCLUDED_TRELLIS_SISO_F_H
-
-#include <trellis_api.h>
-#include "fsm.h"
-#include "siso_type.h"
-#include "core_algorithms.h"
-#include <gr_block.h>
-
-class trellis_siso_f;
-typedef boost::shared_ptr<trellis_siso_f> trellis_siso_f_sptr;
-
-TRELLIS_API trellis_siso_f_sptr trellis_make_siso_f (
- const fsm &FSM, // underlying FSM
- int K, // block size in trellis steps
- int S0, // initial state (put -1 if not specified)
- int SK, // final state (put -1 if not specified)
- bool POSTI, // true if you want a-posteriori info about the input symbols to be mux-ed in the output
- bool POSTO, // true if you want a-posteriori info about the output symbols to be mux-ed in the output
- trellis_siso_type_t d_SISO_TYPE // perform "min-sum" or "sum-product" combining
-);
-
-
-/*!
- * \ingroup coding_blk
- */
-class TRELLIS_API trellis_siso_f : public gr_block
-{
- fsm d_FSM;
- int d_K;
- int d_S0;
- int d_SK;
- bool d_POSTI;
- bool d_POSTO;
- trellis_siso_type_t d_SISO_TYPE;
- //std::vector<float> d_alpha;
- //std::vector<float> d_beta;
-
- friend TRELLIS_API trellis_siso_f_sptr trellis_make_siso_f (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- bool POSTI,
- bool POSTO,
- trellis_siso_type_t d_SISO_TYPE);
-
-
- trellis_siso_f (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- bool POSTI,
- bool POSTO,
- trellis_siso_type_t d_SISO_TYPE);
-
-
-public:
- fsm FSM () const { return d_FSM; }
- int K () const { return d_K; }
- int S0 () const { return d_S0; }
- int SK () const { return d_SK; }
- bool POSTI () const { return d_POSTI; }
- bool POSTO () const { return d_POSTO; }
- trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; }
- void forecast (int noutput_items,
- gr_vector_int &ninput_items_required);
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-trellis/src/lib/trellis_siso_f.i b/gr-trellis/src/lib/trellis_siso_f.i
deleted file mode 100644
index 63bfb48c8f..0000000000
--- a/gr-trellis/src/lib/trellis_siso_f.i
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(trellis,siso_f);
-
-trellis_siso_f_sptr trellis_make_siso_f (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- bool POSTI,
- bool POSTO,
- trellis_siso_type_t SISO_TYPE);
-
-
-class trellis_siso_f : public gr_block
-{
-private:
- trellis_siso_f (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- bool POSTI,
- bool POSTO,
- trellis_siso_type_t SISO_TYPE);
-
-public:
- fsm FSM () const { return d_FSM; }
- int K () const { return d_K; }
- int S0 () const { return d_S0; }
- int SK () const { return d_SK; }
- bool POSTI () const { return d_POSTI; }
- bool POSTO () const { return d_POSTO; }
- trellis_siso_type_t SISO_TYPE () const { return d_SISO_TYPE; }
-};
diff --git a/gr-trellis/src/lib/trellis_viterbi_X.cc.t b/gr-trellis/src/lib/trellis_viterbi_X.cc.t
deleted file mode 100644
index cadb89d574..0000000000
--- a/gr-trellis/src/lib/trellis_viterbi_X.cc.t
+++ /dev/null
@@ -1,183 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME@.h>
-#include <gr_io_signature.h>
-#include <assert.h>
-#include <iostream>
-
-static const float INF = 1.0e9;
-
-@SPTR_NAME@
-trellis_make_@BASE_NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK)
-{
- return gnuradio::get_initial_sptr (new @NAME@ (FSM,K,S0,SK));
-}
-
-@NAME@::@NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK)
- : gr_block ("@BASE_NAME@",
- gr_make_io_signature (1, -1, sizeof (float)),
- gr_make_io_signature (1, -1, sizeof (@TYPE@))),
- d_FSM (FSM),
- d_K (K),
- d_S0 (S0),
- d_SK (SK)//,
- //d_trace(FSM.S()*K)
-{
- set_relative_rate (1.0 / ((double) d_FSM.O()));
- set_output_multiple (d_K);
-}
-
-
-void
-@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required)
-{
- assert (noutput_items % d_K == 0);
- int input_required = d_FSM.O() * noutput_items ;
- unsigned ninputs = ninput_items_required.size();
- for (unsigned int i = 0; i < ninputs; i++) {
- ninput_items_required[i] = input_required;
- }
-}
-
-/*
-template
-void viterbi_algorithm<@O_TYPE@>(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- const float *in, @O_TYPE@ *out);
-*/
-
-
-
-/* Moved it to "core_algorithms.cc" */
-/*
-void viterbi_algorithm(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- const float *in, @TYPE@ *out)//,
- //std::vector<int> &trace)
-{
- std::vector<int> trace(S*K);
- std::vector<float> alpha(S*2);
- int alphai;
- float norm,mm,minm;
- int minmi;
- int st;
-
-
- if(S0<0) { // initial state not specified
- for(int i=0;i<S;i++) alpha[0*S+i]=0;
- }
- else {
- for(int i=0;i<S;i++) alpha[0*S+i]=INF;
- alpha[0*S+S0]=0.0;
- }
-
- alphai=0;
- for(int k=0;k<K;k++) {
- norm=INF;
- for(int j=0;j<S;j++) { // for each next state do ACS
- minm=INF;
- minmi=0;
- for(unsigned int i=0;i<PS[j].size();i++) {
- //int i0 = j*I+i;
- if((mm=alpha[alphai*S+PS[j][i]]+in[k*O+OS[PS[j][i]*I+PI[j][i]]])<minm)
- minm=mm,minmi=i;
- }
- trace[k*S+j]=minmi;
- alpha[((alphai+1)%2)*S+j]=minm;
- if(minm<norm) norm=minm;
- }
- for(int j=0;j<S;j++)
- alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode
- alphai=(alphai+1)%2;
- }
-
- if(SK<0) { // final state not specified
- minm=INF;
- minmi=0;
- for(int i=0;i<S;i++)
- if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i;
- st=minmi;
- }
- else {
- st=SK;
- }
-
- for(int k=K-1;k>=0;k--) { // traceback
- int i0=trace[k*S+st];
- out[k]= (@TYPE@) PI[st][i0];
- st=PS[st][i0];
- }
-
-}
-
-*/
-
-
-
-
-int
-@NAME@::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert (input_items.size() == output_items.size());
- int nstreams = input_items.size();
- assert (noutput_items % d_K == 0);
- int nblocks = noutput_items / d_K;
-
- for (int m=0;m<nstreams;m++) {
- const float *in = (const float *) input_items[m];
- @TYPE@ *out = (@TYPE@ *) output_items[m];
- for (int n=0;n<nblocks;n++) {
- viterbi_algorithm(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,&(in[n*d_K*d_FSM.O()]),&(out[n*d_K]));//,d_trace);
- }
- }
-
- consume_each (d_FSM.O() * noutput_items );
- return noutput_items;
-}
diff --git a/gr-trellis/src/lib/trellis_viterbi_X.h.t b/gr-trellis/src/lib/trellis_viterbi_X.h.t
deleted file mode 100644
index c0400d3410..0000000000
--- a/gr-trellis/src/lib/trellis_viterbi_X.h.t
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <trellis_api.h>
-#include "fsm.h"
-#include <gr_block.h>
-#include "core_algorithms.h"
-
-class @NAME@;
-typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
-
-TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK);
-
-
-
-/*!
- * \ingroup coding_blk
- */
-class TRELLIS_API @NAME@ : public gr_block
-{
- fsm d_FSM;
- int d_K;
- int d_S0;
- int d_SK;
- //std::vector<int> d_trace;
-
- friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK);
-
-
- @NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK);
-
-
-public:
- fsm FSM () const { return d_FSM; }
- int K () const { return d_K; }
- int S0 () const { return d_S0; }
- int SK () const { return d_SK; }
- //std::vector<int> trace () const { return d_trace; }
- void forecast (int noutput_items,
- gr_vector_int &ninput_items_required);
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-
-
-
-
-
-
-
-
-#endif
diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t b/gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t
deleted file mode 100644
index b337b6f16c..0000000000
--- a/gr-trellis/src/lib/trellis_viterbi_combined_XX.cc.t
+++ /dev/null
@@ -1,191 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <@NAME@.h>
-#include <gr_io_signature.h>
-#include <assert.h>
-#include <iostream>
-
-static const float INF = 1.0e9;
-
-@SPTR_NAME@
-trellis_make_@BASE_NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE)
-{
- return gnuradio::get_initial_sptr (new @NAME@ (FSM,K,S0,SK,D,TABLE,TYPE));
-}
-
-@NAME@::@NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE)
- : gr_block ("@BASE_NAME@",
- gr_make_io_signature (1, -1, sizeof (@I_TYPE@)),
- gr_make_io_signature (1, -1, sizeof (@O_TYPE@))),
- d_FSM (FSM),
- d_K (K),
- d_S0 (S0),
- d_SK (SK),
- d_D (D),
- d_TABLE (TABLE),
- d_TYPE (TYPE)//,
- //d_trace(FSM.S()*K)
-{
- set_relative_rate (1.0 / ((double) d_D));
- set_output_multiple (d_K);
-}
-
-
-void @NAME@::set_TABLE(const std::vector<@I_TYPE@> &table)
-{
- d_TABLE = table;
-}
-
-void
-@NAME@::forecast (int noutput_items, gr_vector_int &ninput_items_required)
-{
- assert (noutput_items % d_K == 0);
- int input_required = d_D * noutput_items ;
- unsigned ninputs = ninput_items_required.size();
- for (unsigned int i = 0; i < ninputs; i++) {
- ninput_items_required[i] = input_required;
- }
-}
-
-
-
-
-/*
-void viterbi_algorithm_combined(int I, int S, int O,
- const std::vector<int> &NS,
- const std::vector<int> &OS,
- const std::vector< std::vector<int> > &PS,
- const std::vector< std::vector<int> > &PI,
- int K,
- int S0,int SK,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE,
- const @I_TYPE@ *in, @O_TYPE@ *out)//,
- //std::vector<int> &trace)
-{
- std::vector<int> trace(S*K);
- std::vector<float> alpha(S*2);
- float *metric = new float[O];
- int alphai;
- float norm,mm,minm;
- int minmi;
- int st;
-
- if(S0<0) { // initial state not specified
- for(int i=0;i<S;i++) alpha[0*S+i]=0;
- }
- else {
- for(int i=0;i<S;i++) alpha[0*S+i]=INF;
- alpha[0*S+S0]=0.0;
- }
-
- alphai=0;
- for(int k=0;k<K;k++) {
- calc_metric(O, D, TABLE, &(in[k*D]), metric,TYPE); // calc metrics
- norm=INF;
- for(int j=0;j<S;j++) { // for each next state do ACS
- minm=INF;
- minmi=0;
- for(unsigned int i=0;i<PS[j].size();i++) {
- //int i0 = j*I+i;
- if((mm=alpha[alphai*S+PS[j][i]]+metric[OS[PS[j][i]*I+PI[j][i]]])<minm)
- minm=mm,minmi=i;
- }
- trace[k*S+j]=minmi;
- alpha[((alphai+1)%2)*S+j]=minm;
- if(minm<norm) norm=minm;
- }
- for(int j=0;j<S;j++)
- alpha[((alphai+1)%2)*S+j]-=norm; // normalize total metrics so they do not explode
- alphai=(alphai+1)%2;
- }
-
- if(SK<0) { // final state not specified
- minm=INF;
- minmi=0;
- for(int i=0;i<S;i++)
- if((mm=alpha[alphai*S+i])<minm) minm=mm,minmi=i;
- st=minmi;
- }
- else {
- st=SK;
- }
-
- for(int k=K-1;k>=0;k--) { // traceback
- int i0=trace[k*S+st];
- out[k]= (@O_TYPE@) PI[st][i0];
- st=PS[st][i0];
- }
-
- delete [] metric;
-
-}
-
-
-*/
-
-
-
-int
-@NAME@::general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- assert (input_items.size() == output_items.size());
- int nstreams = input_items.size();
- assert (noutput_items % d_K == 0);
- int nblocks = noutput_items / d_K;
-
- for (int m=0;m<nstreams;m++) {
- const @I_TYPE@ *in = (const @I_TYPE@ *) input_items[m];
- @O_TYPE@ *out = (@O_TYPE@ *) output_items[m];
- for (int n=0;n<nblocks;n++) {
- viterbi_algorithm_combined(d_FSM.I(),d_FSM.S(),d_FSM.O(),d_FSM.NS(),d_FSM.OS(),d_FSM.PS(),d_FSM.PI(),d_K,d_S0,d_SK,d_D,d_TABLE,d_TYPE,&(in[n*d_K*d_D]),&(out[n*d_K]));//,d_trace);
- }
- }
-
- consume_each (d_D * noutput_items );
- return noutput_items;
-}
diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t b/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t
deleted file mode 100644
index f0a64c3317..0000000000
--- a/gr-trellis/src/lib/trellis_viterbi_combined_XX.h.t
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-#ifndef @GUARD_NAME@
-#define @GUARD_NAME@
-
-#include <trellis_api.h>
-#include "fsm.h"
-#include <gr_block.h>
-#include "calc_metric.h"
-#include "core_algorithms.h"
-
-class @NAME@;
-typedef boost::shared_ptr<@NAME@> @SPTR_NAME@;
-
-TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
-
-
-/*!
- * \ingroup coding_blk
- */
-class TRELLIS_API @NAME@ : public gr_block
-{
- fsm d_FSM;
- int d_K;
- int d_S0;
- int d_SK;
- int d_D;
- std::vector<@I_TYPE@> d_TABLE;
- gr::digital::trellis_metric_type_t d_TYPE;
- //std::vector<int> d_trace;
-
- friend TRELLIS_API @SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
-
-
- @NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
-
-
-public:
- fsm FSM () const { return d_FSM; }
- int K () const { return d_K; }
- int S0 () const { return d_S0; }
- int SK () const { return d_SK; }
- int D () const { return d_D; }
- std::vector<@I_TYPE@> TABLE () const { return d_TABLE; }
- gr::digital::trellis_metric_type_t TYPE () const { return d_TYPE; }
- //std::vector<int> trace () const { return d_trace; }
- void set_TABLE (const std::vector<@I_TYPE@> &table);
- void forecast (int noutput_items,
- gr_vector_int &ninput_items_required);
- int general_work (int noutput_items,
- gr_vector_int &ninput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif
diff --git a/gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t b/gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t
deleted file mode 100644
index 2687a2056d..0000000000
--- a/gr-trellis/src/lib/trellis_viterbi_combined_XX.i.t
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-// @WARNING@
-
-GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
-
-@SPTR_NAME@ trellis_make_@BASE_NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
-
-
-class @NAME@ : public gr_block
-{
-private:
- @NAME@ (
- const fsm &FSM,
- int K,
- int S0,
- int SK,
- int D,
- const std::vector<@I_TYPE@> &TABLE,
- gr::digital::trellis_metric_type_t TYPE);
-
-public:
- fsm FSM () const { return d_FSM; }
- int K () const { return d_K; }
- int S0 () const { return d_S0; }
- int SK () const { return d_SK; }
- int D () const { return d_D; }
- std::vector<@I_TYPE@> TABLE () const { return d_TABLE; }
- gr::digital::trellis_metric_type_t TYPE () const { return d_TYPE; }
- //std::vector<short> trace () const { return d_trace; }
- void set_TABLE (const std::vector<@I_TYPE@> &table);
-};
diff --git a/gr-trellis/swig/CMakeLists.txt b/gr-trellis/swig/CMakeLists.txt
new file mode 100644
index 0000000000..36a5f850ad
--- /dev/null
+++ b/gr-trellis/swig/CMakeLists.txt
@@ -0,0 +1,57 @@
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+# Setup swig generation
+########################################################################
+include(GrPython)
+include(GrSwig)
+
+set(GR_SWIG_INCLUDE_DIRS
+ ${GR_TRELLIS_INCLUDE_DIRS}
+ ${GR_DIGITAL_INCLUDE_DIRS}
+ ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
+)
+
+set(GR_SWIG_LIBRARIES gnuradio-trellis gnuradio-digital)
+
+if(ENABLE_GR_CTRLPORT)
+ ADD_DEFINITIONS(-DGR_CTRLPORT)
+endif(ENABLE_GR_CTRLPORT)
+
+# Setup swig docs to depend on includes and pull in from build directory
+set(GR_SWIG_TARGET_DEPS trellis_generated_includes)
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/trellis_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib)
+
+GR_SWIG_MAKE(trellis_swig trellis_swig.i)
+
+GR_SWIG_INSTALL(
+ TARGETS trellis_swig
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/trellis
+ COMPONENT "trellis_python"
+)
+
+install(
+ FILES
+ trellis_swig.i
+ ${CMAKE_CURRENT_BINARY_DIR}/trellis_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "trellis_swig"
+)
diff --git a/gr-trellis/swig/trellis_swig.i b/gr-trellis/swig/trellis_swig.i
new file mode 100644
index 0000000000..5732aca1fb
--- /dev/null
+++ b/gr-trellis/swig/trellis_swig.i
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#define TRELLIS_API
+#define DIGITAL_API
+
+%include "gnuradio.i"
+
+//load generated python docstrings
+%include "trellis_swig_doc.i"
+
+%include "digital/metric_type.h"
+%include "digital/constellation.h"
+%include "trellis/siso_type.h"
+%include "trellis/fsm.h"
+%include "trellis/interleaver.h"
+
+%{
+#include "trellis/constellation_metrics_cf.h"
+#include "trellis/permutation.h"
+#include "trellis/siso_combined_f.h"
+#include "trellis/siso_f.h"
+#include "trellis/encoder_bb.h"
+#include "trellis/encoder_bs.h"
+#include "trellis/encoder_bi.h"
+#include "trellis/encoder_ss.h"
+#include "trellis/encoder_si.h"
+#include "trellis/encoder_ii.h"
+#include "trellis/sccc_encoder_bb.h"
+#include "trellis/sccc_encoder_bs.h"
+#include "trellis/sccc_encoder_bi.h"
+#include "trellis/sccc_encoder_ss.h"
+#include "trellis/sccc_encoder_si.h"
+#include "trellis/sccc_encoder_ii.h"
+#include "trellis/pccc_encoder_bb.h"
+#include "trellis/pccc_encoder_bs.h"
+#include "trellis/pccc_encoder_bi.h"
+#include "trellis/pccc_encoder_ss.h"
+#include "trellis/pccc_encoder_si.h"
+#include "trellis/pccc_encoder_ii.h"
+#include "trellis/metrics_s.h"
+#include "trellis/metrics_i.h"
+#include "trellis/metrics_f.h"
+#include "trellis/metrics_c.h"
+#include "trellis/pccc_decoder_b.h"
+#include "trellis/pccc_decoder_s.h"
+#include "trellis/pccc_decoder_i.h"
+#include "trellis/pccc_decoder_combined_fb.h"
+#include "trellis/pccc_decoder_combined_fs.h"
+#include "trellis/pccc_decoder_combined_fi.h"
+#include "trellis/pccc_decoder_combined_cb.h"
+#include "trellis/pccc_decoder_combined_cs.h"
+#include "trellis/pccc_decoder_combined_ci.h"
+#include "trellis/viterbi_b.h"
+#include "trellis/viterbi_s.h"
+#include "trellis/viterbi_i.h"
+#include "trellis/viterbi_combined_sb.h"
+#include "trellis/viterbi_combined_ss.h"
+#include "trellis/viterbi_combined_si.h"
+#include "trellis/viterbi_combined_ib.h"
+#include "trellis/viterbi_combined_is.h"
+#include "trellis/viterbi_combined_ii.h"
+#include "trellis/viterbi_combined_fb.h"
+#include "trellis/viterbi_combined_fs.h"
+#include "trellis/viterbi_combined_fi.h"
+#include "trellis/viterbi_combined_cb.h"
+#include "trellis/viterbi_combined_cs.h"
+#include "trellis/viterbi_combined_ci.h"
+#include "trellis/sccc_decoder_b.h"
+#include "trellis/sccc_decoder_s.h"
+#include "trellis/sccc_decoder_i.h"
+#include "trellis/sccc_decoder_combined_fb.h"
+#include "trellis/sccc_decoder_combined_fs.h"
+#include "trellis/sccc_decoder_combined_fi.h"
+#include "trellis/sccc_decoder_combined_cb.h"
+#include "trellis/sccc_decoder_combined_cs.h"
+#include "trellis/sccc_decoder_combined_ci.h"
+%}
+
+%include "trellis/constellation_metrics_cf.h"
+%include "trellis/permutation.h"
+%include "trellis/siso_combined_f.h"
+%include "trellis/siso_f.h"
+%include "trellis/encoder_bb.h"
+%include "trellis/encoder_bs.h"
+%include "trellis/encoder_bi.h"
+%include "trellis/encoder_ss.h"
+%include "trellis/encoder_si.h"
+%include "trellis/encoder_ii.h"
+%include "trellis/sccc_encoder_bb.h"
+%include "trellis/sccc_encoder_bs.h"
+%include "trellis/sccc_encoder_bi.h"
+%include "trellis/sccc_encoder_ss.h"
+%include "trellis/sccc_encoder_si.h"
+%include "trellis/sccc_encoder_ii.h"
+%include "trellis/pccc_encoder_bb.h"
+%include "trellis/pccc_encoder_bs.h"
+%include "trellis/pccc_encoder_bi.h"
+%include "trellis/pccc_encoder_ss.h"
+%include "trellis/pccc_encoder_si.h"
+%include "trellis/pccc_encoder_ii.h"
+%include "trellis/metrics_s.h"
+%include "trellis/metrics_i.h"
+%include "trellis/metrics_f.h"
+%include "trellis/metrics_c.h"
+%include "trellis/pccc_decoder_b.h"
+%include "trellis/pccc_decoder_s.h"
+%include "trellis/pccc_decoder_i.h"
+%include "trellis/pccc_decoder_combined_fb.h"
+%include "trellis/pccc_decoder_combined_fs.h"
+%include "trellis/pccc_decoder_combined_fi.h"
+%include "trellis/pccc_decoder_combined_cb.h"
+%include "trellis/pccc_decoder_combined_cs.h"
+%include "trellis/pccc_decoder_combined_ci.h"
+%include "trellis/viterbi_b.h"
+%include "trellis/viterbi_s.h"
+%include "trellis/viterbi_i.h"
+%include "trellis/viterbi_combined_sb.h"
+%include "trellis/viterbi_combined_ss.h"
+%include "trellis/viterbi_combined_si.h"
+%include "trellis/viterbi_combined_ib.h"
+%include "trellis/viterbi_combined_is.h"
+%include "trellis/viterbi_combined_ii.h"
+%include "trellis/viterbi_combined_fb.h"
+%include "trellis/viterbi_combined_fs.h"
+%include "trellis/viterbi_combined_fi.h"
+%include "trellis/viterbi_combined_cb.h"
+%include "trellis/viterbi_combined_cs.h"
+%include "trellis/viterbi_combined_ci.h"
+%include "trellis/sccc_decoder_b.h"
+%include "trellis/sccc_decoder_s.h"
+%include "trellis/sccc_decoder_i.h"
+%include "trellis/sccc_decoder_combined_fb.h"
+%include "trellis/sccc_decoder_combined_fs.h"
+%include "trellis/sccc_decoder_combined_fi.h"
+%include "trellis/sccc_decoder_combined_cb.h"
+%include "trellis/sccc_decoder_combined_cs.h"
+%include "trellis/sccc_decoder_combined_ci.h"
+
+GR_SWIG_BLOCK_MAGIC2(trellis, constellation_metrics_cf);
+GR_SWIG_BLOCK_MAGIC2(trellis, permutation);
+GR_SWIG_BLOCK_MAGIC2(trellis, siso_combined_f);
+GR_SWIG_BLOCK_MAGIC2(trellis, siso_f);
+GR_SWIG_BLOCK_MAGIC2(trellis, encoder_bb);
+GR_SWIG_BLOCK_MAGIC2(trellis, encoder_bs);
+GR_SWIG_BLOCK_MAGIC2(trellis, encoder_bi);
+GR_SWIG_BLOCK_MAGIC2(trellis, encoder_ss);
+GR_SWIG_BLOCK_MAGIC2(trellis, encoder_si);
+GR_SWIG_BLOCK_MAGIC2(trellis, encoder_ii);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_encoder_bb);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_encoder_bs);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_encoder_bi);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_encoder_ss);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_encoder_si);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_encoder_ii);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_encoder_bb);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_encoder_bs);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_encoder_bi);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_encoder_ss);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_encoder_si);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_encoder_ii);
+GR_SWIG_BLOCK_MAGIC2(trellis, metrics_s);
+GR_SWIG_BLOCK_MAGIC2(trellis, metrics_i);
+GR_SWIG_BLOCK_MAGIC2(trellis, metrics_f);
+GR_SWIG_BLOCK_MAGIC2(trellis, metrics_c);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_b);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_s);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_i);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_combined_fb);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_combined_fs);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_combined_fi);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_combined_cb);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_combined_cs);
+GR_SWIG_BLOCK_MAGIC2(trellis, pccc_decoder_combined_ci);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_b);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_s);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_i);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_sb);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_ss);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_si);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_ib);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_is);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_ii);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_fb);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_fs);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_fi);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_cb);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_cs);
+GR_SWIG_BLOCK_MAGIC2(trellis, viterbi_combined_ci);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_b);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_s);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_i);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_combined_fb);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_combined_fs);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_combined_fi);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_combined_cb);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_combined_cs);
+GR_SWIG_BLOCK_MAGIC2(trellis, sccc_decoder_combined_ci);
diff --git a/gr-uhd/examples/grc/uhd_dpsk_mod.grc b/gr-uhd/examples/grc/uhd_dpsk_mod.grc
index 18ae9c3db7..9caafbb6ac 100644
--- a/gr-uhd/examples/grc/uhd_dpsk_mod.grc
+++ b/gr-uhd/examples/grc/uhd_dpsk_mod.grc
@@ -281,10 +281,10 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
+ <key>blocks_multiply_const_vxx</key>
<param>
<key>id</key>
- <value>gr_multiply_const_vxx_0</value>
+ <value>blocks_multiply_const_vxx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -2218,7 +2218,7 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_0</source_block_id>
+ <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
<sink_block_id>uhd_usrp_sink_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -2231,7 +2231,7 @@
</connection>
<connection>
<source_block_id>digital_dxpsk_mod_0</source_block_id>
- <sink_block_id>gr_multiply_const_vxx_0</sink_block_id>
+ <sink_block_id>blocks_multiply_const_vxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-uhd/examples/grc/uhd_two_tone_loopback.grc b/gr-uhd/examples/grc/uhd_two_tone_loopback.grc
index b186c2f2bc..1884dd3ebf 100644
--- a/gr-uhd/examples/grc/uhd_two_tone_loopback.grc
+++ b/gr-uhd/examples/grc/uhd_two_tone_loopback.grc
@@ -2194,10 +2194,10 @@
</param>
</block>
<block>
- <key>gr_add_xx</key>
+ <key>blocks_add_xx</key>
<param>
<key>id</key>
- <value>gr_add_xx</value>
+ <value>blocks_add_xx</value>
</param>
<param>
<key>_enabled</key>
@@ -2260,7 +2260,7 @@
</param>
</block>
<connection>
- <source_block_id>gr_add_xx</source_block_id>
+ <source_block_id>blocks_add_xx</source_block_id>
<sink_block_id>uhd_usrp_sink_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
@@ -2273,19 +2273,19 @@
</connection>
<connection>
<source_block_id>analog_sig_source_x_0</source_block_id>
- <sink_block_id>gr_add_xx</sink_block_id>
+ <sink_block_id>blocks_add_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>analog_sig_source_x_1</source_block_id>
- <sink_block_id>gr_add_xx</sink_block_id>
+ <sink_block_id>blocks_add_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>1</sink_key>
</connection>
<connection>
<source_block_id>analog_noise_source_x_0</source_block_id>
- <sink_block_id>gr_add_xx</sink_block_id>
+ <sink_block_id>blocks_add_xx</sink_block_id>
<source_key>0</source_key>
<sink_key>2</sink_key>
</connection>
diff --git a/gr-uhd/examples/grc/uhd_tx_dpsk.grc b/gr-uhd/examples/grc/uhd_tx_dpsk.grc
index 281ba84295..38318bef4b 100644
--- a/gr-uhd/examples/grc/uhd_tx_dpsk.grc
+++ b/gr-uhd/examples/grc/uhd_tx_dpsk.grc
@@ -1035,10 +1035,10 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
+ <key>blocks_multiply_const_vxx</key>
<param>
<key>id</key>
- <value>gr_multiply_const_vxx_0</value>
+ <value>blocks_multiply_const_vxx_0</value>
</param>
<param>
<key>_enabled</key>
@@ -1214,20 +1214,20 @@
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_0</source_block_id>
+ <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
<sink_block_id>wxgui_fftsink2_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
- <source_block_id>gr_multiply_const_vxx_0</source_block_id>
+ <source_block_id>blocks_multiply_const_vxx_0</source_block_id>
<sink_block_id>uhd_usrp_sink_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>digital_dxpsk_mod_0</source_block_id>
- <sink_block_id>gr_multiply_const_vxx_0</sink_block_id>
+ <sink_block_id>blocks_multiply_const_vxx_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-uhd/examples/grc/uhd_wbfm_receive.grc b/gr-uhd/examples/grc/uhd_wbfm_receive.grc
index 7f14123f2e..943e82cf31 100644
--- a/gr-uhd/examples/grc/uhd_wbfm_receive.grc
+++ b/gr-uhd/examples/grc/uhd_wbfm_receive.grc
@@ -347,10 +347,10 @@
</param>
</block>
<block>
- <key>gr_multiply_const_vxx</key>
+ <key>blocks_multiply_const_vxx</key>
<param>
<key>id</key>
- <value>gr_multiply_const_vxx</value>
+ <value>blocks_multiply_const_vxx</value>
</param>
<param>
<key>_enabled</key>
@@ -1373,14 +1373,14 @@
</param>
</block>
<connection>
- <source_block_id>gr_multiply_const_vxx</source_block_id>
+ <source_block_id>blocks_multiply_const_vxx</source_block_id>
<sink_block_id>audio_sink</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>blks2_wfm_rcv</source_block_id>
- <sink_block_id>gr_multiply_const_vxx</sink_block_id>
+ <sink_block_id>blocks_multiply_const_vxx</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
diff --git a/gr-utils/CMakeLists.txt b/gr-utils/CMakeLists.txt
index 38bb245c61..e7b43f4c82 100644
--- a/gr-utils/CMakeLists.txt
+++ b/gr-utils/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011 Free Software Foundation, Inc.
+# Copyright 2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -48,6 +48,6 @@ CPACK_COMPONENT("utils"
########################################################################
# Add subdirectories
########################################################################
-add_subdirectory(src/python)
+add_subdirectory(python)
endif(ENABLE_GR_UTILS)
diff --git a/gr-utils/src/python/CMakeLists.txt b/gr-utils/python/CMakeLists.txt
index 4b956904f3..4b956904f3 100644
--- a/gr-utils/src/python/CMakeLists.txt
+++ b/gr-utils/python/CMakeLists.txt
diff --git a/gr-utils/src/python/README.plot b/gr-utils/python/README.plot
index 60f14c669c..60f14c669c 100644
--- a/gr-utils/src/python/README.plot
+++ b/gr-utils/python/README.plot
diff --git a/gr-utils/src/python/create-gnuradio-out-of-tree-project b/gr-utils/python/create-gnuradio-out-of-tree-project
index d5e32c92b8..d5e32c92b8 100755
--- a/gr-utils/src/python/create-gnuradio-out-of-tree-project
+++ b/gr-utils/python/create-gnuradio-out-of-tree-project
diff --git a/gr-utils/src/python/gr_plot_char b/gr-utils/python/gr_plot_char
index a2b93a63c6..a2b93a63c6 100755
--- a/gr-utils/src/python/gr_plot_char
+++ b/gr-utils/python/gr_plot_char
diff --git a/gr-utils/src/python/gr_plot_const b/gr-utils/python/gr_plot_const
index 749ad035b5..749ad035b5 100755
--- a/gr-utils/src/python/gr_plot_const
+++ b/gr-utils/python/gr_plot_const
diff --git a/gr-utils/src/python/gr_plot_fft b/gr-utils/python/gr_plot_fft
index 4343481645..4343481645 100644
--- a/gr-utils/src/python/gr_plot_fft
+++ b/gr-utils/python/gr_plot_fft
diff --git a/gr-utils/src/python/gr_plot_fft_c b/gr-utils/python/gr_plot_fft_c
index 43e808d95a..43e808d95a 100755
--- a/gr-utils/src/python/gr_plot_fft_c
+++ b/gr-utils/python/gr_plot_fft_c
diff --git a/gr-utils/src/python/gr_plot_fft_f b/gr-utils/python/gr_plot_fft_f
index dee9b17dea..dee9b17dea 100755
--- a/gr-utils/src/python/gr_plot_fft_f
+++ b/gr-utils/python/gr_plot_fft_f
diff --git a/gr-utils/src/python/gr_plot_float b/gr-utils/python/gr_plot_float
index 22806e48ae..22806e48ae 100755
--- a/gr-utils/src/python/gr_plot_float
+++ b/gr-utils/python/gr_plot_float
diff --git a/gr-utils/src/python/gr_plot_int b/gr-utils/python/gr_plot_int
index 355ddf0189..355ddf0189 100755
--- a/gr-utils/src/python/gr_plot_int
+++ b/gr-utils/python/gr_plot_int
diff --git a/gr-utils/src/python/gr_plot_iq b/gr-utils/python/gr_plot_iq
index bf8077b6b4..bf8077b6b4 100755
--- a/gr-utils/src/python/gr_plot_iq
+++ b/gr-utils/python/gr_plot_iq
diff --git a/gr-utils/src/python/gr_plot_psd b/gr-utils/python/gr_plot_psd
index 059ca6b645..059ca6b645 100644
--- a/gr-utils/src/python/gr_plot_psd
+++ b/gr-utils/python/gr_plot_psd
diff --git a/gr-utils/src/python/gr_plot_psd_c b/gr-utils/python/gr_plot_psd_c
index fff2bff0f2..fff2bff0f2 100755
--- a/gr-utils/src/python/gr_plot_psd_c
+++ b/gr-utils/python/gr_plot_psd_c
diff --git a/gr-utils/src/python/gr_plot_psd_f b/gr-utils/python/gr_plot_psd_f
index ec67994797..ec67994797 100755
--- a/gr-utils/src/python/gr_plot_psd_f
+++ b/gr-utils/python/gr_plot_psd_f
diff --git a/gr-utils/src/python/gr_plot_qt b/gr-utils/python/gr_plot_qt
index 153359f0c6..153359f0c6 100755
--- a/gr-utils/src/python/gr_plot_qt
+++ b/gr-utils/python/gr_plot_qt
diff --git a/gr-utils/src/python/gr_plot_short b/gr-utils/python/gr_plot_short
index 702a2a94a6..702a2a94a6 100755
--- a/gr-utils/src/python/gr_plot_short
+++ b/gr-utils/python/gr_plot_short
diff --git a/gr-utils/src/python/gr_read_file_metadata b/gr-utils/python/gr_read_file_metadata
index cf0cd5b116..cf0cd5b116 100644
--- a/gr-utils/src/python/gr_read_file_metadata
+++ b/gr-utils/python/gr_read_file_metadata
diff --git a/gr-utils/src/python/grcc b/gr-utils/python/grcc
index 7e5665dc05..7e5665dc05 100755
--- a/gr-utils/src/python/grcc
+++ b/gr-utils/python/grcc
diff --git a/gr-utils/src/python/plot_data.py b/gr-utils/python/plot_data.py
index 2ae3b1d5b3..2ae3b1d5b3 100644
--- a/gr-utils/src/python/plot_data.py
+++ b/gr-utils/python/plot_data.py
diff --git a/gr-utils/src/python/plot_fft_base.py b/gr-utils/python/plot_fft_base.py
index 4afdc3a360..4afdc3a360 100755
--- a/gr-utils/src/python/plot_fft_base.py
+++ b/gr-utils/python/plot_fft_base.py
diff --git a/gr-utils/src/python/plot_psd_base.py b/gr-utils/python/plot_psd_base.py
index fe3c9e12b7..fe3c9e12b7 100755
--- a/gr-utils/src/python/plot_psd_base.py
+++ b/gr-utils/python/plot_psd_base.py
diff --git a/gr-utils/src/python/pyqt_filter.py b/gr-utils/python/pyqt_filter.py
index 0c781f2347..0c781f2347 100644
--- a/gr-utils/src/python/pyqt_filter.py
+++ b/gr-utils/python/pyqt_filter.py
diff --git a/gr-utils/src/python/pyqt_filter.ui b/gr-utils/python/pyqt_filter.ui
index 9853352e2e..9853352e2e 100644
--- a/gr-utils/src/python/pyqt_filter.ui
+++ b/gr-utils/python/pyqt_filter.ui
diff --git a/gr-utils/src/python/pyqt_plot.py b/gr-utils/python/pyqt_plot.py
index 5650135abf..5650135abf 100644
--- a/gr-utils/src/python/pyqt_plot.py
+++ b/gr-utils/python/pyqt_plot.py
diff --git a/gr-utils/src/python/pyqt_plot.ui b/gr-utils/python/pyqt_plot.ui
index 55c72fda26..55c72fda26 100644
--- a/gr-utils/src/python/pyqt_plot.ui
+++ b/gr-utils/python/pyqt_plot.ui
diff --git a/gr-video-sdl/CMakeLists.txt b/gr-video-sdl/CMakeLists.txt
index 57ffde8945..6dfec7d671 100644
--- a/gr-video-sdl/CMakeLists.txt
+++ b/gr-video-sdl/CMakeLists.txt
@@ -35,7 +35,8 @@ GR_REGISTER_COMPONENT("gr-video-sdl" ENABLE_GR_VIDEO_SDL
)
GR_SET_GLOBAL(GR_VIDEO_SDL_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR}/src
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_BINARY_DIR}/include
)
########################################################################
@@ -80,7 +81,12 @@ CPACK_COMPONENT("video_sdl_swig"
########################################################################
# Add subdirectories
########################################################################
-add_subdirectory(src)
+add_subdirectory(include/video_sdl)
+add_subdirectory(lib)
+if(ENABLE_PYTHON)
+ add_subdirectory(swig)
+ add_subdirectory(python)
+endif(ENABLE_PYTHON)
########################################################################
# Create Pkg Config File
diff --git a/gr-trellis/src/CMakeLists.txt b/gr-video-sdl/include/video_sdl/CMakeLists.txt
index 56db84a3e4..8831fd8172 100644
--- a/gr-trellis/src/CMakeLists.txt
+++ b/gr-video-sdl/include/video_sdl/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2012 Free Software Foundation, Inc.
+# Copyright 2011,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,11 +18,13 @@
# Boston, MA 02110-1301, USA.
########################################################################
-# Add subdirectories
+# Install header files
########################################################################
-add_subdirectory(lib)
-if(ENABLE_PYTHON)
- add_subdirectory(python)
- add_subdirectory(examples/python)
- add_subdirectory(examples/grc)
-endif(ENABLE_PYTHON)
+install(FILES
+ api.h
+ sink_s.h
+ sink_uc.h
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/video_sdl
+ COMPONENT "video_sdl_devel"
+)
+
diff --git a/gr-video-sdl/src/video_sdl_api.h b/gr-video-sdl/include/video_sdl/api.h
index 5418f86f03..5418f86f03 100644
--- a/gr-video-sdl/src/video_sdl_api.h
+++ b/gr-video-sdl/include/video_sdl/api.h
diff --git a/gr-video-sdl/include/video_sdl/sink_s.h b/gr-video-sdl/include/video_sdl/sink_s.h
new file mode 100644
index 0000000000..2e2a9085e4
--- /dev/null
+++ b/gr-video-sdl/include/video_sdl/sink_s.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_VIDEO_SDL_SINK_S_H
+#define INCLUDED_VIDEO_SDL_SINK_S_H
+
+#include <video_sdl/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace video_sdl {
+
+ /*!
+ * \brief video sink using SDL
+ *
+ * input signature is one, two or three streams of signed short.
+ * One stream: stream is grey (Y)
+ * two streems: first is grey (Y), second is alternating U and V
+ * Three streams: first is grey (Y), second is U, third is V
+ * Input samples must be in the range [0,255].
+ */
+ class VIDEO_SDL_API sink_s : virtual public gr_sync_block
+ {
+ public:
+ // gr::video_sdl::sink_s::sptr
+ typedef boost::shared_ptr<sink_s> sptr;
+
+ static sptr make(double framerate,
+ int width, int height,
+ unsigned int format,
+ int dst_width, int dst_height);
+ };
+
+ } /* namespace video_sdl */
+} /* namespace gr */
+
+#endif /* INCLUDED_VIDEO_SDL_SINK_S_H */
diff --git a/gr-video-sdl/include/video_sdl/sink_uc.h b/gr-video-sdl/include/video_sdl/sink_uc.h
new file mode 100644
index 0000000000..215847fc0b
--- /dev/null
+++ b/gr-video-sdl/include/video_sdl/sink_uc.h
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_VIDEO_SDL_SINK_UC_H
+#define INCLUDED_VIDEO_SDL_SINK_UC_H
+
+#include <video_sdl/api.h>
+#include <gr_sync_block.h>
+
+namespace gr {
+ namespace video_sdl {
+
+ /*!
+ * \brief video sink using SDL
+ *
+ * input signature is one, two or three streams of uchar.
+ * One stream: stream is grey (Y)
+ * two streems: first is grey (Y), second is alternating U and V
+ * Three streams: first is grey (Y), second is U, third is V
+ * Input samples must be in the range [0,255].
+ */
+ class VIDEO_SDL_API sink_uc : virtual public gr_sync_block
+ {
+ public:
+ // gr::video_sdl::sink_uc::sptr
+ typedef boost::shared_ptr<sink_uc> sptr;
+
+ static sptr make(double framerate,
+ int width, int height,
+ unsigned int format,
+ int dst_width, int dst_height);
+ };
+
+ } /* namespace video_sdl */
+} /* namespace gr */
+
+#endif /* INCLUDED_VIDEO_SDL_SINK_UC_H */
diff --git a/gr-video-sdl/lib/CMakeLists.txt b/gr-video-sdl/lib/CMakeLists.txt
new file mode 100644
index 0000000000..5175412ad8
--- /dev/null
+++ b/gr-video-sdl/lib/CMakeLists.txt
@@ -0,0 +1,56 @@
+# Copyright 2011,2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+# Setup the include and linker paths
+########################################################################
+include_directories(
+ ${GR_VIDEO_SDL_INCLUDE_DIRS}
+ ${GNURADIO_CORE_INCLUDE_DIRS}
+)
+
+include_directories(${Boost_INCLUDE_DIRS})
+link_directories(${Boost_LIBRARY_DIRS})
+
+include_directories(${SDL_INCLUDE_DIR})
+
+if(ENABLE_GR_CTRLPORT)
+ ADD_DEFINITIONS(-DGR_CTRLPORT)
+endif(ENABLE_GR_CTRLPORT)
+
+########################################################################
+# Setup library
+########################################################################
+list(APPEND video_sdl_sources
+ sink_s_impl.cc
+ sink_uc_impl.cc
+)
+
+list(APPEND video_sdl_libs
+ gnuradio-core
+ ${Boost_LIBRARIES}
+ ${SDL_LIBRARY}
+)
+
+
+add_library(gnuradio-video-sdl SHARED ${video_sdl_sources})
+target_link_libraries(gnuradio-video-sdl ${video_sdl_libs})
+GR_LIBRARY_FOO(gnuradio-video-sdl RUNTIME_COMPONENT "video_sdl_runtime" DEVEL_COMPONENT "video_sdl_devel")
+add_dependencies(gnuradio-video-sdl
+ gnuradio-core)
diff --git a/gr-video-sdl/lib/sink_s_impl.cc b/gr-video-sdl/lib/sink_s_impl.cc
new file mode 100644
index 0000000000..2da9442d63
--- /dev/null
+++ b/gr-video-sdl/lib/sink_s_impl.cc
@@ -0,0 +1,322 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "sink_s_impl.h"
+#include <gr_io_signature.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <iostream>
+#include <stdexcept>
+#include <string.h>
+
+
+namespace gr {
+ namespace video_sdl {
+
+
+ sink_s::sptr
+ sink_s::make(double framerate, int width, int height,
+ unsigned int format, int dst_width, int dst_height)
+ {
+ return gnuradio::get_initial_sptr
+ (new sink_s_impl(framerate, width, height,format, dst_width, dst_height));
+ }
+
+ sink_s_impl::sink_s_impl(double framerate, int width, int height,
+ unsigned int format, int dst_width, int dst_height)
+ : gr_sync_block("video_sdl_sink_s",
+ gr_make_io_signature(1, 3, sizeof(short)),
+ gr_make_io_signature(0, 0, 0)),
+ d_chunk_size(width*height), d_framerate(framerate),
+ d_wanted_frametime_ms(0), d_width(width), d_height(height),
+ d_dst_width(dst_width), d_dst_height(dst_height),
+ d_format(format),
+ d_current_line(0), d_screen(NULL), d_image(NULL),
+ d_avg_delay(0.0), d_wanted_ticks(0)
+ {
+ if(framerate <= 0.0)
+ d_wanted_frametime_ms = 0; //Go as fast as possible
+ else
+ d_wanted_frametime_ms = (int)(1000.0/framerate);
+
+ if(dst_width < 0)
+ d_dst_width = d_width;
+ if(dst_height < 0)
+ d_dst_height = d_height;
+ if(0 == format)
+ d_format = IMGFMT_YV12;
+
+ atexit(SDL_Quit); //check if this is the way to do this
+ if(SDL_Init(SDL_INIT_VIDEO) < 0) {
+ std::cerr << "video_sdl::sink_s: Couldn't initialize SDL:" << SDL_GetError()
+ << " \n SDL_Init(SDL_INIT_VIDEO) failed\n";
+ throw std::runtime_error("video_sdl::sink_s");
+ };
+
+ /* accept any depth */
+ d_screen = SDL_SetVideoMode(dst_width, dst_height, 0,
+ SDL_SWSURFACE|SDL_RESIZABLE|SDL_ANYFORMAT);//SDL_DOUBLEBUF |SDL_SWSURFACE| SDL_HWSURFACE||SDL_FULLSCREEN
+
+ if(d_screen == NULL) {
+ std::cerr << "Unable to set SDL video mode: " << SDL_GetError()
+ << "\n SDL_SetVideoMode() Failed \n";
+ exit(1);
+ }
+ if(d_image) {
+ SDL_FreeYUVOverlay(d_image);
+ }
+
+ /* Initialize and create the YUV Overlay used for video out */
+ if(!(d_image = SDL_CreateYUVOverlay(d_width, d_height, SDL_YV12_OVERLAY, d_screen))) {
+ std::cerr << "SDL: Couldn't create a YUV overlay: \n"<< SDL_GetError() << "\n";
+ throw std::runtime_error("video_sdl::sink_s");
+ }
+
+ printf("SDL screen_mode %d bits-per-pixel\n",
+ d_screen->format->BitsPerPixel);
+ printf("SDL overlay_mode %i \n",
+ d_image->format);
+
+ d_chunk_size = std::min(1, 16384/width); //width*16;
+ d_chunk_size = d_chunk_size*width;
+ //d_chunk_size = (int) (width);
+ set_output_multiple(d_chunk_size);
+
+ /* Set the default playback area */
+ d_dst_rect.x = 0;
+ d_dst_rect.y = 0;
+ d_dst_rect.w = d_dst_width;
+ d_dst_rect.h = d_dst_height;
+ //clear the surface to grey
+
+ if(SDL_LockYUVOverlay(d_image)) {
+ std::cerr << "SDL: Couldn't lock YUV overlay: \n" << SDL_GetError() << "\n";
+ throw std::runtime_error("video_sdl::sink_s");
+ }
+
+ memset(d_image->pixels[0], 128, d_image->pitches[0]*d_height);
+ memset(d_image->pixels[1], 128, d_image->pitches[1]*d_height/2);
+ memset(d_image->pixels[2], 128, d_image->pitches[2]*d_height/2);
+ SDL_UnlockYUVOverlay( d_image );
+ }
+
+ sink_s_impl::~sink_s_impl()
+ {
+ SDL_Quit();
+ }
+
+ void
+ sink_s_impl::copy_line_pixel_interleaved(unsigned char *dst_pixels_u,
+ unsigned char *dst_pixels_v,
+ const short * src_pixels,
+ int src_width)
+ {
+ for(int i = 0; i < src_width; i++) {
+ dst_pixels_u[i]=(unsigned char)src_pixels[i*2];
+ dst_pixels_v[i]=(unsigned char)src_pixels[i*2+1];
+ }
+ }
+
+ void
+ sink_s_impl::copy_line_line_interleaved(unsigned char *dst_pixels_u,
+ unsigned char *dst_pixels_v,
+ const short * src_pixels,
+ int src_width)
+ {
+ for(int i = 0; i < src_width; i++) {
+ dst_pixels_u[i] = (unsigned char)src_pixels[i];
+ dst_pixels_v[i] = (unsigned char)src_pixels[i+src_width];
+ }
+
+ for(int i = src_width; i < src_width*2; i++) {
+ dst_pixels_v[i] = (unsigned char)src_pixels[i];
+ }
+ }
+
+ void
+ sink_s_impl::copy_line_single_plane(unsigned char *dst_pixels,
+ const short * src_pixels,
+ int src_width)
+ {
+ for(int i = 0; i < src_width; i++) {
+ dst_pixels[i] = (unsigned char)src_pixels[i];
+ }
+ }
+
+ void
+ sink_s_impl::copy_line_single_plane_dec2(unsigned char *dst_pixels,
+ const short * src_pixels,
+ int src_width)
+ {
+ for(int i = 0, j = 0; i < src_width; i += 2, j++) {
+ dst_pixels[j] = (unsigned char)src_pixels[i];
+ }
+ }
+
+ int
+ sink_s_impl::copy_plane_to_surface(int plane,int noutput_items,
+ const short * src_pixels)
+ {
+ const int first_dst_plane = (12 == plane || 1122 == plane) ? 1 : plane;
+ const int second_dst_plane = (12 == plane || 1122 == plane) ? 2 : plane;
+ int current_line = (0 == plane) ? d_current_line : d_current_line/2;
+
+ unsigned char * dst_pixels = (unsigned char *)d_image->pixels[first_dst_plane];
+ dst_pixels =& dst_pixels[current_line*d_image->pitches[first_dst_plane]];
+
+ unsigned char * dst_pixels_2 = (unsigned char *)d_image->pixels[second_dst_plane];
+ dst_pixels_2 =& dst_pixels_2[current_line*d_image->pitches[second_dst_plane]];
+
+ int src_width = (0 == plane || 12 == plane || 1122 == plane) ? d_width:d_width/2;
+ int noutput_items_produced = 0;
+ int max_height = (0 == plane) ? d_height-1 : d_height/2-1;
+
+ for(int i = 0; i < noutput_items; i += src_width) {
+ //output one line at a time
+ if(12==plane) {
+ copy_line_pixel_interleaved(dst_pixels, dst_pixels_2, src_pixels, src_width);
+ dst_pixels_2 += d_image->pitches[second_dst_plane];
+ }
+ else if(1122 == plane) {
+ copy_line_line_interleaved(dst_pixels, dst_pixels_2, src_pixels, src_width);
+ dst_pixels_2 += d_image->pitches[second_dst_plane];
+ src_pixels += src_width;
+ }
+ else if(0==plane)
+ copy_line_single_plane(dst_pixels, src_pixels, src_width);
+ else /* 1==plane || 2==plane*/
+ copy_line_single_plane_dec2(dst_pixels, src_pixels, src_width); //decimate by two horizontally
+
+ src_pixels += src_width;
+ dst_pixels += d_image->pitches[first_dst_plane];
+ noutput_items_produced += src_width;
+ current_line++;
+ if(current_line > max_height) {
+ //Start new frame
+ //TODO, do this all in a seperate thread
+ current_line=0;
+ dst_pixels=d_image->pixels[first_dst_plane];
+ dst_pixels_2=d_image->pixels[second_dst_plane];
+ if(0 == plane) {
+ SDL_DisplayYUVOverlay(d_image, &d_dst_rect);
+ //SDL_Flip(d_screen);
+ unsigned int ticks = SDL_GetTicks();//milliseconds
+ d_wanted_ticks += d_wanted_frametime_ms;
+ float avg_alpha = 0.1;
+ int time_diff = d_wanted_ticks-ticks;
+ d_avg_delay = time_diff*avg_alpha +d_avg_delay*(1.0-avg_alpha);
+ }
+ }
+ }
+
+ if(0==plane)
+ d_current_line=current_line;
+
+ return noutput_items_produced;
+ }
+
+ int
+ sink_s_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ short *src_pixels_0,*src_pixels_1,*src_pixels_2;
+ int noutput_items_produced = 0;
+ int plane;
+ int delay = (int)d_avg_delay;
+
+ if(0 == d_wanted_ticks)
+ d_wanted_ticks = SDL_GetTicks();
+ if(delay > 0)
+ SDL_Delay((unsigned int)delay); //compensate if running too fast
+
+ if(SDL_LockYUVOverlay(d_image)) {
+ return 0;
+ }
+
+ switch(input_items.size ()) {
+ case 3: // first channel=Y, second channel is U , third channel is V
+ src_pixels_0 = (short *)input_items[0];
+ src_pixels_1 = (short *)input_items[1];
+ src_pixels_2 = (short *)input_items[2];
+ for(int i = 0; i < noutput_items; i += d_chunk_size) {
+ copy_plane_to_surface(1,d_chunk_size, src_pixels_1);
+ copy_plane_to_surface(2,d_chunk_size, src_pixels_2);
+ noutput_items_produced += copy_plane_to_surface(0,d_chunk_size, src_pixels_0);
+ src_pixels_0 += d_chunk_size;
+ src_pixels_1 += d_chunk_size;
+ src_pixels_2 += d_chunk_size;
+ }
+ break;
+ case 2:
+ if(1) { //if(pixel_interleaved_uv)
+ // first channel=Y, second channel is alternating pixels U and V
+ src_pixels_0 = (short *)input_items[0];
+ src_pixels_1 = (short *)input_items[1];
+ for(int i = 0; i < noutput_items; i += d_chunk_size) {
+ copy_plane_to_surface(12, d_chunk_size/2, src_pixels_1);
+ noutput_items_produced += copy_plane_to_surface(0, d_chunk_size, src_pixels_0);
+ src_pixels_0 += d_chunk_size;
+ src_pixels_1 += d_chunk_size;
+ }
+ }
+ else {
+ // first channel=Y, second channel is alternating lines U and V
+ src_pixels_0 = (short *)input_items[0];
+ src_pixels_1 = (short *)input_items[1];
+ for(int i = 0; i < noutput_items; i += d_chunk_size) {
+ copy_plane_to_surface(1222, d_chunk_size/2, src_pixels_1);
+ noutput_items_produced += copy_plane_to_surface(0, d_chunk_size, src_pixels_0);
+ src_pixels_0 += d_chunk_size;
+ src_pixels_1 += d_chunk_size;
+ }
+ }
+ break;
+ case 1: // grey (Y) input
+ /* Y component */
+ plane=0;
+ src_pixels_0 = (short *)input_items[plane];
+ for(int i = 0; i < noutput_items; i += d_chunk_size) {
+ noutput_items_produced += copy_plane_to_surface(plane, d_chunk_size, src_pixels_0);
+ src_pixels_0 += d_chunk_size;
+ }
+ break;
+ default: //0 or more then 3 channels
+ std::cerr << "video_sdl::sink_s: Wrong number of channels: ";
+ std::cerr << "1, 2 or 3 channels are supported.\n Requested number of channels is "
+ << input_items.size () << "\n";
+ throw std::runtime_error("video_sdl::sink_s");
+ }
+
+ SDL_UnlockYUVOverlay(d_image);
+ return noutput_items_produced;
+ }
+
+ } /* namespace video_sdl */
+} /* namespace gr */
diff --git a/gr-video-sdl/lib/sink_s_impl.h b/gr-video-sdl/lib/sink_s_impl.h
new file mode 100644
index 0000000000..8d20cb6596
--- /dev/null
+++ b/gr-video-sdl/lib/sink_s_impl.h
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_VIDEO_SDL_SINK_S_IMPL_H
+#define INCLUDED_VIDEO_SDL_SINK_S_IMPL_H
+
+#include <video_sdl/sink_s.h>
+#include <SDL.h>
+
+namespace gr {
+ namespace video_sdl {
+
+/* fourcc (four character code) */
+#define vid_fourcc(a,b,c,d) (((unsigned)(a)<<0) | ((unsigned)(b)<<8) | ((unsigned)(c)<<16) | ((unsigned)(d)<<24))
+#define IMGFMT_YV12 vid_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */
+
+ class sink_s_impl : public sink_s
+ {
+ private:
+ int d_chunk_size;
+
+ protected:
+ void copy_line_pixel_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,
+ const short * src_pixels,int src_width);
+ void copy_line_line_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,
+ const short * src_pixels,int src_width);
+ void copy_line_single_plane(unsigned char *dst_pixels,const short * src_pixels,int src_width);
+ void copy_line_single_plane_dec2(unsigned char *dst_pixels,const short * src_pixels,int src_width);
+ int copy_plane_to_surface(int plane,int noutput_items,
+ const short * src_pixels);
+
+ float d_framerate;
+ int d_wanted_frametime_ms;
+ int d_width;
+ int d_height;
+ int d_dst_width;
+ int d_dst_height;
+ int d_format;
+ int d_current_line;
+ SDL_Surface *d_screen;
+ SDL_Overlay *d_image;
+ SDL_Rect d_dst_rect;
+ float d_avg_delay;
+ unsigned int d_wanted_ticks;
+
+ public:
+ sink_s_impl(double framerate,
+ int width, int height,
+ unsigned int format,
+ int dst_width, int dst_height);
+ ~sink_s_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace video_sdl */
+} /* namespace gr */
+
+#endif /* INCLUDED_VIDEO_SDL_SINK_S_IMPL_H */
diff --git a/gr-video-sdl/lib/sink_uc_impl.cc b/gr-video-sdl/lib/sink_uc_impl.cc
new file mode 100644
index 0000000000..28333e2413
--- /dev/null
+++ b/gr-video-sdl/lib/sink_uc_impl.cc
@@ -0,0 +1,318 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2010,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "sink_uc_impl.h"
+#include <gr_io_signature.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <iostream>
+#include <stdexcept>
+#include <string.h>
+
+
+namespace gr {
+ namespace video_sdl {
+
+ sink_uc::sptr
+ sink_uc::make(double framerate, int width, int height,
+ unsigned int format, int dst_width, int dst_height)
+ {
+ return gnuradio::get_initial_sptr
+ (new sink_uc_impl(framerate, width, height, format, dst_width, dst_height));
+ }
+
+ sink_uc_impl::sink_uc_impl(double framerate, int width, int height,
+ unsigned int format, int dst_width, int dst_height)
+ : gr_sync_block("video_sdl_sink_uc",
+ gr_make_io_signature(1, 3, sizeof(unsigned char)),
+ gr_make_io_signature(0, 0, 0)),
+ d_chunk_size(width*height), d_framerate(framerate),
+ d_wanted_frametime_ms(0), d_width(width), d_height(height),
+ d_dst_width(dst_width), d_dst_height(dst_height),
+ d_format(format),
+ d_current_line(0), d_screen(NULL), d_image(NULL),
+ d_avg_delay(0.0), d_wanted_ticks(0)
+ {
+ if(framerate <= 0.0)
+ d_wanted_frametime_ms = 0; //Go as fast as possible
+ else
+ d_wanted_frametime_ms = (int)(1000.0/framerate);
+
+ if(dst_width < 0)
+ d_dst_width = d_width;
+
+ if(dst_height < 0)
+ d_dst_height = d_height;
+
+ if(0==format)
+ d_format= IMGFMT_YV12;
+
+ atexit(SDL_Quit); //check if this is the way to do this
+ if(SDL_Init(SDL_INIT_VIDEO) < 0) {
+ std::cerr << "video_sdl::sink_uc: Couldn't initialize SDL:"
+ << SDL_GetError() << " \n SDL_Init(SDL_INIT_VIDEO) failed\n";
+ throw std::runtime_error ("video_sdl::sink_uc");
+ }
+
+ /* accept any depth */
+ d_screen = SDL_SetVideoMode(dst_width, dst_height, 0,
+ SDL_SWSURFACE|SDL_RESIZABLE|SDL_ANYFORMAT);//SDL_DOUBLEBUF |SDL_SWSURFACE| SDL_HWSURFACE||SDL_FULLSCREEN
+
+ if(d_screen == NULL) {
+ std::cerr << "Unable to set SDL video mode: " << SDL_GetError()
+ <<"\n SDL_SetVideoMode() Failed \n";
+ exit(1);
+ }
+
+ if(d_image) {
+ SDL_FreeYUVOverlay(d_image);
+ }
+
+ /* Initialize and create the YUV Overlay used for video out */
+ if(!(d_image = SDL_CreateYUVOverlay(d_width, d_height, SDL_YV12_OVERLAY, d_screen))) {
+ std::cerr << "SDL: Couldn't create a YUV overlay: \n"<< SDL_GetError() <<"\n";
+ throw std::runtime_error("video_sdl::sink_uc");
+ }
+
+ printf("SDL screen_mode %d bits-per-pixel\n",
+ d_screen->format->BitsPerPixel);
+ printf("SDL overlay_mode %i \n",
+ d_image->format);
+
+ d_chunk_size = std::min(1,16384/width); //width*16;
+ d_chunk_size = d_chunk_size*width;
+ //d_chunk_size = (int)(width);
+ set_output_multiple(d_chunk_size);
+
+ /* Set the default playback area */
+ d_dst_rect.x = 0;
+ d_dst_rect.y = 0;
+ d_dst_rect.w = d_dst_width;
+ d_dst_rect.h = d_dst_height;
+ //clear the surface to grey
+
+ if(SDL_LockYUVOverlay(d_image)) {
+ std::cerr << "SDL: Couldn't lock YUV overlay: \n" << SDL_GetError() << "\n";
+ throw std::runtime_error ("video_sdl::sink_uc");
+ }
+
+ memset(d_image->pixels[0], 128, d_image->pitches[0]*d_height);
+ memset(d_image->pixels[1], 128, d_image->pitches[1]*d_height/2);
+ memset(d_image->pixels[2], 128, d_image->pitches[2]*d_height/2);
+ SDL_UnlockYUVOverlay(d_image);
+ }
+
+ sink_uc_impl::~sink_uc_impl()
+ {
+ SDL_Quit();
+ }
+
+ void
+ sink_uc_impl::copy_line_pixel_interleaved(unsigned char *dst_pixels_u,
+ unsigned char *dst_pixels_v,
+ const unsigned char *src_pixels,
+ int src_width)
+ {
+ for(int i=0;i<src_width;i++) {
+ dst_pixels_u[i]=src_pixels[i*2];
+ dst_pixels_v[i]=src_pixels[i*2+1];
+ }
+ }
+
+ void
+ sink_uc_impl::copy_line_line_interleaved(unsigned char *dst_pixels_u,
+ unsigned char *dst_pixels_v,
+ const unsigned char *src_pixels,
+ int src_width)
+ {
+ memcpy(dst_pixels_u, src_pixels, src_width);
+ memcpy(dst_pixels_v, src_pixels+src_width, src_width);
+ }
+
+ void
+ sink_uc_impl::copy_line_single_plane(unsigned char *dst_pixels,
+ const unsigned char *src_pixels,
+ int src_width)
+ {
+ memcpy(dst_pixels, src_pixels, src_width);
+ }
+
+ void
+ sink_uc_impl::copy_line_single_plane_dec2(unsigned char *dst_pixels,
+ const unsigned char *src_pixels,
+ int src_width)
+ {
+ for(int i = 0,j = 0; i < src_width; i += 2, j++) {
+ dst_pixels[j] = (unsigned char)src_pixels[i];
+ }
+ }
+
+ int
+ sink_uc_impl::copy_plane_to_surface(int plane,int noutput_items,
+ const unsigned char * src_pixels)
+ {
+ const int first_dst_plane = (12==plane || 1122 == plane) ? 1 : plane;
+ const int second_dst_plane = (12==plane || 1122 == plane) ? 2 : plane;
+ int current_line = (0 == plane) ? d_current_line : d_current_line/2;
+
+ unsigned char *dst_pixels = (unsigned char*)d_image->pixels[first_dst_plane];
+ dst_pixels =& dst_pixels[current_line*d_image->pitches[first_dst_plane]];
+
+ unsigned char * dst_pixels_2 = (unsigned char *)d_image->pixels[second_dst_plane];
+ dst_pixels_2 =& dst_pixels_2[current_line*d_image->pitches[second_dst_plane]];
+
+ int src_width = (0 == plane || 12 == plane || 1122 == plane) ? d_width : d_width/2;
+ int noutput_items_produced = 0;
+ int max_height = (0 == plane)? d_height-1 : d_height/2-1;
+
+ for(int i = 0; i < noutput_items; i += src_width) {
+ //output one line at a time
+ if(12 == plane) {
+ copy_line_pixel_interleaved(dst_pixels, dst_pixels_2, src_pixels, src_width);
+ dst_pixels_2 += d_image->pitches[second_dst_plane];
+ }
+ else if(1122 == plane) {
+ copy_line_line_interleaved(dst_pixels, dst_pixels_2, src_pixels, src_width);
+ dst_pixels_2 += d_image->pitches[second_dst_plane];
+ src_pixels += src_width;
+ }
+ else if(0 == plane)
+ copy_line_single_plane(dst_pixels, src_pixels, src_width);
+ else /* 1==plane || 2==plane*/
+ copy_line_single_plane_dec2(dst_pixels, src_pixels, src_width); //decimate by two horizontally
+
+ src_pixels += src_width;
+ dst_pixels += d_image->pitches[first_dst_plane];
+ noutput_items_produced+=src_width;
+ current_line++;
+
+ if(current_line > max_height) {
+ //Start new frame
+ //TODO, do this all in a seperate thread
+ current_line = 0;
+ dst_pixels = d_image->pixels[first_dst_plane];
+ dst_pixels_2 = d_image->pixels[second_dst_plane];
+ if(0 == plane) {
+ SDL_DisplayYUVOverlay(d_image, &d_dst_rect);
+ //SDL_Flip(d_screen);
+ unsigned int ticks = SDL_GetTicks();//milliseconds
+ d_wanted_ticks += d_wanted_frametime_ms;
+ float avg_alpha = 0.1;
+ int time_diff = d_wanted_ticks-ticks;
+ d_avg_delay = time_diff*avg_alpha + d_avg_delay*(1.0-avg_alpha);
+ }
+ }
+ }
+
+ if(0==plane)
+ d_current_line=current_line;
+
+ return noutput_items_produced;
+ }
+
+ int
+ sink_uc_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ unsigned char *src_pixels_0,*src_pixels_1,*src_pixels_2;
+ int noutput_items_produced = 0;
+ int plane;
+ int delay = (int)d_avg_delay;
+
+ if(0 == d_wanted_ticks)
+ d_wanted_ticks=SDL_GetTicks();
+
+ if(delay > 0)
+ SDL_Delay((unsigned int)delay);//compensate if running too fast
+
+ if(SDL_LockYUVOverlay(d_image)) {
+ return 0;
+ }
+
+ switch(input_items.size ()) {
+ case 3: // first channel=Y, second channel is U , third channel is V
+ src_pixels_0 = (unsigned char *) input_items[0];
+ src_pixels_1 = (unsigned char *) input_items[1];
+ src_pixels_2 = (unsigned char *) input_items[2];
+ for(int i = 0; i < noutput_items; i += d_chunk_size) {
+ copy_plane_to_surface (1,d_chunk_size, src_pixels_1);
+ copy_plane_to_surface (2,d_chunk_size, src_pixels_2);
+ noutput_items_produced+=copy_plane_to_surface(0,d_chunk_size, src_pixels_0);
+ src_pixels_0 += d_chunk_size;
+ src_pixels_1 += d_chunk_size;
+ src_pixels_2 += d_chunk_size;
+ }
+ break;
+ case 2:
+ if(1) {//if(pixel_interleaved_uv)
+ // first channel=Y, second channel is alternating pixels U and V
+ src_pixels_0 = (unsigned char *) input_items[0];
+ src_pixels_1 = (unsigned char *) input_items[1];
+ for(int i = 0; i < noutput_items; i += d_chunk_size) {
+ copy_plane_to_surface(12, d_chunk_size/2, src_pixels_1);
+ noutput_items_produced += copy_plane_to_surface(0, d_chunk_size, src_pixels_0);
+ src_pixels_0 += d_chunk_size;
+ src_pixels_1 += d_chunk_size;
+ }
+ }
+ else {
+ // first channel=Y, second channel is alternating lines U and V
+ src_pixels_0 = (unsigned char*)input_items[0];
+ src_pixels_1 = (unsigned char*)input_items[1];
+ for(int i = 0; i < noutput_items; i += d_chunk_size) {
+ copy_plane_to_surface (1222,d_chunk_size/2, src_pixels_1);
+ noutput_items_produced += copy_plane_to_surface(0, d_chunk_size, src_pixels_0);
+ src_pixels_0 += d_chunk_size;
+ src_pixels_1 += d_chunk_size;
+ }
+ }
+ break;
+ case 1: // grey (Y) input
+ /* Y component */
+ plane=0;
+ src_pixels_0 = (unsigned char*)input_items[plane];
+ for(int i = 0; i < noutput_items; i += d_chunk_size) {
+ noutput_items_produced += copy_plane_to_surface(plane, d_chunk_size, src_pixels_0);
+ src_pixels_0 += d_chunk_size;
+ }
+ break;
+ default: //0 or more then 3 channels
+ std::cerr << "video_sdl::sink_uc: Wrong number of channels: ";
+ std::cerr <<"1, 2 or 3 channels are supported.\n Requested number of channels is "
+ << input_items.size () <<"\n";
+ throw std::runtime_error("video_sdl::sink_uc");
+ }
+
+ SDL_UnlockYUVOverlay(d_image);
+ return noutput_items_produced;
+ }
+
+ } /* namespace video_sdl */
+} /* namespace gr */
diff --git a/gr-video-sdl/lib/sink_uc_impl.h b/gr-video-sdl/lib/sink_uc_impl.h
new file mode 100644
index 0000000000..927510745f
--- /dev/null
+++ b/gr-video-sdl/lib/sink_uc_impl.h
@@ -0,0 +1,80 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2012 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_VIDEO_SDL_SINK_UC_IMPL_H
+#define INCLUDED_VIDEO_SDL_SINK_UC_IMPL_H
+
+#include <video_sdl/sink_uc.h>
+#include <SDL.h>
+
+namespace gr {
+ namespace video_sdl {
+
+/* fourcc (four character code) */
+#define vid_fourcc(a,b,c,d) (((unsigned)(a)<<0) | ((unsigned)(b)<<8) | ((unsigned)(c)<<16) | ((unsigned)(d)<<24))
+#define IMGFMT_YV12 vid_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */
+
+ class sink_uc_impl : public sink_uc
+ {
+ private:
+ int d_chunk_size;
+
+ protected:
+ void copy_line_pixel_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,
+ const unsigned char * src_pixels,int src_width);
+ void copy_line_line_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,
+ const unsigned char * src_pixels,int src_width);
+ void copy_line_single_plane(unsigned char *dst_pixels,const unsigned char * src_pixels,int src_width);
+ void copy_line_single_plane_dec2(unsigned char *dst_pixels,const unsigned char * src_pixels,int src_width);
+ int copy_plane_to_surface(int plane,int noutput_items,
+ const unsigned char * src_pixels);
+
+ float d_framerate;
+ int d_wanted_frametime_ms;
+ int d_width;
+ int d_height;
+ int d_dst_width;
+ int d_dst_height;
+ int d_format;
+ int d_current_line;
+ SDL_Surface *d_screen;
+ SDL_Overlay *d_image;
+ SDL_Rect d_dst_rect;
+ float d_avg_delay;
+ unsigned int d_wanted_ticks;
+
+ public:
+ sink_uc_impl(double framerate,
+ int width, int height,
+ unsigned int format,
+ int dst_width, int dst_height);
+ ~sink_uc_impl();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace video_sdl */
+} /* namespace gr */
+
+#endif /* INCLUDED_VIDEO_SDL_SINK_UC_IMPL_H */
diff --git a/gr-trellis/src/python/CMakeLists.txt b/gr-video-sdl/python/CMakeLists.txt
index d5b941afab..0ce0ea3d78 100644
--- a/gr-trellis/src/python/CMakeLists.txt
+++ b/gr-video-sdl/python/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright 2011-2012 Free Software Foundation, Inc.
+# Copyright 2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -18,20 +18,28 @@
# Boston, MA 02110-1301, USA.
########################################################################
+# Setup python install
+########################################################################
+include(GrPython)
+
+GR_PYTHON_INSTALL(
+ FILES
+ __init__.py
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/video-sdl
+ COMPONENT "video_sdl_python"
+)
+
+########################################################################
# Handle the unit tests
########################################################################
if(ENABLE_TESTING)
list(APPEND GR_TEST_PYTHON_DIRS
- ${CMAKE_BINARY_DIR}/gr-analog/swig
- ${CMAKE_BINARY_DIR}/gr-digital/swig
- ${CMAKE_BINARY_DIR}/gr-trellis/src/lib
- ${CMAKE_BINARY_DIR}/gr-blocks/python
- ${CMAKE_BINARY_DIR}/gr-blocks/swig
+ ${CMAKE_BINARY_DIR}/gr-video-sdl/python
+ ${CMAKE_BINARY_DIR}/gr-video-sdl/swig
)
-list(APPEND GR_TEST_TARGET_DEPS gnuradio-analog gnuradio-digital gnuradio-trellis gnuradio-filter)
+list(APPEND GR_TEST_TARGET_DEPS gnuradio-video-sdl)
-include(GrPython)
include(GrTest)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
diff --git a/gr-video-sdl/python/__init__.py b/gr-video-sdl/python/__init__.py
new file mode 100644
index 0000000000..c029a82c2d
--- /dev/null
+++ b/gr-video-sdl/python/__init__.py
@@ -0,0 +1,27 @@
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+'''
+Blocks and utilities for Video SDL module
+'''
+
+# The presence of this file turns this directory into a Python package
+
+from video_sdl_swig import *
diff --git a/gr-video-sdl/src/qa_video_sdl.py b/gr-video-sdl/python/qa_video_sdl.py
index 9008d15131..68c3185ef5 100755
--- a/gr-video-sdl/src/qa_video_sdl.py
+++ b/gr-video-sdl/python/qa_video_sdl.py
@@ -21,7 +21,7 @@
#
from gnuradio import gr, gr_unittest
-import video_sdl
+import video_sdl_swig as video_sdl
class test_video_sdl (gr_unittest.TestCase):
diff --git a/gr-video-sdl/src/CMakeLists.txt b/gr-video-sdl/src/CMakeLists.txt
deleted file mode 100644
index 27fb4115f6..0000000000
--- a/gr-video-sdl/src/CMakeLists.txt
+++ /dev/null
@@ -1,112 +0,0 @@
-# Copyright 2011-2012 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-
-########################################################################
-# Setup the include and linker paths
-########################################################################
-include_directories(
- ${GNURADIO_CORE_INCLUDE_DIRS}
- ${GR_VIDEO_SDL_INCLUDE_DIRS}
-)
-
-include_directories(${Boost_INCLUDE_DIRS})
-link_directories(${Boost_LIBRARY_DIRS})
-
-include_directories(${SDL_INCLUDE_DIR})
-
-########################################################################
-# Setup library
-########################################################################
-list(APPEND gr_video_sdl_sources
- video_sdl_sink_uc.cc
- video_sdl_sink_s.cc
-)
-
-list(APPEND video_sdl_libs
- gnuradio-core
- ${Boost_LIBRARIES}
- ${SDL_LIBRARY}
-)
-
-add_library(gnuradio-video-sdl SHARED ${gr_video_sdl_sources})
-target_link_libraries(gnuradio-video-sdl ${video_sdl_libs})
-GR_LIBRARY_FOO(gnuradio-video-sdl RUNTIME_COMPONENT "video_sdl_runtime" DEVEL_COMPONENT "video_sdl_devel")
-
-########################################################################
-# Install public header files
-########################################################################
-install(FILES
- video_sdl_api.h
- video_sdl_sink_uc.h
- video_sdl_sink_s.h
- DESTINATION ${GR_INCLUDE_DIR}/gnuradio
- COMPONENT "video_sdl_devel"
-)
-
-########################################################################
-# Setup swig generation
-########################################################################
-if(ENABLE_PYTHON)
-include(GrPython)
-include(GrSwig)
-
-set(GR_SWIG_INCLUDE_DIRS
- ${GR_COMEDI_INCLUDE_DIRS}
- ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
-)
-
-set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/video_sdl_swig_doc.i)
-set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
-
-set(GR_SWIG_LIBRARIES gnuradio-video-sdl)
-
-GR_SWIG_MAKE(video_sdl video_sdl.i)
-
-GR_SWIG_INSTALL(
- TARGETS video_sdl
- DESTINATION ${GR_PYTHON_DIR}/gnuradio
- COMPONENT "video_sdl_python"
-)
-
-install(
- FILES video_sdl.i
- ${CMAKE_CURRENT_BINARY_DIR}/video_sdl_swig_doc.i
- DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
- COMPONENT "video_sdl_swig"
-)
-
-endif(ENABLE_PYTHON)
-
-########################################################################
-# Handle the unit tests
-########################################################################
-if(ENABLE_TESTING AND ENABLE_PYTHON)
-
-list(APPEND GR_TEST_PYTHON_DIRS
- ${CMAKE_BINARY_DIR}/gr-video-sdl/src
-)
-list(APPEND GR_TEST_TARGET_DEPS gnuradio-video-sdl)
-
-include(GrTest)
-file(GLOB py_qa_test_files "qa_*.py")
-foreach(py_qa_test_file ${py_qa_test_files})
- get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
- GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
-endforeach(py_qa_test_file)
-endif(ENABLE_TESTING AND ENABLE_PYTHON)
diff --git a/gr-video-sdl/src/video_sdl.i b/gr-video-sdl/src/video_sdl.i
deleted file mode 100644
index c06ad6c2e3..0000000000
--- a/gr-video-sdl/src/video_sdl.i
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2009 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-%include "gnuradio.i" // the common stuff
-
-//load generated python docstrings
-%include "video_sdl_swig_doc.i"
-
-%{
-#include "video_sdl_sink_uc.h"
-#include "video_sdl_sink_s.h"
-%}
-
-// ----------------------------------------------------------------
-
-GR_SWIG_BLOCK_MAGIC(video_sdl,sink_uc)
-
-video_sdl_sink_uc_sptr
-video_sdl_make_sink_uc ( double framerate,int width=640, int height=480,unsigned int format=0,int dst_width=-1,int dst_height=-1
- ) throw (std::runtime_error);
-
-
-class video_sdl_sink_uc : public gr_sync_block {
- protected:
- video_sdl_sink_uc (double framerate,int width, int height,gr_uint32 format,int dst_width,int dst_height);
-
- public:
- ~video_sdl_sink_uc ();
-};
-
-// ----------------------------------------------------------------
-
-GR_SWIG_BLOCK_MAGIC(video_sdl,sink_s)
-
-video_sdl_sink_s_sptr
-video_sdl_make_sink_s ( double framerate,int width=640, int height=480,unsigned int format=0,int dst_width=-1,int dst_height=-1
- ) throw (std::runtime_error);
-
-
-class video_sdl_sink_s : public gr_sync_block {
- protected:
- video_sdl_sink_s (double framerate,int width, int height,gr_uint32 format,int dst_width,int dst_height);
-
- public:
- ~video_sdl_sink_s ();
-};
diff --git a/gr-video-sdl/src/video_sdl_sink_s.cc b/gr-video-sdl/src/video_sdl_sink_s.cc
deleted file mode 100644
index d9232043ab..0000000000
--- a/gr-video-sdl/src/video_sdl_sink_s.cc
+++ /dev/null
@@ -1,301 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <SDL.h>
-
-#include <video_sdl_sink_s.h>
-#include <gr_io_signature.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <iostream>
-#include <stdexcept>
-#include <string.h>
-
-
-
-video_sdl_sink_s::video_sdl_sink_s (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height)
- : gr_sync_block ("video_sdl_sink_s",
- gr_make_io_signature (1, 3, sizeof (short)),
- gr_make_io_signature (0, 0, 0)),
- d_chunk_size (width*height),
- d_framerate(framerate),
- d_wanted_frametime_ms(0),
- d_width(width),
- d_height (height),
- d_dst_width(dst_width),
- d_dst_height(dst_height),
- d_format(format),
- d_current_line(0),
- d_screen(NULL),
- d_image(NULL),
- d_avg_delay(0.0),
- d_wanted_ticks(0)
-{
- if(framerate<=0.0)
- d_wanted_frametime_ms=0;//Go as fast as possible
- else
- d_wanted_frametime_ms=(int)(1000.0/framerate);
- if(dst_width<0) d_dst_width=d_width;
- if(dst_height<0) d_dst_height=d_height;
- if(0==format) d_format=IMGFMT_YV12;
-
- atexit(SDL_Quit);//check if this is the way to do this
- if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
- std::cerr << "video_sdl_sink_s: Couldn't initialize SDL:" << SDL_GetError() << " \n SDL_Init(SDL_INIT_VIDEO) failed\n";
- throw std::runtime_error ("video_sdl_sink_s");
- };
-
- /* accept any depth */
- d_screen = SDL_SetVideoMode(dst_width, dst_height, 0, SDL_SWSURFACE|SDL_RESIZABLE|SDL_ANYFORMAT);//SDL_DOUBLEBUF |SDL_SWSURFACE| SDL_HWSURFACE||SDL_FULLSCREEN
- if ( d_screen == NULL ) {
- std::cerr << "Unable to set SDL video mode: " << SDL_GetError() <<"\n SDL_SetVideoMode() Failed \n";
- exit(1);
- }
- if ( d_image ) {
- SDL_FreeYUVOverlay(d_image);
- }
- /* Initialize and create the YUV Overlay used for video out */
- if (!(d_image = SDL_CreateYUVOverlay (d_width, d_height, SDL_YV12_OVERLAY, d_screen))) {
- std::cerr << "SDL: Couldn't create a YUV overlay: \n"<< SDL_GetError() <<"\n";
- throw std::runtime_error ("video_sdl_sink_s");
- }
-
- printf("SDL screen_mode %d bits-per-pixel\n",
- d_screen->format->BitsPerPixel);
- printf("SDL overlay_mode %i \n",
- d_image->format);
- d_chunk_size = std::min(1,16384/width); //width*16;
- d_chunk_size = d_chunk_size*width;
- //d_chunk_size = (int) (width);
- set_output_multiple (d_chunk_size);
- /* Set the default playback area */
- d_dst_rect.x = 0;
- d_dst_rect.y = 0;
- d_dst_rect.w = d_dst_width;
- d_dst_rect.h = d_dst_height;
- //clear the surface to grey
- if ( SDL_LockYUVOverlay( d_image ) ) {
- std::cerr << "SDL: Couldn't lock YUV overlay: \n"<< SDL_GetError() <<"\n";
- throw std::runtime_error ("video_sdl_sink_s");
- }
- memset(d_image->pixels[0], 128, d_image->pitches[0]*d_height);
- memset(d_image->pixels[1], 128, d_image->pitches[1]*d_height/2);
- memset(d_image->pixels[2], 128, d_image->pitches[2]*d_height/2);
- SDL_UnlockYUVOverlay( d_image );
-}
-
-video_sdl_sink_s::~video_sdl_sink_s ()
-{
- SDL_Quit();
-}
-
-video_sdl_sink_s_sptr
-video_sdl_make_sink_s (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height)
-{
- return gnuradio::get_initial_sptr(new video_sdl_sink_s (framerate, width, height,format,dst_width,dst_height));
-}
-
-void
-video_sdl_sink_s::copy_line_pixel_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,const short * src_pixels,int src_width)
-{
- for(int i=0;i<src_width;i++)
- {
- dst_pixels_u[i]=(unsigned char)src_pixels[i*2];
- dst_pixels_v[i]=(unsigned char)src_pixels[i*2+1];
- }
- return;
-}
-
-void
-video_sdl_sink_s::copy_line_line_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,const short * src_pixels,int src_width)
-{
- for(int i=0;i<src_width;i++)
- {
- dst_pixels_u[i]=(unsigned char)src_pixels[i];
- dst_pixels_v[i]=(unsigned char)src_pixels[i+src_width];
- }
- for(int i=src_width;i<src_width*2;i++)
- {
- dst_pixels_v[i]=(unsigned char)src_pixels[i];
- }
- return;
-}
-void
-video_sdl_sink_s::copy_line_single_plane(unsigned char *dst_pixels,const short * src_pixels,int src_width)
-{
- for(int i=0;i<src_width;i++)
- {
- dst_pixels[i]=(unsigned char)src_pixels[i];
- }
- return;
-}
-
-void
-video_sdl_sink_s::copy_line_single_plane_dec2(unsigned char *dst_pixels,const short * src_pixels,int src_width)
-{
- for(int i=0,j=0;i<src_width;i+=2,j++)
- {
- dst_pixels[j]=(unsigned char)src_pixels[i];
- }
- return;
-}
-
-int
-video_sdl_sink_s::copy_plane_to_surface (int plane,int noutput_items,
- const short * src_pixels)
-{
- const int first_dst_plane=(12==plane ||1122==plane)?1:plane;
- const int second_dst_plane=(12==plane ||1122==plane)?2:plane;
- int current_line=(0==plane)?d_current_line:d_current_line/2;
- unsigned char * dst_pixels = (unsigned char *)d_image->pixels[first_dst_plane];
- dst_pixels=&dst_pixels[current_line*d_image->pitches[first_dst_plane]];
- unsigned char * dst_pixels_2 = (unsigned char *)d_image->pixels[second_dst_plane];
- dst_pixels_2=&dst_pixels_2[current_line*d_image->pitches[second_dst_plane]];
- int src_width=(0==plane || 12==plane || 1122==plane)?d_width:d_width/2;
- int noutput_items_produced=0;
- int max_height=(0==plane)?d_height-1:d_height/2-1;
- for (int i = 0; i < noutput_items; i += src_width){
- //output one line at a time
- if(12==plane)
- {
- copy_line_pixel_interleaved(dst_pixels,dst_pixels_2,src_pixels,src_width);
- dst_pixels_2 += d_image->pitches[second_dst_plane];
- }
- else if (1122==plane)
- {
- copy_line_line_interleaved(dst_pixels,dst_pixels_2,src_pixels,src_width);
- dst_pixels_2 += d_image->pitches[second_dst_plane];
- src_pixels += src_width;
- }
- else if (0==plane)
- copy_line_single_plane(dst_pixels,src_pixels,src_width);
- else /* 1==plane || 2==plane*/
- copy_line_single_plane_dec2(dst_pixels,src_pixels,src_width);//decimate by two horizontally
-
- src_pixels += src_width;
- dst_pixels += d_image->pitches[first_dst_plane];
- noutput_items_produced+=src_width;
- current_line++;
- if (current_line>max_height)
- {
- //Start new frame
- //TODO, do this all in a seperate thread
- current_line=0;
- dst_pixels=d_image->pixels[first_dst_plane];
- dst_pixels_2=d_image->pixels[second_dst_plane];
- if(0==plane)
- {
- SDL_DisplayYUVOverlay(d_image, &d_dst_rect);
- //SDL_Flip(d_screen);
- unsigned int ticks=SDL_GetTicks();//milliseconds
- d_wanted_ticks+=d_wanted_frametime_ms;
- float avg_alpha=0.1;
- int time_diff=d_wanted_ticks-ticks;
- d_avg_delay=time_diff*avg_alpha +d_avg_delay*(1.0-avg_alpha);
- }
- }
- }
- if(0==plane) d_current_line=current_line;
- return noutput_items_produced;
-}
-
-int
-video_sdl_sink_s::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- short *src_pixels_0,*src_pixels_1,*src_pixels_2;
- int noutput_items_produced=0;
- int plane;
- int delay=(int)d_avg_delay;
- if(0==d_wanted_ticks)
- d_wanted_ticks=SDL_GetTicks();
- if(delay>0)
- SDL_Delay((unsigned int)delay);//compensate if running too fast
-
- if ( SDL_LockYUVOverlay( d_image ) ) {
- return 0;
- }
- switch (input_items.size ()){
- case 3: // first channel=Y, second channel is U , third channel is V
- src_pixels_0 = (short *) input_items[0];
- src_pixels_1 = (short *) input_items[1];
- src_pixels_2 = (short *) input_items[2];
- for (int i = 0; i < noutput_items; i += d_chunk_size){
- copy_plane_to_surface (1,d_chunk_size, src_pixels_1);
- copy_plane_to_surface (2,d_chunk_size, src_pixels_2);
- noutput_items_produced+=copy_plane_to_surface (0,d_chunk_size, src_pixels_0);
- src_pixels_0 += d_chunk_size;
- src_pixels_1 += d_chunk_size;
- src_pixels_2 += d_chunk_size;
- }
- break;
- case 2:
- if(1) //if(pixel_interleaved_uv)
- {
- // first channel=Y, second channel is alternating pixels U and V
- src_pixels_0 = (short *) input_items[0];
- src_pixels_1 = (short *) input_items[1];
- for (int i = 0; i < noutput_items; i += d_chunk_size){
- copy_plane_to_surface (12,d_chunk_size/2, src_pixels_1);
- noutput_items_produced+=copy_plane_to_surface (0,d_chunk_size, src_pixels_0);
- src_pixels_0 += d_chunk_size;
- src_pixels_1 += d_chunk_size;
- }
- } else
- {
- // first channel=Y, second channel is alternating lines U and V
- src_pixels_0 = (short *) input_items[0];
- src_pixels_1 = (short *) input_items[1];
- for (int i = 0; i < noutput_items; i += d_chunk_size){
- copy_plane_to_surface (1222,d_chunk_size/2, src_pixels_1);
- noutput_items_produced+=copy_plane_to_surface (0,d_chunk_size, src_pixels_0);
- src_pixels_0 += d_chunk_size;
- src_pixels_1 += d_chunk_size;
- }
- }
- break;
- case 1: // grey (Y) input
- /* Y component */
- plane=0;
- src_pixels_0 = (short *) input_items[plane];
- for (int i = 0; i < noutput_items; i += d_chunk_size){
- noutput_items_produced+=copy_plane_to_surface (plane,d_chunk_size, src_pixels_0);
- src_pixels_0 += d_chunk_size;
- }
- break;
- default: //0 or more then 3 channels
- std::cerr << "video_sdl_sink_s: Wrong number of channels: ";
- std::cerr <<"1, 2 or 3 channels are supported.\n Requested number of channels is "<< input_items.size () <<"\n";
- throw std::runtime_error ("video_sdl_sink_s");
- }
-
- SDL_UnlockYUVOverlay( d_image );
- return noutput_items_produced;
-}
diff --git a/gr-video-sdl/src/video_sdl_sink_s.h b/gr-video-sdl/src/video_sdl_sink_s.h
deleted file mode 100644
index 64f5b5a6c2..0000000000
--- a/gr-video-sdl/src/video_sdl_sink_s.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_VIDEO_SDL_SINK_S_H
-#define INCLUDED_VIDEO_SDL_SINK_S_H
-
-#include <video_sdl_api.h>
-#include <gr_sync_block.h>
-#include <string>
-#include <SDL.h>
-
-/* fourcc (four character code) */
-#define vid_fourcc(a,b,c,d) (((unsigned)(a)<<0) | ((unsigned)(b)<<8) | ((unsigned)(c)<<16) | ((unsigned)(d)<<24))
-#define IMGFMT_YV12 vid_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */
-
-class video_sdl_sink_s;
-typedef boost::shared_ptr<video_sdl_sink_s> video_sdl_sink_s_sptr;
-
-VIDEO_SDL_API video_sdl_sink_s_sptr
-video_sdl_make_sink_s (double framerate,int width=640, int height=480,unsigned int format=IMGFMT_YV12,int dst_width=-1,int dst_height=-1);
-
-/*!
- * \brief video sink using SDL
- *
- * input signature is one, two or three streams of signed short.
- * One stream: stream is grey (Y)
- * two streems: first is grey (Y), second is alternating U and V
- * Three streams: first is grey (Y), second is U, third is V
- * Input samples must be in the range [0,255].
- */
-
-class VIDEO_SDL_API video_sdl_sink_s : public gr_sync_block {
- friend VIDEO_SDL_API video_sdl_sink_s_sptr
- video_sdl_make_sink_s (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height);
-
- int d_chunk_size;
-
- protected:
- video_sdl_sink_s (double framerate,int width, int height,unsigned int format,
- int dst_width,int dst_height);
- void copy_line_pixel_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,
- const short * src_pixels,int src_width);
- void copy_line_line_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,
- const short * src_pixels,int src_width);
- void copy_line_single_plane(unsigned char *dst_pixels,const short * src_pixels,int src_width);
- void copy_line_single_plane_dec2(unsigned char *dst_pixels,const short * src_pixels,int src_width);
- int copy_plane_to_surface (int plane,int noutput_items,
- const short * src_pixels);
- float d_framerate;
- int d_wanted_frametime_ms;
- int d_width;
- int d_height;
- int d_dst_width;
- int d_dst_height;
- int d_format;
- int d_current_line;
- SDL_Surface *d_screen;
- SDL_Overlay *d_image;
- SDL_Rect d_dst_rect;
- float d_avg_delay;
- unsigned int d_wanted_ticks;
-
-
- public:
- ~video_sdl_sink_s ();
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_VIDEO_SDL_SINK_S_H */
diff --git a/gr-video-sdl/src/video_sdl_sink_uc.cc b/gr-video-sdl/src/video_sdl_sink_uc.cc
deleted file mode 100644
index 360df1109f..0000000000
--- a/gr-video-sdl/src/video_sdl_sink_uc.cc
+++ /dev/null
@@ -1,291 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006,2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <SDL.h>
-
-#include <video_sdl_sink_uc.h>
-#include <gr_io_signature.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <iostream>
-#include <stdexcept>
-#include <string.h>
-
-
-
-video_sdl_sink_uc::video_sdl_sink_uc (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height)
- : gr_sync_block ("video_sdl_sink_uc",
- gr_make_io_signature (1, 3, sizeof (unsigned char)),
- gr_make_io_signature (0, 0, 0)),
- d_chunk_size (width*height),
- d_framerate(framerate),
- d_wanted_frametime_ms(0),
- d_width(width),
- d_height (height),
- d_dst_width(dst_width),
- d_dst_height(dst_height),
- d_format(format),
- d_current_line(0),
- d_screen(NULL),
- d_image(NULL),
- d_avg_delay(0.0),
- d_wanted_ticks(0)
-{
- if(framerate<=0.0)
- d_wanted_frametime_ms=0;//Go as fast as possible
- else
- d_wanted_frametime_ms=(int)(1000.0/framerate);
- if(dst_width<0) d_dst_width=d_width;
- if(dst_height<0) d_dst_height=d_height;
- if(0==format) d_format=IMGFMT_YV12;
-
- atexit(SDL_Quit);//check if this is the way to do this
- if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
- std::cerr << "video_sdl_sink_uc: Couldn't initialize SDL:" << SDL_GetError() << " \n SDL_Init(SDL_INIT_VIDEO) failed\n";
- throw std::runtime_error ("video_sdl_sink_uc");
- };
-
- /* accept any depth */
- d_screen = SDL_SetVideoMode(dst_width, dst_height, 0, SDL_SWSURFACE|SDL_RESIZABLE|SDL_ANYFORMAT);//SDL_DOUBLEBUF |SDL_SWSURFACE| SDL_HWSURFACE||SDL_FULLSCREEN
- if ( d_screen == NULL ) {
- std::cerr << "Unable to set SDL video mode: " << SDL_GetError() <<"\n SDL_SetVideoMode() Failed \n";
- exit(1);
- }
- if ( d_image ) {
- SDL_FreeYUVOverlay(d_image);
- }
- /* Initialize and create the YUV Overlay used for video out */
- if (!(d_image = SDL_CreateYUVOverlay (d_width, d_height, SDL_YV12_OVERLAY, d_screen))) {
- std::cerr << "SDL: Couldn't create a YUV overlay: \n"<< SDL_GetError() <<"\n";
- throw std::runtime_error ("video_sdl_sink_uc");
- }
-
- printf("SDL screen_mode %d bits-per-pixel\n",
- d_screen->format->BitsPerPixel);
- printf("SDL overlay_mode %i \n",
- d_image->format);
- d_chunk_size = std::min(1,16384/width); //width*16;
- d_chunk_size = d_chunk_size*width;
- //d_chunk_size = (int) (width);
- set_output_multiple (d_chunk_size);
- /* Set the default playback area */
- d_dst_rect.x = 0;
- d_dst_rect.y = 0;
- d_dst_rect.w = d_dst_width;
- d_dst_rect.h = d_dst_height;
- //clear the surface to grey
- if ( SDL_LockYUVOverlay( d_image ) ) {
- std::cerr << "SDL: Couldn't lock YUV overlay: \n"<< SDL_GetError() <<"\n";
- throw std::runtime_error ("video_sdl_sink_uc");
- }
- memset(d_image->pixels[0], 128, d_image->pitches[0]*d_height);
- memset(d_image->pixels[1], 128, d_image->pitches[1]*d_height/2);
- memset(d_image->pixels[2], 128, d_image->pitches[2]*d_height/2);
- SDL_UnlockYUVOverlay( d_image );
-}
-
-video_sdl_sink_uc::~video_sdl_sink_uc ()
-{
- SDL_Quit();
-}
-
-video_sdl_sink_uc_sptr
-video_sdl_make_sink_uc (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height)
-{
- return gnuradio::get_initial_sptr(new video_sdl_sink_uc (framerate, width, height,format,dst_width,dst_height));
-}
-
-void
-video_sdl_sink_uc::copy_line_pixel_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,const unsigned char * src_pixels,int src_width)
-{
- for(int i=0;i<src_width;i++)
- {
- dst_pixels_u[i]=src_pixels[i*2];
- dst_pixels_v[i]=src_pixels[i*2+1];
- }
- return;
-}
-
-void
-video_sdl_sink_uc::copy_line_line_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,const unsigned char * src_pixels,int src_width)
-{
- memcpy(dst_pixels_u, src_pixels, src_width);
- memcpy(dst_pixels_v, src_pixels+src_width, src_width);
- return;
-}
-
-void
-video_sdl_sink_uc::copy_line_single_plane(unsigned char *dst_pixels,const unsigned char * src_pixels,int src_width)
-{
- memcpy(dst_pixels, src_pixels, src_width);
- return;
-}
-
-void
-video_sdl_sink_uc::copy_line_single_plane_dec2(unsigned char *dst_pixels,const unsigned char * src_pixels,int src_width)
-{
- for(int i=0,j=0;i<src_width;i+=2,j++)
- {
- dst_pixels[j]=(unsigned char)src_pixels[i];
- }
- return;
-}
-
-int
-video_sdl_sink_uc::copy_plane_to_surface (int plane,int noutput_items,
- const unsigned char * src_pixels)
-{
- const int first_dst_plane=(12==plane ||1122==plane)?1:plane;
- const int second_dst_plane=(12==plane ||1122==plane)?2:plane;
- int current_line=(0==plane)?d_current_line:d_current_line/2;
- unsigned char * dst_pixels = (unsigned char *)d_image->pixels[first_dst_plane];
- dst_pixels=&dst_pixels[current_line*d_image->pitches[first_dst_plane]];
- unsigned char * dst_pixels_2 = (unsigned char *)d_image->pixels[second_dst_plane];
- dst_pixels_2=&dst_pixels_2[current_line*d_image->pitches[second_dst_plane]];
- int src_width=(0==plane || 12==plane || 1122==plane)?d_width:d_width/2;
- int noutput_items_produced=0;
- int max_height=(0==plane)?d_height-1:d_height/2-1;
- for (int i = 0; i < noutput_items; i += src_width){
- //output one line at a time
- if(12==plane)
- {
- copy_line_pixel_interleaved(dst_pixels,dst_pixels_2,src_pixels,src_width);
- dst_pixels_2 += d_image->pitches[second_dst_plane];
- }
- else if (1122==plane)
- {
- copy_line_line_interleaved(dst_pixels,dst_pixels_2,src_pixels,src_width);
- dst_pixels_2 += d_image->pitches[second_dst_plane];
- src_pixels += src_width;
- }
- else if (0==plane)
- copy_line_single_plane(dst_pixels,src_pixels,src_width);
- else /* 1==plane || 2==plane*/
- copy_line_single_plane_dec2(dst_pixels,src_pixels,src_width);//decimate by two horizontally
- src_pixels += src_width;
- dst_pixels += d_image->pitches[first_dst_plane];
- noutput_items_produced+=src_width;
- current_line++;
- if (current_line>max_height)
- {
- //Start new frame
- //TODO, do this all in a seperate thread
- current_line=0;
- dst_pixels=d_image->pixels[first_dst_plane];
- dst_pixels_2=d_image->pixels[second_dst_plane];
- if(0==plane)
- {
- SDL_DisplayYUVOverlay(d_image, &d_dst_rect);
- //SDL_Flip(d_screen);
- unsigned int ticks=SDL_GetTicks();//milliseconds
- d_wanted_ticks+=d_wanted_frametime_ms;
- float avg_alpha=0.1;
- int time_diff=d_wanted_ticks-ticks;
- d_avg_delay=time_diff*avg_alpha +d_avg_delay*(1.0-avg_alpha);
- }
- }
- }
- if(0==plane) d_current_line=current_line;
- return noutput_items_produced;
-}
-
-int
-video_sdl_sink_uc::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- unsigned char *src_pixels_0,*src_pixels_1,*src_pixels_2;
- int noutput_items_produced=0;
- int plane;
- int delay=(int)d_avg_delay;
- if(0==d_wanted_ticks)
- d_wanted_ticks=SDL_GetTicks();
- if(delay>0)
- SDL_Delay((unsigned int)delay);//compensate if running too fast
-
- if ( SDL_LockYUVOverlay( d_image ) ) {
- return 0;
- }
- switch (input_items.size ()){
- case 3: // first channel=Y, second channel is U , third channel is V
- src_pixels_0 = (unsigned char *) input_items[0];
- src_pixels_1 = (unsigned char *) input_items[1];
- src_pixels_2 = (unsigned char *) input_items[2];
- for (int i = 0; i < noutput_items; i += d_chunk_size){
- copy_plane_to_surface (1,d_chunk_size, src_pixels_1);
- copy_plane_to_surface (2,d_chunk_size, src_pixels_2);
- noutput_items_produced+=copy_plane_to_surface (0,d_chunk_size, src_pixels_0);
- src_pixels_0 += d_chunk_size;
- src_pixels_1 += d_chunk_size;
- src_pixels_2 += d_chunk_size;
- }
- break;
- case 2:
- if(1) //if(pixel_interleaved_uv)
- {
- // first channel=Y, second channel is alternating pixels U and V
- src_pixels_0 = (unsigned char *) input_items[0];
- src_pixels_1 = (unsigned char *) input_items[1];
- for (int i = 0; i < noutput_items; i += d_chunk_size){
- copy_plane_to_surface (12,d_chunk_size/2, src_pixels_1);
- noutput_items_produced+=copy_plane_to_surface (0,d_chunk_size, src_pixels_0);
- src_pixels_0 += d_chunk_size;
- src_pixels_1 += d_chunk_size;
- }
- } else
- {
- // first channel=Y, second channel is alternating lines U and V
- src_pixels_0 = (unsigned char *) input_items[0];
- src_pixels_1 = (unsigned char *) input_items[1];
- for (int i = 0; i < noutput_items; i += d_chunk_size){
- copy_plane_to_surface (1222,d_chunk_size/2, src_pixels_1);
- noutput_items_produced+=copy_plane_to_surface (0,d_chunk_size, src_pixels_0);
- src_pixels_0 += d_chunk_size;
- src_pixels_1 += d_chunk_size;
- }
- }
- break;
- case 1: // grey (Y) input
- /* Y component */
- plane=0;
- src_pixels_0 = (unsigned char *) input_items[plane];
- for (int i = 0; i < noutput_items; i += d_chunk_size){
- noutput_items_produced+=copy_plane_to_surface (plane,d_chunk_size, src_pixels_0);
- src_pixels_0 += d_chunk_size;
- }
- break;
- default: //0 or more then 3 channels
- std::cerr << "video_sdl_sink_uc: Wrong number of channels: ";
- std::cerr <<"1, 2 or 3 channels are supported.\n Requested number of channels is "<< input_items.size () <<"\n";
- throw std::runtime_error ("video_sdl_sink_uc");
- }
-
- SDL_UnlockYUVOverlay( d_image );
- return noutput_items_produced;
-}
diff --git a/gr-video-sdl/src/video_sdl_sink_uc.h b/gr-video-sdl/src/video_sdl_sink_uc.h
deleted file mode 100644
index 6c071cf9db..0000000000
--- a/gr-video-sdl/src/video_sdl_sink_uc.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2006 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_VIDEO_SDL_SINK_UC_H
-#define INCLUDED_VIDEO_SDL_SINK_UC_H
-
-#include <video_sdl_api.h>
-#include <gr_sync_block.h>
-#include <string>
-#include <SDL.h>
-
-/* fourcc (four character code) */
-#define vid_fourcc(a,b,c,d) (((unsigned)(a)<<0) | ((unsigned)(b)<<8) | ((unsigned)(c)<<16) | ((unsigned)(d)<<24))
-#define IMGFMT_YV12 vid_fourcc('Y','V','1','2') /* 12 YVU 4:2:0 */
-
-class video_sdl_sink_uc;
-typedef boost::shared_ptr<video_sdl_sink_uc> video_sdl_sink_uc_sptr;
-
-VIDEO_SDL_API video_sdl_sink_uc_sptr
-video_sdl_make_sink_uc (double framerate,int width=640, int height=480,unsigned int format=IMGFMT_YV12,int dst_width=-1,int dst_height=-1);
-
-/*!
- * \brief video sink using SDL
- *
- * input signature is one, two or three streams of uchar.
- * One stream: stream is grey (Y)
- * two streems: first is grey (Y), second is alternating U and V
- * Three streams: first is grey (Y), second is U, third is V
- * Input samples must be in the range [0,255].
- */
-
-class VIDEO_SDL_API video_sdl_sink_uc : public gr_sync_block {
- friend VIDEO_SDL_API video_sdl_sink_uc_sptr
- video_sdl_make_sink_uc (double framerate,int width, int height,unsigned int format,int dst_width,int dst_height);
-
- int d_chunk_size;
-
- protected:
- video_sdl_sink_uc (double framerate,int width, int height,unsigned int format,
- int dst_width,int dst_height);
- void copy_line_pixel_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,
- const unsigned char * src_pixels,int src_width);
- void copy_line_line_interleaved(unsigned char *dst_pixels_u,unsigned char *dst_pixels_v,
- const unsigned char * src_pixels,int src_width);
- void copy_line_single_plane(unsigned char *dst_pixels,const unsigned char * src_pixels,int src_width);
- void copy_line_single_plane_dec2(unsigned char *dst_pixels,const unsigned char * src_pixels,int src_width);
- int copy_plane_to_surface (int plane,int noutput_items,
- const unsigned char * src_pixels);
- float d_framerate;
- int d_wanted_frametime_ms;
- int d_width;
- int d_height;
- int d_dst_width;
- int d_dst_height;
- int d_format;
- int d_current_line;
- SDL_Surface *d_screen;
- SDL_Overlay *d_image;
- SDL_Rect d_dst_rect;
- float d_avg_delay;
- unsigned int d_wanted_ticks;
-
-
- public:
- ~video_sdl_sink_uc ();
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_VIDEO_SDL_SINK_UC_H */
diff --git a/gr-video-sdl/swig/CMakeLists.txt b/gr-video-sdl/swig/CMakeLists.txt
new file mode 100644
index 0000000000..665e398d43
--- /dev/null
+++ b/gr-video-sdl/swig/CMakeLists.txt
@@ -0,0 +1,58 @@
+# Copyright 2012 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+
+########################################################################
+# Setup swig generation
+########################################################################
+include(GrPython)
+include(GrSwig)
+
+set(GR_SWIG_INCLUDE_DIRS
+ ${GNURADIO_CORE_SWIG_INCLUDE_DIRS}
+ ${GR_VIDEO_SDL_INCLUDE_DIRS}
+)
+
+set(GR_SWIG_LIBRARIES gnuradio-video-sdl)
+
+if(ENABLE_GR_CTRLPORT)
+ ADD_DEFINITIONS(-DGR_CTRLPORT)
+endif(ENABLE_GR_CTRLPORT)
+
+# Setup swig docs to depend on includes and pull in from build directory
+set(GR_SWIG_TARGET_DEPS video_sdl_generated_includes)
+set(GR_SWIG_DOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/video_sdl_swig_doc.i)
+set(GR_SWIG_DOC_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/../lib)
+
+set(GR_SWIG_LIBRARIES gnuradio-video-sdl)
+
+GR_SWIG_MAKE(video_sdl_swig video_sdl_swig.i)
+
+GR_SWIG_INSTALL(
+ TARGETS video_sdl_swig
+ DESTINATION ${GR_PYTHON_DIR}/gnuradio/video_sdl
+ COMPONENT "video_sdl_python"
+)
+
+install(
+ FILES
+ video_sdl_swig.i
+ ${CMAKE_CURRENT_BINARY_DIR}/video_sdl_swig_doc.i
+ DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig
+ COMPONENT "video_sdl_swig"
+)
diff --git a/gr-trellis/src/lib/trellis_encoder_XX.i.t b/gr-video-sdl/swig/video_sdl_swig.i
index 29c9c4db33..8561565901 100644
--- a/gr-trellis/src/lib/trellis_encoder_XX.i.t
+++ b/gr-video-sdl/swig/video_sdl_swig.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -20,17 +20,20 @@
* Boston, MA 02110-1301, USA.
*/
-// @WARNING@
+#define VIDEO_SDL_API
-GR_SWIG_BLOCK_MAGIC(trellis,@BASE_NAME@);
+%include "gnuradio.i" // the common stuff
-@SPTR_NAME@ trellis_make_@BASE_NAME@ (const fsm &FSM, int ST);
+//load generated python docstrings
+%include "video_sdl_swig_doc.i"
-class @NAME@ : public gr_sync_block
-{
-private:
- @NAME@ (const fsm &FSM, int ST);
-public:
- fsm FSM () const { return d_FSM; }
- int ST () const { return d_ST; }
-};
+%{
+#include "video_sdl/sink_uc.h"
+#include "video_sdl/sink_s.h"
+%}
+
+%include "video_sdl/sink_uc.h"
+%include "video_sdl/sink_s.h"
+
+GR_SWIG_BLOCK_MAGIC2(video_sdl, sink_uc);
+GR_SWIG_BLOCK_MAGIC2(video_sdl, sink_s);
diff --git a/gr-wxgui/grc/wxgui_fftsink2.xml b/gr-wxgui/grc/wxgui_fftsink2.xml
index 74ee5b173e..ff5c47b85c 100644
--- a/gr-wxgui/grc/wxgui_fftsink2.xml
+++ b/gr-wxgui/grc/wxgui_fftsink2.xml
@@ -8,7 +8,7 @@
<name>WX GUI FFT Sink</name>
<key>wxgui_fftsink2</key>
<category>WX GUI Widgets</category>
- <import>from gnuradio import window</import>
+ <import>from gnuradio.fft import window</import>
<import>from gnuradio.wxgui import fftsink2</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
fftsink2.$(type.fcn)(
diff --git a/gr-wxgui/grc/wxgui_waterfallsink2.xml b/gr-wxgui/grc/wxgui_waterfallsink2.xml
index 8921e87f9a..c02901d336 100644
--- a/gr-wxgui/grc/wxgui_waterfallsink2.xml
+++ b/gr-wxgui/grc/wxgui_waterfallsink2.xml
@@ -8,7 +8,7 @@
<name>WX GUI Waterfall Sink</name>
<key>wxgui_waterfallsink2</key>
<category>WX GUI Widgets</category>
- <import>from gnuradio import window</import>
+ <import>from gnuradio.fft import window</import>
<import>from gnuradio.wxgui import waterfallsink2</import>
<make>#set $parent = $notebook() and 'self.%s.GetPage(%s)'%$notebook() or 'self'
waterfallsink2.$(type.fcn)(
diff --git a/gr-wxgui/src/python/fftsink_gl.py b/gr-wxgui/src/python/fftsink_gl.py
index d4bd052989..e87b86ec2a 100644
--- a/gr-wxgui/src/python/fftsink_gl.py
+++ b/gr-wxgui/src/python/fftsink_gl.py
@@ -29,6 +29,7 @@ import common
from gnuradio import gr, fft
from gnuradio import analog
from gnuradio import blocks
+from gnuradio.fft import logpwrfft
from pubsub import pubsub
from constants import *
import math
@@ -134,12 +135,12 @@ class _fft_sink_base(gr.hier_block2, common.wxgui_hb):
self.win.set_callback(callb)
class fft_sink_f(_fft_sink_base):
- _fft_chain = fft.logpwrfft_f
+ _fft_chain = logpwrfft.logpwrfft_f
_item_size = gr.sizeof_float
_real = True
class fft_sink_c(_fft_sink_base):
- _fft_chain = fft.logpwrfft_c
+ _fft_chain = logpwrfft.logpwrfft_c
_item_size = gr.sizeof_gr_complex
_real = False