CN113613022B - Compression method, device and equipment of JPEG image and readable medium - Google Patents
Compression method, device and equipment of JPEG image and readable medium Download PDFInfo
- Publication number
- CN113613022B CN113613022B CN202110681371.0A CN202110681371A CN113613022B CN 113613022 B CN113613022 B CN 113613022B CN 202110681371 A CN202110681371 A CN 202110681371A CN 113613022 B CN113613022 B CN 113613022B
- Authority
- CN
- China
- Prior art keywords
- block
- image data
- sub
- compressed image
- reference sub
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000007906 compression Methods 0.000 title claims abstract description 101
- 230000006835 compression Effects 0.000 title claims abstract description 89
- 238000000034 method Methods 0.000 title claims abstract description 34
- 230000004044 response Effects 0.000 claims abstract description 26
- 238000004590 computer program Methods 0.000 claims description 10
- 238000010586 diagram Methods 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 4
- 238000013139 quantization Methods 0.000 description 4
- 238000005457 optimization Methods 0.000 description 3
- 230000009466 transformation Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 230000014509 gene expression Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000000969 carrier Substances 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000004377 microelectronic Methods 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 230000003252 repetitive effect Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 238000000844 transformation Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/60—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
- H04N19/625—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using discrete cosine transform [DCT]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods 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/136—Incoming video signal characteristics or properties
- H04N19/137—Motion inside a coding unit, e.g. average field, frame or block difference
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/17—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
- H04N19/176—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- Discrete Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
- Compression Of Band Width Or Redundancy In Fax (AREA)
Abstract
The invention discloses a compression method of a JPEG image, which comprises the following steps: reading a current sub-block as a reference sub-block, performing DCT compression based on the reference sub-block, and storing compressed image data into a memory; reading the next sub-block as an adjacent sub-block, and judging whether the source image data of the adjacent sub-block and the source image data of the reference sub-block are equal; in response to the source image data of the adjacent sub-block and the source image data of the reference sub-block being equal, adding one to the omitted compression number, and judging whether the omitted compression number is greater than a preset number of times; in response to the omitted compression number not being greater than the preset number of times, storing the compressed image data of the reference sub-block as the compressed image data of the adjacent sub-block into the memory; and a step of taking the adjacent sub-block as a new reference sub-block, taking the compressed image data of the adjacent sub-block as the compressed image data of the reference sub-block, and returning to read the next sub-block as the adjacent sub-block. The invention also discloses a compression device, computer equipment and a readable storage medium of the JPEG image.
Description
Technical Field
The present invention relates to the field of image compression technologies, and in particular, to a method, an apparatus, a device, and a readable medium for compressing a JPEG image.
Background
With the rapid development of microelectronic technology, computer technology and communication technology, the human society is gradually moving into an informatization age, images are widely used as information carriers, visual information accounts for 60% of human receiving information, the amount of image data after digitalization is very large, and the compression of the images is necessary and important in the process of transmitting and storing the images.
JPEG (Join Photographic Experts Group) is a first set of international color still image compression standard coding algorithms formulated by the joint picture experts group, and is widely used because of its good image quality and high compression rate. The main steps include DCT (Discrete Cosine Transform ), quantization, and encoding.
In the DCT compression process of a JPEG image, each component of a frame of image needs to be sequentially divided into a plurality of blocks (sub-blocks) from left to right and from top to bottom, and DCT transformation, quantization and encoding are performed by using the blocks as minimum units, so as to obtain compressed image data.
In the JPEG image compression algorithm, each sub-block performs DCT, quantization, encoding, etc., which causes repetitive operations, thereby generating a large amount of computation, and wasting the computation resource image.
Disclosure of Invention
Accordingly, an object of the embodiments of the present invention is to provide a method, apparatus, device and readable medium for compressing a JPEG image, which simplify a compression process by detecting the relevance of two adjacent sub-blocks, thereby greatly reducing the amount of computation in the discrete cosine transform compression process, saving a resource image, and realizing optimization of image compression.
Based on the above object, an aspect of the embodiments of the present invention provides a compression method of a JPEG image, including the steps of: reading a current sub-block as a reference sub-block, performing DCT compression based on the reference sub-block, and storing compressed image data into a memory; reading a next sub-block as an adjacent sub-block, and judging whether source image data of the adjacent sub-block and source image data of the reference sub-block are equal; in response to the source image data of the adjacent sub-block and the source image data of the reference sub-block being equal, adding one to the omitted compression number, and judging whether the omitted compression number is greater than a preset number of times; in response to the omitted compression number not being greater than a preset number of times, storing the compressed image data of the reference sub-block as the compressed image data of the adjacent sub-block into a memory; and taking the adjacent sub-block as a new reference sub-block, taking the compressed image data of the adjacent sub-block as the compressed image data of the new reference sub-block, and returning to the step of reading the next sub-block as the adjacent sub-block.
In some embodiments, further comprising: judging whether the adjacent sub-block is the last sub-block, if so, performing DCT compression based on the adjacent sub-block, and storing the compressed image data into a memory.
In some embodiments, further comprising: in response to the source image data of the adjacent sub-block and the source image data of the reference sub-block being unequal, further determining whether the source image data of the adjacent sub-block and the source image data of the reference sub-block are similar; in response to the source image data of the adjacent sub-block being dissimilar to the source image data of the reference sub-block, performing DCT compression based on the adjacent sub-block and storing the compressed image data in a memory; and taking the adjacent sub-block as a new reference sub-block, taking the compressed image data of the adjacent sub-block as the compressed image data of the new reference sub-block, and returning to the step of reading the next sub-block as the adjacent sub-block.
In some embodiments, further comprising: in response to the source image data of the adjacent sub-block being similar to the source image data of the reference sub-block, predicting the compressed image data of the adjacent sub-block based on the compressed image data of the reference sub-block and the compressed image data of the previous reference sub-block, and storing the predicted compressed image data in a memory; and taking the adjacent sub-block as a new reference sub-block, taking the compressed image data of the adjacent sub-block as the compressed image data of the new reference sub-block, and returning to the step of reading the next sub-block as the adjacent sub-block.
In some implementations, predicting the compressed image data of the neighboring sub-block based on the compressed image data of the reference sub-block and the compressed image data of the previous reference sub-block includes: judging whether the compressed image data of the reference sub-block is equal to the compressed image data of the previous reference sub-block; if the compressed image data of the reference sub-block is equal to the compressed image data of the previous reference sub-block, predicting the compressed image data of the adjacent sub-block as the compressed image data of the reference sub-block; and predicting the compressed image data of the adjacent sub-block based on the arithmetic difference value of the compressed image data of the reference sub-block and the compressed image data of the previous reference sub-block if the compressed image data of the reference sub-block and the compressed image data of the previous reference sub-block are not equal and are graded within a threshold range.
In some embodiments, determining whether the source image data of the neighboring sub-block and the source image data of the reference sub-block are similar comprises: judging whether the source image data of the adjacent sub-block and the source image data of the reference sub-block are graded within a threshold range; if the source image data of the adjacent sub-block and the source image data of the reference sub-block are graded within a threshold range, the source image data of the adjacent sub-block and the source image data of the reference sub-block are considered to be similar; and if the source image data of the adjacent sub-block and the source image data of the reference sub-block are not graded within the threshold range, the source image data of the adjacent sub-block and the source image data of the reference sub-block are not considered to be similar.
In some embodiments, further comprising: in response to the omitted compression number being greater than a preset number of times, performing DCT compression based on the adjacent sub-blocks, and storing compressed image data into a memory; resetting the omitted compression number to zero, taking the adjacent sub-block as a new reference sub-block, taking the compressed image data of the adjacent sub-block as the compressed image data of the new reference sub-block, and returning to the step of reading the next sub-block as the adjacent sub-block.
In another aspect of the embodiment of the present invention, there is also provided a compression apparatus for a JPEG image, including: the first module is configured to read a current sub-block as a reference sub-block, perform DCT compression based on the reference sub-block, and store compressed image data into a memory; a second module configured to read a next sub-block as a neighboring sub-block and determine whether source image data of the neighboring sub-block and source image data of the reference sub-block are equal; a third module configured to, in response to the source image data of the adjacent sub-block and the source image data of the reference sub-block being equal, add one to the omitted compression number and determine whether the omitted compression number is greater than a preset number of times; a fourth module configured to store the compressed image data of the reference sub-block as the compressed image data of the adjacent sub-block in a memory in response to the omitted compression number being not greater than a preset number of times; and a fifth module configured to take the adjacent sub-block as a new reference sub-block and take the compressed image data of the adjacent sub-block as the compressed image data of the new reference sub-block, and return to the second module.
In still another aspect of the embodiment of the present invention, there is also provided a computer apparatus, including: at least one processor; and a memory storing computer instructions executable on the processor, the instructions when executed by the processor performing the steps of the method described above.
In yet another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium storing a computer program which, when executed by a processor, implements the method steps as described above.
The invention has the following beneficial technical effects: by detecting the relevance of two adjacent small blocks, the compression flow is simplified, so that the calculated amount in the discrete cosine transform compression process is greatly reduced, the resource image is saved, and the optimization of image compression is realized.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are necessary for the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention and that other embodiments may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of an embodiment of a compression method of a JPEG image according to the present invention;
FIG. 2 is a schematic diagram of an embodiment of a compression apparatus for JPEG images according to the present invention;
FIG. 3 is a schematic diagram of an embodiment of a computer device provided by the present invention;
fig. 4 is a schematic diagram of an embodiment of a computer readable storage medium provided by the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention will be described in further detail with reference to the accompanying drawings.
It should be noted that, in the embodiments of the present invention, all the expressions "first" and "second" are used to distinguish two entities with the same name but different entities or different parameters, and it is noted that the "first" and "second" are only used for convenience of expression, and should not be construed as limiting the embodiments of the present invention, and the following embodiments are not described one by one.
Based on the above object, a first aspect of the embodiments of the present invention proposes an embodiment of a compression method of a JPEG image. Fig. 1 is a schematic diagram of an embodiment of a compression method of a JPEG image according to the present invention. As shown in fig. 1, the embodiment of the present invention includes the following steps:
s01, reading a current sub-block as a reference sub-block, performing DCT compression based on the reference sub-block, and storing compressed image data into a memory;
s02, reading the next sub-block as an adjacent sub-block, and judging whether source image data of the adjacent sub-block and source image data of a reference sub-block are equal;
s03, in response to the fact that the source image data of the adjacent sub-block is equal to the source image data of the reference sub-block, adding one to the omitted compression number, and judging whether the omitted compression number is larger than a preset number of times;
s04, in response to the omitted compression number not being larger than the preset times, storing the compressed image data of the reference sub-block into a memory as the compressed image data of the adjacent sub-block; and
s05, taking the adjacent sub-block as a new reference sub-block, taking the compressed image data of the adjacent sub-block as the compressed image data of the new reference sub-block, and returning to the step of reading the next sub-block as the adjacent sub-block.
In this embodiment, in the DCT-based JPEG image compression process, a frame of image is divided into a plurality of sub-blocks before compression, and then the sub-blocks are DCT-transformed, quantized, and encoded to form compressed image data. The sub-block size is typically 8 x 8. The adjacent two sub-blocks in a frame of image have great relevance, and compressed image data of the next sub-block can be predicted by detecting the relevance of the adjacent two sub-blocks, so that each sub-block is prevented from DCT transformation, quantization and encoding. The compression process is simplified, so that the calculated amount in the DCT compression process is greatly reduced, the resource image is saved, and DCT compression optimization of the JPEG image is realized.
In this embodiment, by comparing source image data of two adjacent sub-blocks, if the source image data of two sub-blocks are equal, the compressed image data of the previous sub-block may be directly used without performing a repeated compression process, and in order to maintain the continuity of the whole frame image, when the number of the omitted compression processes is increased, the omitted compression process is not performed, that is, the adjacent sub-blocks are still compressed. By comparing the compressed image data of the adjacent two sub-blocks, the compressed image data of the next sub-block is predicted, and if the compressed image data of the two sub-blocks can be directly used for predicting the compressed image data, the compression process does not need to be performed again. And when the two adjacent sub-blocks are unequal and dissimilar, carrying out a normal compression flow on the adjacent sub-blocks. The last sub-block of a frame of image is subjected to a normal compression process to maintain the integrity of the entire frame of image.
In this embodiment, the specific steps include: reading first (b=0) sub-block source image data of a frame of image, performing DCT-based compression on the sub-blocks to obtain compressed image data, and storing the compressed image data into a memory; reading second (b=1) sub-block source image data of the image, taking the second sub-block source image data as a reference sub-block, performing DCT-based compression on the sub-block to obtain reference compressed image data, and storing the reference compressed image data into a memory; comparing the compressed image data of the two sub-blocks, wherein the first comparison after initialization is the compressed image data of b=0 and b=1, the second comparison is the reference compressed image data and the adjacent compressed image data, and the compressed image data of the next sub-block is predicted, wherein the prediction method is that if the two compressed image data are equal, the compressed image data of the next sub-block is equal to the adjacent compressed image data, and if the compressed image data are graded within the threshold range, the compressed image data of the next sub-block are graded according to the equal difference value; reading the next sub-block source image data, namely b=b+1, as an adjacent sub-block; judging whether the adjacent sub-block is the last sub-block of a frame of image, and obtaining the sequence number b of the last sub-block through the row-column size of the resolution ratio; if the image is the last sub-block of a frame of image, performing DCT-based compression to complete the image compression of the frame of image, and storing compressed image data into a memory; if not, comparing the reference sub-block with the source image data of the adjacent sub-block; if the reference sub-block and the adjacent sub-block source image data are equal, the adjacent sub-block source image data do not need DCT compression, and the compression number is omitted and one is added; judging the omitted compression number and a preset maximum value, if the omitted compression number is larger than the preset maximum value, namely, a plurality of continuous sub-blocks exist and are not compressed, performing DCT (discrete cosine transform) compression on adjacent sub-blocks in order to keep the continuity of the whole frame image and the continuity of data, and storing the compressed image data of the adjacent sub-blocks into a memory; if the omitted compressed number is smaller than the preset maximum value, namely the two sub-block source image data are the same, omitting the DCT compression flow, storing the compressed image data of the reference sub-block into a memory, and updating the compressed image data of the reference sub-block to adjacent compressed image data; if the source image data of the reference sub-block and the adjacent sub-block are not equal, continuing to compare whether the reference sub-block and the adjacent sub-block have similarity; if the reference sub-block and the adjacent sub-block source image data are graded within the threshold range, the adjacent sub-block source image data do not need DCT-based compression, the predicted compressed image data are stored in a memory, and the predicted compressed image data are updated to the adjacent compressed image data; if the reference sub-block and the adjacent sub-block source image data do not have similarity, DCT compression is carried out on the adjacent sub-block source image data, and the adjacent sub-block compressed image data are stored in a memory; the adjacent sub-block is changed to the reference sub-block, the compressed image data of the adjacent sub-block is changed to the compressed image data of the reference sub-block, and the next sub-block is read back as the adjacent sub-block.
In some embodiments of the invention, further comprising: judging whether the adjacent sub-block is the last sub-block, if so, performing DCT compression based on the adjacent sub-block, and storing the compressed image data into a memory.
In some embodiments of the invention, further comprising: in response to the source image data of the adjacent sub-block and the source image data of the reference sub-block being unequal, further determining whether the source image data of the adjacent sub-block and the source image data of the reference sub-block are similar; in response to the source image data of the adjacent sub-block being dissimilar to the source image data of the reference sub-block, performing DCT compression based on the adjacent sub-block and storing the compressed image data in the memory; the adjacent sub-block is used as a new reference sub-block, the compressed image data of the adjacent sub-block is used as the compressed image data of the new reference sub-block, and the step of reading the next sub-block as the adjacent sub-block is returned.
In some embodiments of the invention, further comprising: in response to the source image data of the adjacent sub-block being similar to the source image data of the reference sub-block, predicting the compressed image data of the adjacent sub-block based on the compressed image data of the reference sub-block and the compressed image data of the previous reference sub-block, and storing the predicted compressed image data in the memory; the adjacent sub-block is used as a new reference sub-block, the compressed image data of the adjacent sub-block is used as the compressed image data of the new reference sub-block, and the step of reading the next sub-block as the adjacent sub-block is returned.
In some embodiments of the present invention, predicting compressed image data of a neighboring sub-block based on compressed image data of a reference sub-block and compressed image data of a previous reference sub-block includes: judging whether the compressed image data of the reference sub-block is equal to the compressed image data of the previous reference sub-block; if the compressed image data of the reference sub-block is equal to the compressed image data of the previous reference sub-block, predicting the compressed image data of the adjacent sub-block as the compressed image data of the reference sub-block; if the compressed image data of the reference sub-block and the compressed image data of the previous reference sub-block are not equal and are graded within a threshold range, the compressed image data of the adjacent sub-block is predicted based on the arithmetic difference value of the compressed image data of the reference sub-block and the compressed image data of the previous reference sub-block.
In some embodiments of the present invention, determining whether source image data of neighboring sub-blocks and source image data of reference sub-blocks are similar comprises: judging whether the source image data of the adjacent sub-block and the source image data of the reference sub-block are graded within a threshold range; if the source image data of the adjacent sub-block and the source image data of the reference sub-block are graded within the threshold range, the source image data of the adjacent sub-block and the source image data of the reference sub-block are considered to be similar; if the source image data of the adjacent sub-block and the source image data of the reference sub-block do not change in a threshold range, the source image data of the adjacent sub-block and the source image data of the reference sub-block are considered to be dissimilar.
In some embodiments of the invention, further comprising: in response to the number of omitted compression being greater than a preset number of times, performing DCT compression based on the adjacent sub-blocks, and storing the compressed image data into a memory; resetting the omitted compression number to zero, taking the adjacent sub-block as a new reference sub-block, taking the compressed image data of the adjacent sub-block as the compressed image data of the new reference sub-block, and returning to the step of reading the next sub-block as the adjacent sub-block.
It should be noted that, in the above embodiments of the compression method of the JPEG image, the steps may be intersected, replaced, added and subtracted, so that the compression method of the JPEG image by these reasonable permutation and combination transformations should also belong to the protection scope of the present invention, and the protection scope of the present invention should not be limited to the embodiments.
Based on the above object, a second aspect of the embodiments of the present invention proposes a compression apparatus for a JPEG image. Fig. 2 is a schematic diagram of an embodiment of a compression apparatus for JPEG images according to the present invention. As shown in fig. 2, the embodiment of the invention includes the following modules: a first module S11 configured to read a current sub-block as a reference sub-block, perform DCT compression based on the reference sub-block, and store compressed image data into a memory; a second module S12 configured to read a next sub-block as an adjacent sub-block and determine whether source image data of the adjacent sub-block and source image data of a reference sub-block are equal; a third module S13 configured to, in response to the source image data of the adjacent sub-block and the source image data of the reference sub-block being equal, increase the omitted compression number by one, and determine whether the omitted compression number is greater than a preset number of times; a fourth module S14 configured to store the compressed image data of the reference sub-block as the compressed image data of the neighboring sub-block in the memory in response to the omitted compression number being not greater than the preset number of times; and a fifth module S15 configured to take the adjacent sub-block as a new reference sub-block and take the compressed image data of the adjacent sub-block as the compressed image data of the new reference sub-block, and return to the second module.
Based on the above object, a third aspect of the embodiments of the present invention proposes a computer device. Fig. 3 is a schematic diagram of an embodiment of a computer device provided by the present invention. As shown in fig. 3, an embodiment of the present invention includes the following means: at least one processor S21; and a memory S22, the memory S22 storing computer instructions S23 executable on the processor, which when executed by the processor, implement the steps of the above method.
The invention also provides a computer readable storage medium. Fig. 4 is a schematic diagram of an embodiment of a computer-readable storage medium provided by the present invention. As shown in fig. 4, the computer-readable storage medium stores S31 a computer program S32 which, when executed by a processor, performs the method as above.
Finally, it should be noted that, as will be understood by those skilled in the art, implementing all or part of the above-mentioned embodiments of the method may be implemented by a computer program to instruct related hardware, and the program of the compression method of the JPEG image may be stored in a computer readable storage medium, and the program may include the steps of the embodiments of the methods when executed. The storage medium of the program may be a magnetic disk, an optical disk, a read-only memory (ROM), a random-access memory (RAM), or the like. The computer program embodiments described above may achieve the same or similar effects as any of the method embodiments described above.
Furthermore, the method disclosed according to the embodiment of the present invention may also be implemented as a computer program executed by a processor, which may be stored in a computer-readable storage medium. The above-described functions defined in the methods disclosed in the embodiments of the present invention are performed when the computer program is executed by a processor.
Furthermore, the above-described method steps and system units may also be implemented using a controller and a computer-readable storage medium storing a computer program for causing the controller to implement the above-described steps or unit functions.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as software or hardware depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
In one or more exemplary designs, the functions may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one location to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a general purpose or special purpose computer or general purpose or special purpose processor. Further, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, includes Compact Disc (CD), laser disc, optical disc, digital Versatile Disc (DVD), floppy disk, blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the disclosed embodiments may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that as used herein, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items.
The foregoing embodiment of the present invention has been disclosed with reference to the number of embodiments for the purpose of description only, and does not represent the advantages or disadvantages of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, and the program may be stored in a computer readable storage medium, where the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those of ordinary skill in the art will appreciate that: the above discussion of any embodiment is merely exemplary and is not intended to imply that the scope of the disclosure of embodiments of the invention, including the claims, is limited to such examples; combinations of features of the above embodiments or in different embodiments are also possible within the idea of an embodiment of the invention, and many other variations of the different aspects of the embodiments of the invention as described above exist, which are not provided in detail for the sake of brevity. Therefore, any omission, modification, equivalent replacement, improvement, etc. of the embodiments should be included in the protection scope of the embodiments of the present invention.
Claims (10)
1. A compression method of a JPEG image, comprising the steps of:
reading a current sub-block as a reference sub-block, performing DCT compression based on the reference sub-block, and storing compressed image data into a memory;
reading a next sub-block as an adjacent sub-block, and judging whether source image data of the adjacent sub-block and source image data of the reference sub-block are equal;
in response to the source image data of the adjacent sub-block and the source image data of the reference sub-block being equal, adding one to the omitted compression number, and judging whether the omitted compression number is greater than a preset number of times;
in response to the omitted compression number not being greater than a preset number of times, storing the compressed image data of the reference sub-block as the compressed image data of the adjacent sub-block into a memory; and
and taking the adjacent sub-block as a new reference sub-block, taking the compressed image data of the adjacent sub-block as the compressed image data of the new reference sub-block, and returning to the step of reading the next sub-block as the adjacent sub-block.
2. The compression method of a JPEG image in accordance with claim 1, further comprising:
judging whether the adjacent sub-block is the last sub-block, if so, performing DCT compression based on the adjacent sub-block, and storing the compressed image data into a memory.
3. The compression method of a JPEG image in accordance with claim 1, further comprising:
in response to the source image data of the adjacent sub-block and the source image data of the reference sub-block being unequal, further determining whether the source image data of the adjacent sub-block and the source image data of the reference sub-block are similar;
in response to the source image data of the adjacent sub-block being dissimilar to the source image data of the reference sub-block, performing DCT compression based on the adjacent sub-block and storing the compressed image data in a memory;
and taking the adjacent sub-block as a new reference sub-block, taking the compressed image data of the adjacent sub-block as the compressed image data of the new reference sub-block, and returning to the step of reading the next sub-block as the adjacent sub-block.
4. A compression method of a JPEG image according to claim 3, further comprising:
in response to the source image data of the adjacent sub-block being similar to the source image data of the reference sub-block, predicting the compressed image data of the adjacent sub-block based on the compressed image data of the reference sub-block and the compressed image data of the previous reference sub-block, and storing the predicted compressed image data in a memory;
and taking the adjacent sub-block as a new reference sub-block, taking the compressed image data of the adjacent sub-block as the compressed image data of the new reference sub-block, and returning to the step of reading the next sub-block as the adjacent sub-block.
5. The compression method of the JPEG image according to claim 4, wherein predicting the compressed image data of the neighboring sub-block based on the compressed image data of the reference sub-block and the compressed image data of the previous reference sub-block comprises:
judging whether the compressed image data of the reference sub-block is equal to the compressed image data of the previous reference sub-block;
if the compressed image data of the reference sub-block is equal to the compressed image data of the previous reference sub-block, predicting the compressed image data of the adjacent sub-block as the compressed image data of the reference sub-block;
and predicting the compressed image data of the adjacent sub-block based on the arithmetic difference value of the compressed image data of the reference sub-block and the compressed image data of the previous reference sub-block if the compressed image data of the reference sub-block and the compressed image data of the previous reference sub-block are not equal and are graded within a threshold range.
6. A compression method of a JPEG image according to claim 3, wherein determining whether the source image data of the neighboring sub-block and the source image data of the reference sub-block are similar comprises:
judging whether the source image data of the adjacent sub-block and the source image data of the reference sub-block are graded within a threshold range;
if the source image data of the adjacent sub-block and the source image data of the reference sub-block are graded within a threshold range, the source image data of the adjacent sub-block and the source image data of the reference sub-block are considered to be similar;
and if the source image data of the adjacent sub-block and the source image data of the reference sub-block are not graded within the threshold range, the source image data of the adjacent sub-block and the source image data of the reference sub-block are not considered to be similar.
7. The compression method of a JPEG image in accordance with claim 1, further comprising:
in response to the omitted compression number being greater than a preset number of times, performing DCT compression based on the adjacent sub-blocks, and storing compressed image data into a memory;
resetting the omitted compression number to zero, taking the adjacent sub-block as a new reference sub-block, taking the compressed image data of the adjacent sub-block as the compressed image data of the new reference sub-block, and returning to the step of reading the next sub-block as the adjacent sub-block.
8. A compression apparatus for a JPEG image, comprising:
the first module is configured to read a current sub-block as a reference sub-block, perform DCT compression based on the reference sub-block, and store compressed image data into a memory;
a second module configured to read a next sub-block as a neighboring sub-block and determine whether source image data of the neighboring sub-block and source image data of the reference sub-block are equal;
a third module configured to, in response to the source image data of the adjacent sub-block and the source image data of the reference sub-block being equal, add one to the omitted compression number and determine whether the omitted compression number is greater than a preset number of times;
a fourth module configured to store the compressed image data of the reference sub-block as the compressed image data of the adjacent sub-block in a memory in response to the omitted compression number being not greater than a preset number of times; and
and a fifth module configured to take the adjacent sub-block as a new reference sub-block, take the compressed image data of the adjacent sub-block as the compressed image data of the new reference sub-block, and return to the second module.
9. A computer device, comprising:
at least one processor; and
a memory storing computer instructions executable on the processor, which when executed by the processor, perform the steps of the method of any one of claims 1-7.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method of any one of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110681371.0A CN113613022B (en) | 2021-06-18 | 2021-06-18 | Compression method, device and equipment of JPEG image and readable medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110681371.0A CN113613022B (en) | 2021-06-18 | 2021-06-18 | Compression method, device and equipment of JPEG image and readable medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113613022A CN113613022A (en) | 2021-11-05 |
CN113613022B true CN113613022B (en) | 2023-11-14 |
Family
ID=78336570
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110681371.0A Active CN113613022B (en) | 2021-06-18 | 2021-06-18 | Compression method, device and equipment of JPEG image and readable medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113613022B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114615209B (en) * | 2022-03-11 | 2024-03-08 | 山东云海国创云计算装备产业创新中心有限公司 | Dynamic adaptive image compression method, device, equipment and readable medium |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5661822A (en) * | 1993-03-30 | 1997-08-26 | Klics, Ltd. | Data compression and decompression |
US6427029B1 (en) * | 1997-08-28 | 2002-07-30 | Custom Technology Corp. | Image signal processing method and device, and storage medium |
EP1345449A1 (en) * | 2001-12-21 | 2003-09-17 | Chih-Ta Star Sung | Digital image compression and decompression using block coding |
US6847684B1 (en) * | 2000-06-01 | 2005-01-25 | Hewlett-Packard Development Company, L.P. | Zero-block encoding |
CN104869425A (en) * | 2015-05-13 | 2015-08-26 | 信阳师范学院 | Compression and decompression method based on texture image similarity |
CN109842803A (en) * | 2018-09-19 | 2019-06-04 | 华为技术有限公司 | A kind of method and device of compression of images |
CN110460854A (en) * | 2019-07-15 | 2019-11-15 | 珠海市杰理科技股份有限公司 | Method for compressing image |
GB202004639D0 (en) * | 2020-03-30 | 2020-05-13 | Imagination Tech Ltd | Methods and decompression units for decompressing image data compressed using pattern-based compression |
CN112153388A (en) * | 2020-09-18 | 2020-12-29 | 山东云海国创云计算装备产业创新中心有限公司 | Image compression method, device and related equipment |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
FR2850827B1 (en) * | 2003-02-03 | 2005-11-04 | Pagnac Andre | METHOD AND DEVICE FOR COMPRESSION OF PARTS OF IMAGES |
US9451275B2 (en) * | 2014-05-28 | 2016-09-20 | LassoFX, Inc. | System and method for storing and moving graphical image data sets with reduced data size requirements |
-
2021
- 2021-06-18 CN CN202110681371.0A patent/CN113613022B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5661822A (en) * | 1993-03-30 | 1997-08-26 | Klics, Ltd. | Data compression and decompression |
US6427029B1 (en) * | 1997-08-28 | 2002-07-30 | Custom Technology Corp. | Image signal processing method and device, and storage medium |
US6847684B1 (en) * | 2000-06-01 | 2005-01-25 | Hewlett-Packard Development Company, L.P. | Zero-block encoding |
EP1345449A1 (en) * | 2001-12-21 | 2003-09-17 | Chih-Ta Star Sung | Digital image compression and decompression using block coding |
CN104869425A (en) * | 2015-05-13 | 2015-08-26 | 信阳师范学院 | Compression and decompression method based on texture image similarity |
CN109842803A (en) * | 2018-09-19 | 2019-06-04 | 华为技术有限公司 | A kind of method and device of compression of images |
CN110460854A (en) * | 2019-07-15 | 2019-11-15 | 珠海市杰理科技股份有限公司 | Method for compressing image |
GB202004639D0 (en) * | 2020-03-30 | 2020-05-13 | Imagination Tech Ltd | Methods and decompression units for decompressing image data compressed using pattern-based compression |
CN112153388A (en) * | 2020-09-18 | 2020-12-29 | 山东云海国创云计算装备产业创新中心有限公司 | Image compression method, device and related equipment |
Non-Patent Citations (1)
Title |
---|
基于图像纹理特征的JPEG-XR帧内预测技术;邬春明,焦龙龙,张金强;《东北师大学报(自然科学版)》;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN113613022A (en) | 2021-11-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TW201826786A (en) | Low-complexity sign prediction for video coding | |
US8600183B2 (en) | Optimized method and system for entropy coding | |
JPWO2009057506A1 (en) | Image encoding method and decoding method, apparatus thereof, program thereof, and recording medium recording the program | |
CN113873252A (en) | Image processing method and device, electronic equipment and storage medium | |
CN111316642A (en) | Method and apparatus for signaling image coding and decoding partition information | |
CN113613022B (en) | Compression method, device and equipment of JPEG image and readable medium | |
CN110738666A (en) | discrete cosine transform-based image semantic segmentation method and device | |
US20240089494A1 (en) | Video encoding and decoding method and apparatus, storage medium, electronic device, and computer program product | |
KR101172983B1 (en) | Image data compression apparatus, decompression apparatus, compression method, decompression method, and computer-readable recording medium having program | |
US8934537B2 (en) | Video coding device and video coding method | |
JP2024505798A (en) | Point cloud encoding/decoding method and system, point cloud encoder, and point cloud decoder | |
US9812095B2 (en) | Video processing method including managing a reference picture list and video system therefore | |
TWI520587B (en) | Dynamic image predictive decoding method, dynamic image predictive decoding device, dynamic image predictive decoding program, dynamic image predictive coding method, dynamic image predictive coding device and dynamic image predictive coding program | |
CN115442617A (en) | Video processing method and device based on video coding | |
JP2017103723A (en) | Encoding device, decoding device, and program | |
US20210377523A1 (en) | Encoding device, encoding method, decoding device, and decoding method | |
CN111194552A (en) | Motion compensated reference frame compression | |
WO2024007157A1 (en) | Multi-reference line index list sorting method and device, video coding method and device, video decoding method and device, and system | |
CN117692648B (en) | Video encoding method, apparatus, device, storage medium, and computer program product | |
US20240357162A1 (en) | Receiver selected decimation scheme for video coding | |
US20240357184A1 (en) | Receiver side prediction of encoding selection data for video encoding | |
US20240357134A1 (en) | Distributed video coding using reliability data | |
Suresh et al. | Approximate compression: Enhancing compressibility through data approximation | |
Ibraheem et al. | Enhancing Versatile Video Coding Efficiency via Post-Processing of Decoded Frames Using Residual Network Integration in Deep Convolutional Neural Networks | |
CN115834910A (en) | Video encoding and decoding method and device, electronic equipment and storage medium |
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 |