Image display method, image display device, storage medium and electronic equipment
Technical Field
The present invention relates to the field of embedded image processing, and in particular, to an image display method, an image display apparatus, a storage medium, and an electronic device.
Background
On various resource shortage type equipment with small memory, low interface speed and limited code space, a single-frame or double-frame complete screen is used for caching images, the memory consumption is huge, the requirement on hardware interface speed is high, modules are huge and complex, the usability is poor, and therefore the system operation smoothness is poor under the condition of screen refreshing, and the overall use experience of the equipment is poor.
Disclosure of Invention
The invention provides an image display method, an image display device, a storage medium and electronic equipment, which effectively solve the problem of poor system operation smoothness under the condition of refreshing small image cache in an equipment memory.
In order to achieve the above object, according to one aspect of the present application, there is provided an image display method including the steps of:
A. the system divides the memory into a first display cache and a second display cache;
B. when the first display cache reads the image data, the second display cache writes the image data into a display;
C. when the image data of the first display cache is written into the display, the second display cache reads the image data;
D. step B, C is repeated until image data is written to the display and an image is displayed.
Furthermore, the size of the first display buffer and the second display buffer is display line width and single maximum display line number and single pixel byte data.
Further, when the single maximum display line number cannot be divided by the screen line number of the display, the number of the read and write data lines is the remaining line number.
According to a second aspect, an embodiment of the present invention provides an image display apparatus including:
the processing module divides the memory into a first display cache and a second display cache by the system;
when the first display cache reads the image data, the second display cache writes the image data into a display;
when the image data of the first display cache is written into the display, the second display cache reads the image data;
and repeating the reading and writing steps of the first display buffer and the second display buffer in the above process until the image data is written into the display, and displaying the image.
Furthermore, the size of the first display buffer and the second display buffer is display line width and single maximum display line number and single pixel byte data.
Further, when the single maximum display line number cannot be divided by the screen line number of the display, the number of the read and write data lines is the remaining line number.
According to a third aspect, embodiments of the present invention provide a storage medium having stored therein a plurality of instructions adapted to be loaded by a processor to perform the image display method according to any one of the first aspect above.
According to a fourth aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, where the processor is electrically connected to the memory, the memory is used for storing instructions and data, and the processor is used for executing the steps in the image display method according to any one of the first aspect.
The invention has the beneficial effects that: according to the image display method, the image display device, the storage medium and the electronic equipment, the system distributes the memory into the two display caches, and the data are read and written alternately through the double display caches, so that the use is simple and flexible, the expansion is convenient, the adaptability is strong, the hardware utilization rate is maximized, and the system operation smoothness under the screen refreshing is ensured under the condition of small memory and low memory.
Drawings
FIG. 1 is a flow chart of an image display method provided by the present invention;
FIG. 2 is a schematic diagram of an image display device according to the present invention;
fig. 3 is a schematic structural diagram of an image display electronic device provided by the present invention.
Detailed Description
In order to make the objects, technical solutions and effects of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, according to a first aspect of the present invention, an image displaying method includes the following steps:
s101: the system divides the memory into a first display cache and a second display cache;
s102: when the first display cache reads the image data, the second display cache writes the image data into the display;
s103: when the image data of the first display cache is written into the display, the second display cache reads the image data;
s104: and repeating the steps S102 and S103 until the image data is written into the display, and displaying the image.
The invention is further illustrated by the following specific examples; the system divides the size of the available memory into a first display cache and a second display cache, wherein the size of the first display cache and the second display cache is the display line width W x the single maximum display line number h x the single pixel byte data P;
when the first display cache reads image data, wherein the size of the read data is display line width W and single maximum display line number (reading is 1 to h lines) and single pixel byte data P, the second display cache writes the image data into a display, and the data written into the second display cache is display line width 0 and single maximum display line number 0 and single pixel byte data 0;
after the first display cache reads the image data and the second display cache writes the image data, the image data of the first display cache is written into the display, the second display cache reads the image data, and the second display cache reads the data with the size of display line width W x the maximum display line number (the reading is h +1 to h + h lines) per pixel byte data P;
the first display cache and the second display cache repeat the alternating reading and writing steps until the image data are written into the display, wherein when the maximum display line number H of a single time cannot completely divide the screen line number H of the display, the number of the reading and writing data lines is the number of the remaining lines, the image data are completely written into the display, and the first display cache and the second display cache alternately read and write the image data through the distribution of the system to the memory, so that the maximum hardware utilization rate is improved, the consumption of the system memory is reduced, the image display is completed under the condition of low memory, and the fluency of an operating system is ensured at the same time.
Referring to fig. 2, according to a second aspect of the present invention, an image display apparatus includes:
the processing module 21 divides the memory into a first display cache and a second display cache by the system;
the display module 22, when the first display buffer reads the image data, the second display buffer writes the image data into the display;
when the image data of the first display cache is written into the display, the second display cache reads the image data;
and repeating the reading and writing steps of the first display buffer and the second display buffer in the process until the image data are written into the display, and displaying the image.
The sizes of the first display buffer and the second display buffer are display line width and single maximum display line number and single pixel byte data.
When the maximum display line number of a single time cannot divide the screen line number of the display completely, the read and write data line number is the residual line number.
In a third aspect, the present invention provides a storage medium, on which computer instructions are stored, and when the instructions are executed by a processor, the image display method is implemented.
Referring to fig. 3, according to a fourth aspect, the embodiment of the present invention provides an electronic device, which includes a processor 31, a memory 32, a display device 33, and a computer program stored in the memory 32 and executable on the processor 31, wherein the processor 31 implements the image display method described above when executing the program, and writes a processed image in the display device 33.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.