Timing adjustment method, device, computer readable storage medium and electronic device
By using the Kalman filtering algorithm on the DP receiver to process the first row period to estimate the second row period and adjust the output clock, the problem of image data distortion at the DP receiver is solved, and the accurate recovery and normal output of image data are achieved.
Patent Information
- Application Number
- CN202311453271.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-02
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2043-11-02
AI Technical Summary
The image data recovered by the DP receiver is distorted or cannot be output normally, mainly due to the mismatch between the clock frequency of the DP transmitter and the receiver.
The received first row period is processed by using the Kalman filtering algorithm, predicting and estimating the second row period, and the output clock is adjusted according to the estimated second row period to match the source clock frequency.
By adjusting the output clock frequency, we ensure that the restored image data is basically consistent with the original data, avoiding distortion and output failure of the image data.
Smart Images

Figure CN117349219B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data transmission, and in particular to a timing adjustment method, device, computer-readable storage medium and electronic device. Background Art
[0002] In the DP (Display Port) protocol, the transmission timing information on the Main Link is generated based on the content of the image data. At the DP transmitter, the resolution and refresh rate of the image data are fixed values. A stable pixel clock is used to correspond to a stable line length time, and the line length time corresponding to each line of image data is fixed. Due to changes in the clock domain, when the image timing is restored at the DP receiver, the line length becomes larger or smaller, and the resolution of each line cannot be kept consistent, resulting in distortion of the converted downstream output image or inability to output correctly. Summary of the invention
[0003] The main purpose of the present application is to provide a timing adjustment method, device, computer-readable storage medium and electronic device to at least solve the problem in the prior art that the image data restored by the DP receiving end is distorted or even cannot be output normally.
[0004] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a timing adjustment method is provided, including: when receiving a data stream output by a transmitting end of a display interface, determining a first line period according to the data stream, the first line period being the line period of the data stream under an output clock, and the output clock being the clock domain of the receiving end of the display interface; processing the first line period using at least a Kalman filtering algorithm to obtain a second line period, the second line period being the line period of the data stream under a source clock, and the source clock being the clock domain of the transmitting end; and adjusting the output clock according to the second line period.
[0005] Optionally, determining the first line period according to the data stream includes: restoring the data stream to obtain image data and the output clock; extracting two adjacent identical blanking markers from the image data, the blanking markers including at least one of a blanking start marker and a blanking end marker; and determining that the clock period of two adjacent identical blanking markers under the output clock is the first line period.
[0006] Optionally, the transmitting end outputs the data stream through at least one link, one of the links corresponds to at least one first FIFO queue and at least one second FIFO queue, and at least a Kalman filter algorithm is used to process the first row cycle to obtain a second row cycle, including: according to the link corresponding to the first row cycle, writing the first row cycle into the first FIFO queue corresponding to the link; when the first FIFO queue is not empty, reading the first row cycle from the first FIFO queue, and inputting the first row cycle into a Kalman filter, so that the Kalman filter outputs a second initial row cycle, the second initial row cycle consisting of the second row cycle and a plurality of decimal data; writing the second initial row cycle into the corresponding second FIFO queue; reading the second initial row cycle from the second FIFO queue, and inputting the second initial row cycle into the Kalman filter for iterative calculation; truncating part of the decimal data of the second initial row cycle and performing superposition processing on the truncated decimal data, generating and sending the second row cycle according to the truncated second initial row cycle and the accumulated error obtained by the superposition processing.
[0007] Optionally, the first line cycle is input into a Kalman filter so that the Kalman filter outputs a second initial line cycle, including: inputting the first line cycle into the Kalman filter so that the Kalman filter predicts a system state based on the first line cycle to obtain the second initial line cycle, wherein the system state is a clock cycle of two adjacent identical blanking markers in the data stream under the source clock, and the blanking marker includes at least one of a blanking start marker and a blanking end marker.
[0008] Optionally, writing the first row cycle into the first FIFO queue corresponding to the link includes: when a first interrupt is triggered, writing the first row cycle into the first FIFO queue corresponding to the link, and ending the first interrupt, the first interrupt carries an interrupt number generated according to the link and the data flow number; reading the second initial row cycle from the second FIFO queue includes: when a second interrupt is triggered, reading the second row cycle from the second FIFO queue according to a predetermined algorithm, and ending the second interrupt, the predetermined algorithm includes one of the following: a round-robin scheduling algorithm, a priority scheduling algorithm, and the second interrupt carries the interrupt number.
[0009] Optionally, the source clock is a row clock or a pixel clock. When the source clock is the row clock, after the first row period is processed by a Kalman filter algorithm to obtain a second row period, the method further includes: performing clock domain conversion on the second row period to obtain a row period of the first row period under the pixel clock. When the source clock is the pixel clock, before the first row period is processed by a Kalman filter algorithm to obtain the second row period, the method further includes: performing clock domain conversion on the first row period to obtain a row period of the first row period under the pixel clock.
[0010] Optionally, the output clock is adjusted according to the second row period, including: calculating a division ratio according to the second row period and a reference clock period in a phase-locked loop; and controlling the phase-locked loop to generate a corresponding adjustment clock signal to restore the phase and / or frequency of the output clock according to the division ratio.
[0011] According to another aspect of the present application, a timing adjustment device is provided, including: a determination unit, for determining a first line period according to a data stream output by a transmitting end of a display interface when the data stream is received, the first line period being the line period of the data stream under an output clock, and the output clock being the clock domain of the receiving end of the display interface; a processing unit, for processing the first line period using at least a Kalman filtering algorithm to obtain a second line period, the second line period being the line period of the data stream under a source clock, and the source clock being the clock domain of the transmitting end; and an adjustment unit, for adjusting the output clock according to the second line period.
[0012] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the methods described.
[0013] According to another aspect of the present application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include methods for executing any one of the described methods.
[0014] By applying the technical solution of the present application, based on the first row period, at least the Kalman filtering algorithm is used to predict and estimate the second row period, so as to obtain the second row period that stably reflects the pixel row length of the transmitting end, and then the estimated second row period is used to adjust the output clock, thereby ensuring that the adjusted output clock frequency basically matches the source clock frequency, thereby ensuring that the image data recovered according to the adjusted output clock is basically consistent with the original data, avoiding the problem of distortion of the recovered image data or even failure to output normally. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0016] Figure 1 A hardware structure block diagram of a mobile terminal for executing a timing adjustment method provided in an embodiment of the present application is shown;
[0017] Figure 2 A schematic diagram of a flow chart of a timing adjustment method provided according to an embodiment of the present application is shown;
[0018] Figure 3 A schematic diagram of the Kalman filter hardware and software implementation structure provided according to an embodiment of the present application is shown;
[0019] Figure 4 A schematic diagram of a Kalman filter algorithm flow chart provided according to an embodiment of the present application is shown;
[0020] Figure 5 A flowchart of a first FIFO queue provided according to an embodiment of the present application is shown;
[0021] Figure 6 A flowchart of a second FIFO queue provided according to an embodiment of the present application is shown;
[0022] Figure 7 A schematic diagram of timing adjustment at a receiving end according to an embodiment of the present application is shown;
[0023] Figure 8 Another schematic diagram of timing adjustment at a receiving end provided according to an embodiment of the present application is shown;
[0024] Fig. 9 A schematic diagram of a timing adjustment process provided according to an embodiment of the present application is shown;
[0025] Fig.10 A structural block diagram of a timing adjustment device provided according to an embodiment of the present application is shown.
[0026] The drawings include the following reference numerals:
[0027] 102, processor; 104, memory; 106, transmission device; 108, input and output devices. DETAILED DESCRIPTION
[0028] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0029] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0030] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the accompanying drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0031] As introduced in the background technology, there is a problem in the prior art that the image data recovered by the DP receiving end is distorted or even cannot be output normally due to the clock frequency mismatch between the DP sending end and the DP receiving end. In order to solve the above technical problem, the embodiments of the present application provide a timing adjustment method, device, computer-readable storage medium and electronic device.
[0032] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0033] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a timing adjustment method according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0034] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the timing adjustment method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the method described is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. The transmission device 106 is used to receive or send data via a network. The specific example of the network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0035] In this embodiment, a timing adjustment method running on a mobile terminal, a computer terminal, a processor or a similar computing device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0036] Figure 2 is a flow chart of a timing adjustment method according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0037] Step S201, when receiving a data stream output by a transmitting end of a display interface, determining a first line period according to the data stream, wherein the first line period is a line period of the data stream under an output clock, and the output clock is a clock domain of a receiving end of the display interface;
[0038] Specifically, the line period is the time required to scan a row of pixels, that is, the number of pixels in a row, also called the line length. Driven by the output clock, the receiving end samples the received signal and recovers the pixel clock that matches the clock of the transmitting end, thereby recovering accurate data. Generally, the receiving end samples the received signal at the rising edge or falling edge of the output clock. The clock domain of the receiving end is generally the line clock (Link Clock).
[0039] Step S202, at least using a Kalman filter algorithm to process the first row period to obtain a second row period, where the second row period is a row period of the data stream under a source clock, and the source clock is a clock domain of the transmitting end;
[0040] Specifically, the clock domain of the source clock is generally a main link (Main Link) domain.
[0041] Step S203: adjusting the output clock according to the second row period.
[0042] Through the embodiment, first, according to the data stream sent by the transmitting end of the display interface, the first line period of the data stream under the output clock is determined; then, at least the Kalman filter algorithm is used to process the first line period to obtain the second line period of the data stream under the source clock; finally, the output clock is adjusted according to the obtained second line period. Compared with the problem in the prior art that the image data recovered by the DP receiving end is distorted or even cannot be output normally due to the mismatch of the clock frequency between the DP transmitting end and the DP receiving end, the present application predicts and estimates the second line period according to the first line period, at least the Kalman filter algorithm is used to obtain the second line period that stably reflects the pixel row length of the transmitting end, and then the estimated second line period is used to adjust the output clock, ensuring that the adjusted output clock frequency is basically matched with the source clock frequency, thereby ensuring that the image data recovered according to the adjusted output clock is basically consistent with the original data, avoiding the problem that the recovered image data is distorted or even cannot be output normally.
[0043] In an optional scheme, determining the first line period according to the data stream includes: restoring the data stream to obtain image data and the output clock; extracting two adjacent identical blanking markers from the image data, the blanking markers including at least one of a blanking start (Blanking Start, abbreviated as BS) marker and a blanking end (Blanking End, abbreviated as BE) marker; determining the clock period of the two adjacent identical blanking markers under the output clock as the first line period.
[0044] In the embodiment, the received data stream is first restored to obtain image data including a blanking mark and an output clock, and then the number of clock cycles of two adjacent blanking start marks or two adjacent blanking end marks under the output clock is used to measure the line length of the image data to obtain the first line period. The first line period corresponding to the data stream can be obtained more accurately, providing more accurate data support for the subsequent estimation of the second line period.
[0045] Specifically, the image data generally includes a BS flag, a field blanking flag, a timer value, a virtual display, a BE flag, pixel data, a fill start flag, fill data, and a fill end flag.
[0046] In an exemplary embodiment, at least the first row period is processed using a Kalman filter algorithm to obtain a second row period, including: using a Kalman filter algorithm to process the first row period to obtain a system state that represents the clock period of two adjacent identical blanking markers in the data stream under the source clock, and the system state is the second row period.
[0047] Of course, in addition to the embodiments, those skilled in the art may also use other methods to implement the determination of the second row period. In the present application, the transmitting end outputs the data stream through at least one link, that is, the transmitting end adopts a single-stream transmission mode (Single-Stream Transport, referred to as SST) or a multi-stream transmission mode (Multi-Stream Transport, referred to as MST) to transmit the data stream, and one of the links corresponds to at least one first FIFO queue and at least one second FIFO queue, such as Figure 3 and Figure 4 As shown, step S202: at least using a Kalman filter algorithm to process the first row period to obtain a second row period includes the following specific steps:
[0048] Step S2021: According to the link corresponding to the first row period, writing the first row period into the first FIFO queue corresponding to the link;
[0049] Specifically, the link corresponding to the first row period is a link for transmitting the data stream of the first row period. The first FIFO queue and the second FIFO queue may be FIFOs designed by hardware or FIFOs designed by software.
[0050] Step S2022: when the first FIFO queue is not empty, reading the first line period from the first FIFO queue, and inputting the first line period into a Kalman filter, so that the Kalman filter outputs a second initial line period, wherein the second initial line period is composed of the second line period and a plurality of decimal data;
[0051] Specifically, the Kalman filter is used to execute the Kalman filter algorithm, which can be a device designed by hardware or software, the second initial row period is the original period value of the data stream under the source clock estimated by the Kalman filter algorithm, the second initial row period is a decimal, and the decimal data is the decimal data value of the second initial row period.
[0052] Step S2023: writing the second initial row period into the corresponding second FIFO queue;
[0053] Step S2024: reading the second initial row period from the second FIFO queue, and inputting the second initial row period into the Kalman filter for iterative calculation;
[0054] Specifically, the Kalman filter algorithm uses the system state at the previous moment and the measurement value at the current moment to obtain the optimal estimate of the system state of the dynamic system at the current moment. Therefore, after obtaining the second initial row period, the second initial row period needs to be fed back to the input end of the Kalman filter.
[0055] Step S2025: truncate part of the fractional data of the second initial line period and perform superposition processing on the truncated fractional data, generate the second line period and send it out according to the truncated second initial line period and the accumulated error obtained by the superposition processing.
[0056] Specifically, since the Kalman filter algorithm is a cyclic iterative algorithm, the Kalman filter algorithm performs truncation once each time it obtains the second row period, and correspondingly obtains a truncated decimal data, and the accumulated error is obtained by superimposing these truncated decimal data.
[0057] In the embodiment, the first row period is dynamically filtered by the Kalman filter algorithm, which can further ensure that the second row period that stably reflects the pixel row length of the sending end is obtained, and the timing adjustment of the receiving end is further realized, thereby further ensuring that the image data recovered by the receiving end is more accurate and reliable. In addition, since the Kalman filter algorithm is an iterative algorithm, it requires the system state calculated at the previous moment and the measured value at the current moment to calculate the system state at the current moment. The present application can balance the difference between the measured value interval and the system state interval by setting a two-level FIFO queue, so that the two are basically the same, further facilitating the execution of the Kalman filter algorithm. In addition, the present application allocates a first FIFO queue and a second FIFO queue to the transmission link of each data stream, so that multiple transmission links share the Kalman filter calculation resources, realizes the time-sharing execution of the data stream iterative calculation of each link, and can obtain the second row period corresponding to each link, avoiding the problem of designing a separate calculation resource for each link and causing resource waste.
[0058] Of course, by setting the first FIFO queue and the second FIFO queue, it is also possible to prevent the loss of multi-link data during the input and output process, avoid frequent bus operations, and reduce the burden on the processor.
[0059] In order to further ensure the flexibility of timing adjustment, in an optional method, the Kalman filter is a device that implements the Kalman filter algorithm, and the first FIFO queue and the second FIFO queue are implemented by software. Compared with the pure hardware implementation, the present application can provide the ability to programmably modify and update the dynamic filtering algorithm later through the implementation of software and hardware.
[0060] In addition, the second line period is generated and issued based on the truncated second initial line period and the accumulated error obtained by the superposition processing. Specifically, when the accumulated error is greater than a threshold, the truncated second initial line period is corrected according to the accumulated error to obtain the second line period; when the accumulated error is not greater than a threshold, the truncated second initial line period is directly output as the second line period.
[0061] Further, the second initial line period after truncation is corrected according to the accumulated error to obtain the second line period, including: adding the second initial line period after truncation to the average value of the accumulated error to obtain the second line period.
[0062] It should be noted that the step S2025 can be implemented by software, by hardware, or by a combination of software and hardware. Among them, in the embodiment that needs to be implemented by hardware, the number of digits of the truncated decimal data is specifically determined according to the number of decimal digits that can be stored by the hardware generation logic itself, that is, according to the number of decimal digits that can be stored by the hardware generation logic, the number of decimal digits that exceeds the number of decimal digits of the hardware generation logic is truncated, and the error accumulation method is used for superposition processing, and each iteration outputs the decimal part that matches the hardware generation logic. The truncation process can be implemented by hardware, and the accumulation process of the decimal part can be implemented by software, so as to achieve the purpose of software and hardware coordination.
[0063] According to other embodiments of the present application, the first line cycle is input into a Kalman filter so that the Kalman filter outputs a second initial line cycle, including: the first line cycle is input into the Kalman filter so that the Kalman filter predicts the system state according to the first line cycle to obtain the second initial line cycle, the system state is the clock cycle of two adjacent identical blanking marks in the data stream under the source clock, and the blanking mark includes at least one of a blanking start mark and a blanking end mark. The present application defines the system state and the measurement value on both sides of the transmitting end and the receiving end of the display interface respectively, and uses dynamic filtering to estimate the system state representing the line cycle of the transmitting end from the measurement value representing the line cycle of the receiving end, thereby further achieving a system state output that stably reflects the line cycle of the transmitting end.
[0064] Specifically, the specific process of constructing the Kalman filter and using the Kalman filter to perform dynamic filtering can be as follows:
[0065] Define the initial state at time T0: Z = Z[0], X = X[0], H = h0, P = P[0], R = r0, Q = q0. Among them, the initial value Z[0] of the measurement value Z represents the measurement value at time T0. For example, the number of line cycles of the line clock between two adjacent BEs, the number of line cycles of the line clock between two adjacent BSs, the number of line cycles of the pixel clock between two adjacent BEs, and the number of line cycles of the pixel clock between two adjacent BSs. Select the initial state X[0] of the system state X. Here, you can choose the observed value of the system state, such as the observed value of the system state at time T0, or other valid estimates of the system state. Select the observation coefficient H, that is, the relationship ratio between the measured value and the system state, which is a constant h0. From the measurement point of view, the measured value can have a certain linear proportional relationship with the system state. You can choose to accumulate the line cycle of multiple pixel lines within a period of time as the measured value for calculation. For example: Select 5 line cycles to observe the BS interval and the system state calculated, which is one-fifth of the measured value. Select the initial states q0 and r0 of the error coefficients Q and R. The error coefficients modify the Kalman filter calculation process, allowing the user to adjust according to the actual system, and can remain unchanged after the initial state selection. Select the intermediate value P of the calculation process, the initial value P[0], for example, generally select state 0.
[0066] like Figure 4 As shown, the calculation is done in an iterative manner, and the calculation result is the system state X at the iteration time k. The iteration interval is the measurement interval. The calculation process is as follows:
[0067] X[k]=X[k-1];
[0068] P[k]=P[k-1]+q0;
[0069] temp=(P[k]×h0 / (P[k]×h0×h0+r0));
[0070] X[k]=X[k]+temp×(Z[k]–h0×X[k]);
[0071] P[k]=(1-temp×h0)×P[k].
[0072] Step S2021 of the present application: writing the first row cycle into the first FIFO queue corresponding to the link, specifically including: in the case of triggering the first interrupt, writing the first row cycle into the first FIFO queue corresponding to the link, and ending the first interrupt, the first interrupt carries an interrupt number generated according to the number of the link and the data stream. The interrupt number is used to characterize the link and data stream corresponding to the first row cycle, and is the unique number of the first row cycle. Step S2024 of the present application: reading the second initial row cycle from the second FIFO queue, specifically including: in the case of triggering the second interrupt, reading the second row cycle from the second FIFO queue according to a predetermined algorithm, and ending the second interrupt, the predetermined algorithm includes one of the following: a cyclic scheduling algorithm, a priority scheduling algorithm, and the second interrupt carries the interrupt number. The present application combines FIFO queues and interrupts to meet real-time processing requirements and further improve the efficiency of timing adjustment. And by reading the second row cycle from the second FIFO queue through a cyclic scheduling or priority scheduling method, the iteration of the parallel loop can be distributed to multiple threads, further speeding up the progress of timing adjustment of each link.
[0073] In addition, the specific implementation method of step S2022: reading the first row cycle from the first FIFO queue is the same as the implementation method of step S2024, and the specific implementation method of step S2023: writing the second initial row cycle into the corresponding second FIFO queue is the same as the specific implementation method of step S2021, which will not be repeated here.
[0074] In a specific embodiment, Figure 5 As shown, when the first line cycle of the nth link is obtained, the first interrupt corresponding to the nth link is triggered; the measurement value is counted; the first line cycle corresponding to the nth link is read and written into the first FIFO queue; and the first interrupt corresponding to the nth link is ended. Figure 6 As shown, when the system status of the nth link is written into the second FIFO, the second interrupt corresponding to the nth link is triggered; the system status value is counted; the system status is read from the second FIFO, and the generation logic of the second row cycle is updated according to the system status, that is, the output of the second row cycle is updated; and the second interrupt corresponding to the nth link is ended.
[0075] In actual application, the source clock is a row clock or a pixel clock, that is, the system state of the Kalman filter can be the clock cycle of the same two adjacent blanking mark intervals under the clock domain of the row clock of the transmitting end, or it can be the clock cycle of the same two adjacent blanking mark intervals under the clock domain of the pixel clock of the transmitting end. In order to further achieve accurate adjustment of the clock timing of the output end corresponding to the above two situations, in some optional embodiments of the present application, when the source clock is the row clock, after the Kalman filter algorithm is used to process the first row cycle to obtain the second row cycle, the method further includes: performing clock domain conversion on the second row cycle to obtain the row cycle of the first row cycle under the pixel clock. When the source clock is the pixel clock, before the Kalman filter algorithm is used to process the first row cycle to obtain the second row cycle, the method further includes: performing clock domain conversion on the first row cycle to obtain the row cycle of the first row cycle under the pixel clock.
[0076] That is to say, Figure 7 As shown in the figure, when the system state is the clock cycle in the clock domain of the line clock at the transmitting end, the measured value of the Kalman filter input at the receiving end is the clock cycle of the image data in the clock domain of the line clock, and the output of the Kalman filter is still the clock cycle estimated in the clock domain of the line clock, which is then converted into the clock cycle in the clock domain of the pixel clock after cross-clock domain conversion. Figure 8 As shown, when the system state is the clock period in the clock domain of the pixel clock at the transmitting end, the measured value of the Kalman filter input on the receiving end side is the clock period of the image data in the clock domain of the pixel clock, which is obtained after clock conversion from the clock domain of the row clock, and the Kalman filter output is the estimated clock period in the clock domain of the pixel clock.
[0077] In order to further solve the problem that the image data recovered by the DP receiving end is distorted or even cannot be output normally due to the mismatch of the clock frequency between the DP sending end and the DP receiving end, optionally, the output clock is adjusted according to the second line period, including: calculating the division ratio according to the second line period and the reference clock period in the phase-locked loop; according to the division ratio, controlling the phase-locked loop (Phase Locked Loop, referred to as PLL) to generate a corresponding adjustment clock signal to restore the phase and / or frequency of the output clock. By calculating the fractional division ratio of the second line period and the reference clock period in the phase-locked loop, and then controlling the PLL to generate the adjustment clock signal to restore the image data according to the fractional division ratio, it is further ensured that the resolution of the recovered image data is basically consistent with that of the sending end, and the accuracy and reliability of the recovered image data are further ensured.
[0078] This embodiment relates to a specific timing adjustment method, such as Fig. 9 As shown, the following steps are included:
[0079] Step S1: after receiving the data stream from the main link at the transmitting end, recover the clock cycles of two adjacent identical blanking marks observed on the main link to obtain the first line cycle;
[0080] Step S2: triggering the Kalman filter circuit to perform dynamic filtering calculation on the first line period, and obtaining two adjacent clock periods of the same blanking mark of the transmitting end standard as the second line period;
[0081] Step S3: According to the second row period, combined with the reference clock period in the PLL, the frequency adjustment circuit is controlled to perform frequency adjustment calculation, and the dynamically changing frequency control fractional division ratio is output;
[0082] Step S4: According to the fractional frequency division ratio, the PLL is controlled to generate an adjustment clock signal of the corresponding image pixel for use in image data recovery, and at the same time, the signal is fed back to the frequency adjustment circuit for dynamic adjustment reference.
[0083] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0084] The embodiment of the present application also provides a timing adjustment device. It should be noted that the timing adjustment device of the embodiment of the present application can be used to execute the timing adjustment method provided by the embodiment of the present application. The device is used to implement the embodiments and preferred implementations, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0085] The following is an introduction to the timing adjustment device provided in the embodiments of the present application.
[0086] Fig.10 is a schematic diagram of a timing adjustment device according to an embodiment of the present application. Fig.10 As shown, the device comprises:
[0087] The determining unit 10 is used to determine a first line period according to the data stream when receiving the data stream output by the transmitting end of the display interface, wherein the first line period is a line period of the data stream under the output clock, and the output clock is a clock domain of the receiving end of the display interface;
[0088] Specifically, the line period is the time required to scan a row of pixels, that is, the number of pixels in a row, also called the line length. Driven by the output clock, the receiving end samples the received signal and recovers the pixel clock that matches the clock of the transmitting end, thereby recovering accurate data. Generally, the receiving end samples the received signal at the rising edge or falling edge of the output clock. The clock domain of the receiving end is generally the line clock.
[0089] A processing unit 20, configured to process the first row period by at least using a Kalman filter algorithm to obtain a second row period, where the second row period is a row period of the data stream under a source clock, and the source clock is a clock domain of the transmitting end;
[0090] The adjusting unit 30 is configured to adjust the output clock according to the second row period.
[0091] Through the embodiment, the determination unit determines the first line period of the data stream under the output clock according to the data stream sent by the transmitting end of the display interface; the processing unit processes the first line period by at least using the Kalman filter algorithm to obtain the second line period of the data stream under the source clock; the adjustment unit adjusts the output clock according to the obtained second line period. Compared with the problem in the prior art that the image data recovered by the DP receiving end is distorted or even cannot be output normally due to the mismatch of the clock frequencies of the DP transmitting end and the DP receiving end, the present application predicts and estimates the second line period according to the first line period, at least using the Kalman filter algorithm to obtain the second line period that stably reflects the pixel row length of the transmitting end, and then uses the estimated second line period to adjust the output clock, ensuring that the adjusted output clock frequency is basically matched with the source clock frequency, thereby ensuring that the image data recovered according to the adjusted output clock is basically consistent with the original data, avoiding the problem that the recovered image data is distorted or even cannot be output normally.
[0092] In an optional scheme, the determination unit includes: a recovery module, used to recover the data stream to obtain image data and the output clock; an extraction module, used to extract two adjacent identical blanking markers from the image data, the blanking markers including at least one of a blanking start marker and a blanking end marker; a determination module, used to determine that the clock period of two adjacent identical blanking markers under the output clock is the first line period.
[0093] In the embodiment, the received data stream is restored to obtain image data including a blanking mark and an output clock. The number of clock cycles of two adjacent blanking start marks or two adjacent blanking end marks under the output clock is used to measure the line length of the image data to obtain the first line period. The first line period corresponding to the data stream can be obtained more accurately, providing more accurate data support for the subsequent estimation of the second line period.
[0094] Specifically, the image data generally includes a BS flag, a field blanking flag, a timer value, a virtual display, a BE flag, pixel data, a fill start flag, fill data, and a fill end flag.
[0095] In an exemplary embodiment, the processing unit includes: a processing module, used to process the first row period using a Kalman filtering algorithm to obtain a system state representing a clock period of two adjacent identical blanking markers in the data stream under the source clock, and the system state is the second row period.
[0096] Of course, in addition to the embodiments, those skilled in the art may also use other methods to implement the determination of the second row period. In the present application, the transmitting end outputs the data stream through at least one link, that is, the transmitting end transmits the data stream in a single-stream transmission mode or a multi-stream transmission mode, and one of the links corresponds to at least one first FIFO queue and at least one second FIFO queue. The processing unit includes:
[0097] A first writing module, configured to write the first row period into the first FIFO queue corresponding to the link according to the link corresponding to the first row period;
[0098] Specifically, the link corresponding to the first row period is a link for transmitting the data stream of the first row period. The first FIFO queue and the second FIFO queue may be FIFOs designed by hardware or FIFOs designed by software.
[0099] A first reading module is used for reading the first line period from the first FIFO queue when the first FIFO queue is not empty, and inputting the first line period into a Kalman filter, so that the Kalman filter outputs a second initial line period, wherein the second initial line period is composed of the second line period and a plurality of decimal data;
[0100] Specifically, the Kalman filter is used to execute the Kalman filter algorithm, which can be a device designed by hardware or software, the second initial row period is the original period value of the data stream under the source clock estimated by the Kalman filter algorithm, the second initial row period is a decimal, and the decimal data is the decimal data value of the second initial row period.
[0101] A second writing module, used for writing the second initial row period into the corresponding second FIFO queue;
[0102] A second reading module, configured to read the second initial row period from the second FIFO queue, and input the second initial row period into the Kalman filter for iterative calculation;
[0103] Specifically, the Kalman filter algorithm uses the system state at the previous moment and the measurement value at the current moment to obtain the optimal estimate of the system state of the dynamic system at the current moment. Therefore, after obtaining the second initial row period, the second initial row period needs to be fed back to the input end of the Kalman filter.
[0104] The truncation module is used to truncate part of the fractional data of the second initial line period and perform superposition processing on the truncated fractional data, and generate and send out the second line period according to the truncated second initial line period and the accumulated error obtained by the superposition processing.
[0105] Specifically, since the Kalman filter algorithm is a cyclic iterative algorithm, the Kalman filter algorithm performs truncation once each time it obtains the second row period, and correspondingly obtains a truncated decimal data, and the accumulated error is obtained by superimposing these truncated decimal data.
[0106] In the embodiment, the first row period is dynamically filtered by the Kalman filter algorithm, which can further ensure that the second row period that stably reflects the pixel row length of the sending end is obtained, and the timing adjustment of the receiving end is further realized, thereby further ensuring that the image data recovered by the receiving end is more accurate and reliable. In addition, since the Kalman filter algorithm is an iterative algorithm, it requires the system state calculated at the previous moment and the measured value at the current moment to calculate the system state at the current moment. The present application can balance the difference between the measured value interval and the system state interval by setting a two-level FIFO queue, so that the two are basically the same, further facilitating the execution of the Kalman filter algorithm. In addition, the present application allocates a first FIFO queue and a second FIFO queue to the transmission link of each data stream, so that multiple transmission links share the Kalman filter calculation resources, realizes the time-sharing execution of the data stream iterative calculation of each link, and can obtain the second row period corresponding to each link, avoiding the problem of designing a separate calculation resource for each link and causing resource waste.
[0107] Of course, by setting the first FIFO queue and the second FIFO queue, it is also possible to prevent the loss of multi-link data during the input and output process, avoid frequent bus operations, and reduce the burden on the processor.
[0108] In order to further ensure the flexibility of timing adjustment, in an optional method, the Kalman filter is a device that implements the Kalman filter algorithm, and the first FIFO queue and the second FIFO queue are implemented by software. Compared with the pure hardware implementation, the present application can provide the ability to programmably modify and update the dynamic filtering algorithm later through the implementation of software and hardware.
[0109] In addition, the truncation module may specifically include: a correction submodule, which is used to correct the second initial line period after truncation according to the accumulated error to obtain the second line period when the accumulated error is greater than a threshold; and an output submodule, which is used to directly output the second initial line period after truncation as the second line period when the accumulated error is not greater than a threshold.
[0110] Furthermore, the correction submodule is further configured to add the truncated second initial line period to the average value of the accumulated error to obtain the second line period.
[0111] It should be noted that the truncation module can be implemented by software, hardware, or a combination of software and hardware. Among them, in the embodiment that needs to be implemented by hardware, the number of digits of the truncated decimal data is specifically determined according to the number of decimal digits that can be stored by the hardware generation logic itself, that is, according to the number of decimal digits that can be stored by the hardware generation logic, the number of decimal digits that exceeds the number of decimal digits of the hardware generation logic is truncated, and the error accumulation method is used for superposition processing, and each iteration outputs the decimal part that matches the hardware generation logic. The truncation process can be implemented by hardware, and the accumulation process of the decimal part can be implemented by software, so as to achieve the purpose of software and hardware coordination.
[0112] According to some other embodiments of the present application, the first reading module includes: an input submodule, which is used to input the first line cycle into the Kalman filter, so that the Kalman filter predicts the system state according to the first line cycle to obtain the second initial line cycle, and the system state is the clock cycle of two adjacent identical blanking marks in the data stream under the source clock, and the blanking mark includes at least one of a blanking start mark and a blanking end mark. The present application defines the system state and the measurement value on both sides of the sending end and the receiving end of the display interface respectively, and uses dynamic filtering to estimate the system state representing the line cycle of the sending end from the measurement value representing the line cycle of the receiving end, thereby further achieving a system state output that stably reflects the line cycle of the sending end.
[0113] Specifically, the specific process of constructing the Kalman filter and using the Kalman filter to perform dynamic filtering can be as follows:
[0114] Define the initial state at time T0: Z = Z[0], X = X[0], H = h0, P = P[0], R = r0, Q = q0. Among them, the initial value Z[0] of the measurement value Z represents the measurement value at time T0. For example, the number of line cycles of the line clock between two adjacent BEs, the number of line cycles of the line clock between two adjacent BSs, the number of line cycles of the pixel clock between two adjacent BEs, and the number of line cycles of the pixel clock between two adjacent BSs. Select the initial state X[0] of the system state X. Here, you can choose the observed value of the system state, such as the observed value of the system state at time T0, or other valid estimates of the system state. Select the observation coefficient H, that is, the relationship ratio between the measured value and the system state, which is a constant h0. From the measurement point of view, the measured value can have a certain linear proportional relationship with the system state. You can choose to accumulate the line cycle of multiple pixel lines within a period of time as the measured value for calculation. For example: Select 5 line cycles to observe the BS interval and the system state calculated, which is one-fifth of the measured value. Select the initial states q0 and r0 of the error coefficients Q and R. The error coefficients modify the Kalman filter calculation process, allowing the user to adjust according to the actual system, and can remain unchanged after the initial state selection. Select the intermediate value P of the calculation process, the initial value P[0], for example, generally select state 0.
[0115] The calculation is done in an iterative way, and the calculation is performed at each iteration time k. The calculation result is the system state X at the iteration time k. The iteration interval is the measurement interval. The calculation process is as follows:
[0116] X[k]=X[k-1];
[0117] P[k]=P[k-1]+q0;
[0118] temp=(P[k]×h0 / (P[k]×h0×h0+r0));
[0119] X[k]=X[k]+temp×(Z[k]–h0×X[k]);
[0120] P[k]=(1-temp×h0)×P[k].
[0121] The first writing module of the present application specifically includes: a writing submodule, which is used to write the first row cycle into the first FIFO queue corresponding to the link and end the first interruption when the first interruption is triggered, and the first interruption carries an interruption number generated according to the number of the link and the data stream. The interruption number is used to characterize the link and data stream corresponding to the first row cycle, which is the unique number of the first row cycle. The second reading module of the present application specifically includes: a reading submodule, which is used to read the second row cycle from the second FIFO queue according to a predetermined algorithm when the second interruption is triggered, and end the second interruption. The predetermined algorithm includes one of the following: a cyclic scheduling algorithm, a priority scheduling algorithm, and the second interruption carries the interruption number. The present application combines FIFO queues and interruptions to meet real-time processing requirements and further improve the efficiency of timing adjustment. And by reading the second row cycle from the second FIFO queue through a cyclic scheduling or priority scheduling method, the iteration of the parallel loop can be distributed to multiple threads, further speeding up the progress of timing adjustment of each link.
[0122] In addition, the specific implementation method of reading the first row cycle from the first FIFO queue in the first reading module is the same as the implementation method of the second reading module, and the specific implementation method of writing the second initial row cycle into the corresponding second FIFO queue in the second writing module is the same as the specific implementation method of the first writing module, which will not be repeated here.
[0123] In a specific embodiment, Figure 5 As shown, when the first line cycle of the nth link is obtained, the first interrupt corresponding to the nth link is triggered; the measurement value is counted; the first line cycle corresponding to the nth link is read and written into the first FIFO queue; and the first interrupt corresponding to the nth link is ended. Figure 6 As shown, when the system status of the nth link is written into the second FIFO, the second interrupt corresponding to the nth link is triggered; the system status value is counted; the system status is read from the second FIFO, and the generation logic of the second row cycle is updated according to the system status, that is, the output of the second row cycle is updated; and the second interrupt corresponding to the nth link is ended.
[0124] In actual application, the source clock is a row clock or a pixel clock, that is, the system state of the Kalman filter can be the clock cycle of the same two adjacent blanking mark intervals under the clock domain of the row clock of the transmitting end, or the clock cycle of the same two adjacent blanking mark intervals under the clock domain of the pixel clock of the transmitting end. In order to further achieve accurate adjustment of the clock timing of the output end corresponding to the above two situations, in some optional embodiments of the present application, the device also includes: a first conversion unit, which is used to process the first row cycle using the Kalman filter algorithm to obtain the second row cycle, and then perform clock domain conversion on the second row cycle to obtain the row cycle of the first row cycle under the pixel clock when the source clock is the row clock. The device also includes: a second conversion unit, which is used to process the first row cycle using the Kalman filter algorithm to obtain the second row cycle, and then perform clock domain conversion on the first row cycle to obtain the row cycle of the first row cycle under the pixel clock when the source clock is the pixel clock.
[0125] That is to say, Figure 7 As shown in the figure, when the system state is the clock cycle in the clock domain of the line clock at the transmitting end, the measured value of the Kalman filter input at the receiving end is the clock cycle of the image data in the clock domain of the line clock, and the output of the Kalman filter is still the clock cycle estimated in the clock domain of the line clock, which is then converted into the clock cycle in the clock domain of the pixel clock after cross-clock domain conversion. Figure 8 As shown, when the system state is the clock period in the clock domain of the pixel clock at the transmitting end, the measured value of the Kalman filter input on the receiving end side is the clock period of the image data in the clock domain of the pixel clock, which is obtained after clock conversion from the clock domain of the row clock, and the Kalman filter output is the estimated clock period in the clock domain of the pixel clock.
[0126] In order to further solve the problem that the image data recovered by the DP receiving end is distorted or even cannot be output normally due to the mismatch of the clock frequency between the DP transmitting end and the DP receiving end, the adjustment unit optionally includes: a calculation module, which is used to calculate the frequency division ratio according to the second line period and the reference clock period in the phase-locked loop; a control module, which is used to control the phase-locked loop to generate a corresponding adjustment clock signal to restore the phase and / or frequency of the output clock according to the frequency division ratio. By calculating the fractional frequency division ratio of the second line period and the reference clock period in the phase-locked loop, and then controlling the PLL to generate the adjustment clock signal to restore the image data according to the fractional frequency division ratio, it is further ensured that the resolution of the recovered image data is basically consistent with that of the transmitting end, and the accuracy and reliability of the recovered image data are further ensured.
[0127] The timing adjustment device includes a processor and a memory, the determination unit, the processing unit, and the adjustment unit are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions. The modules are all located in the same processor; or, the modules are located in different processors in any combination.
[0128] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the problem of distortion or even failure to output the image data restored by the DP receiving end in the prior art can be at least solved by adjusting the kernel parameters.
[0129] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0130] An embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the timing adjustment method.
[0131] Specifically, the timing adjustment method includes:
[0132] Step S201, when receiving a data stream output by a transmitting end of a display interface, determining a first line period according to the data stream, wherein the first line period is a line period of the data stream under an output clock, and the output clock is a clock domain of a receiving end of the display interface;
[0133] Specifically, the line period is the time required to scan a row of pixels, that is, the number of pixels in a row, also called the line length. Driven by the output clock, the receiving end samples the received signal and recovers the pixel clock that matches the clock of the transmitting end, thereby recovering accurate data. Generally, the receiving end samples the received signal at the rising edge or falling edge of the output clock. The clock domain of the receiving end is generally the line clock.
[0134] Step S202, at least using a Kalman filter algorithm to process the first row period to obtain a second row period, where the second row period is a row period of the data stream under a source clock, and the source clock is a clock domain of the transmitting end;
[0135] Specifically, the clock domain of the source clock is generally a main link domain.
[0136] Step S203: adjusting the output clock according to the second row period.
[0137] Optionally, determining the first line period according to the data stream includes: restoring the data stream to obtain image data and the output clock; extracting two adjacent identical blanking markers from the image data, the blanking markers including at least one of a blanking start marker and a blanking end marker; and determining that the clock period of two adjacent identical blanking markers under the output clock is the first line period.
[0138] Optionally, the transmitting end outputs the data stream through at least one link, one of the links corresponds to at least one first FIFO queue and at least one second FIFO queue, and at least a Kalman filter algorithm is used to process the first row cycle to obtain a second row cycle, including: according to the link corresponding to the first row cycle, writing the first row cycle into the first FIFO queue corresponding to the link; when the first FIFO queue is not empty, reading the first row cycle from the first FIFO queue, and inputting the first row cycle into a Kalman filter, so that the Kalman filter outputs a second initial row cycle, the second initial row cycle consisting of the second row cycle and a plurality of decimal data; writing the second initial row cycle into the corresponding second FIFO queue; reading the second initial row cycle from the second FIFO queue, and inputting the second initial row cycle into the Kalman filter for iterative calculation; truncating part of the decimal data of the second initial row cycle and performing superposition processing on the truncated decimal data, generating and sending the second row cycle according to the truncated second initial row cycle and the accumulated error obtained by the superposition processing.
[0139] Optionally, the first line cycle is input into a Kalman filter so that the Kalman filter outputs a second initial line cycle, including: inputting the first line cycle into the Kalman filter so that the Kalman filter predicts a system state based on the first line cycle to obtain the second initial line cycle, wherein the system state is a clock cycle of two adjacent identical blanking markers in the data stream under the source clock, and the blanking marker includes at least one of a blanking start marker and a blanking end marker.
[0140] Optionally, writing the first row cycle into the first FIFO queue corresponding to the link includes: when a first interrupt is triggered, writing the first row cycle into the first FIFO queue corresponding to the link, and ending the first interrupt, the first interrupt carries an interrupt number generated according to the link and the data flow number; reading the second initial row cycle from the second FIFO queue includes: when a second interrupt is triggered, reading the second row cycle from the second FIFO queue according to a predetermined algorithm, and ending the second interrupt, the predetermined algorithm includes one of the following: a round-robin scheduling algorithm, a priority scheduling algorithm, and the second interrupt carries the interrupt number.
[0141] Optionally, the source clock is a row clock or a pixel clock. When the source clock is the row clock, after the first row period is processed by a Kalman filter algorithm to obtain a second row period, the method further includes: performing clock domain conversion on the second row period to obtain a row period of the first row period under the pixel clock. When the source clock is the pixel clock, before the first row period is processed by a Kalman filter algorithm to obtain the second row period, the method further includes: performing clock domain conversion on the first row period to obtain a row period of the first row period under the pixel clock.
[0142] Optionally, the output clock is adjusted according to the second row period, including: calculating a division ratio according to the second row period and a reference clock period in a phase-locked loop; and controlling the phase-locked loop to generate a corresponding adjustment clock signal to restore the phase and / or frequency of the output clock according to the division ratio.
[0143] An embodiment of the present invention provides a processor, which is used to run a program, wherein the timing adjustment method is executed when the program is running.
[0144] An embodiment of the present invention provides a device, the device including a processor, a memory, and a program stored in the memory and executable on the processor, and when the processor executes the program, at least the following steps are implemented:
[0145] Step S201, when receiving a data stream output by a transmitting end of a display interface, determining a first line period according to the data stream, wherein the first line period is a line period of the data stream under an output clock, and the output clock is a clock domain of a receiving end of the display interface;
[0146] Step S202, at least using a Kalman filter algorithm to process the first row period to obtain a second row period, where the second row period is a row period of the data stream under a source clock, and the source clock is a clock domain of the transmitting end;
[0147] Step S203: adjusting the output clock according to the second row period.
[0148] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0149] The device may specifically be a graphics adapter or a docking station including a display interface.
[0150] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing at least the following method steps:
[0151] Step S201, when receiving a data stream output by a transmitting end of a display interface, determining a first line period according to the data stream, wherein the first line period is a line period of the data stream under an output clock, and the output clock is a clock domain of a receiving end of the display interface;
[0152] Step S202, at least using a Kalman filter algorithm to process the first row period to obtain a second row period, where the second row period is a row period of the data stream under a source clock, and the source clock is a clock domain of the transmitting end;
[0153] Step S203: adjusting the output clock according to the second row period.
[0154] Obviously, those skilled in the art should understand that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0155] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0156] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block 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, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0157] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0158] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0159] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0160] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0161] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0162] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0163] From the above description, it can be seen that the embodiments described in this application achieve the following technical effects:
[0164] 1) The timing adjustment method of the present application first determines the first line period of the data stream under the output clock according to the data stream sent by the transmitting end of the display interface; then at least uses the Kalman filter algorithm to process the first line period to obtain the second line period of the data stream under the source clock; finally, adjusts the output clock according to the obtained second line period. Compared with the problem in the prior art that the image data recovered by the DP receiving end is distorted or even cannot be output normally due to the mismatch of the clock frequencies of the DP transmitting end and the DP receiving end, the present application predicts and estimates the second line period according to the first line period, at least uses the Kalman filter algorithm to obtain the second line period that stably reflects the pixel row length of the transmitting end, and then uses the estimated second line period to adjust the output clock, ensuring that the adjusted output clock frequency is basically matched with the source clock frequency, thereby ensuring that the image data recovered according to the adjusted output clock is basically consistent with the original data, avoiding the problem that the recovered image data is distorted or even cannot be output normally.
[0165] 2) The timing adjustment device of the present application determines the first line period of the data stream under the output clock by the determination unit according to the data stream sent by the sending end of the display interface; the processing unit processes the first line period by at least using the Kalman filter algorithm to obtain the second line period of the data stream under the source clock; the adjustment unit adjusts the output clock according to the obtained second line period. Compared with the problem in the prior art that the image data recovered by the DP receiving end is distorted or even cannot be output normally due to the mismatch of the clock frequencies of the DP sending end and the DP receiving end, the present application predicts and estimates the second line period according to the first line period by at least using the Kalman filter algorithm to obtain the second line period that stably reflects the pixel row length of the sending end, and then uses the estimated second line period to adjust the output clock, ensuring that the adjusted output clock frequency is basically matched with the source clock frequency, thereby ensuring that the image data recovered according to the adjusted output clock is basically consistent with the original data, avoiding the problem that the recovered image data is distorted or even cannot be output normally.
[0166] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A timing adjustment method, characterized in that: include: In case of receiving a data stream output by a transmitting end of a display interface, determining a first line period according to the data stream, wherein the first line period is a line period of the data stream under an output clock, and the output clock is a clock domain of a receiving end of the display interface; At least using a Kalman filter algorithm to process the first row period to obtain a second row period, where the second row period is a row period of the data stream under a source clock, and the source clock is a clock domain of the transmitting end; adjusting the output clock according to the second row period, The source clock is a line clock or a pixel clock, In the case where the source clock is the row clock, after the first row period is processed by using a Kalman filter algorithm to obtain a second row period, the method further includes: performing clock domain conversion on the second row period to obtain a row period of the first row period under a pixel clock, When the source clock is the pixel clock, the first line period is processed by a Kalman filter algorithm to obtain a second line period, and the method further includes: performing clock domain conversion on the first line period to obtain a line period of the first line period under the pixel clock.
2. The method according to claim 1, characterized in that Determining a first row period according to the data stream includes: Restoring the data stream to obtain image data and the output clock; Extracting two adjacent identical blanking marks from the image data, wherein the blanking marks include at least one of a blanking start mark and a blanking end mark; A clock period of two adjacent identical blanking marks under the output clock is determined to be the first row period.
3. The method according to claim 1, characterized in that The transmitting end outputs the data stream through at least one link, one of the links corresponds to at least one first FIFO queue and at least one second FIFO queue, and at least a Kalman filter algorithm is used to process the first row cycle to obtain a second row cycle, including: According to the link corresponding to the first row period, writing the first row period into the first FIFO queue corresponding to the link; When the first FIFO queue is not empty, reading the first line period from the first FIFO queue, and inputting the first line period into a Kalman filter, so that the Kalman filter outputs a second initial line period, wherein the second initial line period is composed of the second line period and a plurality of decimal data; Writing the second initial row period into the corresponding second FIFO queue; Reading the second initial row period from the second FIFO queue, and inputting the second initial row period into the Kalman filter for iterative calculation; A portion of the fractional data of the second initial line period is truncated and the truncated fractional data is superimposed, and the second line period is generated and issued according to the truncated second initial line period and the accumulated error obtained by the superimposition process.
4. The method according to claim 3, characterized in that Inputting the first line period into a Kalman filter so that the Kalman filter outputs a second initial line period comprises: The first line cycle is input into the Kalman filter, so that the Kalman filter predicts the system state according to the first line cycle to obtain the second initial line cycle, the system state is the clock cycle of two adjacent identical blanking markers in the data stream under the source clock, and the blanking marker includes at least one of a blanking start marker and a blanking end marker.
5. The method according to claim 3, characterized in that: Writing the first row cycle into the first FIFO queue corresponding to the link comprises: in the case of triggering a first interrupt, writing the first row cycle into the first FIFO queue corresponding to the link and ending the first interrupt, wherein the first interrupt carries an interrupt number generated according to the link and the number of the data flow, Reading the second initial row cycle from the second FIFO queue includes: when the second interrupt is triggered, reading the second row cycle from the second FIFO queue according to a predetermined algorithm, and ending the second interrupt, the predetermined algorithm includes one of the following: a round-robin scheduling algorithm, a priority scheduling algorithm, and the second interrupt carries the interrupt number.
6. The method according to claim 1, characterized in that According to the second row period, adjusting the output clock includes: Calculating a frequency division ratio according to the second row period and a reference clock period in a phase-locked loop; According to the frequency division ratio, the phase-locked loop is controlled to generate a corresponding adjustment clock signal to restore the phase and / or frequency of the output clock.
7. A timing adjustment device, characterized in that: include: a determining unit, configured to determine, upon receiving a data stream output by a transmitting end of a display interface, a first line period according to the data stream, wherein the first line period is a line period of the data stream under an output clock, and the output clock is a clock domain of a receiving end of the display interface; A processing unit, configured to process the first row period by at least using a Kalman filter algorithm to obtain a second row period, where the second row period is a row period of the data stream under a source clock, and the source clock is a clock domain of the transmitting end; an adjusting unit, configured to adjust the output clock according to the second line period, wherein the source clock is a line clock or a pixel clock, The device further includes: a first conversion unit, configured to, when the source clock is the row clock, process the first row period using a Kalman filter algorithm to obtain a second row period, and then perform clock domain conversion on the second row period to obtain a row period of the first row period under the pixel clock, The device also includes: a second conversion unit, which is used to use a Kalman filter algorithm to process the first line period when the source clock is the pixel clock, and before obtaining the second line period, perform clock domain conversion on the first line period to obtain the line period of the first line period under the pixel clock.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 6.
9. An electronic device, characterized in that: include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include methods for executing any one of claims 1 to 6.
Citation Information
Patent Citations
Video clock recovery method and apparatus thereof
CN106341127A
Data conversion and high definition multimedia interface receiving device
US20220124282A1