Time stamps
At the receiving end, video and audio access units belonging to different programmes arrive at different times. A demultiplexer picks out the video and audio access units belonging to the selected programme and stores them into a buffer. When instructed to do so, the video decoder takes a complete access unit from the buffer, decodes it and displays the picture on the screen. Similarly, the audio decoder decodes audio access units to provide a few mil- liseconds of sound in sync with the displayed picture. This process can only be carried out with a common time base if the video access units are dis- played in the correct order and in sync with the audio pieces, what is known as lip sync. This is provided by time stamps. It is generated at the multiplex- ing/formatting stage at the transmitting end. There are two types of time stamp: presentation time stamp (PTS) and decoding time stamp (DTS). The PTS specifies the time when an access unit should be removed from the buffer, decoded and displayed at the receiving end. A PTS is adequate for decoding audio and other data. However, a second time stamp is required to decode the video elementary stream; this is the DTS. A DTS specifies the time when a video access unit should be removed from the buffer and decoded but not displayed to the viewer. Instead, the decoded picture is held temporarily in memory for later presentation. This is necessary for I- and P-coded pictures where they are separated by a B-coded picture. In these cases, both DTS and PTS are necessary. The PTS determines the time when the video access unit is decoded and the DTS determines the time when the decoded picture is released from the temporary store for presentation to the viewer. This means the PTS will always be longer than the DTS. The transfer of data from the buffer and the decoding process itself take a certain amount of time, and this has to be compensated in the design of the decoder. Failure to do this would result in lip-sync fault as experienced by some cheap decoder boxes.
It is not necessary for every access unit to be allocated a time stamp. A decoder will normally know the rate at which access units are to be decoded and it is therefore sufficient to provide time stamps on an occasional basis to ensure the decoding process maintains long-term synchronisation. For DTV broadcasting, MPEG specifies that a time stamp must occur at least every 100 ms in an audio or video PES.
Program clock reference
For the time stamps to have meaning at the receiving end, some common measure of time must be available. This is provided by the programme clock generated at the multiplier stage of the transmitter. The programme clock is based on the 27 MHz video sampling clock. There is no requirement that the system clock should be related to any real-time standard. It is purely a notional time. In the transport stream multiplex, which carries a number of programmes, each programme has its own independent programme clock but it need not be synchronised with the clocks of other programmes, although several programmes may share a single programme clock. Access units are assigned time stamps based on the programme clock. The 27 MHz clock is divided by a factor of 300 to generate a standard time unit of 90 kHz expressed as a 33-bit binary number. A similar process is carried out for the 47.5 MHz system clock for an HD transport stream. Samples of this clock, known as the programme clock reference (PCR), are included in the transport stream. A PCR for each programme clock in the multiplex must appear in the transport stream at least every 100 ms.
At the receiving end, the PCR arriving on the transport stream is used to speed up or slow down the local 27 MHz (47.5 MHz for HDTV) voltage- controlled oscillator. This ensures the two transmitter and receiver clocks are fully synchronised.