blob: bb55afbf252d6a63ce11987a69621a2d779758dc [file] [log] [blame]
Roman Khassraf059bab92015-05-20 12:49:46 +02001/* -*- c++ -*- */
2/*
3 * @file
Roman Khassraf05bfb822015-05-22 11:46:00 +02004 * @author Roman Khassraf <rkhassraf@gmail.com>
Roman Khassraf059bab92015-05-20 12:49:46 +02005 * @section LICENSE
6 *
7 * Gr-gsm is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * Gr-gsm is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with gr-gsm; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef INCLUDED_GSM_TCH_F_DECODER_IMPL_H
24#define INCLUDED_GSM_TCH_F_DECODER_IMPL_H
25
26#include "VocoderFrame.h"
27#include "GSM610Tables.h"
28#include "GSM660Tables.h"
29#include "GSM690Tables.h"
Roman Khassrafd71e6582015-06-02 08:49:12 +020030#include "ViterbiR204.h"
Roman Khassraf059bab92015-05-20 12:49:46 +020031#include <grgsm/decoding/tch_f_decoder.h>
32
33
34#define DATA_BLOCK_SIZE 184
35#define PARITY_SIZE 40
36#define FLUSH_BITS_SIZE 4
37#define PARITY_OUTPUT_SIZE (DATA_BLOCK_SIZE + PARITY_SIZE + FLUSH_BITS_SIZE)
38
39#define CONV_INPUT_SIZE PARITY_OUTPUT_SIZE
40#define CONV_SIZE (2 * CONV_INPUT_SIZE)
41
42#define BLOCKS 8
43#define iBLOCK_SIZE (CONV_SIZE / BLOCKS)
44
45namespace gr {
46 namespace gsm {
47
48 class tch_f_decoder_impl : public tch_f_decoder
49 {
50 private:
51 unsigned int d_collected_bursts_num;
52 unsigned short interleave_trans[CONV_SIZE];
53 pmt::pmt_t d_bursts[8];
54 FILE * d_speech_file;
55 enum tch_mode d_tch_mode;
56 void decode(pmt::pmt_t msg);
Roman Khassraf091a80f2015-05-22 10:39:16 +020057 const unsigned char amr_nb_magic[6] = { 0x23, 0x21, 0x41, 0x4d, 0x52, 0x0a };
Roman Khassraf059bab92015-05-20 12:49:46 +020058 public:
59 tch_f_decoder_impl(tch_mode mode, const std::string &file);
60 ~tch_f_decoder_impl();
61 };
62
63 } // namespace gsm
64} // namespace gr
65
66#endif /* INCLUDED_GSM_TCH_F_DECODER_IMPL_H */
67