GNU Radio's DAB Package
mp4_decode_bs_impl.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 *
4 * Copyright 2017 Moritz Luca Schmid, Communications Engineering Lab (CEL) / Karlsruhe Institute of Technology (KIT).
5 *
6 * GNU Radio block written for gr-dab including the following third party elements:
7 * -QT-DAB: classes mp4Processor and faad-decoder except the reed-solomon class
8 * Copyright (C) 2013
9 * Jan van Katwijk (J.vanKatwijk@gmail.com)
10 * Lazy Chair Computing
11 * -KA9Q: the char-sized Reed-Solomon encoder and decoder of the libfec library
12 * (details on the license see /fec/LICENCE)
13 *
14 * This is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3, or (at your option)
17 * any later version.
18 *
19 * This software is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this software; see the file COPYING. If not, write to
26 * the Free Software Foundation, Inc., 51 Franklin Street,
27 * Boston, MA 02110-1301, USA.
28 */
29
30#ifndef INCLUDED_DAB_MP4_DECODE_BS_IMPL_H
31#define INCLUDED_DAB_MP4_DECODE_BS_IMPL_H
32
33#include <dab/mp4_decode_bs.h>
34#include "neaacdec.h"
35
36namespace gr {
37 namespace dab {
38/*! \brief DAB+ Audio frame decoder
39 * according to ETSI TS 102 563
40 */
42 private:
43 int d_nsamples_produced;
44 int d_bit_rate_n;
45 int d_sample_rate;
46 int d_superframe_size;
47 bool d_aacInitialized;
48 int32_t baudRate;
49 uint8_t d_dac_rate, d_sbr_flag, d_aac_channel_mode, d_ps_flag, d_mpeg_surround, d_num_aus;
50 int16_t d_au_start[10];
51 bool d_first;
52
53 NeAACDecHandle aacHandle;
54
55 bool crc16(const uint8_t *msg, int16_t len);
56
57 uint16_t BinToDec(const uint8_t *data, size_t offset, size_t length);
58
59 int get_aac_channel_configuration(int16_t m_mpeg_surround_config, uint8_t aacChannelMode);
60
61 bool initialize(uint8_t dacRate,
62 uint8_t sbrFlag,
63 int16_t mpegSurround,
64 uint8_t aacChannelMode);
65
66 void handle_aac_frame(const uint8_t *v,
67 int16_t frame_length,
68 uint8_t dacRate,
69 uint8_t sbrFlag,
70 uint8_t mpegSurround,
71 uint8_t aacChannelMode,
72 int16_t *out_sample1,
73 int16_t *out_sample2);
74
75 int16_t MP42PCM(uint8_t dacRate,
76 uint8_t sbrFlag,
77 int16_t mpegSurround,
78 uint8_t aacChannelMode,
79 uint8_t buffer[],
80 int16_t bufferLength,
81 int16_t *out_sample1,
82 int16_t *out_sample2);
83
84 public:
85 mp4_decode_bs_impl(int bit_rate_n);
86
88
89 virtual int get_sample_rate()
90 { return d_sample_rate; }
91
92 // Where all the action really happens
93 void forecast(int noutput_items, gr_vector_int &ninput_items_required);
94
95 int general_work(int noutput_items,
96 gr_vector_int &ninput_items,
97 gr_vector_const_void_star &input_items,
98 gr_vector_void_star &output_items);
99 };
100
101 } // namespace dab
102} // namespace gr
103
104#endif /* INCLUDED_DAB_MP4_DECODE_BS_IMPL_H */
DAB+ Audio frame decoder according to ETSI TS 102 563.
Definition mp4_decode_bs_impl.h:41
mp4_decode_bs_impl(int bit_rate_n)
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
void forecast(int noutput_items, gr_vector_int &ninput_items_required)
virtual int get_sample_rate()
Definition mp4_decode_bs_impl.h:89
DAB+ Audio frame decoder.
Definition mp4_decode_bs.h:38
Definition complex_to_interleaved_float_vcf.h:28
void * NeAACDecHandle
Definition neaacdec.h:140