November 6, 2002

The ATSC (Advanced Television Standards Committee) reception and
transmission are now working.

atsc_tx is the transmitter main program.
atsc_rx is the receiver main program.

The transmitter takes an mpeg transport stream and turns it into 16-bit
samples at 21.52 Msamples/sec.  The receiver reads 16-bit samples in
at 21.52 Msamples/sec and produces an mpeg transport stream as its
output.

run_rx is a friendlier interface for running the receiver.  It works
around a buffer alignment problem by padding the mpeg transport stream
packets out to 256 bytes.

test_full_loopback loops back the transmitter into the receiver.  It
will produce a bogus, but syntactically correct transport stream for
its input if you don't already have one.

Have fun!  


# -------------------------------------------------------------------------------
# The notes below are mostly out of date.  Some of them may still
# work, but most don't, or are no longer applicable.

ATSC (Advanced Television System Committee) reception and transmission
code is still being tested and integrated.  It integrates with the
free MPEG stream player "xine" (http://xine.sourceforge.net).  We have
been using the xine-{lib,ui}-0.9.10cvs version, with some patches
that aren't yet included here.

To test the integration between GNU Radio and xine, use:

    ./tcp_server -f inputfile.ts

This will run GNU Radio with a file source (inputfile.ts) and a TCP sink
at port 9000 (which can be changed with the "-p NNN" option).  This process
will start up, then hang until someone connects to the TCP socket.  The
next step is to run:

    xine tcp://127.0.0.1:9000.mpeg2

which tells xine to use TCP to connect to port 9000 on the machine
"127.0.0.1" (traditionally "localhost", i.e. the current machine), expecting
to encounter an MPEG 2 stream.  It will bring up a video window displaying
the "xine" logo.  Press RETURN in that window, or the "Play" button in the
control window that opens when you press the right-hand mouse button.
Xine will connect to the TCP socket and play "inputfile.ts" if everything
is working.  (Of course, you can run the server anywhere on the Internet,
and run xine anywhere else, if you know the server's IP address.)

To test GNU Radio ATSC data stream processing, use the atsc_txstub
and atsc_rxstub programs.  The TX stub is the transmit side of an ATSC
transmitter; the RX stub is the receiver.  The code can be modified to
stack up whatever ATSC modules you are testing.  The stubs take input
from files, and send their output either to a file or to a TCP socket.
So, to test the randomizer, examine the source code of the stubs to make
sure that only the randomizer is connected (using the NWO_CONNECT macro)
between the input source and output sink, and then run:

    ./atsc_txstub -f inputfile.ts -o outputfile.rand

That will randomize the input Transport Stream file and send it to
"outputfile.rand".  You can derandomize it by doing:

    ./atsc_rxstub -f outputfile.rand -o checkit.ts

This takes "outputfile.rand" as input, derandomizes, and feeds it to
"checkit.ts".  Use "cmp" to compare "intputfile.ts" to "checkit.ts";
they should be identical, except perhaps for missing a few bytes on
the end due to buffering bugs inside GNU Radio at end-of-file.

When using the convolutional interleaver (which atsc_txstub and
atsc_rxstub do by default), there is an end-to-end delay of 52 MPEG
packets, each of which is 188 bytes long, between when the transmitter
sends a packet and when the receiver gets it.  Hence, to check for
correctness, start your comparison of the output file by skipping the
first 9776 bytes (52 * 188).  Take a look at ./test_loopback in this
directory.  It runs atsc_txstub, atsc_rxstub and performs the checking
for you.

If instead you wanted to feed the derandomized output Transport Stream 
file to xine for display, you could run:

    ./atsc_rxstub -f outputfile.rand -p 9000

and then run xine as above.

----------------------------------------------------------------

To test the bottom portion of the VSB transmit/receiver path try the
following:

	./make_data	

This does the following:  First, generates fake input for the VSB modulator.
creates random.dseg and field_syncs.dseg, input files which contain
atsc_data_segment's, that is, 3 bit symbols ready for the modulator.
random.dseg consists of two complete fields, including two field
sync segments and 312*2 random normal data segments.

Then, as a second step, this script runs the input through the
vsbtx_weaver VSB modulator and produces random.vsb and
field_syncs.vsb, files of floats which are the actual samples
transmitted.


Now, run the bottom end receiver module.

  ./exp2 -F random.vsb -o /tmp/m0 

[look at the doitx shell script for more info] 

The receiver writes a bunch of binary intermediate data that we
ususally use octave to view.  files of binary floats can be read into
octave using src/utils/read_float_binary.m.  Also see utils.m in this
directory for additional tools.  loadloops is a favorite.  Note that
this isn't ready for prime time, but it's getting there.
