A graphics rendering processing method and device based on multi-threading

By adopting multi-threading mechanism and GPU rendering in the central monitoring system, the problem of excessive resource occupation by graphics drawing is solved, and the effective release of resources and improvement of system stability are achieved.

CN115456859BActive Publication Date: 2025-09-12SHANGHAI LEPU CLOUDMED CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211174626.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-26
Publication Date
2025-09-12
Estimated Expiration
2042-09-26

AI Technical Summary

Technical Problem

In the existing technology, the graphics drawing plug-in of the central monitoring system occupies a large amount of CPU/memory resources when processing graphics drawing and image rendering, resulting in excessive resource consumption and affecting the normal operation of other functions of the system, especially when the number of monitoring devices or the amount of ECG data is large.

Method used

Three types of asynchronous threads (communication thread, data processing thread and drawing thread) are designed based on the multi-threading mechanism to reduce the continuous occupancy of CPU/memory resources, and a schedulable GPU is used for image rendering. The rendering target object is created through the SharpDX plug-in to handle image rendering work.

Benefits of technology

It effectively reduces the continuous and overall utilization of CPU/memory resources, ensuring the stable operation of the central monitoring system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115456859B_ABST
    Figure CN115456859B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention relate to a multi-threaded graphics rendering processing method and apparatus. The method comprises: obtaining a list of first monitoring devices; creating a first window object, a first device space, a first lead image object, and a first rendering target object; allocating a first communication interface to each first monitoring device; creating a first device cache queue for each first monitoring device; creating a first lead cache queue for each first device lead identifier; creating a first device communication thread for each first monitoring device for data caching; creating a first data processing thread for each first device cache queue to periodically migrate lead cache queue data; and creating a first drawing thread for each first lead image object to periodically acquire lead cache data, draw graphics, render images, and display images. The present invention can effectively free up CPU and memory resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and in particular to a multi-threaded graphics rendering processing method and device. Background Art

[0002] Medical institutions all have central monitoring systems for real-time ECG monitoring. The central monitoring system consists of front-end monitoring devices and back-end central monitoring stations. The front-end monitoring devices send the real-time collected ECG data to the central monitoring station, which then performs waveform drawing and display processing on the received ECG data based on a graphics drawing plug-in. Conventional graphics drawing plug-ins use the central processing unit (CPU) / memory as computing and storage resources by default when processing graphics drawing and image rendering. This processing method will take up a lot of CPU / memory resources, especially image rendering, which takes up the most resources. Under this conventional method, if the number of monitoring devices or the amount of ECG data is large, the CPU / memory resources will be consumed quickly, thereby affecting the normal operation of other functions of the central monitoring station. Summary of the Invention

[0003] The purpose of the present invention is to address the shortcomings of the existing technology and provide a multi-threaded graphics rendering processing method, device, electronic device, and computer-readable storage medium. On the one hand, based on the multi-threading mechanism, three types of asynchronous threads (communication thread, data processing thread, and drawing thread) are designed to reduce the continuous occupancy rate of CPU / memory resources. On the other hand, a SharpDX plug-in that uses a schedulable graphics processing unit (GPU) for image rendering is used to create corresponding rendering target objects to handle image rendering work, thereby effectively releasing CPU / memory resources. Through the present invention, not only can the continuous occupancy rate of CPU / memory resources be reduced, but the overall occupancy rate of CPU / memory resources can also be reduced.

[0004] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present invention provides a multi-threaded graphics rendering processing method, the method comprising:

[0005] Obtain a first monitoring device list; and count the number of first monitoring devices in the first monitoring device list to generate a corresponding first quantity; the first monitoring device list includes a plurality of first monitoring devices; the first monitoring device includes a first lead quantity and a plurality of first device lead identifiers; the first device lead identifiers in the first monitoring device list are non-repeating;

[0006] Create a first window object; allocate a window space as a corresponding first device space for each first monitoring device on the first window object; create an image object according to the corresponding first lead quantity on each first device space to obtain the first lead image objects; create a corresponding SharpDX rendering target object for each first lead image object, recorded as a first rendering target object; and allocate a corresponding first device lead identifier to each first lead image object;

[0007] Allocate a data communication interface to each first monitoring device as a corresponding first communication interface; create a data cache queue for each first monitoring device as a corresponding first device cache queue; and create a data cache queue for each first device lead identifier as a corresponding first lead cache queue;

[0008] Creating a thread object for each first monitoring device as a corresponding first device communication thread and running the thread; the first device communication thread is used to cache the multi-lead ECG data sent by the first monitoring device;

[0009] Creating a thread object as a corresponding first data processing thread for each first device cache queue, setting a sleep duration of the first data processing thread to a preset first duration, and running the first data processing thread; the first data processing thread is used to periodically perform lead cache queue data migration processing on the corresponding first device cache queue;

[0010] A thread object is created for each first lead image object as a corresponding first drawing thread and runs, and a sleep duration of the first drawing thread is set to a preset second duration, and the first drawing thread is run; the first drawing thread is used to periodically perform lead cache data acquisition, graphics drawing, image rendering, and image display processing according to the corresponding first lead cache queue, the first rendering target object, and the first lead image object.

[0011] Preferably, the multi-lead ECG data includes a plurality of single-lead ECG data; the single-lead ECG data includes the first device lead identifier and the first lead ECG data.

[0012] Preferably, the first device communication thread is used to perform data caching processing on the multi-lead ECG data sent by the first monitoring device, specifically including:

[0013] When the first device communication thread is running, it continuously listens to the first communication interface corresponding to itself; once the first communication interface completes data reception, it uses the received data as the corresponding multi-lead ECG data; and adds the multi-lead ECG data to the corresponding first device cache queue.

[0014] Preferably, the first data processing thread is used to periodically perform lead cache queue data migration processing on the corresponding first device cache queue, specifically including:

[0015] When the first data processing thread is running, the first device cache queue is periodically used as the current device cache queue according to the set sleep time; and the number of the multi-lead ECG data in the current device cache queue is counted to generate a corresponding second number;

[0016] If the second number exceeds a preset first number threshold, extracting a first extracted number of the multi-lead ECG data with the earliest time from the current device cache queue to form a corresponding first multi-lead ECG data sequence; if the second number does not exceed the first number threshold but exceeds a preset second number threshold, extracting a second extracted number of the multi-lead ECG data with the earliest time from the current device cache queue to form a corresponding first multi-lead ECG data sequence; if the second number does not exceed the second number threshold, extracting a third extracted number of the multi-lead ECG data with the earliest time from the current device cache queue to form a corresponding first multi-lead ECG data sequence; the first extracted number is greater than the second extracted number, and the second extracted number is greater than the third extracted number;

[0017] And traverse each of the multi-lead ECG data in the first multi-lead ECG data sequence, and add the first lead ECG data of each single-lead ECG data of the currently traversed multi-lead ECG data to the corresponding first lead cache queue during the traversal; and remove each of the multi-lead ECG data in the first multi-lead ECG data sequence from the current device cache queue at the end of the traversal.

[0018] Preferably, the first drawing thread is used to periodically perform lead buffer data acquisition, graphics drawing, image rendering, and image display processing according to the corresponding first lead buffer queue, the first rendering target object, and the first lead image object, specifically including:

[0019] When the first drawing thread is running, the corresponding first lead cache queue is periodically used as the current lead cache queue according to the set sleep time;

[0020] Extract the first lead ECG data with the earliest time in the current lead cache queue one by one as the current lead ECG data; and when the current lead ECG data is not empty, perform two-dimensional waveform graphics drawing processing on the current lead ECG data to generate a corresponding first graphic; and perform bitmap conversion processing on the first graphic to generate a corresponding first bitmap; and send the first bitmap to the corresponding first rendering target object, call the GPU processor resources through the first rendering target object to perform image rendering processing to generate a corresponding first rendered image; and use the first rendered image as the display image of the corresponding first lead image for image display processing; and remove the current lead ECG data from the current lead cache queue when the image display processing is successful.

[0021] A second aspect of the embodiments of the present invention provides a device for implementing the method described in the first aspect, the device comprising: an acquisition module, an interface processing module, a queue processing module, a first thread processing module, a second thread processing module, and a third thread processing module;

[0022] The acquisition module is used to obtain a first monitoring device list; and to count the number of first monitoring devices in the first monitoring device list to generate a corresponding first number; the first monitoring device list includes a plurality of first monitoring devices; the first monitoring device includes a first lead number and a plurality of first device lead identifiers; the first device lead identifiers in the first monitoring device list are non-repeating;

[0023] The interface processing module is used to create a first window object; allocate a window space as a corresponding first device space for each first monitoring device on the first window object; create an image object according to the corresponding first lead quantity on each first device space to obtain the first lead image objects of the first lead quantity; create a corresponding SharpDX rendering target object for each first lead image object and record it as a first rendering target object; and allocate a corresponding first device lead identifier to each first lead image object;

[0024] The queue processing module is used to allocate a data communication interface to each first monitoring device as a corresponding first communication interface; create a data cache queue for each first monitoring device as a corresponding first device cache queue; and create a data cache queue for each first device lead identifier as a corresponding first lead cache queue;

[0025] The first thread processing module is used to create a thread object for each first monitoring device as a corresponding first device communication thread and run it; the first device communication thread is used to perform data caching processing on the multi-lead ECG data sent by the first monitoring device;

[0026] The second thread processing module is configured to create a thread object as a corresponding first data processing thread for each first device cache queue, set a sleep duration of the first data processing thread to a preset first duration, and run the first data processing thread; the first data processing thread is configured to periodically perform lead cache queue data migration processing on the corresponding first device cache queue;

[0027] The third thread processing module is used to create a thread object as a corresponding first drawing thread for each first lead image object and run it, set the sleep duration of the first drawing thread to a preset second duration, and run the first drawing thread; the first drawing thread is used to regularly perform lead cache data acquisition, graphics drawing, image rendering and image display processing according to the corresponding first lead cache queue, the first rendering target object and the first lead image object.

[0028] A third aspect of an embodiment of the present invention provides an electronic device, including: a memory, a processor, and a transceiver;

[0029] The processor is configured to be coupled to the memory, read and execute instructions in the memory, so as to implement the method steps described in the first aspect above;

[0030] The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

[0031] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed by a computer, the computer executes the instructions of the method described in the first aspect above.

[0032] Embodiments of the present invention provide a multi-threaded graphics rendering processing method, apparatus, electronic device, and computer-readable storage medium. Firstly, based on the multi-threading mechanism, three types of asynchronous threads (communication thread, data processing thread, and drawing thread) are designed to reduce the sustained occupancy of CPU / memory resources. Secondly, a SharpDX plug-in capable of scheduling GPU-based image rendering is used to create corresponding rendering target objects to handle image rendering tasks, thereby effectively freeing up CPU / memory resources. This invention not only reduces the sustained occupancy of CPU / memory resources, but also reduces the overall occupancy of CPU / memory resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 A schematic diagram of a multi-threaded graphics rendering method according to a first embodiment of the present invention;

[0034] Figure 2 A module structure diagram of a multi-threaded graphics rendering processing device provided in the second embodiment of the present invention;

[0035] Figure 3 This is a structural diagram of an electronic device provided in Example 3 of the present invention. DETAILED DESCRIPTION

[0036] To make the objectives, technical solutions, and advantages of the present invention more apparent, the present invention will be further described in detail below with reference to the accompanying drawings. It should be understood that the embodiments described herein are merely some, rather than all, of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without inventive effort are intended to fall within the scope of protection of the present invention.

[0037] The graphics drawing function of the central monitoring station is modified based on a multi-threaded graphics drawing processing method provided in the first embodiment of the present invention. The modified central monitoring station can, on the one hand, reduce the continuous occupancy rate of CPU / memory resources based on three types of asynchronous threads (communication thread, data processing thread, and drawing thread), and on the other hand, effectively release CPU / memory resources based on SharpDX rendering target objects. Figure 1 A schematic diagram of a multi-threaded graphics rendering method provided in the first embodiment of the present invention is shown in FIG. Figure 1 As shown, this method mainly includes the following steps:

[0038] Step 1: Obtain a first monitoring device list; and count the number of first monitoring devices in the first monitoring device list to generate a corresponding first number;

[0039] The first monitoring device list includes multiple first monitoring devices; the first monitoring devices include a first lead quantity and multiple first device lead identifiers; and the first device lead identifiers in the first monitoring device list are not repeated.

[0040] Here, the first monitoring device list is an information list of all monitoring devices connected to the central monitoring station; the number of first leads is the total number of leads of the first monitoring device; the number of first device lead identifiers of each first monitoring device is the same as the number of first leads; the first device lead identifier includes the monitoring device identifier and the lead identifier. Since the device identifier of each device is unique, the first device lead identifiers in the first monitoring device list are not repeated.

[0041] Step 2: Create a first form object; allocate a form space as the corresponding first device space for each first monitoring device on the first form object; create an image object according to the corresponding first lead quantity on each first device space to obtain the first lead quantity of first lead image objects; create a corresponding SharpDX rendering target object for each first lead image object and record it as the first rendering target object; and allocate a corresponding first device lead identifier to each first lead image object.

[0042] Here, the central monitoring station of the embodiment of the present invention can use a client program or a WEB method to realize the creation of the monitoring interface, and the first window object is the data object corresponding to the monitoring interface; if the central monitoring station uses a client program to realize the monitoring interface, then the first window object is a window object by default, such as a Winform object under the Windows operating system; if the central monitoring station uses a WEB method to realize the monitoring interface, then the first window object is a page object by default; no matter whether it is a window object or a page object, space can be divided on it according to their respective sizes to obtain multiple window spaces, namely the first device space; no matter whether it is a window object or a page object, space can be divided on it according to their respective sizes to obtain multiple window spaces, namely the first device space; Surface objects can be used to place and layout other objects on them, so the embodiment of the present invention creates an equal number of image objects, namely, first lead image objects, according to the number of first leads of the first monitoring device corresponding to each first device space, and arranges these multiple first lead image objects in a pre-set arrangement order on each first device space, and assigns a corresponding first device lead identifier to each first lead image object; in order to subsequently process the image rendering work of each first lead image object, the embodiment of the present invention also pre-assigns a rendering target object created based on the SharpDX plug-in, namely, a first rendering target object, to each first lead image object.

[0043] To sum up, the current step is actually processing the initialization operation of the monitoring interface. Each first device space on the monitoring interface corresponds to a first monitoring device, and each visible first lead image object in the first device space corresponds to a single-lead ECG waveform image on the monitoring device.

[0044] Step 3: allocate a data communication interface to each first monitoring device as the corresponding first communication interface; create a data cache queue for each first monitoring device as the corresponding first device cache queue; and create a data cache queue for each first device lead identifier as the corresponding first lead cache queue.

[0045] Here, the first communication interface is the data interface port corresponding to each first monitoring device; each first device cache queue corresponds to a first monitoring device, and the first device cache queue is used to cache the data sent by the first monitoring device, and the first device cache queue is managed using a first-in-first-out queue management method; each first lead cache queue corresponds to a single lead of a first monitoring device, and the first lead cache queue is used to perform secondary caching on the single lead data matched in the first device cache queue, and the first lead cache queue is also managed using a first-in-first-out queue management method.

[0046] Step 4: Create a thread object for each first monitoring device as the corresponding first device communication thread and run it;

[0047] The first device communication thread is used to cache the multi-lead ECG data sent by the first monitoring device, specifically including: when the first device communication thread is running, continuously listening to the first communication interface corresponding to itself; once the first communication interface completes a data reception, the received data is used as the corresponding multi-lead ECG data; and the multi-lead ECG data is added to the corresponding first device cache queue;

[0048] The multi-lead ECG data includes multiple single-lead ECG data; the single-lead ECG data includes a first device lead identifier and first lead ECG data.

[0049] Here, the data sent by the first monitoring device each time is multi-lead ECG data, which includes multiple single-lead device lead identifiers and real-time ECG data, namely single-lead ECG data. The first device lead identifier in each single-lead ECG data is consistent with the first monitoring device list, and the first lead ECG data is the real-time ECG data of the corresponding single lead.

[0050] Here, before creating a thread object for each first monitoring device, the embodiment of the present invention pre-defines a device communication thread class based on the standard thread class and reconstructs the running part of the device communication thread class. During the reconstruction, two object handles or pointers are assigned to it: the handle or pointer of the communication interface and the device cache queue, so that it can listen to data based on the specified communication interface and store the received data of the communication interface into the specified device cache queue. Based on the device communication thread class, when creating a thread object as the corresponding first device communication thread for each first monitoring device, it is only necessary to create a corresponding device communication thread class object instance, and assign the corresponding first communication interface and first device cache queue handle or pointer to each first device communication thread. The first device communication thread of the embodiment of the present invention is actually used to solve the problem of caching the uplink data of the corresponding first monitoring device based on the first device cache queue.

[0051] Step 5: Create a thread object for each first device cache queue as the corresponding first data processing thread, set the sleep duration of the first data processing thread to a preset first duration, and run the first data processing thread;

[0052] Here, before creating a thread object for each first device cache queue, the embodiment of the present invention pre-defines a data processing thread class based on the standard thread class and reconstructs the running part of the data processing thread class; during the reconstruction, a sleep duration, namely a first duration, is set for it. The first duration is an adjustable empirical value, and multiple object handles or pointers are allocated to it: handles or pointers to the device cache queue and multiple lead cache queues, so that it can regularly read a specified number of first-lead ECG data from the specified device cache queue and add them to the specified lead cache queues, and remove the read data from the specified device cache queue. The detailed processing steps can be seen below; based on the data processing thread class, when creating a thread object for each first device cache queue as the corresponding first data processing thread, it is only necessary to create a corresponding data processing thread class object instance, and allocate the corresponding first device cache queue handle or pointer and the corresponding multiple first lead cache queue handles or pointers to each first data processing thread; the first data processing thread of the embodiment of the present invention is actually used to handle the secondary caching problem of the first-lead ECG data in the first lead cache queue;

[0053] The first data processing thread is used to periodically perform lead cache queue data migration processing on the corresponding first device cache queue, specifically including:

[0054] Step A1: When the first data processing thread is running, the corresponding first device cache queue is periodically used as the current device cache queue according to the set sleep time; and the number of multi-lead ECG data in the current device cache queue is counted to generate a corresponding second number;

[0055] Here, the set sleep duration is the first duration, which is generally set through the thread's sleep method; for a thread with a set sleep duration, it means that the current thread will be run once every first duration;

[0056] Step A2: If the second number exceeds the preset first number threshold, extracting the first number of multi-lead ECG data with the earliest time from the current device cache queue to form a corresponding first multi-lead ECG data sequence; if the second number does not exceed the first number threshold but exceeds the preset second number threshold, extracting the second number of multi-lead ECG data with the earliest time from the current device cache queue to form a corresponding first multi-lead ECG data sequence; if the second number does not exceed the second number threshold, extracting the third number of multi-lead ECG data with the earliest time from the current device cache queue to form a corresponding first multi-lead ECG data sequence;

[0057] wherein the first extraction quantity is greater than the second extraction quantity, and the second extraction quantity is greater than the third extraction quantity;

[0058] Here, the first data processing thread of the embodiment of the present invention adopts a dynamic migration processing method to process data migration from the first device cache queue to the first lead cache queue; the principle is that if the data volume (second quantity) in the first device cache queue is too large and exceeds the maximum threshold (first quantity threshold), then the maximum data volume (first extraction quantity) is used for data extraction from the first device cache queue; if the data volume (second quantity) in the first device cache queue is medium (between the first quantity threshold and the second quantity threshold), then the medium data volume (second extraction quantity) is used for data extraction from the first device cache queue; if the data volume (second quantity) in the first device cache queue is small and does not exceed the minimum threshold (second quantity threshold), then the medium data volume (third extraction quantity) is used for data extraction from the first device cache queue; the extracted data sequence is the first multi-lead ECG data sequence;

[0059] Step A3, and traverse each multi-lead ECG data of the first multi-lead ECG data sequence, and add the first lead ECG data of each single-lead ECG data of the currently traversed multi-lead ECG data to the corresponding first lead cache queue; and at the end of the traversal, remove each multi-lead ECG data in the first multi-lead ECG data sequence from the current device cache queue.

[0060] Here, the traversal order is based on the chronological order, that is, the multi-lead ECG data with the earliest time is processed first, and the multi-lead ECG data with the latest time is processed last, so that the first-in-first-out characteristic in the first lead cache queue can be satisfied; at the end of the traversal, each multi-lead ECG data in the first multi-lead ECG data sequence needs to be removed from the current device cache queue, so that the resources of the read data in the first device cache queue can be effectively released; after completing the removal of the queue data, the embodiment of the present invention will end the current thread operation and enter a dormant state, and will not automatically start to run again until the first time period has passed; in addition, it should be noted that if the first multi-lead ECG data sequence obtained in step A2 is empty, it means that there is no new monitoring data in the current device cache queue and no corresponding data migration operation is required. At this time, the embodiment of the present invention will immediately end the current thread operation and enter a dormant state, and will not automatically start to run again until the first time period has passed.

[0061] Step 6: Create a thread object for each first-lead image object as the corresponding first drawing thread and run it, set the sleep time of the first drawing thread to a preset second time, and run the first drawing thread;

[0062] Here, before creating a thread object for each first-lead image object, the embodiment of the present invention pre-defines a drawing thread class based on the standard thread class and reconstructs the running part of the drawing thread class; during the reconstruction, a sleep duration, i.e., a second duration, is set for the drawing thread class, which is an empirical value that can be modulated, and three object handles or pointers are allocated to the drawing thread class: a lead cache queue, a rendering target object, and a handle or pointer to an image object, so that the drawing thread class can periodically read the first-lead ECG data one by one from the specified lead cache queue to perform graphic drawing processing to generate a corresponding drawing graphic object, perform bitmap conversion processing on the drawing graphic object to generate a corresponding bitmap object, and send the bitmap object to the corresponding rendering target object through The rendering target object invokes GPU processor resources to perform image rendering processing to generate a corresponding rendered image object, uses the rendered image object as the display image of the corresponding image object for image display processing, and removes read data from the specified lead buffer queue. Detailed processing steps are described below. Based on the drawing thread class, when creating a thread object as the corresponding first drawing thread for each first lead image object, it is sufficient to simply create a corresponding drawing thread class object instance, and allocate a corresponding first lead buffer queue, first rendering target object, and first image object handle or pointer to each first drawing thread. The first drawing thread in this embodiment of the present invention is actually used to process the ECG waveform display problem of each first image object.

[0063] The first drawing thread is used to periodically perform lead buffer data acquisition, graphics drawing, image rendering, and image display processing according to the corresponding first lead buffer queue, first rendering target object, and first lead image object, specifically including:

[0064] Step B1: when the first drawing thread is running, the corresponding first lead cache queue is periodically used as the current lead cache queue according to the set sleep time;

[0065] Here, the set sleep duration is the second duration, which is generally set through the thread's sleep method; for a thread with a set sleep duration, it means that the current thread will be run once every second duration;

[0066] Step B2, extract the earliest first-lead ECG data in the current lead cache queue one by one as the current lead ECG data; and when the current lead ECG data is not empty, perform two-dimensional waveform graphics drawing processing based on the current lead ECG data to generate a corresponding first graphic; and perform bitmap conversion processing on the first graphic to generate a corresponding first bitmap; and send the first bitmap to the corresponding first rendering target object, call the GPU processor resources through the first rendering target object to perform image rendering processing to generate a corresponding first rendered image; and use the first rendered image as the display image of the corresponding first lead image for image display processing; and remove the current lead ECG data from the current lead cache queue when the image display processing is successful.

[0067] Here, if the current lead ECG data is empty, it means that there is no new monitoring data in the current lead cache queue and the corresponding ECG waveform drawing is not required. At this time, the embodiment of the present invention will immediately end the current thread and enter the dormant state, and will not automatically start running again until the second time period has passed;

[0068] If the current lead ECG data is not empty, it means that new monitoring data has arrived in the current lead cache queue and corresponding graphics drawing, image rendering and image display are required. In order to utilize the SharpDX rendering target object, i.e., the first rendering target object, to process image rendering through the GPU to achieve the purpose of releasing CPU / memory resources, the embodiment of the present invention specifically divides the drawing of the ECG waveform and the rendering of the drawn graphics into two implementation steps. First, the conventional ECG waveform drawing method is used to perform two-dimensional waveform graphics drawing processing according to the current lead ECG data, and then the drawn graphics are transferred to the first rendering target object for image rendering processing. The former of these two steps is implemented based on CPU / memory resources, and the latter is implemented through GPU resources. In this way, CPU / memory resources are released during image rendering. The above-mentioned processing process of performing two-dimensional waveform graphics drawing processing according to the current lead ECG data will be implemented by the conventional ECG waveform drawing method according to the embodiment of the present invention. The relevant implementation method can be obtained by querying the publicly available technical implementation, which will not be described one by one here. The above-mentioned processing process based on the first rendering target The target object calls the GPU resources through the hardware mode to render the loaded image, that is, the first bitmap is sent to the corresponding first rendering target object, and the first rendering target object calls the GPU processor resources for image rendering processing to generate the corresponding first rendered image. The implementation method can also be obtained by querying the technical implementation disclosed by the SharpDX component, which will not be described one by one here; it should be noted that the first graphic generated by the conventional ECG waveform drawing method is not a bitmap, but may be a graphic vector, and the loaded image of the first rendering target object needs to be a bitmap image. Therefore, the embodiment of the present invention adds an operation step between graphic drawing and image rendering, that is, bitmap conversion processing is performed on the first graphic to generate the corresponding first bitmap, and the output of the graphic drawing, that is, the first graphic, is converted into a bitmap format to obtain the bitmap image required for image rendering input, that is, the first bitmap; after completing the image display and queue data removal, the embodiment of the present invention will end the current thread operation and enter a dormant state, and will not automatically start to run again until after the second time period.

[0069] Figure 2 This is a module structure diagram of a multi-threaded graphics rendering processing device provided in the second embodiment of the present invention. The device can be a terminal device or server that implements the method of the embodiment of the present invention, or a device that implements the method of the embodiment of the present invention connected to the above terminal device or server. For example, the device can be a device or chip system of the above terminal device or server. Figure 2 As shown, the multi-threaded graphics rendering processing device includes: an acquisition module 201, an interface processing module 202, a queue processing module 203, a first thread processing module 204, a second thread processing module 205 and a third thread processing module 206.

[0070] The acquisition module 201 is used to obtain a first monitoring device list; and to count the number of first monitoring devices in the first monitoring device list to generate a corresponding first quantity; the first monitoring device list includes multiple first monitoring devices; the first monitoring device includes a first lead quantity and multiple first device lead identifiers; the first device lead identifiers in the first monitoring device list are not repeated.

[0071] The interface processing module 202 is used to create a first form object; and allocate a form space as the corresponding first device space for each first monitoring device on the first form object; and create an image object according to the corresponding first lead quantity on each first device space to obtain the first lead quantity of first lead image objects; and create a corresponding SharpDX rendering target object for each first lead image object and record it as the first rendering target object; and allocate a corresponding first device lead identifier to each first lead image object.

[0072] The queue processing module 203 is used to allocate a data communication interface to each first monitoring device as the corresponding first communication interface; create a data cache queue for each first monitoring device as the corresponding first device cache queue; and create a data cache queue for each first device lead identifier as the corresponding first lead cache queue.

[0073] The first thread processing module 204 is used to create a thread object for each first monitoring device as a corresponding first device communication thread and run it; the first device communication thread is used to perform data caching processing on the multi-lead ECG data sent by the first monitoring device.

[0074] The second thread processing module 205 is used to create a thread object as the corresponding first data processing thread for each first device cache queue, set the sleep duration of the first data processing thread to a preset first duration, and run the first data processing thread; the first data processing thread is used to regularly perform lead cache queue data migration processing on the corresponding first device cache queue.

[0075] The third thread processing module 206 is used to create a thread object as a corresponding first drawing thread for each first lead image object and run it, set the sleep duration of the first drawing thread to a preset second duration, and run the first drawing thread; the first drawing thread is used to periodically perform lead cache data acquisition, graphics drawing, image rendering and image display processing according to the corresponding first lead cache queue, first rendering target object and first lead image object.

[0076] An embodiment of the present invention provides a multi-threaded graphics rendering processing device that can execute the method steps in the above method embodiment. Its implementation principles and technical effects are similar and will not be described in detail here.

[0077] It should be noted that it should be understood that the division of the various modules of the above device is merely a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. Moreover, these modules can all be implemented in the form of software called by a processing element; or they can all be implemented in the form of hardware; or some modules can be implemented in the form of software called by a processing element, and some modules can be implemented in the form of hardware. For example, the startup module can be a separately established processing element, or it can be integrated into a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called by a processing element of the above device to execute the functions of the above-mentioned determined module. The implementation of other modules is similar. In addition, these modules can all or partly be integrated together, or they can be implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each of the above modules can be completed by the hardware integrated logic circuit in the processor element or by instructions in the form of software.

[0078] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application-specific integrated circuits (ASICs), one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs). For another example, when a module is implemented by scheduling program code through a processing element, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0079] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in accordance with the embodiment of the present invention is generated in whole or in part. The above-mentioned computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The above-mentioned computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the above-mentioned computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, Bluetooth, microwave, etc.) mode. The above-mentioned computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state disks (SSDs)).

[0080] Figure 3 This is a schematic diagram of the structure of an electronic device provided in the third embodiment of the present invention. The electronic device may be the aforementioned terminal device or server, or may be a terminal device or server connected to the aforementioned terminal device or server to implement the method of the embodiment of the present invention. Figure 3 As shown, the electronic device may include: a processor 301 (such as a CPU), a memory 302, and a transceiver 303; the transceiver 303 is coupled to the processor 301, and the processor 301 controls the transceiver 303's transceiver actions. Various instructions may be stored in the memory 302 for performing various processing functions and implementing the methods and processing procedures provided in the above embodiments of the present invention. Preferably, the electronic device involved in the embodiment of the present invention further includes: a power supply 304, a system bus 305, and a communication port 306. The system bus 305 is used to realize communication connections between components. The above-mentioned communication port 306 is used for connecting and communicating between the electronic device and other peripheral devices.

[0081] exist Figure 3The system bus mentioned in the figure can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface is used to realize communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory (Non-Volatile Memory), such as at least one disk storage.

[0082] The above-mentioned processor can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0083] It should be noted that an embodiment of the present invention further provides a computer-readable storage medium, which stores instructions. When the storage medium is run on a computer, it enables the computer to execute the methods and processing procedures provided in the above embodiments.

[0084] An embodiment of the present invention further provides a chip for executing instructions, which is used to execute the methods and processing procedures provided in the above embodiments.

[0085] Embodiments of the present invention provide a multithreaded graphics rendering processing method, apparatus, electronic device, and computer-readable storage medium. Firstly, based on the multithreading mechanism, three types of asynchronous threads (communication thread, data processing thread, and drawing thread) are designed to reduce the sustained occupancy of CPU / memory resources. Secondly, a SharpDX plug-in capable of scheduling GPU-based image rendering is used to create corresponding rendering target objects to handle image rendering tasks, thereby effectively freeing up CPU / memory resources. This invention not only reduces the sustained occupancy of CPU / memory resources, but also reduces the overall occupancy of CPU / memory resources.

[0086] Professionals should also be further aware that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0087] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0088] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A graphics rendering processing method based on multithreading, characterized in that: The method comprises: Obtain a first monitoring device list; and count the number of first monitoring devices in the first monitoring device list to generate a corresponding first quantity; the first monitoring device list includes a plurality of first monitoring devices; the first monitoring device includes a first lead quantity and a plurality of first device lead identifiers; the first device lead identifiers in the first monitoring device list are non-repeating; Create a first window object; allocate a window space as a corresponding first device space for each first monitoring device on the first window object; create an image object according to the corresponding first lead quantity on each first device space to obtain the first lead image objects; create a corresponding SharpDX rendering target object for each first lead image object, recorded as a first rendering target object; and allocate a corresponding first device lead identifier to each first lead image object; Allocate a data communication interface to each first monitoring device as a corresponding first communication interface; create a data cache queue for each first monitoring device as a corresponding first device cache queue; and create a data cache queue for each first device lead identifier as a corresponding first lead cache queue; Creating a thread object for each first monitoring device as a corresponding first device communication thread and running the thread; the first device communication thread is used to cache the multi-lead ECG data sent by the first monitoring device; Creating a thread object as a corresponding first data processing thread for each first device cache queue, setting a sleep duration of the first data processing thread to a preset first duration, and running the first data processing thread; the first data processing thread is used to periodically perform lead cache queue data migration processing on the corresponding first device cache queue; A thread object is created for each first lead image object as a corresponding first drawing thread and runs, and a sleep duration of the first drawing thread is set to a preset second duration, and the first drawing thread is run; the first drawing thread is used to periodically perform lead cache data acquisition, graphics drawing, image rendering, and image display processing according to the corresponding first lead cache queue, the first rendering target object, and the first lead image object.

2. The multi-threaded graphics rendering method according to claim 1, wherein: The multi-lead ECG data includes a plurality of single-lead ECG data; the single-lead ECG data includes the first device lead identifier and the first lead ECG data.

3. The multi-threaded graphics rendering method according to claim 2, wherein: The first device communication thread is used to perform data caching processing on the multi-lead ECG data sent by the first monitoring device, specifically including: When the first device communication thread is running, it continuously listens to the first communication interface corresponding to itself; once the first communication interface completes data reception, it uses the received data as the corresponding multi-lead ECG data; and adds the multi-lead ECG data to the corresponding first device cache queue.

4. The multi-threaded graphics rendering method according to claim 2, wherein: The first data processing thread is used to periodically perform lead cache queue data migration processing on the corresponding first device cache queue, specifically including: When the first data processing thread is running, the first device cache queue is periodically used as the current device cache queue according to the set sleep time; and the number of the multi-lead ECG data in the current device cache queue is counted to generate a corresponding second number; If the second number exceeds a preset first number threshold, extracting a first extracted number of the multi-lead ECG data with the earliest time from the current device cache queue to form a corresponding first multi-lead ECG data sequence; if the second number does not exceed the first number threshold but exceeds a preset second number threshold, extracting a second extracted number of the multi-lead ECG data with the earliest time from the current device cache queue to form a corresponding first multi-lead ECG data sequence; if the second number does not exceed the second number threshold, extracting a third extracted number of the multi-lead ECG data with the earliest time from the current device cache queue to form a corresponding first multi-lead ECG data sequence; the first extracted number is greater than the second extracted number, and the second extracted number is greater than the third extracted number; And traverse each of the multi-lead ECG data in the first multi-lead ECG data sequence, and add the first lead ECG data of each single-lead ECG data of the currently traversed multi-lead ECG data to the corresponding first lead cache queue during the traversal; and remove each of the multi-lead ECG data in the first multi-lead ECG data sequence from the current device cache queue at the end of the traversal.

5. The multi-threaded graphics rendering method according to claim 2, wherein: The first drawing thread is used to periodically perform lead buffer data acquisition, graphics drawing, image rendering, and image display processing according to the corresponding first lead buffer queue, the first rendering target object, and the first lead image object, specifically including: When the first drawing thread is running, the corresponding first lead cache queue is periodically used as the current lead cache queue according to the set sleep time; Extract the first lead ECG data with the earliest time in the current lead cache queue one by one as the current lead ECG data; and when the current lead ECG data is not empty, perform two-dimensional waveform graphics drawing processing on the current lead ECG data to generate a corresponding first graphic; and perform bitmap conversion processing on the first graphic to generate a corresponding first bitmap; and send the first bitmap to the corresponding first rendering target object, call the GPU processor resources through the first rendering target object to perform image rendering processing to generate a corresponding first rendered image; and use the first rendered image as the display image of the corresponding first lead image for image display processing; and remove the current lead ECG data from the current lead cache queue when the image display processing is successful.

6. A device for implementing the multi-threaded graphics rendering method according to any one of claims 1 to 5, characterized in that: The device includes: an acquisition module, an interface processing module, a queue processing module, a first thread processing module, a second thread processing module and a third thread processing module; The acquisition module is used to obtain a first monitoring device list; and to count the number of first monitoring devices in the first monitoring device list to generate a corresponding first number; the first monitoring device list includes a plurality of first monitoring devices; the first monitoring device includes a first lead number and a plurality of first device lead identifiers; the first device lead identifiers in the first monitoring device list are non-repeating; The interface processing module is used to create a first window object; allocate a window space as a corresponding first device space for each first monitoring device on the first window object; create an image object according to the corresponding first lead quantity on each first device space to obtain the first lead image objects of the first lead quantity; create a corresponding SharpDX rendering target object for each first lead image object and record it as a first rendering target object; and allocate a corresponding first device lead identifier to each first lead image object; The queue processing module is used to allocate a data communication interface to each first monitoring device as a corresponding first communication interface; create a data cache queue for each first monitoring device as a corresponding first device cache queue; and create a data cache queue for each first device lead identifier as a corresponding first lead cache queue; The first thread processing module is used to create a thread object for each first monitoring device as a corresponding first device communication thread and run it; the first device communication thread is used to perform data caching processing on the multi-lead ECG data sent by the first monitoring device; The second thread processing module is configured to create a thread object as a corresponding first data processing thread for each first device cache queue, set a sleep duration of the first data processing thread to a preset first duration, and run the first data processing thread; the first data processing thread is configured to periodically perform lead cache queue data migration processing on the corresponding first device cache queue; The third thread processing module is used to create a thread object as a corresponding first drawing thread for each first lead image object and run it, set the sleep duration of the first drawing thread to a preset second duration, and run the first drawing thread; the first drawing thread is used to regularly perform lead cache data acquisition, graphics drawing, image rendering and image display processing according to the corresponding first lead cache queue, the first rendering target object and the first lead image object.

7. An electronic device, characterized in that: include: memory, processors, and transceivers; The processor is configured to be coupled to the memory, read and execute instructions in the memory, so as to implement the method steps described in any one of claims 1 to 5; The transceiver is coupled to the processor, and the processor controls the transceiver to send and receive messages.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, which, when executed by a computer, enable the computer to execute the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Dynamic image display processing method and system

    CN105426185A

  • Multithreading-based OpenGL quick drawing method

    CN106340055A