CN103369312B - Method and device for compressing image - Google Patents
Method and device for compressing image Download PDFInfo
- Publication number
- CN103369312B CN103369312B CN201210092490.3A CN201210092490A CN103369312B CN 103369312 B CN103369312 B CN 103369312B CN 201210092490 A CN201210092490 A CN 201210092490A CN 103369312 B CN103369312 B CN 103369312B
- Authority
- CN
- China
- Prior art keywords
- pixel
- length
- pixel value
- image
- current
- 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
Abstract
The invention discloses a method and a device for compressing an image. The method for compressing the image comprises the steps of mapping a pixel value of a first length of the current pixel to a pixel value of a second length; a pixel value of a second length of a previous pixel is subtracted from the pixel value of the second length of the current pixel to obtain a pixel difference value of the current pixel and the previous pixel, and acquiring the lengthening coding length corresponding to the pixel difference value under the condition of carrying out lengthening coding on the pixel difference value; and selecting to carry out fixed length coding on the pixel value of the second length of the current pixel directly if the lengthening coding length corresponding to the pixel difference value is greater than the fixed length coding length corresponding to the current pixel under the condition of carrying out lengthening coding on the pixel value of the second length of the current pixel, and if not, selecting to carry out lengthening coding on the pixel difference value.
Description
Technical field
The present invention relates to image processing field, relates more specifically to a kind of method for compressing image and device.
Background technology
The definition more and more higher of digital video and digital picture, and the frame per second of digital video is also constantly increasing, from
And cause the size of the processing data in digital video/picture system to become increasing.Digital video/picture system must be located
Reason mass data, so required memory-size and bandwidth are all increased.
Between functional module and memory module in digital video/picture system or in digital video/image system
Embedded voice compression codecs is inserted between functional module and external memory storage in system for reduction memory-size and storage
Device bandwidth is highly useful.In the case where embedded voice compression codecs is inserted, initial data be transferred to memorizer it
Front elder generation is compressed, and then compressed data is first decompressed before processed resume module.
Typically, there are two kinds of method for compressing image:Lossy compression method and lossless compress.In order to reduce document size, pressure is damaged
Contracting has clipped some view data so as to sacrifice some picture qualities.Conversely, lossless compress has been fully retained original image
Content, and reduce document size by only removing the data bit of the complete reproduction for being used for original image.Lossy compression method
It is generally possible to the higher compression ratio of producing ratio lossless compress.In the appropriate compress technique of selection and compression ratio, user must examine
The factors such as specific image, desired picture quality and transmission time and the memory requirement that worry will be compressed.In order to reduce biography
The defeated time and/or memory requirement will be reduced, user would generally select higher compression ratio, but higher compression ratio will be led
Cause the reduction of picture quality.
The content of the invention
In view of problem above, the invention provides one kind can be with higher on the basis of visual picture quality is ensured
Compression ratio method for compressing image that image is compressed and device.
Method for compressing image according to embodiments of the present invention, including:The pixel value of the first length of current pixel is mapped
For the pixel value of the second length;By the pixel value phase of the pixel value of the second length of current pixel and the second length of previous pixel
Subtract to obtain the pixel value difference of current pixel and previous pixel, and obtain in the feelings that variable-length encoding is carried out to the pixel value difference
Variable-length encoding length corresponding with the pixel value difference under condition;If the variable-length encoding length corresponding with the pixel value difference
The fixed length corresponding with current pixel in the case of more than block code is carried out in the pixel value of the second length to current pixel
Code length, then selecting the pixel value of the second length directly to current pixel carries out block code, otherwise selects to the picture
Plain difference carries out variable-length encoding.
Image compressing device according to embodiments of the present invention, including:Data mapping unit, for by the first of current pixel
The pixel value of length is mapped as the pixel value of the second length;Differential coding unit, for by the picture of the second length of current pixel
Plain value is subtracted each other to obtain the pixel value difference of current pixel and previous pixel with the pixel value of the second length of previous pixel, and is obtained
Being taken at carries out corresponding with pixel value difference variable-length encoding length in the case of variable-length encoding to the pixel value difference;And
Mode selecting unit, if be more than in second to current pixel for the variable-length encoding length corresponding with the pixel value difference
The pixel value of length carries out corresponding with current pixel block code length in the case of block code, then select directly to working as
The pixel value of the second length of preceding pixel carries out block code, otherwise selects to carry out variable-length encoding to the pixel value difference.
By image compressing device and method according to embodiments of the present invention, it is possible to reduce the transmission time of image and/or
Memory requirement is reduced, and is not result in the reduction of the visual quality of image.
Description of the drawings
From below in conjunction with the accompanying drawings to the present invention specific embodiment description in the present invention may be better understood, its
In:
Fig. 1 shows the block diagram of image compressing device according to embodiments of the present invention;
Fig. 2 shows the flow chart of method for compressing image according to embodiments of the present invention;And
Fig. 3 shows the signal of the form of the code stream that image compressing device and method according to Fig. 1 and Fig. 2 draw
Figure.
Specific embodiment
The feature and exemplary embodiment of various aspects of the present invention is described more fully below.Explained below covers many
Detail, to provide complete understanding of the present invention.It will be apparent, however, to one skilled in the art that
The present invention can be implemented in the case of some details in not needing these details.Below to the description of embodiment only
It is to be provided to clearer understanding of the invention by illustrating the example of the present invention.The present invention is not limited to set forth below
Any concrete configuration and algorithm, but cover coherent element, part and calculation under the premise of without departing from the spirit of the present invention
Any modification, replacement and the improvement of method.
Typically, it is possible to use 24 bits to describe high-quality digital color image in each pixel.Wherein, three
In primary color space, color component R (redness), G (green), the B (blueness) of each pixel can be described respectively using 8 bits
In each color component;In YCbCr color spaces, the brightness point of each pixel can be described respectively using 8 bits
Each component in amount Y, chromatic component Cb, chromatic component Cr.For every kind of point in three primary colours and YCbCr color spaces
, there are 256 color grades in amount.Method for compressing image and device according to embodiments of the present invention is designed to abandon figure to be compressed
Information that human eye as in is not easy to discover (, human eye is difficult the slight change for discovering color), with higher compression ratio pair
Image to be compressed is compressed.
Fig. 1 shows the block diagram of image compressing device according to embodiments of the present invention.Fig. 2 is shown according to present invention enforcement
The flow chart of the method for compressing image of example.With reference to Fig. 1 and Fig. 2, to image compressing device according to embodiments of the present invention and
Method is described in detail.
As shown in figure 1, image compressing device 100 according to embodiments of the present invention is compiled including data mapping unit 102, difference
Code (DPCM) unit 104 and mode selecting unit 106.Wherein, image compressing device 100 according to embodiments of the present invention with
Segment realizes that the compression to image to be compressed is processed for unit.Specifically, original image is divided into multiple segments and is deposited
In fragment buffers, image compressing device according to embodiments of the present invention obtains each piece to be compressed from fragment buffers for storage
It is disconnected.
Wherein, data mapping unit 102 is used for the current pixel (that is, current pixel to be encoded) in segment to be compressed
The pixel value of the first length be mapped as the pixel value (that is, execution step S202) of the second length;Differential coding unit 104 is used for
Pixel value difference between the pixel value of the second length for obtaining the pixel value and previous pixel of the second length of current pixel, and
Obtain the variable-length encoding length corresponding with above-mentioned pixel value difference in the case where variable-length encoding is carried out to above-mentioned pixel value difference
(that is, execution step S204);Mode selecting unit 106 is used for, if the variable-length encoding length corresponding with above-mentioned pixel value difference
With the second length of current pixel in the case of more than block code is carried out in the pixel value of the second length to current pixel
The corresponding block code length of pixel value, then selecting the pixel value of the second length directly to current pixel carries out fixed length volume
Code, otherwise selects to carry out above-mentioned pixel value difference variable-length encoding (that is, execution step S206).
Below by taking YcbCr color spaces as an example describing image compressing device according to embodiments of the present invention and method reality
Existing image compression process.
Any one pixel (hereinafter referred to current pixel) that any one segment is included is detailed below
Any one color component pixel value cataloged procedure.It should be noted that 8 bit pixel values cited below, 5 bits
Pixel value or 6 bit pixel values all correspond to the pixel value of same color component.Below by taking luminance component Y as an example illustrating
Image compressing device according to embodiments of the present invention and method.
First, 8 bit pixel values of the luminance component Y of current pixel are mapped as 5 bits or 6 by data mapping unit 102
Bit pixel values.Then, 5 bits or 6 bit pixels of the luminance component Y of current pixel of differential coding (DPCM) unit 104
Value deduct 5 bits or 6 bit pixels of the luminance component Y of previous pixel be worth to it is relative with the luminance component Y of two pixels
The pixel value difference answered, and obtain the coding corresponding with the pixel value difference in the case where variable-length encoding is carried out to the pixel value difference
Length.Finally, 5 bits or 6 bit pixel values that mode selecting unit 106 compares in the luminance component Y to current pixel are carried out
In the case of block code the code length corresponding with 5 bits or 6 bit pixel values of the luminance component Y of current pixel and
Corresponding with above-mentioned pixel value difference code length in the case of variable-length encoding is carried out to above-mentioned pixel value difference, if to current
5 bits or 6 bit pixel values of the luminance component Y of pixel carry out the luminance component Y in the case of block code with current pixel
5 bits or the corresponding code length of 6 bit pixel values it is less, then select 5 ratios of luminance component Y directly to current pixel
Special or 6 bit pixel values carry out block code, otherwise select to carry out variable-length encoding to above-mentioned pixel value difference.
Data map
8 bit pixel values of any one color component of any one pixel are mapped as into 5 bits or 6 bit pixel values
Mode can have multiple choices, user can be adjusted according to the diversity of different application situation.One is only included below
Nonlinear mapping method is planted, i.e., 8 bit pixel values is mapped as by 5 bits or 6 bit pixel values according to table 1 below or table 2.
The bit pixel values of table 18 are mapped as 6 bit pixel values
The bit pixel values of table 28 are mapped as 5 bit pixel values
DPCM
For each pixel P (k) in a segment:
D (k)=X (k) k=0
D (k)=X (k)-X (k-1) k!=0
That is, for first pixel P (0) in a segment, directly carrying out to the pixel value X (0) of the pixel
Block code, and pixel value difference d (0) need not be calculated;For other pixels P (k) beyond first pixel in a segment,
Then need to calculate the pixel between pixel value X (k) and the pixel value X (k-1) of its previous pixel P (k-1) of pixel P (k)
Difference d (k).
For image compressing device 100 according to embodiments of the present invention, because it is needed in units of segment to be compressed
Image is compressed, so the image compressing device 100 may further include segment division unit 108, for will be to be compressed
Image division is multiple segments, it is possible to which these segments are stored in segment caching (that is, execution step S208).In addition, should
Image compressing device 100 can also include compression performance element 110, for according to the selection of mode selecting unit 106 to current
The pixel value of the second length of pixel carries out block code, or the pixel value and previous pixel to the second length of current pixel
The second length pixel value between pixel value difference carry out variable-length encoding (that is, execution step S210).
Specifically, for pixel value difference d (k), can be carried out using index Columbus (Exp-Golomb) coded method
Variable-length encoding.But, if the variable-length encoding length of pixel value difference d (k) has exceeded the block code length of current pixel, select
Select carries out block code to current pixel.Here, it is pixel value difference or current to carry out labelling data below using a bit
The coding result of the pixel value of pixel.Code stream form after packing is as shown in Figure 3.
By image compressing device and method according to embodiments of the present invention, it is possible to reduce the transmission time of image and/or
Memory requirement is reduced, and is not result in the reduction of the visual quality of image.
Above by reference to the present invention specific embodiment describing the present invention, but those skilled in the art are equal
Solution, these specific embodiments can be carried out various modifications, combination and change, without departing from by claims or its etc.
The spirit and scope of the present invention that jljl limits.
As needed can be with hardware or software come execution step.Note, without departing from the scope of the invention, can
The step of flow chart be given in this specification adds step, therefrom removal step or changes wherein.In general, flow chart
It is only used to indicate a kind of possible sequence of the basic operation for realizing function.
Embodiments of the invention can be using the universal digital computer of programming, using special IC, FPGA
Device, field programmable gate array, the system of light, chemistry, biological, quantum or nanometer engineering, component and mechanism come
Realize.In general, function of the invention can be realized by any means known in the art.Can be using distributed or networking
System, component and circuit.The communication of data or transmission can be wired, wirelessly or through any other means.
Will additionally appreciate, according to the needs of application-specific, one or more in the key element illustrated in accompanying drawing can be by more
Separate or more integrated mode is realizing, or or even be removed in some cases or be deactivated.Realization is storable in machine
Journey logic bomb in computer-readable recording medium to allow computer to perform any of the above described method, also the spirit and scope of the present invention it
It is interior.
Additionally, any signal arrows in accompanying drawing should be to be considered merely as exemplary rather than restricted, unless separately
There is concrete instruction.When term is also contemplated as making ability separately or in combination not know, the combination of component or step also will be by
It is considered to have described.
Claims (8)
1. a kind of method for compressing image, including:
The pixel value of the first length of current pixel is mapped as into the pixel value of the second length;
The pixel value of the second length of current pixel is subtracted each other with the pixel value of the second length of previous pixel to obtain current picture
The pixel value difference of plain and previous pixel, and obtain in the case where variable-length encoding is carried out to the pixel value difference with the pixel
The corresponding variable-length encoding length of difference;
If the variable-length encoding length corresponding with the pixel value difference is more than the pixel value in the second length to current pixel
Corresponding with current pixel block code length in the case of block code is carried out, is then selected directly to the second of current pixel
The pixel value of length carries out block code, otherwise selects to carry out variable-length encoding to the pixel value difference.
2. method for compressing image according to claim 1, it is characterised in that described image compression method is with image segments
Unit is realizing processing the compression of image to be compressed.
3. method for compressing image according to claim 1, it is characterised in that first in current pixel is image segments
During individual pixel, directly block code is carried out to the pixel value of the second length of current pixel.
4. method for compressing image according to claim 1, it is characterised in that when encoding to current pixel, use
Individual bit is indicating directly to carry out block code or to the pixel value difference to the pixel value of the second length of current pixel
Carry out variable-length encoding.
5. a kind of image compressing device, including:
Data mapping unit, for the pixel value of the first length of current pixel to be mapped as the pixel value of the second length;
Differential coding unit, for by the pixel value of the pixel value of the second length of current pixel and the second length of previous pixel
Subtract each other to obtain the pixel value difference of current pixel and previous pixel, and obtain carrying out variable-length encoding to the pixel value difference
In the case of the variable-length encoding length corresponding with the pixel value difference;And
Mode selecting unit, if be more than to current pixel for the variable-length encoding length corresponding with the pixel value difference
The pixel value of the second length carries out corresponding with current pixel block code length in the case of block code, then select direct
Block code is carried out to the pixel value of the second length of current pixel, otherwise selects to carry out variable-length encoding to the pixel value difference.
6. image compressing device according to claim 5, it is characterised in that described image compressor is with image segments
Unit is realizing processing the compression of image to be compressed.
7. image compressing device according to claim 5, it is characterised in that first in current pixel is image segments
During individual pixel, described image compressor directly carries out block code to the pixel value of the second length of current pixel.
8. image compressing device according to claim 5, it is characterised in that described when encoding to current pixel
Image compressing device indicates it is directly to carry out block code also to the pixel value of the second length of current pixel with a bit
It is that variable-length encoding is carried out to the pixel value difference.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210092490.3A CN103369312B (en) | 2012-03-27 | 2012-03-27 | Method and device for compressing image |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210092490.3A CN103369312B (en) | 2012-03-27 | 2012-03-27 | Method and device for compressing image |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103369312A CN103369312A (en) | 2013-10-23 |
CN103369312B true CN103369312B (en) | 2017-04-12 |
Family
ID=49369728
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210092490.3A Active CN103369312B (en) | 2012-03-27 | 2012-03-27 | Method and device for compressing image |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103369312B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE102018122297A1 (en) * | 2018-09-12 | 2020-03-12 | Arnold & Richter Cine Technik Gmbh & Co. Betriebs Kg | Process for compression and decompression of image data |
CN115100031B (en) * | 2022-08-23 | 2023-03-14 | 摩尔线程智能科技(北京)有限责任公司 | Image processing method and image processing apparatus |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1033883A1 (en) * | 1998-09-22 | 2000-09-06 | Matsushita Electric Industrial Co., Ltd. | Video signal encoding method, video signal encoder, and program recorded medium |
CN1664862A (en) * | 2004-03-02 | 2005-09-07 | Lg电子有限公司 | Image coding and decoding method |
CN101160725A (en) * | 2005-04-13 | 2008-04-09 | 弗劳恩霍夫应用研究促进协会 | Lossless encoding of information with guaranteed maximum bitrate |
CN101335897A (en) * | 2007-06-28 | 2008-12-31 | 联想(北京)有限公司 | Image compression/decoding method and system |
CN102196264A (en) * | 2010-03-16 | 2011-09-21 | 索尼公司 | Image coding apparatus and method, image decoding apparatus and method and program |
CN102271251A (en) * | 2010-06-02 | 2011-12-07 | 华晶科技股份有限公司 | Lossless image compression method |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP3975188B2 (en) * | 2002-09-30 | 2007-09-12 | 三星電子株式会社 | Video coding and decoding method and apparatus using spatial prediction coding of hue |
-
2012
- 2012-03-27 CN CN201210092490.3A patent/CN103369312B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1033883A1 (en) * | 1998-09-22 | 2000-09-06 | Matsushita Electric Industrial Co., Ltd. | Video signal encoding method, video signal encoder, and program recorded medium |
CN1664862A (en) * | 2004-03-02 | 2005-09-07 | Lg电子有限公司 | Image coding and decoding method |
CN101160725A (en) * | 2005-04-13 | 2008-04-09 | 弗劳恩霍夫应用研究促进协会 | Lossless encoding of information with guaranteed maximum bitrate |
CN101335897A (en) * | 2007-06-28 | 2008-12-31 | 联想(北京)有限公司 | Image compression/decoding method and system |
CN102196264A (en) * | 2010-03-16 | 2011-09-21 | 索尼公司 | Image coding apparatus and method, image decoding apparatus and method and program |
CN102271251A (en) * | 2010-06-02 | 2011-12-07 | 华晶科技股份有限公司 | Lossless image compression method |
Also Published As
Publication number | Publication date |
---|---|
CN103369312A (en) | 2013-10-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10165293B2 (en) | Method and apparatus for processing video | |
JP5069349B2 (en) | An efficient image compression scheme that minimizes storage and bus bandwidth requirements | |
US9299167B2 (en) | Image processing methods and apparatus using localized gamut definitions | |
US10672148B2 (en) | Compressing and uncompressing method for high bit-depth medical gray scale images | |
US20020196970A1 (en) | Image compression apparatus, image decompression apparatus, image compression method, image decompression method, computer program product, and recording medium | |
RU2008150330A (en) | COMPRESSING VIDEO DATA WITHOUT VISIBLE LOSS | |
CN102812705B (en) | image encoder and image decoder | |
CN109643456A (en) | Method for compressing image and equipment | |
EP3036743B1 (en) | Backwards compatible extended image format | |
KR20050027442A (en) | Method of compressing still pictures for mobile devices | |
US20130251261A1 (en) | Method And Apparatus For Image Data Compression | |
JP5530198B2 (en) | Image encoding method, decoding method, and apparatus | |
CN109831668A (en) | Data compression method and apparatus, data encoding/decoding method and device | |
CN109479151A (en) | Using the processes pixel of color component | |
JP2017529784A (en) | Image encoding and decoding method and apparatus | |
TWI705693B (en) | Apparatus and method for vector-based entropy coding for display stream compression | |
CN103369312B (en) | Method and device for compressing image | |
KR102626217B1 (en) | Frame buffer compressor and Image processing device comprising the same | |
CN110087082A (en) | Image processing apparatus and method for operating image processing apparatus | |
JP2016208356A (en) | Image compression device, image compression method, image decompression device and image decompression method | |
CN103517068B (en) | Method for compressing image and device | |
RU2705013C2 (en) | Method and device for colour image encoding and decoding | |
CN101406034A (en) | Compression scheme using qualifier watermarking and apparatus using the compression scheme for temporarily storing image data in a frame memory | |
US20050129110A1 (en) | Coding and decoding method and device | |
JP4708882B2 (en) | Bit budget monitor for compressed images |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |