CN114339348A - PCR correction method and system based on frequency difference detection and compensation - Google Patents

PCR correction method and system based on frequency difference detection and compensation Download PDF

Info

Publication number
CN114339348A
CN114339348A CN202111397748.6A CN202111397748A CN114339348A CN 114339348 A CN114339348 A CN 114339348A CN 202111397748 A CN202111397748 A CN 202111397748A CN 114339348 A CN114339348 A CN 114339348A
Authority
CN
China
Prior art keywords
pcr
value
local
compensation
frequency difference
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111397748.6A
Other languages
Chinese (zh)
Other versions
CN114339348B (en
Inventor
黄化吉
江锐
袁金保
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WELLAV TECHNOLOGIES Ltd
Original Assignee
WELLAV TECHNOLOGIES Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WELLAV TECHNOLOGIES Ltd filed Critical WELLAV TECHNOLOGIES Ltd
Priority to CN202111397748.6A priority Critical patent/CN114339348B/en
Publication of CN114339348A publication Critical patent/CN114339348A/en
Application granted granted Critical
Publication of CN114339348B publication Critical patent/CN114339348B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

The invention provides a PCR correction method and a system based on frequency difference detection and compensation, wherein the method comprises the following steps: receiving a TS code stream, acquiring a PCR value from the TS code stream, and acquiring a local counter value from a local counter; calculating frequency difference information of a local clock and a source end clock according to the PCR value and the local counter value; according to the frequency difference information, carrying out synchronization and frequency difference compensation on a local time base; and performing regenerative correction on the PCR value by using the local time base after frequency difference compensation. Compared with the traditional method, the method has the advantages that the convergence time of the frequency difference calculation is greatly shortened, the obtained frequency difference information with enough precision is converged according to exponential speed, the practical significance is higher, and after the frequency difference information of the local clock and the source end clock is obtained, the frequency difference information can be used for compensating the locally regenerated PCR value.

Description

PCR correction method and system based on frequency difference detection and compensation
Technical Field
The invention relates to the field of digital technology, in particular to a PCR correction method and system based on frequency difference detection and compensation.
Background
After being digitized, tv moving pictures and accompanying sounds are usually transmitted in a TS (Transport Stream) format. In the application process of the TS transport stream, the multiplexing operation of the program is often required, the position of the PCR packet of the multiplexed program is changed, the time information indicated by the PCR value is inaccurate, and the PCR correction is required, so as to ensure that the back-end device can accurately recover the clock of the encoding end and perform the decoding operation from the stream by means of PCR.
The existing PCR correction algorithm has three modes:
the first is regenerative PCR correction, whose core idea is to initially synchronize local PCRs with source-side input PCRs and then regenerate the multiplexed PCR values by means of a local clock. The regenerative PCR correction has the advantages of simplicity, convenience, simultaneous correction of multiple programs, no need of considering the interface conversion form and the like, and is particularly suitable for IP input and output interfaces. The method has the disadvantages that due to the frequency difference between the source end clock and the local clock, errors between the PCR and the PTS/DTS are gradually accumulated due to long-time operation, and the ES cache overflow and decoding incapability phenomenon occur at the decoding end, so in order to solve the problem that the ES cache overflow and decoding incapability, the local clock is required to be periodically synchronized with the source clock, the PCR precision index is influenced at the moment of initializing the local counter operated by the synchronized source clock, and the problem cannot be fundamentally solved by regenerative PCR correction as long as the frequency difference problem is not solved.
The second one is follow-up PCR correction, which uses local clock to count time stamp, and inputs time stamp label on the input end of code stream, and outputs time label after adjusting multiplex code rate, and determines the time delay of PCR package in the system through input and output time stamp, and superimposes the time delay on the original PCR value. The follow-up PCR correction method has the advantages that the frequency difference factor of the local clock and the source clock cannot be introduced, and the output end PCR can be ensured to be normal as long as the source end PCR is normal. The disadvantage is that its use has more severe restrictions: firstly, it must be ensured that the TS packets of the TS transport stream are uniformly spaced at the input side and the output side, and there cannot be jitter, otherwise the jitter of the TS packets will be introduced into the PCR precision, thereby affecting the PCR correction result; secondly, it must ensure that the PCR of the input TS stream is normal, and the follow-up PCR cannot correct the PCR index with source error.
And the third method is to completely use the local clock to regenerate PCR, PTS and DTS, and the method has the advantages that the frequency difference between the source end clock and the local clock is not needed to be considered, and the limitations of uniform input and output code streams, normal PCR and the like are not needed. However, the method has the disadvantages of the most complex realization, more processing modules, the largest resource consumption and difficult application to multi-channel and multi-program scenes.
The prior art discloses a TS transport stream audio and video synchronization device and method based on a through audio, the TS re-encoding module is used for re-encoding a source TS transport stream to obtain a re-encoded TS transport stream; the audio delay module is used for delaying the audio packets in the source TS transmission stream, and the time of delaying corresponds to the time required by recoding the source TS transmission stream; the frequency difference calculating module is used for calculating and outputting a frequency deviation representation quantity between the source coding reference clock and the recoding reference clock; the calibration module is used for calibrating the recoding TS transmission stream according to the frequency deviation characterization quantity output by the frequency difference calculation module; and the code stream multiplexing module multiplexes and outputs the corrected recoded TS transmission stream and the audio packet in the delayed source TS transmission stream. But the scheme can not solve the problem of deviation caused by jitter when the TS code stream is transmitted.
Disclosure of Invention
The invention mainly aims to provide a PCR correction method based on frequency difference detection and compensation, which can detect the frequency difference characteristics of clocks at a TS stream source end and a local end and solve the problem of deviation caused by jitter during TS code stream transmission.
A further object of the invention is a PCR correction system based on frequency difference detection and compensation.
In order to solve the technical problems, the technical scheme of the invention is as follows:
a PCR correction method based on frequency difference detection and compensation comprises the following steps:
receiving a TS code stream, acquiring a PCR value from the TS code stream, and acquiring a local counter value from a local counter;
calculating frequency difference information of a local clock and a source end clock according to the PCR value and the local counter value;
according to the frequency difference information, carrying out synchronization and frequency difference compensation on a local time base;
and performing regenerative correction on the PCR value by using the local time base after frequency difference compensation.
The local time base and the local counter are different counters, wherein the local counter is used for comparing and operating with a source end PCR value to obtain frequency difference information of the local clock and the source end clock, and the frequency difference information is not adjusted in the whole correction process. The local time base is another counter, and the local time base can carry out compensation adjustment according to the frequency difference obtained by the previous detection, so that the local time base is close to the clock frequency of the source end, and most of error compensation is realized.
Preferably, the acquiring the PCR value from the TS code stream specifically includes:
the TS code stream comprises a plurality of PCR packets, and the PCR value is obtained by obtaining the corresponding PCR value in each PCR packet.
Preferably, the obtaining a local counter value from the local counter specifically includes:
and the local counter value is the corresponding local counter value when each PCR packet in the TS code stream is received.
Preferably, the calculating the frequency difference information between the local clock and the source clock according to the PCR value and the local counter value specifically includes:
calculating a local counter difference value according to the local clock counter value:
ΔCntn'=Cntn'-Cnt0'
in the formula,. DELTA.Cntn' local counter difference, Cnt, for the n +1 th PCR packetn' denotes the corresponding local counter value, Cnt, when receiving the (n + 1) th PCR packet in the TS code stream0' represents a corresponding local counter value when a 1 st PCR packet in a TS code stream is received;
calculating a PCR difference value according to the PCR value:
ΔPCRn=PCRn-PCR0
in the formula,. DELTA.PCRnIs the corresponding PCR difference value of the n +1 PCR packet, PCRnRepresents the PCR value corresponding to the (n + 1) th PCR packet, PCR0Represents the PCR value corresponding to the 1 st PCR packet;
calculating a first parameter An
Figure BDA0003370622870000031
Calculating a second parameter Bn
Figure BDA0003370622870000032
The frequency difference information Δ f' between the local clock and the source clock is:
Δf'=floor(10M×An/Bn)
in the formula, floor () is a rounding function, and M is an integer of 6 or more.
Preferably, according to the frequency difference information, the local time base is synchronized and frequency difference compensated, specifically:
and performing initial synchronization on the local time base according to the PCR value, then counting the local time base according to the local clock, and performing homogenization compensation on the local time base by using frequency difference information in the counting process.
Preferably, the method further comprises comparing the PCR value of the preliminary regeneration correction with the PCR value obtained from the TS code stream, determining whether there is a deviation, and if there is a deviation, performing deviation compensation on the local time base, and obtaining a final corrected PCR value from the local time base.
Preferably, the comparing the PCR value corrected for the preliminary regeneration with the PCR value obtained from the TS code stream to determine whether there is a deviation specifically is:
and subtracting the corrected PCR value from the PCR value obtained from the TS code stream, continuously monitoring the difference value for N times, and judging that the deviation exists if the difference value is a positive value or a negative value.
Preferably, the offset compensation is performed on the local time base, specifically:
judging the direction of deviation, wherein the judging the direction of deviation specifically comprises the following steps: judging whether the PCR value is positive or negative according to the fact that the difference value between the corrected PCR value and the PCR value obtained from the TS code stream is a positive value or a negative value;
and setting a timing time T, performing reverse deviation compensation on the local time base according to the deviation direction after the timing time T is reached, and only compensating one counting unit each time when the reverse deviation compensation is performed on the local time base.
A PCR correction system based on frequency difference detection and compensation, comprising:
the receiving module is used for receiving the TS code stream, acquiring a PCR value from the TS code stream and acquiring a local counter value from a local counter;
the frequency difference detection module is used for calculating frequency difference information of a local clock and a source end clock according to the PCR value and the local counter value;
the time base synchronization and compensation module is used for carrying out synchronization and frequency difference compensation on the local time base according to the frequency difference information;
the PCR correction module regeneratively corrects the PCR value by using the local time base compensated by the frequency difference;
preferably, the system further comprises a deviation estimation module, wherein the deviation estimation module compares the PCR value subjected to the preliminary regeneration correction with the PCR value obtained from the TS code stream, determines whether a deviation exists, performs deviation compensation on the local time base if the deviation exists, and obtains a final corrected PCR value from the local time base after the deviation compensation.
Compared with the prior art, the technical scheme of the invention has the beneficial effects that:
the invention calculates the frequency difference information of the local clock and the source end clock according to the PCR value and the local counter value, compared with the traditional method, the convergence time of the frequency difference calculation of the invention is greatly shortened, and the invention has higher practical significance.
Drawings
FIG. 1 is a schematic flow chart of the method of the present invention.
Fig. 2 shows the results of counting by using counters respectively for the TS streams sent at the source end and the TS streams received locally according to the embodiment.
Fig. 3 is a result of counting, by using counters, a TS stream transmitted at a source end and a TS stream received locally due to jitter according to an embodiment.
Fig. 4 is a schematic diagram of a system module according to the present invention.
Fig. 5 is a functional block diagram of a time base synchronization and compensation module according to an embodiment.
Fig. 6 is a schematic diagram of an operation process of the frequency offset compensation module according to the embodiment.
Fig. 7 is a schematic diagram of an operation process of the deviation compensation module according to the embodiment.
Detailed Description
The drawings are for illustrative purposes only and are not to be construed as limiting the patent;
for the purpose of better illustrating the embodiments, certain features of the drawings may be omitted, enlarged or reduced, and do not represent the size of an actual product;
it will be understood by those skilled in the art that certain well-known structures in the drawings and descriptions thereof may be omitted.
The technical solution of the present invention is further described below with reference to the accompanying drawings and examples.
Example 1
The present embodiment provides a PCR calibration method based on frequency offset detection and compensation, as shown in fig. 1, including the following steps:
receiving a TS code stream, acquiring a PCR value from the TS code stream, and acquiring a local counter value from a local counter;
calculating frequency difference information of a local clock and a source end clock according to the PCR value and the local counter value;
according to the frequency difference information, carrying out synchronization and frequency difference compensation on a local time base;
and performing regenerative correction on the PCR value by using the local time base after frequency difference compensation.
Acquiring a PCR value from the TS code stream, specifically:
the TS code stream comprises a plurality of PCR packets, and the PCR value is obtained by obtaining the corresponding PCR value in each PCR packet.
The obtaining of the local counter value from the local counter specifically includes:
and the local counter value is the corresponding local counter value when each PCR packet in the TS code stream is received.
Calculating frequency difference information of a local clock and a source clock according to the PCR value and the local counter value, specifically:
calculating a local counter difference value according to the local clock counter value:
ΔCntn'=Cntn'-Cnt0'
in the formula,. DELTA.Cntn' local counter difference, Cnt, for the n +1 th PCR packetn' denotes the corresponding local counter value, Cnt, when receiving the (n + 1) th PCR packet in the TS code stream0' represents a corresponding local counter value when a 1 st PCR packet in a TS code stream is received;
calculating a PCR difference value according to the PCR value:
ΔPCRn=PCRn-PCR0
in the formula,. DELTA.PCRnIs the corresponding PCR difference value of the n +1 PCR packet, PCRnRepresents the PCR value corresponding to the (n + 1) th PCR packet, PCR0Represents the PCR value corresponding to the 1 st PCR packet;
calculating a first parameter An
Figure BDA0003370622870000061
Calculating a second parameter Bn
Figure BDA0003370622870000062
The frequency difference information Δ f' between the local clock and the source clock is:
Δf'=floor(10M×An/Bn)
in the formula, floor () is a rounding function, M is an integer greater than or equal to 6, and since the frequency difference of the crystal oscillator is PPM (parts per million), the result of the frequency difference needs to be multiplied by a value with a precision of 10^6 or higher to obtain a reasonable precision value, and M represents a parameter for obtaining the precision.
The frequency difference information calculated according to the method has high convergence speed, and specifically comprises the following steps:
first, the influence of the frequency difference between the source clock and the local clock on the PCR correction will be described. Fig. 2 illustrates the results of counting the TS streams sent at the source end and the locally received TS streams respectively by using counters;
the reference 27MHz clock crystal oscillators used by the source end and the local receiving end of the TS code stream are not the same, although the nominal values are the same, a certain degree of frequency difference exists, and the frequency difference is caused by non-homologous of two clocks and is also the reason that accumulated deviation is generated by local regeneration PCR in PCR correction. As shown in the figure, assuming that the source side transmits PCR packets at the time points (T0, T1, T2, T3, T4, … …, Tn), the number of clocks between two packets counted by the frequency f can be deduced according to the clock frequency f of the source side:
Cntn=(Tn-T0) F- (formula-1)
Assuming that the time delay Δ experienced by each TS packet transmitted from the source end to the receiver end is consistent, after the receiver end receives the TS packet, the number of clocks between two packets counted by the receiver end using the local clock f' is:
Cnt′n=((Tn+Δ)-(T0+Δ))*f′=(Tn-T0) F' -formula (2)
By comparing (formula-1) and (formula-2) and analyzing, the frequency difference can be characterized as:
Figure BDA0003370622870000071
in the above formula, CntnCnt 'can be obtained by subtracting the PCR value between two PCR packets'nThis can be done by using a local clock to count at the time the PCR packet is received. Therefore, theoreticallyAnalyzing, as long as the TS packets do not jitter and the time delays are consistent in the receiving process from the source end to the local end, the clock frequency difference information of the local end and the source end can be obtained through the formula-3.
The above-mentioned calculation of clock frequency difference information of the local end and the source end is a method in the prior art, however, when the receiving end receives the TS stream, there is a position jitter caused by the receiving of the TS stream and the code stream multiplexing, especially the jitter is more obvious in the IP transmission, and the jitter can be regarded as time measurement noise, which affects the result of frequency difference detection. The jitter of the general TS packets can reach the millisecond level, and the cumulative effect of the frequency difference relative to the short time is more prominent.
As shown in FIG. 3, since the delays of the PCR packets are not completely matched after multiplexing at the receiving end due to the transmission jitter, the relative positions thereof are changed and the clock count values Cnt'nThe expression of (c) also changes:
Cnt′n=(Tn-T0)*f′+(Δn0) F' -formula (4)
The original (formula-3) becomes:
Figure BDA0003370622870000072
in (equation-5), the right addition term is added more than in (equation-3)
Figure BDA0003370622870000073
This is the effect on the frequency offset calculation due to the jitter in the TS packet position. To obtain a frequency difference result of sufficient accuracy, i.e., Δ f' → Δ f, by (equation-5), it is necessary to
Figure BDA0003370622870000074
At least more real terms are required
Figure BDA0003370622870000075
A few orders of magnitude, i.e.
Figure BDA0003370622870000076
Thus Δ fCan be characterized primarily by Δ f.
Now study the following additive terms
Figure BDA0003370622870000077
In the formula
Figure BDA0003370622870000078
Thus adding items
Figure BDA0003370622870000081
n0) The time noise caused by the position jitter of the TS packets after multiplexing is shown, the value of the time noise is not fixed, the statistical distribution rule of the time noise is subject to white noise of normal distribution, a boundary exists in practical application, the specific value depends on the jitter of a transmission network, the experimental boundary value in a practical system can reach about 20ms, and the summation average of sampling points is close to 0 along with the increase of the sampling points. (T)n-T0) Is the time interval of the nth PCR packet relative to the 0 th PCR packet, which increases gradually with increasing value of n. Thus, as n increases
Figure BDA0003370622870000082
It will become progressively smaller, an algorithmic approach that converges on linear velocity.
In theory, the value of n can be increased,
Figure BDA0003370622870000083
gradually approaches 0 to obtain Δ f' with sufficient accuracy. However, the real frequency difference Δ f is inherently very small, and according to the current crystal manufacturing process, the crystal frequency difference Δ f of the same nominal value is about 10PPM to 20PPM, i.e. 10PPM to 20PPM, and in order to obtain Δ f' with sufficient accuracy,
Figure BDA0003370622870000084
the value of (d) needs to be less than two orders of magnitude smaller than the frequency difference Δ f, in this case taken to be less than 1 part per million. By (Δ)n0) Maximum deviation 20ms and crystal oscillator frequency difference estimated by 20PPMMeter (T)n-T0) A time period of about 200000 seconds, i.e. about 56 hours, enables Δ f' to be ≈ Δ f. That is, it takes 56 hours after the system is powered on to obtain the frequency difference information of the local clock with sufficient precision relative to the source clock, and the convergence time is too long, so the method of converging according to the linear stage speed cannot be applied in the scene with transmission jitter.
One benefit of this embodiment is that a method is designed to quickly detect frequency difference information, and the frequency difference information with sufficient accuracy converges exponentially. The algorithm principle thereof is described below.
Definitions Δ Cntn=Cnt′n-CntnAnd, instead of (formula-1) and (formula-4), there are:
ΔCntn=(Tn-T0)*(f′-f)+(Δn0) F' -formula (6)
Redefining:
Figure BDA0003370622870000085
(equation-7) where the number of samples n increases, the noise summation term
Figure BDA0003370622870000086
Since the normal distribution does not increase with the number of summations, it is controlled to be within a value of the order of the maximum deviation. And the sum term of time intervals
Figure BDA0003370622870000087
But increases exponentially with the number of summations, so that the convergence rate is exponential. Suppose that
Figure BDA0003370622870000091
The maximum value of (2) is 100ms, and the source end sends a PCR packet according to 20ms, then:
Figure BDA0003370622870000092
then (formula-7)) The following steps are changed:
Figure BDA0003370622870000093
in order to obtain sufficient frequency difference accuracy, the same applies
Figure BDA0003370622870000094
The value of n is estimated to be less than 1 ten thousandth, the value of n can only reach 10000, the time length is 10000, 20ms and 200 seconds, namely, the system is electrified and operated for about 200 seconds, the higher frequency difference precision can be obtained, the number of sampling points is increased along with the time,
Figure BDA0003370622870000095
the accuracy of the frequency difference detection will become more and more accurate.
According to the frequency difference information, carrying out synchronization and frequency difference compensation on the local time base, which specifically comprises the following steps:
and performing initial synchronization on the local time base according to the PCR value, then counting the local time base according to the local clock, and performing homogenization compensation on the local counter by using frequency difference information in the counting process.
The frequency difference information delta f' between the local clock and the source clock needs to be obtained for An/BnThe preset precision value of the method is rounded, and tail cutting operation exists, so that the precision is still lost, and compensation is required to be performed through two parts, namely frequency difference compensation and deviation compensation.
And compensating the frequency difference, namely compensating the influence caused by the frequency difference part. As can be seen from the above discussion, Δ f' is for An/BnThe rounding result, assuming a value of 19PPM, i.e. 19 parts per million, means that after the local time base is synchronized, it is necessary to compensate for the insertion of 19 clock beats per 100 ten thousand clock beats counted in the process of counting with the local clock, and it should be noted that this compensation mode must be uniform, i.e. 19 clock beats are inserted one beat at a time at almost equal intervals, rather than being once inserted for compensation. The result of the frequency difference may be a negative value, assumed to be-19 PPM, i.e., representing a per countFor 100 ten thousand clock ticks, it is necessary to compensate for subtracting 19 clock ticks, and likewise, subtracting 19 clock ticks must be an operation at equal intervals.
Offset compensation, the frequency difference Δ f' being for A as can be seen from the foregoing discussionn/BnThe rounding result, i.e. a small part of the rounding result is not completely compensated, and errors existing in statistics and calculation are added, so that errors still exist in the detection result inevitably, and an accumulation effect exists as long as the errors exist, so that the one-way deviation between the locally corrected PCR and the source-end PCR value can still be caused after the system runs for a long time. Please note that the jitter of the TS packet is random, the deviation direction is not fixed, and the deviation caused by the frequency difference is unidirectional, as long as the time is long enough and the cumulative effect of the frequency difference is obvious enough, the directionality of the difference between the local PCR and the source-side PCR can be monitored, i.e. the probability that the local PCR is a positive value or a negative value is obviously high, and the deviation direction can be determined. The deviation compensation method is that a timer is taken, the direction of deviation is observed within a timing period, if the deviation result is positive direction, 1 clock beat is compensated to the negative direction at the time when the timer finishes timing, if the deviation result is negative direction, one clock beat is compensated to the positive direction at the time when the timer finishes timing, and the deviation compensation has enough sensitivity by adjusting the timing length of the timer.
And comparing the PCR value of the primary regeneration correction with the PCR value obtained from the TS code stream, judging whether deviation exists, if so, performing deviation compensation on the local time base, and obtaining the final corrected PCR value from the local time base.
Comparing the PCR value of the preliminary regeneration correction with the PCR value obtained from the TS code stream, and judging whether a deviation exists, specifically:
and subtracting the corrected PCR value from the PCR value obtained from the TS code stream, continuously monitoring the difference value for N times, and judging that the deviation exists if the difference value is a positive value or a negative value.
The performing deviation compensation on the local counter specifically includes:
judging the direction of deviation, wherein the judging the direction of deviation specifically comprises the following steps: judging whether the PCR value is positive or negative according to the fact that the difference value between the corrected PCR value and the PCR value obtained from the TS code stream is a positive value or a negative value;
and setting a timing time T, performing reverse deviation compensation on the local time base according to the deviation direction after the timing time T is reached, and only compensating one counting unit each time when the reverse deviation compensation is performed on the local time base.
The specific values of the monitoring times N and the timing time T in the embodiment can be parameters corrected empirically in the actual use process, and the mutual matching of the timing time T and the monitoring times N can enable the deviation compensation to be more reasonable and accurate.
After the normal frequency offset compensation is completed, if there is no error, the comparison relationship between the corrected PCR value and the source PCR value depends mainly on the jitter of the source TS stream, so the difference may be a positive value or a negative value, similar to noise. And continuously monitoring the PCR difference values for N times, and if the PCR difference values are positive values or negative values, judging that the deviation exists and obtaining the direction of the deviation. After the deviation direction is obtained, a timing counter can be set, the timing time of the timing counter can be adjusted according to actual conditions, and the timing time is compensated by positive deviation or negative deviation according to the deviation obtained in the previous step, wherein the compensation is a fine compensation, and one counting unit is compensated each time.
Example 2
The present embodiment provides a PCR calibration system based on frequency offset detection and compensation, as shown in fig. 4, including:
the receiving module is used for receiving the TS code stream, acquiring a PCR value from the TS code stream and acquiring a local counter value from a local counter;
the frequency difference detection module is used for calculating frequency difference information of a local clock and a source end clock according to the PCR value and the local counter value;
the time base synchronization and compensation module is used for carrying out synchronization and frequency difference compensation on the local time base according to the frequency difference information;
the PCR correction module regeneratively corrects the PCR value by using the local time base compensated by the frequency difference;
and the deviation estimation module compares the PCR value subjected to the primary regeneration correction with the PCR value obtained from the TS code stream, judges whether deviation exists or not, performs deviation compensation on the local time base if the deviation exists, and obtains a finally corrected PCR value from the local time base after the deviation compensation.
As shown in fig. 5, in the time base synchronization and compensation module, the frequency difference compensation is performed on the local time base according to the frequency difference information, the initial synchronization is performed on the local time base according to the synchronization information of the TS code stream, and the deviation compensation is performed on the local time base according to the deviation information.
As shown in fig. 6, the frequency offset compensation module operates an operation process of outputting a compensation indication to the local time base from the power-on operation until the frequency offset result is stable.
As shown in fig. 7, the operation of the offset compensation module is shown.
Example 3
The present embodiment provides a computer medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the frequency difference detection and compensation-based PCR correction method of embodiment 1.
The same or similar reference numerals correspond to the same or similar parts;
the terms describing positional relationships in the drawings are for illustrative purposes only and are not to be construed as limiting the patent;
it should be understood that the above-described embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. And are neither required nor exhaustive of all embodiments. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the claims of the present invention.

Claims (10)

1. A PCR correction method based on frequency difference detection and compensation is characterized by comprising the following steps:
receiving a TS code stream, acquiring a PCR value from the TS code stream, and acquiring a local counter value from a local counter;
calculating frequency difference information of a local clock and a source end clock according to the PCR value and the local counter value;
according to the frequency difference information, carrying out synchronization and frequency difference compensation on a local time base;
and performing regenerative correction on the PCR value by using the local time base after frequency difference compensation.
2. The frequency difference detection and compensation-based PCR correction method according to claim 1, wherein a PCR value is obtained from the TS code stream, specifically:
the TS code stream comprises a plurality of PCR packets, and the PCR value is obtained by obtaining the corresponding PCR value in each PCR packet.
3. The method for PCR correction based on frequency offset detection and compensation according to claim 2, wherein the obtaining the local counter value from the local counter specifically comprises:
and the local counter value is the corresponding local counter value when each PCR packet in the TS code stream is received.
4. The frequency offset detection and compensation-based PCR calibration method according to claim 3, wherein the frequency offset information of the local clock and the source clock is calculated according to the PCR value and the local counter value, specifically:
calculating a local counter difference value according to the local clock counter value:
ΔCntn'=Cntn'-Cnt0'
in the formula,. DELTA.Cntn' local counter difference, Cnt, for the n +1 th PCR packetn' denotes the corresponding local counter value, Cnt, when receiving the (n + 1) th PCR packet in the TS code stream0' indicating the corresponding local meter when receiving the 1 st PCR packet in TS code streamA counter value;
calculating a PCR difference value according to the PCR value:
ΔPCRn=PCRn-PCR0
in the formula,. DELTA.PCRnIs the corresponding PCR difference value of the n +1 PCR packet, PCRnRepresents the PCR value corresponding to the (n + 1) th PCR packet, PCR0Represents the PCR value corresponding to the 1 st PCR packet;
calculating a first parameter An
Figure FDA0003370622860000011
Calculating a second parameter Bn
Figure FDA0003370622860000021
The frequency difference information Δ f' between the local clock and the source clock is:
Δf'=floor(10M×An/Bn)
in the formula, floor () is a rounding function, and M is an integer of 6 or more.
5. The method for PCR calibration based on frequency offset detection and compensation of claim 4, wherein the local time base is synchronized and frequency offset compensated according to the frequency offset information, specifically:
and performing initial synchronization on the local time base according to the PCR value, then counting the local time base according to the local clock, and performing homogenization compensation on the local time base by using frequency difference information in the counting process.
6. The method of claim 5, further comprising comparing the PCR value of the preliminary reproduction correction with the PCR value obtained from the TS code stream to determine whether there is a deviation, and if there is a deviation, performing deviation compensation on a local counter to obtain a final corrected PCR value.
7. The frequency offset detection and compensation-based PCR correction method of claim 6, wherein the PCR value of the preliminary regeneration correction is compared with the PCR value obtained from the TS code stream to determine whether there is a deviation, specifically:
and subtracting the corrected PCR value from the PCR value obtained from the TS code stream, continuously monitoring the difference value for N times, and judging that the deviation exists if the difference value is a positive value or a negative value.
8. The method for PCR calibration based on frequency offset detection and compensation of claim 7, wherein the offset compensation is performed on the local time base, specifically:
judging the direction of deviation, wherein the judging the direction of deviation specifically comprises the following steps: judging whether the PCR value is positive or negative according to the fact that the difference value between the corrected PCR value and the PCR value obtained from the TS code stream is a positive value or a negative value;
setting timing time, after the timing time is reached, carrying out reverse deviation compensation on the local time base according to the deviation direction, and only compensating one counting unit each time when carrying out reverse deviation compensation on the local time base.
9. A PCR correction system based on frequency offset detection and compensation, comprising:
the receiving module is used for receiving the TS code stream, acquiring a PCR value from the TS code stream and acquiring a local counter value from a local counter;
the frequency difference detection module is used for calculating frequency difference information of a local clock and a source end clock according to the PCR value and the local counter value;
the time base synchronization and compensation module is used for carrying out synchronization and frequency difference compensation on the local time base according to the frequency difference information;
and the PCR correction module regeneratively corrects the PCR value by using the local time base after the frequency difference compensation.
10. The frequency offset detection and compensation-based PCR calibration system of claim 9, further comprising a bias estimation module, wherein the bias estimation module compares the PCR value of the preliminary reproduction calibration with the PCR value obtained from the TS code stream to determine whether there is a bias, and if there is a bias, the bias compensation is performed on the local time base, and the final calibration PCR value is obtained from the local time base after the bias compensation.
CN202111397748.6A 2021-11-23 2021-11-23 PCR correction method and system based on frequency offset detection and compensation Active CN114339348B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111397748.6A CN114339348B (en) 2021-11-23 2021-11-23 PCR correction method and system based on frequency offset detection and compensation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111397748.6A CN114339348B (en) 2021-11-23 2021-11-23 PCR correction method and system based on frequency offset detection and compensation

Publications (2)

Publication Number Publication Date
CN114339348A true CN114339348A (en) 2022-04-12
CN114339348B CN114339348B (en) 2024-02-06

Family

ID=81046598

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111397748.6A Active CN114339348B (en) 2021-11-23 2021-11-23 PCR correction method and system based on frequency offset detection and compensation

Country Status (1)

Country Link
CN (1) CN114339348B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6049886A (en) * 1997-10-29 2000-04-11 Fujitsu Limited Clock frequency synchronizer
JP2004289249A (en) * 2003-03-19 2004-10-14 Toshiba Corp Multimedia receiving terminal, pcr jitter correcting apparatus used for the same, and pcr jitter correction method
EP1548963A2 (en) * 2003-12-27 2005-06-29 Electronics and Telecommunications Research Institute Reference clock recovery apparatus and method
JP2006050656A (en) * 2005-09-02 2006-02-16 Nippon Telegr & Teleph Corp <Ntt> Stream transmitting device and receiving device, and transmission/reception method
JP2008245050A (en) * 2007-03-28 2008-10-09 Hitachi Kokusai Electric Inc Pcr correction circuit
JP2009212876A (en) * 2008-03-05 2009-09-17 Nec Corp Ip stream transmission/reception system, ip stream receiver, and reception processing timing synchronization method used for the same
KR20120077457A (en) * 2010-12-30 2012-07-10 전자부품연구원 Digital broadcasting transmitter and method for amending pcr using the transmitter
WO2018120557A1 (en) * 2016-12-26 2018-07-05 深圳市中兴微电子技术有限公司 Method and device for synchronously processing audio and video, and storage medium
CN109889876A (en) * 2019-01-28 2019-06-14 伟乐视讯科技股份有限公司 A kind of TS transport stream audio-visual synchronization device and method based on straight-through audio

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6049886A (en) * 1997-10-29 2000-04-11 Fujitsu Limited Clock frequency synchronizer
JP2004289249A (en) * 2003-03-19 2004-10-14 Toshiba Corp Multimedia receiving terminal, pcr jitter correcting apparatus used for the same, and pcr jitter correction method
EP1548963A2 (en) * 2003-12-27 2005-06-29 Electronics and Telecommunications Research Institute Reference clock recovery apparatus and method
JP2006050656A (en) * 2005-09-02 2006-02-16 Nippon Telegr & Teleph Corp <Ntt> Stream transmitting device and receiving device, and transmission/reception method
JP2008245050A (en) * 2007-03-28 2008-10-09 Hitachi Kokusai Electric Inc Pcr correction circuit
JP2009212876A (en) * 2008-03-05 2009-09-17 Nec Corp Ip stream transmission/reception system, ip stream receiver, and reception processing timing synchronization method used for the same
KR20120077457A (en) * 2010-12-30 2012-07-10 전자부품연구원 Digital broadcasting transmitter and method for amending pcr using the transmitter
WO2018120557A1 (en) * 2016-12-26 2018-07-05 深圳市中兴微电子技术有限公司 Method and device for synchronously processing audio and video, and storage medium
CN109889876A (en) * 2019-01-28 2019-06-14 伟乐视讯科技股份有限公司 A kind of TS transport stream audio-visual synchronization device and method based on straight-through audio

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王亚南: "IP网络中数字视音频信息传输关键技术的研究", 《中国优秀硕士学位论文全文数据集》 *

Also Published As

Publication number Publication date
CN114339348B (en) 2024-02-06

Similar Documents

Publication Publication Date Title
US6493832B1 (en) Communication apparatus which handles a time stamp
US8644348B2 (en) Method for generating a robust timing correction in timing transfer systems
US7876791B2 (en) Synchronizing apparatus and method in packet network
US6654956B1 (en) Method, apparatus and computer program product for synchronizing presentation of digital video data with serving of digital video data
JP4838273B2 (en) Adaptive media playback method and apparatus for intra-media synchronization
US6259677B1 (en) Clock synchronization and dynamic jitter management for voice over IP and real-time data
JP5440880B2 (en) Clock synchronization system, apparatus, method, and program using packet filter
US7778173B2 (en) Clock recovery algorithm for remultiplexing MPEG-2 SPTSs and/or MPTSs in the presence of network jitter
JP2006238424A (en) System and method for multimedia delivery in wireless environment
US9307298B2 (en) System and method for video statistical multiplexing adapting to internet protocol networks
KR20140104969A (en) Apparatus and method for synchronized transmission of multimedia content over an asynchronous network
US9395697B2 (en) Method and apparatus for calculating transmission delay across a network
JP5300278B2 (en) How to detect media rate to measure network jitter
US20130148022A1 (en) System and method for time synchronized splicing operation of a broadcast stream
US8854964B2 (en) Method and apparatus for determining a transport bit rate for a Multiprogram transport stream
JP4081936B2 (en) COMMUNICATION DEVICE, COMMUNICATION METHOD, AND RECORDING MEDIUM
US7397877B2 (en) Clock drift compensation method for remote communications
EP2311260B1 (en) Constant bit rate padding of mpeg transport streams
US7012982B1 (en) Method and system for de-jittering of transmitted MPEG-2 and MPEG-4 video
CN114339348A (en) PCR correction method and system based on frequency difference detection and compensation
CN103975600B (en) The method and apparatus of transmission time and/or system clock pulse is sent with signal
JP2007306497A (en) Clock synchronization method and circuit in packet transmission
JPH11308203A (en) Clock reproduction system
CN109889876B (en) TS transmission stream audio and video synchronization device and method based on through audio
US7274863B2 (en) Data stream processing device and method and program storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant