MPEG-2 TS Overview

advertisement
MPEG-2 Timing Model
Kyung-Hee UNIV.
Kyuheon Kim
kyuheonkim@khu.ac.kr
Constant Delay Timing Model
-2-
PCR Generation
system_clock_frequency
mod 300 counter
[0 : 299]
ripple_carry
mod 233 counter
[0 : 2 33 -1]
90KHz
27MHz
9 bits
PCR_ext(i)
33 bits
PCR_base(i)
• Why 27MHz as the STC(System Time Clock) in MPEG-2 ?
- Common to 525/59.94 and 625/50 systems
• Why 90KHz as STC in MPEG-1, is it full enough?
- No Problems with DSM
-3-
System Clock Recovery
SCR, PCR
from channel
Phase
LPF
Detector
Loop Gain
System Time Clock
Mod 2 33
Counter
27MHz
VCXO
Mod 300
Counter
Initial Load
-4-
System Clock Frequency
STC Tolerance


-5-
Accuracy: 27MHz +/- 30ppm
Rate of changes with time: 0.075 Hz/sec
Time Stamp Coding

PCR(Program Clock Reference), SCR(System Clock Reference)

Sampled value of the encoder STC at the time of transmission.

Coding interval(SCR) : less than 0.7sec
Coding interval(PCR) : less than 0.1sec


PTS(Presentation Time Stamp), DTS(Decoding Time Stamp)



-6-
Reside in the PES packet
Intended time for AUs(Access Units) to be presented or decoded
Coding interval : less than 0.7sec
Time Stamps (1)
(PCR_base and PCR_extension)
PCR(i)= PCR_base(i)  300  PCR_ext(i)
PCR_base  PCR  300
=((system_clock_frequency*t(i))/300/2**33
PCR_ext
 PCR % 300 =((system_clock_frequency*t(i))%300
Time Stamps (2)
(PCR_base and PCR_extension)
• PCR is described by 42 (=33+9) bits
• 24h/day * 60min/h * 60sec/min * 27M/sec = 2,332,800,000,000
PCR vs Time
TS packet & Decoder
Decoding & rendering
T-STD Model
Transport Stream
System Target Decoder
Model
- 12 -
Purpose of T-STD
• To specify a standard,
- independent of bit rates,
- independent of implementations
- CBR/VBR
• To provide models for
- data delivery
- timing
• To specify the virtual platform for MPEG-2 decoder.
• To specify a tool for verification of application correctness.
- 13 -
Motivations for STD Model
• Multiplexing schemes
1) Scheme A
A B C
A
B C A B C A
B C
A
B C
A B C A B C A B C
2) Scheme B
A A A
A A A A B
B B
B
B
B B C C
C
C C C
From channel
Buffer
C A A A A A
Decoder
• The effects of multiplexing schemes on receiving buffer.
- What will happen if the burst duration is long ?
==> The Effects of Multiplexing schemes on the receiver operation.
• Source traffic control parameters
- Leaky Bucket Concept
* Leak Rate
* Buffer Size
- 14 -
Leaky Bucket
• The “Leaky Bucket” is a useful tool for traffic policing
- To prevent network congestion
- To detect the violating cells of non-conforming
sources
• The “Leaky Bucket” Parameters :
- the leaky rate
- the token pool size
• There are several variants of the “Leaky Bucket”.
- 15 -
Operation of the “Leaky Bucket”
LB Operation
Departing
cells
Arriving
cells
Server
2) when the token pool is empty, no tokens
are drained from the token pool.
Dropped
cells
Token
pool
Draining
tokens(Rate=Rleak)
- 16 -
1) Tokens are drained off at a constant rate
from the token pool(at the leak rate).
3) If the token pool is not full, an arriving cell
enters the network immediately, and at the
same time a token is inserted into the token
pool .
4) The arriving cells that arrive when the
token pool is full are discarded.
T-STD Model
Rx 1
TB 1
A 1 (j)
td 1 (j)
Rbx 1
MB 1
i-th byte of
Transport Stream
EB 1
Video
D1
TB n
Rx n
P 1 (k)
tp 1 (k)
j-th access unit
t(i)
O1
k-th presentation unit
A n (j)
td n (j)
Audio
P n (k)
tp n (k)
Dn
Bn
R sys
TB sys
- 17 -
Rx sys
B sys
System control
D sys
T-STD : System Decoder
TBsys
Rxsys
Bsys
System control
Rsys
D sys
• Transport Buffer
- TBSsys: 512 bytes
- Rxsys rate : 1.0 Mb/s
• Main Buffer
- BSsys: 1,536 bytes
- R sysrate : max{80Kb/s, transport_rate(i)*8 bits/byte/500}
• Buffer management
- TBsys shall not overflow,
and shall empty at least once every second.
- Bsys shall not overflow.
- 18 -
T-STD : Audio Decoder
TBn
Rxn
Bn
Rn
Audio
Dn
• Transport Buffer
- TBS n : 512 bytes
- Rx n rate : 2.0 Mb/s
• Main Buffer
- BSn = BSmux+ BSdec + BSoh : 3,584 bytes
(BSdec+ BSoh<= 2,848bytes)
- R n rate :
• Buffer management
- TBn shall not overflow,
and shall empty at least once every second.
- Bn shall not overflow nor underflow.
- 19 -
T-STD : Video Decoder
TB1
MB1
• Transport Buffer
- TBS n : 512 bytes
- Rx n rate : 1.2 * Rmax[p,l]
• Multiplexing Buffer
• Elementary Buffer(i.e. VBV)
• Data Transfer from MB to EB
- Leak Method
- VBV Method
- 20 -
A1(j)
td1(j)
Rbx1
Rx1
EB1
O1
D1
P1(k)
tp1(k)
T-STD : Video Decoder
TB1
A1(j)
td1(j)
Rbx1
Rx1
MB1
EB1
O1
D1
P1(k)
tp1(k)
• Multiplexing Buffer
1) Low & Main Level
MBSn = BSmux + BSoh +VBVmax[p,l] - vbv_buffer_size,
where BSmux = 0.004 seconds * Rmax[p,l],
BSoh = (1/750)seconds * Rmax[p,l].
2) H1440 & High Level
MBSn = BSmux + BSoh ,
where BSmux = 0.004 seconds * Rmax[p,l],
BSoh = (1/750)seconds * Rmax[p,l].
3) MPEG-1 CPBS
MBSn = BSmux + BSoh + vbv_max - vbv_buffer_size,
where BSmux = 0.004 seconds * Rmax,
BSoh = (1/750)seconds * Rmax .
- 21 -
Data Transfer from MB to EB
Leak Method
VBV Delay Method
rate[bits/sec]
rate[bits/sec]
peak rate, Rpeak
peak rate, Rpeak
0
0
on
off
time [sec]
- If there is data in MB, and EB is not full,
data are transferred from MB to EB at the
peak rate, Rpeak.
time [sec]
- By using the vbv_delay values coded in the
video ES, the time at which each byte of
coded video data is transferred from MB to
EB can be specified precisely.
- If EB is full, data are not transferred to EB.
- Data transfer of a coded picture is at a piecewise constant rate.
- 22 -
Leak Method
• Conditions
- No STD Descriptor in TS,
- STD descriptor with leak_valid flag set to “1”,
- STD descriptor, leak_valid =“0”, vbv_delay=“0xFFFF”,
- Trick mode status is true.
• Rbxn Leak Rate
1) Low & Main level
Rbxn = Rmax[p,l]
2) H1440 & High level
Rbxn = Min {1.05 x Res, Rmax[p,l]}
3) MPEG-1 CPBS
Rbxn = 1.2 * Rmax
• Buffer Management
- MB shall not overflow,
and shall empty at least once every second.
- EB shall not overflow.
- 23 -
VBV Delay Method
TB1
A1(j)
td1(j)
Rbx1
Rx1
MB1
EB1
O1
D1
P1(k)
tp1(k)
• Conditions
- STD descriptor, leak_valid =“0”, vbv_delay = “0xFFFF”.
• Rbxn Transfer Rate(MB to EB)
Rbx(j) = NB(j) / [tdn(j+1) - vbv_delay(j+1) -{tdn(j) - vbv_delay(j)}]
where NB(j) is the number of bytes of j-th coded picture, and tdn(j) is the decoding
time of j-th picture.
• Buffer Management
- MB shall not overflow nor underflow.
- EB shall not overflow.
( EB may underflow in the case of low delay or trick mode.)
- 24 -
Transfer Rate Calculation(MB to EB )
Rbx ( I10 ) 
- 25 -
NB( I10 )
{DTS ( B8 )  vbv _ delay( B8 )}  {DTS ( I10 )  vbv _ delay( I10 )}
Delay of data through the T-STD
• For any data
tdn(j)-t(i) <= 1 second for all j, and all bytes i
in access unit An(j).
• For still picture video data
tdn(j)-t(i) <= 60 seconds for all j, and all bytes i
in access unit An(j).
- 26 -
DAVIC 1.1 RDM(Reference Decoder Model)
Bexecute
Bcode
Return channel user data (TCP/IP)
run-time
engine
Bcontents
TBn
Rx(n)
Graphics/text decoder
TBn
Bn
Rx(n)
Linear audio decoder
MPEG audio decoder
TBn
Bn
MPEG
TS
MPEG video decoder
TBn
MBn
EBn
Bo
TBn
Bsys
SystemDecoder
defined by MPEG
- 27 -
ATSC T-STD Model
Buffer Management
&
Media Synchronization
- 29 -
Buffer Behaviour
• Overall delay should be kept constant.
• If the buffer sizes are determined, the overall delay is known value.
• At the transmitting side the encoder knows the encoder delay, if only this
value is known, the decoder buffer delay can be calculated straightforwardly.
• The delay time in the decoder buffer is the intended time of the data extraction
i.e. the decoding time of that data.
- 30 -
Buffer Occupancy : CBR case
Encoder Buffer
Bvbv_buffer_size
0
1
2
3
4
5
6
7
8
9
10
11
12
Decoder Buffer
Bvbv_buffer_size
0
start-up delay
- 31 -
1
2
3
4
5
6
7
8
9
10
Regulation of Encoder Buffer
and Decoder Buffer
Encoder Buffer
Bvbv_buffer_size
0
1
2
3
4
5
6
7
8
9
10
11
12
Decoder Buffer
Bvbv_buffer_size
0
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Bvbv_buffer_size
0
- 32 -
1
Buffer Regulation Methods
• The occupancy
level of encoder buffer is sent to the decoder at each
Access Unit’s header part.
- decoder regulates the decoder buffer by speeding up
or slowing down the data extraction in order to fulfill
synchronization relationship.
• Assuming that the decoder system clock is synchronized to that of encoder
system clock, the data extraction time and the amount of data to be
extracted are sent to the decoder at each Access Unit’s header part.
- 33 -
Media Synchronization
• Audio Path
• Video Path
• Synchronization between the media.
• PTS/DTS Encoding related with buffer
management
- 34 -
Delay Difference
between Video and Audio
• Assume that the the encoding and decoding delays are zero seconds, and that the transmission is CBR.
• Video Data Transmission
total _ buffer _ size
- video data delay :
delayvideo 
• Audio Data Transmission
- audio data delay :
• Delay Difference :
delayaudio 
decoder _ video _ path
bit _ ratevideo
total _ buffer _ sizedecoder _ audio _ path
bit _ rateaudio
delay _ differencev a  delayvideo  delayaudio
• IF
IF the
the Delay
Delay Difference
Differencev-a
is not
not zero
zero seconds,
seconds, what
what will
will happen
happen ??
v-a is
and
and which
which one
one is
is responsible
responsible for
for this
this ??
- 35 -
Delay Difference : An Example
• A video stream compliant to MPEG-2 MP@ML with 6Mb/s rate and an audio stream compliant to
MPEG-I Layer-II with 384Kb/s bit rate are multiplexed into Transport Stream, in this case the delay
difference can be calculated as follows.
delayvideo
1
TBS  0.004 * Rmax [ p, l ]   750
 * Rmax [ p, l ]  VBVmax

bit _ ratevideo
239, 888byte * 8bits / byte
=
6  106bits / sec
= 0.31985 sec
4096byte * 8bits / byte
384  103bits / sec
= 0.08533 sec
delayaudio 
delay _ differencev a  0.2345 sec
• This calculation shows that audio is always decoded 235ms in advance compared to video
in this configuration.
- 36 -
Delay Difference Compensation*
• To compensate the delay difference between the video data and audio data, the transmitting equipment
must have the functionality to delay the audio data in the case of TS stream.
• In actual case, the encoding delay is not equal to zero and the encoding delays of video and audio are
different.
For instance, the video encoding delay is 3 to 5 frame times depending on the coding schemes used, and
the audio encoding delay is about 2 to 3 audio frame times. If we assume that the video encoding delay
is 5 NTSC frame times and the audio encoding delay is 2 audio frame times(e.g. MPEG-1 Layer II, 48KHz
sampled audio), the encoding delay difference is about 119ms. This value is too large to be ignored.
Therefore the encoding delay difference must be compensated in the transmitting equipment in actual
implementations.
- 37 -
TS Multiplexer: An Example
- 38 -
Time Stamps (1)
(the two kinds of time stamps)
1. The time-stamp for
the synchronization of
an ES
2. The time-stamp for the recovery of System Time
Clock(STC)
to calculate a bit-rate between PCR or
SCR
for only one program
PCRi  system_color_frequency  ti Real world time
 PCR_basei  300  PCR_exti
PCR_basei  PCRi  300
PCR_exti  PCRi  300
Constant
i  i
in the PCR
transport_rate 
duration
ti  ti
ti  ti  i - i  tranport_rate
Time for Bytes
Decoder-Side
a block diagram of a simplified PLL
Download