CN113326085B - JPEG format picture display method and system based on LVGL - Google Patents

JPEG format picture display method and system based on LVGL Download PDF

Info

Publication number
CN113326085B
CN113326085B CN202110537981.3A CN202110537981A CN113326085B CN 113326085 B CN113326085 B CN 113326085B CN 202110537981 A CN202110537981 A CN 202110537981A CN 113326085 B CN113326085 B CN 113326085B
Authority
CN
China
Prior art keywords
picture
jpeg
data
format
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110537981.3A
Other languages
Chinese (zh)
Other versions
CN113326085A (en
Inventor
胡文
黄金华
于嘉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ASR Microelectronics Co Ltd
Original Assignee
ASR Microelectronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ASR Microelectronics Co Ltd filed Critical ASR Microelectronics Co Ltd
Priority to CN202110537981.3A priority Critical patent/CN113326085B/en
Publication of CN113326085A publication Critical patent/CN113326085A/en
Application granted granted Critical
Publication of CN113326085B publication Critical patent/CN113326085B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Abstract

The application discloses a JPEG format picture display method based on LVGL. A universal picture decoding interface, a JPEG picture decoder and a decoding library required for decoding JPEG pictures are added in the LVGL system framework. In the pre-compiling stage of the firmware code of the electronic equipment, the binary original RAW data of the JPEG-format picture is stored into an array of unsigned bytes of C language and is stored in a C file. JPEG format pictures generated by the electronic equipment in the using process are stored in a file system of the electronic equipment and are uniquely identified by different file paths; and during storage, storing the character string data of the file path of the JPEG-format picture into an array of C-language unsigned bytes, and establishing a structural body variable for the JPEG-format picture. The application also provides a reading and displaying method of the pictures with two JPEG formats in the firmware and the file system, which is suitable for displaying the JPEG pictures on the LVGL system framework.

Description

JPEG format picture display method and system based on LVGL
Technical Field
The present invention relates to a JPEG format picture display method for an electronic device using an embedded system (embedded system), and more particularly, to a JPEG format picture display method for an electronic device using an embedded system with limited memory space.
Background
A child watch is a typical electronic device that employs an embedded system. The child watch is mainly used for realizing a positioning function, and the positioning function mainly depends on a satellite positioning technology such as a Global Positioning System (GPS), a base station positioning technology of a mobile communication network, a wireless fidelity (WiFi) positioning technology, and the like. Some child watches only support 2G mobile communication networks, and other child watches support 4G mobile communication networks at most. A modem-to-modem code of a 4G mobile communication network is more bulky than a modem code of a 2G mobile communication network. To save costs, children's watches typically employ limited storage space, such as 16MB of flash memory. At this time, the child watch supporting the 4G mobile communication network must compress the storage space of the GUI (graphical user interface). The child watch needs abundant pictures to attract children, and how to minimize the picture storage space becomes a key factor for saving cost.
At present, two GUI schemes are mainly used for electronic devices adopting embedded systems, wherein an Android GUI system frame is used for high-end electronic devices, and a miniGUI system frame is used for low-end electronic devices. The android GUI system framework has a large code amount and cannot be stored in an electronic device with a limited storage space. The miniGUI system framework is old in function, not rich in picture effect and not small enough in code volume.
LVGL (Light and virtual Graphics Library) is a new GUI system framework, which has the advantages of small code amount and easy UI (user interface) development, and can load firmware of the child watch only with 16MB of flash memory space. LVGL is a emerging GUI system framework, however, and has not yet provided a complete solution to the needs of embedded systems, particularly children's watches, on which new functionality needs to be developed. For example, the LVGL system framework supports only picture display in bitmap (bitmap) format, and the picture input source supported by the LVGL system framework is a C array (array) of bitmaps saved in 32-bit (32-bit) true color (true color) format. The 32-bit true color format refers to three bytes for three colors, respectively, the fourth byte for the alpha (alpha) channel, and 32 bits for one pixel. The LVGL system framework directly reads the picture input source into the memory for display without decompressing. And the pictures sent and received between the child watch and the APP server are in JPEG format, and the pictures stored after being photographed are also in JPEG format. The LVGL system framework is currently unable to display pictures in JPEG format.
Disclosure of Invention
The technical problem to be solved by the application is to provide a method for supporting the display of a picture file in a JPEG format based on an LVGL system framework.
In order to solve the technical problem, the application provides a JPEG format picture display method based on LVGL, which includes the following steps. Step S10: the electronic equipment adopts LVGL as a GUI system frame, and a general picture decoding interface, a JPEG picture decoder and a JPEG decoding library are added in the LVGL system frame. Step S20: at the pre-compiling stage of firmware codes of the electronic equipment, storing binary original RAW data of a JPEG-format picture into an array of unsigned bytes of C language and storing the array in a C file; simultaneously recording the structure variable of the picture in the C file; the structure body adopted by the structure body variable comprises a structure body and a data pointer, wherein the structure body comprises a flag bit, the flag bit is a first value and indicates that the data pointer points to binary data of a JPEG picture; and compiling the C file into a code segment which is a binary file and is stored in a firmware image file in a compiling stage of firmware codes of the electronic equipment. Step S30: when the electronic equipment is started, when the LVGL system frame needs to display a JPEG format picture in a firmware file, the LVGL system frame calls a general picture decoding interface to determine that the picture type is in a JPEG format, then a JPEG picture decoder finds a structural body variable of the JPEG format picture, determines binary data of the JPEG format picture pointed by a data pointer in the structural body variable according to a flag bit in the structural body variable, and finally finds an unsigned byte array, namely the binary data of the JPEG format picture according to the data pointer; and the JPEG picture decoder decodes the binary RAW data of the JPEG format picture by calling an interface function of a JPEG decoding library to obtain data of the whole bitmap, and transmits the data of the whole bitmap to a drawing interface of the LVGL system frame for full bitmap display. Step S40: JPEG format pictures generated by the electronic equipment in the using process are stored in a file system of the electronic equipment and are uniquely identified by different file paths; when the structure variable is stored, the character string data of the file path of the JPEG-formatted picture is stored into an array of unsigned bytes of a C language, and a structure variable is newly established for the JPEG-formatted picture, wherein a structure adopted by the structure variable comprises a head structure and a data pointer, the head structure comprises a flag bit, and the flag bit is a second value and indicates that the data pointer points to the character string data of the file path of the JPEG-formatted picture. Step S50: when the electronic equipment is used, when the LVGL system frame needs to display a JPEG-format picture in a file system, the LVGL system frame calls a general picture decoding interface to determine that the picture type is in a JPEG format, then a JPEG picture decoder finds a structural body variable of the JPEG-format picture, determines character string data of a file path of the JPEG-format picture pointed by a data pointer in the structural body variable according to a flag bit in the structural body variable, and finally finds an ASCII code of the file path character string stored in the file system of the JPEG-format picture; the JPEG picture decoder opens a file path through an opening function of a file system and reads out RAW data of the JPEG format picture through a reading operation function of the file system; and the JPEG picture decoder decodes the binary RAW data of the JPEG-formatted picture by calling an interface function of a JPEG decoding library to obtain data of the whole bitmap, and transmits the data of the whole bitmap to a drawing interface of the LVGL system frame for full bitmap display. The method designs the storage and reading methods of the pictures with two JPEG formats in the firmware and the file system, and is suitable for displaying the JPEG pictures on the LVGL system framework.
Further, in step S10, the common picture decoding interface is a common interface of decoders in different picture formats to an upper layer, and decoders in different picture formats are registered; when the LVGL system framework analyzes a picture data, a 'read file type function' of a general picture decoding interface is called to access the data of the picture, and a byte which marks the picture type in the picture data is found; if the data type defined by a certain picture format decoder registered by the universal picture decoding interface is met, the universal picture decoding interface returns a pointer of an operation function of the picture format decoder. This is a supplementary description of the generic picture decoding interface.
Preferably, the PNG picture decoder, the JPEG picture decoder, and the GIF picture decoder are sequentially registered in the common picture decoding interface by using a linked list mechanism. This is an exemplary illustration of a generic picture decoding interface.
Further, in the step S10, the JPEG picture decoder is configured to decode pictures in JPEG format; the JPEG picture decoder is provided with a universal function interface which is in butt joint with the LVGL system frame and comprises an interface function for opening JEPG picture data, an interface function for closing JEPG picture data and an interface function for returning picture types. This is a supplementary explanation of the JPEG picture decoder.
Further, in the step S20, the structure body adopted by the structure body variable is the improved structure body lv _ img _ dsc _ t for pictures in JPEG format, and includes a structure body and data pointers. The head structure comprises a flag bit header; the flag bit is a first value indicating that the data pointer points to binary data of the JPEG format picture. The data pointer points to an array of unsigned bytes in the C file; the bytes in the array are either bytes of binary data of the JPEG format picture. This is a supplementary description of the structure variables, which is suitable for saving and reading pictures in JPEG format in firmware.
Further, in the step S40, the structure body adopted by the structure body variable is the improved structure body lv _ img _ dsc _ t for pictures in JPEG format, and includes a structure body and data pointers. The head structure comprises a flag bit header; the flag bit is a second value indicating that the data pointer points to the character string data of the file path of the JPEG-format picture. The data pointer points to an array of unsigned bytes in the C file; the bytes in the array are bytes of string data that record the file path of a JPEG format picture. This is a supplementary description of the structure variables, and is suitable for saving and reading pictures in JPEG format in file system.
Further, in step S20 or step S40, the header structure further includes a decoding identifier header.cf, and it is recorded that the way in which the LVGL system framework interprets the JPEG-formatted picture is the JPEG picture decoder LV _ IMG _ CF _ RAW _ ALPHA; this means that the LVGL system framework translates the pixel bytes of the picture to the display component in the manner of a transparency-enabled alpha channel in RAW format. This is a supplementary explanation of the decoding flag in the structure variable.
The application also provides a JPEG format picture display system based on the LVGL, which comprises an adding unit, a first storage unit, a first display unit, a second storage unit and a second display unit. The adding unit is used for adding a general picture decoding interface, a JPEG picture decoder and a JPEG decoding library in the LVGL system frame in the electronic equipment adopting the LVGL as the GUI system frame. The first storage unit is used for storing binary RAW data of a JPEG-format picture into an array of unsigned bytes of C language and storing the array in a C file at the precompilation stage of a firmware code of the electronic equipment; simultaneously recording the structure body variable of the picture in the C file; the structure body adopted by the structure body variable comprises a structure body and a data pointer, wherein the structure body comprises a flag bit, the flag bit is a first value and indicates that the data pointer points to binary data of a JPEG picture; the first saving unit is also used for compiling the C file into a code segment which is a binary file stored in a firmware image file in the compiling stage of the firmware code of the electronic equipment. The first display unit is used for calling a general picture decoding interface to determine that the picture type is in a JPEG format when the LVGL system frame needs to display a JPEG-format picture in a firmware file when the electronic equipment is started, then finding a structural body variable of the JPEG-format picture by a JPEG picture decoder, determining binary data of the JPEG-format picture pointed by a data pointer in the structural body variable according to a flag bit in the structural body variable, and finally finding an unsigned byte array according to the data pointer, namely the binary data of the JPEG-format picture; and the JPEG picture decoder decodes the binary RAW data of the JPEG format picture by calling an interface function of a JPEG decoding library to obtain data of the whole bitmap, and transmits the data of the whole bitmap to a drawing interface of the LVGL system frame for full bitmap display. The second storage unit is used for storing the JPEG-format pictures generated by the electronic equipment in the using process in a file system of the electronic equipment; each JPEG format picture is uniquely identified by different file paths; when the structure variable is stored, the character string data of the file path of the JPEG-format picture is stored into an array of C-language unsigned bytes, and a structure variable is newly built for the JPEG-format picture, wherein the structure adopted by the structure variable comprises a structure body and a data pointer, the structure body comprises a mark bit, and the mark bit is a second value and indicates that the data pointer points to the character string data of the file path of the JPEG-format picture. The second display unit is used for enabling the electronic equipment to call a general picture decoding interface to determine that the picture type is in a JPEG format when the LVGL system frame needs to display a JPEG-format picture in a file system in the using process, then a JPEG picture decoder finds a structural body variable of the JPEG-format picture, determines character string data of a file path of the JPEG-format picture pointed by a data pointer in the structural body variable according to a flag bit in the structural body variable, and finally finds the ASCII code of the file path character string stored in the file system of the JPEG-format picture; the JPEG picture decoder opens a file path through an opening function of the file system and reads out RAW data of the JPEG format picture through a reading operation function of the file system; and the JPEG picture decoder decodes the binary RAW data of the JPEG format picture by calling an interface function of a JPEG decoding library to obtain data of the whole bitmap, and transmits the data of the whole bitmap to a drawing interface of the LVGL system frame for full bitmap display. The system designs two JPEG format picture storing and reading methods in firmware and file system, and is suitable for displaying JPEG pictures on LVGL system frame.
The technical effect that this application gained is: the display function of JPEG pictures is expanded on the LVGL system framework with the minimum code volume, and bitmap data can be fully decomposed on the LVGL framework structure. Meanwhile, the whole volume of the firmware file can be ensured to be small, and the firmware file can be stored only in a flash memory (flash) space of 16MB for taking an intelligent child watch as an example. Meanwhile, the picture display effect and experience sense which can be comparable to those of android are realized, and the picture is refreshed smoothly.
Drawings
Fig. 1 is a flowchart of a JPEG format picture display method based on LVGL according to the present application.
Fig. 2 is a schematic structural diagram of a JPEG format picture display system based on LVGL according to the present application.
The reference numbers in the figures illustrate: 10 is an adding unit, 20 is a first storing unit, 30 is a first display unit, 40 is a second storing unit, and 50 is a second display unit.
Detailed Description
Referring to fig. 1, the JPEG format image display method based on LVGL according to the present application includes the following steps.
Step S10: the electronic device adopts the LVGL as a GUI system framework, and a general picture decoding interface, a JPEG picture decoder and a decoding library (hereinafter referred to as JPEG decoding library) required for decoding JPEG pictures are added in the LVGL system framework. This serves to add functionality to decode JPEG pictures in the LVGL system framework that does not natively support decoding JPEG pictures.
The universal picture decoding interface is a universal interface of decoders with different picture formats to an upper layer and is used for expanding and decoding pictures with various formats. The generic picture decoding interface provides a linked list (linked list) mechanism, in which decoders of different picture formats, such as a PNG picture decoder, a JPEG picture decoder, and a GIF picture decoder, are registered in a certain order. When the LVGL system framework analyzes a picture data, a 'read file type function' of a general picture decoding interface is called to access the data of the picture, and a byte which marks the picture type in the picture data is found. If the data type defined by a certain picture format decoder is registered according to the linked list of the general picture decoding interface, the general picture decoding interface returns the pointer of the operation function of the picture format decoder. For example, when the generic picture decoding interface finds that the byte indicating the picture type in a certain picture data is in the JPEG format, it returns a pointer to the operation function of the JPEG picture decoder to the upper layer function.
The JPEG picture decoder is used for decoding pictures in JPEG format. The JPEG picture decoder is provided with a general function interface which is in butt joint with the LVGL system frame and comprises an interface function for opening JEPG picture data, an interface function for closing the JEPG picture data and an interface function for returning picture types.
Step S20: in the pre-compiling stage of the firmware code of the electronic equipment, binary RAW (RAW) data of a JPEG format picture is stored into an array of unsigned bytes of C language and is stored in a C file. This array is the true data source for the JPEG format picture, and each unsigned byte in the array is the binary data of the RAW of the JPEG format picture. And simultaneously recording the structure body variable of the picture in the C file. The structure body adopted by the structure body variable comprises a structure body and a data pointer, wherein the structure body comprises a flag bit, and the flag bit is a first value and indicates that the data pointer points to binary data of the JPEG picture. And compiling the C file into a code segment which is a binary file and is stored in a firmware image file in a compiling stage of firmware codes of the electronic equipment.
The structure lv img dsc t of the original bitmap format picture in the LVGL system framework describes the head structure (header) related parameters and the length and pointer to the data array. The application improves the structure lv _ img _ dsc _ t, so that the structure lv _ img _ dsc _ t can be used for pictures in JPEG format.
The improved structure lv _ img _ dsc _ t for pictures in JPEG format comprises the following.
First portion, head structure. Which comprises the following steps: (1) header. always _ zero: 0 is input. (2) header. reserved: in the structure body variable of the original bitmap format picture, the parameter is not used, and belongs to a variable reserved for user customization. The present application uses the parameter as a flag to distinguish between different sources of JPEG data. When the flag bit is the first value. E.g., 0, indicating that the data pointer points to binary data for a JPEG format picture. When the flag bit is a second value, for example, 1, the flag bit indicates that the data pointer points to the string data of the file path of the JPEG format picture. (3) head.w: the width of the display of the input JPEG picture. (4) head.h: the length of the display of the input JPEG picture. (5) head.cf: it is recorded that the way the LVGL system framework interprets the picture is the JPEG picture decoder LV _ IMG _ CF _ RAW _ ALPHA. This means that the LVGL system framework translates the pixel bytes of the picture to the display component in a raw format with alpha channels that support transparency.
The second part, data size (data _ size), is the data length of a JPEG picture.
The third part, the data (data) pointer, points to an array of unsigned bytes in the C file. The bytes in the array are either bytes of binary data of the JPEG format picture or bytes of string data of a file path in which the JPEG format picture is recorded.
Step S30: when the electronic equipment is started, when the LVGL system frame needs to display a JPEG format picture in a firmware file, the LVGL system frame calls a general picture decoding interface to determine that the picture type is in a JPEG format, then a JPEG picture decoder finds a structural body variable of the JPEG format picture, determines that a data pointer in the structural body variable points to binary data of the JPEG format picture according to a flag bit head. And the JPEG picture decoder decodes the binary RAW data of the JPEG-formatted picture by calling an interface function of a JPEG decoding library to obtain data of the whole bitmap, and transmits the data of the whole bitmap to a drawing interface of the LVGL system frame for full bitmap display.
Step S40: JPEG format pictures generated by the electronic equipment in the using process are saved in a file system of the electronic equipment. For example, the electronic device needs to store JPEG format pictures by taking pictures, operating an album, downloading from a server, and the like during use. Each JPEG format picture is uniquely identified by a different file path. For example, the character string of the file path of the JPEG format picture includes a drive letter and a file name where the file is located. And when the data is stored, the character string data of the file path of the JPEG format picture is stored into an array of C language unsigned bytes. The unsigned bytes in this array are the bytes of the string (ASCII code) of the file path of the JPEG format picture. And a structural body variable is newly established for the JPEG format picture. The structure body adopted by the structure body variable comprises a structure body and a data pointer, wherein the structure body comprises a flag bit, the flag bit is a second value and indicates that the data pointer points to character string data of a file path of the JPEG-format picture.
This step still uses the modified structure lv img dsc t for pictures in JPEG format. The reserved flag bit in the header structure is a second value, for example, when the flag bit is 1, it indicates that the data pointer points to character string data (ASCII code) of a file path of the JPEG format picture. CF in the header structure records that the way LVGL system framework interprets the picture is JPEG picture decoder LV _ IMG _ CF _ RAW _ ALPHA.
Step S50: when the electronic equipment is used, when the LVGL system frame needs to display a JPEG-format picture in a file system, the LVGL system frame calls a general picture decoding interface to determine that the picture type is in a JPEG format, then a JPEG picture decoder finds a structural body variable of the JPEG-format picture, determines character string data of a file path of the JPEG-format picture pointed by a data pointer in the structural body variable according to a flag bit header. And the JPEG picture decoder opens a file path through an opening function of the file system and reads out RAW data of the JPEG format picture through a reading operation function of the file system. And the JPEG picture decoder decodes the binary RAW data of the JPEG-formatted picture by calling an interface function of a JPEG decoding library to obtain data of the whole bitmap, and transmits the data of the whole bitmap to a drawing interface of the LVGL system frame for full bitmap display.
Referring to fig. 2, the JPEG format image display system based on LVGL according to the present application includes an adding unit 10, a first saving unit 20, a first display unit 30, a second saving unit 40 and a second display unit 50.
The adding unit 10 is used for adding a general picture decoding interface, a JPEG picture decoder, and a decoding library (hereinafter referred to as JPEG decoding library) required for decoding JPEG pictures in the LVGL system frame in an electronic device adopting the LVGL system as a GUI system frame.
The first saving unit 20 is used for saving the binary RAW data of the JPEG format picture into an array of unsigned bytes of C language in the C file at the precompilation stage of the firmware code of the electronic device. And simultaneously recording the structure body variable of the picture in the C file. The structure body adopted by the structure body variable comprises a structure body and a data pointer, wherein the structure body comprises a flag bit, and the flag bit is a first value and indicates that the data pointer points to binary data of a JPEG picture. The first saving unit 20 is further configured to compile the C-file into a code segment that is stored in a binary file in a firmware image file during a compilation stage of firmware codes of the electronic device.
The first display unit 30 is configured to, when the electronic device is turned on, call a generic picture decoding interface to determine that the picture type is in a JPEG format when the LVGL system frame needs to display a JPEG-format picture in the firmware file, then find a structure variable of the JPEG-format picture by the JPEG system frame, determine that a data pointer in the structure variable points to binary data of the JPEG-format picture according to a flag bit header. And the JPEG picture decoder decodes the binary RAW data of the JPEG format picture by calling an interface function of a JPEG decoding library to obtain data of the whole bitmap, and transmits the data of the whole bitmap to a drawing interface of the LVGL system frame for full bitmap display.
The second saving unit 40 is used for saving the JPEG format pictures generated by the electronic equipment in the using process in a file system of the electronic equipment. Each JPEG format picture is uniquely identified by a different file path. And during storage, storing the character string data of the file path of the JPEG-format picture into an array of C-language unsigned bytes, and establishing a structural body variable for the JPEG-format picture. The structure body adopted by the structure body variable comprises a structure body and a data pointer, wherein the structure body comprises a flag bit, the flag bit is a second value and indicates that the data pointer points to character string data of a file path of the JPEG-format picture.
The second display unit 50 is configured to, in a use process of the electronic device, when the LVGL system frame needs to display a JPEG-format picture in the file system, call the generic picture decoding interface to determine that a picture type is in a JPEG format, then find a structure variable of the JPEG-format picture by the JPEG picture decoder, determine, according to a flag bit header in the structure variable, character string data of a file path of the JPEG-format picture pointed by a data pointer in the structure variable, and finally find an ASCII code of the file path character string stored in the file system of the JPEG-format picture. And the JPEG picture decoder opens a file path through an opening function of the file system and reads out RAW data of the JPEG format picture through a reading operation function of the file system. And the JPEG picture decoder decodes the binary RAW data of the JPEG-formatted picture by calling an interface function of a JPEG decoding library to obtain data of the whole bitmap, and transmits the data of the whole bitmap to a drawing interface of the LVGL system frame for full bitmap display.
In order to display the JPEG-format pictures on the LVGL system frame, two JPEG picture storage and reading modes are designed. In the firmware precompilation stage of the electronic device, RAW binary data of a JPEG picture is stored in an array of unsigned bytes in C language. During the use process of the electronic equipment, the character string of the JPEG picture saving path in the file system is saved in the array of the unsigned bytes of the C language. No matter the RAW binary data of the JPEG picture is directly read or the RAW binary data of the JPEG picture is indirectly read from a file path, the data of the JPEG picture is fully decompressed through a newly added general picture decoding interface, a JPEG picture decoder and a JPEG decoding library, the complete bitmap is filled into an internal memory, and the picture is drawn from the internal memory and displayed on a display component.
The above are merely preferred embodiments of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (8)

1. A JPEG format picture display method based on LVGL is characterized by comprising the following steps;
step S10: the electronic equipment adopts LVGL as a GUI system frame, and a general picture decoding interface, a JPEG picture decoder and a JPEG decoding library are added in the LVGL system frame;
step S20: at the pre-compiling stage of firmware codes of the electronic equipment, storing binary original RAW data of a JPEG-format picture into an array of unsigned bytes of C language and storing the array in a C file; simultaneously recording the structure variable of the picture in the C file; the structure body adopted by the structure body variable comprises a structure body and a data pointer, wherein the structure body comprises a flag bit, the flag bit is a first value and indicates that the data pointer points to binary original RAW data of a JPEG picture; compiling the C file into a binary file and storing the binary file into a code segment of a firmware image file at the compiling stage of a firmware code of the electronic equipment;
step S30: when the electronic equipment is started, when the LVGL system frame needs to display a JPEG format picture in a firmware file, the LVGL system frame calls a general picture decoding interface to determine that the picture type is in a JPEG format, then a JPEG picture decoder finds a structural body variable of the JPEG format picture, determines that a data pointer in the structural body variable points to binary original RAW data of the JPEG format picture according to a flag bit in the structural body variable, and finally finds an unsigned byte array, namely the binary original RAW data of the JPEG format picture according to the data pointer; the JPEG picture decoder decodes the binary original RAW data of the JPEG format picture by calling an interface function of a JPEG decoding library to obtain data of the whole bitmap, and the data is transmitted to a drawing interface of the LVGL system frame and used for full bitmap display;
step S40: JPEG format pictures generated by the electronic equipment in the using process are stored in a file system of the electronic equipment and are uniquely identified by different file paths; when the structure variable is stored, the character string data of the file path of the JPEG-format picture is stored into an array of C-language unsigned bytes, and a structure variable is newly built for the JPEG-format picture, wherein a structure adopted by the structure variable comprises a structure body and a data pointer, the structure body comprises a mark bit, and the mark bit is a second value and indicates that the data pointer points to the character string data of the file path of the JPEG-format picture;
step S50: when the electronic equipment is used, when the LVGL system frame needs to display a JPEG-format picture in a file system, the LVGL system frame calls a general picture decoding interface to determine that the picture type is in a JPEG format, then a JPEG picture decoder finds a structural body variable of the JPEG-format picture, determines character string data of a file path of the JPEG-format picture pointed by a data pointer in the structural body variable according to a flag bit in the structural body variable, and finally finds an ASCII code of the file path character string stored in the file system of the JPEG-format picture; the JPEG picture decoder opens a file path through an opening function of the file system and reads out binary original RAW data of the JPEG format picture through a reading operation function of the file system; and the JPEG picture decoder decodes the binary original RAW data of the JPEG-formatted picture by calling an interface function of a JPEG decoding library to obtain data of the whole bitmap, and transmits the data of the whole bitmap to a drawing interface of the LVGL system frame for full bitmap display.
2. The method according to claim 1, wherein in step S10, the generic picture decoding interface is a generic interface of a decoder with different picture formats to an upper layer, and the decoder with different picture formats is registered; when the LVGL system framework analyzes a picture data, a 'read file type function' of a general picture decoding interface is called to access the data of the picture, and a byte which marks the picture type in the picture data is found; if the data type defined by a certain picture format decoder registered by the universal picture decoding interface is met, the universal picture decoding interface returns a pointer of an operation function of the picture format decoder.
3. The JPEG-format picture display method based on LVGL of claim 2, wherein said general picture decoding interface adopts a linked list mechanism to sequentially register the PNG picture decoder, the JPEG picture decoder, and the GIF picture decoder.
4. The LVGL-based JPEG format picture display method in accordance with claim 1, wherein in said step S10, said JPEG picture decoder is configured to decode JPEG format pictures; the JPEG picture decoder is provided with a general function interface which is in butt joint with the LVGL system frame and comprises an interface function for opening JEPG picture data, an interface function for closing the JEPG picture data and an interface function for returning picture types.
5. The method according to claim 1, wherein the texture variable is a modified texture lv img dsc _ t for JPEG format pictures, comprising a texture structure and data pointers in step S20;
the head structure comprises a flag bit header; the flag bit is a first value, which indicates that the data pointer points to binary data of the JPEG format picture;
the data pointer points to an array of unsigned bytes in the C file; the bytes in the array are either bytes of binary data of the JPEG format picture.
6. The method as claimed in claim 5, wherein in step S40, the texture variable is a modified texture lv img dsc _ t for JPEG format pictures, and comprises a texture structure and a data pointer;
the head structure comprises a flag bit header; the flag bit is a second value and indicates that the data pointer points to the character string data of the file path of the JPEG-format picture;
the data pointer points to an array of unsigned bytes in the C file; the bytes in the array are bytes of string data that record the file path of a JPEG format picture.
7. The method as claimed in claim 5 or 6, wherein in step S20 or S40, the header structure further includes a decoder identifier header.cf, and the manner of interpreting JPEG-formatted pictures by LVGL system frame is recorded as a JPEG picture decoder LV _ IMG _ CF _ RAW _ ALPHA; this means that the LVGL system framework translates the pixel bytes of the picture to the display component in the manner of a transparency-enabled alpha channel in RAW format.
8. A JPEG format picture display system based on LVGL is characterized by comprising an adding unit, a first storage unit, a first display unit, a second storage unit and a second display unit;
the adding unit is used for adding a general picture decoding interface, a JPEG picture decoder and a JPEG decoding library in the LVGL system frame in the electronic equipment adopting the LVGL as the GUI system frame;
the first storage unit is used for storing binary original RAW data of a JPEG-format picture into an array of unsigned bytes of C language and storing the array in a C file at the pre-compiling stage of a firmware code of the electronic equipment; simultaneously recording the structure variable of the picture in the C file; the structure body adopted by the structure body variable comprises a structure body and a data pointer, wherein the structure body comprises a flag bit, the flag bit is a first value and indicates that the data pointer points to binary original RAW data of a JPEG picture; the first saving unit is also used for compiling the C file into a binary file and storing the binary file into a code segment of a firmware image file in a compiling stage of firmware codes of the electronic equipment;
the first display unit is used for calling a general picture decoding interface to determine that the picture type is in a JPEG format when the LVGL system frame needs to display a JPEG-format picture in a firmware file when the electronic equipment is started, then finding a structural variable of the JPEG-format picture by a JPEG picture decoder, determining binary original RAW data of the JPEG-format picture pointed by a data pointer in the structural variable according to a flag bit in the structural variable, and finally finding an unsigned byte array according to the data pointer, namely the binary original RAW data of the JPEG-format picture; the JPEG picture decoder decodes the binary original RAW data of the JPEG format picture by calling an interface function of a JPEG decoding library to obtain data of the whole bitmap, and the data is transmitted to a drawing interface of the LVGL system frame and used for full bitmap display;
the second saving unit is used for saving the JPEG format picture generated in the using process of the electronic equipment in a file system of the electronic equipment; each JPEG format picture is uniquely identified by different file paths; when in storage, the character string data of the file path of the JPEG format picture is stored into an array of C language unsigned bytes, and a structure body variable is newly built for the JPEG format picture; the structure body adopted by the structure body variable comprises a structure body and a data pointer, wherein the structure body comprises a flag bit, the flag bit is a second value and indicates that the data pointer points to character string data of a file path of the JPEG-format picture;
the second display unit is used for enabling the electronic equipment to call a general picture decoding interface to determine that the picture type is in a JPEG format when the LVGL system frame needs to display a JPEG-format picture in a file system in the using process, then a JPEG picture decoder finds a structure variable of the JPEG-format picture, determines character string data of a file path of the JPEG-format picture pointed by a data pointer in the structure variable according to a flag bit in the structure variable, and finally finds an ASCII code of the file path character string stored in the file system of the JPEG-format picture; the JPEG picture decoder opens a file path through an opening function of the file system and reads out binary original RAW data of the JPEG format picture through a reading operation function of the file system; and the JPEG picture decoder decodes the binary original RAW data of the JPEG format picture by calling an interface function of a JPEG decoding library to obtain data of the whole bitmap, and transmits the data of the whole bitmap to a drawing interface of the LVGL system frame for full bitmap display.
CN202110537981.3A 2021-05-18 2021-05-18 JPEG format picture display method and system based on LVGL Active CN113326085B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110537981.3A CN113326085B (en) 2021-05-18 2021-05-18 JPEG format picture display method and system based on LVGL

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110537981.3A CN113326085B (en) 2021-05-18 2021-05-18 JPEG format picture display method and system based on LVGL

Publications (2)

Publication Number Publication Date
CN113326085A CN113326085A (en) 2021-08-31
CN113326085B true CN113326085B (en) 2022-08-23

Family

ID=77415782

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110537981.3A Active CN113326085B (en) 2021-05-18 2021-05-18 JPEG format picture display method and system based on LVGL

Country Status (1)

Country Link
CN (1) CN113326085B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7224891B1 (en) * 2002-02-13 2007-05-29 Hewlett-Packard Development Company, L.P. Digital photograph presentation using DVD players
CN104133796A (en) * 2014-08-15 2014-11-05 广东欧珀移动通信有限公司 Method and device for coding and decoding image in smart mobile terminal LK
CN106210724A (en) * 2016-07-21 2016-12-07 腾讯科技(深圳)有限公司 Picture decoding method and device
CN107066609A (en) * 2017-04-27 2017-08-18 北京京东尚科信息技术有限公司 Image display method and device
CN108629729A (en) * 2018-04-26 2018-10-09 珠海亿智电子科技有限公司 A kind of method that picture is shown
CN112130948A (en) * 2020-09-25 2020-12-25 Oppo广东移动通信有限公司 Display control method and device, computer readable medium and electronic device
CN112199087A (en) * 2020-10-13 2021-01-08 Oppo广东移动通信有限公司 Configuration method, device, equipment and storage medium of application development environment
CN112241932A (en) * 2019-07-19 2021-01-19 华为技术有限公司 Picture processing method and device
CN112562022A (en) * 2021-01-25 2021-03-26 翱捷科技股份有限公司 Picture display method and system of electronic equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4978334B2 (en) * 2006-09-25 2012-07-18 セイコーエプソン株式会社 Image processing apparatus, RAW file information display method, and computer program
WO2015041652A1 (en) * 2013-09-19 2015-03-26 Entropic Communications, Inc. A progressive jpeg bitstream transcoder and decoder
US10447965B2 (en) * 2016-10-04 2019-10-15 39Degrees C Inc. Apparatus and method for processing image

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7224891B1 (en) * 2002-02-13 2007-05-29 Hewlett-Packard Development Company, L.P. Digital photograph presentation using DVD players
CN104133796A (en) * 2014-08-15 2014-11-05 广东欧珀移动通信有限公司 Method and device for coding and decoding image in smart mobile terminal LK
CN106210724A (en) * 2016-07-21 2016-12-07 腾讯科技(深圳)有限公司 Picture decoding method and device
CN107066609A (en) * 2017-04-27 2017-08-18 北京京东尚科信息技术有限公司 Image display method and device
CN108629729A (en) * 2018-04-26 2018-10-09 珠海亿智电子科技有限公司 A kind of method that picture is shown
CN112241932A (en) * 2019-07-19 2021-01-19 华为技术有限公司 Picture processing method and device
CN112130948A (en) * 2020-09-25 2020-12-25 Oppo广东移动通信有限公司 Display control method and device, computer readable medium and electronic device
CN112199087A (en) * 2020-10-13 2021-01-08 Oppo广东移动通信有限公司 Configuration method, device, equipment and storage medium of application development environment
CN112562022A (en) * 2021-01-25 2021-03-26 翱捷科技股份有限公司 Picture display method and system of electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ARTcode: Preserve Art and Code In Any Image;Yang, Z等;《ACM International Joint Conference on Pervasive and Ubiquitous Computing (UbiComp)》;20160101;第904-915页 *
基于Linux系统控制的广告系统模块化设计;倪元相等;《LVGL》;20191231(第24期);第129-131页 *

Also Published As

Publication number Publication date
CN113326085A (en) 2021-08-31

Similar Documents

Publication Publication Date Title
CN100430931C (en) Non-time dependent synchronization of databases
US7330100B2 (en) Mobile device and related method for displaying text message with background images
CN1232118C (en) Method and system of displaying teletext information on mobile devices
CN102984151B (en) Method and the server of image data are provided to computing terminal
CN112562022A (en) Picture display method and system of electronic equipment
CN101300622A (en) Method of managing fonts in multimedia scenes and corresponding computer program and terminal
CN102932671A (en) Method and server for supplying picture to computing terminal
US20130215151A1 (en) Apparatus and method of encoding and decoding image files
AU2001286213B2 (en) Motion picture reproducing middleware selecting/ executing device and method
CN100394773C (en) Film converting edition apparatus and method
CN113326086B (en) GIF picture display method and device based on LVGL
CN113326085B (en) JPEG format picture display method and system based on LVGL
CN103136208B (en) A kind of method of Showing Picture and device
US8457419B2 (en) Method of decoding entropy-encoded data
CN114371844B (en) APP development platform, APP development method and electronic equipment
CN103634475B (en) The method of display network title and mobile terminal on mobile terminal
CN109597620B (en) Data processing method, device, equipment and storage medium
US20100257188A1 (en) Method and apparatus for providing/receiving stereoscopic image data download service in digital broadcasting system
US6650709B2 (en) Image decoding device, image decoding method, and storage medium and integrated circuit thereof
JPWO2015052968A1 (en) Server apparatus, client apparatus, information processing method, and recording medium
CN102256221B (en) Rapid multimedia color display transmission method
CN113099270A (en) File storage method, decoding method, device, storage medium and electronic device
JP3847539B2 (en) Image information processing device
JP3146920U (en) Advertisement display device
US20050231324A1 (en) System and method for converting message type

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant