L64005 MPEG-2 Audio/Video Decoder Technical Manual
8-19
Final Rev F
Copyright 1996 by LSI Logic Corporation. All rights reserved.
frequency lock on PCRs. The L64005 can perform clock recovery on the
ESCR. Each step of the following algorithms is implemented as an inde-
pendent subroutine called by the interrupt handler routine.
8.5.1
Clock Recovery
The clock recovery mechanism for the A/V synchronization system can
come from two sources: the PCR value extracted from the transport
device, or the ESCR value extracted from the PES header buffer. The
operation is basically the same in either case— the only difference is the
source of the data.
For this example, assume that the ESCR value in the PES headers is
the correct value for the system clock. At the time of the PES header
interrupt, the host reads the SCR counter value immediately and stores
this variable as the arrival time of the PES header. This value is called
SCRarr. The host can parse the PES header in the DRAM for various
syntax elements such as PTS, DTS, and ESCR. For clock recovery, the
host must only parse the PES header in the DRAM for the ESCR value;
then the ESCR value must be stored in the host as the variable
ESCR.
The clock recovery error is calculated as:
Optionally, a number of error values for
SCRerr can be accumulated and
low-pass ltered in software (
SCRerr0, SCRerr1, SCRerr2, ..., SCRerrn)
to reduce channel jitter effects on the SCR arrival time. The nal result
of the lter is called
SCRerrlt. Note that this lter can be a simple aver-
age of the last few error values, or it can be a precise low-pass ltering
of the error, depending on the accuracy desired. If the ESCR value does
not occur with regular frequency in the bitstream, then the lter can be
lled with 0 values at regular intervals to maintain correct time-domain
impulse response.
The SCR counter can be updated with this error value to keep the SCR
in sync with the channel source clock, using a routine that does the fol-
lowing (disable interrupts during this routine to prevent unnecessary
delays):
Read the SCR counter value, and save this variable in the host as
(SCRcurrent).
Calculate the correct clock recovered value:
.
SCRerr
ESCR
SCRarr
–
=
SCRnew
SCRcurrent
SCRerrfilt
+
=