Exemplo n.º 1
0
	def test_loopback_rand_rs_int(self):
		"""
		Loopback of data, (de)randomiser, rs (en/de)coder, (de)interleaver
		"""
		src_data = make_transport_stream()
		# Disregard end bytes of source data, accounting for interleaver delay
		expected_delay = dvb_interleaver_bb.DELAY * \
				dvb_swig.MPEG_TS_PKT_LENGTH / dvb_swig.DVB_RS_ENCODED_LENGTH
		expected_result = tuple(src_data[:-expected_delay])

		src = gr.vector_source_b(src_data)
		txpad = dvb_swig.pad_mpeg_ts_packet_bp()
		randomizer = dvb_swig.randomizer_pp()
		rs_encoder = dvb_swig.rs_encoder_pp()
		txdepad = dvb_swig.depad_dvb_packet_rs_encoded_pb()
		interleaver = dvb_interleaver_bb.interleaver_bb()
		deinterleaver = dvb_interleaver_bb.deinterleaver_bb()
		rxpad = dvb_swig.pad_dvb_packet_rs_encoded_bp()
		rs_decoder = dvb_swig.rs_decoder_pp()
		derandomizer = dvb_swig.derandomizer_pp()
		rxdepad = dvb_swig.depad_mpeg_ts_packet_pb()
		dst = gr.vector_sink_b()

		# Connect and run
		self.tb.connect(src, txpad, randomizer, rs_encoder, txdepad, interleaver, deinterleaver)
		self.tb.connect(deinterleaver, rxpad, rs_decoder, derandomizer, rxdepad, dst)
		self.tb.run()
		# Check that the decoded bytes are the same as original
		self.assertEqual(expected_result, dst.data())
Exemplo n.º 2
0
	def test_interleaver_bb(self):
		"""
		DVB convolutional interleaver, deinterleaver and their associated delays
		"""
		data_length = 3000
		src_data = [i % 256 for i in range(data_length)]
		# Ensure that we check for longer than fixed delay of 2244 bytes total to be meaningful
		self.assertTrue(data_length > dvb_interleaver_bb.DELAY)
		# We expect only the bytes prior to DELAY - they're still in the shift registers
		expected_result = tuple(src_data[:-dvb_interleaver_bb.DELAY])

		src = gr.vector_source_b(src_data)
		interleaver = dvb_interleaver_bb.interleaver_bb()
		deinterleaver = dvb_interleaver_bb.deinterleaver_bb()
		dst = gr.vector_sink_b()

		self.tb.connect(src, interleaver, deinterleaver, dst)
		self.tb.run()
		self.assertEqual(expected_result, dst.data())