Picture display method and device, image acquisition control device and storage medium
By continuously displaying the image and calculating the sleep time during the callback thread's sleep period, the problem of high CPU usage caused by incompatibility between the capture card driver and the hardware was solved, and smooth screen display under low CPU usage was achieved.
Patent Information
- Application Number
- CN202310166017.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-24
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2043-02-24
AI Technical Summary
In settings such as hospitals and health check-up centers, existing video display systems suffer from high CPU usage and choppy video playback due to incompatibility between the capture card driver and the hardware.
By continuously displaying the target image while the callback thread enters a sleep state, and by calculating the sleep time to ensure the smoothness of the screen display, the pressure on the capture card driver to wait is reduced.
While the capture card driver is busy waiting, the screen continues to be displayed, reducing CPU usage, improving screen display smoothness, and reducing screen stuttering.
Smart Images

Figure CN116302407B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of display technology, and in particular to a screen display method, apparatus, image acquisition and control device, and storage medium. Background Technology
[0002] Currently, in settings such as hospitals and health check-up centers, the systems used for image display (e.g., ultrasound image reporting systems) often have different manufacturers providing capture cards and capture card drivers, which can lead to incompatibility between the capture card drivers and the hardware.
[0003] In this situation, current display methods or traditional approaches result in a high CPU (Central Processing Unit) usage rate for the displayed image, which can easily lead to choppy playback when the CPU is busy waiting. Summary of the Invention
[0004] Therefore, it is necessary to provide a display method, apparatus, image acquisition and control device, and storage medium that can improve the smoothness of image playback, in response to the above-mentioned technical problems.
[0005] Firstly, this application provides a method for displaying a screen. The method includes:
[0006] In response to acquiring the current target image, a callback thread is invoked; the target image includes the latest frame image in the currently acquired image data; the callback thread is used to display the current target image.
[0007] If the callback thread enters a sleep state, the current target image will continue to be displayed.
[0008] The process continues until the callback thread finishes its sleep and obtains the target image to trigger the next call to the callback thread.
[0009] In one embodiment, the method further includes:
[0010] Determine the sleep time for the thread; the sleep time is obtained based on the current call time of the callback thread and the historical call time of the callback thread.
[0011] In one embodiment, the step of determining the sleep time of a thread includes:
[0012] In response to a call from a callback thread, obtain the current call interval of the callback thread; the current call interval includes the time interval determined based on the time of the last call and the time of the current call;
[0013] The sleep time is determined based on the current call interval and several historical call intervals; the historical call intervals include time intervals determined based on adjacent historical call times.
[0014] In one embodiment, the step of determining the sleep time based on the current call interval and several historical call intervals includes:
[0015] The sleep time is determined based on the current call interval and at least two historical call intervals; wherein each historical call interval and the current call interval are sequentially adjacent call intervals.
[0016] In one embodiment, the step of determining the sleep time based on the current call interval and several historical call intervals includes:
[0017] Get the frame rate of the target image to obtain the current display time of the target image;
[0018] The sleep time is determined based on the display time, the current call interval, and several historical call intervals; the sleep time is less than the display time.
[0019] In one embodiment, the step of determining the sleep time based on the display time, the current call interval, and several historical call intervals includes:
[0020] The average call interval is obtained based on the current call interval and several historical call intervals;
[0021] If the average value is less than the display time, the previous sleep time is increased based on the preset value to determine the current sleep time; where both the previous sleep time and the current sleep time are less than the display time.
[0022] If the average value is greater than the display time, and the difference between the average value and the display time is less than the target threshold, then the previous sleep time is increased based on the preset value to determine the current sleep time.
[0023] If the average value is greater than the display time, and the difference between the average value and the display time is greater than the target threshold, then the previous sleep time is reduced based on the preset value to determine the current sleep time.
[0024] In one embodiment, the step of determining the sleep time of a thread includes:
[0025] In response to a call from a callback thread, obtain the current call interval of the callback thread; the current call interval includes the time interval determined based on the time of the last call and the time of the current call;
[0026] If the current call interval is less than the display time of the current target image, the previous sleep time is increased based on a preset value to determine the current sleep time; the display time is obtained based on the frame rate of the target image being displayed; both the previous sleep time and the current sleep time are less than the display time.
[0027] If the current call interval is greater than the display time, and the difference between the current call interval and the display time is less than the target threshold, then the previous sleep time is increased based on the preset value to determine the current sleep time.
[0028] If the current call interval is greater than the display time, and the difference between the current call interval and the display time is greater than the target threshold, then the previous sleep time is reduced based on the preset value to determine the current sleep time.
[0029] Secondly, this application provides a screen display device. The device includes:
[0030] The thread triggering module is used to trigger the call of the callback thread in response to the acquisition of the current target image; wherein, the target image includes the latest frame image in the currently acquired image data; the callback thread is used to display the current target image;
[0031] The image display module is used to continuously display the current target image when the callback thread enters a sleep state.
[0032] The loop call module is used to sleep until the callback thread finishes and obtains the target image to trigger the next call of the callback thread.
[0033] Thirdly, this application provides an image acquisition control device. The device includes an acquisition card driver for connecting an acquisition card; the acquisition card driver is used to implement the steps of the method described above.
[0034] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.
[0035] The above-mentioned screen display method, apparatus, image acquisition control device, and storage medium, and the screen display method proposed in the embodiments of this application, trigger the call of a callback thread in response to the acquisition of the current target image; wherein, the target image includes the latest frame image in the currently acquired image data; the callback thread is used to display the current target image; when the callback thread enters thread sleep mode, the current target image is continuously displayed; until the callback thread ends thread sleep mode, the target image used to trigger the next call of the callback thread is acquired. The callback thread can be triggered and called repeatedly. By setting the sleep time, it is ensured that the acquired current target image is continuously displayed when the acquisition card driver is busy waiting, which reduces the pressure of the acquisition card driver being busy waiting during the screen display process, improves the smoothness of the screen display, and reduces the occurrence of screen stuttering. Attached Figure Description
[0036] Figure 1 This is a flowchart illustrating a screen display method in one embodiment;
[0037] Figure 2 This is a flowchart comparing the conventional solution and the screen display method of this application in one embodiment;
[0038] Figure 3 This is a flowchart illustrating the screen display steps in one embodiment;
[0039] Figure 4 This is a flowchart illustrating the screen display steps in another embodiment;
[0040] Figure 5 This is a flowchart illustrating the screen display steps in yet another embodiment;
[0041] Figure 6 This is a flowchart illustrating the screen display steps in another embodiment;
[0042] Figure 7 This is a structural block diagram of a screen display device in one embodiment;
[0043] Figure 8 This is an internal structural diagram of an image acquisition control device in one embodiment. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0045] It should be noted that in scenarios such as hospitals and medical examination centers, the systems currently used for image display (e.g., ultrasound image reporting systems) often use different manufacturers (e.g., third-party manufacturers) to provide capture cards and capture card drivers. The upgrade process of capture card drivers is uncontrollable, and some versions of capture card drivers are incompatible with the hardware, causing busy waiting situations when the CPU calls the display screen callback method. The real-time display process consumes up to 25% of the CPU. This application proposes an image display method, device, image acquisition control equipment, and storage medium, which adopts a fault-tolerant design. Even if there are defects such as busy waiting caused by incompatibility between drivers and hardware, the real-time display process can still achieve smooth image playback with a low CPU utilization.
[0046] In one embodiment, such as Figure 1 As shown, a screen display method is provided, the method comprising:
[0047] Step 110: In response to acquiring the current target image, a callback thread is invoked; wherein, the target image includes the latest frame image in the currently acquired image data; the callback thread is used to display the current target image;
[0048] Specifically, if the current target image is acquired, for example, the latest frame from the currently acquired image data, a callback thread can be invoked. This callback thread can be a thread that executes a callback function to display the current target image; for example, it can display the latest frame from the acquired image data. This process triggers the invocation of the callback thread, initiating a loop that displays the currently acquired target image.
[0049] In some examples, the capture card can be initialized and the callback method can be registered before the step of triggering the callback thread in response to acquiring the current target image; the capture card driver can be used to prepare the latest frame of the image to trigger the callback thread invocation and hand over the current thread control to the callback thread.
[0050] Step 120: If the callback thread enters a sleep state, the current target image will be continuously displayed.
[0051] Specifically, after executing the callback method, the callback thread can enter a sleep state. While the callback thread is in sleep mode, it can continuously display the current target image, such as the latest frame from the currently acquired image data. By continuously displaying the current target image while the callback thread is in sleep mode, the CPU usage of the callback thread can be reduced, and smooth playback can be achieved. Furthermore, this avoids frequent calls to the callback method by the capture card, reducing the CPU usage of the callback thread. Moreover, even when the CPU usage is high and the next target image triggering the callback thread cannot be acquired in time, the currently acquired target image can be continuously displayed, improving playback smoothness and reducing stuttering.
[0052] Step 130, until the callback thread finishes its sleep, obtain the target image to trigger the next call of the callback thread.
[0053] Specifically, the current target image is continuously displayed until the callback thread ends and goes to sleep. If the callback thread ends and goes to sleep, the target image required for the next call to the callback thread can be obtained, for example, the latest frame image required for the next call to the callback thread. The target image required for the next call to the callback thread can trigger another call to the callback thread. If the callback thread is called again, it can display the target image required for the next call to the callback thread. Through the above cyclic calling process, the callback thread can continuously display the latest frame image obtained by the capture card driver, regardless of whether it enters sleep mode, thus achieving smooth display of the latest scene.
[0054] In some examples, after the callback thread finishes its sleep, the callback method can transfer current thread control to the acquisition card driver. The acquisition card driver then obtains the target image to trigger the next call to the callback thread. The target image for the next call can be the latest frame from the next batch of acquired image data.
[0055] In some examples, such as Figure 2 The diagram shown is a comparison of the traditional solution and the screen display method of this application. Among them, Figure 2(a) is the traditional screen display scheme. If the capture card driver obtains the latest frame image from the currently captured image data, it directly calls the callback method used for real-time display. The callback method displays the latest frame image, and after the callback thread finishes executing the callback method, it obtains the latest frame image used to trigger the next call to the callback method. In the above traditional screen display scheme, the latest frame image used to trigger the next call to the callback method can only be obtained after the capture card driver finishes its busy-wait period. However, the callback thread has already finished executing the callback method and is preparing to enter the process of displaying the latest image. If the capture card driver is currently busy-waiting, it cannot obtain the latest frame image used to trigger the next call to the callback method, which will cause stuttering in the display. In the above scheme, since the image needs to be displayed at a fixed frame rate, the capture card driver will spend a lot of time performing busy-wait, consuming a lot of CPU resources and reducing the smoothness of the screen playback.
[0056] Furthermore, Figure 2 (b) The screen display method proposed in this application, if the capture card driver obtains the latest frame image from the currently acquired image data, then after calling the callback method used for real-time display, calculates the sleep time of the callback thread executing the callback method, and puts the thread to sleep based on the sleep time after the callback thread finishes executing the callback method; during the thread sleep process, the latest frame image from the currently acquired image data can be continuously displayed; until the sleep ends, the latest frame image used to trigger the next call to the callback method is obtained. Since the display time of each obtained latest frame image includes the internal execution time of the capture card driver and the execution time of the capture card callback method, the execution time of the capture card callback method increases the sleep time of the callback thread compared to the execution time of the callback thread in the traditional solution. The screen display method proposed in this application, by setting the sleep time, can ensure continuous display of the screen even when the capture card driver is busy waiting, thereby reducing the busy waiting time of the capture card driver, alleviating the pressure of busy waiting of the capture card driver during screen display, and improving the smoothness of screen display.
[0057] The screen display method proposed in this application triggers a callback thread in response to acquiring the current target image. The target image includes the latest frame image in the currently acquired image data. The callback thread is used to display the current target image. When the callback thread enters a thread sleep state, the current target image is continuously displayed until the callback thread ends its thread sleep state and acquires the target image used to trigger the next call of the callback thread. The callback thread can be triggered repeatedly. By setting a sleep time, the current target image can be continuously displayed even when the acquisition card driver is busy waiting. This reduces the pressure on the acquisition card driver during screen display, improves the smoothness of screen display, and reduces screen stuttering.
[0058] In one embodiment, the method further includes:
[0059] Determine the sleep time for the thread; the sleep time is obtained based on the current call time of the callback thread and the historical call time of the callback thread.
[0060] Specifically, the sleep time for a thread can be the time required from the moment the callback thread enters sleep mode until it ends. By determining the sleep time, the callback thread can be controlled to exit sleep mode after the specified sleep time. For example, the callback thread can enter sleep mode immediately after executing its callback method, and exit sleep mode after the specified sleep time. After the callback thread exits sleep mode, the target image used to trigger the next call to the callback thread can be obtained. By determining the sleep time in this way, the sleep process of the callback thread can be controlled to ensure that the target image is re-acquired after the callback thread's sleep mode ends, triggering the next call to the callback thread and continuously displaying the target image in a loop.
[0061] In one embodiment, such as Figure 3 As shown, the steps to determine the sleep time of a thread include:
[0062] Step 310: In response to the call of the callback thread, obtain the current call interval of the callback thread; the current call interval includes the time interval determined based on the time of the last call and the current call.
[0063] Step 320: Determine the sleep time based on the current call interval and several historical call intervals; the historical call intervals include time intervals determined based on adjacent historical call times.
[0064] Specifically, in response to a callback thread call, the current call interval of the callback thread can be obtained to determine the sleep time. The current call interval can include the time interval determined by the previous call time and the current call time. By obtaining the previous and current call times of the callback thread, the current call interval can be obtained. Based on the obtained current call interval and several historical call intervals of the callback thread, the sleep time of the thread can be further determined. The historical call intervals can include the time interval determined by adjacent historical call times, where the historical call times are the call times of the callback thread before the current call time. In this way, the current sleep time of the callback thread can be obtained based on the current call interval and several historical call intervals to meet the requirements of smooth playback.
[0065] In some examples, the historical call time includes the last call time of the callback thread, that is, the historical call interval can include the time interval adjacent to the current call interval; the current call interval of the callback thread can be the interval between the last call time and the current call time; the historical call interval of the callback thread can be the interval between two adjacent historical call times.
[0066] In one embodiment, the step of determining the sleep time based on the current call interval and several historical call intervals includes:
[0067] The sleep time is determined based on the current call interval and at least two historical call intervals; wherein each historical call interval and the current call interval are sequentially adjacent call intervals.
[0068] Specifically, the sleep time of the callback thread can be determined based on the current call interval and at least two historical call intervals. For example, the sleep time of the callback thread can be adjusted based on the current call interval and at least two historical call intervals, where each historical call interval and the current call interval are the sequentially adjacent call intervals of the callback thread, so that the sleep time of the callback thread meets the requirements of smooth playback.
[0069] In one embodiment, such as Figure 4 As shown, the steps for determining the sleep time based on the current call interval and several historical call intervals include:
[0070] Step 410: Obtain the frame rate of the target image and get the current display time of the target image;
[0071] Step 420: Determine the sleep time based on the display time, the current call interval, and several historical call intervals; wherein the sleep time is less than the display time.
[0072] Specifically, the frame rate (frames / s) used to display the target image can be obtained, and the current display time of the target image can be obtained based on the frame rate. For example, the display time t_frame used to display the latest frame of the currently acquired image data can be obtained using the following formula:
[0073] tframe = 1000 / rate(ms)
[0074] Furthermore, the sleep time t_sleep of the callback thread can be determined based on the display time t_frame, the current call interval, and several historical call intervals (e.g., at least two historical call intervals, where each historical call interval and the current call interval are sequentially adjacent call intervals), ensuring that the sleep time t_sleep of the callback thread is within a range shorter than the display time t_frame. By using this method, the sleep time of the callback thread can be made to not affect the current frame rate, thus ensuring smooth playback of the target image.
[0075] In some examples, the frame rate (rate) for displaying the target image can be configured via a configuration file. This frame rate is loaded from the configuration file when the display process starts, and remains a fixed value until the display process is closed. The sleep time (t_sleep) of the callback thread can be determined based on the interval (t_call) between the last three calls (including the intervals between two consecutive historical calls and the current call interval).
[0076] In one embodiment, such as Figure 5 As shown, the steps for determining the sleep time based on the display time, the current call interval, and several historical call intervals include:
[0077] Step 510: Based on the current call interval and several historical call intervals, obtain the average call interval.
[0078] Step 520: If the average value is less than the display time, the previous sleep time is increased based on a preset value to determine the current sleep time; wherein both the previous sleep time and the current sleep time are less than the display time.
[0079] Step 530: If the average value is greater than the display time, and the difference between the average value and the display time is less than the target threshold, then the previous sleep time is increased based on the preset value to determine the current sleep time.
[0080] Step 540: If the average value is greater than the display time, and the difference between the average value and the display time is greater than the target threshold, then the previous sleep time is reduced based on the preset value to determine the current sleep time.
[0081] Specifically, several call intervals t_call can be obtained, including the current call interval and several historical call intervals, to obtain the average value of the call intervals t_call. The average value of the call intervals t_call can be the arithmetic mean of the current call interval and several historical call intervals, or it can be a weighted average of the current call interval and several historical call intervals. The weighting coefficient can be a value that increases or decreases sequentially with the call interval time. Furthermore, if the average value of the call intervals t_call is less than the display time t_frame, the previous sleep time can be increased based on a preset value. For example, the preset value can be added to the previous sleep time to determine the current sleep time t_sleep. The size of the preset value can be adjusted according to actual needs. The settings are as follows: Both the previous and current sleep times are less than the display time. If the average call interval (t_call) is greater than the display time (t_frame), and the difference between the average call interval (t_call) and the display time (t_frame) is less than the target threshold, then the previous sleep time is increased based on a preset value. For example, the preset value is added to the previous sleep time to determine the current sleep time (t_sleep), without affecting the current frame rate. If the average call interval (t_call) is greater than the display time (t_frame), and the difference between the average call interval (t_call) and the display time (t_frame) is greater than the target threshold, then the previous sleep time is decreased based on a preset value to determine the current sleep time (t_sleep). By comparing the average value with the display time, and the difference between the average value and the display time with the target threshold, the sleep time can be made to meet the frame rate requirements of the capture card driver, thereby improving the smoothness of video playback.
[0082] In some examples, without historical call intervals, the current call interval can be directly compared with the display time. If the current call interval is less than the display time, the previous sleep time can be increased based on a preset value, for example, by adding a preset value to the previous sleep time to determine the current sleep time t_sleep. Here, both the previous and current sleep times are less than the display time. If the current call interval is greater than the display time, and the difference between the current call interval and the display time is less than a target threshold, the previous sleep time can be increased based on a preset value, for example, by adding a preset value to the previous sleep time to determine the current sleep time t_sleep. If the current call interval is greater than the display time, and the difference between the current call interval and the display time is greater than a target threshold, the previous sleep time can be decreased based on a preset value, for example, by decreasing a preset value to determine the current sleep time t_sleep. Here, the preset value can be 1ms; the target threshold value can also be 1ms.
[0083] In one embodiment, such as Figure 6 As shown, the steps to determine the sleep time of a thread include:
[0084] Step 610: In response to the call of the callback thread, obtain the current call interval of the callback thread; the current call interval includes the time interval determined based on the time of the last call and the time of the current call;
[0085] Step 620: If the current call interval is less than the display time of the current target image, the previous sleep time is increased based on a preset value to determine the current sleep time; wherein, the display time is obtained based on the frame rate of the target image being displayed; both the previous sleep time and the current sleep time are less than the display time.
[0086] Step 630: If the current call interval is greater than the display time, and the difference between the current call interval and the display time is less than the target threshold, then the previous sleep time is increased based on the preset value to determine the current sleep time.
[0087] Step 640: If the current call interval is greater than the display time, and the difference between the current call interval and the display time is greater than the target threshold, then the previous sleep time is reduced based on the preset value to determine the current sleep time.
[0088] Specifically, in response to a callback thread call, the current call interval of the callback thread can be obtained to determine the sleep time. The current call interval of the callback thread can include the time interval determined by the previous call time and the current call time. By obtaining the previous call time and the current call time of the callback thread, the current call interval of the callback thread can be obtained. Based on the obtained current call interval of the callback thread and the current display time of the target image, for example, by comparing the current call interval with the display time, the sleep time of the thread can be further determined. The current display time of the target image can be obtained by obtaining the frame rate of the displayed target image. Since the capture card driver always occupies sufficient time to reach a fixed frame rate, the target call interval will not be significantly less than the display time t_frame. If the current call interval is less than the display time t_frame, a preset value can be added to the previous sleep time to determine the current sleep time t_sleep. If the current call interval is greater than the display time t_frame, and the difference between the current call interval and the display time t_frame is less than the target threshold, a preset value can be added to the previous sleep time to determine the current sleep time t_sleep. If the current call interval is greater than the display time t_frame, and the difference between the current call interval and the display time t_frame is greater than the target threshold, a preset value can be subtracted from the previous sleep time to determine the current sleep time t_sleep. Both the previous sleep time and the determined current sleep time t_sleep are less than the display time t_frame. Using this method, the sleep time of the current callback thread can be obtained based on the current call interval and the display time, improving the accuracy of the sleep time, adapting to the needs of the callback thread in the current loop, and improving the smoothness of video playback.
[0089] In some examples, the preset value can be 1ms; the target threshold value can also be 1ms. If the current call interval is less than the display time t_frame, the current sleep time t_sleep can be determined by adding 1ms to the previous sleep time. If the current call interval is greater than the display time t_frame, and the difference between the current call interval and the display time t_frame is less than 1ms, the current sleep time t_sleep can be determined by adding 1ms to the previous sleep time. If the current call interval is greater than the display time t_frame, and the difference between the current call interval and the display time t_frame is greater than 1ms, the current sleep time t_sleep can be determined by subtracting 1ms from the previous sleep time. Both the previous sleep time and the determined current sleep time t_sleep are less than the display time t_frame.
[0090] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0091] Based on the same inventive concept, this application also provides a screen display device for implementing the screen display method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more screen display device embodiments provided below can be found in the limitations of the screen display method described above, and will not be repeated here.
[0092] In one embodiment, such as Figure 7 As shown, a screen display device is proposed, the device comprising:
[0093] The thread triggering module 710 is used to trigger the call of the callback thread in response to the acquisition of the current target image; wherein, the target image includes the latest frame image in the currently acquired image data; the callback thread is used to display the current target image;
[0094] The image display module 720 is used to continuously display the current target image when the callback thread enters a thread sleep state.
[0095] The loop calls module 730 to sleep until the callback thread finishes and obtains the target image to trigger the next call of the callback thread.
[0096] In one embodiment, the device further includes:
[0097] The sleep time determination module is used to determine the sleep time of a thread; the sleep time is obtained based on the current call time of the callback thread and the historical call time of the callback thread.
[0098] In one embodiment, the sleep time determination module includes:
[0099] The current call interval acquisition unit is used to obtain the current call interval of the callback thread in response to the call of the callback thread; the current call interval includes the time interval determined based on the time of the last call and the time of the current call;
[0100] The sleep time determination unit is used to determine the sleep time based on the current call interval and several historical call intervals; the historical call intervals include time intervals determined based on adjacent historical call times.
[0101] In one embodiment, the sleep time determination unit is further configured to determine the sleep time based on the current call interval and at least two historical call intervals; wherein each historical call interval and the current call interval are sequentially adjacent call intervals.
[0102] In one embodiment, the sleep time determination unit is further configured to:
[0103] Get the frame rate of the target image to obtain the current display time of the target image;
[0104] The sleep time is determined based on the display time, the current call interval, and several historical call intervals; the sleep time is less than the display time.
[0105] In one embodiment, the sleep time determination unit is further configured to:
[0106] The average call interval is obtained based on the current call interval and several historical call intervals;
[0107] If the average value is less than the display time, the previous sleep time is increased based on the preset value to determine the current sleep time; where both the previous sleep time and the current sleep time are less than the display time.
[0108] If the average value is greater than the display time, and the difference between the average value and the display time is less than the target threshold, then the previous sleep time is increased based on the preset value to determine the current sleep time.
[0109] If the average value is greater than the display time, and the difference between the average value and the display time is greater than the target threshold, then the previous sleep time is reduced based on the preset value to determine the current sleep time.
[0110] In one embodiment, the sleep time determination module is further configured to:
[0111] In response to a call from a callback thread, obtain the current call interval of the callback thread; the current call interval includes the time interval determined based on the time of the last call and the time of the current call;
[0112] If the current call interval is less than the display time of the current target image, the previous sleep time is increased based on a preset value to determine the current sleep time; the display time is obtained based on the frame rate of the target image being displayed; both the previous sleep time and the current sleep time are less than the display time.
[0113] If the current call interval is greater than the display time, and the difference between the current call interval and the display time is less than the target threshold, then the previous sleep time is increased based on the preset value to determine the current sleep time.
[0114] If the current call interval is greater than the display time, and the difference between the current call interval and the display time is greater than the target threshold, then the previous sleep time is reduced based on the preset value to determine the current sleep time.
[0115] Each module in the aforementioned display device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0116] In one embodiment, an image acquisition control device is provided, including an acquisition card driver for connecting an acquisition card; the acquisition card driver is used to implement the steps of the method described above.
[0117] In one embodiment, an image acquisition and control device is provided. This image acquisition and control device can be a terminal, and its internal structure diagram can be as follows: Figure 8As shown, the image acquisition and control device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a screen display method. The display unit of the image acquisition and control device forms a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the image acquisition and control device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the housing of the image acquisition and control device, or an external keyboard, touchpad, or mouse, etc.
[0118] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the image acquisition control device to which the present application is applied. The specific image acquisition control device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0119] In one embodiment, a computer-readable storage medium is provided on which a computer program is stored, which, when executed by a processor, implements the steps of the method described above.
[0120] In one embodiment, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the steps of the method described above.
[0121] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0122] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0123] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for displaying a screen, characterized in that, The method includes: In response to acquiring the current target image, a callback thread is invoked; wherein, the target image includes the latest frame image in the currently acquired image data; the callback thread is used to display the current target image; After the callback thread finishes execution, the thread goes to sleep based on the sleep time. If the callback thread enters a sleep state, the current target image will continue to be displayed. The process continues until the callback thread ends its sleep and obtains the target image used to trigger the next call of the callback thread.
2. The method according to claim 1, characterized in that, The method further includes: The sleep time of the thread is determined; the sleep time is obtained based on the current call time of the callback thread and the historical call time of the callback thread.
3. The method according to claim 2, characterized in that, The step of determining the sleep time of the thread includes: In response to the call of the callback thread, the current call interval of the callback thread is obtained; the current call interval includes a time interval determined based on the last call time and the current call time; The sleep time is determined based on the current call interval and several historical call intervals; the historical call intervals include time intervals determined based on adjacent historical call times.
4. The method according to claim 3, characterized in that, The step of determining the sleep time based on the current call interval and several historical call intervals includes: The sleep time is determined based on the current call interval and at least two historical call intervals; wherein each historical call interval and the current call interval are sequentially adjacent call intervals.
5. The method according to claim 3 or 4, characterized in that, The step of determining the sleep time based on the current call interval and several historical call intervals includes: Obtain the frame rate at which the target image is displayed, and thus obtain the current display time of the target image; The sleep time is determined based on the display time, the current call interval, and several historical call intervals; wherein the sleep time is less than the display time.
6. The method according to claim 5, characterized in that, The step of determining the sleep time based on the display time, the current call interval, and several historical call intervals includes: The average call interval is obtained based on the current call interval and several historical call intervals; If the average value is less than the display time, the previous sleep time is increased based on a preset value to determine the current sleep time; wherein both the previous sleep time and the current sleep time are less than the display time. If the average value is greater than the display time, and the difference between the average value and the display time is less than the target threshold, then the previous sleep time is increased based on the preset value to determine the current sleep time. If the average value is greater than the display time, and the difference between the average value and the display time is greater than the target threshold, then the previous sleep time is reduced based on the preset value to determine the current sleep time.
7. The method according to claim 2, characterized in that, The step of determining the sleep time of the thread includes: In response to the call of the callback thread, the current call interval of the callback thread is obtained; the current call interval includes a time interval determined based on the last call time and the current call time; If the current call interval is less than the current display time of the target image, the previous sleep time is increased based on a preset value to determine the current sleep time; wherein, the display time is obtained based on the obtained frame rate of displaying the target image; both the previous sleep time and the current sleep time are less than the display time; If the current call interval is greater than the display time, and the difference between the current call interval and the display time is less than the target threshold, then the previous sleep time is increased based on a preset value to determine the current sleep time. If the current call interval is greater than the display time, and the difference between the current call interval and the display time is greater than the target threshold, then the previous sleep time is reduced based on the preset value to determine the current sleep time.
8. A screen display device, characterized in that, The apparatus for implementing the method according to any one of claims 1 to 7, comprising: A thread triggering module is used to trigger the invocation of a callback thread in response to the acquisition of the current target image; wherein, the target image includes the latest frame image in the currently acquired image data; the callback thread is used to display the current target image; The image display module is used to continuously display the current target image when the callback thread enters a thread sleep state. The loop call module is used to obtain the target image for triggering the next call of the callback thread until the callback thread ends its sleep.
9. An image acquisition control device, comprising an acquisition card driver for connecting an acquisition card; the acquisition card driver is used to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Animation playing method and device
CN103325398A