Data Processing Method, System, and Electronic Device
By dividing the image data into data blocks according to pixel values and compressing them into compression units, the problems of large amount of data, long transmission time and high power consumption in low-power electronic devices are solved, and the data amount and storage space are reduced, which is suitable for low-performance processors.
Patent Information
- Application Number
- CN202010899685.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-31
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2041-01-17
AI Technical Summary
In the prior art In low-power electronic devices, there are problems such as large data volume, long transmission time, high power consumption, and high processor computing power and storage space requirements during the transmission and processing of image data.
By dividing the image data into data blocks according to pixel values, compressing it into a compression unit using compression parameters, the generated compression unit data amount is smaller than the data set to be compressed, and then decompressed after transmission, reducing the data amount and storage space requirements.
It reduces the amount and time of data transmission between electronic devices, reduces power consumption, is suitable for low-performance processors, and saves storage resources and processing costs.
Smart Images

Figure CN114125456B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of display technologies, and in particular, to a data processing method and system, and an electronic device. Background Art
[0002] With the development of technologies, electronic devices such as display devices are becoming more and more intelligent, with more diverse functions, and the mutual transmission of resources between different electronic devices is also becoming more extensive. Summary of the Invention
[0003] Embodiments of the present disclosure provide a data processing method and system, and an electronic device, which can reduce power consumption.
[0004] To achieve the above object, the embodiments of the present disclosure adopt the following technical solutions:
[0005] On the one hand, a data processing method is provided. The data processing method includes: obtaining first image data; compressing at least one data set to be compressed in the first image data into corresponding compression units according to compression parameters to obtain second image data including the compression units. Wherein, the first image data includes a plurality of pixel values arranged continuously, the plurality of pixel values are divided into a plurality of data blocks according to the order of pixel value arrangement, each data block occupies one byte and includes at least one pixel value.
[0006] A data set to be compressed includes at least one data group. When the data set to be compressed includes at least two data groups, the at least two data groups are arranged continuously and are the same; each data group includes at least one of the data blocks. When the data group includes at least two data blocks, the at least two data blocks are arranged continuously. The compression parameters include a first length, and the first length is configured to represent the number of data blocks in the data group; the compression unit includes one data group in the data set to be compressed and a second length, and the second length is configured to represent the number of data groups in the data set to be compressed.
[0007] In some embodiments, the step of compressing at least one data set to be compressed in the first image data into corresponding compression units according to compression parameters includes: sequentially reading data groups from the data to be compressed in the first image data according to the first length; starting from the first data group, determining one by one whether the subsequent data group is the same as the current data group until the subsequent data group is different from the current data group, or the number of the same data groups exceeds a set value; wherein the same data groups constitute the data set to be compressed; generating a compression unit corresponding to the data set to be compressed according to one data group in the same data groups and the second length.
[0008] In some embodiments, compressing at least one data set to be compressed in the first image data into corresponding compression units according to the compression parameter further includes: setting the second length to zero or one; starting from the first data group, in response to the subsequent data group being the same as the current data group, increasing the second length by one until the subsequent data group is different from the current data group or the number of identical data groups exceeds a set value, so as to obtain a second length that can represent the number of identical data groups in the data set to be compressed.
[0009] In some embodiments, the compression parameter further includes a third length; the third length is configured to represent the size of the storage space of the compression unit. Generating a compression unit corresponding to the data set to be compressed according to one data group in the identical data groups and the second length includes: writing one data group of the data set to be compressed and the second length into a storage space with the third length to generate a compression unit corresponding to the data set to be compressed.
[0010] In some embodiments, one data group included in the compression unit is the first data group of the data set to be compressed.
[0011] In some embodiments, the data groups sequentially read from the data to be compressed in the first image data according to the first length include: except for the first data group, obtaining a data group from the data to be compressed in the first image data when the length of the processed data is less than the length of the first image data before obtaining each data group.
[0012] In some embodiments, the compression parameter is a plurality of compression parameters; the plurality of compression parameters are not completely the same. Compressing at least one data set to be compressed in the first image data into corresponding compression units according to the compression parameter to obtain a second image data including the compression units includes: compressing the data set to be compressed in the first image data into corresponding compression units according to each compression parameter in the plurality of compression parameters to generate a third image data including the compression units; selecting the third image data with the smallest length or the third image data with a length less than a threshold from the plurality of third image data as the second image data.
[0013] In some embodiments, compressing at least one data set to be compressed in the first image data into corresponding compression units according to the compression parameter includes: when the data to be compressed in the first image data is not empty and the number of bytes occupied by the data to be compressed is less than the number of bytes occupied by one data group, writing zeros after the data to be compressed to make up the data to be compressed to one data group.
[0014] In some embodiments, the second image data further includes the compression parameter.
[0015] In some embodiments, the number of data blocks included in the data group is 1 to 4.
[0016] On the other hand, a data processing method is provided. The data processing method includes: obtaining second image data; the second image data includes at least one compression unit; one compression unit includes a data group and a second length; according to the compression parameter, decompressing the compression unit in the second image data into a corresponding decompressed data set to obtain fourth image data.
[0017] The compression parameter includes a first length, and the first length is configured to represent the number of data blocks in the data group. The second length is configured to represent the number of data groups in the decompressed data set corresponding to the compression unit. The decompressed data set includes at least one of the data groups, and in the case where the decompressed data set includes at least two of the data groups, at least two of the data groups are arranged continuously. Each data group includes at least one of the data blocks. In the case where the data group includes at least two data blocks, the at least two data blocks are arranged continuously. The fourth image data includes a plurality of the data blocks arranged continuously, and each data block includes a plurality of pixel values arranged continuously.
[0018] In some embodiments, the decompressing the compression unit in the second image data into a corresponding decompressed data set according to the compression parameter includes: reading the data group in the compression unit according to the first length; and copying the data group according to the second length to generate the decompressed data set.
[0019] In some embodiments, the compression parameter further includes a third length; the third length is configured to represent the size of the storage space of the compression unit. The decompressing the compression unit in the second image data into a corresponding decompressed data set according to the compression parameter further includes: reading the compression unit in the second image data according to the third length, and decompressing the compression unit into a corresponding decompressed data set.
[0020] In some embodiments, the second image data further includes the length of the first image data. The data processing method further includes: in the case where the length of the decompressed data is greater than the length of the first image data, deleting a part of the data at the end of the decompressed data that exceeds the length of the first image data to obtain the first image data.
[0021] In another aspect, an electronic device is provided. The electronic device includes a memory and a processor. The processor is coupled to the memory. One or more computer program instructions are stored in the memory. The processor is configured to execute the one or more computer program instructions so that the electronic device implements the data processing method as described in any of the above embodiments.
[0022] In another aspect, a data processing system is provided. The data processing system includes: a first electronic device and a second electronic device. The first electronic device is coupled to the second electronic device. The first electronic device is configured to implement the data processing method as described in the above embodiments. The second electronic device is configured to implement the data processing method as described in the above embodiments.
[0023] In yet another aspect, a computer non-transitory readable storage medium is provided. The computer readable storage medium stores computer program instructions that, when run on a processor, cause the computer to execute the data processing method as described in any of the above embodiments.
[0024] In another aspect, a computer program product is provided. The computer program product includes computer program instructions that, when executed on a computer, cause the computer to execute the data processing method as described in any of the above embodiments.
[0025] In another aspect, a computer program is provided. When the computer program is executed on a computer, the computer program causes the computer to execute the data processing method as described in any of the above embodiments.
[0026] In summary, the embodiments of the present disclosure provide a data processing method, system, and electronic device. The first image data is compressed, and the data volume of the generated compression unit is smaller than the data volume of the corresponding data set to be compressed. The data volume of the second image data including the compression unit is also smaller than the data volume of the first image data. Therefore, when the electronic device compresses the first image data into the second image data and then transmits it, the amount of data transmitted can be reduced, the data transmission time can be shortened, the data transmission pressure between electronic devices can be reduced, the power consumption can be reduced, and it can be applied to electronic devices with low-performance processors. In addition, the storage resources required for the electronic device to store the second image data and the data processing resources required in the process of compressing the first image data to obtain the second image data can be reduced, saving the cost of the electronic device for image data processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] To more clearly illustrate the technical solutions in the present disclosure, the following will briefly introduce the accompanying drawings required for use in some embodiments of the present disclosure. Obviously, the accompanying drawings in the following description are only the accompanying drawings of some embodiments of the present disclosure. For those of ordinary skill in the art, other accompanying drawings can also be obtained based on these drawings. In addition, the accompanying drawings in the following description can be regarded as schematic diagrams, and are not limitations on the actual dimensions of the products, the actual processes of the methods, the actual timings of the signals, etc. involved in the embodiments of the present disclosure.
[0028] Figure 1 It is a structural diagram of a data processing system according to some embodiments;
[0029] Figure 2 It is a structural diagram of an electronic device according to some embodiments;
[0030] Figure 3 It is a flowchart of a data processing method according to some embodiments;
[0031] Figure 4A It is a distribution diagram of pixels according to some embodiments;
[0032] Figure 4B It is a distribution diagram of first image data according to some embodiments;
[0033] Figure 5 It is a structural diagram of a compression unit according to some embodiments;
[0034] Figure 6 It is a process diagram of a data processing method according to some embodiments;
[0035] Figure 7 It is another flowchart of a data processing method according to some embodiments;
[0036] Figure 8 It is yet another flowchart of a data processing method according to some embodiments;
[0037] Figure 9 It is yet another flowchart of a data processing method according to some embodiments;
[0038] Figure 10 It is yet another flowchart of a data processing method according to some embodiments;
[0039] Figure 11 It is yet another flowchart of a data processing method according to some embodiments;
[0040] Figure 12 It is yet another flowchart of a data processing method according to some embodiments;
[0041] Figure 13Another flowchart of a data processing method according to some embodiments;
[0042] Figure 14 Another flowchart of a data processing method according to some embodiments;
[0043] Figure 15 Another flowchart of a data processing method according to some embodiments;
[0044] Figure 16 Another flowchart of a data processing method according to some embodiments;
[0045] Figure 17 A structural diagram of a data processing device according to some embodiments;
[0046] Figure 18 Another structural diagram of a data processing device according to some embodiments. Detailed implementation manners
[0047] Next, in combination with the accompanying drawings, the technical solutions in some embodiments of the present disclosure will be clearly and completely described. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments provided by the present disclosure, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present disclosure.
[0048] Unless the context requires otherwise, throughout the specification and claims, the term "comprise" and its other forms, such as the third-person singular form "comprises" and the present participle form "comprising", are interpreted as open and inclusive, that is, "including, but not limited to". In the description of the specification, the terms "one embodiment", "some embodiments", "exemplary embodiments", "example", "specific example", or "some examples", etc., are intended to indicate that the specific features, structures, materials, or characteristics related to the embodiment or example are included in at least one embodiment or example of the present disclosure. The schematic representations of the above terms do not necessarily refer to the same embodiment or example. In addition, the described specific features, structures, materials, or characteristics may be included in any one or more embodiments or examples in any appropriate manner.
[0049] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present disclosure, unless otherwise specified, the meaning of "a plurality of" is two or more.
[0050] When describing some embodiments, the expressions "coupled" and "connected" and their derivatives may be used. For example, when describing some embodiments, the term "connected" may be used to indicate that two or more components have direct physical or electrical contact with each other. Also, for example, when describing some embodiments, the term "coupled" may be used to indicate that two or more components have direct physical or electrical contact. However, the term "coupled" or "communicatively coupled" may also mean that two or more components do not have direct contact with each other but still cooperate or interact with each other. The embodiments disclosed herein are not necessarily limited to the content herein.
[0051] The use of "adapted to" or "configured to" herein means open and inclusive language that does not exclude devices adapted to or configured to perform additional tasks or steps.
[0052] Embodiments of the present disclosure provide a data processing system 200, as Figure 1 shown, the data processing system 200 includes a first electronic device 100A and a second electronic device 100B, which are coupled to each other.
[0053] Exemplarily, the first electronic device 100A can establish a connection with the second electronic device 100B through a wireless communication method, for example, Wi-Fi (Wireless-Fidelity), Bluetooth, etc. For example, the second electronic device 100B is connected to a wireless router or a wireless access point (Access Point, AP) through a wireless communication method or a wired communication method, and the first electronic device 100A establishes a connection with the wireless router or the wireless access point through a wireless communication method, and then communicates with the second electronic device 100B. Of course, the communication connection method in the embodiments of the present disclosure is not limited to this. For example, the second electronic device 100B and the first electronic device 100A can also establish a connection through a wired communication method.
[0054] Among them, the first electronic device 100A and the second electronic device 100B can be applied to various scenarios. For example, the first electronic device 100A can be a desktop computer, a portable computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, an embedded device, etc. The second electronic device 100B can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant, etc. The specific types of the first electronic device 100A and the second electronic device 100B are not limited in the embodiments of the present disclosure.
[0055] Embodiments of the present disclosure provide an electronic device 100, such as Figure 2 shown, the electronic device 100 includes a memory 101 and a processor 102. The memory 101 and the processor 102 are coupled.
[0056] One or more computer program instructions that can run on the processor 102 are stored in the memory 101.
[0057] When the processor 102 executes the computer program, the electronic device 100 is enabled to implement the data processing method in the following embodiments.
[0058] Exemplarily, the above-mentioned processor 102 can be a single processor or a collective term for multiple processing elements. For example, the processor 102 can be a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present disclosure solution, such as: one or more microprocessors, or one or more field programmable gate arrays.
[0059] The above-mentioned memory 101 can be a single memory or a collective term for multiple storage elements, and is used to store executable program codes, etc. For example, the memory can be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or can also be an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store the desired program codes in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0060] Among them, the memory 101 is used to store computer program instructions (such as application program codes) for executing the solution of the present disclosure, and is controlled by the processor 102 for execution. The processor 102 is used to execute the computer program instructions stored in the memory 101 to control the electronic device 100 to implement the data processing method provided in the following embodiments of the present disclosure.
[0061] In some embodiments, the first electronic device 100A and the second electronic device 100B in the above-mentioned data processing system 200 can both adopt the above-mentioned electronic device 100, that is, the data processing system 200 includes two electronic devices 100 that communicate with each other, where one electronic device 100 serves as the first electronic device 100A and the other electronic device 100 serves as the second electronic device 100B.
[0062] In some embodiments, such as Figure 2As shown, the electronic device 100 further includes a display screen 103 and a communication device 104. Both the display screen 103 and the communication device 104 are coupled to the processor 102. The display screen 103 is configured to display an image under the control of the processor 102. For example, the display screen 103 is an electronic ink screen; the communication device 104 is a device for information interaction with an external device (AP or wireless router), so as to send data or commands to the external device or receive data or commands sent by the external device under the control of the processor 102. For example, the communication device 104 may be a transceiver, a transceiver circuit, a transmitter, a receiver, etc.; for example, it may be a wireless communication device such as a Wi-Fi device, a Bluetooth device, or a wired communication device such as a universal serial bus (USB) interface. Among them, the Wi-Fi device provides network access for the electronic device 100 that complies with Wi-Fi related standard protocols. The Bluetooth device may be an integrated circuit or a Bluetooth chip, etc. As an example, the communication device 104 and the processor 102 may be provided separately or integrated together.
[0063] Among them, in the process of data transmission between two electronic devices 100, for example, the first electronic device 100A obtains an image data (such as the first image data in the following text), processes the image data (such as compresses), obtains the compressed image data (such as the second image data in the following text), and sends the compressed image data to the second electronic device 100B. Correspondingly, the second electronic device 100B receives the compressed image data, processes the compressed image data (such as decompresses), obtains the decompressed image data (such as the fourth image data in the following text), and the second electronic device 100B can display according to the decompressed image data.
[0064] Exemplarily, the first electronic device 100A is configured to control the image (i.e., the screen) displayed on the second electronic device 100B. For example, the first electronic device 100A may not perform display. For example, the first electronic device 100A may not include a display screen. At this time, the first electronic device 100A may be a server or a terminal. The terminal may be a personal computer (PC), such as a desktop computer, a laptop computer, a tablet computer, and a superbook, etc.; it may also be a handheld terminal such as a mobile phone. Exemplarily, the first electronic device 100A and the second electronic device 100B may also both be display devices.
[0065] Exemplarily, when the electronic device 100 (such as the second electronic device 100B) is a display device, for example, the display device can be a monitor, or a product including a monitor, such as an Electronic Paper Display (EPD), a television, a computer (all-in-one or desktop), a tablet computer, a mobile phone, an electronic painting screen, etc. For example, the EPD can be applied to various scenarios. For example, the EPD device 100 can be an e-reader, a smart tag (also known as an electronic tag), an electronic watch (such as an electronic wristwatch), a thermometer, a bus stop sign, and a gas price sign at a gas station, etc. Among them, the smart tag can include: an electronic price tag that can be placed on the shelves of supermarkets, convenience stores, pharmacies, etc., a luggage tag, and a drug tag set on the drug package, etc.
[0066] Currently, for some low-power electronic devices, they can be widely applied to scenarios such as shopping malls, offices, and transportation. For example, EPD electronic devices have advantages such as low power consumption, energy saving, and eye protection, and can be applied to small-sized electronic devices such as handheld e-reader devices (such as e-books) or shelf tags. Among them, the EPD electronic device (or EPD display device) can update the display content by means of wireless transmission. Since the EPD electronic device is mainly applied to low-power scenarios, in the process of directly transmitting uncompressed images, although the image size can be guaranteed to be fixed, the amount of data transmitted is relatively large, which easily leads to a long data transmission time, resulting in a relatively large power consumption of the display device and affecting the performance of the display device. Moreover, the computing power and storage space (such as RAM) of the processor of the EPD electronic device are relatively low. In the process of processing data, the requirements for the capabilities of the processor of the display device are relatively high, and it is relatively difficult for the EPD electronic device to perform data processing (such as compression or decompression).
[0067] Exemplarily, a base map (or background image) can be pre-stored in the electronic device, or the base map can be separately transmitted to the electronic device, and only the text information is updated to reduce the transmission time. However, in this way, the electronic device needs to be built with a font library chip, and generating a picture of Chinese characters requires a large amount of computing power and storage space, which will increase the cost and power consumption of the electronic device. In addition, the base map is not easy to change, making the display of the electronic device monotonous. Exemplarily, some compression algorithms with relatively high image data compression ratios (i.e., the ratio of the size occupied before compression to the actual size occupied) can be used, such as JPEG (Joint Photographic Experts Group) format, TIFF (Tag Image File Format) format, GIF (Graphic Interchange Format) format, or RAW format, etc., to reduce the amount of data transmitted and shorten the transmission time. However, in this way, the computing power requirement of the electronic device during decompression is relatively high, and the storage space (such as random access memory) occupies more, thus increasing the cost of the electronic device.
[0068] Embodiments of the present disclosure provide a data processing method, which is applied to the above-mentioned electronic device 100, for example, applied to the above-mentioned first electronic device 100A. As Figure 3 shown, the data processing method includes the following steps:
[0069] S10. Obtain first image data. Among them, the first image data includes a plurality of pixel values arranged continuously. The plurality of pixel values are divided into a plurality of data blocks according to the arranged order. Each data block occupies one byte and contains at least one pixel value.
[0070] Exemplarily, the arrangement order of the plurality of pixel values in the first image data is related to the display order of the pixels when the first image data is displayed. For example, if the pixels are displayed row by row when the first image is displayed, the arrangement of the plurality of pixel values in the first image data is also row by row. For example, for each row of pixels, the pixel values of the first column of pixels to the pixel values of the last column of pixels are arranged in sequence. For adjacent two rows of pixels, the pixel value of the first column of pixels in the latter row is located after the pixel value of the last column of pixels in the former row. For example, referring to Figure 4A , the first image data is displayed row by row through the pixels of the i-th row and the j-th column when displayed. Both i and j are positive integers. The pixel of the u-th row and the v-th column is represented as R u-v , 0 ≤ u ≤ i, 0 ≤ v ≤ j, and both u and v are integers. Among them, a row of pixels is a row of pixels arranged horizontally along the X direction in FIG. 4, and a column of pixels is a row of pixels arranged vertically along the Y direction in FIG. 4. For example, R 1-1 to pixel R 1-j are the first row of pixels, and pixel R 1-1 to pixel R i-1are the first column of pixels. For example, the pixel R of the pixel in the u-th row and v-th column u-v is represented by the pixel value P u-v , and multiple pixel values in the first image data are in the order of (P 1-1 , P 1-2 , P 1-3 ……P 1-j , P 2-1 , P 2-2 ……P 2-j ……P u-1 ……P u-v ……P i-1 , P i-2 ……P i-j ) and arranged continuously in sequence.
[0071] Among them, the pixel value can be used to characterize the color information of each pixel, and the pixel value can be represented by bit positions. For a non-gradient image (picture), there are fewer types of colors displayed by each pixel in this image, and there is no gradient change in brightness and chromaticity for each color. The pixel value of each pixel can be represented by 2 to 4 bit positions. For example, when each pixel can display two colors and each color can be represented by 1 bit position, for example, when the two colors displayed by each pixel are black and white respectively, the pixel value of black is 0 and the pixel value of white is 1. For example, when each pixel can display four colors and each color can be represented by 2 bit positions, for example, when the four colors displayed by each pixel are black, white, red, and purple respectively, the pixel value of black is 11, the pixel value of white is 00, the pixel value of red is 10, and the pixel value of purple is 01. For example, as Figure 4B shown, the display image corresponding to the first image data is the number "13". The pixel value of the pixel corresponding to "1" in the image is 10, "1" is red, the pixel value of the pixel corresponding to "3" is 11, "3" is black, and the pixel values of the pixels corresponding to the remaining parts are 00, and the remaining parts are white.
[0072] Exemplarily, starting from the pixel value P 1-1 of the pixel in the first row and first column, to the pixel value P i-j of the pixel in the i-th row and j-th column, the first image data is divided into multiple data blocks, and each data block occupies one byte. For example, when each pixel value is represented by 1 bit position, each data block contains the pixel values of eight pixels. For example, the first data block is (P 1-1 , P 1-2 , P 1-3 , P 1-4 , P 1-5 , P 1-6 , P 1-7 , P 1-8 ), and the second data block is (P 1-9 , P1-10 , P 1-11 , P 1-12 , P 1-13 , P 1-14 , P 1-15 , P 1-16 ). For example, when each pixel value is represented by two bits, each data block contains the pixel values of four pixels. For example, the first data block is (P 1-1 , P 1-2 , P 1-3 , P 1-4 ), and the second data block is (P 1-5 , P 1-6 , P 1-7 , P 1-8 ).
[0073] S20. Compress at least one data set to be compressed in the first image data into corresponding compression units according to the compression parameters to obtain second image data containing the compression units.
[0074] Among them, the first image data contains at least one data set to be compressed. A data set to be compressed contains at least one data group. When the data set to be compressed contains at least two data groups, the at least two data groups are arranged continuously and are the same. Each data group includes at least one data block. When the data group contains at least two data blocks, the at least two data blocks are arranged continuously.
[0075] For example, each data group can contain two data blocks. For example, the first data block (P 1-1 , P 1-2 , P 1-3 , P 1-4 ) and the second data block (P 1-5 , P 1-6 , P 1-7 , P 1-8 ) form a data group. Or, each data group can contain one data block. For example, the first data group contains the first data block (P 1-1 , P 1-2 , P 1-3 , P 1-4 ), and the second data group contains the second data block (P 1-5 , P 1-6 , P 1-7 , P 1-8) Among them, the first data group and the second data group are arranged continuously. When the first data group is the same as the second data group, a data set to be compressed including the first data group and the second data group can be obtained. When the first data group is different from the second data group, a data set to be compressed including the first data group and another data set to be compressed including the second data group can be obtained.
[0076] Among them, the compression parameter includes a first length. The first length is configured to represent the number of data blocks in the data group. The compression unit includes a data group in the data set to be compressed and a second length, and the second length is configured to represent the number of data groups in the data set to be compressed.
[0077] For example, the first length may represent the number of bytes occupied by the data blocks in the data group. For example, the first length may represent the size of the storage space (i.e., the number of bytes). For example, the first length is 2 bytes. At this time, the data blocks in the data group represented by the first length occupy 2 bytes, that is, the number of data blocks is 2. Or, the first length may represent a number. For example, the value of the first length is 2. At this time, the number of data blocks in the data group represented by the first length is 2, and 2 data blocks occupy 2 bytes. At this time, the first length may also be 2 bytes. The second length may represent the number of repetitions of the data groups in the data set to be compressed. For example, the value of the second length is 1, and the value 1 can be represented as 00000001, representing that the data groups in the data set to be compressed are repeated 1 time. At this time, there are 2 data groups in the data set to be compressed. In this case, if the number of repetitions of the data groups in the data set to be compressed is within 255 times, the second length occupies 1 byte; if the number of repetitions of the data groups in the data set to be compressed is within 256 - 511 times, the second length occupies 2 bytes. Or, the second length may represent the number of data groups in the data set to be compressed. For example, the value of the second length is 1, indicating that there is 1 data group in the data set to be compressed. In this case, if the number of data groups in the data set to be compressed is within 255, the second length occupies 1 byte; if the number of data groups in the data set to be compressed is within 256 - 511, the second length occupies 2 bytes.
[0078] Exemplarily, the storage space occupied by the compression unit is the sum of the storage space occupied by a data group and the storage space occupied by the second length. For example, as Figure 5 shown, a compression unit occupies T bytes, where a data group among them occupies S bytes, and the second length occupies (T - S) bytes. S is a positive integer, and T is a positive integer greater than S. For example, as Figure 6As shown, the data set to be compressed includes four data groups, and each data group contains a data block (00001100). One data group contained in the compression unit is any one of the four data groups. The second length can be 4 (i.e., 00000100). The space occupied by this data group is 1 byte, and the space occupied by the second length is 1 byte. At this time, the space occupied by the compression unit is the sum of the space occupied by one data group and the space occupied by the second length, which is 2 bytes. In this case, the four data groups occupy 4 bytes, and the compression unit occupies 2 bytes. The data volume of the compression unit is smaller than the data volume of the data set to be compressed. Therefore, the embodiments of the present disclosure process the first image data, reducing the data volume and storage space, thereby reducing the data volume and storage space of the second image data including the compression unit. In this way, during the data transmission process, the transmission time can be shortened, the transmitted data volume can be reduced, and the data transmission efficiency can be improved.
[0079] Therefore, the data processing method provided by the embodiments of the present disclosure obtains the first image data. Among them, the first image data includes a plurality of pixel values arranged continuously. The plurality of pixel values are divided into a plurality of data blocks according to the order of pixel value arrangement. Each data block occupies 1 byte and contains at least one pixel value. According to the compression parameter, at least one data set to be compressed in the first image data is compressed into a corresponding compression unit to obtain the second image data including the compression unit. Among them, the data set to be compressed includes at least one data group. When the data set to be compressed includes at least two data groups, the at least two data groups are arranged continuously and are the same. Each data group includes at least one data block. When the data group includes at least two data blocks, the at least two data blocks are arranged continuously. The compression parameter includes a first length. The first length is configured to represent the number of data blocks in the data group. The compression unit includes one data group in the data set to be compressed and a second length. The second length is configured to represent the number of data groups in the data set to be compressed. In this case, compared with the case of directly transmitting the first image data without compression, the embodiments of the present disclosure compress the first image data, and the data volume of the generated compression unit is smaller than the data volume of the corresponding data set to be compressed, and the data volume of the obtained second image data including the compression unit is also smaller than the data volume of the first image data. Therefore, after the electronic device compresses the first image data into the second image data and then transmits it, the transmitted data volume can be reduced, the data transmission time can be shortened, the data transmission pressure between electronic devices can be reduced, the power consumption can be reduced, and it can be applied to electronic devices (such as EPD) using low-performance processors. In addition, the storage resources required for the electronic device to store the second image data and the data processing resources required for compressing the first image data to obtain the second image data can be reduced, saving the cost of the electronic device for image data processing.
[0080] Exemplarily, for a gradientless image, another different pixel value can be inserted between every at least two identical pixel values, that is, another pixel of a different color can be inserted between every at least two pixels of the same color, so that the displayed image can have grayscale visually. The inserted pixel of the other color can be called a color dot. For example, there is another pixel value between every two identical pixel values, that is, there is another pixel of a different color between every two pixels of the same color. In this way, the displayed image can have grayscale visually.
[0081] For example, if the pixel value of each pixel can be represented by two bits, the pixel value of black is 11, and the pixel value of white is 00. There is a black pixel value between every two white pixel values, that is, there is a black pixel between every two white pixels. At this time, the first image data is 0000110000110000110000110000110000.... In this case, each data group includes three data blocks, and the three data blocks included in each data group are 00001100, 00110000, and 11000011 respectively. The first image data circulates with three data blocks (i.e., three bytes) as a whole, and the first length can be 3 bytes. In this case, for the case where the pixels display two colors, black and white, the displayed image can be gray visually, so that the displayed image has grayscale.
[0082] Exemplarily, the data blocks in the first image data have a certain pattern. For example, the set of data to be compressed in the first image data includes multiple consecutive and identical data blocks A. At this time, the data in the set of data to be compressed is repeated in a single byte, and one data group can include one data block A; for example, the set of data to be compressed in the first image data includes three data blocks A, B, and C arranged in sequence, that is, the data blocks A, B, and C are arranged in a circular permutation as a whole. At this time, the data in the set of data to be compressed is circulated in multiple bytes, and one data group can include three data blocks, namely data blocks A, B, and C.
[0083] It should be noted that the compression parameters can be preset according to the actual situation of the electronic device, such as the type of image data received or displayed by the electronic device during actual use. For example, when the image data received by the electronic device is mostly gradientless image data, for example, the displayed image corresponding to the gradientless image data is mainly multiple solid color blocks, the number of data blocks in the data group represented by the first length in the compression parameters can be one.
[0084] Exemplarily, the image displayed by the electronic device includes at least one solid color block, and one solid color block corresponds to a plurality of continuously arranged and identical data groups. In this way, the first image data has at least two consecutive and identical data groups. For example, the compression parameter can be determined according to the size of the color block (i.e., the number of continuously arranged and identical data groups). For example, the color block corresponding to the set of data to be compressed with the largest number of continuously arranged and identical data groups can be used as the largest color block. The size of the first length can be determined according to the number of data blocks in the data group corresponding to the largest color block. For example, if the number of data blocks in the data group corresponding to the largest color block is 3, the first length can be 3 bytes. Also, the second length can be determined according to the largest number of identical data groups. For example, if the largest number of identical data groups is 250, the second length can be 1 byte. In addition, the storage space size of the compression unit can also be obtained according to the first length and the second length. For example, the storage space size of the compression unit can be the sum of the storage spaces of the first length and the second length. For example, if the first length is 3 bytes and the second length is 1 byte, the storage space of the compression unit is 4 bytes.
[0085] Exemplarily, according to the compression parameter, at least one set of data to be compressed in the first image data is compressed into a corresponding compression unit, as Figure 7 shown, including:
[0086] S201. Sequentially read data groups from the data to be compressed in the first image data according to the first length.
[0087] For example, among the data to be compressed in the first image data, multiple consecutively arranged pixel values are 00, 10, 11, 01, 00, 10, 11, 01, 00, 00, 11, 11, 00, 00, 11, 11, 00, 00, 11, 11, 00, 00, 11, 11. At this time, the data to be compressed has four data blocks, namely the first data block 00101101, the second data block 00101101, the third data block 00001111, the fourth data block 00001111, the fifth data block 00001111, and the sixth data block 00001111. Each data block includes four pixel values. When the number of data blocks in the data group characterized by the first length is 2, that is, when the first length is 2 bytes, according to the first length, data is read starting from the first pixel value 00, and data is read in steps of 2 bytes, obtaining three data groups, namely: the first data group including the first data block and the second data block, and the first data group is 0010110100101101; the second data group including the third data block and the fourth data block, and the second data group is 0000111100001111; the third data group including the fifth data block and the sixth data block, and the third data group is 0000111100001111.
[0088] Exemplarily, from the data to be compressed in the first image data, according to the first length, data groups are sequentially read, as Figure 8 shown, including:
[0089] S2011. From the data to be compressed in the first image data, except for the first data group, before obtaining each data group, when the length of the processed data is less than the length of the first image data, a data group is obtained.
[0090] It should be noted that the processed data refers to the data that has been compressed to generate a compression unit.
[0091] For example, the length of the first image data is 6 bytes, and the data to be compressed in the first image data is 00,10,11,01,00,10,11,01,00,00,11,11,00,00,11,11,00,00,11,11,00,00,11,11. When each data group includes 2 data blocks, the first data group is 0010110100101101. Before obtaining the second data group, compare the length of the processed data with the length of the first image data. At this time, the processed data (i.e., the read data) is the first data group, and its length is 2 bytes, which is less than the length of the first image data. At this time, the second data group 0000111100001111 can be obtained. Before obtaining the third data group, compare the length of the processed data with the length of the first image data. At this time, the processed data is the first data group and the second data group, and its length is 4 bytes, which is less than the length of the first image data. At this time, the third data group 0000111100001111 can be obtained. Before obtaining the fourth data group, compare the length of the processed data with the length of the first image data. At this time, the processed data is the first data group, the second data group, and the third data group, and its length is 6 bytes, which is equal to the length of the first image data. At this time, the fourth data group cannot be read, and there is no data to be processed in the first image data, so the reading process of the first image data ends.
[0092] S202. Starting from the first data group, determine one by one whether the subsequent data group is the same as the current data group until the subsequent data group is different from the current data group or the number of identical data groups exceeds the set value. Among them, the identical data groups constitute the data set to be compressed.
[0093] S203. Generate a compression unit corresponding to the data set to be compressed according to one data group in the identical data groups and the second length.
[0094] It should be noted that when the subsequent data group is different from the current data group, the current data group is the same as the previous data group. At this time, a compression unit can be generated according to the current data group and the previous data group, that is, the current data group and the previous data group can be regarded as the processed data; at this time, the subsequent data group can be regarded as the unprocessed data (data to be compressed), and this subsequent data group is updated to the current data group. If it is different when compared with the subsequent data group, a compression unit is generated according to the current data group.
[0095] For example, when the first data group read is 0010110100101101 and the second data group read is 0000111100001111, compare whether the second data group is the same as the first data group. Since the second data group is different from the first data group, at this time, the first data set to be compressed includes the first data group. The data group included in the first compression unit generated is the first data group, and the number of data groups represented by the second length included in the first compression unit is 1 (for example, the value 1 can be represented as 00000001). When the third data group read is 0000111100001111, compare whether the third data group is the same as the second data group. Since the third data group is the same as the second data group, data groups can continue to be read at this time. When the fourth data group read is 0010110100101101, since the fourth data group is different from the third data group, a second data set to be compressed can be obtained at this time. The second data set to be compressed includes the second data group and the third data group. Then, the data group included in the second compression unit generated is any one of the third data group and the second data group, and the number of data groups represented by the second length included in the second compression unit is 2 (for example, the value 2 can be represented as 00000010). Among them, the second length can occupy 1 byte of storage space. For example, referring to Figure 5 , the second compression unit is (000011110000111100000010), occupying 3 bytes. Among them, the first 16 bits (the 1st to 2nd bytes) represent the data group, occupying 2 bytes, and the last 8 bits (the 3rd byte) represent the second length, occupying 1 byte. Compared with the second data set to be compressed, the storage space occupied by the second compression unit is smaller, reducing the amount of data.
[0096] It should be noted that the above set value represents the maximum number of identical data groups corresponding to the compression unit of the generated data set to be compressed. For example, when the set value is 255, the maximum number of identical data groups corresponding to the compression unit of the generated data set to be compressed can be 255. At this time, the second length is 255 (i.e., 11111111), that is, the storage space occupied by the second length is 1 byte.
[0097] For example, the data to be compressed has three sets of data to be compressed. The number of the first data group A in the first set of data to be compressed is 511, the number of the second data group B in the second set of data to be compressed is 255, and the number of the third data group C in the third set of data to be compressed is 255. The first data group A, the second data group B, and the third data group C are all one byte. In this case, since the storage spaces of the compression units obtained by compressing the first image data are the same, that is, the storage space of one data group in each compression unit is the same, and the storage space of the second length in each compression unit is the same. Therefore, each compression unit can be 3 bytes. The length of the first compression unit obtained according to the first set of data to be compressed can be 3 bytes (the first data group A occupies 1 byte, and the second length occupies 2 bytes). The length of the second compression unit obtained according to the second set of data to be compressed can be 3 bytes (the second data group B occupies 1 byte, and the second length occupies 2 bytes). The length of the third compression unit obtained according to the third set of data to be compressed can be 3 bytes (the third data group C occupies 1 byte, and the second length occupies 2 bytes). At this time, the length of the obtained second image data is at least 9 bytes. In this case, since the number of the first data group A is greater than the number of the second data group B and also greater than the number of the third data group C, that is, when the set value is 255, the number of the first data group A exceeds the set value. Therefore, during the compression of the first set of data to be compressed, two first compression units can be obtained. The number of the first data group A in one of the first compression units is 255, and the number of the first data group A in the other first compression unit is 255. In this way, both compression units occupy 2 bytes (the first data group A occupies 1 byte, and the second length occupies 1 byte). Correspondingly, the length of the second compression unit can be 2 bytes (the second data group B occupies 1 byte, and the second length occupies 1 byte), and the length of the third compression unit can be 2 bytes (the third data group C occupies 1 byte, and the second length occupies 1 byte). At this time, the length of the obtained second image data is at least 8 bytes, making the length of the second image data smaller.
[0098] In some embodiments, as Figure 9 shown, according to the compression parameter, compressing at least one set of data to be compressed in the first image data into a corresponding compression unit further includes:
[0099] S204. Set the second length to zero or one. In this case, the storage space of the second length can be initialized, thereby avoiding the error of the initial value of the second length and improving the accuracy of the second length.
[0100] S205. Starting from the first data group, in response to the subsequent data group being the same as the current data group, increase the second length by 1 until the subsequent data group is different from the current data group or the number of identical data groups exceeds the set value, to obtain the second length that can characterize the number of identical data groups in the data set to be compressed.
[0101] For example, when the second length is set to zero, the initial value of the second length can be 0000000. Compare the second data group with the first data group. If they are the same, increase the second length by 1, that is, the value of the second length is 1 (for example, the second length can be represented as 00000001). Compare the third data group with the second data group. If they are the same, increase the second length by 1 again, that is, the value of the second length is 2 (for example, the second length can be represented as 00000010). Compare the fourth data group with the third data group. If they are different, stop increasing the second length by 1. At this time, the value of the second length is 2, which can characterize that the number of identical data groups is 3, namely the first data group, the second data group, and the third data group. Or, when the set value is 255, if the subsequent data group is the same as the current data group, increase the second length by 1, and stop when the value of the second length increases to 255, obtaining the value of the second length as 255 (for example, the second length can be represented as 11111111). In this case, the second length can also characterize the repetition times of the data group.
[0102] For example, when the second length is set to 1, the initial value of the second length can be 0000001. Compare the second data group with the first data group. If they are the same, increase the second length by 1, that is, the value of the second length is 2 (for example, the second length can be represented as 00000010). Compare the third data group with the second data group. If they are the same, increase the second length by 1 again, that is, the value of the second length is 3 (for example, the second length can be represented as 00000011). Compare the fourth data group with the third data group. If they are different, increase the second length by 1. At this time, the value of the second length is 3, which can characterize that the number of identical data groups is 3, namely the first data group, the second data group, and the third data group. Or, when the set value is 255, if the subsequent data group is the same as the current data group, increase the second length by 1, and stop when the value of the second length increases to 255, obtaining the value of the second length as 255 (for example, the second length can be represented as 11111111).
[0103] In some embodiments, the compression parameter further includes a third length. The third length is configured to characterize the size of the storage space of the compression unit. Wherein, the compression unit includes a data group and a second length. Therefore, the size of the storage space characterized by the third length is greater than the length of one data group, that is, greater than the number of data blocks characterized by the first length. For example, if the first length characterizes that the number of data blocks in the data group is Q, where Q is a positive integer, then the first length is Q bytes, and the number of bytes of the third length is greater than or equal to (Q + 1) bytes.
[0104] It should be noted that, before the electronic device performs data processing, it can reserve a certain amount of storage space to write the compressed data. For example, referring to Figure 5 , the third length can be T, and the first length can be S. In this way, T bytes of storage space can be reserved. When compressing the first image data, one data group is written to S bytes in the T-byte storage space, and the remaining (T - S) bytes of the storage space are initialized (i.e., set to zero or one), and the second length is written to the (T - S) bytes in the T-byte storage space.
[0105] Exemplarily, according to one data group and the second length in the same data groups, a compression unit corresponding to the data set to be compressed is generated, as Figure 10 shown, including:
[0106] S206. Write one data group and the second length of the data set to be compressed into the storage space with the third length to generate a compression unit corresponding to the data set to be compressed.
[0107] For example, the storage device in the electronic device (the first electronic device) can have a storage space with the third length. Write one data group into the storage space with the third length, and while obtaining the second length, write the second length to obtain the compression unit.
[0108] In some embodiments, one data group included in the compression unit is the first data group of the data set to be compressed. For example, in the case of determining the first data group in the data to be compressed, write the first data group into the storage space with the third length, and set the remaining storage space of the storage space with the third length to zero or one. Starting from the first data group, when the next data group in the data to be compressed is the same as the current data group, increment by 1 in the remaining storage space until the next data group is different from the current data group. At this time, the accumulated value in the remaining storage space is the second length, which characterizes the number of the same data groups. For example, the second length can be written into the remaining storage space in parallel when comparing whether two adjacent data groups are the same.
[0109] For example, when the initial value of the remaining storage space is zero (if the remaining storage space is 1 byte, the initial value of the remaining storage space is 00000000), the second data group is compared with the first data group. If the second data group is the same as the first data group, the remaining storage space is increased by 1, that is, the value of the second length is 1 (such as the value of the remaining storage space is 00000001). The third data group is compared with the second data group. If the third data group is the same as the second data group, the remaining storage space is increased by 1, that is, the value of the second length is 2 (such as the value of the remaining storage space is 00000010). The fourth data group is compared with the third data group. If the fourth data group is different from the third data group, the increase of the remaining storage space stops. At this time, the value of the remaining storage space is 2, and the value of the second length is 2, which can represent that the number of identical data groups is 3, namely the first data group, the second data group, and the third data group. At this time, the second length can also represent the repetition times of the data group.
[0110] For example, when the initial value of the remaining storage space is 1 (if the remaining storage space is 1 byte, the initial value of the remaining storage space is 00000001), the second data group is compared with the first data group. If the second data group is the same as the first data group, the remaining storage space is increased by 1, that is, the value of the second length is 2 (such as the value of the remaining storage space is 00000010). The third data group is compared with the second data group. If the third data group is the same as the second data group, the remaining storage space is increased by 1, that is, the value of the second length is 3 (such as the value of the remaining storage space is 00000011). The fourth data group is compared with the third data group. If the fourth data group is different from the third data group, the increase of the remaining storage space stops. At this time, the value of the remaining storage space is 3, and the value of the second length is 3, which can represent that the number of identical data groups is 3, namely the first data group, the second data group, and the third data group.
[0111] In some embodiments, the number of compression parameters is multiple, and the multiple compression parameters are not completely the same. For example, the first length N in one compression parameter is 1, and the third length L in the compression parameter is 2; the first length N in one compression parameter is 2, and the third length L in the compression parameter is 3; these two compression parameters are different.
[0112] Exemplarily, according to the compression parameters, at least one data set to be compressed in the first image data is compressed into corresponding compression units to obtain second image data including the compression units, as Figure 11 shown, including:
[0113] S207. Compress the data set to be compressed in the first image data into corresponding compression units according to each of the multiple compression parameters, and generate third image data including the compression units.
[0114] S208. Select the third image data with the minimum length or the third image data with a length less than the threshold from the multiple third image data as the second image data.
[0115] For example, the compression parameter includes a first length. According to each of the multiple compression parameters, that is, the first length in each compression parameter, compress the data set to be compressed in the first image data into corresponding compression units, and generate third image data including the compression units. For example, when there are three multiple compression parameters, the first length is also three, namely the first first length N1 in the first compression parameter, the second first length N2 in the second compression parameter, and the third first length N3 in the third compression parameter. In this case, according to the first first length N1, compress the data set to be compressed in the first image data into corresponding compression units (the first compression units), and generate the first third image data including the first compression units. The length of a data group in the first compression units is N1 bytes. According to the second first length N2, compress the data set to be compressed in the first image data into corresponding compression units (the second compression units), and generate the second third image data including the second compression units. The length of a data group in the second compression units is N2 bytes. According to the third first length N3, compress the data set to be compressed in the first image data into corresponding compression units (the third compression units), and generate the third third image data including the third compression units. The length of a data group in the third compression units is N3 bytes.
[0116] For example, the compression parameters include a first length and a third length. According to each of the multiple compression parameters, that is, the first length and the third length in each compression parameter, a data set to be compressed in the first image data is compressed into a corresponding compression unit, and third image data containing the compression unit is generated. For example, when there are three multiple compression parameters, both the first length and the third length are three, namely the first first length N1 and the first third length L1 in the first compression parameter, the second first length N2 and the second third length L2 in the second compression parameter, and the third first length N3 and the third third length L3 in the third compression parameter. In this case, according to the first first length N1 and the first third length L1, the data set to be compressed in the first image data is compressed into a corresponding compression unit (the first compression unit), and the first third image data containing the first compression unit is generated. The length of a data group in the first compression unit is N1 bytes, and the length of the first compression unit is L1. According to the second first length N2 and the second third length L2, the data set to be compressed in the first image data is compressed into a corresponding compression unit (the second compression unit), and the second third image data containing the second compression unit is generated. The length of a data group in the second compression unit is N2 bytes, and the length of the second compression unit is L2 bytes. According to the third first length N3 and the third third length L3, the data set to be compressed in the first image data is compressed into a corresponding compression unit (the third compression unit), and the third third image data containing the third compression unit is generated. The length of a data group in the third compression unit is N3 bytes, and the length of the third compression unit is L3 bytes.
[0117] In this case, the lengths of the first third image data, the second third image data, and the third third image data can be compared respectively. Among the first third image data, the second third image data, and the third third image data, if the length of the third image data with the smallest length, for example, the length of the second third image data is the smallest, then the second third image data is used as the second image data for transmission. Alternatively, during the process of generating the first third image data, the second third image data, and the third third image data, if the length of the first third image data is greater than the threshold and the length of the second third image data is less than the threshold, then the second third image data is used as the second image data for transmission, and in this way, the third third image data will not be generated anymore.
[0118] Exemplarily, the above-mentioned threshold can be pre-configured in the electronic device, and the threshold can characterize the length of the image data (such as the number of bytes of the image data). The first electronic device compresses the first image data into the second image data with a length within the threshold range. The length of the second image data is much smaller than the length of the first image data. The first electronic device transmits the second image data to the second electronic device. During the process of decompressing the second image data, the second electronic device will not exceed its computing power.
[0119] It should be noted that multiple compression parameters can be pre-configured in the electronic device (such as the first electronic device). For example, multiple first lengths N can be pre-configured. In the case where the compression parameters also include the third length, multiple third lengths L can also be pre-configured.
[0120] Exemplarily, according to the compression parameters, at least one data set to be compressed in the first image data is compressed into a corresponding compression unit, such as Figure 12 shown, including:
[0121] S209. When the data to be compressed in the first image data is not empty and the number of bytes occupied by the data to be compressed is less than the number of bytes occupied by a data group, write zeros after the data to be compressed to make up the data to be compressed to a data group.
[0122] For example, when the number of data blocks in each data group is 3, that is, the data group is 3 bytes, and the first length can be 3 bytes, if at the end of the first image data, the data to be compressed is 1 data block A, at this time, the data to be compressed is 1 byte, which is less than 3 bytes. Zeros can be written after the 1 data block A of the data to be compressed, that is, 2 data blocks B and C filled with zeros are written (for example, both data blocks B and C are 00000000). In this way, the data to be compressed can be read according to the first length to obtain a data group containing 3 data blocks, and the 3 data blocks in the data group are data block A, data block B, and data block C in sequence. In this case, the data group obtained by writing zeros is compared with its previous data group to obtain the compression unit.
[0123] In some embodiments, the second image data further includes compression parameters. For example, the compression parameters can be written before the compression unit in the second image data, or the compression parameters can be written after the compression unit in the second image data. The position of the compression parameters in the second image data can be designed according to the actual situation and is not limited here. For example, when the compression parameters are written before the compression unit in the second image data, the first length and the third length can be written before the compression unit in the second image data, and the order can be the third length, the first length, and the compression unit. For example, the compression parameters are located in the file header of the second image data.
[0124] Exemplarily, in the case where there are multiple compression parameters, the compression parameters included in the second image data are the compression parameters used when obtaining the compression units in the second image data. For example, the second compression parameter used when obtaining the second third image data as described above is the compression parameter included in the second image data.
[0125] Exemplarily, the second image data may further include the data size of the first image data (for example, the storage space size occupied by the first image data), the data size of all compression units as a whole (for example, the storage space size occupied by all compression units as a whole, or the total number of compression units), and the arrangement order of multiple pixel values in the first image data, etc. For example, in the file header of the second image data, the 1st to 10th bytes may be the data size of the first image data, the 11th to 20th bytes may store the data size of all compression units as a whole, the 21st byte may store the third length, the 22nd byte may store the first length, the 23rd to 26th bytes may store reserved information (such as the picture name, etc.), and the 27th to 31st bytes may store the arrangement order of multiple pixel values in the first image data (such as progressive scanning). Among them, the data size of the first image data is the information carried by the first image data itself during transmission, the data size of all compression units as a whole is the information generated during the compression process of the first image data, and the first length and the third length may be pre-selected or set information.
[0126] In some embodiments, the number of data blocks included in the data group is 1 to 4. For example, the storage space size of one data group is 1 to 4 bytes. For example, the first length N may represent a length of 1 to 4 bytes. For example, in the case where the number of data groups in the data set to be compressed is less than or equal to 255 (or the repetition times of the data group is less than or equal to 255 times), the storage space of the second length M may be 1 byte. At this time, the storage space of the third length L may be (N + 1) bytes; in the case where the number of data groups in the data set to be compressed is greater than 255 and less than or equal to 511 (or the repetition times of the data group is greater than 255 times and less than or equal to 511 times), the storage space of the second length M may be 2 bytes. At this time, the storage space of the third length L may be (N + 2) bytes. It can be understood that the difference between the storage space of the third length and the storage space of the first length is greater than or equal to 1 byte.
[0127] Exemplarily, in the case where the compression parameters include the first length and the third length, the storage space of the second length is the difference between the storage space of the third length and the storage space of the first length. For example, refer to Figure 5, the first length occupies S bytes, the third length occupies T bytes, and at this time, the second length occupies (T - S) bytes. Exemplarily, when the compression parameter includes the first length, the size of the space occupied by the second length can be preset, and then the size of the third length can be obtained. For example, the first length occupies S bytes, and it is preset that the second length occupies 1 byte. At this time, the third length occupies (S + 1) bytes.
[0128] In addition, in some embodiments, the data processing method further includes: sending the second image data to an electronic device. For example, the first electronic device sends the second image data to the second electronic device.
[0129] Embodiments of the present disclosure provide a data processing method, which is applied to the above-mentioned electronic device 100, for example, applied to the above-mentioned first electronic device 100B. As Figure 13 shown, the data processing method includes the following steps:
[0130] S30. Obtain the second image data. Among them, the second image data includes at least one compression unit, and one compression unit includes a data group and a second length.
[0131] S40. According to the compression parameter, decompress the compression unit in the second image data into a corresponding decompressed data set to obtain the fourth image data.
[0132] Among them, the compression parameter includes a first length, and the first length is configured to represent the number of data blocks in the data group. The second length is configured to represent the number of data groups in the decompressed data set corresponding to the compression unit. The decompressed data set contains at least one data group. When the decompressed data set contains at least two data groups, the at least two data groups are arranged continuously. Each data group includes at least one data block. When the data group contains at least two data blocks, the at least two data blocks are arranged continuously. The fourth image data includes a plurality of continuously arranged data blocks, and each data block includes a plurality of continuously arranged pixel values.
[0133] It can be understood that the first electronic device transmits the compression unit obtained by compressing the data set to be compressed to the second electronic device. After the second electronic device decompresses the compression unit, a decompressed data set is obtained. The decompressed data set corresponding to the compression unit and the data set to be compressed are the same. The fourth image data includes at least one decompressed data set.
[0134] It should be noted that the compression parameter used when the image data is decompressed is the same as the compression parameter used when the image data is compressed. Among them, the compression parameter can be pre-configured in the electronic device (such as the second electronic device). The decompressed data (i.e., the fourth image data) should be the same as the data before compression (i.e., the first image data).
[0135] For example, when the compression unit includes a data group A and the second length is 3 (i.e., the number of data groups in the corresponding decompressed data set of the compression unit is 3), the decompressed data set is (A, A, A). And when the first length is 3 (i.e., the number of data blocks in the data group is 3), the data group A includes three data blocks (A1, A2, A3), and the decompressed data set is (A1, A2, A3, A1, A2, A3, A1, A2, A3). The fourth image data including six data blocks (A1, A2, A3, A1, A2, A3, A1, A2, A3) can be obtained. At this time, the data group A occupies 3 bytes, the second length occupies 1 byte, the compression unit occupies 4 bytes, the decompressed data set occupies 6 bytes, and the fourth image data occupies 6 bytes. In this case, the data volume of the compression unit is relatively small, occupying less computing power and storage space of the electronic device during the decompression process, and can reduce the cost and power consumption of the electronic device.
[0136] Therefore, the data processing method provided by the embodiments of the present disclosure obtains the second image data. The second image data includes a compression unit. The compression unit includes a data group and a second length. According to the compression parameter, the compression unit in the second image data is decompressed into the corresponding decompressed data set to obtain the fourth image data. The compression parameter includes the first length. In this case, since the data volume of the compression unit is smaller than the data volume of the decompressed data set corresponding to the compression unit, the electronic device occupies relatively less computing power and storage space during the process of decompressing the compression unit to obtain the fourth image data, thereby reducing the cost and power consumption of the electronic device and improving the efficiency of data processing. In addition, the data processing method provided by the embodiments of the present disclosure has simple decompression and is applicable to low-end processors such as, for example, a Micro Controller Unit (MCU).
[0137] Exemplarily, according to the compression parameter, decompressing the compression unit in the second image data into the corresponding decompressed data set, as Figure 14 shown, includes:
[0138] S401. Read the data group in the compression unit according to the first length.
[0139] For example, when the first length is greater than 1, that is, the number of data blocks in the data group is greater than 1, the data group occupies multiple bytes, and the multiple bytes can be read at one time to obtain the data group in the compression unit, which can improve the efficiency of image data processing compared with single-byte reading.
[0140] S402. Copy the data group according to the second length to generate the decompressed data set.
[0141] For example, during the process of compressing to obtain the second image data, when the second length is set to zero, starting from the first data group to be decompressed, each time a data group is copied, the second length is decreased by 1 until the second length becomes zero, and the decompressed data set is obtained. For example, for the data group (00001111) of the compression unit, the second length is 3 and the first length is 1 (indicating 1 byte). At this time, according to the first length, 1 byte in the compression unit is read to obtain the data group (00001111). When the second length is not zero, the data group is copied, and the obtained decompressed data set is (00001111, 00001111). At this time, the second length is decreased by 1, that is, the second length is 3 - 1 = 2; continue when the second length is not zero, copy the data group, and the obtained decompressed data set is (00001111, 00001111, 00001111). At this time, the second length is decreased by 1, that is, the second length is 2 - 1 = 1; continue when the second length is not zero, copy the data group, and the obtained decompressed data set is (00001111, 00001111, 00001111, 00001111). At this time, the second length is decreased by 1, that is, the second length is 1 - 1 = 0; in this case, the second length is equal to zero, stop copying the data group, the decompression of this compression unit is completed, and the number of data groups in the obtained decompressed data set is 4.
[0142] For example, during the process of compressing to obtain the second image data, when the second length is set to zero, the copy count is set to zero. Starting from the first data group to be decompressed, each time a data group is copied, the copy count is increased by 1 until the copy count is equal to the value of the second length, and the decompression of the compression unit is completed, and the decompressed data set is obtained. For example, for the data group (00001111) of the compression unit, the second length is 3 and the first length is 1 (indicating 1 byte). At this time, according to the first length, 1 byte in the compression unit is read to obtain the data group (00001111). When the copy count is not equal to the second length, the data group is copied, and the obtained decompressed data set is (00001111, 00001111). At this time, the copy count is increased by 1, that is, the copy count is 1; continue, when the copy count is not equal to the second length, copy the data group, and the obtained decompressed data set is (00001111, 00001111, 00001111). At this time, the copy count is increased by 1, that is, the copy count is 1 + 1 = 2; continue, when the copy count is not equal to the second length, copy the data group, and the obtained decompressed data set is (00001111, 00001111, 00001111, 00001111). At this time, the copy count is increased by 1, that is, the copy count is 2 + 1 = 3; in this case, the copy count is equal to the second length, stop copying the data group, the decompression of this compression unit is completed, and the number of data groups in the obtained decompressed data set is 4.
[0143] For example, in the process of compressing to obtain the second image data, when the second length is set to 1, starting from the first data group to be decompressed, each time a data group is copied, the second length is decreased by 1 until the second length becomes 1, and the decompressed data set is obtained. For example, for the data group (00001111) of the compression unit, the second length is 3 and the first length is 1 (representing 1 byte). At this time, according to the first length, 1 byte in the compression unit is read to obtain the data group (00001111). When the second length is not equal to 1, the data group is copied, and the obtained decompressed data set is (00001111, 00001111). At this time, the second length is decreased by 1, that is, the second length is 3 - 1 = 2; continue when the second length is not 1, copy the data group, and the obtained decompressed data set is (00001111, 00001111, 00001111). At this time, the second length is decreased by 1, that is, the second length is 2 - 1 = 1; in this case, the second length is equal to 1, stop copying the data group, the decompression of this compression unit is completed, and the number of data groups in the obtained decompressed data set is 3.
[0144] For example, in the process of compressing to obtain the second image data, when the second length is set to 1, the copy count is set to 1. Starting from the first data group to be decompressed, each time a data group is copied, the copy count is increased by 1 until the copy count is equal to the value of the second length, and the decompression of the compression unit is completed, and the decompressed data set is obtained. For example, for the data group (00001111) of the compression unit, the second length is 3 and the first length is 1 (representing 1 byte). At this time, according to the first length, 1 byte in the compression unit is read to obtain the data group (00001111). When the copy count is not equal to the second length, the data group is copied, and the obtained decompressed data set is (00001111, 00001111). At this time, the copy count is increased by 1, that is, the copy count is 1 + 1 = 2; continue, when the copy count is not equal to the second length, copy the data group, and the obtained decompressed data set is (00001111, 00001111, 00001111). At this time, the copy count is increased by 1, that is, the copy count is 2 + 1 = 3; in this case, the copy count is equal to the second length, stop copying the data group, the decompression of this compression unit is completed, and the number of data groups in the obtained decompressed data set is 3.
[0145] In some embodiments, the compression parameter further includes a third length. The third length is configured to characterize the size of the storage space of the compression unit. According to the compression parameter, the compression unit in the second image data is decompressed into a corresponding decompressed data set, as Figure 15 shown, including:
[0146] S403. Read the compression units in the second image data according to the third length, and decompress the compression units into corresponding decompressed data sets.
[0147] For example, according to the third length, read the data to be decompressed in the second image data to obtain the compression units. For example, referring to Figure 5 , if a compression unit occupies T bytes, T bytes can be read each time to obtain the compression units in the second image data. And when the first length is S bytes, read S bytes of the compression unit, that is, obtain the data group of the compression unit, and then copy the data group according to the (T - S) bytes in the compression unit, so as to decompress the compression unit and obtain the decompressed data set. In this way, compared with reading data byte by byte, the efficiency of image data processing can be improved.
[0148] For example, during the decompression process, the electronic device writes the decompressed data into the storage space. For example, for a compression unit, when obtaining the data group according to the first length, write the first data group into the storage space, and then read the second length and repeat writing the data group according to the second length to obtain the decompressed data set corresponding to the compression unit.
[0149] For example, when the second image data includes the data size of all compression units as a whole (such as the storage space size occupied by all compression units as a whole, or the total number of compression units), before reading each compression unit, the size relationship between the data of the already read compression units and the data of all compression units as a whole included in the second image data can be compared. If the data of the already read compression units is less than the data of all compression units as a whole included in the second image data, it means that the compression units in the second image data have not been completely read, and continue to read the compression units according to the third length. If the data of the already read compression units is equal to the data of all compression units as a whole included in the second image data, it means that all the compression units in the second image data have been completely read, and stop reading the compression units.
[0150] In some embodiments, the second image data further includes the length of the first image data. As Figure 16 shown, the data processing method includes:
[0151] S50. When the length of the decompressed data is greater than the length of the first image data, delete the part of the data at the end of the decompressed data that exceeds the length of the first image data to obtain the first image data.
[0152] For example, when the length of the first image data is 6 bytes and the length of the decompressed data is 7 bytes, the data of the 7th byte can be deleted, and the data of the 1st to 6th bytes of the decompressed data is the first image data; alternatively, data can be read starting from the 1st byte of the decompressed data until the length is equal to the length of the first image data (i.e., the 6th byte), and the data of the 1st to 6th bytes in the decompressed data is the first image data. For example, for the electronic device at the sending end, when writing zeros after the data to be compressed to make up the data to be compressed into a data group, after decompressing the made-up data group, when the length of the decompressed data is greater than the length of the first image data, the data written as zeros during compression is deleted, and the obtained decompressed data is the first image data. In this way, the data before compression is consistent with the data after decompression, ensuring the accuracy of data processing.
[0153] It should be noted that the electronic device (such as the second electronic device) includes a first memory and a second memory. For example, the first memory is a random access memory (RAM), and the second memory is a flash memory. For example, during the process of decompressing the second image data, for each compressed unit to be decompressed, the intermediate data can be stored in the first memory, and the decompressed data group can be stored in the second memory, that is, the decompressed data set is stored in the second memory, and the first memory does not store the corresponding decompressed data set; alternatively, the first memory can also store each data group of the compressed unit, and after the decompression of the compressed unit is completed, the decompressed data set including each data group is stored in the second memory.
[0154] An embodiment of the present disclosure provides a data processing apparatus 300A, as Figure 17 shown, the data processing apparatus 300A includes an acquisition unit 301A and a processing unit 302A.
[0155] The acquisition unit 301A is configured to acquire first image data. The first image data includes a plurality of pixel values arranged continuously. The plurality of pixel values are divided into a plurality of data blocks according to the order of pixel value arrangement. Each data block occupies one byte and includes at least one pixel value.
[0156] The processing unit 302A is configured to compress at least one data set to be compressed in the first image data into a corresponding compressed unit according to compression parameters, so as to obtain second image data including the compressed unit. Wherein, one data set to be compressed includes at least one data group. When the data set to be compressed includes at least two data groups, the at least two data groups are arranged continuously and are the same; each data group includes at least one data block. When the data group includes at least two data blocks, the at least two data blocks are arranged continuously.
[0157] The compression parameter includes a first length, and the first length is configured to characterize the number of data blocks in a data group; the compression unit includes a data group in the data set to be compressed and a second length, and the second length is configured to characterize the number of data groups in the data set to be compressed.
[0158] In some embodiments, as Figure 17 shown, the data processing device 300A further includes a sending unit 303A. The sending unit 303A is configured to send the second image data to the electronic device 100 (such as the second electronic device 100B described above).
[0159] It should be noted that the above data processing device can implement some of the above data methods, such as the data processing method for compressing the first image data. The above data processing device has the same beneficial effects as some of the above data processing methods, which will not be elaborated here.
[0160] An embodiment of the present disclosure provides a data processing device 300B, as Figure 18 shown, the data processing device 300B includes an acquisition unit 301B and a processing unit 302B.
[0161] The acquisition unit 301B is configured to acquire second image data, and the second image data includes at least one compression unit. One compression unit includes a data group and a second length.
[0162] The processing unit 302B is configured to decompress the compression unit in the second image data into a corresponding decompressed data set according to the compression parameter to obtain the fourth image data. The compression parameter includes a first length, and the first length is configured to characterize the number of data blocks in the data group. The second length is configured to characterize the number of data groups in the decompressed data set corresponding to the compression unit.
[0163] The decompressed data set includes at least one data group. In the case where the decompressed data set includes at least two data groups, the at least two data groups are arranged continuously. Each data group includes at least one data block. In the case where the data group includes at least two data blocks, the at least two data blocks are arranged continuously. The fourth image data includes a plurality of continuously arranged data blocks, and each data block includes a plurality of continuously arranged pixel values.
[0164] Exemplarily, the second image data further includes the length of the first image data. The processing unit 302B is further configured to, in the case where the length of the decompressed data is greater than the length of the first image data, delete the part of the decompressed data that exceeds the length of the first image data at the end to obtain the first image data.
[0165] It should be noted that the above data processing device can implement some of the above data processing methods. For example, the data processing method of decompressing the second image data. The above data processing device and some of the above data processing methods have the same beneficial effects, which will not be elaborated here.
[0166] Figure 17 and Figure 18 The described device embodiments are merely illustrative. For example, the above division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In each embodiment of the present application, the functional units can be integrated in a processing module, or each unit can exist physically alone, or two or more units can be integrated in a module. Figure 17 and Figure 18 In [reference document] and [reference document], the above-mentioned respective units can be implemented in the form of hardware or in the form of software functional units. For example, when implemented in software, the above-mentioned acquisition unit 301, processing unit 302, etc. can be implemented as software functional modules generated after at least one processor reads the program code stored in the memory. Figure 17 and Figure 18 In [reference document] and [reference document], the above-mentioned respective units can also be implemented by different hardware in a computer (display device). For example, the processing unit 302 is implemented by a part of the processing resources in at least one processor (such as one core or two cores in a multi-core processor), while the acquisition unit 301 is implemented by the remaining part of the processing resources in at least one processor (such as other cores in a multi-core processor). For example, when implemented in the form of hardware, exemplarily, the above data processing device 300 can be a programmable device, such as a hardware programmable device, such as an FPGA (Field Programmable Gate Array). The above functional units can also be implemented in a combination of software and hardware. For example, the acquisition unit 301, processing unit 302, etc. are software functional modules generated after the CPU reads the program code stored in the memory.
[0167] Figure 17 and Figure 18 For more details on how the acquisition unit 301, processing unit 302, etc. implement the above functions, please refer to the descriptions in the previous method embodiments, and will not be repeated here.
[0168] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments.
[0169] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the processes or functions in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium. The computer-readable storage medium can be any available medium that the computer can access or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a disk, a magnetic tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid state drive (SSD)), etc.
[0170] Some embodiments of the present disclosure provide a computer non-transitory readable storage medium (e.g., a non-transitory computer-readable storage medium). Computer program instructions are stored in the computer-readable storage medium. When the computer program instructions are run on a computer, the computer is caused to execute one or more steps in the data processing method described in the above embodiments.
[0171] Exemplarily, the above computer-readable storage medium may include, but is not limited to: magnetic storage devices (e.g., hard disks, floppy disks, or magnetic tapes, etc.), optical discs (e.g., CDs (Compact Disks), DVDs (Digital Versatile Disks), etc.), smart cards, and flash memory devices (e.g., EPROMs (Erasable Programmable Read-Only Memories), cards, sticks, or key drives, etc.). The various computer-readable storage media described in the present disclosure may represent one or more devices and / or other machine-readable storage media for storing information. The term "machine-readable storage medium" may include, but is not limited to, wireless channels and various other media that can store, contain, and / or carry instructions and / or data.
[0172] Some embodiments of the present disclosure also provide a computer program product. The computer program product includes computer program instructions. When the computer program instructions are executed on a computer, the computer program instructions cause the computer to execute one or more steps in the data processing method described in the above embodiments.
[0173] Some embodiments of the present disclosure also provide a computer program. When the computer program is executed on a computer, the computer program causes the computer to execute one or more steps of the data processing method described in the above embodiments.
[0174] The beneficial effects of the above computer-readable storage medium, computer program product, and computer program are the same as those of the data processing method described in some of the above embodiments, and will not be elaborated here.
[0175] As described above, the above are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present disclosure who contemplates changes or substitutions should be covered by the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.
Claims
1. A data processing method, characterized in that, Including: Obtaining first image data; the first image data includes a plurality of pixel values arranged continuously, and the plurality of pixel values are divided into a plurality of data blocks according to the order of pixel value arrangement. Each data block occupies one byte and contains at least one pixel value; According to compression parameters, compressing at least one data set to be compressed in the first image data into corresponding compression units to obtain second image data including the compression units and the compression parameters; Wherein, one data set to be compressed contains at least one data group. When the data set to be compressed contains at least two data groups, the at least two data groups are arranged continuously and are the same; each data group includes at least one of the data blocks. When the data group contains at least two data blocks, the at least two data blocks are arranged continuously; The compression parameters include a first length, and the first length is configured to represent the number of data blocks in the data group; the compression unit contains one data group in the data set to be compressed and a second length, and the second length is configured to represent the number of data groups in the data set to be compressed; The step of compressing at least one data set to be compressed in the first image data into corresponding compression units according to the compression parameters includes: Sequentially reading data groups from the data to be compressed in the first image data according to the first length; Starting from the first data group, successively determining whether a subsequent data group is the same as the current data group until the subsequent data group is different from the current data group or the number of identical data groups exceeds a set value; Wherein, the identical data groups constitute the data set to be compressed; Generating a compression unit corresponding to the data set to be compressed according to one data group among the identical data groups and the second length.
2. The data processing method according to claim 1, wherein The step of compressing at least one data set to be compressed in the first image data into corresponding compression units according to the compression parameters further includes: Setting the second length to zero or one; Starting from the first data group, in response to the subsequent data group being the same as the current data group, incrementing the second length by 1 until the subsequent data group is different from the current data group or the number of identical data groups exceeds a set value, to obtain a second length capable of representing the number of identical data groups in the data set to be compressed.
3. The data processing method according to claim 1, wherein The compression parameters further include a third length; the third length is configured to represent the size of the storage space of the compression unit; The step of generating a compression unit corresponding to the data set to be compressed according to one data group among the identical data groups and the second length includes: Writing one data group of the data set to be compressed and the second length into a storage space having the third length to generate a compression unit corresponding to the data set to be compressed.
4. The data processing method according to claim 1, wherein One data group included in the compression unit is the first data group of the data set to be compressed.
5. The data processing method according to any one of claims 1 to 4, characterized in that The step of sequentially reading data groups from the data to be compressed in the first image data according to the first length includes: From the data to be compressed in the first image data, except for the first data group, before obtaining each data group, when the length of the processed data is less than the length of the first image data, obtain the data group.
6. The data processing method according to any one of claims 1 to 4, characterized in that, The compression parameters are multiple compression parameters; the multiple compression parameters are not completely the same; The method of compressing at least one set of data to be compressed in the first image data into corresponding compression units according to the compression parameters to obtain second image data including the compression units includes: Compressing the set of data to be compressed in the first image data into corresponding compression units according to each compression parameter in the multiple compression parameters to generate third image data including the compression units; Selecting the third image data with the minimum length or the third image data with a length less than the threshold from the multiple third image data as the second image data.
7. The data processing method according to any one of claims 1 to 4, characterized in that The method of compressing at least one set of data to be compressed in the first image data into corresponding compression units according to the compression parameters includes: When the data to be compressed in the first image data is not empty and the number of bytes occupied by the data to be compressed is less than the number of bytes occupied by a data group, write zeros after the data to be compressed to make up the data to be compressed to a data group.
8. The data processing method according to any one of claims 1 to 4, characterized in that, The number of data blocks included in the data group is 1 to 4.
9. A data processing method, characterized in that, Including: Obtain second image data; the second image data includes at least one compression unit, the length of the first image data, and the compression parameters; One compression unit includes one data group and a second length; Decompressing the compression units in the second image data into corresponding sets of decompressed data according to the compression parameters to obtain fourth image data; the compression parameters include a first length configured to represent the number of data blocks in the data group; the second length is configured to represent the number of data groups in the corresponding set of decompressed data of the compression unit; The set of decompressed data includes at least one of the data groups. When the set of decompressed data includes at least two of the data groups, at least two of the data groups are arranged continuously; each data group includes at least one of the data blocks. When the data group includes at least two of the data blocks, the at least two data blocks are arranged continuously; the fourth image data includes a plurality of the data blocks arranged continuously, and each data block includes a plurality of pixel values arranged continuously; When the length of the decompressed data is greater than the length of the first image data, delete the partial data at the end of the decompressed data that exceeds the length of the first image data to obtain the first image data.
10. The data processing method according to claim 9, wherein The method of decompressing the compression units in the second image data into corresponding sets of decompressed data according to the compression parameters includes: Reading the data group in the compression unit according to the first length; Copying the data group according to the second length to generate the set of decompressed data.
11. The data processing method according to claim 9 or 10, characterized in that, The compression parameters further include a third length; the third length is configured to represent the storage space size of the compression unit; Uncompressing the compression units in the second image data into corresponding decompressed data sets according to the compression parameters further includes: Reading the compression units in the second image data according to the third length and uncompressing the compression units into corresponding decompressed data sets.
12. An electronic device, characterized in that, Including: A memory; One or more computer program instructions are stored in the memory; A processor; The processor is coupled to the memory; The processor is configured to execute the one or more computer program instructions so that the electronic device implements the data processing method according to any one of claims 1 to 8; and / or, the data processing method according to any one of claims 9 to 11.
13. A data processing system, characterized in that, Including: A first electronic device configured to implement the data processing method according to any one of claims 1 to 8; A second electronic device coupled to the first electronic device; the second electronic device is configured to implement the data processing method according to any one of claims 9 to 11.
14. A computer non-transitory readable storage medium, characterized in that, It stores computer program instructions, wherein when the computer program instructions are run on a computer, the computer implements the data processing method according to any one of claims 1 to 8; or, implements the data processing method according to any one of claims 9 to 11.
Citation Information
Patent Citations
Method for encoding and decoding images
US20110038551A1