Audio clock recovery method, receiving terminal and device
By determining and adjusting the frequency division coefficient in the phase-locked loop circuit, the problem of large audio clock recovery error in the HDMI protocol is solved, the accuracy of the audio clock is improved, and the phase-locked loop is ensured to operate within the optimal working range.
Patent Information
- Application Number
- CN202211737404.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-31
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-12-31
AI Technical Summary
During the HDMI protocol transmission process, when the audio clock is restored, due to minimizing the jitter of the differential clock and the instability of the inter-frame data amount, the value changes of the variables N and CTS cause the phase-locked loop PLL to be unable to work in the optimal range, causing the audio clock to be restored. The error is large.
Through the phase-locked loop circuit, determine the first, third, second and fourth frequency division coefficients, use these coefficients to divide and multiply the input clock, generate a stable audio clock, and adjust the fourth frequency division coefficient to match The amount of audio data ensures that the PLL is within the optimal working range.
The error of the audio clock is reduced and the accuracy of the audio clock is improved, allowing the phase-locked loop circuit to recover the audio clock more stably in the HDMI protocol.
Smart Images

Figure CN116032453B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of wireless communication technology, and in particular to an audio clock recovery method, a receiving terminal and a device. Background Art
[0002] During the HDMI protocol transmission process, the transmitter (source) places the variables (N and CTS) used by the receiver (sink) to recover the audio clock in the Audio Clock Regeneration Packet. The variables N and CTS are directly related to the minimized differential clock freq_tmds of the HDMI Minimized Transmission Differential Signal Clock (HDMI TMDS Clock) and the amount of audio data in each frame.
[0003] In order to minimize the jitter of the differential clock freq_tmds and the instability of the audio data volume between frames, the values of variables N and CTS may change slightly between two consecutive frames. If variables N and CTS are used directly as the frequency division coefficients of the frequency divider in the phase locked loop (PLL) without processing, the PLL may not work in the optimal working range, resulting in large errors in the results. Summary of the invention
[0004] The present invention provides an audio clock recovery method, a receiving terminal and a device, which are used to solve the problem of large error of the recovered audio clock in the prior art.
[0005] In a first aspect, an embodiment of the present application provides an audio clock recovery method, which is applied to a phase-locked loop circuit, wherein the phase-locked loop circuit includes a first-stage frequency divider, a second-stage frequency divider, a third-stage frequency divider, a phase detector, a low-pass filter, and a voltage-controlled oscillator, wherein the first-stage frequency divider, the phase detector, the low-pass filter, the voltage-controlled oscillator, and the third-stage frequency divider are connected in sequence, the input end of the second-stage frequency divider is connected to the output end of the voltage-controlled oscillator, and the output end of the second-stage frequency divider is connected to the phase detector, and the method includes:
[0006] Determine a first frequency division coefficient according to an input clock of the phase-locked loop circuit and a preset crystal oscillator clock, and determine a third frequency division coefficient according to the input clock, a preset high-frequency clock and audio clock related information, so that the first-stage frequency divider performs frequency division processing on the input clock based on the first frequency division coefficient to obtain a reference clock, and the third-stage frequency divider performs frequency division processing on the output clock of the voltage-controlled oscillator based on the third frequency division coefficient to obtain an audio clock;
[0007] Determine a second frequency division coefficient and a fourth frequency division coefficient according to the first frequency division coefficient, the third frequency division coefficient and audio clock related information, so that the second-stage frequency divider performs frequency multiplication processing on the reference clock based on the second frequency division coefficient and the fourth frequency division coefficient to obtain the output clock;
[0008] The audio clock related information is related information sent by the transmitter and used to recover the audio clock.
[0009] In a possible implementation, determining the first frequency division coefficient according to the input clock of the phase-locked loop circuit and a preset crystal oscillator clock includes:
[0010] The quotient of the input clock and the crystal oscillator clock is rounded to obtain the first frequency division coefficient.
[0011] In a possible implementation, the method further includes:
[0012] Under the control of the reference clock, collecting the crystal oscillator clock;
[0013] A difference operation is performed between the number of clock acquisitions within a previous first preset time length and the number of clock acquisitions within a current first preset time length. If the difference is less than a preset threshold, the first frequency division coefficient is input into the first-stage frequency divider.
[0014] In a possible implementation manner, the audio clock related information includes a frequency division parameter and a count value, wherein the count value is a count value of a clock obtained by dividing the input clock by the frequency division parameter;
[0015] The step of determining a third frequency division coefficient according to the input clock, the preset high-frequency clock and the audio clock related information includes:
[0016] Taking the product of the high-frequency clock and the count value as a quotient of the product of the input clock and the frequency division parameter;
[0017] The obtained first quotient value is rounded to obtain the third frequency division coefficient.
[0018] In a possible implementation manner, determining the second frequency division coefficient and the fourth frequency division coefficient according to the first frequency division coefficient, the third frequency division coefficient and audio clock related information includes:
[0019] Taking the product of the frequency division parameter, the first frequency division coefficient and the third frequency division coefficient as a quotient of the count value;
[0020] The second frequency division coefficient and the fourth frequency division coefficient are determined according to the obtained second quotient value.
[0021] In a possible implementation manner, determining the second frequency division coefficient and the fourth frequency division coefficient according to the obtained second quotient value includes:
[0022] The integer part of the second quotient is used as the second frequency division coefficient, and the decimal part of the second quotient is used as the fourth frequency division coefficient.
[0023] In a possible implementation, the method further includes:
[0024] Decoding the received audio and video data to obtain audio data;
[0025] Under the control of the input clock, writing the audio data into a first-in-first-out queue;
[0026] Under the control of the audio clock, reading the audio data from the first-in-first-out queue;
[0027] The fourth frequency division coefficient is adjusted according to the data amount of the audio data stored in the first-in-first-out queue.
[0028] In a possible implementation, adjusting the fourth frequency division coefficient according to the amount of audio data stored in the first-in-first-out queue includes:
[0029] If the difference between the data amount and the first preset data amount is greater than the second preset data amount, increasing and adjusting the fourth frequency division coefficient;
[0030] If the difference between the data amount and the first preset data amount is smaller than the second preset data amount, the fourth frequency division coefficient is adjusted to decrease.
[0031] In a second aspect, an embodiment of the present application provides a receiving terminal, comprising: a processor, a memory and a phase-locked loop circuit, wherein the phase-locked loop circuit comprises a first-stage frequency divider, a second-stage frequency divider, a third-stage frequency divider, a phase detector, a low-pass filter and a voltage-controlled oscillator, wherein the first-stage frequency divider, the phase detector, the low-pass filter, the voltage-controlled oscillator and the third-stage frequency divider are connected in sequence, the input end of the second-stage frequency divider is connected to the output end of the voltage-controlled oscillator, and the output end of the second-stage frequency divider is connected to the phase detector, and the memory stores program code, and when one or more computer programs stored in the memory are executed by the processor, the receiving terminal executes the audio clock recovery method as described in any one of the first aspects.
[0032] In a third aspect, an embodiment of the present application provides an audio clock recovery device, which is applied to a phase-locked loop circuit, wherein the phase-locked loop circuit includes a first-stage frequency divider, a second-stage frequency divider, a third-stage frequency divider, a phase detector, a low-pass filter, and a voltage-controlled oscillator, wherein the first-stage frequency divider, the phase detector, the low-pass filter, the voltage-controlled oscillator, and the third-stage frequency divider are connected in sequence, the input end of the second-stage frequency divider is connected to the output end of the voltage-controlled oscillator, and the output end of the second-stage frequency divider is connected to the phase detector, and the device includes:
[0033] A first determination module is used to determine a first frequency division coefficient according to an input clock of the phase-locked loop circuit and a preset crystal oscillator clock, and to determine a third frequency division coefficient according to the input clock, a preset high-frequency clock and audio clock related information, so that the first-stage frequency divider performs frequency division processing on the input clock based on the first frequency division coefficient to obtain a reference clock, and the third-stage frequency divider performs frequency division processing on the output clock of the voltage-controlled oscillator based on the third frequency division coefficient to obtain an audio clock;
[0034] A second determination module is used to determine a second frequency division coefficient and a fourth frequency division coefficient according to the first frequency division coefficient, the third frequency division coefficient and audio clock related information, so that the second-stage frequency divider performs frequency multiplication processing on the reference clock based on the second frequency division coefficient and the fourth frequency division coefficient to obtain the output clock;
[0035] The audio clock related information is related information sent by the transmitter and used to recover the audio clock.
[0036] The beneficial effects of the present invention are as follows:
[0037] The present application provides an audio clock recovery method, a receiving terminal and an apparatus. First, a first frequency division coefficient is determined according to an input clock of a phase-locked loop circuit and a preset crystal oscillator clock, and a third frequency division coefficient is determined according to the input clock, a preset high-frequency clock and audio clock related information, so that a first frequency divider performs frequency division processing on the input clock based on the first frequency division coefficient to obtain a reference clock, and a third frequency divider performs frequency division processing on an output clock of a voltage-controlled oscillator based on the third frequency division coefficient to obtain an audio clock. Then, a second frequency division coefficient and a fourth frequency division coefficient are determined according to the first frequency division coefficient, the third frequency division coefficient and audio clock related information, so that a second-stage frequency divider performs frequency multiplication processing on the reference clock based on the second frequency division coefficient and the fourth frequency division coefficient to obtain an output clock. Since in the embodiment of the present application, the division coefficient in the divider input to the phase-locked loop circuit is determined based on the input clock, the preset crystal oscillator clock, the preset high-frequency clock and the audio clock related information, compared with directly using the audio clock related information as the division coefficient, the phase-locked loop circuit can operate within a better working range, thereby reducing the error of the audio clock output by the phase-locked loop circuit and improving the accuracy of the audio clock. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0039] Figure 1 A schematic diagram of the structure of a phase-locked loop circuit provided in an embodiment of the present application;
[0040] Figure 2 A flowchart of an audio clock recovery method provided in an embodiment of the present application;
[0041] Figure 3 A schematic diagram of a process for performing jitter protection on the input clock freq_in of a PLL provided in an embodiment of the present application;
[0042] Figure 4 A schematic diagram of another process for performing jitter protection on the input clock freq_in of the PLL provided in an embodiment of the present application;
[0043] Figure 5 A schematic diagram of a flow chart for determining a second frequency division coefficient and a fourth frequency division coefficient provided in an embodiment of the present application;
[0044] Figure 6 A schematic diagram of a process for adjusting the fourth frequency division coefficient fbdiv_frac provided in an embodiment of the present application;
[0045] Figure 7 A schematic diagram of the structure of a receiving terminal provided in an embodiment of the present application;
[0046] Figure 8 A schematic diagram of the structure of an audio clock recovery device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] In this application, the terms "first" and "second" are used for descriptive purposes only and should not be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, "multiple" means two or more.
[0049] The application scenarios described in the embodiments of the present invention are intended to more clearly illustrate the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. A person of ordinary skill in the art can appreciate that, with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.
[0050] During the HDMI protocol transmission process, audio data is packaged and transmitted from the transmitter to the receiver. However, the original audio clock is not included in the data transmission process. In order to ensure the quality of audio signal playback, the audio clock needs to be regenerated at the receiver. The process of regenerating the audio clock at the receiver is called audio clock recovery.
[0051] In the scheme of audio clock recovery in the related art, the relevant information sent by the transmitter for recovering the audio clock is usually used, such as N and CTS in the HDMI protocol, and the relevant information is used as the frequency division coefficient of the frequency divider of the PLL in the receiving end. Due to the jitter of the minimized differential clock freq_tmds and the instability of the amount of audio data between frames, the value of the relevant information may change slightly between two consecutive frames. If the relevant information is directly used as the frequency division coefficient of the frequency divider in the PLL, it may cause the PLL to fail to work in the optimal working range, resulting in a large error in the result.
[0052] Based on the above problems, an embodiment of the present application provides an audio clock recovery method, which is applied to a phase-locked loop circuit, such as Figure 1 As shown, the phase-locked loop circuit includes a first-stage frequency divider 11, a second-stage frequency divider 16, a third-stage frequency divider 15, a phase detector 12, a low-pass filter 13 and a voltage-controlled oscillator 14, wherein the first-stage frequency divider 11, the phase detector 12, the low-pass filter 13, the voltage-controlled oscillator 14 and the third-stage frequency divider 15 are connected in sequence, the input end of the second-stage frequency divider 16 is connected to the phase detector 12, and the output end of the second-stage frequency divider is connected to the output end of the voltage-controlled oscillator 14, as shown in FIG. Figure 2 As shown, the method comprises the following steps:
[0053] S201, determining a first frequency division coefficient prediv according to an input clock freq_in of a phase-locked loop circuit and a preset crystal oscillator clock freq_osc, and determining a third frequency division coefficient postdiv according to the input clock freq_in, a preset high-frequency clock freq_fb and audio clock related information, so that the first-stage frequency divider 11 performs frequency division processing on the input clock freq_in based on the first frequency division coefficient prediv to obtain a reference clock freq_ref, and the third-stage frequency divider 15 performs frequency division processing on the output clock freq_vco of the voltage-controlled oscillator 14 based on the third frequency division coefficient postdiv to obtain an audio clock freq_out;
[0054] S202, determining a second frequency division coefficient fbdiv_int and a fourth frequency division coefficient fbdiv_frac according to the first frequency division coefficient prediv, the third frequency division coefficient postdiv and the audio clock related information, so that the second-stage frequency divider 16 performs frequency multiplication processing on the reference clock freq_ref based on the second frequency division coefficient fbdiv_int and the fourth frequency division coefficient fbdiv_frac to obtain an output clock freq_vco;
[0055] The audio clock related information is related information sent by the sending end and used to recover the audio clock.
[0056] In the embodiment of the present application, firstly, a first frequency division coefficient is determined according to an input clock of a phase-locked loop circuit and a preset crystal oscillator clock, and a third frequency division coefficient is determined according to the input clock, the preset high-frequency clock and the audio clock related information, so that the first frequency divider performs frequency division processing on the input clock based on the first frequency division coefficient to obtain a reference clock, and the third frequency divider performs frequency division processing on the output clock of the voltage-controlled oscillator based on the third frequency division coefficient to obtain an audio clock, and then a second frequency division coefficient and a fourth frequency division coefficient are determined according to the first frequency division coefficient, the third frequency division coefficient and the audio clock related information, so that the second-stage frequency divider performs frequency multiplication processing on the reference clock based on the second frequency division coefficient and the fourth frequency division coefficient to obtain an output clock. Since in the embodiment of the present application, the frequency division coefficient in the frequency divider input to the phase-locked loop circuit is determined according to the input clock, the preset crystal oscillator clock, the preset high-frequency clock and the audio clock related information, compared with directly using the audio clock related information as the frequency division coefficient, the phase-locked loop circuit can be operated in a better working range, thereby reducing the error of the audio clock output by the phase-locked loop circuit and improving the accuracy of the audio clock.
[0057] The embodiment of the present application is used to recover the audio clock of HDMI. The input clock freq_in of the phase-locked loop circuit in the embodiment of the present application is the HDMI TMDS Clock.
[0058] In a specific implementation, the first frequency division coefficient prediv is determined according to the input clock freq_in of the phase-locked loop circuit and the preset crystal clock freq_osc. The quotient of the input clock freq_in and the crystal clock freq_osc can be rounded to obtain the first frequency division coefficient prediv.
[0059] The first-stage frequency divider performs integer frequency division on the input clock freq_in of the PLL to obtain the reference clock freq_ref, and then sends the reference clock freq_ref to the phase detector 12. The ratio of the input clock freq_in to the crystal oscillator clock freq_osc is rounded off to obtain the first frequency division parameter prediv of the first-stage frequency divider. Since the output of the first-stage frequency divider 11 is used as the input of the phase detector 12, the first frequency division parameter prediv should not jump when the input clock freq_in does not change dramatically. Therefore, the jitter threshold freq_delta is added to perform jitter protection on the input clock freq_in of the PLL.
[0060] Specifically, Figure 3 As shown, it is a schematic diagram of a process of performing jitter protection on the input clock freq_in of the PLL provided in an embodiment of the present application.
[0061] S301, under the control of the reference clock freq_ref, collecting the crystal oscillator clock freq_osc;
[0062] S302, performing a difference operation on the number of clock acquisitions within the previous first preset duration and the number of clock acquisitions within the current first preset duration;
[0063] S303 : If the obtained difference is smaller than the preset threshold, the first frequency division coefficient prediv is input to the first-stage frequency divider 11 .
[0064] like Figure 4 As shown, it is a schematic diagram of another process of performing jitter protection on the input clock freq_in of the PLL provided by an embodiment of the present application.
[0065] S401, under the control of the reference clock freq_ref, collecting the crystal oscillator clock freq_osc;
[0066] S402, performing a difference operation on the number of clock acquisitions within the previous first preset duration and the number of clock acquisitions within the current first preset duration;
[0067] S403: If the obtained difference is greater than or equal to the preset threshold, the process ends.
[0068] In the embodiment of the present application, the preset threshold is the jitter threshold freq_delta. If the obtained difference is smaller than the preset threshold, it means that the first frequency division coefficient prediv has not jumped and is stable. Therefore, the first frequency division coefficient prediv is input into the first-stage frequency divider 11.
[0069] In one embodiment, the audio clock related information includes a frequency division parameter N and a count value CTS, wherein the count value CTS is a count value obtained by counting a clock obtained by dividing the input clock freq_in by the frequency division parameter N;
[0070] The third frequency division coefficient postdiv is determined according to the input clock freq_in, the preset high-frequency clock freq_fb and the audio clock related information. Specifically, the product of the high-frequency clock freq_fb and the count value CTS is divided by the product of the input clock freq_in and the frequency division parameter N; the first quotient obtained is rounded to obtain the third frequency division coefficient postdiv.
[0071] In the embodiment of the present application, the third-stage frequency divider divides the output clock freq_vco to obtain the audio clock freq_out finally output by the PLL. The third-stage frequency divider is similar to the first-stage frequency divider, and the input frequency division coefficient is an integer and does not jump with the jitter of the input clock freq_in, the frequency division parameter N, the count value CTS and other variables.
[0072] In a specific implementation, the second and fourth frequency division coefficients are determined based on the first frequency division coefficient, the third frequency division coefficient and audio clock related information, and the product of the frequency division parameter, the first frequency division coefficient and the third frequency division coefficient is divided by the count value; the second and fourth frequency division coefficients are determined based on the second quotient value obtained.
[0073] Specifically, the second frequency division coefficient and the fourth frequency division coefficient are determined according to the obtained second quotient value, the integer part of the second quotient value is used as the second frequency division coefficient, and the decimal part of the second quotient value is used as the fourth frequency division coefficient.
[0074] like Figure 5 , which is a schematic diagram of a flow chart for determining a second frequency division coefficient and a fourth frequency division coefficient provided in an embodiment of the present application;
[0075] S501, taking the product of the frequency division parameter, the first frequency division coefficient and the third frequency division coefficient as the quotient of the count value;
[0076] S502: Use the integer part of the second quotient as a second frequency division coefficient, and use the decimal part of the second quotient as a fourth frequency division coefficient.
[0077] In the embodiment of the present application, the second-stage frequency divider implements the operation of multiplying the reference clock freq_ref to obtain the output frequency freq_vco. The second frequency division coefficient fbdiv_int and the fourth frequency division coefficient fbdiv_frac are obtained by dividing (N*prediv*postdiv) by the ratio of CTS. The second frequency division coefficient fbdiv_int and the fourth frequency division coefficient fbdiv_frac are the integer part and the decimal part of the input parameter of the second-stage frequency divider, respectively.
[0078] In a specific implementation, the fourth frequency division coefficient fbdiv_frac may be fine-tuned to achieve calibration of the PLL output clock frequency.
[0079] Specifically, Figure 6 As shown, it is a schematic diagram of a flow chart of adjusting the fourth frequency division coefficient fbdiv_frac provided in an embodiment of the present application.
[0080] S601, decoding the received audio and video data to obtain audio data;
[0081] S602, under the control of the input clock, write the audio data into the first-in-first-out queue; then under the control of the audio clock, read the audio data from the first-in-first-out queue;
[0082] S603: Adjust the fourth frequency division coefficient according to the amount of audio data stored in the first-in-first-out queue.
[0083] In one embodiment, the fourth frequency division coefficient is adjusted according to the data amount of the audio data stored in the first-in-first-out queue. If the difference between the data amount and the first preset data amount is greater than the second preset data amount, the fourth frequency division coefficient is increased; if the difference between the data amount and the first preset data amount is less than the second preset data amount, the fourth frequency division coefficient is decreased.
[0084] In the embodiment of the present application, the fourth frequency division coefficient is increased or decreased to calibrate the PLL output clock frequency.
[0085] In the embodiment of the present application, the first frequency division coefficient prediv, the second frequency division coefficient fbdiv_int, the third frequency division coefficient postdiv, the fourth frequency division coefficient fbdiv_frac, the frequency division parameter N and the count value CTS satisfy the following (Formula 1):
[0086]
[0087] For PLL, in order to make it work in the best performance range, the frequencies of the input clock freq_ref of the phase detector and the output clock freq_vco of the voltage-controlled oscillator need to be as close to freq_osc and freq_fb as possible respectively. This is one of the reasons why the embodiment of the present application converts the frequency division parameter N and the count value CTS into four parameters.
[0088] For ease of understanding, the present application is described in detail below with reference to specific embodiments.
[0089] Taking HDMI2.0 transmission of FHD video and 48K two-channel audio as an example, the embodiment of the present application is described in four steps:
[0090] The first step is to calculate the first frequency division coefficient prediv.
[0091] The clock frequency of HDMI 2.0 when transmitting FHD video is tmds_fhd, that is, the input clock freq_in. In order to make the PLL work in the best working performance range, the input clock freq_in needs to be divided to get as close to the crystal clock freq_osc as possible. The first division coefficient is the ratio of the input clock freq_in to the crystal clock freq_osc, and then rounded off.
[0092] In this case, if the ratio of the two is exactly 0.5*n (n is an odd number), due to the possible jitter of the input clock freq_in, the first frequency division coefficient may be and This will directly affect the input frequency of the phase detector 12, that is, the reference clock freq_ref. To reduce the occurrence of this phenomenon, a threshold freq_delta protection can be added. After sampling a valid frequency, if the jitter error is less than freq_delta, it is considered that the frequency is stable, so a relatively stable first frequency division coefficient prerdiv can be obtained.
[0093] The second step is to calculate the third frequency division coefficient postdiv.
[0094] In order to make the PLL output a more stable audio clock, the output clock freq_vco needs to be as close to the high-frequency clock freq_fb as possible. The high-frequency clock freq_fb is used as the ideal output clock of the voltage-controlled oscillator 14, so the high-frequency clock freq_fb should be the product of the audio clock freq_out and the first frequency division coefficient postdiv, as shown in Formula 2.
[0095] freq_fb=freq_out*postdiv (Formula 2)
[0096] However, freq_out is an unknown value, so the third frequency division coefficient cannot be directly calculated through the frequency freq_fb and freq_out. However, the HDMI2.0 protocol gives the relationship between the TMDS clock frequency and the audio clock frequency, as shown in Formula 3:
[0097]
[0098] Combining Formula 2 and Formula 3, since freq_out is equal to freq_aud, Formula 4 can be derived:
[0099]
[0100] The result of Formula 4 is retained as an integer to obtain the third frequency division coefficient postdiv, which is an input parameter of the third-stage frequency divider.
[0101] The third step is to calculate the second frequency division coefficient fbdiv_int and the fourth frequency division coefficient fbdiv_frac.
[0102] The input parameters of the second-stage frequency divider are placed at the last step of the calculation because the first frequency division coefficient prediv and the second frequency division coefficient postdiv both need to be integers, and the parameters of the second-stage frequency divider have two parts: integer and decimal. N and CTS can be recovered from the Audio Clock Regeneration Packet, and the first frequency division coefficient prediv and the third frequency division coefficient postdiv have also been calculated from steps 1 and 2 respectively. Therefore, the values of the second frequency division coefficient fbdiv_int and the fourth frequency division coefficient fbdiv_frac can be calculated according to formula 1.
[0103] The fourth step is to adjust the fourth frequency division coefficient fbdiv_frac.
[0104] The HDMI transmitter writes the decoded audio data into the asynchronous input and output queue fifo through the TMDS Clock, and then reads the audio data from the asynchronous fifo according to the recovered audio clock. The amount of audio data read and written needs to be balanced, otherwise the fifo may overflow or underflow. On the one hand, since this application will introduce certain errors in the calculation process, although the errors are small, they will inevitably be gradually amplified over a long period of time; on the other hand, the audio data may be unevenly transmitted over a period of time, and the audio clock frequency expressed by the variables N and CTS may have errors with the actual audio clock frequency, which will cause the asynchronous fifo to overflow. Therefore, it is necessary to add the fifo threshold fifo_fill_state_thd to monitor the amount of data in the asynchronous fifo in real time.
[0105] Specifically, a reference value fifo_fill_thd_ref is set for the amount of data in the asynchronous fifo, and the following situations are discussed: First, if the part of the internal data volume that is higher than the reference value fifo_fill_thd_ref is still greater than fifo_fill_state_thd, it is considered that the audio clock recovered at this time is slow, and the fourth frequency division coefficient fbdiv_frac needs to be increased to speed up the audio sampling frequency; second, if the part of the internal data volume that is lower than the reference value fifo_fill_thd_ref is still greater than fifo_fill_state_thd, it is considered that the audio clock recovered at this time is fast, and the fourth frequency division coefficient fbdiv_frac needs to be reduced to slow down the audio sampling frequency; third, if both conditions one and two are not met, it is considered that the audio clock frequency recovered at this time is relatively stable, and there is no need to adjust the fourth frequency division coefficient fbdiv_frac.
[0106] When increasing or decreasing the fourth frequency division coefficient fbdiv_frac, a first step value may be preset to increase the fourth frequency division coefficient fbdiv_frac, and a second step value may be preset to decrease the fourth frequency division coefficient fbdiv_frac, wherein the first step value and the second step value may be equal or unequal.
[0107] Based on the same inventive concept, an embodiment of the present application further provides an electronic device, the principle of which is similar to the principle of which is similar to that of any of the above-mentioned audio clock recovery methods, and the repeated parts will not be repeated.
[0108] like Figure 7 As shown, an embodiment of the present application further provides a receiving terminal, which includes: a processor 31, a memory 32 and a phase-locked loop circuit 33, wherein the phase-locked loop circuit includes a first-stage frequency divider, a second-stage frequency divider, a third-stage frequency divider, a phase detector, a low-pass filter and a voltage-controlled oscillator, wherein the first-stage frequency divider, the phase detector, the low-pass filter, the voltage-controlled oscillator and the third-stage frequency divider are connected in sequence, the input end of the second-stage frequency divider is connected to the output end of the voltage-controlled oscillator, and the output end of the second-stage frequency divider is connected to the phase detector, and the memory stores program code, and when one or more computer programs stored in the memory are executed by the processor, the receiving terminal performs the following process:
[0109] Determine a first frequency division coefficient according to an input clock of the phase-locked loop circuit and a preset crystal oscillator clock, and determine a third frequency division coefficient according to the input clock, a preset high-frequency clock and audio clock related information, so that the first-stage frequency divider performs frequency division processing on the input clock based on the first frequency division coefficient to obtain a reference clock, and the third-stage frequency divider performs frequency division processing on the output clock of the voltage-controlled oscillator based on the third frequency division coefficient to obtain an audio clock;
[0110] Determine a second frequency division coefficient and a fourth frequency division coefficient according to the first frequency division coefficient, the third frequency division coefficient and audio clock related information, so that the second-stage frequency divider performs frequency multiplication processing on the reference clock based on the second frequency division coefficient and the fourth frequency division coefficient to obtain the output clock;
[0111] The audio clock related information is related information sent by the transmitter and used to recover the audio clock.
[0112] Optionally, the processor 31 is specifically configured to:
[0113] The quotient of the input clock and the crystal oscillator clock is rounded to obtain the first frequency division coefficient.
[0114] Optionally, the processor 31 is further configured to:
[0115] Under the control of the reference clock, collecting the crystal oscillator clock;
[0116] A difference operation is performed between the number of clock acquisitions within a previous first preset time length and the number of clock acquisitions within a current first preset time length. If the difference is less than a preset threshold, the first frequency division coefficient is input into the first-stage frequency divider.
[0117] Optionally, the audio clock related information includes a frequency division parameter and a count value, wherein the count value is a count value of a clock obtained by dividing the input clock by the frequency division parameter;
[0118] The processor 31 is specifically used for:
[0119] Taking the product of the high-frequency clock and the count value as a quotient of the product of the input clock and the frequency division parameter;
[0120] The obtained first quotient value is rounded to obtain the third frequency division coefficient.
[0121] Optionally, the processor 31 is specifically configured to:
[0122] Taking the product of the frequency division parameter, the first frequency division coefficient and the third frequency division coefficient as a quotient of the count value;
[0123] The second frequency division coefficient and the fourth frequency division coefficient are determined according to the obtained second quotient value.
[0124] Optionally, the processor 31 is specifically configured to:
[0125] The integer part of the second quotient is used as the second frequency division coefficient, and the decimal part of the second quotient is used as the fourth frequency division coefficient.
[0126] Optionally, the processor 31 is further configured to:
[0127] Decoding the received audio and video data to obtain audio data;
[0128] Under the control of the input clock, writing the audio data into a first-in-first-out queue;
[0129] Under the control of the audio clock, reading the audio data from the first-in-first-out queue;
[0130] The fourth frequency division coefficient is adjusted according to the data amount of the audio data stored in the first-in-first-out queue.
[0131] Optionally, the processor 31 is specifically configured to:
[0132] If the difference between the data amount and the first preset data amount is greater than the second preset data amount, increasing and adjusting the fourth frequency division coefficient;
[0133] If the difference between the data amount and the first preset data amount is smaller than the second preset data amount, the fourth frequency division coefficient is adjusted to decrease.
[0134] Based on the same inventive concept, an embodiment of the present application further provides an audio clock recovery device. The principle of solving the problem by the audio clock recovery device is similar to the principle of solving the problem by any of the above-mentioned audio clock recovery methods, and the repeated parts will not be repeated.
[0135] like Figure 8 As shown, an audio clock recovery device provided by an embodiment of the present application is applied to a phase-locked loop circuit, wherein the phase-locked loop circuit includes a first-stage frequency divider, a second-stage frequency divider, a third-stage frequency divider, a phase detector, a low-pass filter, and a voltage-controlled oscillator, wherein the first-stage frequency divider, the phase detector, the low-pass filter, the voltage-controlled oscillator, and the third-stage frequency divider are connected in sequence, the input end of the second-stage frequency divider is connected to the output end of the voltage-controlled oscillator, and the output end of the second-stage frequency divider is connected to the phase detector, and the device includes:
[0136] The first determination module 41 is used to determine a first frequency division coefficient according to an input clock of the phase-locked loop circuit and a preset crystal oscillator clock, and to determine a third frequency division coefficient according to the input clock, a preset high-frequency clock and audio clock related information, so that the first-stage frequency divider performs frequency division processing on the input clock based on the first frequency division coefficient to obtain a reference clock, and the third-stage frequency divider performs frequency division processing on the output clock of the voltage-controlled oscillator based on the third frequency division coefficient to obtain an audio clock;
[0137] A second determination module 42 is used to determine a second frequency division coefficient and a fourth frequency division coefficient according to the first frequency division coefficient, the third frequency division coefficient and audio clock related information, so that the second-stage frequency divider performs frequency multiplication processing on the reference clock based on the second frequency division coefficient and the fourth frequency division coefficient to obtain the output clock;
[0138] The audio clock related information is related information sent by the transmitter and used to recover the audio clock.
[0139] Optionally, the first determining module 41 is specifically configured to:
[0140] The quotient of the input clock and the crystal oscillator clock is rounded to obtain the first frequency division coefficient.
[0141] Optionally, the first determining module 41 is further configured to:
[0142] Under the control of the reference clock, collecting the crystal oscillator clock;
[0143] A difference operation is performed between the number of clock acquisitions within a previous first preset time length and the number of clock acquisitions within a current first preset time length. If the difference is less than a preset threshold, the first frequency division coefficient is input into the first-stage frequency divider.
[0144] The optional audio clock related information includes a frequency division parameter and a count value, wherein the count value is a count value of a clock obtained by dividing the input clock by the frequency division parameter;
[0145] Optionally, the first determining module 41 is specifically configured to:
[0146] Taking the product of the high-frequency clock and the count value as a quotient of the product of the input clock and the frequency division parameter;
[0147] The obtained first quotient value is rounded to obtain the third frequency division coefficient.
[0148] Optionally, the second determining module 42 is specifically configured to:
[0149] Taking the product of the frequency division parameter, the first frequency division coefficient and the third frequency division coefficient as a quotient of the count value;
[0150] The second frequency division coefficient and the fourth frequency division coefficient are determined according to the obtained second quotient value.
[0151] Optionally, the second determining module 42 is specifically configured to:
[0152] The integer part of the second quotient is used as the second frequency division coefficient, and the decimal part of the second quotient is used as the fourth frequency division coefficient.
[0153] Optionally, the second determining module 42 is further configured to:
[0154] Decoding the received audio and video data to obtain audio data;
[0155] Under the control of the input clock, writing the audio data into a first-in-first-out queue;
[0156] Under the control of the audio clock, reading the audio data from the first-in-first-out queue;
[0157] The fourth frequency division coefficient is adjusted according to the data amount of the audio data stored in the first-in-first-out queue.
[0158] Optionally, the second determining module 42 is specifically configured to:
[0159] If the difference between the data amount and the first preset data amount is greater than the second preset data amount, increasing and adjusting the fourth frequency division coefficient;
[0160] If the difference between the data amount and the first preset data amount is smaller than the second preset data amount, the fourth frequency division coefficient is adjusted to decrease.
[0161] An embodiment of the present invention further provides a computer-readable non-volatile storage medium, comprising a program code. When the program code is executed on a computing terminal, the program code is used to enable the computing terminal to execute the steps of the audio clock recovery method in the above-mentioned embodiment of the present invention.
[0162] The present application is described above with reference to the block diagrams and / or flow charts showing the methods, devices (systems) and / or computer program products according to the embodiments of the present application. It should be understood that a block of the block diagram and / or flow chart diagram and a combination of blocks of the block diagram and / or flow chart diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer and / or other programmable data processing device to produce a machine, so that the instructions executed by the computer processor and / or other programmable data processing device create a method for implementing the functions / actions specified in the block diagram and / or flow chart block.
[0163] Accordingly, the present application may also be implemented with hardware and / or software (including firmware, resident software, microcode, etc.). Furthermore, the present application may take the form of a computer program product on a computer-usable or computer-readable storage medium, which has a computer-usable or computer-readable program code implemented in the medium, for use by an instruction execution system or in conjunction with an instruction execution system. In the context of the present application, a computer-usable or computer-readable medium may be any medium that may contain, store, communicate, transmit, or convey a program for use by an instruction execution system, device, or apparatus, or in conjunction with an instruction execution system, device, or apparatus.
[0164] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. An audio clock recovery method, characterized in that: Applied to a phase-locked loop circuit, the phase-locked loop circuit includes a first-stage frequency divider, a second-stage frequency divider, a third-stage frequency divider, a phase detector, a low-pass filter and a voltage-controlled oscillator, wherein the first-stage frequency divider, the phase detector, the low-pass filter, the voltage-controlled oscillator and the third-stage frequency divider are connected in sequence, the input end of the second-stage frequency divider is connected to the output end of the voltage-controlled oscillator, and the output end of the second-stage frequency divider is connected to the phase detector, and the method includes: Determine a first frequency division coefficient according to an input clock of the phase-locked loop circuit and a preset crystal oscillator clock, and determine a third frequency division coefficient according to the input clock, a preset high-frequency clock and audio clock related information, so that the first-stage frequency divider performs frequency division processing on the input clock based on the first frequency division coefficient to obtain a reference clock, and the third-stage frequency divider performs frequency division processing on the output clock of the voltage-controlled oscillator based on the third frequency division coefficient to obtain an audio clock; Determine a second frequency division coefficient and a fourth frequency division coefficient according to the first frequency division coefficient, the third frequency division coefficient and audio clock related information, so that the second-stage frequency divider performs frequency multiplication processing on the reference clock based on the second frequency division coefficient and the fourth frequency division coefficient to obtain the output clock; The audio clock related information is related information sent by the transmitter and used to recover the audio clock.
2. The method according to claim 1, characterized in that Determining a first frequency division coefficient according to an input clock of the phase-locked loop circuit and a preset crystal oscillator clock includes: The quotient of the input clock and the crystal oscillator clock is rounded to obtain the first frequency division coefficient.
3. The method according to claim 2, characterized in that The method further includes: Under the control of the reference clock, collecting the crystal oscillator clock; A difference operation is performed between the number of clock acquisitions within a previous first preset time length and the number of clock acquisitions within a current first preset time length. If the difference is less than a preset threshold, the first frequency division coefficient is input into the first-stage frequency divider.
4. The method according to claim 1, characterized in that The audio clock related information includes a frequency division parameter and a count value, wherein the count value is a count value obtained by counting a clock obtained by frequency dividing the input clock using the frequency division parameter; The step of determining a third frequency division coefficient according to the input clock, the preset high-frequency clock and the audio clock related information includes: Taking the product of the high-frequency clock and the count value as a quotient of the product of the input clock and the frequency division parameter; The obtained first quotient value is rounded to obtain the third frequency division coefficient.
5. The method according to claim 4, characterized in that The determining the second frequency division coefficient and the fourth frequency division coefficient according to the first frequency division coefficient, the third frequency division coefficient and the audio clock related information includes: Taking the product of the frequency division parameter, the first frequency division coefficient and the third frequency division coefficient as a quotient of the count value; The second frequency division coefficient and the fourth frequency division coefficient are determined according to the obtained second quotient value.
6. The method according to claim 5, characterized in that The step of determining the second frequency division coefficient and the fourth frequency division coefficient according to the obtained second quotient value comprises: The integer part of the second quotient is used as the second frequency division coefficient, and the decimal part of the second quotient is used as the fourth frequency division coefficient.
7. The method according to claim 6, characterized in that The method further includes: Decoding the received audio and video data to obtain audio data; Under the control of the input clock, writing the audio data into a first-in-first-out queue; Under the control of the audio clock, reading the audio data from the first-in-first-out queue; The fourth frequency division coefficient is adjusted according to the data amount of the audio data stored in the first-in-first-out queue.
8. The method according to claim 7, characterized in that The adjusting the fourth frequency division coefficient according to the amount of audio data stored in the first-in-first-out queue includes: If the difference between the data amount and the first preset data amount is greater than the second preset data amount, increasing and adjusting the fourth frequency division coefficient; If the difference between the data amount and the first preset data amount is smaller than the second preset data amount, the fourth frequency division coefficient is adjusted to decrease.
9. A receiving terminal, characterized in that: include: A processor, a memory and a phase-locked loop circuit, wherein the phase-locked loop circuit includes a first-stage frequency divider, a second-stage frequency divider, a third-stage frequency divider, a phase detector, a low-pass filter and a voltage-controlled oscillator, wherein the first-stage frequency divider, the phase detector, the low-pass filter, the voltage-controlled oscillator and the third-stage frequency divider are connected in sequence, the input end of the second-stage frequency divider is connected to the output end of the voltage-controlled oscillator, and the output end of the second-stage frequency divider is connected to the phase detector, and the memory stores program code, and when one or more computer programs stored in the memory are executed by the processor, the receiving terminal executes the audio clock recovery method according to any one of claims 1 to 8.
10. An audio clock recovery device, characterized in that: Applied to a phase-locked loop circuit, the phase-locked loop circuit includes a first-stage frequency divider, a second-stage frequency divider, a third-stage frequency divider, a phase detector, a low-pass filter and a voltage-controlled oscillator, wherein the first-stage frequency divider, the phase detector, the low-pass filter, the voltage-controlled oscillator and the third-stage frequency divider are connected in sequence, the input end of the second-stage frequency divider is connected to the output end of the voltage-controlled oscillator, and the output end of the second-stage frequency divider is connected to the phase detector, and the device includes: A first determination module is used to determine a first frequency division coefficient according to an input clock of the phase-locked loop circuit and a preset crystal oscillator clock, and to determine a third frequency division coefficient according to the input clock, a preset high-frequency clock and audio clock related information, so that the first-stage frequency divider performs frequency division processing on the input clock based on the first frequency division coefficient to obtain a reference clock, and the third-stage frequency divider performs frequency division processing on the output clock of the voltage-controlled oscillator based on the third frequency division coefficient to obtain an audio clock; A second determination module is used to determine a second frequency division coefficient and a fourth frequency division coefficient according to the first frequency division coefficient, the third frequency division coefficient and audio clock related information, so that the second-stage frequency divider performs frequency multiplication processing on the reference clock based on the second frequency division coefficient and the fourth frequency division coefficient to obtain the output clock; The audio clock related information is related information sent by the transmitter and used to recover the audio clock.
Citation Information
Patent Citations
Communication system, receiving apparatus, and receiving method
CN101459504A
Detection method and circuit of frequency lock of phase lock loop
CN101621297A
Phase-locked loop with reduced in-band phase noise and corresponding working method thereof
CN102684686A
Audio clock recovery method and apparatus thereof
CN106341128A
Clock system with synchronization function and synchronization implementation method thereof
CN113381755A
