def test_loopback_003(self): """ Loopback randomizer/rs_encoder/interleaver/trellis_encoder via ds_to_softds to viterbi_decoder/deinterleaver/rs_decoder/derandomizer """ src_data = make_transport_stream() interleaver_delay = 52 viterbi_delay = 12 expected_result = src_data[0:len(src_data)-((interleaver_delay+viterbi_delay)*atsc.ATSC_MPEG_PKT_LENGTH)] src = vector_source_ts(src_data) rand = atsc.randomizer() rs_enc = atsc.rs_encoder() inter = atsc.interleaver() trellis = atsc.trellis_encoder() softds = atsc.ds_to_softds() viterbi = atsc.viterbi_decoder() deinter = atsc.deinterleaver() rs_dec = atsc.rs_decoder() derand = atsc.derandomizer() dst = vector_sink_ts() self.tb.connect(src, rand, rs_enc, inter, trellis, softds, viterbi, deinter, rs_dec, derand, dst) self.tb.run () result_data = dst.data ()[((interleaver_delay+viterbi_delay)*atsc.ATSC_MPEG_PKT_LENGTH):len(dst.data())] self.assertEqual (expected_result, result_data)
def test_loopback_002(self): """ Loopback randomizer/rs_encoder/interleaver to deinterleaver/rs_decoder/derandomizer """ src_data = make_transport_stream() interleaver_delay = 52 expected_result = src_data[0:len(src_data) - (interleaver_delay * atsc.ATSC_MPEG_PKT_LENGTH)] src = vector_source_ts(src_data) rand = atsc.randomizer() rs_enc = atsc.rs_encoder() inter = atsc.interleaver() deinter = atsc.deinterleaver() rs_dec = atsc.rs_decoder() derand = atsc.derandomizer() dst = vector_sink_ts() self.tb.connect(src, rand, rs_enc, inter, deinter, rs_dec, derand, dst) self.tb.run() result_data = dst.data() result_data = result_data[(interleaver_delay * atsc.ATSC_MPEG_PKT_LENGTH):len(result_data)] self.assertEqual(expected_result, result_data)
def test_loopback_002(self): """ Loopback randomizer/rs_encoder/interleaver to deinterleaver/rs_decoder/derandomizer """ src_data = make_transport_stream() interleaver_delay = 52 expected_result = src_data[0:len(src_data)-(interleaver_delay*atsc.ATSC_MPEG_PKT_LENGTH)] src = vector_source_ts(src_data) rand = atsc.randomizer() rs_enc = atsc.rs_encoder() inter = atsc.interleaver() deinter = atsc.deinterleaver() rs_dec = atsc.rs_decoder() derand = atsc.derandomizer() dst = vector_sink_ts() self.tb.connect(src, rand, rs_enc, inter, deinter, rs_dec, derand, dst) self.tb.run () result_data = dst.data () result_data = result_data[(interleaver_delay*atsc.ATSC_MPEG_PKT_LENGTH):len(result_data)] self.assertEqual (expected_result, result_data)