Image data transmission method and device and storage medium

By using multi-threads to manage video memory buffer pool switching and data transmission in image data transmission, the problem of difficult read and write speed control in pseudo-static random access memory video memory is solved, and efficient image data transmission and smooth screen display are achieved.

CN119342160APending Publication Date: 2025-01-21MIDEA SMART TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310894212.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-19
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

When using pseudo-static random memory as video memory for image data transmission, the reading and writing speed of video memory cannot be accurately controlled, resulting in picture stuttering.

Method used

By calling multiple threads to manage the cache pool switch, data storage, and data sending to the display screen by calling multiple threads, to achieve flexible control of memory read and writing speed. Specific steps include: first -threaded receiving switching requests and switching the cache pool, the second thread stores the memory data to the cache pool, and the third thread sends the data in the cache pool to the display.

Benefits of technology

Through multi -threaded parallel work, the efficiency of image data transmission has been improved, and flexible control of memory read and writing speed is achieved, and the screen stuck is avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119342160A_ABST
    Figure CN119342160A_ABST
Patent Text Reader

Abstract

The invention discloses an image data transmission method and device, equipment and a computer storage medium, and the method comprises the steps: calling a first thread to receive a switching request, and calling the first thread to switch a cache pool for storing data in a video memory from a first cache pool to a second cache pool; calling a second thread to store to-be-displayed data in the memory to the second cache pool; and calling a third thread to send the to-be-displayed data in the first cache pool to a display screen, and calling the display screen to output the to-be-displayed data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of image data transmission, and in particular to an image data transmission method, device, equipment and computer storage medium. Background Art

[0002] At present, when using pseudo-static random access memory as video memory for image data transmission, a single video memory solution is usually adopted. In the single video memory solution, data is copied from the memory to a single video memory area, and then the data in the single video memory area is sent to the display screen for display. Since there is only one video memory area in the single video memory solution, only a small part of the data can be obtained each time. At the same time, the reading speed of the video memory read pointer and the reading speed of the video memory write pointer need to be strictly controlled to match the screen refresh rate and frame rate to ensure the smoothness of the picture. However, it is often impossible to accurately control the reading speed of the video memory read pointer and the reading speed of the video memory write pointer, which easily leads to screen freezes. Summary of the invention

[0003] The present application provides a method, device, equipment and computer storage medium for transmitting image data, which solves the problem that when a pseudo-static random access memory is used as a video memory for transmitting image data, the reading and writing speed of the video memory cannot be accurately controlled, and the screen is prone to freeze.

[0004] The technical solution of this application is implemented as follows:

[0005] A method for transmitting image data, comprising:

[0006] Calling the first thread to receive a switching request, and calling the first thread to switch the buffer pool storing data in the video memory from the first buffer pool to the second buffer pool;

[0007] Calling the second thread to store the data to be displayed in the memory into the second buffer pool;

[0008] The third thread is called to send the data to be displayed in the first buffer pool to the display screen, and the display screen is called to output the data to be displayed.

[0009] An image data transmission device, the device comprising:

[0010] A first processing module, configured to call a first thread to receive a switching request, and call the first thread to switch a buffer pool storing data in a video memory from a first buffer pool to a second buffer pool;

[0011] A second processing module, used for calling a second thread to store the data to be displayed in the memory into the second buffer pool;

[0012] The third processing module is used to call a third thread to send the data to be displayed in the first buffer pool to the display screen, and call the display screen to output the data to be displayed.

[0013] An electronic device, comprising: a display screen, a processor, a memory and a communication bus; the memory comprises a video memory and a memory;

[0014] The communication bus is used to realize the communication connection between the processor, the display screen, the memory and the video memory;

[0015] The processor is used to execute the program of the image data transmission method stored in the memory to implement the steps of the above-mentioned image data transmission method.

[0016] A computer-readable storage medium includes an image data transmission program. When the image data transmission program is executed by a processor, the steps of the above-mentioned image data transmission method are implemented.

[0017] The image data transmission method, device, equipment and computer storage medium provided in the embodiment of the present application, wherein the method comprises: calling a first thread to receive a switching request, and calling the first thread to switch the cache pool storing data in the video memory from the first cache pool to the second cache pool; calling a second thread to store the data to be displayed in the memory to the second cache pool; calling a third thread to send the data to be displayed in the first cache pool to the display screen, and calling the display screen to output the data to be displayed. The problem that the read and write speed of the video memory cannot be accurately controlled and the screen is prone to freeze when using pseudo-static random access memory as the video memory for image data transmission is solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 The process diagram of the image data transmission method provided in the embodiment of the present application is as follows: Figure 1 ;

[0019] Figure 2 The process diagram of the image data transmission method provided in the embodiment of the present application is as follows: Figure 2 ;

[0020] Figure 3 A schematic diagram of an image data transmission device provided in an embodiment of the present application;

[0021] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0022] Figure 5 A flowchart of an image data transmission method in a practical application scenario provided by an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0024] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0025] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.

[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0027] The embodiment of the present application provides a method for transmitting image data. Figure 1 As shown, the method comprises the following steps:

[0028] Step 101: Call a first thread to receive a switching request, and call the first thread to switch a buffer pool storing data in a video memory from a first buffer pool to a second buffer pool.

[0029] The first thread is used to perform switching operations between buffer pools in the video memory. The video memory is provided with multiple buffer pools, for example, the multiple buffer pools include a first buffer pool and a second buffer pool, and both the first buffer pool and the second buffer pool can store image data to be displayed.

[0030] Exemplarily, when the first buffer pool is used as a buffer pool for image drawing, the second buffer pool is used as a buffer pool for sending image data to the display screen. After the switch occurs, when the second buffer pool is used as a buffer pool for image drawing, the first buffer pool is used as a buffer pool for sending image data to the display screen.

[0031] Exemplarily, the video memory of the present application may be a built-in 2M pseudo-static random access memory.

[0032] In an embodiment of the present application, after the first thread receives a switching request, the first thread is called to switch the two cache pools storing image data in the video memory, that is, the applicable scenarios of the first cache pool and the second cache pool are exchanged. Assuming that the first cache pool is used as a cache pool for image drawing before the exchange, then the first cache pool is used as a cache pool for sending image data to the display screen after the exchange; assuming that the second cache pool is used as a cache pool for sending image data to the display screen before the exchange, then the second cache pool is used as a cache pool for image drawing after the exchange.

[0033] The execution subject of this embodiment may be an electronic device having functions of data processing, data communication, and program execution, etc. Usually, the operation of each component in an electronic device may be driven by a core controller / processor, so the execution subject of this embodiment may also be a controller / processor of the electronic device.

[0034] Exemplarily, the processor of the present application may be a single-chip microcomputer; optionally, the single-chip microcomputer may be a 240M dual-core processor single-chip microcomputer.

[0035] Step 102: Call the second thread to store the data to be displayed in the memory into the second buffer pool.

[0036] The second thread is used to perform image data storage operations. The image data to be displayed is image data obtained from a device / storage area outside the video memory; for example, the obtained image data can be image data stored in the memory, or image data on a server or other device connected to the electronic device.

[0037] In an embodiment of the present application, in an applicable scenario, after the first thread receives a switching request, the first thread is called to switch the two buffer pools storing image data in the video memory, and the first buffer pool after the switch is the buffer pool used to send image data to the display screen, and at this time, the second buffer pool after the switch is the buffer pool used for image drawing. Then, after the second thread obtains the image data to be displayed, the image data to be displayed is stored in the second buffer pool.

[0038] Step 103: Call the third thread to send the data to be displayed in the first buffer pool to the display screen, and call the display screen to output the data to be displayed.

[0039] The third video memory is used to execute the operation of sending the image data to the display screen.

[0040] In the embodiment of the present application, when the first thread receives the switching request, the first thread is called to switch the two buffer pools storing image data in the video memory. After the switch, the first buffer pool is the buffer pool used to send image data to the display screen. At this time, after the switch, the second buffer pool is the buffer pool used for image drawing. Thus, according to the image data refresh requirement of the display screen, the third thread is called to send the image data to be displayed in the first buffer pool to the display screen, and the image data to be displayed is output through the display screen.

[0041] In the embodiment of the present application, the image data refresh requirement of the display screen can be understood as displaying images at a screen update frequency of 1 frame per second according to the screen refresh rate requirement of the display screen. Optionally, the screen refresh rate can be 60 frames per second or other, which is not limited by the present invention. Optionally, grouped data transmission (Direct Memory Access, DMA) can be adopted for image data transmission.

[0042] An image data transmission method provided by an embodiment of the present application includes calling a first thread to receive a switching request, and calling the first thread to switch the cache pool storing data in the video memory from the first cache pool to the second cache pool; calling the second thread to store the data to be displayed in the memory to the second cache pool; calling the third thread to send the data to be displayed in the first cache pool to the display screen, and calling the display screen to output the data to be displayed. The present application improves the transmission efficiency of image data by independent parallel work between multiple threads. At the same time, the applicable scenarios of the first cache pool and the second cache pool are exchanged, so that different cache pools correspond to specific applicable scenarios, further realizing flexible control of the reading and writing of a single cache pool, and improving the parallel reading and writing speed between multiple cache pools, thereby solving the problem that the video memory reading and writing speed cannot be accurately controlled when using pseudo-static random access memory as video memory for image data transmission, and the screen is prone to freeze.

[0043] In the related art, when a dual video memory solution is adopted, the memory data is first collected through a cache area in the video memory for a whole frame of data, and then the collected whole frame of data is copied to another cache area. At this time, the other cache area is locked and the whole frame of data therein is sent to the display screen for display. It should be pointed out that in the current dual video memory solution, data copying and frame locking operations need to be repeated, resulting in slow reading and writing speeds of the video memory, low data transmission efficiency, and a low frame rate. Under the high requirements of the screen refresh rate, the frame rate cannot keep up with the screen refresh rate, and the screen is prone to freeze. The present application provides an image data transmission method that solves the problem that when a pseudo-static random access memory is used as a video memory for image data transmission, the reading and writing speed of the video memory cannot be accurately controlled, and the screen is prone to freeze.

[0044] In some embodiments of the present application, calling the first thread to switch the buffer pool storing data in the video memory from the first buffer pool to the second buffer pool can be implemented by the following steps:

[0045] First, calling the first thread to obtain a pointer stored in the video memory; the pointer is used to indicate the switching of the first buffer pool and the switching of the second buffer pool;

[0046] Secondly, the first thread is called to point the pointer to the second buffer pool, so as to switch the buffer pool storing image data from the first buffer pool to the second buffer pool.

[0047] In a feasible scenario, when storing image data, the switching between the buffer pools is realized by changing the position pointed by the pointer. For example, the pointer originally pointing to the first buffer pool can be changed to point to the second buffer pool, so that in the process of storing image data, the image data to be stored before the pointer changes are stored in the first buffer pool, and the image data in the second buffer pool is sent to the display screen before the pointer changes; the image data to be stored after the pointer changes are stored in the second buffer pool, and the image data in the first buffer pool is sent to the display screen after the pointer changes. It can be seen that the present application realizes the exchange of applicable scenarios of the first buffer pool and the second buffer pool by changing the position pointed by the pointer. The implementation method is simple, and compared with the method of copying image data, it can significantly reduce the number of read and write times of the video memory, realize the transmission, drawing and display of real-time image data, and avoid screen freezes.

[0048] In some embodiments of the present application, calling the first thread to receive the switching request in step 101 can be implemented by the following steps:

[0049] If the data in the first buffer pool meets the first update condition after the second thread updates the data in the first buffer pool, the first thread is called to receive the switching request generated by the second thread.

[0050] The first update condition includes a full screen update. It can be understood that a full screen update is to clear the screen of the display screen completely, redraw all pixels, and complete the refresh of the entire screen area.

[0051] In an embodiment of the present application, in an applicable scenario, when the first buffer pool before the exchange is a buffer pool used for image drawing, at this time, the second buffer pool before the exchange is a buffer pool used for sending image data to the display screen. Then, when the second thread updates the image data in the first buffer pool, if the image data in the first buffer pool meets the conditions for updating the entire screen, it means that the image data stored in the first buffer pool at this time can meet the conditions for redrawing all pixels after the screen of the display screen is cleared after the image drawing. Then, the second thread sends a request to switch between the buffer pools in the video memory to the first thread, and the first thread receives the switching request sent by the second thread.

[0052] In some embodiments of the present application, calling the first thread to receive the switching request in step 101 may also be implemented by the following steps:

[0053] If the data in the first cache pool meets the second update condition after the second thread updates the data in the first cache pool, and the data in the second cache pool meets the first update condition after the second thread updates the data in the second cache pool, the data in the second cache pool that is different from the first cache pool is copied to the first cache pool, and the first thread is called to receive the switching request generated by the second thread.

[0054] The second update condition includes non-whole screen update. It can be understood that non-whole screen update is to clear part of the screen of the display screen, draw the part of pixels, and complete the refresh of the part of the screen area.

[0055] In an embodiment of the present application, in an applicable scenario, when the first buffer pool before the exchange is a buffer pool used for image drawing, the second buffer pool before the exchange is a buffer pool used for sending image data to the display screen. Then, when the second thread updates the image data in the first buffer pool, if the image data in the first buffer pool meets the condition of non-whole screen update, it indicates that the image data currently being drawn is image data of non-whole screen, and at the same time, if the image data in the second buffer pool meets the condition of full screen update after the second thread updates the image data in the second buffer pool, it indicates that the data previously sent to the display screen is image data of the whole screen; that is, the data currently being drawn differs from the data previously sent to the display screen by part of the difference image data, then, before sending the next image data to the display screen, it is necessary to update the image data of the partial refresh area of ​​the screen corresponding to the difference image data, that is, to fill the image data in the second buffer pool that is different from the refresh area in the first buffer pool back to the first buffer pool, so that the first buffer pool can meet the condition of drawing the part of pixels after the screen part of the display screen is cleared after the non-whole screen update and the difference image data corresponding to the partial refresh area of ​​the screen are backfilled. Then, the second thread sends a request to switch between buffer pools in the video memory to the first thread, and the first thread receives the switching request sent by the second thread. In this way, the data transmission volume is reduced, thereby reducing the number of video memory read and write times and improving the video memory read and write speed.

[0056] In some embodiments of the present application, calling the first thread to receive the switching request in step 101 may also be implemented by the following steps:

[0057] If the data in the first buffer pool meets the second update condition after the second thread updates the data in the first buffer pool, and the data in the second buffer pool meets the second update condition after the second thread updates the data in the second buffer pool, obtaining the first partial refresh area of ​​the second buffer pool and the second partial refresh area of ​​the first buffer pool;

[0058] If the first partial refresh area overlaps with the second partial refresh area, the first thread is called to receive a switching request generated by the second thread.

[0059] In an embodiment of the present application, in an applicable scenario, when the first buffer pool before the exchange is a buffer pool used for image drawing, at this time, the second buffer pool before the exchange is a buffer pool used for sending image data to the display screen. Then, after the second thread updates the data in the first buffer pool, if the image data in the first buffer pool meets the conditions for non-whole-screen update, at the same time, if the data in the second buffer pool meets the conditions for non-whole-screen update after the second thread updates the data in the second buffer pool, it indicates that the image data currently being drawn and the data of the previous image data sent to the display screen are both non-whole-screen image data. At this time, it is necessary to further determine whether the partial screen refresh area corresponding to the image data currently being drawn and the partial screen refresh area corresponding to the data of the previous image data sent to the display screen overlap.

[0060] Furthermore, when the first partial refresh area overlaps with the second partial refresh area, it indicates that the partial screen refresh area corresponding to the image data currently being drawn is the same as the partial screen refresh area corresponding to the data that has previously sent image data to the display screen, and both are updating the image data in the same refresh area of ​​the display screen. Then, before sending the next image data to the display screen, when the first buffer pool where the current image data is located and the second buffer pool where the data that has previously sent image data to the display screen are located are directly switched, the condition of drawing the pixels of this part after the screen portion of the display screen is cleared can be met. Then, the second thread sends a request to switch between the buffer pools in the video memory to the first thread, and the first thread receives the switching request sent by the second thread. In this way, the amount of data transmission is reduced, thereby reducing the number of video memory read and write times and improving the video memory read and write speed.

[0061] Furthermore, if the first partial refresh area does not overlap with the second partial refresh area, the data in the second buffer pool that is different from the first buffer pool is copied to the first buffer pool, and the first thread is called to receive the switching request generated by the second thread.

[0062] In an embodiment of the present application, in an applicable scenario, when the first buffer pool before the exchange is a buffer pool used for image drawing, at this time, the second buffer pool before the exchange is a buffer pool used for sending image data to the display screen. Then, when the first partial refresh area does not overlap with the second partial refresh area, it indicates that the screen partial refresh area corresponding to the image data currently being drawn is different from the screen partial refresh area corresponding to the data that has previously sent image data to the display screen, and the image data is updated for different refresh areas of the screen of the display screen. Then, before sending the next image data to the display screen, it is necessary to first update the image data of the screen partial refresh area corresponding to the difference image data, that is, to fill the image data in the second buffer pool that is different from the first buffer pool back to the first buffer pool, so that the first buffer pool is updated by non-whole screen, and the difference image data corresponding to the screen partial refresh area in the second buffer pool is filled back to the first buffer pool, so that the condition of drawing the part of pixels after the screen part of the display screen is cleared can be met. Then, the second thread sends a request to switch between buffer pools in the video memory to the first thread, and the first thread receives the switching request sent by the second thread. In this way, the amount of data transmission is reduced, thereby reducing the number of video memory read and write times and increasing the video memory read and write speed.

[0063] In some embodiments of the present application, before step 101 calls the first thread to receive a switching request and calls the first thread to switch the buffer pool storing data in the video memory from the first buffer pool to the second buffer pool, the following steps may also be performed: Figure 2 Steps shown:

[0064] S201: The first thread is not called to receive a switching request, and the second thread is called to store the data to be displayed in the memory into the first buffer pool.

[0065] In the embodiment of the present application, when the first thread does not receive a switching request, it indicates that the buffer pool storing data in the video memory at this time is the first buffer pool. At this time, in an applicable scenario, the first buffer pool is used as a buffer pool for image drawing, and the second buffer pool is used as a buffer pool for sending image data to the display screen.

[0066] S202: Calling a third thread to send the data to be displayed in the second buffer pool to the display screen, and calling the display screen to output the data to be displayed.

[0067] In the embodiment of the present application, when the first thread does not receive a switching request, at this time, in an applicable scenario, the first buffer pool is used as a buffer pool for image drawing, and at the same time, the second buffer pool is also used as a buffer pool for sending image data to the display screen. Then, when the first buffer pool stores image data for sending to the display screen, according to the image data refresh requirement of the display screen, the third thread is called to send the data to be displayed stored in the second buffer pool to the display screen, and the image data to be displayed is output through the display screen.

[0068] A schematic diagram of an image data transmission device provided in an embodiment of the present application is as follows: Figure 3 As shown, the image data transmission device 300 includes: a first processing module 301, a second processing module 302, and a third processing module 303, wherein:

[0069] The first processing module 301 is used to call the first thread to receive a switching request, and call the first thread to switch the buffer pool storing data in the video memory from the first buffer pool to the second buffer pool;

[0070] The second processing module 302 is used to call the second thread to store the data to be displayed in the memory into the second buffer pool;

[0071] The third processing module 303 is used to call the third thread to send the data to be displayed in the first buffer pool to the display screen, and call the display screen to output the data to be displayed.

[0072] In some embodiments of the present application, the first processing module 301 further includes a first processing sub-module 3011 , a first processing sub-module 3012 , a first processing sub-module 3013 , and a first processing sub-module 3014 .

[0073] The first processing submodule 3011 is configured to call the first thread to receive a switching request generated by the second thread if the data in the first buffer pool meets a first update condition after the second thread updates the data in the first buffer pool.

[0074] The first processing submodule 3012 is configured to copy data in the second cache pool that is different from the first cache pool to the first cache pool if the data in the first cache pool meets the second update condition after the second thread updates the data in the first cache pool, and the data in the second cache pool meets the first update condition after the second thread updates the data in the second cache pool, and to call the first thread to receive a switching request generated by the second thread.

[0075] The first processing submodule 3013 is used to obtain a first partial refresh area of ​​the second cache pool and a second partial refresh area of ​​the first cache pool if the data in the first cache pool meets a second update condition after the second thread updates the data in the first cache pool, and the data in the second cache pool meets the second update condition after the second thread updates the data in the second cache pool; if the first partial refresh area overlaps with the second partial refresh area, call the first thread to receive a switching request generated by the second thread.

[0076] The first processing submodule 3013 is further configured to copy data in the second cache pool that is different from the first cache pool to the first cache pool if the first partial refresh area does not overlap with the second partial refresh area, and call the first thread to receive a switching request generated by the second thread.

[0077] The first processing submodule 3014 is used to call the first thread to obtain the pointer stored in the video memory; the pointer is used to indicate the switching of the first buffer pool and the switching of the second buffer pool.

[0078] The first processing submodule 3014 is further configured to call the first thread to point the pointer to the second buffer pool, so as to switch the buffer pool storing data from the first buffer pool to the second buffer pool.

[0079] In some embodiments of the present application, the second processing module 302 also includes a second processing sub-module 3021 .

[0080] The second processing submodule 3021 is configured to update the data in the first buffer pool by the second thread if the first thread is called to receive a switching request.

[0081] The second processing submodule 3021 is further configured to, if the first thread is not called to receive the switching request, call the second thread to store the data to be displayed in the memory into the first buffer pool.

[0082] In some embodiments of the present application, the third processing module 303 is further used to call the third thread to send the data to be displayed in the second buffer pool to the display screen, and call the display screen to output the data to be displayed.

[0083] In addition, each functional module in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or software functional modules.

[0084] A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the electronic device 400 includes: a display screen 401, a processor 402, a memory 405 and a communication bus 406; the memory 405 includes a video memory 403 and a memory 404;

[0085] The communication bus 406 is used to realize the communication connection between the processor 402, the display screen 401, the video memory 403 and the memory 404;

[0086] The processor 402 is used to execute the program of the image data transmission method stored in the memory 405 to implement the steps in the aforementioned image data transmission method.

[0087] Exemplarily, the communication bus of the present application may use a frequency above 120 MHz.

[0088] Exemplarily, the memory of the present application may be a flash memory of 8M or more, and connected to the processor using a queued serial peripheral interface.

[0089] Exemplarily, the display screen of the present application may use a small-size thin-film field-effect transistor with a resolution of 360X480, and use a queued serial peripheral interface to connect to the processor.

[0090] Exemplarily, the present application also includes other peripheral circuits required to implement the image data transmission method of the present application, such as serial port communication, circuit conversion, etc., which are not limited herein.

[0091] Below, take the actual application scenario as an example, see Figure 5 As shown, the image data transmission method provided by this application is described:

[0092] In this application scenario, taking the second thread as the main thread, the first thread as the working thread, and the third thread as the sending thread as an example, the electronic device can perform corresponding control on each thread to implement the following steps:

[0093] S501. Start, control the subroutine of the main thread to start. S502. Call the main thread, update the image data to be displayed in the graphics library to the buffer pool buffer A in the video memory. At this time, the buffer pool buffer A before the exchange is used as the buffer pool for image drawing. In this usage scenario, the buffer pool buffer A before the exchange is used as the buffer pool for sending image data to the display screen. S503. Determine whether the graphics library has updated a frame of image data to the buffer pool buffer A. S504. If not, it indicates that the current graphics library has not updated a frame of image data, and return to step S502 to continue updating; if yes, it indicates that the current graphics library has updated a frame of image data, and continue to determine whether the image data in the buffer pool buffer A is updated on the entire screen. S505. If yes, it indicates that the current buffer pool buffer A stores image data that meets the full-screen update conditions, and sends a switching request to the working thread, which is used to switch between the buffer pool buffer A and the buffer pool buffer B. S509. Adjust the main thread to be in a waiting notification state to wait for the feedback notification of the working thread completing the switch.

[0094] S510, start, indicating that the subroutine controlling the working thread is started. S511, the working thread receives the DMA transfer completion interrupt signal, indicating that the image data transmission process of the last image data sent to the display screen is completed. S512, determine whether to receive the switching request of the buffer pool buffer A and the buffer pool buffer B. S513, if yes, call the working thread to switch the buffer pool buffer A to the buffer pool buffer B, that is, the pointer originally pointing to the buffer pool buffer A, after the switch, changes to point to the buffer pool buffer B, then the swapped buffer pool buffer A is used as the buffer pool for sending image data to the display screen, and at the same time, the swapped buffer pool buffer B is used as the buffer pool for image drawing. S514, send a switching completion notification, that is, after the switching is completed, send a switching feedback notification of the completion of the switching to the main thread, at this time, the switched buffer pool buffer A stores the image data for sending to the display screen. S516, wake up the sending thread, and send the image data to be displayed stored in the buffer pool buffer A in the working thread, that is, the image data for sending to the display screen, to the display screen for display. Among them, the transmission efficiency of image data is improved through the independent parallel work between the main thread and the working thread; by changing the pointer pointing position, the applicable scenarios of the buffer pool buffer A and the buffer pool buffer B are flexibly changed, and the flexible control of the reading and writing of the video memory is realized. The implementation method is simple, and compared with the image data copying method, the number of video memory reading and writing can be significantly reduced, and real-time image data transmission, drawing and display can be realized to avoid screen freeze.

[0095] Further, S512, determine whether the working thread receives the switching request of the buffer pools buffer A and buffer pools buffer B. S515, if not, it indicates that the working thread has not received the switching request from the main thread, and at this time, the buffer pool buffer A is used as the buffer pool for image drawing, and at the same time, the buffer pool buffer B is used as the buffer pool for sending image data to the display screen, then, fill the buffer pool buffer A, that is, update the image data to be displayed in the graphics library to the buffer pool buffer A. S517, wake up the sending thread, the sending thread is used to send the data to be displayed stored in the buffer pool buffer B in the working thread to the display screen for display, so that when the working thread does not receive the switching request from the main thread, it can respond to the data transmission demand from the display screen more quickly.

[0096] Further, S504, determine whether the data in the buffer pool buffer A is updated for the entire screen. S506, if not, it indicates that the image data currently being drawn is image data that is not the entire screen; continue to determine whether the data in the buffer pool buffer B is updated for the entire screen. S507, if yes, it indicates that the data previously sent to the display screen is image data for the entire screen, that is, the data currently being drawn differs from the data previously sent to the display screen in part of the difference image data, so before sending the next image data to the display screen, it is necessary to update the image data in the partial refresh area of ​​the screen corresponding to the difference image data, that is, copy the image data in the different refresh areas of the buffer pool buffer B and the buffer pool buffer A back to the buffer pool buffer A. S505, send a switching request to the working thread for the buffer pool buffer A and the buffer pool buffer B. In this way, by updating the difference image data corresponding to the partial refresh area of ​​the screen, the amount of data transmission is reduced, thereby reducing the number of video memory read and write times and improving the video memory read and write speed.

[0097] Further, S504, determine whether the data in the buffer pool buffer A is updated for the entire screen. S506, if not, it indicates that the image data currently being drawn is image data of a non-entire screen; continue to determine whether the data in the buffer pool buffer B is updated for the entire screen. S508, if not, it indicates that the data of the previous image data sent to the display screen is image data of a non-entire screen; continue to determine whether the partial refresh areas of the buffer pool buffer A and the buffer pool buffer B at this time overlap, if yes, proceed to the aforementioned step S505; if not, proceed to the aforementioned step S507.

[0098] Further, S509, when the main thread receives the switching completion notification sent by the working thread, it indicates that the buffer pool buffer A and the buffer pool buffer B have completed the switching, and the main thread is called to enter a new round of graphics library data update, that is, enter the aforementioned step S502.

[0099] It can be seen that the image data transmission method provided by the present application reduces the amount of data transmission by updating the difference image data corresponding to the partial refresh area of ​​the screen, thereby reducing the number of video memory read and write times and improving the video memory read and write speed; the independent parallel work between the main thread and the working thread improves the transmission efficiency of image data; by changing the position pointed to by the pointer, the applicable scenarios of the buffer pool buffer A and the buffer pool buffer B are flexibly changed, and flexible control of video memory reading and writing is achieved. The implementation method is simple, and compared with the image data copying method, it can significantly reduce the number of video memory read and write times, realize real-time image data transmission, drawing and display, and avoid screen freezes.

[0100] The embodiment of the present application provides a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the following. Figure 1 The steps in the image data transmission method provided in the corresponding embodiment are not repeated here.

[0101] The above-mentioned computer storage medium / memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (Flash Memory), a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and the like; it can also be various terminals including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.

[0102] It should be understood that the "one embodiment" or "an embodiment" or "an embodiment of the present application" or "the aforementioned embodiment" or "some embodiments" or "some implementation methods" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" or "an embodiment of the present application" or "the aforementioned embodiment" or "some embodiments" or "some implementation methods" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The above-mentioned sequence numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.

[0103] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0104] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0105] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0106] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0107] The features disclosed in several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0108] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0109] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.

[0110] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0111] It is worth noting that the drawings in the embodiments of the present application are only for illustrating the schematic positions of various components on the terminal device and do not represent the actual positions in the terminal device. The actual positions of various components or areas may be changed or offset accordingly according to actual conditions (for example, the structure of the terminal device), and the proportions of different parts of the terminal device in the drawings do not represent the actual proportions.

[0112] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for transmitting image data, characterized in that: The method includes: Calling the first thread to receive a switching request, and calling the first thread to switch the buffer pool storing data in the video memory from the first buffer pool to the second buffer pool; Calling the second thread to store the data to be displayed in the memory into the second buffer pool; The third thread is called to send the data to be displayed in the first buffer pool to the display screen, and the display screen is called to output the data to be displayed.

2. The method according to claim 1, characterized in that The calling the first thread to receive the switching request includes: If the data in the first buffer pool meets a first update condition after the second thread updates the data in the first buffer pool, the first thread is called to receive the switching request generated by the second thread.

3. The method according to claim 1, characterized in that The calling the first thread to receive the switching request includes: If the data in the first cache pool meets the second update condition after the second thread updates the data in the first cache pool, and the data in the second cache pool meets the first update condition after the second thread updates the data in the second cache pool, copy the data in the second cache pool that is different from the first cache pool to the first cache pool; The first thread is called to receive the switching request generated by the second thread.

4. The method according to claim 3, characterized in that The method further comprises: If the data in the first buffer pool meets the second update condition after the second thread updates the data in the first buffer pool, and the data in the second buffer pool meets the second update condition after the second thread updates the data in the second buffer pool, obtaining a first partial refresh area of ​​the second buffer pool and a second partial refresh area of ​​the first buffer pool; If the first partial refresh area overlaps with the second partial refresh area, the first thread is called to receive the switching request generated by the second thread.

5. The method according to claim 4, characterized in that The method further comprises: If the first partial refresh area does not overlap with the second partial refresh area, copying the data in the second buffer pool that is different from the data in the first buffer pool to the first buffer pool; The first thread is called to receive the switching request generated by the second thread.

6. The method according to any one of claims 1 to 5, characterized in that include: If the first thread is not called to receive the switching request, calling the second thread to store the data to be displayed in the memory into the first buffer pool; The third thread is called to send the data to be displayed in the second buffer pool to the display screen, and the display screen is called to output the data to be displayed.

7. The method according to any one of claims 1 to 5, wherein calling the first thread to switch the buffer pool storing data in the video memory from the first buffer pool to the second buffer pool comprises: Calling the first thread to obtain the pointer stored in the video memory; The pointer is used to indicate the switching of the first buffer pool and the switching of the second buffer pool; The first thread is called to point the pointer to the second buffer pool, so as to switch the buffer pool storing data from the first buffer pool to the second buffer pool.

8. An image data transmission device, characterized in that: It includes a first processing module, a second processing module, and a third processing module, wherein: A first processing module, configured to call a first thread to receive a switching request, and call the first thread to switch a buffer pool storing data in a video memory from a first buffer pool to a second buffer pool; A second processing module, used for calling a second thread to store the data to be displayed in the memory into the second buffer pool; The third processing module is used to call a third thread to send the data to be displayed in the first buffer pool to the display screen, and call the display screen to output the data to be displayed.

9. An electronic device, comprising: Display screen, processor, memory and communication bus; The memory includes video memory and internal memory; The communication bus is used to realize the communication connection between the processor, the display screen, the memory and the video memory; The processor is used to execute the program of the image data transmission method stored in the memory to implement the steps of the image data transmission method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes an image data transmission program, and when the image data transmission program is executed by a processor, the steps of the image data transmission method according to any one of claims 1 to 7 are implemented.