How PCR works

Source: Internet
Author: User
How PCR Works
PCR is the abbreviation of program clock reference. Literally, we can understand that this parameter should be related to decoding, because the program concept is involved during decoding. In the previous Transmission Phase of decoding, discrete digital signals occur. Therefore, when analyzing PCR, we can establish a single and ideal environment, this is the issue of clock pairing and timing at the encoding and decoding ends. Here, the PCR jitter is omitted-that is, the extracted clock signal changes left and right at the center position. This simplifies the analysis environment. The 6b PCR structure exists in the TS Baotou adaptive zone ,. All the byte 32B in the four red boxes plus one byte 1B in the black box constitute the PCR _ base, expressed as 33B; 6B is reserved in the black box; in the yellow box, all the byte 8b and one byte 1B in the black box constitute pcr_ex, Which is 9B. On encoder side and decoder side: Indirect timing is achieved through counting. We can assume that the delay of all parameters is the same during transmission. Pcr_base is a sample of the clock Count value after the 300 frequency division of the 27mhz system clock of the encoder. It is used to provide the initial value of the decoder PCR counter when the decoder switches programs, in this way, the PCR value and the PTS and DTS described later may reach the same time starting point. Pcr_ex is the counter value for the 27 MHz system clock of the encoder. Its function is to correct the system clock of the decoder through the phase-locked loop circuit at the decoder end, so that it reaches 27 MHz consistent with the encoder. After the decoder system clock is divided by 300, the count continues based on the initial value of the decoder's PCR counter, so that the PCR Count value of the encoder is transitioned to the decoder end, in addition, from intermittent sampling to Continuous counting values, this can always capture the same time as the PTS and DTS values. (ISO/IEC 13818-1, the intervals between PTS and dts on the pcr encoding end are 0.1 s ). DTS is defined by the encoder During encoding. It is specified by the decoder and the pre-decoding time in the decoder. This time mark appears on the PES layer and exists in the PES header time domain. It is also a counter value of 33 B, which is also the counter value of the 300-frequency clock of the system clock. Because it has the same starting point as PCR, it can play a time-based role when the PCR value is continuous. When the PCR value is equal to the DTs value, they calculate the same clock, that is, they pass through the same time. For PCR, they played the Continuous counting function, faithfully completed the timing task, DTS is waiting for this time, once the time, it indicates that its decoding order is well arranged, because the decoding order is specified during encoding, we do not know the specific details of the encoding. We only need to query DTS for the next step. This is also conducive to the independence of encoder and decoder R & D, with less bundling and compatibility. For video, DTS uses bidirectional prediction during video encoding. An Image unit is not displayed immediately and may be stored in the memory for a period of time, as a reference for decoding other image units, it is displayed only after being referenced. For video display, MPEG also proposes a video PTS. For synchronous display of audio and video, an audio PTS is proposed. Since there is no two-way prediction for sound, its decoding order is its display order, so we only propose the concept of PTS for it. PTS is defined by the encoder and specifies the display time of a certain unit for the decoder. It is also a counter value of 33B, which is also the counter value of the 300-frequency clock of the system clock. It should be noted that PCR, DTS, and PTS should have the same time starting point. It is good to choose to start timing at the field synchronization of the simulated image. A unit is displayed after decoding, and the PCR counter is re-counted to start the work of the next unit. It can be seen that there are two functions of PCR: (1) reading the pcr_base reading of the encoding end as its own initial value; (2) extracting pcr_ex to adjust the system clock of the encoding and decoding end, to achieve strict unification, the recovery of the system clock is also conducive to the extraction of the sampling clock. The brightness sampling is 13.5 MHz, and the color sampling is 6.75 MHz, which can be obtained from the system clock. The system clock reaches the same count clock as the encoding end after dividing the clock by 300. After the two steps are completed, the headers of the subsequent ts packets of the same nature (extracted by PID) are removed to form a PES (audio or video ), generally, a video PES contains the encoding data of an image and the headers indicating its nature. The audio PES may be shorter. Extract DTS, PTS from PES headers, and pass through local PCR (which is slightly different from the encoded PCR, which is the first PCR in the received TS packet, and the standard clock count) to determine the order, or decode or display. When the program is switched, the system clock is still in the adjustment phase, and the counting clock is unstable, resulting in incorrect counting. In this case, the display sequence of the processing unit is incorrectly indicated, so we will see a short mosaic or temporarily audible sound when switching the program. As the system clock is adjusted, the image decoding display order and sound display order can be properly arranged, and the image and sound will become normal.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.