Skip to content

Commit

Permalink
Add support for processing multiple input stream in TS mode
Browse files Browse the repository at this point in the history
  • Loading branch information
fsschiava committed Feb 25, 2024
1 parent 5109828 commit 24ab25c
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
9 changes: 8 additions & 1 deletion apps/dvbs2-rx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class DVBS2RxTopBlock(gr.top_block, Qt.QWidget):
self.ldpc_iterations = options.ldpc_iterations
self.modcod = options.modcod
self.multistream = options.multistream
self.multistream_isi = options.multistream_isi
self.out_fd = options.out_fd
self.out_file = options.out_file
self.out_stream = options.out_stream
Expand Down Expand Up @@ -866,7 +867,7 @@ class DVBS2RxTopBlock(gr.top_block, Qt.QWidget):
bbdescrambler = dvbs2rx.bbdescrambler_bb(standard, frame_size,
code_rate)
bbdeheader = dvbs2rx.bbdeheader_bb(standard, frame_size, code_rate,
self.debug)
self.multistream_isi, self.debug)

self.connect((ldpc_decoder, 0), (bch_decoder, 0), (bbdescrambler, 0))

Expand Down Expand Up @@ -1234,6 +1235,12 @@ def argument_parser():
help="Enable processing of multiple input streams (MIS mode). Set to "
"\"auto\" if unsure about whether the input signal uses SIS or MIS. "
"Otherwise, choose \"on\" or \"off\" for better performance.")
dvb_group.add_argument(
"--multistream-isi",
type=int,
default=0,
help="Select which stream to process when operating in MIS mode and "
"output stream is MPEG TS.")
dvb_group.add_argument(
'-p',
"--pilots",
Expand Down
1 change: 1 addition & 0 deletions include/gnuradio/dvbs2rx/bbdeheader_bb.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class DVBS2RX_API bbdeheader_bb : virtual public gr::block
static sptr make(dvb_standard_t standard,
dvb_framesize_t framesize,
dvb_code_rate_t rate,
int multistream_isi = 0,
int debug_level = 0);

/*!
Expand Down
11 changes: 10 additions & 1 deletion lib/bbdeheader_bb_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ namespace dvbs2rx {
bbdeheader_bb::sptr bbdeheader_bb::make(dvb_standard_t standard,
dvb_framesize_t framesize,
dvb_code_rate_t rate,
int multistream_isi,
int debug_level)
{
return gnuradio::get_initial_sptr(
new bbdeheader_bb_impl(standard, framesize, rate, debug_level));
new bbdeheader_bb_impl(standard, framesize, rate, multistream_isi, debug_level));
}

/*
Expand All @@ -39,13 +40,15 @@ bbdeheader_bb::sptr bbdeheader_bb::make(dvb_standard_t standard,
bbdeheader_bb_impl::bbdeheader_bb_impl(dvb_standard_t standard,
dvb_framesize_t framesize,
dvb_code_rate_t rate,
int multistream_isi,
int debug_level)
: gr::block("bbdeheader_bb",
gr::io_signature::make(1, 1, sizeof(unsigned char)),
gr::io_signature::make(1, 1, sizeof(unsigned char))),
d_debug_level(debug_level),
d_synched(false),
d_partial_ts_bytes(0),
d_multistream_isi(multistream_isi),
d_packet_cnt(0),
d_error_cnt(0),
d_bbframe_cnt(0),
Expand Down Expand Up @@ -199,6 +202,12 @@ int bbdeheader_bb_impl::general_work(int noutput_items,
d_bbheader.sync,
d_bbheader.syncd);

// Limit processing to user-specified ISI BBFRAMEs only
if ((d_bbheader.sis_mis == 0) && (d_bbheader.isi != d_multistream_isi)) {
in += d_kbch_bytes;
continue;
}

// Skip the BBHEADER
in += BB_HEADER_LENGTH_BYTES;
unsigned int df_remaining = d_bbheader.dfl / 8; // DATAFIELD bytes remaining
Expand Down
2 changes: 2 additions & 0 deletions lib/bbdeheader_bb_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class bbdeheader_bb_impl : public bbdeheader_bb
unsigned int d_partial_ts_bytes; /**< Byte count of the partial TS packet
extracted at the end of the previous BBFRAME */
unsigned char d_partial_pkt[TS_PACKET_LENGTH+3]; /**< Partial TS packet storage */
const int d_multistream_isi; /**< ISI to process in MIS mode */
BBHeader d_bbheader; /**< Parsed BBHEADER */
uint64_t d_packet_cnt; /**< All-time count of received packets */
uint64_t d_error_cnt; /**< All-time count of packets with bit errors */
Expand Down Expand Up @@ -76,6 +77,7 @@ class bbdeheader_bb_impl : public bbdeheader_bb
bbdeheader_bb_impl(dvb_standard_t standard,
dvb_framesize_t framesize,
dvb_code_rate_t rate,
int multistream_isi,
int debug_level);
~bbdeheader_bb_impl();

Expand Down
1 change: 1 addition & 0 deletions python/dvbs2rx/bindings/bbdeheader_bb_python.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ void bind_bbdeheader_bb(py::module& m)
py::arg("standard"),
py::arg("framesize"),
py::arg("rate"),
py::arg("multistream_isi") = 0,
py::arg("debug_level") = 0,
D(bbdeheader_bb, make))

Expand Down

0 comments on commit 24ab25c

Please sign in to comment.