CN101267566A - Image coding method and device - Google Patents
Image coding method and device Download PDFInfo
- Publication number
- CN101267566A CN101267566A CN 200810105766 CN200810105766A CN101267566A CN 101267566 A CN101267566 A CN 101267566A CN 200810105766 CN200810105766 CN 200810105766 CN 200810105766 A CN200810105766 A CN 200810105766A CN 101267566 A CN101267566 A CN 101267566A
- Authority
- CN
- China
- Prior art keywords
- resolution
- code stream
- discrete cosine
- discarding
- cosine transform
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 49
- 239000011159 matrix material Substances 0.000 claims abstract description 79
- 238000006243 chemical reaction Methods 0.000 claims description 23
- 238000013139 quantization Methods 0.000 claims description 12
- 238000012545 processing Methods 0.000 claims description 10
- 230000006835 compression Effects 0.000 abstract description 9
- 238000007906 compression Methods 0.000 abstract description 9
- 238000010586 diagram Methods 0.000 description 7
- 230000000717 retained effect Effects 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 3
- 239000004973 liquid crystal related substance Substances 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 239000003086 colorant Substances 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Landscapes
- Compression Or Coding Systems Of Tv Signals (AREA)
- Compression Of Band Width Or Redundancy In Fax (AREA)
Abstract
The embodiment of the invention relates to a method and a device for image coding. The method comprises the following steps: reading out the compression bit streams of an original image, resolving the compressed bit streams of the original image to obtain the resolution of the original image; entropy decoding and inverse scanning the resolved compressed bit streams to get an original discrete cosine transform coefficients matrix; determining the discarding mode of high frequency discrete cosine transform coefficients, according to the relation between the resolution of the original image and the resolution of a display device; discarding corresponding high frequency discrete cosine transform coefficients according to the discarding mode; scanning and entropy decoding a new discrete cosine transform coefficients matrix with the high frequency discrete cosine transform coefficients being discarded, and forming compressed transform bit streams, thus saving storing space and lowering the computation complexity of image decoding, as well as reducing cost and power consumption.
Description
Technical Field
The present invention relates to the field of image encoding and decoding, and in particular, to an image encoding method and apparatus.
Background
With the development of multimedia communication technology, people no longer satisfy the transmission of single words or sound, and the multimedia technology gradually enters into thousands of households from a common telephone to a video telephone, from a Short Messaging Service (SMS) to an Enhanced Message Service (EMS) to a Multimedia Messaging Service (MMS). Therefore, it is necessary to research how to efficiently process multimedia sources for more convenient and efficient storage and transmission. The Joint Photographic Experts Group (JPEG) standard is an important technique for image compression coding, and is suitable for continuously variable still images, including continuous variations in both gray scale and color.
JPEG involves two basic compression methods: one is lossy compression, also called Discrete Cosine Transform (DCT) compression; the other is lossless compression, also known as predictive compression method. The former, DCT compression method, is most commonly used, and may also be referred to as the Baseline Sequential Codec (Baseline Sequential Codec) method. Fig. 1 is a schematic diagram illustrating a DCT-based JPEG encoding process in the prior art. First, source image data is divided into 8 × 8 pixel blocks, and encoded in units of 8 × 8 pixel blocks. After Forward Discrete Cosine Transform (FDCT), 64 DCT coefficients are generated, which are arranged in Zigzag order from low frequency to high frequency, the first value being a Direct Current (DC) coefficient, and the other 63 being Alternating Current (AC) coefficients. The high frequency coefficients are located in the lower right region of the DCT coefficient matrix. Then, each DCT coefficient is quantized using the already normalized quantization table. The previously quantized DC coefficient is used to predict the current DC coefficient, and then the difference is encoded; the 63 AC coefficients are not differentially encoded. Finally, the DCT coefficients are entropy encoded. There are two types of entropy coding, one is Huffman coding and the other is arithmetic coding. Baseline uses Huffman coding. In FDCT transform and quantization, a loss of image accuracy, i.e., distortion, is introduced. Because human eyes are insensitive to high-frequency components, the high-frequency components in the image are removed, so that better compression is obtained, and meanwhile, a high-fidelity image on vision can be obtained.
The decoding process is opposite to the encoding process, and is a schematic view of a DCT-based JPEG decoding flow in the prior art, as shown in fig. 2. The decoding and displaying process of the JPEG image comprises three steps of storing the image, decoding the image and displaying the image. The image storage is to obtain the compressed data of the JPEG image by using serial communication, USB interface or Ethernet data transmission and store the data into a high-speed memory, such as: flash Memory (Flash), Static Random Access Memory (SRAM), and the like; the image decoding process is basically the reverse of the above coding process, and mainly includes preprocessing, Huffman decoding, Inverse quantization, Inverse Discrete Cosine Transform (IDCT); the image display is to convert the decoded image data into RGB signals and deactivate a Cathode Ray Tube (CRT) or a Liquid Crystal Display (LCD) to complete the display and restoration of the display colors of the original image.
A Digital Photo Frame (DPF) is a popular consumer electronics product for displaying Digital photos, and is mainly used for decoding and displaying JPEG images. The JPEG image may be transmitted to a Flash Memory (Flash) built in the Digital photo frame through a WiFi network and a USB interface, or may be from an external storage medium, including a Compact Flash (CF), a Memory Stick (MS), a Secure Digital (SD) card, a multimedia (MMC) card, (Smart Media, SM), a mobile hard disk (MicroDrive), and other popular Flash cards.
The image size of JPEG code stream files input by the existing DPF is often far larger than the display resolution of a liquid crystal display screen, typically, the size of pictures shot by a digital camera is 1024 × 768 to 4000 × 4000, while the liquid crystal display screen of the DPF is usually about 800 × 480, and the size of a low-end DPF screen is lower. Accordingly, a large amount of memory space is wasted in storing the excessively high-resolution JPEG compressed image files, and unnecessary computational complexity is increased in subsequently decoding the excessively high-resolution JPEG compressed image files according to the standard, thereby increasing costs and power consumption.
Disclosure of Invention
Embodiments of the present invention provide an image encoding method and apparatus, so as to solve the problem of storage space waste caused by storing a compressed image file with an excessively high resolution, and the problem of high computational complexity caused by decoding the image, thereby saving storage space, reducing computational complexity of decoding, and reducing cost and power consumption.
The embodiment of the invention provides an image coding method, which comprises the following steps:
reading a compressed code stream of an original image, analyzing the compressed code stream of the original image, and acquiring the resolution of the original image;
carrying out entropy decoding and inverse scanning on the analyzed compressed code stream to obtain an original discrete cosine transform coefficient matrix;
determining a discarding mode of the high-frequency discrete cosine transform coefficient according to the relation between the resolution of the original image and the resolution of the display device;
discarding the corresponding high-frequency discrete cosine transform coefficient according to the discarding mode;
and scanning and entropy coding the new discrete cosine transform coefficient matrix after the high-frequency discrete cosine transform coefficient is discarded to form a compressed transform code stream.
An embodiment of the present invention provides an image encoding device, including:
the first decoding module is used for reading out a compressed code stream of an original image, analyzing the compressed code stream of the original image to obtain the resolution of the original image, and performing entropy decoding and inverse scanning on the analyzed compressed code stream to obtain an original discrete cosine transform coefficient matrix;
the processing module is used for determining a discarding mode of the high-frequency discrete cosine transform coefficient according to the relation between the resolution of the original image and the resolution of the display device, and discarding the corresponding high-frequency discrete cosine transform coefficient according to the discarding mode;
and the coding module is used for scanning and entropy coding the new discrete cosine transform coefficient matrix after the high-frequency discrete cosine transform coefficient is discarded to form a compressed transform code stream.
According to the technical scheme, the high-frequency discrete cosine transform coefficient of the compressed code stream of the original image is discarded in advance and then is encoded again, so that the storage space occupied by the compressed image file with the overhigh resolution is saved, the operation complexity of decoding the image is reduced, and the cost and the power consumption are reduced.
Drawings
FIG. 1 is a schematic diagram of a DCT-based JPEG encoding process in the prior art;
FIG. 2 is a schematic diagram of a prior art DCT-based JPEG decoding process;
FIG. 3 is a flowchart illustrating an image encoding method according to a first embodiment of the present invention;
FIG. 4 is a flowchart illustrating an image encoding method according to a second embodiment of the present invention;
FIG. 5 is a flowchart illustrating an image encoding method according to a third embodiment of the present invention;
FIG. 6 is a flowchart illustrating an image encoding method according to a fourth embodiment of the present invention;
FIG. 7 is a diagram illustrating a structure of an image encoding apparatus according to a first embodiment of the present invention;
FIG. 8 is a diagram illustrating a second embodiment of an image encoding apparatus according to the present invention.
Detailed Description
The following describes in further detail specific embodiments of the present invention with reference to the accompanying drawings.
Fig. 3 is a flowchart illustrating an image encoding method according to a first embodiment of the present invention. The embodiment comprises the following steps:
301, receiving a compressed code stream of an original image from a network or reading the compressed code stream of the original image from a memory card;
303, carrying out entropy decoding and inverse scanning on the analyzed compressed code stream to obtain an original DCT coefficient matrix;
and step 306, scanning and entropy coding the new DCT coefficient matrix with the discarded high-frequency DCT coefficient to form a compressed conversion code stream.
In the embodiment, the high-frequency discrete cosine transform coefficient of the compressed code stream of the original image is discarded in advance and then is encoded again, so that the storage space occupied by the compressed image file with the overhigh resolution is saved, the operation complexity of decoding the image is reduced, and the cost and the power consumption are reduced.
FIG. 4 is a flowchart illustrating an image encoding method according to a second embodiment of the present invention. The embodiment comprises the following steps:
In this step, for an 8 × 8DCT coefficient matrix, after determining the discarding number in the horizontal and vertical directions according to the respective ratios of the resolution of the original JPEG code stream and the resolution of a display device such as an LCD in the horizontal and vertical directions, the DCT coefficient may discard the corresponding high-frequency discrete cosine transform coefficient according to the determined discarding number in the horizontal and vertical directions. Wherein,
the number of discarded columns of the discrete cosine transform coefficient matrix with the high frequency in the horizontal direction is 8- [8 × K/Sx ], and the value range of M' is [0, 7] and is an integer;
the number of discarded lines in the vertical direction is the number of discarded lines of the high-frequency discrete cosine transform coefficient matrix, i.e., N 'is 8- [8 × K/Sy ], and the value range of N' is [0, 7] and is an integer;
k is an adjusting coefficient considering display quality requirements, local storage capacity and decoding processing capacity, and the value range of K is [1, 2 ]; sx is the ratio of the resolution of the original JPEG compressed code stream to the resolution of the display device in the horizontal direction; sy is the ratio of the resolution of the original JPEG compressed code stream to the resolution of the display device in the vertical direction;
In this step, the discarded high frequency DCT coefficients of the DCT coefficient matrix may be set to 0 by the determined discarding mode.
For an 8 × 8DCT coefficient matrix, the remaining coefficients are discarded except for the remaining M × N (M ═ 8-M '; N ═ 8-N') DCT coefficients in the upper left corner of the DCT coefficient matrix, where M, N is a positive integer between [1, 8 ].
The discard Mode flag Mode in step 105 in this embodiment can be determined by the following equation:
the discard Mode flag Mode is N '× 16+ M'.
For example: when Sx and Sy are both 2, K is 1.3, it can be determined that M 'and N' are both 3, i.e. M, N are both 5, i.e. only the upper left 5 × 5 DCT coefficients are retained, and the remaining coefficients are discarded. The discarding Mode flag Mode is 51, and is represented as 0x33 by hexadecimal numbers;
and step 407, storing the converted JPEG code stream to a local storage medium.
Storing the modified converted JPEG code stream into a local NAND Flash or a memory card;
step 108, reading out a conversion JPEG code stream from the local storage medium according to the picture display request, and analyzing a new JPEG file in the conversion JPEG code stream;
409, carrying out entropy decoding and inverse scanning on the analyzed transformed JPEG code stream to obtain a new DCT coefficient matrix;
in step 411, the JPEG decoded reconstructed image is scaled to a predetermined display resolution, and output and displayed.
In the embodiment, after the corresponding high-frequency DCT coefficient is set to 0 according to the discarding mode, the DCT coefficient matrix is coded and stored again, and then the subsequent decoding is performed, so that the storage space occupied by storing the JPEG compressed image file with the too high resolution is saved, the operation amount during the decoding again is reduced, and the cost and the power consumption are reduced.
Fig. 5 is a flowchart illustrating an image encoding method according to a third embodiment of the present invention. The embodiment comprises the following steps:
step 501, receiving a JPEG compressed code stream of an original image from a network or reading the JPEG compressed code stream from a memory card;
502, analyzing a JPEG file in an original JPEG compressed code stream to obtain a resolution parameter of an original image;
step 503, performing huffman decoding and inverse scanning on the analyzed original JPEG compressed code stream to obtain an original DCT coefficient matrix;
step 504, determining a discarding mode of the high frequency DCT coefficient according to the relation between the resolution of the original JPEG image and the resolution of the display device.
In this step, for an 8 × 8DCT coefficient matrix, after determining the discarding number in the horizontal and vertical directions according to the respective ratios of the resolution of the original JPEG code stream and the resolution of a display device such as an LCD in the horizontal and vertical directions, the DCT coefficient may discard the corresponding high-frequency discrete cosine transform coefficient according to the determined discarding number in the horizontal and vertical directions. Wherein,
the number of discarded columns of the discrete cosine transform coefficient matrix with the high frequency in the horizontal direction is 8- [8 × K/Sx ], and the value range of M' is [0, 7] and is an integer;
the number of discarded lines in the vertical direction is the number of discarded lines of the high-frequency discrete cosine transform coefficient matrix, i.e., N 'is 8- [8 × K/Sy ], and the value range of N' is [0, 7] and is an integer;
k is an adjusting coefficient considering display quality requirements, local storage capacity and decoding processing capacity, and the value range of K is [1, 2 ]; sx is the ratio of the resolution of the original JPEG compressed code stream to the resolution of the display device in the horizontal direction; sy is the ratio of the resolution of the original JPEG compressed code stream to the resolution of the display device in the vertical direction;
and step 505, discarding the corresponding high-frequency DCT coefficient according to the discarding mode.
In this step, the discarded high frequency DCT coefficients of the DCT coefficient matrix may be set to 0 by the determined discarding mode.
For an 8 × 8DCT coefficient matrix, the remaining coefficients are discarded except for the remaining M × N (M ═ 8-M '; N ═ 8-N') DCT coefficients in the upper left corner of the DCT coefficient matrix, where M, N is a positive integer between [1, 8 ].
The discard Mode flag Mode in step 205 in this embodiment can be determined by the following formula:
the discard Mode flag Mode is N '× 16+ M'.
For example: when Sx and Sy are both 2, K is 1.3, it can be determined that M 'and N' are both 3, i.e. M, N are both 5, i.e. only the upper left 5 × 5 DCT coefficients are retained, and the remaining coefficients are discarded. The discarding Mode flag Mode is 51, and is represented as 0x33 by hexadecimal numbers;
step 506, scanning and entropy coding the new DCT coefficient matrix with the discarded high-frequency DCT coefficient to form a compressed conversion JPEG code stream;
and 507, storing the converted JPEG code stream and a discarding Mode identifier Mode of the identifier discarding Mode corresponding to the converted JPEG code stream to a local storage medium.
The storage method comprises two related storage methods, wherein one method is that a discarding Mode identifier Mode is added into a JPEG file description header of a conversion JPEG code stream, and then the conversion JPEG code stream file with the discarding Mode identifier Mode is stored in a local NAND Flash (or a memory card); another method may be to store the modified transform JPEG code stream in a local NAND Flash (or memory card), add and store the discard Mode identifier Mode in the transform code stream file discard identifier description table, where each discard Mode identifier data item corresponds to a transform code stream file.
Step 508, reading out the converted JPEG code stream and the corresponding discarding Mode identifier Mode from the local storage medium according to the picture display request, and analyzing a new JPEG file in the converted JPEG code stream;
509, performing entropy decoding and inverse scanning on the analyzed transformed JPEG code stream to obtain a new DCT coefficient matrix;
and step 510, carrying out simplified inverse quantization and IDCT on the new DCT coefficient matrix according to the discarding Mode identifier Mode to obtain a JPEG decoding reconstruction image.
All coefficients of a new DCT coefficient matrix do not need to be subjected to inverse quantization and IDCT any more, and only the coefficients of the M multiplied by N area at the upper left corner in the DCT coefficient matrix (namely the residual coefficients after removing the high-frequency DCT coefficients without 0 in the 8 multiplied by 8 coefficient matrix) need to be subjected to inverse quantization and IDCT according to the discarding Mode identifier Mode;
and step 511, the JPEG decoded and reconstructed image is scaled to the specified display resolution and is output and displayed.
In the embodiment, after the high-frequency DCT coefficient is set to 0 according to the discarding mode, the modified DCT coefficient matrix is coded and stored again, and then the subsequent simplified decoding is performed according to the discarding mode, so that the storage space occupied by storing the JPEG compressed image file with the too high resolution is saved, the subsequent operation complexity of decoding the JPEG image is further reduced, and the cost and the power consumption are reduced.
Fig. 6 is a flowchart illustrating an image encoding method according to a fourth embodiment of the present invention. Different from the third embodiment of the image encoding method of the present invention, in the present embodiment, the encoding and the secondary decoding do not use a standard JPEG algorithm, but may be a JPEG-like algorithm customized by the user. The embodiment comprises the following steps:
601, receiving a JPEG compressed code stream of an original image from a network or reading the JPEG compressed code stream from a memory card;
603, carrying out Hoffman decoding and inverse scanning on the analyzed original JPEG compressed code stream to obtain an original DCT coefficient matrix;
and step 604, determining a discarding mode of the high-frequency DCT coefficient according to the relation between the resolution of the original JPEG image and the resolution of the display device.
In this step, for an 8 × 8DCT coefficient matrix, after determining the discarding number in the horizontal and vertical directions according to the respective ratios of the resolution of the original JPEG code stream and the resolution of a display device such as an LCD in the horizontal and vertical directions, the DCT coefficient may discard the corresponding high-frequency discrete cosine transform coefficient according to the determined discarding number in the horizontal and vertical directions. Wherein,
the number of discarded columns of the discrete cosine transform coefficient matrix with the high frequency in the horizontal direction is 8- [8 × K/Sx ], and the value range of M' is [0, 7] and is an integer;
the number of discarded lines in the vertical direction is the number of discarded lines of the high-frequency discrete cosine transform coefficient matrix, i.e., N 'is 8- [8 × K/Sy ], and the value range of N' is [0, 7] and is an integer;
k is an adjusting coefficient considering display quality requirements, local storage capacity and decoding processing capacity, and the value range of K is [1, 2 ]; sx is the ratio of the resolution of the original JPEG compressed code stream to the resolution of the display device in the horizontal direction; and Sy is the ratio of the resolution of the original JPEG compressed code stream to the resolution of the display device in the vertical direction.
For an 8 × 8DCT coefficient matrix, the remaining coefficients are discarded except for the remaining M × N (M ═ 8-M '; N ═ 8-N') DCT coefficients in the upper left corner of the DCT coefficient matrix, where M, N is a positive integer between [1, 8 ].
In addition to the above rectangular discarding pattern, the high frequency coefficients may also be discarded in the reverse order of the Zig-Zag scan;
In the case of a rectangular discard pattern, an 8 × 8DCT coefficient matrix is changed to a coefficient matrix divided by M × N (M is 8-M '; N is 8-N', M, N is a positive integer between [1, 8 ]), and the element of the M × N matrix is the M × N DCT coefficient at the upper left corner of the 8 × 8DCT coefficient matrix.
The discard Mode flag Mode in step 305 in this embodiment can be determined by the following equation:
the discard Mode flag Mode is N '× 16+ M'.
For example: when Sx and Sy are both 2, K is 1.3, it can be determined that M 'and N' are both 3, i.e. M, N are both 5, i.e. only the upper left 5 × 5 DCT coefficients are retained, and the remaining coefficients are discarded. The discarding Mode flag Mode is 51, and is represented as 0x33 by hexadecimal numbers;
here the new coefficient matrix size is no longer 8 x 8 but M x N (M, N is a positive integer between [1, 8 ]). The scan here may be a Zig-Zag scan of the 8 x 8 matrix still using the JPEG standard, just skipping the discarded coefficients; other custom scanning algorithms may also be used. Here the entropy coding may be huffman coding; other entropy coding, such as arithmetic coding, may also be used;
The related storage methods are two, one is to add a discarding Mode identifier Mode to a description header of a conversion code stream file, and then the conversion code stream file with the discarding Mode identifier Mode is stored in a local NAND Flash (or a memory card); the other method can be that the modified conversion code stream is stored in a local NAND Flash (or a memory card), a discarding Mode identifier Mode is added and stored in a conversion code stream file discarding identifier description table, and each discarding Mode identifier data item corresponds to one conversion code stream file in the conversion code stream file discarding identifier description table;
and 609, carrying out entropy decoding and inverse scanning on the analyzed conversion code stream to obtain a new DCT coefficient matrix.
Here, the entropy decoding is the inverse process of the entropy encoding in step 306, the inverse scanning is the inverse process of the scanning in step 306, the DCT coefficient matrix of the transform code stream is an M × N matrix, and M is 8-M'; N-8-N ', M ' and N ' being positive integers between [0, 7], M ' and N ' being obtained by the discard Mode identification Mode;
and step 610, carrying out simplified inverse quantization and IDCT on the new DCT coefficient matrix according to the discarding Mode identifier Mode to obtain a decoded and reconstructed image.
Obtaining a high-frequency coefficient discarding column number M 'and a discarding line number N' from the discarding Mode identifier Mode, as M '═ 3 and N' ═ 3, and M ═ 5 can be obtained from Mode ═ 0x 33; n is 5; only the inverse quantization and the IDCT are needed to be performed on the 5 × 5 DCT coefficient matrix, but the reconstructed image block output by the IDCT is 8 × 8;
In the embodiment, after the high-frequency DCT coefficients are discarded according to the discarding mode, the residual DCT coefficient matrix is coded and stored again, and then the subsequent simplified decoding is performed, so that the storage space occupied by the compressed image with the overhigh resolution is saved, the subsequent operation complexity of decoding the compressed image is reduced, and the cost and the power consumption are reduced.
FIG. 7 is a schematic structural diagram of an image encoding device according to a first embodiment of the present invention. The present embodiment includes a first decoding module 10, a processing module 20, and an encoding module 30, which are connected in sequence. The first decoding module 10 is configured to receive a JPEG compressed code stream of an original image from a network or read the JPEG compressed code stream from a memory card, parse the JPEG compressed code stream of the original image to obtain a resolution of the original image, and perform huffman decoding and inverse scanning on the parsed JPEG compressed code stream to obtain an original DCT coefficient matrix; the processing module 20 is configured to determine a discarding mode of the high-frequency DCT coefficients according to a relationship between a resolution of the original image and a resolution of the display device, and discard corresponding high-frequency DCT coefficients according to the discarding mode; the encoding module 30 is configured to scan and entropy encode the new DCT coefficient matrix after discarding the high-frequency DCT coefficient, so as to form a compressed transform code stream.
In this embodiment, after the discarding module discards part of the corresponding high-frequency DCT coefficients according to the discarding mode, the encoding module encodes the DCT coefficient matrix again, thereby saving the storage space occupied by storing the compressed image with too high resolution, reducing the computational complexity of subsequently decoding the compressed image, and reducing the cost and power consumption.
Further, the processing module 20 in this embodiment may include an obtaining unit 21 and a discarding unit 22 connected to each other. The obtaining unit 21 is configured to determine a discarding mode of the high-frequency discrete cosine transform coefficient according to a relationship between a resolution of the original image and a resolution of the display device; the discarding unit 22 is configured to discard the corresponding high frequency discrete cosine transform coefficient according to the discarding mode obtained by the obtaining unit.
For an 8 × 8DCT coefficient matrix, the obtaining unit 21 may determine the discarding number in the horizontal and vertical directions according to the ratio of the resolution of the original JPEG code stream and the resolution of the display device, such as an LCD, in the horizontal and vertical directions, so that the discarding unit 22 discards the corresponding high frequency discrete cosine transform coefficient according to the discarding number in the horizontal and vertical directions determined by the obtaining unit 21. Accordingly, the acquisition unit 21 may include a discarded column number acquisition subunit and a discarded row number acquisition subunit. A discarded column number obtaining subunit, configured to determine, according to a relationship between a horizontal resolution of the original image and a horizontal resolution of the display device, a discarded column number of the high-frequency DCT coefficient matrix; and the discarded line number obtaining subunit is used for determining the discarded line number of the high-frequency DCT coefficient matrix according to the relationship between the vertical resolution of the original image and the vertical resolution of the display device. Wherein,
the number of discarded columns of the discrete cosine transform coefficient matrix with the high frequency in the horizontal direction is 8- [8 × K/Sx ], and the value range of M' is [0, 7] and is an integer;
the number of discarded lines in the vertical direction is the number of discarded lines of the high-frequency discrete cosine transform coefficient matrix, i.e., N 'is 8- [8 × K/Sy ], and the value range of N' is [0, 7] and is an integer;
k is an adjusting coefficient considering display quality requirements, local storage capacity and decoding processing capacity, and the value range of K is [1, 2 ]; sx is the ratio of the resolution of the original JPEG compressed code stream to the resolution of the display device in the horizontal direction; and Sy is the ratio of the resolution of the original JPEG compressed code stream to the resolution of the display device in the vertical direction.
The discarding unit 22 may set the discarded high frequency DCT coefficients to 0 for the DCT coefficient matrix by the discarding mode that the obtaining unit 21 has determined. For an 8 × 8DCT coefficient matrix, the discarding unit 22 discards the remaining coefficients except for keeping the top left M × N (M ═ 8-M '; N ═ 8-N') DCT coefficients of the DCT coefficient matrix, where M, N is a positive integer between [1, 8 ].
The drop Mode identification Mode can be determined by the following formula:
the discard Mode flag Mode is N '× 16+ M'.
For example: when Sx and Sy are both 2, K is 1.3, it can be determined that M 'and N' are both 3, i.e. M, N are both 5, i.e. only the upper left 5 × 5 DCT coefficients are retained, and the remaining coefficients are discarded. The discard Mode flag Mode is 51, and is represented as 0 × 33 by hexadecimal number.
FIG. 8 is a schematic structural diagram of an image encoding device according to a second embodiment of the present invention. On the basis of the above embodiment, the present embodiment may further include a storage module 40, a second decoding module 50, and a display module 60. The storage module 40 is configured to store the transform code stream stored by the encoding module 30; the second decoding module 50 is configured to read out a transform code stream from the storage module according to the picture display request, and decode the transform code stream to obtain a decoded reconstructed image; the display module 60 is used to scale and display the decoded reconstructed image.
In this embodiment, after the discarding module discards part of the corresponding high-frequency DCT coefficients according to the discarding mode, the encoding module encodes the DCT coefficient matrix again, and after the storage module stores the DCT coefficient matrix, the second decoding module performs subsequent simplified decoding to obtain a decoded reconstructed image and then displays the decoded reconstructed image, thereby saving a storage space occupied by storing a compressed image with an excessively high resolution, reducing the computational complexity of subsequent decoding of the compressed image, and reducing the cost and power consumption.
Further, in this embodiment, the storage module 40 may be further configured to store discarding mode information corresponding to the transform code stream.
Further, in this embodiment, the second decoding module 50 may be further configured to perform simplified inverse quantization and inverse discrete cosine transform on the new discrete cosine transform coefficient matrix according to the discarding mode information stored in the storage module 40.
In addition, it can be understood by those skilled in the art that all or part of the processes in the methods of the embodiments described above can be implemented by hardware related to instructions of a program, where the program can be stored in a computer-readable storage medium, and when executed, the program can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-only Memory (ROM), a Random Access Memory (RAM), or the like.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (13)
1. An image encoding method characterized by comprising:
reading a compressed code stream of an original image, analyzing the compressed code stream of the original image, and acquiring the resolution of the original image;
carrying out entropy decoding and inverse scanning on the analyzed compressed code stream to obtain an original discrete cosine transform coefficient matrix;
determining a discarding mode of the high-frequency discrete cosine transform coefficient according to the relation between the resolution of the original image and the resolution of the display device;
discarding the corresponding high-frequency discrete cosine transform coefficient according to the discarding mode;
and scanning and entropy coding the new discrete cosine transform coefficient matrix after the high-frequency discrete cosine transform coefficient is discarded to form a compressed transform code stream.
2. The image encoding method of claim 1, wherein said discarding the corresponding high frequency discrete cosine transform coefficients according to the discarding mode specifically comprises:
determining the discarding number in the horizontal direction and the vertical direction according to the respective proportions of the resolution of the original image and the resolution of the display device in the horizontal direction and the vertical direction;
and discarding the corresponding high-frequency discrete cosine transform coefficients according to the discarding number in the horizontal direction and the vertical direction.
3. The image encoding method according to claim 2, wherein the number of discards in the horizontal direction includes:
the discarded column number M 'of the high-frequency discrete cosine transform coefficient matrix is 8- [8 multiplied by K/Sx ], and M' is an integer between 0 and 7, wherein K is an adjustment coefficient and the value range of K is 1 to 2; sx is the ratio of the resolution of the original image to the resolution of the display device in the horizontal direction;
the number of discards in the vertical direction includes:
the number of discarded lines N 'of the high-frequency discrete cosine transform coefficient matrix is 8- [8 multiplied by K/Sy ], N' is an integer between 0 and 7, wherein K is an adjustment coefficient and the value range of K is 1 to 2; sy is the ratio of the resolution of the original image and the resolution of the display device in the vertical direction.
4. The encoding method according to claim 1, wherein said scanning and entropy encoding the new dct coefficient matrix after discarding the high frequency dct coefficients to form a compressed transform code stream further comprises:
storing the converted code stream to a local storage medium;
reading out a conversion code stream which is correspondingly stored in a local storage medium from the local storage medium according to the picture display request;
decoding the converted code stream to obtain a decoded and reconstructed image;
and scaling and displaying the decoded reconstructed image.
5. The image encoding method of claim 4, wherein said storing the transform codestream to a local storage medium specifically comprises: storing the conversion code stream and the discarding mode information corresponding to the conversion code stream to a local storage medium;
reading out the corresponding transform code stream stored in the local storage medium from the local storage medium according to the picture display request specifically includes: reading out the conversion code stream and the discarding mode information of the corresponding stored local storage medium from the local storage medium according to the picture display request;
the decoding the transform code stream to obtain a decoded reconstructed image specifically includes: and decoding the converted code stream according to the discarding mode information.
6. The image encoding method of claim 5, wherein the discarding mode information specifically includes a discarding mode flag, the discarding mode flag being a function of the number of discards in the horizontal direction and the number of discards in the vertical direction.
7. The image encoding method according to claim 5 or 6, wherein the decoding the transform code stream to obtain a decoded reconstructed image specifically includes:
analyzing the transform code stream, and performing entropy decoding and inverse scanning to obtain a new discrete cosine transform coefficient matrix;
and performing inverse quantization and inverse discrete cosine transform on the new discrete cosine transform coefficient matrix to obtain a decoded and reconstructed image.
8. An image encoding device characterized by comprising:
the first decoding module is used for reading out a compressed code stream of an original image, analyzing the compressed code stream of the original image to obtain the resolution of the original image, and performing entropy decoding and inverse scanning on the analyzed compressed code stream to obtain an original discrete cosine transform coefficient matrix;
the processing module is used for determining a discarding mode of the high-frequency discrete cosine transform coefficient according to the relation between the resolution of the original image and the resolution of the display device, and discarding the corresponding high-frequency discrete cosine transform coefficient according to the discarding mode;
and the coding module is used for scanning and entropy coding the new discrete cosine transform coefficient matrix after the high-frequency discrete cosine transform coefficient is discarded to form a compressed transform code stream.
9. The image encoding device according to claim 8, wherein the processing module comprises:
the acquisition unit is used for determining a discarding mode of the high-frequency discrete cosine transform coefficient according to the relation between the resolution of the original image and the resolution of the display device;
and the discarding unit is used for discarding the corresponding high-frequency discrete cosine transform coefficient according to the discarding mode acquired by the acquisition unit.
10. The image encoding device according to claim 9, wherein the acquisition unit includes:
a discarded column number obtaining subunit, configured to determine, according to a relationship between a horizontal resolution of the original image and a horizontal resolution of a display device, a discarded column number of a high-frequency discrete cosine transform coefficient matrix, where the discarded column number M 'is 8- [8 × K/Sx ], M' is an integer between 0 and 7, where K is an adjustment coefficient, and a value range of K is 1 to 2; sx is the ratio of the resolution of the original image to the resolution of the display device in the horizontal direction;
a discarded line number obtaining subunit, configured to determine, according to a relationship between a vertical resolution of the original image and a vertical resolution of a display device, a discarded line number of a high-frequency discrete cosine transform coefficient matrix, where N 'is 8- [8 × K/Sy ], and N' is an integer between 0 and 7, where K is an adjustment coefficient, and a value range of K is 1 to 2; sy is the ratio of the resolution of the original image and the resolution of the display device in the vertical direction.
11. The image encoding device according to claim 8, characterized in that the image encoding device further comprises:
the storage module is used for storing the conversion code stream generated by the coding module;
the second decoding module is used for reading the conversion code stream from the storage module according to the picture display request and decoding the conversion code stream to obtain a decoded and reconstructed image;
and the display module is used for scaling and displaying the decoded reconstructed image.
12. The image encoding apparatus of claim 11, wherein the storage module is further configured to store discard mode information corresponding to the transform code stream.
13. The image encoding apparatus of claim 12, wherein the second decoding module is further configured to perform inverse quantization and inverse discrete cosine transform on the new dct coefficient matrix according to the discard mode information stored in the storage module.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 200810105766 CN100539700C (en) | 2008-04-30 | 2008-04-30 | Method for encoding images and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 200810105766 CN100539700C (en) | 2008-04-30 | 2008-04-30 | Method for encoding images and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101267566A true CN101267566A (en) | 2008-09-17 |
CN100539700C CN100539700C (en) | 2009-09-09 |
Family
ID=39989646
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 200810105766 Active CN100539700C (en) | 2008-04-30 | 2008-04-30 | Method for encoding images and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100539700C (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107277551A (en) * | 2017-06-12 | 2017-10-20 | 电子科技大学 | A kind of Approximation Discrete cosine transform method |
CN108810549A (en) * | 2018-06-06 | 2018-11-13 | 天津大学 | A kind of flow media playing method towards low-power consumption |
CN110555345A (en) * | 2018-06-01 | 2019-12-10 | 北京深鉴智能科技有限公司 | Intelligent image analysis system and method |
CN112767503A (en) * | 2021-01-15 | 2021-05-07 | 北京航空航天大学 | JPEG compression coding-based digital pathology full-slice image rapid analysis method |
CN113170161A (en) * | 2020-08-31 | 2021-07-23 | 深圳市大疆创新科技有限公司 | Image encoding method, image decoding method, image encoding apparatus, image decoding apparatus, and storage medium |
CN113473139A (en) * | 2020-03-31 | 2021-10-01 | 华为技术有限公司 | Image processing method and image processing device |
CN114761968A (en) * | 2019-12-31 | 2022-07-15 | 阿里巴巴集团控股有限公司 | Method, system, and storage medium for frequency domain static channel filtering |
-
2008
- 2008-04-30 CN CN 200810105766 patent/CN100539700C/en active Active
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107277551A (en) * | 2017-06-12 | 2017-10-20 | 电子科技大学 | A kind of Approximation Discrete cosine transform method |
CN110555345A (en) * | 2018-06-01 | 2019-12-10 | 北京深鉴智能科技有限公司 | Intelligent image analysis system and method |
CN110555345B (en) * | 2018-06-01 | 2022-06-28 | 赛灵思电子科技(北京)有限公司 | Intelligent image analysis system and method |
CN108810549A (en) * | 2018-06-06 | 2018-11-13 | 天津大学 | A kind of flow media playing method towards low-power consumption |
CN108810549B (en) * | 2018-06-06 | 2021-04-27 | 天津大学 | Low-power-consumption-oriented streaming media playing method |
CN114761968A (en) * | 2019-12-31 | 2022-07-15 | 阿里巴巴集团控股有限公司 | Method, system, and storage medium for frequency domain static channel filtering |
CN113473139A (en) * | 2020-03-31 | 2021-10-01 | 华为技术有限公司 | Image processing method and image processing device |
CN113170161A (en) * | 2020-08-31 | 2021-07-23 | 深圳市大疆创新科技有限公司 | Image encoding method, image decoding method, image encoding apparatus, image decoding apparatus, and storage medium |
CN112767503A (en) * | 2021-01-15 | 2021-05-07 | 北京航空航天大学 | JPEG compression coding-based digital pathology full-slice image rapid analysis method |
Also Published As
Publication number | Publication date |
---|---|
CN100539700C (en) | 2009-09-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100539700C (en) | Method for encoding images and device | |
US6847735B2 (en) | Image processing system, image processing apparatus, image input apparatus, image output apparatus and method, and storage medium | |
US8503827B2 (en) | Apparatus and method for decoding image data | |
US11558631B2 (en) | Super-resolution loop restoration | |
US20170347105A1 (en) | Quantization Method and Apparatus in Encoding/Decoding | |
KR102120571B1 (en) | Entropy coding techniques for display stream compression (DSC) of non-4:4:4 chroma sub-sampling | |
CN104255033B (en) | Reduced look-up-table for LM mode computations | |
CN100524452C (en) | Digital image storage, displaying method and device | |
CN101990095B (en) | Method and apparatus for generating compressed file, camera module associated therewith, and terminal including the same | |
CN101653004A (en) | Decoder for selectively decoding predetermined data units from a coded bit stream | |
CN107483942B (en) | Decoding method of video data compressed code stream, encoding method and device of video data | |
CN106937113A (en) | Method for compressing image and device based on mixing colourity sample rate | |
WO2023040600A1 (en) | Image encoding method and apparatus, image decoding method and apparatus, electronic device, and medium | |
US7373001B2 (en) | Compressed moving image decompression device and image display device using the same | |
CN111741302A (en) | Data processing method and device, computer readable medium and electronic equipment | |
US20240080481A1 (en) | Sparse matrix representation using a boundary of non-zero coefficients | |
US8045824B2 (en) | Wavelet transformation-based image encoder, decoder and method for generating thumbnail image | |
CN109819259A (en) | A kind of image recompression processing method based on Huffman coding | |
CN115037941A (en) | Intelligent bracelet picture compression storage method for improving compression rate | |
KR20060022894A (en) | Apparatus and method for generating thumbnail image in mobile terminal | |
CN101489018A (en) | Static image compression method and computer readable storage apparatus | |
JP4739443B2 (en) | Method and apparatus for processing digital images | |
Hsu et al. | Compression of halftone video for electronic paper | |
CN116248895B (en) | Video cloud transcoding method and system for virtual reality panorama roaming | |
JP2018201143A (en) | Picture encoder |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |