Encoder Testing 25W - 14588 - 0
Encoder Testing 25W - 14588 - 0
Encoder Testing
The MPEG-2 (ISO/IEC 13818) standard, finalized in 1994, includes Understanding the MPEG-2 standard
several sections on the system layer (Program and Transport MPEG-2 is today’s dominant digital compression standard because it
Stream) as well as a definition of the Elementary Streams (video, enables the delivery of high quality transmission of multiple programs
audio and data). in a single digital signal, and because it paves the way for high defi-
The standard was written for MPEG-2 decoders. There is no specifi- nition TV. Its compression algorithm is based on discrete cosine
cation for MPEG-2 encoders. This approach allows encoder designers transform (DCT) coding and interframe motion compensation. Today’s
to implement any design they want, as long as any MPEG-2 decoder encoders provide internal conversion from PAL or NTSC to a data
following the ISO/IEC 13818 standard can properly decode the output stream of 270 Mb/s, and/or have a direct SDI input. Using MPEG-2
of that design. While encoders are typically more complicated and compression, spatial and temporal redundancies within the moving
much more expensive than decoders, testing an encoder for compli- pictures are removed and the data stream is compressed to less
ance with the MPEG-2 standard is somewhat simpler than verifying a than 3 Mb/s. In addition, the audio is compressed down to less
decoder. It is not, however, a trivial task. than 400 kb/s.
This application note will focus on the particular issues encoder The output stream of an MPEG-2 audio or video encoder is called
designers face when testing for MPEG-2 compliance and the meas- an Elementary Stream (ES). An Elementary Stream can be broken
urement solutions Tektronix provides that streamline encoder charac- into convenient-sized data blocks in a Packetized Elementary
terization and testing. Stream (PES).
1 www.tektronix.com/video_audio
Encoder Testing
Application Note
These data blocks need header information to identify the start of the the decoder clock to the encoder clock, the SPTS is more common
packets and must include time stamps because packetizing disrupts than the PS.
the time axis. A TS is more than just a multiplex of audio and video PES. In addition
Figure 1 shows that video and audio PES can be combined to form a to the compressed audio, video and data, a TS includes a great deal
Program Stream (PS), provided the audio and video encoders are of metadata describing the bit stream. This includes the Program
locked to a common clock. Time stamps in each PES ensure lip-sync Association Table (PAT) that lists every program in the transport
between the video and audio. Program streams have variable length stream. Each entry in the PAT points to a Program Map Table (PMT)
packets with headers. They find use in data transfers to and from that lists the elementary streams making up each program. Some
optical and hard disks, which are error free and in which files of programs will be open, but some programs may be subject to
arbitrary sizes are expected. DVD uses program streams. conditional access (encryption) and this information is also carried
For transmission and digital broadcasting, several programs and their in the metadata.
associated PES can be multiplexed into a single Transport Stream (TS). The TS consists of fixed-sized data packets, each containing 188 bytes
A TS differs from a PS in that the PES packets are further subdivided (Figure 2). Each packet carries a packet identifier code (PID). Packets
into short fixed-size packets and in that multiple programs encoded in the same elementary stream all have the same PID, so the decoder
with different clocks can be carried. This is possible because a trans- (or demultiplexer) can select the elementary stream(s) it wants and
port stream has a program clock reference (PCR) mechanism that reject the remainder. Packet continuity counts ensure that every
allows transmission of multiple clocks, one of which is selected and packet that is needed to decode a stream is received. An effective
regenerated at the decoder. The ATSC standard, however, mandates synchronization system is needed so that decoders can correctly
that each picture frame be placed in a single PES. identify the beginning of each packet and deserialize the bit stream
A Single Program Transport Stream (SPTS) is also possible and may be into words.
found between an encoder and a multiplexer. Since a TS can genlock
Elementary Single
Stream Transport Program
Stream
MUX Transport
Stream
Data
2 www.tektronix.com/video_audio
Encoder Testing
Application Note
Testing for decodability errors overall bandwidth and efficiency of the transport stream under test.
The most critical error, with respect to the decodability of the encoded And its graphic and dynamic displays show the data rates,
signal, is loss of the transport stream sync. That is, the sync byte is percentage of use and global data information for each program,
missing (typically, because no signal is present). The sync byte always PID and the transport stream.
contains a value of hexadecimal 47 (decimal 71). Whenever an Other tests of decodability require that we take a closer look at the
unlocked MPEG-2 receiver reads its first 47h, it then expects another construction of the MPEG-2 transport stream. Referring again to
sync byte to arrive 188 bytes later. The number of consecutive packets Figure 2, transport stream segments of direct interest here are the
with good sync bytes required to achieve lock is device dependent, but packet ID (PID), the scrambling control field, the continuity counter
it typically ranges from two to six. Without these consecutive good and the payload. Because the payload of each packet is identified by
sync bytes, a receiving device cannot remain locked up with (synchro- its PID value, proper transmission of the PID is essential to decoding
nized to) the transmitted signal. the transport stream. Other referencing information that can be con-
The Tektronix MTS300 Multi-Standard MPEG Test System can be used tained in the payload relates PID values to specific programs in a
for real-time monitoring and analysis of the quality of the sync byte in transport stream.
the transport stream. It provides status-at-a-glance display of the
71 0 1 0 0 0 1 0
8 1 1 1 13 2 2 4
Payload
www.tektronix.com/video_audio 3
Encoder Testing
Application Note
In Figure 3, which continues in greater detail the referencing begun in Here, at the low level of reference that is the program map table, are
Figure 2, we see that PIDs can identify (“point to”) further sets of PIDs. the PIDs of the audio, video and data packets of that program (data
Program specific information is usually sent every 100 ms or so to packets traditionally comprised teletext but now also include web
ensure that any consumer can access any desired program as swiftly access information for internet access applications like WebTV). In
as possible after switching on, or after switching to a new TS. It also Figure 3, the program association table indicates that the PMT of pro-
ensures that consumer receivers are updated with any program gram 3 will arrive in a PID 33 packet. Upon consulting the table of PID
changes. An example of such a program change would be when a 33, the decoder sees that the video content for program 3 is in all the
channel switches from showing shopping-club programming to local- packets with a PID value of 19, and the audio is in all the packets with
area programming late at night. This information is indicated in the PID values of 81 and 82. Figure 3 shows how all these differently
program association table (PAT), which in fact is the top level of the functioning packets are carried in the transport stream by a time divi-
MPEG-2 transport stream hierarchy, and whose packet ID is always 0. sion multiplexing process.
This table lists all the programs in the transport stream and associates
each program with another PID, that of a packet with a program map
table (PMT) as its payload.
PID 0
Network Information
Table (NIT)
Program Association
Table (PAT)
Private
Program 0 PID 16 Network
Program 1 PID 22 Data
PID 22 Program 3 PID 33
… … PID 33
Program k PID k
… …
Conditional Access
Table (CAT)/EMM
Stream Type PID Program Map Stream Type PID
1 Video 54 1 Video 19 Conditional
Tables (PMT) PID 1
2 Audio 48 2 Audio 81 Access
3 Audio 49 3 Audio 82 Data
… … … … … …
k' Data k' k'' Data k''
… … … … … …
Header
PIDs 0 22 33 1 48 82 19 19 54 81 19
0 188 bytes
Transport Stream Packets PID = Packet ID
EMM = Entitlement Management Message
4 www.tektronix.com/video_audio
Encoder Testing
Application Note
Figure 4 is a screen shot from the MTS300 MPEG-2 analyzer that counter, which increments with each successive packet for a particular
summarizes some of the elements of Figures 2 and 3. program. A continuity-count error occurs when successive counter
The hierarchical view on the top left presents a graphic view of every words contain the same count (indicating a repeated packet) more
component in the transport stream. It contains an icon for every than twice, or the count is out of order, or packets are lost.
stream component, enabling the designer to easily see how many pro- To test for PMT errors, recall that the program map table carries the
gram streams are present as well as the video and audio content of PID values of the packets containing the actual audio, video and data
each. Each icon represents the top layer of a number of lower analy- for a particular program. Like the PAT error, a PMT error occurs if the
sis and information layers. The analyzer creates the hierarchical view program map table comes too infrequently or its scrambling control
using the program association table (PAT) and the program map table field indicates that the table is scrambled (is not 0). This is not to say
in the program specific information (PSI) data of the transport stream. that the program cannot be scrambled – only that the table listing the
A check for PAT error is called for in our example. Recall that, once PID values of the audio and video elements may not be, by the rules
synchronized, decoders first look for PID 0, which the MPEG-2 stan- of MPEG-2.
dard reserves for the program association table. But if PID 0 fails to PID errors are the last of the critical decodability errors to test. When
occur often enough (at least every half second), or is missing the table a PID referred to in the program association table or program map
in its payload, or indicates that its contents are scrambled, a PAT error table does not occur within an expected, user-definable time interval, a
is flagged and the decoder will not be able to process the stream. PID error is flagged.
(Scrambling for each packet is indicated in the 2-bit scrambling con- As should be apparent, any one of these decodability error conditions
trol field shown in Figure 2.) is likely to prevent programs within a transport stream from being
Continuity-count errors are the next to be checked. Each packet of decoded at all, and therefore warrants continuous monitoring in
audio, video and data in a transport stream has its own continuity operational settings.
www.tektronix.com/video_audio 5
Encoder Testing
Application Note
Data monitoring axis, requiring that the remultiplexer update the PCR data.
Due to the increase in demand on accessing Internet services through Consequently, it is important to test for PCR jitter after the data is
cable and satellite communications, IP data monitoring has become an remultiplexed. The system graphically indicates the times at which
important issue. The Tektronix MTS300 real-time analyzer performs IP PCRs were received.
monitoring with detailed viewing of EN 301 192 (DVB Data Broadcasting) Further, each PCR can be opened to display the PCR data, as shown
tables, syntactic control of the tables with error reporting and the in Figure 6. To measure jitter, the analyzer predicts the PCR value by
ability to monitor data flow of the broadcast session. using the previous PCR and the bit rate to produce interpolated PCR,
Analyses performed include: or PCRI. The actual PCR value is subtracted from PCRI to give an
estimate of the jitter. The figure also shows the time since the
• Intra-PSI analysis
previous PCR arrived.
• Inter SI/PSI analysis (data broadcast descriptors)
• Consistence of data carousel
• TCP/IP session monitoring
Several new tables are now available within the hierarchical display.
Digital Storage Media Command and Control (DSM-CC) from ISO/IEC
13818-6 defines the following types: Multiprotocol encapsulation, U-N
messages, and Stream descriptors. EN 301 192 defines the following
tables: 1-layer Data carousel, Multi-protocol encapsulation, 2-layer
Data carousel, Data Piping, and Data Streaming. Figure 5 shows mul-
tiple DSM-CC elements along with their IP traffic sessions.
Timing analysis
To display real-time video and audio correctly, the transport stream
must also deliver accurate timing to the decoders. Correct transfer of
program clock data is critical because this data controls the entire tim-
Figure 6: Graphical representation of PCR data, overlaid with specific
ing of the decoding process. This task can be confirmed by analyzing information on one PCR.
the PCR (program clock reference) and time-stamp data.
PCR data from a multiplexer may be precise, but demultiplexing may
put the packets of a given program at a different place on the time
6 www.tektronix.com/video_audio
Encoder Testing
Application Note
Conclusion
Pioneering work in MPEG test and picture quality analysis makes
Tektronix the obvious choice when testing and evaluating MPEG-2
based encoder designs. As communications standards converge – with
audio, data, images and video merging in new networks – innovative
test equipment from Tektronix will ensure the integrity of the overall
Figure 7: Real-time graphical display of PCR jitter and repetition. information system. The powerful MTS300 Multi-Standard MPEG Test
System, MTG 100 and 300 MPEG Test Signal Generators, and the
PQA300 Picture Quality Analysis System make the characterization,
test and analysis task much more manageable for the digital designer,
while delivering the finest test performance available.
www.tektronix.com/video_audio 7
Encoder Testing
Application Note
Contact Tektronix:
Norway +47 22 07 07 00
Copyright © 2001, Tektronix, Inc. All rights reserved. Tektronix products are covered by U.S. and
foreign patents, issued and pending. Information in this publication supersedes that in all previously
published material. Specification and price change privileges reserved. TEKTRONIX and TEK
are registered trademarks of Tektronix, Inc. All other trade names referenced are the service marks,
trademarks or registered trademarks of their respective companies.
04/01 FLG5594/XBS 25W-14588-0
8 www.tektronix.com/video_audio