CN113163198A - Image compression method, decompression method, device, equipment and storage medium - Google Patents

Image compression method, decompression method, device, equipment and storage medium Download PDF

Info

Publication number
CN113163198A
CN113163198A CN202110298167.0A CN202110298167A CN113163198A CN 113163198 A CN113163198 A CN 113163198A CN 202110298167 A CN202110298167 A CN 202110298167A CN 113163198 A CN113163198 A CN 113163198A
Authority
CN
China
Prior art keywords
information
image
target
repeating units
compressed data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110298167.0A
Other languages
Chinese (zh)
Other versions
CN113163198B (en
Inventor
张焱
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110298167.0A priority Critical patent/CN113163198B/en
Publication of CN113163198A publication Critical patent/CN113163198A/en
Application granted granted Critical
Publication of CN113163198B publication Critical patent/CN113163198B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • H04N19/423Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation characterised by memory arrangements
    • H04N19/426Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation characterised by memory arrangements using memory downsizing methods
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The disclosure provides an image compression method, an image decompression device, an image compression equipment and a storage medium, and relates to the field of image compression. The specific implementation scheme is as follows: encoding a target image, and converting the target image into text data; wherein the text data at least comprises basic information of the target image and coding information representing image content; and under the condition that a repeating unit exists in the coded information of the text data, compressing the repeating unit in the coded information to obtain target compressed data aiming at the target image, wherein the coded information comprises at least two repeating units. Thus, lossless compression is achieved.

Description

Image compression method, decompression method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of image processing technology, and in particular, to the field of image compression.
Background
In the conventional common compression method, metadata of an image, for example, an image in a JPG (Joint Photographic Experts Group) format, or an image in a Portable Network Graphics (PNG) format, or an image in a webp format transmitted over a Network, is sacrificed, a preset compression algorithm is used in the compression process no matter what format is used, and data which does not affect browsing is deleted under the condition that a difference cannot be recognized by naked eyes to reduce the volume of the image.
Disclosure of Invention
The present disclosure provides an image compression method, a decompression method, an apparatus, a device and a storage medium.
According to an aspect of the present disclosure, there is provided an image compression method including:
encoding a target image, and converting the target image into text data; wherein the text data at least comprises basic information of the target image and coding information representing image content;
and under the condition that a repeating unit exists in the coded information of the text data, compressing the repeating unit in the coded information to obtain target compressed data aiming at the target image, wherein the coded information comprises at least two repeating units.
According to another aspect of the present disclosure, there is provided an image decompression method including:
receiving target compressed data, wherein the target compressed data is obtained by compressing a repeating unit in coding information, the coding information is information representing image content in text data obtained by coding a target image, and the coding information comprises at least two repeating units;
and decompressing the repeating units in the target compressed data to obtain a target image represented by the target compressed data.
According to another aspect of the present disclosure, there is provided an image compression apparatus including:
the encoding processing unit is used for encoding a target image and converting the target image into text data; wherein the text data at least comprises basic information of the target image and coding information representing image content;
and a compression processing unit, configured to, when detecting that a repeating unit exists in the encoding information of the text data, perform compression processing on the repeating unit in the encoding information to obtain target compressed data for the target image, where the encoding information includes at least two repeating units.
According to another aspect of the present disclosure, there is provided an image decompression apparatus including:
the device comprises a receiving unit, a compressing unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving target compressed data, the target compressed data is obtained by compressing a repeating unit in coding information, the coding information is information for representing image content in text data obtained by coding a target image, and the coding information comprises at least two repeating units;
and the decompression processing unit is used for decompressing the repeating unit in the target compressed data to obtain a target image represented by the target compressed data.
According to another aspect of the present disclosure, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform an image compression method or an image decompression method in any of the embodiments of the present disclosure.
According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute an image compression method or an image decompression method in any one of the embodiments of the present disclosure.
According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the image compression method or the image decompression method in any of the embodiments of the present disclosure.
According to the technology disclosed by the invention, lossless compression is realized, and the user experience is improved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a schematic flow chart of an implementation of an image compression method according to an embodiment of the present disclosure;
FIG. 2 is a schematic flow chart illustrating an implementation of an image decompression method according to an embodiment of the present disclosure;
FIG. 3 is a schematic structural diagram of an image compression apparatus according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an image decompression apparatus according to an embodiment of the present disclosure;
fig. 5 is a block diagram of an electronic device for implementing an image compression method or an image decompression method according to an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Based on the method, the scheme of the application provides a lossless image compression method so as to realize complete lossless compression in a real sense. Specifically, fig. 1 is a schematic diagram illustrating an implementation flow of an image compression method according to an embodiment of the present disclosure, where the method can be implemented by an image compression apparatus, and in practical applications, the image compression apparatus can be integrated into any electronic device that needs to perform image compression, so that the electronic device, such as a mobile phone, a tablet computer, and the like, implements the image compression method according to the present disclosure. Specifically, as shown in fig. 1, the method includes:
step S101: encoding a target image, and converting the target image into text data; wherein the text data at least comprises basic information of the target image and coding information representing image content. Here, the basic information may be specific to an image type (i.e., format) of the target image, an encoding method used for compression, and the like. The encoding information is information encoded according to the image content of the target image.
Step S102: and under the condition that a repeating unit exists in the coded information of the text data, compressing the repeating unit in the coded information to obtain target compressed data aiming at the target image, wherein the coded information comprises at least two repeating units.
Therefore, after the encoding information is converted into the text data, a plurality of repeating units may exist in the encoding information of the text data, at the moment, the repeating parts in the encoding information, namely the repeating units, are directly compressed, the whole text data can be compressed, data deletion is not needed in the process, lossless compression is achieved, the image quality of the compressed image is guaranteed, the requirement of a user on the lossless image is met, and user experience is improved.
For example, in a scene that the electronic device browses a page, on one hand, since the scheme of the application can realize compression, long-term waiting of a user in the process of browsing an image can be avoided; on the other hand, the compression realized by the scheme is lossless, and the metadata of the image is not deleted, so that a user can browse the high-quality lossless image, particularly in a shooting website.
Furthermore, as lossless compression is realized in the scheme of the application, even if the image with a large size is browsed, the lossless image can be directly browsed in the browser, the problem that the lossless image cannot be presented in the browser due to the fact that lossless compression cannot be realized in the prior art is solved, different requirements of users are met, and user experience is improved.
In a specific example of the scheme of the present application, the compressing the repeating unit in the encoded information may specifically include: determining a replacement character corresponding to the repeating unit in the coding information, wherein the repeating unit is a character string consisting of at least two characters; further, all character strings representing the repeating units in the encoded information are replaced by the replacement characters, wherein the volume occupied by the replacement characters is smaller than the volume occupied by the repeating units, that is, the number of the characters of the replacement characters is less than that of the repeating units, so that compression processing on the repeating units in the encoded information is realized. The implementation mode is simple and feasible, and is convenient for large-scale engineering application.
It should be noted that, in an actual scenario, one or two, or even a plurality of, repeating units in the encoded information may be provided; when two or more than two repeating units exist, the character strings corresponding to the repeating units are different, namely two different repeating units exist, and a plurality of different repeating units exist; moreover, the number of characters of the character string in the repeating unit may also be two or more; in other words, the scheme of the present application does not limit the number of different repeating units in the encoded information, and the number of characters in the repeating units. Meanwhile, the replacing character at least comprises one character. When a plurality of repeating units exist, a plurality of replacing characters can exist, so that the replacing characters correspond to the repeating units one by one, and therefore, compression processing on different repeating units in the coded information is convenient to realize.
In a specific example of the scheme of the application, after one replacement is completed, the encoded information may further include other repeating units, at this time, the replacement operation may be continued on the other repeating units, specifically, after all the character strings representing the repeating units in the encoded information are replaced with the replacement characters, whether other repeating units exist in the encoded information of the text data is detected again; and under the condition that other repeating units exist, compressing the other repeating units in the coded information again until the data obtained after compression meets the preset data requirement. Therefore, the encoding information can be compressed to the maximum extent, and the data obtained after compression meets the preset data requirement, namely the compression requirement.
In a specific example of the present application, in order to facilitate decompression, a mapping relationship between the repeating unit and the replacement character corresponding to the repeating unit needs to be established, that is, a mapping relationship between the replacement character of the replacement repeating unit and the replaced repeating unit needs to be established; in practical application, a plurality of repeating units and replacement characters corresponding to different repeating units exist, at this time, a mapping relationship, such as a one-to-one correspondence relationship, between the repeating units and the replacement characters is recorded in the mapping relationship, so that decompression processing can be performed on the target compressed data obtained after compression processing based on the mapping relationship, and a foundation is laid for effective decompression operation.
In a specific example of the scheme of the present application, the performing encoding processing on the target image may further specifically include: acquiring a preset coding mode used for network transmission of the target image; and carrying out coding processing on the target image based on the preset coding mode. That is to say, the coding mode can be selected based on the network transmission requirement of the actual scene, so that the flexibility and the adaptability of the scheme of the application are improved, and a foundation is laid for being compatible with different application scenes.
In a specific example of the scheme of the application, the target compressed data further needs to be sent, so that a receiving end decompresses the target compressed data and displays the target image obtained after the decompression. Therefore, effective transmission of lossless compression data is achieved, and a foundation is laid for enriching application scenes and improving user experience.
Therefore, after the encoding information is converted into the text data, a plurality of repeating units may exist in the encoding information of the text data, at the moment, the repeating parts in the encoding information, namely the repeating units, are directly compressed, the whole text data can be compressed, data deletion is not needed in the process, lossless compression is achieved, the image quality of the compressed image is guaranteed, the requirement of a user on the lossless image is met, and user experience is improved.
The application scheme further provides an image decompression method, which can be realized through an image decompression device, and in practical application, the image decompression device can be integrated into any electronic equipment needing image decompression, so that the electronic equipment, such as a mobile phone, a tablet computer and the like, can realize the image decompression method of the application scheme. In one example, the electronic device integrates both the image compression apparatus described above and the image decompression apparatus described in this example, so as to implement the compression or decompression processing of an image. Specifically, as shown in fig. 2, the method includes:
step S201: receiving target compressed data, wherein the target compressed data is obtained by compressing a repeating unit in coding information, the coding information is information representing image content in text data obtained by coding a target image, and the coding information comprises at least two repeating units. The target compressed data is obtained by the image compression method described above.
Step S202: and decompressing the repeating units in the target compressed data to obtain a target image represented by the target compressed data.
Therefore, after the encoding information is converted into the text data, a plurality of repeating units may exist in the encoding information of the text data, at the moment, the repeating parts in the encoding information, namely the repeating units, are directly compressed, the whole text data can be compressed, data deletion is not needed in the process, therefore, lossless compression is achieved, the image quality obtained by decompression is guaranteed, the requirements of a user on lossless images are met, and user experience is improved.
In a specific example of the scheme of the present application, the decompressing processing on the repeating unit in the target compressed data specifically includes: acquiring compression characteristic information for compressing the repeating unit, wherein the compression characteristic information at least comprises a mapping relation between the repeating unit and the replacing character; in practical application, the compression characteristic information may also specifically include other information such as a coding mode, and the scheme of the present application does not limit this. Further, based on the mapping relation included in the compression characteristic information, the replacement characters in the target compressed data are restored to the repeating units, so that the target compressed data are decompressed, and the target image is obtained. Therefore, the quality of the decompressed image is ensured, the requirement of a user on a lossless image is met, and the user experience is improved.
The scheme of the application is further described in detail by combining specific examples; the present example provides a completely lossless compression scheme that not only compresses the image for transmission, but also does not delete any data of the image and guarantees the original content. Specifically, the encoding method is exemplified by the base64 algorithm, where the base64 algorithm refers to the binary representation of files by 64 visible characters, because in a conventional computer, files are represented by binary, i.e., 0 and 1, but the binary is not favorable for network transmission decompression, and the base64 algorithm can replace 0 and 1 by 64 other visible characters, so as to facilitate network transmission.
As for the practical application, the specific encoding manner of the base64 algorithm is not focused on the present example, and the present example only needs to convert one image into text data through the base64 algorithm. In practical applications, in a web page, for example, a browser, the image can be directly converted into base64 code. Further, the present application will be described in detail with reference to the following example of a part of text data encoded by base 64. Here, a part of text data obtained by encoding base64 includes:
data:img/jpg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD//gAQTGF2YzU3LjI0LjEwMgD/2wBDAAgMDA4MDhAQEBAQEBMSExQUFBMTExMUFBQVFRUZGRkVFRUUFBUVGBgZGRscGxoaGRocHB4eHiQkIiIqKiszMz7/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsBAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKCxAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCAACigAAKKAAAooAACigAAKKAAAooAACigAAKKAAAooAACigAAKKAAAooAACigAAKKAAAooAACigAAKKAAAooAACigAAKKAAAooAACigAAKKAAAooAACigAAKKAAAooAACqs9xFbLulcKO3qfoOpoNIU5。
basic information of the text data obtained after encoding is arranged at the beginning part, for example, the basic information comprises data img/jpg; the base64 is used to explain the encoding mode as base64, and the encoded file is an image, the image is an IMG, and the image type is JPG. Based on this, the receiving end, such as a browser, can perform decompression processing based on the basic information after acquiring the basic information.
Further, as can be seen from the above text data, the text data is a character string composed of 64 visible characters (26 upper case letters, 26 lower case letters, 10 numerals from 0 to 9, and 64 in total, plus + -) and the text data has a repeating unit. Further, for example, "aacigaakkaaaoaaacoaaccigaakkaaaoaaacoaacigaakk" in the text data is taken as an example. Wherein AAA and KK are both repeat units; based on this, replacement processing can be performed on the repeating unit, specifically:
raw data: AACigAAKKAAAooAACigAAKKAAAooAACigAAKK.
Data after replacement: a2CigA2K2A3o2A2CigA2K2A3o2A2CigA2K 2.
The comparison shows that the data of the repeating unit is represented by numbers, and it can be seen visually that the same data is represented differently, and the data length is different, obviously, the length of the data after replacement is reduced, and the reduction of the length means that the storage space is reduced, that is, the volume is reduced. Although the replacement processing is performed, the data represented by the two are identical, so that the above process realizes one-time lossless compression.
Here, in order to enable smooth decompression processing, a mapping relationship between the repeating unit and a replacement character for performing a replacement operation on the repeating unit is recorded, for example, a mapping table is obtained, and the repeating unit AAC is recorded and replaced with the replacement character A2C; the repeat unit AAA is replaced with a replacement character a3, etc.
Further, after one replacement, a repeating unit, such as a2, exists in the replaced data, and at this time, the compression can be continued based on the above manner, and the mapping relationship between the repeating unit and the replacement character for replacing the repeating unit is recorded in the mapping table. For example,
replacement character # -repeating unit a 2; the replacement character @ ═ repeat unit K2. On the basis of this, the method is suitable for the production,
raw data: AACigAAKKAAAooAACigAAKKAAAooAACigAAKK.
Modified data 1: a2CigA2K2A3o2A2CigA2K2A3o2A2CigA2K 2.
Modified data 2: # Cig # @ A3o2# Cig # @ A3o2# Cig # @.
Modified data 2, is smaller in volume than modified data 1. Continuing to observe, there are also repeating elements, such as # @, so the mapping continues, i.e.
Replace character! Repeating unit # @. On the basis of this, the method is suitable for the production,
raw data: AACigAAKKAAAooAACigAAKKAAAooAACigAAKK.
Modified data 1: a2CigA2K2A3o2A2CigA2K2A3o2A2CigA2K 2.
Modified data 2: # Cig # @ A3o2# Cig # @ A3o2# Cig # @.
Modified data 3: # Cig! A3o2# Cig! A3o2# Cig! .
Modified data 3, is smaller in volume than modified data 2. And circulating the steps until the obtained compressed data, namely the modified data meets the preset data requirement.
Based on the method, for the repeating units, through one-by-one mapping relation, the data volume can be reduced through replacement processing again and again, compression is achieved, data deletion is not needed in the process, and lossless compression of data is achieved. In practical application, each time of replacement processing corresponds to one mapping relationship, and only the mapping relationship is recorded, and data reduction is performed layer by layer, so that decompressed original data can be obtained.
Therefore, according to the scheme, no data is deleted, only the repeated units are replaced, lossless compression can be achieved, obviously, the file size can be reduced in the process, and the file itself is not affected. And the compressed data can be restored to the original data through the mapping relation. Support is provided for accelerating the image display speed on the webpage and improving the user experience.
The present application further provides an image compression apparatus, as shown in fig. 3, the apparatus including:
an encoding processing unit 301 configured to perform encoding processing on a target image and convert the target image into text data; wherein the text data at least comprises basic information of the target image and coding information representing image content;
a compression processing unit 302, configured to, when detecting that there are repeat units in the coding information of the text data, perform compression processing on the repeat units in the coding information to obtain target compressed data for the target image, where the coding information includes at least two of the repeat units.
In a specific example of the scheme of the present application, the compression processing unit is further configured to determine a replacement character corresponding to the repeating unit in the encoded information, where the repeating unit is a character string composed of at least two characters; and replacing all character strings representing the repeating units in the coding information with the replacing characters so as to realize compression processing of the repeating units in the coding information.
In a specific example of the application, the compression processing unit is further configured to detect whether there are other repeating units in the encoding information of the text data again after all the character strings representing the repeating units in the encoding information are replaced with the replacement characters; and under the condition that other repeating units exist, compressing the other repeating units in the coded information again until the data obtained after compression meets the preset data requirement.
In a specific example of the scheme of the present application, the method further includes:
the mapping relation establishing unit is used for establishing the mapping relation between the repeating unit and the replacing characters corresponding to the repeating unit; and decompressing the target compressed data obtained after the compression processing based on the mapping relation.
In a specific example of the scheme of the present application, the encoding processing unit is further configured to acquire a preset encoding mode used for network transmission of the target image; and carrying out coding processing on the target image based on the preset coding mode.
In a specific example of the scheme of the present application, the method further includes:
and the sending unit is used for sending the target compressed data so as to facilitate the receiving end to decompress the target compressed data and display the target image obtained after decompression.
The functions of each unit in the image compression apparatus according to the embodiments of the present invention can be referred to the corresponding description in the above method, and are not described herein again.
The present application further provides an image decompression apparatus, as shown in fig. 4, the apparatus including:
a receiving unit 401, configured to receive target compressed data, where the target compressed data is obtained by compressing a repeating unit in encoded information, the encoded information is information representing image content in text data obtained by encoding a target image, and the encoded information includes at least two repeating units;
a decompression processing unit 402, configured to decompress the repeating unit in the target compressed data to obtain a target image represented by the target compressed data.
In a specific example of the scheme of the application, the decompression processing unit is further configured to acquire compression characteristic information for performing compression processing on the repeating unit, where the compression characteristic information at least includes a mapping relationship between the repeating unit and the replacement character; and restoring the replacement characters in the target compressed data into the repeating units based on the mapping relation contained in the compression characteristic information so as to decompress the target compressed data to obtain the target image.
The functions of each unit in the image decoding device in the embodiment of the present invention can be referred to the corresponding description in the above method, and are not described herein again.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 5 illustrates a schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 5, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM)502 or a computer program loaded from a storage unit 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic apparatus 500 can also be stored. The calculation unit 501, the ROM 502, and the RAM 503 are connected to each other by a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
A number of components in the electronic device 500 are connected to the I/O interface 505, including: an input unit 506 such as a keyboard, a mouse, or the like; an output unit 507 such as various types of displays, speakers, and the like; a storage unit 508, such as a magnetic disk, optical disk, or the like; and a communication unit 509 such as a network card, modem, wireless communication transceiver, etc. The communication unit 509 allows the electronic device 500 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunication networks.
The computing unit 501 may be a variety of general-purpose and/or special-purpose processing components having processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 501 performs the respective methods and processes described above, such as an image compression method or an image decompression method. For example, in some embodiments, the image compression method or the image decompression method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 500 via the ROM 502 and/or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the image compression method or the image decompression method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the image compression method or the image decompression method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel or sequentially or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (19)

1. An image compression method comprising:
encoding a target image, and converting the target image into text data; wherein the text data at least comprises basic information of the target image and coding information representing image content;
and under the condition that a repeating unit exists in the coded information of the text data, compressing the repeating unit in the coded information to obtain target compressed data aiming at the target image, wherein the coded information comprises at least two repeating units.
2. The method of claim 1, wherein the compressing the repeating unit in the encoded information comprises:
determining a replacement character corresponding to the repeating unit in the coding information, wherein the repeating unit is a character string consisting of at least two characters;
and replacing all character strings representing the repeating units in the coding information with the replacing characters so as to realize compression processing of the repeating units in the coding information.
3. The method of claim 2, further comprising:
after all character strings representing the repeating units in the coding information are replaced by the replacing characters, whether other repeating units exist in the coding information of the text data is detected again;
and under the condition that other repeating units exist, compressing the other repeating units in the coded information again until the data obtained after compression meets the preset data requirement.
4. The method of claim 2 or 3, further comprising:
establishing a mapping relation between the repeating unit and the replacing characters corresponding to the repeating unit; and decompressing the target compressed data obtained after the compression processing based on the mapping relation.
5. The method according to claim 1, wherein the encoding process of the target image includes:
acquiring a preset coding mode used for network transmission of the target image;
and carrying out coding processing on the target image based on the preset coding mode.
6. The method of claim 1 or 5, further comprising:
and sending the target compressed data so as to facilitate a receiving end to decompress the target compressed data and display the target image obtained after decompression.
7. An image decompression method comprising:
receiving target compressed data, wherein the target compressed data is obtained by compressing a repeating unit in coding information, the coding information is information representing image content in text data obtained by coding a target image, and the coding information comprises at least two repeating units;
and decompressing the repeating units in the target compressed data to obtain a target image represented by the target compressed data.
8. The method of claim 7, wherein the decompressing the repeating units in the target compressed data comprises:
acquiring compression characteristic information for compressing the repeating unit, wherein the compression characteristic information at least comprises a mapping relation between the repeating unit and the replacing character;
and restoring the replacement characters in the target compressed data into the repeating units based on the mapping relation contained in the compression characteristic information so as to decompress the target compressed data to obtain the target image.
9. An image compression apparatus comprising:
the encoding processing unit is used for encoding a target image and converting the target image into text data; wherein the text data at least comprises basic information of the target image and coding information representing image content;
and a compression processing unit, configured to, when detecting that a repeating unit exists in the encoding information of the text data, perform compression processing on the repeating unit in the encoding information to obtain target compressed data for the target image, where the encoding information includes at least two repeating units.
10. The apparatus according to claim 9, wherein the compression processing unit is further configured to determine a replacement character corresponding to the repeating unit in the encoded information, where the repeating unit is a character string composed of at least two characters; and replacing all character strings representing the repeating units in the coding information with the replacing characters so as to realize compression processing of the repeating units in the coding information.
11. The apparatus according to claim 10, wherein the compression processing unit is further configured to detect whether there are other repeating units in the encoding information of the text data again after all the character strings representing the repeating units in the encoding information are replaced with the replacement characters; and under the condition that other repeating units exist, compressing the other repeating units in the coded information again until the data obtained after compression meets the preset data requirement.
12. The apparatus of claim 10 or 11, further comprising:
the mapping relation establishing unit is used for establishing the mapping relation between the repeating unit and the replacing characters corresponding to the repeating unit; and decompressing the target compressed data obtained after the compression processing based on the mapping relation.
13. The apparatus according to claim 9, wherein the encoding processing unit is further configured to obtain a preset encoding mode used for network transmission of the target image; and carrying out coding processing on the target image based on the preset coding mode.
14. The apparatus of claim 9 or 13, further comprising:
and the sending unit is used for sending the target compressed data so as to facilitate the receiving end to decompress the target compressed data and display the target image obtained after decompression.
15. An image decompression apparatus comprising:
the device comprises a receiving unit, a compressing unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving target compressed data, the target compressed data is obtained by compressing a repeating unit in coding information, the coding information is information for representing image content in text data obtained by coding a target image, and the coding information comprises at least two repeating units;
and the decompression processing unit is used for decompressing the repeating unit in the target compressed data to obtain a target image represented by the target compressed data.
16. The apparatus according to claim 15, wherein the decompression processing unit is further configured to obtain compression characteristic information for performing compression processing on the repeating unit, where the compression characteristic information at least includes a mapping relationship between the repeating unit and the replacement character; and restoring the replacement characters in the target compressed data into the repeating units based on the mapping relation contained in the compression characteristic information so as to decompress the target compressed data to obtain the target image.
17. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-6; or, performing the method of claim 7 or 8.
18. A non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to perform the method of any one of claims 1-6; or, performing the method of claim 7 or 8.
19. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-6; or, implementing the method of claim 7 or 8.
CN202110298167.0A 2021-03-19 2021-03-19 Image compression method, decompression method, device, equipment and storage medium Active CN113163198B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110298167.0A CN113163198B (en) 2021-03-19 2021-03-19 Image compression method, decompression method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110298167.0A CN113163198B (en) 2021-03-19 2021-03-19 Image compression method, decompression method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113163198A true CN113163198A (en) 2021-07-23
CN113163198B CN113163198B (en) 2022-12-06

Family

ID=76888294

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110298167.0A Active CN113163198B (en) 2021-03-19 2021-03-19 Image compression method, decompression method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113163198B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115482147A (en) * 2022-09-14 2022-12-16 中国人民大学 Efficient parallel graph processing method and system based on compressed data direct calculation
CN115550299A (en) * 2022-10-09 2022-12-30 深圳依时货拉拉科技有限公司 Image information communication method, electronic device, and storage medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102122960A (en) * 2011-01-18 2011-07-13 西安理工大学 Multi-character combination lossless data compression method for binary data
CN103702133A (en) * 2013-12-19 2014-04-02 Tcl集团股份有限公司 Image compression display method and image compression display device
CN103873877A (en) * 2012-12-14 2014-06-18 华为技术有限公司 Image transmission method and device for remote desktop
CN108111858A (en) * 2016-11-24 2018-06-01 腾讯科技(深圳)有限公司 A kind of picture compression method and device
CN108829872A (en) * 2018-06-22 2018-11-16 武汉轻工大学 Immediate processing method, equipment, system and the storage medium of lossless compression file
CN111104631A (en) * 2019-11-30 2020-05-05 四川商通实业有限公司 Webp picture format conversion method
CN111384960A (en) * 2018-12-28 2020-07-07 上海寒武纪信息科技有限公司 Decoding method, processor, decoding device and storage medium
US20200302649A1 (en) * 2019-03-18 2020-09-24 Denso Corporation Data compression method and device
CN111866520A (en) * 2019-04-24 2020-10-30 博世汽车部件(苏州)有限公司 Coding and decoding method, coding and decoding device and communication system
CN112514270A (en) * 2018-06-06 2021-03-16 吴英全 Data compression

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102122960A (en) * 2011-01-18 2011-07-13 西安理工大学 Multi-character combination lossless data compression method for binary data
CN103873877A (en) * 2012-12-14 2014-06-18 华为技术有限公司 Image transmission method and device for remote desktop
CN103702133A (en) * 2013-12-19 2014-04-02 Tcl集团股份有限公司 Image compression display method and image compression display device
CN108111858A (en) * 2016-11-24 2018-06-01 腾讯科技(深圳)有限公司 A kind of picture compression method and device
CN112514270A (en) * 2018-06-06 2021-03-16 吴英全 Data compression
CN108829872A (en) * 2018-06-22 2018-11-16 武汉轻工大学 Immediate processing method, equipment, system and the storage medium of lossless compression file
CN111384960A (en) * 2018-12-28 2020-07-07 上海寒武纪信息科技有限公司 Decoding method, processor, decoding device and storage medium
US20200302649A1 (en) * 2019-03-18 2020-09-24 Denso Corporation Data compression method and device
CN111866520A (en) * 2019-04-24 2020-10-30 博世汽车部件(苏州)有限公司 Coding and decoding method, coding and decoding device and communication system
CN111104631A (en) * 2019-11-30 2020-05-05 四川商通实业有限公司 Webp picture format conversion method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115482147A (en) * 2022-09-14 2022-12-16 中国人民大学 Efficient parallel graph processing method and system based on compressed data direct calculation
CN115550299A (en) * 2022-10-09 2022-12-30 深圳依时货拉拉科技有限公司 Image information communication method, electronic device, and storage medium

Also Published As

Publication number Publication date
CN113163198B (en) 2022-12-06

Similar Documents

Publication Publication Date Title
JP6728385B2 (en) Digital image recompression
JP6242074B2 (en) Method and apparatus for signal data compression and decompression (signal data compression and decompression)
CN107395209B (en) Data compression method, data decompression method and equipment thereof
CN113163198B (en) Image compression method, decompression method, device, equipment and storage medium
CN113590858B (en) Target object generation method and device, electronic equipment and storage medium
CN108628898B (en) Method, device and equipment for data storage
US9966971B2 (en) Character conversion
US20180041224A1 (en) Data value suffix bit level compression
CN114071190B (en) Cloud application video stream processing method, related device and computer program product
US11581903B2 (en) Data compression method and apparatus, computer-readable storage medium, and electronic device
CN114282141A (en) Processing method and device for compression format data, electronic equipment and readable storage medium
CN113518088B (en) Data processing method, device, server, client and medium
CN105469433B (en) Picture compression method and equipment thereof
CN112054805B (en) Model data compression method, system and related equipment
US9054730B2 (en) Method and system for LZW based decompression
CN107077747A (en) The graph command compression remotely shown
CN105450504A (en) Processing method and system for picture link
CN110866132A (en) Tile map using method suitable for low network bandwidth environment
CN111049836A (en) Data processing method, electronic device and computer readable storage medium
CN113361249B (en) Document weight judging method, device, electronic equipment and storage medium
CN113705548B (en) Topic type identification method and device
CN117041358A (en) Optimization method and system for data transmission overhead, storage medium and electronic equipment
CN115396424A (en) Processing method and device for picture network transmission
CN116074576A (en) Video generation method, device, electronic equipment and storage medium
CN116011556A (en) System and method for training audio codec

Legal Events

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