diff --git a/op25/gr-op25_repeater/grc/CMakeLists.txt b/op25/gr-op25_repeater/grc/CMakeLists.txt index f0389b4..4304f9f 100644 --- a/op25/gr-op25_repeater/grc/CMakeLists.txt +++ b/op25/gr-op25_repeater/grc/CMakeLists.txt @@ -20,5 +20,6 @@ install(FILES op25_repeater_vocoder.xml op25_repeater_gardner_costas_cc.xml op25_repeater_p25_frame_assembler.xml - op25_repeater_fsk4_slicer_fb.xml DESTINATION share/gnuradio/grc/blocks + op25_repeater_fsk4_slicer_fb.xml + op25_repeater_p25p2_frame.xml DESTINATION share/gnuradio/grc/blocks ) diff --git a/op25/gr-op25_repeater/include/op25_repeater/CMakeLists.txt b/op25/gr-op25_repeater/include/op25_repeater/CMakeLists.txt index 49f75d2..4e44dfc 100644 --- a/op25/gr-op25_repeater/include/op25_repeater/CMakeLists.txt +++ b/op25/gr-op25_repeater/include/op25_repeater/CMakeLists.txt @@ -25,5 +25,6 @@ install(FILES vocoder.h gardner_costas_cc.h p25_frame_assembler.h - fsk4_slicer_fb.h DESTINATION include/op25_repeater + fsk4_slicer_fb.h + p25p2_frame.h DESTINATION include/op25_repeater ) diff --git a/op25/gr-op25_repeater/lib/CMakeLists.txt b/op25/gr-op25_repeater/lib/CMakeLists.txt index 39c3fa8..a17a09e 100644 --- a/op25/gr-op25_repeater/lib/CMakeLists.txt +++ b/op25/gr-op25_repeater/lib/CMakeLists.txt @@ -28,14 +28,23 @@ list(APPEND op25_repeater_sources vocoder_impl.cc gardner_costas_cc_impl.cc p25_frame_assembler_impl.cc - fsk4_slicer_fb_impl.cc ) + fsk4_slicer_fb_impl.cc + p25p2_frame_impl.cc ) list(APPEND op25_repeater_sources bch.cc rs.cc p25_framer.cc + p25p2_framer.cc + p25p2_isch.cc + p25p2_duid.cc + p25p2_sync.cc + p25p2_tdma.cc + p25p2_vf.cc imbe_decoder.cc software_imbe_decoder.cc + ambe.c + mbelib.c ) add_library(gnuradio-op25_repeater SHARED ${op25_repeater_sources}) diff --git a/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.cc b/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.cc index 36e236a..6285ac7 100644 --- a/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.cc +++ b/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010, 2011, 2012, 2013 KA1RBI + * Copyright 2010, 2011, 2012, 2013, 2014 Max H. Parke KA1RBI * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.h b/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.h index c8e0a36..657ecb3 100644 --- a/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.h +++ b/op25/gr-op25_repeater/lib/p25_frame_assembler_impl.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2009, 2010, 2011, 2012, 2013 KA1RBI + * Copyright 2009, 2010, 2011, 2012, 2013, 2014 Max H. Parke KA1RBI * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/op25/gr-op25_repeater/lib/rs.cc b/op25/gr-op25_repeater/lib/rs.cc index c14b783..9152182 100644 --- a/op25/gr-op25_repeater/lib/rs.cc +++ b/op25/gr-op25_repeater/lib/rs.cc @@ -458,6 +458,11 @@ CW = (CW ^ correction) >> 11; return CW; } +uint32_t gly23127Dec (uint32_t CW) { + uint32_t correction = gly23127DecTbl[gly23127GetSyn(CW)]; + CW = (CW ^ correction) >> 11; + return CW; +} void ProcHDU(const_bit_vector A) { int i, j, k, ec; diff --git a/op25/gr-op25_repeater/lib/rs.h b/op25/gr-op25_repeater/lib/rs.h index 6b2544f..37c7c21 100644 --- a/op25/gr-op25_repeater/lib/rs.h +++ b/op25/gr-op25_repeater/lib/rs.h @@ -11,5 +11,7 @@ void ProcHDU(const_bit_vector A); void ProcTDU(const_bit_vector A); void ProcLDU1(const_bit_vector A); void ProcLDU2(const_bit_vector A); +uint32_t gly24128Dec (uint32_t n) ; +uint32_t gly23127Dec (uint32_t n) ; #endif diff --git a/op25/gr-op25_repeater/lib/software_imbe_decoder.cc b/op25/gr-op25_repeater/lib/software_imbe_decoder.cc index fecf5c1..134b0b3 100644 --- a/op25/gr-op25_repeater/lib/software_imbe_decoder.cc +++ b/op25/gr-op25_repeater/lib/software_imbe_decoder.cc @@ -926,6 +926,49 @@ software_imbe_decoder::decode_audio(uint8_t *A) tmp_f = Old; Old = New; New = tmp_f; } +void +software_imbe_decoder::decode_tap(int _L, int _K, float _w0, const int * _v, const float * _mu) +{ + int ell; + uint32_t ET; + float SE = 0, ER = 0; + int en, tmp_f; + + L = _L; + int K = _K; + w0 = _w0; + for(ell = 1; ell <= L; ell++) { + vee[ell][ New] = _v[ell - 1]; + Mu[ell][ New] = _mu[ell - 1]; + } + // decode_spectral_amplitudes(Start3, Start8); + enhance_spectral_amplitudes(SE); + adaptive_smoothing(SE, ER, ET); + + // (8000 samp/sec) * (1 sec / 50 compressed voice frames) = 160 samples/frame + + //synth: + synth_unvoiced();// ToDo: make suv return value? + synth_voiced(); // ToDo: make sv return value? + + //output: + audio_samples *samples = audio(); + for(en = 0; en <= 159; en++) { + // The unvoiced samples are loud and the voiced are low...I don't know why. + // Most of the difference is compensated by removing the 146.6433 factor + // in the synth_unvoiced procedure. The final tweak is done by raising the + // voiced samples: + float sample = suv[en] + sv[en] * 4; //balance v/uv loudness + if(abs((int)sample) > 32767) { + sample = 32767 * (sample < 0) ? -1 : 1; // * sgn(sample) + } + samples->push_back((short)sample); + } + OldL = L; + Oldw0 = w0; + tmp_f = Old; Old = New; New = tmp_f; +} + void software_imbe_decoder::decode_spectral_amplitudes(int Start3, int Start8) { diff --git a/op25/gr-op25_repeater/lib/software_imbe_decoder.h b/op25/gr-op25_repeater/lib/software_imbe_decoder.h index aae1e70..7573bd4 100644 --- a/op25/gr-op25_repeater/lib/software_imbe_decoder.h +++ b/op25/gr-op25_repeater/lib/software_imbe_decoder.h @@ -51,6 +51,7 @@ public: */ virtual void decode(const voice_codeword& cw); + void decode_tap(int _L, int _K, float _w0, const int * _v, const float * _mu); private: //NOTE: Single-letter variable names are upper case only; Lower diff --git a/op25/gr-op25_repeater/python/CMakeLists.txt b/op25/gr-op25_repeater/python/CMakeLists.txt index 9958577..bc7eece 100644 --- a/op25/gr-op25_repeater/python/CMakeLists.txt +++ b/op25/gr-op25_repeater/python/CMakeLists.txt @@ -45,3 +45,4 @@ GR_ADD_TEST(qa_vocoder ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_vocod GR_ADD_TEST(qa_gardner_costas_cc ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_gardner_costas_cc.py) GR_ADD_TEST(qa_p25_frame_assembler ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_p25_frame_assembler.py) GR_ADD_TEST(qa_fsk4_slicer_fb ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_fsk4_slicer_fb.py) +GR_ADD_TEST(qa_p25p2_frame ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_p25p2_frame.py) diff --git a/op25/gr-op25_repeater/swig/op25_repeater_swig.i b/op25/gr-op25_repeater/swig/op25_repeater_swig.i index 59e7476..c2cc9a0 100644 --- a/op25/gr-op25_repeater/swig/op25_repeater_swig.i +++ b/op25/gr-op25_repeater/swig/op25_repeater_swig.i @@ -12,6 +12,7 @@ #include "op25_repeater/gardner_costas_cc.h" #include "op25_repeater/p25_frame_assembler.h" #include "op25_repeater/fsk4_slicer_fb.h" +#include "op25_repeater/p25p2_frame.h" %} %include "op25_repeater/vocoder.h" @@ -24,3 +25,5 @@ GR_SWIG_BLOCK_MAGIC2(op25_repeater, p25_frame_assembler); %include "op25_repeater/fsk4_slicer_fb.h" GR_SWIG_BLOCK_MAGIC2(op25_repeater, fsk4_slicer_fb); +%include "op25_repeater/p25p2_frame.h" +GR_SWIG_BLOCK_MAGIC2(op25_repeater, p25p2_frame);