PCR_base I = [ system_clock_frequency * t I ] DIV 300 MOD 233 And

PCR_base I = system_clock_frequency * t I DIV 300 MOD 233

And,

PCR_extension I = system_clock_frequency * t I DIV 1 MOD 300

The PCR values of a program are best transmitted in transport stream packets having a PID, that’s particular within the program Map table (PMT) that is generally the video elementary stream of this system no longer each TS packet containing this unique PID always consists of a PCR value. It’s miles enough to insert a value into a TS packet each one hundred ms (according to DVB/MPEG). The PCR value is 42 bits lengthy and incremented with a frequency of 27 MHz. The 33-bit field is for program Clock Reference Base and a 9-bit field for program Clock Reference Extension. This PCR value is useful in streaming rate manipulate mechanism for TS playout system.

Formula to calculate its value (in millisecond):

PCR_value =(PCR_base * 300 + PCR_extension 27 MHZ) *1000
The bit rate of the encoded transport stream:

Where,
i is the index of any byte in the transport stream for i”< i < i'.
i'' is the index of the byte containing the final bit of the maximum latest program_clock_reference_base field relevant to the program being decoded.
PCR (i") is the time encoded within the program clock reference base and extension fields in units of the system clock.

i' is the index of the byte containing the final bit of the straight away following program_clock_reference_base field relevant to the program being decoded.

PCR CORRECTION: Different essential necessities of right decoding is that the (PCR-PTS) or (PCR – DTS) durations are to be maintained in decoder equal as in that one in Encoder.PTS and DTS stand for “Presentation Time Stamp” and “Decode Time Stamp” respectively. These time stamps are used for decoding the Video and Audio frames as the encoder desires them to be. Those are 33 bit counter values, i.e. it a count number of loose running 27Mhz/300 = 90 Khz clock that is truly derived from the free running 27 Mhz clock inside the Encode engine. They constitute the precise time at which specific frame is to be decoded and offered to the show which is planned by using the encoder.

Further to the PCR, the PTS and DTS are transfer. Both values are referenced to the PCR and manage information processing within the receiver. The DTS shows the PCR value at which the related information is to be decoded. The DTS have to be transmitted if the information isn't decoded within the order wherein it's miles obtained. The PTS shows the time at which the decoded information is to be output. Because of this the PTS value is continually higher than the present day PCR value.

The PTS and DTS timestamps are encoded within the starting of the image which will make sure that the complete photograph has entered the buffer earlier than the timestamp takes place, the give up of the coded image is observed and the image length in bytes is added to the timestamp.
PCR Re-Stamping: In the program clock reference the encoder clock accurately on the decoder end all together that decoder can interpret demonstrate the frame in all around planned route as encoder supposed them to be. On the time of encoding, the time stamps PTS , DTS and PCR(base and extension) are derived from 27 Mhz exactness clock with accuracy of the frequency within the range of +/- 30 ppm that is numerically 27 Mhz +/- 810 Hz.

PCR value is the immediately value of the counters that are exactly increasing at each tick off 27 Mhz clock for extension nine bits and ninety kHz clock for base 33 bits as shown below
The presentation time and the decoding time is derived from the PTS & DTS consistent with equation beneath.

PTS(k) ??((system_clock_ frequency ??tpn (k)) DIV 300) % 233

DTS(j) ??((system_clock_ frequency ??tdn (j)) DIV 300) % 233
Where,
tpn(k) is the presentation time of presentation unit.

tdn(j) is the decoding time of access unit.

The 2 consecutive PCR does no longer comply with the identical bitrate due to the fact time interval of consecutive PCR does no longer replicate the specific range of bits acquired on the decoder. There may be mismatch among the predicted range of bits and in fact, arrived range of bits from decoder point of view. The decoder can not re-create the frequency as that of the encoder because of this mismatch. One manner of representing for such eliminated packets is to insert null packets changing the audio PID packets. It is easy to actually exchange the PID value of Audio PID packets to Null PID (0x1fff). Here, we are maintain the equal bitrate as of encode TS.

If we aren't changing the PID value of Audio PID via Null PID and eliminating the audio PIDs absolutely, we are able to nonetheless keep the PCR accuracy of the specific channel through putting same number of Null packets among the consecutive PCR PIDs. In this situation we're keeping the equal encoded bitrate.

All through remuxing, we can also want to growth or lower the bitrate of the encoded TS. In such scenario, really changing the PID value of the undesirable PID packet will no longer eliminate PCR accuracy errors. due to the fact real supposed bitrate isn't equal as encoded bitrate. In this situation, we are able to change the PCR values to take account of the introduced/eliminated Packets inside the TS or to insert the precise range of packets appropriate for required output bitrate in order that current PCR value is in sync with the output bitrate.