CN108965880A - Compression of images, decompression method and device, storage medium, terminal - Google Patents
Compression of images, decompression method and device, storage medium, terminal Download PDFInfo
- Publication number
- CN108965880A CN108965880A CN201710360986.7A CN201710360986A CN108965880A CN 108965880 A CN108965880 A CN 108965880A CN 201710360986 A CN201710360986 A CN 201710360986A CN 108965880 A CN108965880 A CN 108965880A
- Authority
- CN
- China
- Prior art keywords
- block
- present encoding
- quantization step
- sub
- encoding block
- 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
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/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
-
- 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/102—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
- H04N19/124—Quantisation
-
- 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/189—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding
- H04N19/196—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding being specially adapted for the computation of encoding parameters, e.g. by averaging previously computed encoding parameters
-
- 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/42—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
-
- 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/90—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
- H04N19/91—Entropy coding, e.g. variable length coding [VLC] or arithmetic coding
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Computing Systems (AREA)
- Theoretical Computer Science (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
A kind of compression of images, decompression method and device, readable storage medium storing program for executing, terminal, described image compression method includes: when respectively being quantified the coefficient of frequency of the corresponding frequency domain of sub-blocks multiple in present encoding block using selected quantization parameter, the quantization parameter of present encoding block is to choose out of preset quantization parameter, and the corresponding compression ratio of the encoded information of present encoding block is made to be less than or equal to preset compression ratio threshold value and the smallest quantization parameter of numerical value;The prediction mode, selected quantization parameter and corresponding quantization step of sub-block each in present encoding block are subjected to entropy coding, obtain the encoded information of present encoding block, until multiple encoded blocks traversal is completed.Above-mentioned scheme keeps stable bandwidth load, and save bandwidth when carrying out compression processing to image.
Description
Technical field
The present invention relates to technical field of image processing, more particularly to a kind of compression of images, decompression method and device, deposit
Storage media, terminal.
Background technique
It is universal with portable multimedia apparatus such as mobile terminals, people for mobile terminal multimedia function, especially
It is also higher and higher to the image processing requirements of mobile terminal.
The image processing operations of mobile terminal include: from photosensitive element and Bell's colorful optical filter array (Bayer Color
Filter Array, BCFA) handled via imaging sensor after, storage is to chip external memory;Image preview processor is outside piece
Memory reads image, carries out reducing processing and show;Various image processors, such as filter noise reduction, 3D noise reduction, electronic flutter-proof,
Color conversion, strong Xanthophyll cycle, wide dynamic, the accumulation of slow shutter, frame etc. are required to read the image of chip external memory, by processing
Restore to chip external memory again afterwards.Image processing operations needs above-mentioned are frequently interacted between chip external memory, especially
It is in the case where more subtle for image operational requirements at present, various unconventional applications (APP) go out like the mushrooms after rain
It is existing, such as the correction of human face detection, the colour of skin, backlight, it is equally also required to interact with chip external memory, accesses the efficiency of chip external memory
Face test.
Various image procossings are completed, non real-time access under real time access or line, needs piece external storage either on line
Device has enough bandwidth to be able to use.Therefore, how while ensuring picture quality, control bandwidth load, to reach bandwidth
The problem of saving and real-time and efficiently chip external memory access, becoming urgent need to resolve.
Summary of the invention
The technical issues of embodiment of the present invention solves how is kept steady when carrying out compression and decompression processing to image
Fixed bandwidth load, and save bandwidth.
To solve the above problems, the embodiment of the invention provides a kind of method for compressing image, which comprises will input
Raw image data be divided into corresponding multiple encoded blocks;The obtained multiple encoded blocks of division are traversed, it will be all over
The present encoding block gone through is divided into corresponding multiple sub-blocks;Present encoding area is chosen from preset multiple prediction modes
The corresponding prediction mode of each sub-block in block;The prediction error of the pixel of sub-block each in present encoding block is distinguished
It converts to the coefficient of frequency of frequency domain;The quantization parameter of present encoding block is chosen, and is distinguished using selected quantization parameter
The coefficient of frequency of the corresponding frequency domain of sub-blocks multiple in present encoding block is quantified, the amount of present encoding block is obtained
Change rank;Wherein, the quantization parameter of present encoding block is to choose out of preset quantization parameter, and make present encoding area
The corresponding compression ratio of the encoded information of block is less than or equal to preset compression ratio threshold value and the smallest quantization parameter of numerical value;It will be current
The prediction mode of each sub-block, selected quantization parameter and corresponding quantization step carry out entropy coding in encoded block, obtain
The encoded information of present encoding block, until multiple encoded blocks traversal is completed.
Optionally, described corresponding pre- from each sub-block in present encoding block is chosen in preset multiple prediction modes
Survey mode, comprising: the pixel reconstructed value based on corresponding pixel points in an adjacent upper encoded block, using preset multiple prediction moulds
Formula is predicted to obtain the pixel predictors of the pixel of each sub-block in present encoding block respectively;The multiple prediction will be used
In the present encoding block that model prediction obtains the pixel predictors of the pixel of each sub-block respectively with each sub-block
The actual pixel value of pixel is compared;The picture so that pixel of corresponding sub-block is chosen from the multiple prediction mode
The smallest prediction mode of error between plain predicted value and actual pixel value, respectively as the prediction mould of the corresponding sub-block
Formula.
Optionally, preset multiple prediction modes include: DC prediction mode, inverse DC prediction mode, vertical prediction mould
Formula, left oblique 30 degree prediction modes, left oblique 45 degree prediction modes, right oblique 30 degree of prediction modes, oblique 45 degree of prediction modes in the right side and averagely
Prediction mode.
Optionally, the prediction error by pixel in sub-block each in present encoding block is converted respectively to frequency
The coefficient of frequency in domain, comprising: using the integer approximation discrete cosine transform matrix of HEVC, by sub-district each in present encoding block
The prediction error of pixel is converted respectively to the coefficient of frequency of frequency domain in block.
Optionally, the quantization parameter for choosing present encoding block, comprising: in sequence to preset quantization parameter model
Each quantization parameter in enclosing is traversed;Using the current quantisation parameter traversed respectively to each height in present encoding block
Block is quantified respectively, obtains the encoded information of present encoding block;Judge the coding letter of obtained present encoding block
Cease whether corresponding compression ratio is less than or equal to the compression ratio threshold value;When the encoded information for determining present encoding block is corresponding
When compression ratio is less than or equal to the compression ratio threshold value, using current quantisation parameter as the quantization parameter of present encoding block;When
When determining that the corresponding compression ratio of the encoded information of present encoding block is greater than the compression ratio threshold value, the quantization of next bit sequence is chosen
Parameter, until selected quantization parameter makes the corresponding compression ratio of the encoded information of present encoding block less than or equal to described
Compression ratio threshold value.
Optionally, the quantization step uses following one of which: quantization step map;Quantization step map and quantization step are positive and negative
Number;Quantization step map, quantization step sign and the pure value of quantization step.
Optionally, when the quantization step using quantization step map be indicated when, it is described will be each in present encoding block
The prediction mode of sub-block, selected quantization parameter and corresponding quantization step carry out entropy coding, comprising: use fixed-length code
Coding method encodes prediction mode, the quantization step map of each sub-block of present encoding block.
Optionally, when the quantization step is indicated using quantization step map and quantization step sign, it is described will be current
The prediction mode of each sub-block, selected quantization parameter and corresponding quantization step carry out entropy coding in encoded block, comprising:
Using regular length code encoding method to the prediction mode, quantization step map and quantization step of each sub-block of present encoding block just
Negative sign is encoded.
Optionally, when the quantization step is quantization step map, quantization step sign and the pure value of quantization step, it is described will be current
The prediction mode of each sub-block, selected quantization parameter and corresponding quantization step carry out entropy coding in encoded block, comprising:
Using regular length code encoding method to the prediction mode, quantization step map and quantization step of each sub-block of present encoding block just
Negative sign is encoded, and using Golomb-Rice coding mode it is pure to the quantization step of each sub-block of present encoding block be worth into
Row coding.
Optionally, after the encoded information for obtaining present encoding block, the method also includes: judge present encoding area
Whether the corresponding compression ratio of the encoded information of block is less than the compression ratio threshold value;When the encoded information pair for determining present encoding block
When the compression ratio answered is less than the compression ratio threshold value, the encoded information of the present encoding block is filled, so that filling out
The corresponding compression ratio of encoded information for filling rear present encoding block is equal to the compression ratio threshold value.
Optionally, the size of the encoded block is 64*1, and the size of sub-block is 8*1.
The embodiment of the invention also provides a kind of image expansion methods, which comprises it is corresponding to obtain original image
Multiple encoded blocks encoded information;The encoded information of multiple encoded blocks is traversed, and to the current volume traversed
The encoded information of code block carries out entropy decoding, obtain in present encoding block the prediction mode, quantization parameter of each sub-block and
Quantization step;Inverse is carried out to sub-block corresponding in the present encoding block traversed using the corresponding quantization step that decoding obtains
Change processing, obtains the coefficient of frequency of the corresponding frequency domain of each sub-block in present encoding block;It will be each in present encoding block
The coefficient of frequency of the corresponding frequency domain of a sub-block carries out inverse transform processing, obtains the picture of each sub-block in present encoding block
The prediction error of vegetarian refreshments;Based on obtained prediction mode, corresponding prediction error is decoded, to corresponding sub-district in present encoding block
The pixel value of the pixel of block carries out anti-prediction processing, and the pixel for obtaining each sub-block pixel in present encoding block is rebuild
Value;The pixel reconstructed value of sub-block pixel each in present encoding block is spliced in sequence, it is current after being rebuild
Encoded block, until multiple encoded blocks traversal is completed, the encoded block after obtaining multiple reconstructions;By the coding after multiple reconstructions
Block is spliced in sequence, obtains the corresponding reconstruction image of the original image.
Optionally, the coefficient of frequency by the corresponding frequency domain of sub-block each in present encoding block carries out inverse transform
Processing, comprising: corresponding to each sub-block in present encoding block using the integer approximation discrete cosine transform matrix of HEVC
The coefficient of frequency of frequency domain carries out inverse transform processing.
Optionally, the prediction mode obtained based on decoding, corresponding prediction error, to corresponding in present encoding block
The pixel value of the pixel of sub-block carries out anti-prediction processing, comprising: uses the corresponding pixel points of an adjacent upper encoded block
Pixel value, the prediction mode that decoding obtains and corresponding prediction error are rebuild, each sub-block picture in present encoding block is obtained
The pixel reconstructed value of vegetarian refreshments.
Optionally, the quantization step uses following one of which: quantization step map;Quantization step map and quantization step are positive and negative
Number;Quantization step map, quantization step sign and the pure value of quantization step.
Optionally, when the quantization step is quantization step map, the encoded information to present encoding block carries out entropy
Decoding, comprising: using fixed-length code coding/decoding method to the prediction mode of each sub-block, quantization terrace in present encoding block
Figure is decoded.
Optionally, described to present encoding block when the quantization step is quantization step map and quantization step sign
Encoded information carry out entropy decoding, comprising: using fixed-length code coding/decoding method in present encoding block each sub-block it is pre-
Survey mode, quantization step map and quantization step sign are decoded.
Optionally, described to current when the quantization step is quantization step map, quantization step sign and the pure value of quantization step
The encoded information of encoded block carries out entropy decoding, comprising: using fixed-length code coding/decoding method to each in present encoding block
Prediction mode, quantization step map and the quantization step sign of sub-block are decoded, and use Golomb-Rice coding/decoding method pair
The pure value of quantization step of each sub-block of present encoding block is decoded.
The embodiment of the invention also provides a kind of image compressing devices, comprising: the first blocking unit, suitable for the original that will be inputted
Beginning image data is divided into corresponding multiple encoded blocks;Second blocking unit, suitable for the multiple encoded blocks obtained to division
It is traversed, the present encoding block traversed is divided into corresponding multiple sub-blocks;Selection unit is suitable for from preset more
The corresponding prediction mode of each sub-block in present encoding block is chosen in a prediction mode;Converting unit, suitable for will currently compile
The prediction error of the pixel of each sub-block is converted respectively to the coefficient of frequency of frequency domain in code block;Quantifying unit is suitable for
The quantization parameter of present encoding block is chosen, and using selected quantization parameter respectively by sub-districts multiple in present encoding block
The coefficient of frequency of the corresponding frequency domain of block is quantified, and the quantization step of present encoding block is obtained;Wherein, present encoding block
Quantization parameter is to choose out of preset quantization parameter, and make the corresponding compression ratio of the encoded information of present encoding block
Less than or equal to preset compression ratio threshold value and the smallest quantization parameter of numerical value;Entropy code unit is suitable for present encoding block
In the prediction mode of each sub-block, selected quantization parameter and corresponding quantization step carry out entropy coding, obtain present encoding
The encoded information of block, until multiple encoded blocks traversal is completed.
Optionally, the selection unit, suitable for the pixel reconstructed value based on corresponding pixel points in an adjacent upper encoded block,
It predicts to obtain the pixel prediction of the pixel of each sub-block in present encoding block respectively using preset multiple prediction modes
Value;By the pixel prediction of the pixel of each sub-block in the present encoding block predicted using the multiple prediction mode
Value is compared with the actual pixel value of the pixel of each sub-block respectively;It chooses from the multiple prediction mode so that right
The smallest prediction mode of error between the pixel predictors and actual pixel value of the pixel of sub-block is answered, respectively as described
The prediction mode of corresponding sub-block.
Optionally, preset multiple prediction modes include: DC prediction mode, inverse DC prediction mode, vertical prediction mould
Formula, left oblique 30 degree prediction modes, left oblique 45 degree prediction modes, right oblique 30 degree of prediction modes, oblique 45 degree of prediction modes in the right side and averagely
Prediction mode.
Optionally, the converting unit, suitable for the integer approximation discrete cosine transform matrix using HEVC, by present encoding
The prediction error of pixel is converted respectively to the coefficient of frequency of frequency domain in each sub-block in block.
Optionally, the quantifying unit, suitable in sequence to each quantization parameter within the scope of preset quantization parameter
It is traversed;Each sub-block in present encoding block is quantified respectively respectively using the current quantisation parameter traversed,
Obtain the encoded information of present encoding block;Judge obtained present encoding block the corresponding compression ratio of encoded information whether
Less than or equal to the compression ratio threshold value;When the corresponding compression ratio of the encoded information for determining present encoding block is less than or equal to institute
When stating compression ratio threshold value, using current quantisation parameter as the quantization parameter of present encoding block;When determining present encoding block
When the corresponding compression ratio of encoded information is greater than the compression ratio threshold value, the quantization parameter of next bit sequence is chosen, until selected
Quantization parameter makes the corresponding compression ratio of the encoded information of present encoding block be less than or equal to the compression ratio threshold value.
Optionally, the quantization step uses following one of which: quantization step map;Quantization step map and quantization step are positive and negative
Number;Quantization step map, quantization step sign and the pure value of quantization step.
Optionally, the entropy code unit is suitable for compiling when the quantization step is quantization step map using fixed-length code
Code method encodes prediction mode, the quantization step map of each sub-block of present encoding block.
Optionally, the entropy code unit is suitable for adopting when the quantization step is quantization step map and quantization step sign
It is positive and negative with prediction mode, quantization step map and quantization step of the regular length code encoding method to each sub-block of present encoding block
It number is encoded.
Optionally, the entropy code unit is suitable for when the quantization step being quantization step map, quantization step sign and quantization
When the pure value of rank, prediction mode, quantization step map using regular length code encoding method to each sub-block of present encoding block
It is encoded with quantization step sign, and using Golomb-Rice coding mode to the amount of each sub-block of present encoding block
Change the pure value of rank to be encoded.
Optionally, described device further include: judging unit, suitable for after the encoded information for obtaining present encoding block,
Judge whether the corresponding compression ratio of the encoded information of present encoding block is less than the compression ratio threshold value;Fills unit, suitable for working as
When determining that the corresponding compression ratio of the encoded information of present encoding block is less than the compression ratio threshold value, to the present encoding block
Encoded information be filled so that filling after present encoding block the corresponding compression ratio of encoded information be equal to the compression
Rate threshold value.
Optionally, the size of the encoded block is 64*1, and the size of sub-block is 8*1.
The embodiment of the invention also provides a kind of image decompression compression apparatus, comprising: acquiring unit is suitable for obtaining original image
The encoded information of corresponding multiple encoded blocks;Entropy decoding unit is traversed suitable for the encoded information to multiple encoded blocks,
And entropy decoding is carried out to the encoded information of the present encoding block traversed, obtain the pre- of each sub-block in present encoding block
Survey mode, quantization parameter and quantization step;Inverse quantization unit, the corresponding quantization step suitable for being obtained using decoding are worked as to what is traversed
Corresponding sub-block carries out inverse quantization processing in preceding encoded block, obtains the corresponding frequency of each sub-block in present encoding block
The coefficient of frequency in domain;Inverse transform unit, suitable for by the coefficient of frequency of the corresponding frequency domain of sub-block each in present encoding block
Inverse transform processing is carried out, the prediction error of the pixel of each sub-block in present encoding block is obtained;Anti- predicting unit, is suitable for
Based on obtained prediction mode, corresponding prediction error is decoded, to the picture of the pixel of sub-block corresponding in present encoding block
Element value carries out anti-prediction processing, obtains the pixel reconstructed value of each sub-block pixel in present encoding block;First rebuilds list
Member, suitable for splicing the pixel reconstructed value of sub-block pixel each in present encoding block in sequence, after being rebuild
Present encoding block, until multiple encoded blocks traversal is completed, the encoded block after obtaining multiple reconstructions;Second reconstruction unit,
Suitable for splicing the encoded block after multiple reconstructions in sequence, the corresponding reconstruction image of the original image is obtained.
Optionally, the inverse transform unit is compiled suitable for the integer approximation discrete cosine transform matrix using HEVC to current
The coefficient of frequency of the corresponding frequency domain of each sub-block carries out inverse transform processing in code block.
Optionally, the anti-predicting unit, the reconstruction pixel suitable for the corresponding pixel points using an adjacent upper encoded block
The prediction mode and corresponding prediction error that value, decoding obtain, obtain the picture of each sub-block pixel in present encoding block
Plain reconstructed value.
Optionally, the quantization step uses following one of which: quantization step map;Quantization step map and quantization step are positive and negative
Number;Quantization step map, quantization step sign and the pure value of quantization step.
Optionally, the entropy decoding unit is suitable for when the quantization step is quantization step map, using fixed-length code solution
Code method is decoded the prediction mode, quantization step map of each sub-block in present encoding block.
Optionally, the entropy decoding unit is suitable for adopting when the quantization step is quantization step map and quantization step sign
With fixed-length code coding/decoding method to the prediction mode, quantization step map and quantization step of each sub-block in present encoding block just
Negative sign is decoded.
Optionally, the entropy decoding unit is suitable for when the quantization step being quantization step map, quantization step sign and quantization
When the pure value of rank, using fixed-length code coding/decoding method to the prediction mode of each sub-block, quantization terrace in present encoding block
Figure and quantization step sign are decoded, and using Golomb-Rice coding/decoding method to each sub-block of present encoding block
The pure value of quantization step is decoded.
The embodiment of the invention also provides a kind of computer readable storage mediums, execute when the computer instruction is run
The step of stating any method for compressing image.
The embodiment of the invention also provides a kind of computer readable storage mediums, execute when the computer instruction is run
The step of stating any image expansion method.
The embodiment of the invention also provides a kind of terminal, including memory and processor, energy is stored on the memory
Enough computer instructions run on the processor, the processor execute any of the above-described kind when running the computer instruction
Method for compressing image the step of.
The embodiment of the invention also provides a kind of terminal, including memory and processor, energy is stored on the memory
Enough computer instructions run on the processor, the processor execute any of the above-described kind when running the computer instruction
Image expansion method the step of.
Compared with prior art, technical solution of the present invention has the advantage that
Above-mentioned scheme, by each encoded block the coded-bit amount in entropy coding stage information, from preset
The best corresponding quantization parameter of reconstructed image quality is chosen within the scope of quantization parameter, allows selected quantization parameter will
The corresponding image compression ratio control of the encoded information of corresponding encoded block is within preset compression ratio threshold value, so as to true
While protecting image reconstruction quality, guarantee stable, lesser bandwidth load.
Further, the pixel reconstructed value based on pixel in an adjacent upper encoded block chooses present encoding block
In the corresponding prediction mode of each sub-block, between the encoded block that the not adjacent each other relationship of encoded block up and down can be made
Can be with absolute coding, thus the speed of coding can be improved, and then improve the speed of image procossing.
Further, before quantification treatment, the prediction of each sub-block and conversion process can be parallel in encoded block
It carries out, can be further improved the speed of image coding.
Further, after the quantization step that entropy decoding obtains corresponding encoded block, each sub-block is anti-in encoded block
Quantization and inverse transform processing can carry out parallel, can be further improved the speed of image procossing.
Detailed description of the invention
Fig. 1 is the flow chart of one of embodiment of the present invention method for compressing image;
Fig. 2 is that the pixel for predicting to obtain current sub-partition pixel using vertical prediction mode in the embodiment of the present invention is pre-
The schematic diagram of measured value;
Fig. 3 be in the embodiment of the present invention predicted respectively using DC prediction mode obtain the pixel of current sub-partition pixel
The schematic diagram of predicted value;
Fig. 4 is to predict to obtain the picture of current sub-partition pixel using left oblique 45 degree of prediction modes in the embodiment of the present invention
The schematic diagram of plain predicted value;
Fig. 5 is to predict to obtain current sub-partition pixel respectively using right oblique 45 degree of prediction modes in the embodiment of the present invention
Pixel predictors schematic diagram;
Fig. 6 is to predict to obtain the picture of current sub-partition pixel using left oblique 30 degree of prediction modes in the embodiment of the present invention
The schematic diagram of plain predicted value;
Fig. 7 is to predict to obtain the picture of current sub-partition pixel using right oblique 30 degree of prediction modes in the embodiment of the present invention
The schematic diagram of plain predicted value;
Fig. 8 is that the pixel for predicting to obtain current sub-partition pixel using inverse DC prediction mode in the embodiment of the present invention is pre-
The schematic diagram of measured value;
Fig. 9 is that the pixel for obtaining current sub-partition pixel using consensus forecast model prediction in the embodiment of the present invention is pre-
The schematic diagram of measured value
Figure 10 is the schematic diagram for choosing the method for quantization parameter in the embodiment of the present invention out of preset quantization parameter;
Figure 11 is the flow chart of one of embodiment of the present invention image expansion method;
Figure 12 is the structural schematic diagram of one of embodiment of the present invention image compressing device;
Figure 13 is the structural schematic diagram of one of embodiment of the present invention image decompression compression apparatus.
Specific embodiment
The image processing operations of mobile terminal include: from photosensitive element and Bell's colorful optical filter array (Bayer Color
Filter Array, BCFA) handled via imaging sensor after, storage is to chip external memory;Image preview processor is outside piece
Memory reads image, carries out reducing processing and show;Various image processors, such as filter noise reduction, 3D noise reduction, electronic flutter-proof,
Color conversion, strong Xanthophyll cycle, wide dynamic, the accumulation of slow shutter, frame etc. are required to read the image of chip external memory, by processing
Restore to chip external memory again afterwards.Image processing operations needs above-mentioned are frequently interacted between chip external memory, especially
It is in the case where more subtle for image operational requirements at present, various unconventional applications (APP) go out like the mushrooms after rain
It is existing, such as the correction of human face detection, the colour of skin, backlight, it is equally also required to interact with chip external memory, accesses the efficiency of chip external memory
Face test.
It is primarily present in the prior art applied to the method for compressing image in mobile terminal following several:
The first is to increase on piece caching.This method utilize bus free time, pre-read by image data, or
The image data of person's store buffer.But this method will increase the quantity of caching, and the quantity cached is with processor number
Increase and increase, there is a problem that hardware costs is high.In addition, marginal benefit can also increase with processing image resolution ratio and be passed
Subtract, and the burden of bus can additionally be increased by inquiring bus state in real time also.
Second method is time sampling.This method reads image data by down-sampling, then is obtained by up-sampling interpolation
Image identical with original image size is simultaneously handled.However, this method causes obtained image fault rate slightly higher and right
In the image of boundary, details is also easy to be disposed off, and the perception for the image that leads to that treated is also poor.
The third method is lossless compression.Image compress and carry out compressed image data by this method first
Storage, the image data for further taking out compression later unzip it, and obtain rebuilding data.This method can by the compression of image and
The efficiency load of decompression is married again to codec, although hardware cost is unlikely too high, the compression ratio of image can be with image
Content and change, lead to the unstable of bandwidth load.
Fourth method is lossy compression.Image compress and carry out compressed image data by this method first
Storage, the image data for further taking out compression later unzip it, and obtain rebuilding data.It is similar with lossless compression, this method
The efficiency load of the compression and decompression of image can be married again to codec, although hardware cost is unlikely too high, and compression ratio
It is fixed, so that bandwidth load is predictable.But this method is unable to ensure the picture quality after rebuilding.
To solve the above-mentioned problems in the prior art, technical solution used in the embodiment of the present invention passes through to each volume
Code block chooses best reconstruction image in the information of the coded-bit amount in entropy coding stage out of preset quantization parameter
The corresponding quantization parameter of quality allows selected quantization parameter by the corresponding image of the encoded information of corresponding encoded block
Rate control is within preset compression ratio threshold value, so as to guarantee stable while ensuring image reconstruction quality
Bandwidth load.
To make the above purposes, features and advantages of the invention more obvious and understandable, with reference to the accompanying drawing to the present invention
Specific embodiment be described in detail.
Fig. 1 shows the flow chart of one of embodiment of the present invention method for compressing image.Compression of images as shown in Figure 1
Method is suitable for mobile terminal and carries out compression processing to image, can specifically include following operation:
Step S101: the raw image data of input is divided into corresponding multiple encoded blocks.
In specific implementation, the size of each encoded block can be configured according to the actual needs.For example, in order to true
It protects the stability of image procossing, inhibit the image processing requirements such as noise, the size of encoded block is disposed as 64*1, i.e., one
Encoded block includes 64 pixels of a line, to reach fixed compression ratio, stablize bandwidth load, and saves occupied bandwidth
The purpose of resource.
Step S102: the multiple encoded blocks obtained to division traverse, and the present encoding block traversed is divided
For corresponding multiple sub-blocks.
In specific implementation, the size that each encoded block divides to obtain sub-block can be carried out according to image processing requirements
It determines.
In an embodiment of the present invention, when an encoded block includes 64 pixels of a line, encoded block is divided
The sub-block of 8 pixels of a line namely the sub-block of 8 8*1 are respectively included for 8.
Step S103: from choosing the corresponding prediction of each sub-block in present encoding block in preset multiple prediction modes
Mode.
In specific implementation, preset multiple prediction modes, to be used for each in subsequent image decompression process
The pixel value of pixel in sub-block is predicted.
Wherein, when the quantity of alternative prediction mode is arranged, the image processing requirements of mobile terminal can be comprehensively considered
It is determined.It will be appreciated by those skilled in the art that when the quantity of used prediction mode is more, it is selected
The prediction mode pixel predictors that the pixel value of pixel is predicted in sub-block are closer to pixel original
Actual pixel value in image data.
The on piece needed when in order to reduce prediction caches burden, reduces the dependence and maximum limit between encoded block
Degree ground using spatial information removes spatial redundancy, in an embodiment of the present invention, with the reconstruction data of an adjacent upper encoded block,
The pixel value of present encoding block is predicted with the pixel reconstructed value of lastrow 64*1 encoded block, and used pre-
Survey mode is eight kinds, respectively includes DC prediction mode, inverse DC (Inverse DC) prediction mode, vertical prediction mode, a left side oblique 30
Spend prediction mode, left oblique 45 degree of prediction modes, right oblique 30 degree of prediction modes, right oblique 45 degree of prediction modes and average prediction mode.
Referring now to Fig. 2 to Fig. 9 to the pixel reconstructed value in the embodiment of the present invention according to the pixel of adjacent lastrow,
The method that the corresponding prediction mode of current line is chosen from eight kinds of prediction modes is introduced.
Size with encoded block is 64*1, for the size of sub-block is 8*1:
Referring to fig. 2, when adjacent lastrow, i.e., the pixel reconstructed value of corresponding each pixel point in previous row encoded block
Not Wei 128,123,134,133,115,116,118 and 117 when, the pixel of current line is carried out using vertical prediction mode pre-
Survey is that the pixel predictors of the pixel of corresponding sub-block are respectively 128,123,134,133,115,116,118 and 117.
Referring to Fig. 3, when the pixel reconstructed value of corresponding pixel in adjacent lastrow encoded block is respectively 128,123,
134,133,115,116,118 and 117 when, correspond to sub-block in the present encoding block predicted using DC prediction mode
The pixel predictors of pixel are respectively 123,123,123,123,123,123,123 and 123.
Referring to fig. 4, when the pixel reconstructed value of the corresponding pixel of lastrow encoded block is respectively 134,56,73,55,
115,88,186,174,213 and 41 when, correspond to sub-district in the present encoding block predicted using left oblique 45 degree of prediction modes
The pixel predictors of the pixel of block are respectively 134,56,73,55,88,186,174 and 213.
Referring to Fig. 5, when the pixel reconstructed value of the corresponding pixel of lastrow encoded block is respectively 134,56,73,55,
115,88,186,174,213 and 41 when, correspond to sub-district in the present encoding block predicted using right oblique 45 degree of prediction modes
The pixel predictors of the pixel of block are respectively 56,73,55,88,186,174,213 and 41.
Referring to Fig. 6, when the pixel reconstructed value of the corresponding pixel of lastrow encoded block is respectively 33,23,133,77,
88,99,66,177,189 and 231 when, correspond to sub-district in the present encoding block predicted using left oblique 30 degree of prediction modes
The pixel predictors of the pixel of block are respectively 133,77,88,99,66,177,189 and 231.
Referring to Fig. 7, when the pixel reconstructed value of the corresponding pixel of adjacent lastrow encoded block is respectively 33,233,133,
77,88,99,66,177,189 and 231 when, it is corresponding sub in the present encoding block predicted using right oblique 30 degree prediction modes
The pixel predictors of the pixel of block are respectively 33,233,133,77,88,199,66 and 177.
Referring to Fig. 8, when the pixel reconstructed value of corresponding pixel in adjacent lastrow encoded block is respectively 128,123,
134,133,115,116,118 and 117 when, correspond to sub-block in the present encoding block predicted using inverse DC prediction mode
The pixel predictors of pixel be respectively 133,133,133,133,133,133,133 and 133.
Referring to Fig. 9, when the pixel reconstructed value of corresponding pixel in adjacent lastrow encoded block is respectively 33,233,
133,77,88,99,66,177,189 and 231 when, corresponding son in the present encoding block that is obtained using consensus forecast model prediction
The pixel predictors of the pixel of block are respectively 158,144,94,88,88,102,153 and 197.
When using eight kinds of above-mentioned prediction modes, prediction obtains the picture of the pixel of sub-block in present encoding block respectively
When plain predicted value, the pixel predictors for the pixel that eight kinds of prediction modes of each sub-block can be predicted with it is corresponding
Actual pixel value of the pixel in original image is compared, and therefrom finds out the prediction error so that the pixel of sub-block
A kind of the smallest prediction mode, as the sub-block prediction mode and recorded.
From the above description it can be seen that prediction mode used by each sub-block may be identical in same encoded block,
It may also be different.
It is to be herein pointed out when present encoding block is the encoded block of the first row in raw image data, it is preceding
The reconstruction data of a line encoded block be sky, therefore, it is impossible to using adjacent lastrow pixel pixel reconstructed value to current
The pixel value of capable pixel is predicted.In order to solve this problem, in an embodiment of the present invention, it can use each ginseng
The pixel predictors for examining pixel are disposed as 128 mode, obtain the ginseng of the adjacent lastrow encoded block of the first row data
Data are examined, then adopt the pixel prediction mode for obtaining each sub-block in the first row encoded block in manner just described.
In addition, being obtained when using corresponding prediction mode less than corresponding reference point in above-mentioned eight kinds of prediction modes
It is in an embodiment of the present invention, current in order to obtain when corresponding pixel being not present when pixel value namely in adjacent lastrow
The pixel predictors of row corresponding pixel points equally also set 128 for corresponding pixel in adjacent upper one, row, as current
The pixel predictors of the corresponding reference image vegetarian refreshments of capable pixel.
From the above description it can be seen that on piece cache resources required by above-mentioned operation are only the big of an encoded block
The small size plus each 2 pixels in left and right, thus can achieve the purpose for effectively saving bandwidth resources, improve bandwidth resources
Utilization rate.
In addition, through the above description, it will be appreciated by those skilled in the art that, when the code area using lastrow
When block rebuilds present encoding block, so that the not volume between the encoded block of uplink and downlink relationship in raw image data
Code operation can be carried out independently, be not the encoding operation of the encoded block of uplink and downlink relationship under conditions of hardware condition allows
It can carry out parallel, thus the dependence between encoded block can be effectively reduced, and then the speed of image procossing can be improved
And quality.
Step S104: the prediction error of the pixel of sub-block each in present encoding block is converted respectively to frequency domain
Coefficient of frequency.
In specific implementation, the prediction error of the pixel of each sub-block is respectively using correspondence in each encoded block
The prediction mode pixel predictors and actual pixel value of pixel predicted between difference.
In specific implementation, the prediction error of the pixel of each sub-block is to predict to obtain using corresponding prediction mode
Pixel pixel predictors and actual pixel value between difference, in order to be missed to prediction from block each in encoded block
Difference can carry out efficient compression, the prediction error of the pixel of sub-block each in present encoding block can be carried out frequency
Domain conversion, obtains the coefficient of frequency of corresponding frequency domain, because being zero in the corresponding prediction error of high frequency, thus can be improved
The efficiency of compression simultaneously saves resource.
In an embodiment of the present invention, using efficient video coding (High Efficiency Video Coding,
HEVC integer approximation discrete cosine transform matrix), by the prediction error of the pixel of sub-block each in present encoding block
It is converted respectively to the coefficient of frequency of frequency domain.The advantage of this approach is that, on the one hand, used transition matrix is accurate, simple
List is easily achieved;On the other hand, it in subsequent decompression operation, carries out inverse transform and operates used matrix and work as forward
Changing matrix used in operation is same matrix.Therefore, using efficient video coding (High Efficiency Video
Coding, HEVC) integer approximation discrete cosine transform matrix, by the pre- of the pixel of sub-block each in present encoding block
It surveys error to be converted respectively to the coefficient of frequency of frequency domain, the complexity of image procossing can be further decreased, improve image procossing
Efficiency.
It is to be herein pointed out when the size of sub-block is 8*1, the prediction error of the pixel of corresponding sub-block
It include the row vector matrix of 8 elements for one.In subsequent progress frequency domain conversion operation, what is obtained also will be for 8 elements
The coefficient of frequency row vector matrix of frequency domain, and the number of the Effective Numerical in two kinds of above-mentioned row vector matrixes is 0 to 8.
In other words, the Effective Numerical in two kinds of above-mentioned row vector matrixes is up to 8.
Step S105: the quantization parameter of present encoding block is chosen, and respectively will be current using selected quantization parameter
The coefficient of frequency of the corresponding frequency domain of multiple sub-blocks is quantified in encoded block, obtains the quantization step of present encoding block.
In specific implementation, the quantization parameter of present encoding block, for for all sub-districts in present encoding block
Used quantization parameter when block is quantified.Therefore, each sub-block in same encoded block uses same quantization parameter
Quantified, the complexity of operation can be further decreased, improves the efficiency of compression of images.
In specific implementation, when step S104 executes completion, the pixel of each sub-block in present encoding block
Prediction error is converted respectively to the coefficient of frequency of frequency domain, wherein in addition to quantization step, every coding letter of present encoding block
The bit amount of breath is it is known that and the size of quantization parameter then determines the bit of the quantization step of each sub-block in encoded block
Amount.
Referring to Figure 10, when choosing the quantization parameter of present encoding block, can to preset quantization parameter range, such as 0
~51, interior each quantization parameter carries out traversal S1001 according to from greatly to small, or from as low as big sequence.Often traverse one
When a quantization parameter, then using the current quantisation parameter traversed, to first 8*1 sub-block frequency in present encoding block
The coefficient of frequency of frequency domain of the coefficient of frequency in domain to the 8th 8*1 sub-block is quantified respectively, and according to quantized result pair
The corresponding bit amount of quantization step after first 8*1 sub-block to the quantization of the 8th 8*1 sub-block is estimated, is worked as with judgement
First 8*1 sub-block in preceding encoded block to the 8th 8*1 sub-block the sum of the bit amount of quantization step, if Ke Yiman
Foot makes the corresponding compression ratio of the encoded information of present encoding block be less than or equal to preset compression ratio threshold value S1002.Wherein,
Preset compression ratio threshold value can according to need setting, and such as 50%.
Wherein, when determining the quantization step of first in present encoding block 8*1 sub-block to the 8th 8*1 sub-block
The sum of bit amount can satisfy so that the corresponding compression ratio of the encoded information of present encoding block is less than or equal to corresponding compression
When rate threshold value, then using the current quantisation parameter traversed as the quantization parameter S1003 of present encoding block;Conversely, current
First 8*1 sub-block in encoded block to the 8th 8*1 sub-block the sum of the bit amount of quantization step so that present encoding
When the corresponding compression ratio of the encoded information of block is greater than corresponding compression ratio threshold value, the quantization ginseng in preset quantizing range is judged
Whether number, which traverses, is completed S1004;When the judgment result is yes, then end operation;Conversely, next quantization parameter S1005 is then chosen,
And restart to execute from S1002, until the quantization parameter in preset quantizing range all complete by traversal.
It will be appreciated by those skilled in the art that in order to improve the speed of quantization parameter selection, it can also be using simultaneously
Capable mode, to the bit amount of the quantization step of the corresponding present encoding block of all quantization parameters in default quantization parameter area
Estimated, is therefrom chosen so that the corresponding compression ratio of the encoded information of present encoding block is less than or equal to preset compression ratio
All quantization parameters of threshold value, and the quantization parameter by the smallest quantization parameter of numerical value, as present encoding block.Wherein, it selects
The reason of access value the smallest quantization parameter, is that quantization parameter is smaller, the obtained quantization step after quantization and the frequency before quantization
The coefficient of frequency in rate domain is closer, and image fault is smaller.When quantization parameter is more accurate, the encoded information of present encoding block
For corresponding compression ratio then more close to the compression ratio threshold value of setting, the distortion factor of image is generally also smaller, thus can be further
Improve the quality of image procossing.
In addition, quantization step can be accelerated by the mode of above-mentioned increase candidate quantisation number of parameters, and still, candidate's amount
It is also higher for hardware requirement when change number of parameters is more.Therefore, those skilled in the art can set according to the actual needs
Determine candidate quantisation number of parameters, herein with no restrictions.
In specific implementation, when selecting the quantization parameter of present encoding block out of preset quantization parameter, then
Quantified using coefficient of frequency of the selected quantization parameter to the frequency domain of each sub-block in present encoding block, is obtained
The quantization step of each sub-block in present encoding block.
Step S106: by the prediction mode, selected quantization parameter and correspondence of sub-block each in present encoding block
Quantization step carry out entropy coding, obtain the encoded information of present encoding block.
In specific implementation, the information to be encoded of present encoding block includes prediction mode, quantization parameter and quantization step.Its
In, the entropy information redundancy of coding stage is concentrated mainly on quantization step, can be by carrying out adaptive processes to quantization step, with maximum
Remove to limit entropy information redundancy.
Practice have shown that the numerical value of quantization step has been 0 in high frequency, and the pure value of the quantization step on low frequency quantifies also mostly less than 3
Probability in the range of the numerical value of rank is located at -2 to 2 is larger.It therefore, in an embodiment of the present invention, can be using quantization terrace
Figure indicates the quantization step in the range of -2 to 2, and for the quantization step except -2 to 2 range, then using quantization terrace
One of which is indicated in figure and quantization step sign or quantization step map, quantization step sign and the pure value of quantization step.
For respectively indicating quantization step 0,1,2 and 3 using quantization step map:
When quantization step is -5, it is indicated using 3 corresponding quantization step maps, negative sign and pure value 2;
When quantization step is 3, it is indicated using 3 corresponding quantization step maps, positive sign and pure value 0;
When quantization step is 2, it is indicated using 2 corresponding quantization step maps and positive sign, without pure value;
When quantization step is -1, it is indicated using 1 corresponding quantization step map and negative sign, without pure value;
When quantization step is 0, it is indicated using 0 corresponding quantization step map of quantization, without sign and pure value;
It is available by above-mentioned example, when quantization step is 0, it can indicate corresponding only with quantization step map
Quantization step;When quantization component level between -2 and+2, and it is non-zero when, be indicated using quantization step map and sign;When
When quantization step is exceeded except -2 and+2, need to be indicated using quantization step map, sign and pure value simultaneously.
In an embodiment of the present invention, when quantization step is using quantization step map or quantization step map and quantization step sign
When being indicated, when prediction mode, quantization parameter and the quantization step to present encoding block carry out entropy coding, for numerical value wave
The dynamic lesser information to be encoded of range, including prediction mode, quantization parameter, quantization step map or quantization step map and quantization step
Sign can be encoded using fixed-length code;When quantization step uses quantization step map, quantization step sign and quantization step
When pure value is indicated, prediction mode, quantization parameter, quantization step map and quantization step sign are compiled using fixed-length code
Code, and value pure for quantization step can then use Columbus-Lai Si (Golomb-Rice) code because its numerical fluctuations range is larger
It is encoded.
In specific implementation, in order to enable the encoded information of present encoding block is solid in the occupied bandwidth resources of on piece
Fixed, the method for compressing image in the embodiment of the present invention can also include:
S107: judge whether the corresponding compression ratio of the encoded information of present encoding block is less than preset compression ratio threshold value;
When the judgment result is yes, step S108 can be executed;When the judgment result is no, step S109 can be executed.
S108: being filled the encoded information of present encoding block, so that the volume of filled present encoding block
The corresponding compression ratio of code information is equal to the compression ratio threshold value.
In specific implementation, it is completed in present encoding block coding, and determines that the encoded information of present encoding block is corresponding
Compression ratio be less than preset compression ratio threshold value be to be filled by the encoded information to present encoding block so that filling out
The corresponding compression ratio of encoded information of present encoding block after filling is equal to the compression ratio threshold value.
Using such mode, the occupied bit quantity of the encoded information of each encoded block can be made identical, not only may be used
To achieve the purpose that block grade fixed-bandwidth is saved, and the encoding stream of each encoded block is also solid in the position of chip external memory
It is fixed, can so realize the parallel encoding and decoding of the column of encoded block, so as to improve image decompression speed.
Step S109: judge whether multiple encoded blocks traverse completion;It when the judgment result is yes, can be with end operation;
Conversely, thening follow the steps S110.
Step S110: next encoded block is obtained.
In specific implementation, when determining that multiple encoded blocks do not traverse completion, then available next encoded block, and
It is executed since step S102, until multiple encoded blocks traversal is completed.
Above-mentioned scheme, by each encoded block the coded-bit amount in entropy coding stage information, from preset
The best corresponding quantization parameter of reconstructed image quality is chosen within the scope of quantization parameter, allows selected quantization parameter will
The corresponding image compression ratio control of the encoded information of corresponding encoded block is within preset compression ratio threshold value, so as to true
While protecting image reconstruction quality, guarantee stable bandwidth load.
Figure 11 shows the flow chart of one of embodiment of the present invention image expansion method.As shown in figure 11, this hair
Image expansion method in bright embodiment unzips it processing suitable for coded data of the mobile terminal to image, specifically adopts
It is realized with following step:
Step S1101: the encoded information of the corresponding multiple encoded blocks of original image is obtained.
In specific implementation, when the corresponding compression ratio of the encoded information of each encoded block is equal to preset compression ratio threshold
When value, then storage location of the encoded information of corresponding multiple encoded blocks in piece external storage determines, thus, from piece external storage
The corresponding position of device can obtain the encoded information of the corresponding multiple encoded blocks of original image.
Step S1102: traversing the encoded information of multiple encoded blocks, and to the present encoding block traversed
Encoded information carries out entropy decoding, obtains the prediction mode, quantization parameter and quantization step of each sub-block in present encoding block.
In specific implementation, carrying out entropy decoding to the encoded information of the present encoding block traversed is to present encoding area
Prediction mode, quantization parameter and the quantization step of block carry out the reverse operating of entropy coding, can be obtained by entropy decoding operation each
The information of the prediction mode of a encoded block, quantization parameter and quantization step.
In an embodiment of the present invention, when an encoded block includes 64 pixels of a line, and encoded block is divided
When the sub-block of the sub-block namely 8 8*1 that respectively include 8 pixels of a line for 8, the coding of each encoded block is believed
It ceases the information of the prediction mode of the sub-block including 8 8*1, quantization parameter and quantization step.
In specific implementation, when the prediction mode, selected quantization parameter and amount of each sub-block to encoded block
Change rank and carry out entropy coding, when the corresponding compression ratio of encoded information for obtaining encoded block is less than preset compression ratio threshold value, needs
Corresponding filling information to be added in the encoded information of encoded block, therefore, the present encoding block stored on predeterminated position
Encoded information in include corresponding filling information.It, will tightly when the encoded information to present encoding block carries out entropy decoding
Read the information of each prediction mode from block, selected quantization parameter and quantization step in present encoding block, and for
The information of filling will not be read.
In an embodiment of the present invention, when the encoded block using lastrow is to the picture of the pixel in present encoding block
When plain value is rebuild, so that in raw image data mutually solely not between the encoded information of the encoded block of uplink and downlink relationship
It is vertical, because the entropy decoding operation of the encoded information without the encoded block for uplink and downlink relationship can be carried out independently.In hardware condition
Under conditions of permission, it can not carried out parallel for the entropy decoding operation of the encoded information of the encoded block of uplink and downlink relationship, it can be with
The dependence between the decoding operate of encoded block is effectively reduced, and then the speed and quality of image procossing can be improved.
In specific implementation, quantization step can use quantization step map, quantization step map and quantization step sign, Huo Zheliang
Change terrace figure, quantization step sign and the pure value one of which of quantization step to be indicated.It therefore, can be according to used coding staff
The corresponding coding/decoding method of method is decoded operation to the information of the quantization step in encoded block.
In an embodiment of the present invention, entropy is carried out in prediction mode, quantization parameter and the quantization step to present encoding block
When coding, information to be encoded lesser for numerical fluctuations range, including prediction mode, quantization parameter, quantization step map or
Quantization step map and quantization step sign, are encoded using fixed-length code.Therefore, in entropy decoding, for prediction mode,
Quantization parameter and quantization step map or quantization step map and quantization step sign then use fixed-length code coding/decoding method to carry out
Decoding;
When quantization step is indicated using quantization step map, quantization step sign and the pure value of quantization step, and prediction mode, amount
When change parameter, quantization step map and quantization step sign are encoded using fixed-length code, when being decoded, then using solid
Measured length code coding/decoding method is decoded prediction mode, quantization parameter, quantization step map and quantization step sign;
And value pure for quantization step, because its numerical fluctuations range is larger, when using Columbus-Lai Si (Golomb-Rice)
When code is encoded, the pure value of quantization step is decoded using Columbus-Lai Si (Golomb-Rice) code coding/decoding method.
Step S1103: the corresponding quantization step obtained using decoding is to corresponding son in the present encoding block traversed
Block carries out inverse quantization processing, obtains the coefficient of frequency of the corresponding frequency domain of each sub-block in present encoding block.
In specific implementation, to the corresponding quantization step obtained using decoding to corresponding in the present encoding block traversed
Sub-block carry out inverse quantization processing, be using selected quantization parameter respectively by sub-blocks pair multiple in present encoding block
The coefficient of frequency of the frequency domain answered carries out the reverse operating of quantization operation, can be in present encoding block by inverse quantization operation
The coefficient of frequency of the corresponding frequency domain of each sub-block.
Step S1104: the coefficient of frequency of the corresponding frequency domain of sub-block each in present encoding block is subjected to inverse transform
Processing, obtains the prediction error of the pixel of each sub-block in present encoding block.
In specific implementation, the coefficient of frequency of the corresponding frequency domain of sub-block each in present encoding block is inverted
Processing is changed, to be converted the prediction error of the pixel of sub-block each in present encoding block respectively to the frequency system of frequency domain
Several reverse operatings, is operated by inverse transform, and the prediction of the pixel of each sub-block misses in available present encoding block
Difference.
In an embodiment of the present invention, when using efficient video coding (High Efficiency Video Coding,
HEVC integer approximation discrete cosine transform matrix), by the prediction error of the pixel of sub-block each in present encoding block
It, can be using HEVC integer approximation discrete cosine transform matrix by present encoding area when converted respectively to the coefficient of frequency of frequency domain
The coefficient of frequency reversion of the pixel of each sub-block is changed to corresponding prediction error in block.Because carrying out used in conversion operation
It is same matrix that matrix and current inverse transform, which operate used matrix, can further decrease the complexity of image decompressor processing
Degree improves the efficiency of image decompressor processing.
Step S1105: based on obtained prediction mode, corresponding prediction error is decoded, to corresponding in present encoding block
The pixel value of the pixel of sub-block carries out anti-prediction processing, obtains the pixel of each sub-block pixel in present encoding block
Reconstructed value.
In specific implementation, based on obtained prediction mode, corresponding prediction error is decoded, to phase in present encoding block
The pixel value of the pixel of sub-block is answered to carry out anti-prediction processing, to choose present encoding area from preset multiple prediction modes
The reverse operating of the corresponding prediction mode of each sub-block can be based on an adjacent upper code area by anti-predicted operation in block
The information of the reconstruction pixel value of the pixel of block, obtains the reconstruction pixel value of pixel in present encoding block.
Step S1106: the pixel reconstructed value of sub-block pixel each in present encoding block is spliced in sequence, is obtained
Present encoding block after to reconstruction, until multiple encoded blocks traversal is completed, the encoded block after obtaining multiple reconstructions.
It in specific implementation, will when obtaining the pixel reconstructed value of each sub-block pixel in present encoding block
The pixel reconstructed value of each sub-block pixel is spliced in sequence in present encoding block, the present encoding area after being rebuild
Block.
In specific implementation, all sub-blocks in each encoded block adopt same quantization parameter, when passing through entropy decoding
After operation solves all quantization steps, in encoded block the subsequent inverse transform of sub-block, inverse quantization operation can with independent parallel, when
When the hardware condition of mobile terminal allows, the independent decoding of 8 8*1 sub-blocks in encoded block may be implemented, further to mention
The speed of hi-vision processing.
Step S1107: the encoded block after multiple reconstructions is spliced in sequence, and it is corresponding to obtain the original image
Reconstruction image.
In specific implementation, when obtaining the reconstruction data of multiple encoded blocks, the i.e. pixel value of pixel after reconstruction,
Encoded block after multiple reconstructions can be spliced in sequence, it is corresponding heavy so as to obtain the original image
Build image.
It is to be herein pointed out the image expansion method in the embodiment of the present invention is the reversed behaviour of method for compressing image
Make, in order to describe simplicity, the squeeze operation in Fig. 1 is please referred to for the part not being discussed in detail to the greatest extent in decompression operation and is carried out instead
To operation, no longer it is described in detail.
The above-mentioned method in the embodiment of the present invention is described in detail, below will be to the above-mentioned corresponding dress of method
It sets and is introduced.
Figure 12 shows the structure of one of embodiment of the present invention image compressing device.Referring to Figure 12, a kind of image solution
Compression set 1200 may include the first blocking unit 1201, the second blocking unit 1202, selection unit 1203, converting unit
1204, quantifying unit 1205 and entropy code unit 1206, in which:
First blocking unit 1201, suitable for the raw image data of input is divided into corresponding present encoding block;
Second blocking unit 1202, multiple encoded blocks suitable for obtaining to division traverse, current by what is traversed
Encoded block is divided into corresponding multiple sub-blocks;
Selection unit 1203, be suitable for from preset multiple prediction modes choose present encoding block in each sub-block pair
The prediction mode answered;
In an embodiment of the present invention, the selection unit 1203 is suitable for being based on corresponding to picture in an adjacent upper encoded block
The pixel reconstructed value of vegetarian refreshments is predicted to obtain each sub-block in present encoding block using preset multiple prediction modes respectively
The pixel predictors of pixel;By each sub-block in the present encoding block predicted using the multiple prediction mode
The pixel predictors of pixel are compared with the actual pixel value of the pixel of each sub-block respectively;From the multiple prediction
The smallest prediction of error so that between the pixel predictors and actual pixel value of the pixel of corresponding sub-block is chosen in mode
Mode, respectively as the prediction mode of the corresponding sub-block.
In an embodiment of the present invention, preset multiple prediction modes include: DC prediction mode, inverse DC prediction mould
Formula, vertical prediction mode, left oblique 30 degree of prediction modes, left oblique 45 degree of prediction modes, right oblique 30 degree of prediction modes, oblique 45 degree of the right side are pre-
Survey mode and average prediction mode.
Converting unit 1204, suitable for converting the prediction error of the pixel of sub-block each in present encoding block respectively
To the coefficient of frequency of frequency domain;In an embodiment of the present invention, the converting unit 904, suitable for the integer approximation using HEVC
Discrete cosine transform matrix converts the prediction error of pixel in sub-block each in present encoding block respectively to frequency domain
Coefficient of frequency.
Quantifying unit 10905, suitable for choosing the quantization parameter of present encoding block, and using selected quantization parameter point
The coefficient of frequency of the corresponding frequency domain of sub-blocks multiple in present encoding block is not quantified, obtains present encoding block
Quantization step;Wherein, the quantization parameter of present encoding block is to choose out of preset quantization parameter, and make present encoding
The corresponding compression ratio of the encoded information of block is less than or equal to preset compression ratio threshold value and the smallest quantization parameter of numerical value;
In an embodiment of the present invention, the quantifying unit 1205 is suitable in sequence to preset quantization parameter range
Interior each quantization parameter is traversed;Using the current quantisation parameter traversed respectively to each sub-district in present encoding block
Block is quantified respectively, obtains the encoded information of present encoding block;Judge the encoded information of obtained present encoding block
Whether corresponding compression ratio is less than the compression ratio threshold value;When the corresponding compression ratio of the encoded information for determining present encoding block is small
When the compression ratio threshold value, using current quantisation parameter as the quantization parameter of present encoding block;It is current when determining
When the corresponding compression ratio of the encoded information of encoded block is greater than the compression ratio threshold value, the quantization parameter of next bit sequence is chosen, directly
The corresponding compression ratio of the encoded information of present encoding block is made to be less than or equal to the compression ratio to selected quantization parameter
Threshold value.
Entropy code unit 1206, suitable for by the prediction mode of sub-block each in present encoding block, selected quantization
Parameter and corresponding quantization step carry out entropy coding, obtain the encoded information of present encoding block, until multiple encoded blocks traverse
It completes.
In an embodiment of the present invention, the quantization step uses following one of which: quantization step map;Quantization step map and
Quantization step sign;Quantization step map, quantization step sign and the pure value of quantization step.
In an embodiment of the present invention, the entropy code unit 1206 is suitable for when the quantization step is quantization step map,
It is encoded using prediction mode, quantization step map of the regular length code encoding method to each sub-block of present encoding block;
When the quantization step is quantization step map and quantization step sign, using regular length code encoding method to present encoding block
Prediction mode, quantization step map and the quantization step sign of each sub-block are encoded;When the quantization step is quantization terrace
When figure, quantization step sign and the pure value of quantization step, using regular length code encoding method to each sub-block of present encoding block
Prediction mode, quantization step map and quantization step sign encoded, and compiled using Golomb-Rice coding mode to current
The pure value of quantization step of the code each sub-block of block is encoded.
In an embodiment of the present invention, in order to enable the chip external memory that the encoded information of each encoded block occupies is deposited
Storage resource size is fixed, and described image compression set 1200 can also include judging unit 1207 and fills unit 1208, in which:
Judging unit 1207, suitable for judging present encoding block after the encoded information for obtaining present encoding block
Whether the corresponding compression ratio of encoded information is less than the compression ratio threshold value;
Fills unit 1208, suitable for being less than the compression when the corresponding compression ratio of encoded information for determining present encoding block
When rate threshold value, the encoded information of the present encoding block is filled so that filling after present encoding block coding
The corresponding compression ratio of information is equal to the compression ratio threshold value.
In an embodiment of the present invention, the size of the encoded block is 64*1, and the size of sub-block is 8*1.
Figure 13 shows the structure of one of embodiment of the present invention image decompression compression apparatus.Referring to Figure 13, a kind of image
Decompressing device 1300 may include acquiring unit 1301, entropy decoding unit 1302, inverse quantization unit 1303, inverse transform unit
1304, anti-predicting unit 1305, the first reconstruction unit 1306 and the second reconstruction unit 1307, in which:
Acquiring unit 1301, suitable for obtaining the encoded information of the corresponding multiple encoded blocks of original image;
Entropy decoding unit 1302 is traversed suitable for the encoded information to multiple encoded blocks, and current to what is traversed
The encoded information of encoded block carries out entropy decoding, obtains the prediction mode, quantization parameter of each sub-block in present encoding block
And quantization step;In an embodiment of the present invention, the quantization step uses following one of which: quantization step map;Quantization step map;
Quantization step map and quantization step sign;Quantization step map, quantization step sign and the pure value of quantization step.
In an embodiment of the present invention, the entropy decoding unit 1302 is suitable for when the quantization step is quantization step map,
It is solved using prediction mode, quantization step map of the fixed-length code coding/decoding method to each sub-block in present encoding block
Code;Suitable for when the quantization step be quantization step map and quantization step sign when, using fixed-length code coding/decoding method to current
The prediction mode of each sub-block, amount quantization step map and quantization step sign are decoded in encoded block;When the quantization
When rank is quantization step map, quantization step sign and quantization step pure value, using fixed-length code coding/decoding method to present encoding area
The prediction mode of each sub-block, quantization step map and quantization step sign are decoded in block, and are solved using Golomb-Rice
Code method is decoded the pure value of quantization step of each sub-block of present encoding block.
Inverse quantization unit 1303, suitable for using the corresponding quantization step for decoding and obtaining in the present encoding block traversed
Corresponding sub-block carries out inverse quantization processing, obtains the frequency system of the corresponding frequency domain of each sub-block in present encoding block
Number;
Inverse transform unit 1304, suitable for by the coefficient of frequency of the corresponding frequency domain of sub-block each in present encoding block into
The processing of row inverse transform, obtains the prediction error of the pixel of each sub-block in present encoding block;In one embodiment of the invention
In, the inverse transform unit 1304, suitable for the integer approximation discrete cosine transform matrix using HEVC, in present encoding block
The coefficient of frequency of the corresponding frequency domain of each sub-block carries out inverse transform processing.
Anti- predicting unit 1305, suitable for based on decoding obtain prediction mode, corresponding prediction error, to present encoding area
The pixel value of the pixel of corresponding sub-block carries out anti-prediction processing in block, obtains each sub-block pixel in present encoding block
The pixel reconstructed value of point;In an embodiment of the present invention, the anti-predicting unit 1305 is suitable for using an adjacent upper encoded block
Corresponding pixel points reconstruction pixel value, the obtained prediction mode of decoding and corresponding prediction error, obtain present encoding block
In each sub-block pixel pixel reconstructed value.
First reconstruction unit 1306, suitable for by the pixel reconstructed value of sub-block pixel each in present encoding block according to
Sequential concatenation, the present encoding block after being rebuild, until multiple encoded blocks traversal is completed, the volume after obtaining multiple reconstructions
Code block;
Second reconstruction unit 1307 obtains described suitable for splicing the encoded block after multiple reconstructions in sequence
The corresponding reconstruction image of original image.
The embodiment of the invention also provides a kind of computer readable storage mediums, execute when the computer instruction is run
The step of stating the method for compressing image in embodiment, repeats no more.
The embodiment of the invention also provides a kind of computer readable storage mediums, execute when the computer instruction is run
The step of stating the image expansion method of embodiment, repeats no more.
The embodiment of the invention also provides a kind of terminal, including memory and processor, energy is stored on the memory
Enough computer instructions run on the processor, the processor execute above-described embodiment when running the computer instruction
Method for compressing image the step of, repeat no more.
The embodiment of the invention also provides a kind of terminal, including memory and processor, energy is stored on the memory
Enough computer instructions run on the processor, the processor execute above-described embodiment when running the computer instruction
Image expansion method the step of, repeat no more.
Using the above scheme in the embodiment of the present invention, by each encoded block the entropy coding stage coded-bit
The information of amount chooses the corresponding quantization parameter of best reconstructed image quality, so that selected out of preset quantization parameter
The quantization parameter taken can be by the corresponding image compression ratio control of the encoded information of corresponding encoded block in preset compression ratio threshold
Within value, so as to while ensuring image reconstruction quality, guarantee stable, lesser bandwidth load.
Further, the pixel reconstructed value based on pixel in an adjacent upper encoded block chooses present encoding block
In the corresponding prediction mode of each sub-block, between the encoded block that the not adjacent each other relationship of encoded block up and down can be made
Can be with absolute coding, thus the speed of coding can be improved, and then improve the speed of image procossing.
Further, before quantification treatment, the prediction of each sub-block and conversion process can be parallel in encoded block
It carries out, can be further improved the speed of image coding.
Further, after the quantization step that entropy decoding obtains corresponding encoded block, each sub-block is anti-in encoded block
Quantization and inverse transform processing can carry out parallel, can be further improved the speed of image procossing.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of above-described embodiment is can
It is completed with instructing relevant hardware by program, which can store in computer readable storage medium, and storage is situated between
Matter may include: ROM, RAM, disk or CD etc..
The method and system of the embodiment of the present invention are had been described in detail above, the present invention is not limited thereto.Any
Field technical staff can make various changes or modifications without departing from the spirit and scope of the present invention, therefore guarantor of the invention
Shield range should be defined by the scope defined by the claims..
Claims (40)
1. a kind of method for compressing image characterized by comprising
The raw image data of input is divided into corresponding encoded block;
The multiple encoded blocks obtained to division traverse, and the present encoding block traversed is divided into corresponding multiple sons
Block;
From choosing the corresponding prediction mode of each sub-block in present encoding block in preset multiple prediction modes;
The prediction error of the pixel of sub-block each in present encoding block is converted respectively to the coefficient of frequency of frequency domain;
The quantization parameter of present encoding block is chosen, and respectively will be multiple in present encoding block using selected quantization parameter
The coefficient of frequency of the corresponding frequency domain of sub-block is quantified, and the quantization step of present encoding block is obtained;Wherein, present encoding area
The quantization parameter of block is to choose out of preset quantization parameter, and make the corresponding pressure of the encoded information of present encoding block
Shrinkage is less than or equal to preset compression ratio threshold value and the smallest quantization parameter of numerical value;
The prediction mode, selected quantization parameter and corresponding quantization step of sub-block each in present encoding block are subjected to entropy
Coding, obtains the encoded information of present encoding block, until multiple encoded blocks traversal is completed.
2. method for compressing image according to claim 1, which is characterized in that described to be selected from preset multiple prediction modes
Take the corresponding prediction mode of each sub-block in present encoding block, comprising:
It is pre- using preset multiple prediction mode difference based on the pixel reconstructed value of corresponding pixel points in an adjacent upper encoded block
Measure the pixel predictors of the pixel of each sub-block in present encoding block;
The pixel of the pixel of each sub-block in the present encoding block predicted using the multiple prediction mode is pre-
Measured value is compared with the actual pixel value of the pixel of each sub-block respectively;
Chosen from the multiple prediction mode so that the pixel of corresponding sub-block pixel predictors and actual pixel value it
Between the smallest prediction mode of error, respectively as the prediction mode of the corresponding sub-block.
3. method for compressing image according to claim 1, which is characterized in that preset multiple prediction modes include:
DC prediction mode, inverse DC prediction mode, vertical prediction mode, left oblique 30 degree of prediction modes, left oblique 45 degree of prediction modes, the right side oblique 30
Spend prediction mode, right oblique 45 degree of prediction modes and average prediction mode.
4. method for compressing image according to claim 1, which is characterized in that described by sub-district each in present encoding block
The prediction error of pixel is converted respectively to the coefficient of frequency of frequency domain in block, comprising: discrete remaining using the integer approximation of HEVC
String transition matrix converts the prediction error of pixel in sub-block each in present encoding block respectively to the frequency of frequency domain
Coefficient.
5. method for compressing image according to claim 1, which is characterized in that the quantization ginseng for choosing present encoding block
Number, comprising:
Each quantization parameter within the scope of preset quantization parameter is traversed in sequence;
Each sub-block in present encoding block is quantified respectively using the current quantisation parameter traversed, is currently compiled
The encoded information of code block;
Judge whether the corresponding compression ratio of encoded information of obtained present encoding block is less than or equal to the compression ratio threshold
Value;
It, will be current when the corresponding compression ratio of the encoded information for determining present encoding block is less than or equal to the compression ratio threshold value
Quantization parameter of the quantization parameter as present encoding block;
When the corresponding compression ratio of the encoded information for determining present encoding block is greater than the compression ratio threshold value, next bit sequence is chosen
Quantization parameter, until selected quantization parameter makes the corresponding compression ratio of the encoded information of present encoding block be less than or wait
In the compression ratio threshold value.
6. method for compressing image according to claim 1, which is characterized in that the quantization step uses following one of which:
Quantization step map;
Quantization step map and quantization step sign;
Quantization step map, quantization step sign and the pure value of quantization step.
7. method for compressing image according to claim 6, which is characterized in that when the quantization step using quantization step map into
When row indicates, the prediction mode, selected quantization parameter and corresponding amount by sub-block each in present encoding block
Change rank and carry out entropy coding, comprising:
It is compiled using prediction mode, quantization step map of the regular length code encoding method to each sub-block of present encoding block
Code.
8. method for compressing image according to claim 6, which is characterized in that when the quantization step using quantization step map and
It is described by the prediction mode of sub-block each in present encoding block, selected quantization when quantization step sign is indicated
Parameter and corresponding quantization step carry out entropy coding, comprising:
Using regular length code encoding method to the prediction mode, quantization step map and quantization of each sub-block of present encoding block
Rank sign is encoded.
9. method for compressing image according to claim 6, which is characterized in that when the quantization step is quantization step map, amount
It is described by the prediction mode of sub-block each in present encoding block, selected amount when changing rank sign and the pure value of quantization step
Change parameter and corresponding quantization step carry out entropy coding, comprising:
Using regular length code encoding method to the prediction mode, quantization step map and quantization of each sub-block of present encoding block
Rank sign is encoded, and pure to the quantization step of each sub-block of present encoding block using Golomb-Rice coding mode
Value is encoded.
10. method for compressing image according to claim 1, which is characterized in that in the coding letter for obtaining present encoding block
After breath, further includes:
Judge whether the corresponding compression ratio of the encoded information of present encoding block is less than the compression ratio threshold value;
When the corresponding compression ratio of the encoded information for determining present encoding block is less than the compression ratio threshold value, to the current volume
The encoded information of code block is filled, so that the corresponding compression ratio of encoded information of present encoding block is equal to institute after filling
State compression ratio threshold value.
11. -10 described in any item method for compressing image according to claim 1, which is characterized in that the size of the encoded block
For 64*1, the size of sub-block is 8*1.
12. a kind of image expansion method characterized by comprising
Obtain the encoded information of the corresponding multiple encoded blocks of original image;
The encoded information of multiple encoded blocks is traversed, and entropy is carried out to the encoded information of the present encoding block traversed
Decoding, obtains the prediction mode, quantization parameter and quantization step of each sub-block in present encoding block;
Inverse quantization is carried out to sub-block corresponding in the present encoding block traversed using the corresponding quantization step that decoding obtains
Processing obtains the coefficient of frequency of the corresponding frequency domain of each sub-block in present encoding block;
The coefficient of frequency of the corresponding frequency domain of sub-block each in present encoding block is subjected to inverse transform processing, is currently compiled
The prediction error of the pixel of each sub-block in code block;
Based on obtained prediction mode, corresponding prediction error is decoded, to the pixel of sub-block corresponding in present encoding block
Pixel value carry out anti-prediction processing, obtain the pixel reconstructed value of each sub-block pixel in present encoding block;
The pixel reconstructed value of sub-block pixel each in present encoding block is spliced in sequence, it is current after being rebuild
Encoded block, until multiple encoded blocks traversal is completed, the encoded block after obtaining multiple reconstructions;
Encoded block after multiple reconstructions is spliced in sequence, obtains the corresponding reconstruction image of the original image.
13. image expansion method according to claim 12, which is characterized in that it is described will be each in present encoding block
The coefficient of frequency of the corresponding frequency domain of sub-block carries out inverse transform processing, comprising:
Using the integer approximation discrete cosine transform matrix of HEVC, frequency domain corresponding to sub-block each in present encoding block
Coefficient of frequency carry out inverse transform processing.
14. image expansion method according to claim 12, which is characterized in that the prediction mould obtained based on decoding
Formula, corresponding prediction error carry out anti-prediction processing, packet to the pixel value of the pixel of sub-block corresponding in present encoding block
It includes:
Using the reconstruction pixel value of the corresponding pixel points of an adjacent upper encoded block, the obtained prediction mode of decoding and corresponding pre-
Error is surveyed, the pixel reconstructed value of each sub-block pixel in present encoding block is obtained.
15. image expansion method according to claim 12, which is characterized in that the quantization step is using following wherein one
Kind:
Quantization step map;
Quantization step map and quantization step sign;
Quantization step map, quantization step sign and the pure value of quantization step.
16. image expansion method according to claim 15, which is characterized in that when the quantization step is quantization step map
When, the encoded information to present encoding block carries out entropy decoding, comprising:
It is carried out using prediction mode, quantization step map of the fixed-length code coding/decoding method to each sub-block in present encoding block
Decoding.
17. image expansion method according to claim 15, which is characterized in that when the quantization step is quantization step map
When with quantization step sign, the encoded information to present encoding block carries out entropy decoding, comprising:
Prediction mode, Systems of Quantitative Map and quantization using fixed-length code coding/decoding method to each sub-block in present encoding block
Rank sign is decoded.
18. image expansion method according to claim 15, which is characterized in that when the quantization step is quantization terrace
When figure, quantization step sign and the pure value of quantization step, the encoded information to present encoding block carries out entropy decoding, comprising:
Using fixed-length code coding/decoding method to the prediction mode, quantization step map and amount of each sub-block in present encoding block
Change rank sign to be decoded, and using Golomb-Rice coding/decoding method to the quantization step of each sub-block of present encoding block
Pure value is decoded.
19. a kind of image compressing device characterized by comprising
First blocking unit, suitable for the raw image data of input is divided into corresponding multiple encoded blocks;
Second blocking unit, multiple encoded blocks suitable for obtaining to division traverse, the present encoding block that will be traversed
It is divided into corresponding multiple sub-blocks;
Selection unit is suitable for from choosing the corresponding prediction of each sub-block in present encoding block in preset multiple prediction modes
Mode;
Converting unit, suitable for being converted the prediction error of the pixel of sub-block each in present encoding block respectively to frequency domain
Coefficient of frequency;
Quantifying unit, suitable for choosing the quantization parameter of present encoding block, and respectively will be current using selected quantization parameter
The coefficient of frequency of the corresponding frequency domain of multiple sub-blocks is quantified in encoded block, obtains the quantization step of present encoding block;
Wherein, the quantization parameter of present encoding block is to choose out of preset quantization parameter, and make present encoding block
The corresponding compression ratio of encoded information is less than or equal to preset compression ratio threshold value and the smallest quantization parameter of numerical value;
Entropy code unit, suitable for by the prediction mode of sub-block each in present encoding block, selected quantization parameter and right
The quantization step answered carries out entropy coding, obtains the encoded information of present encoding block, until multiple encoded blocks traversal is completed.
20. image compressing device according to claim 19, which is characterized in that the selection unit is suitable for based on adjacent
The pixel reconstructed value of corresponding pixel points in a upper encoded block, predicts currently to be compiled respectively using preset multiple prediction modes
The pixel predictors of the pixel of each sub-block in code block;The current volume that will be predicted using the multiple prediction mode
Code block in each sub-block pixel pixel predictors respectively with the actual pixel value of the pixel of each sub-block into
Row compares;Pixel predictors and actual pixel value so that the pixel of corresponding sub-block are chosen from the multiple prediction mode
Between the smallest prediction mode of error, respectively as the prediction mode of the corresponding sub-block.
21. image compressing device according to claim 19, which is characterized in that preset multiple prediction mode packets
It includes: DC prediction mode, inverse DC prediction mode, vertical prediction mode, left oblique 30 degree of prediction modes, left oblique 45 degree of prediction modes, right sides
Oblique 30 degree of prediction modes, right oblique 45 degree of prediction modes and average prediction mode.
22. image compressing device according to claim 19, which is characterized in that the converting unit is suitable for using HEVC
Integer approximation discrete cosine transform matrix, the prediction error of pixel in sub-block each in present encoding block is turned respectively
Shift to the coefficient of frequency of frequency domain.
23. image compressing device according to claim 19, which is characterized in that the quantifying unit is suitable in sequence
Each quantization parameter within the scope of preset quantization parameter is traversed;Using the current quantisation parameter traversed respectively to working as
Each sub-block is quantified respectively in preceding encoded block, obtains the encoded information of present encoding block;Judge obtained work as
Whether the corresponding compression ratio of the encoded information of preceding encoded block is less than or equal to the compression ratio threshold value;When determining present encoding area
When the corresponding compression ratio of the encoded information of block is less than or equal to the compression ratio threshold value, using current quantisation parameter as present encoding
The quantization parameter of block;When the corresponding compression ratio of the encoded information for determining present encoding block is greater than the compression ratio threshold value,
The quantization parameter of next bit sequence is chosen, until selected quantization parameter makes the corresponding pressure of the encoded information of present encoding block
Shrinkage is less than or equal to the compression ratio threshold value.
24. image compressing device according to claim 19, which is characterized in that the quantization step using it is following wherein at least
It is a kind of:
Quantization step map;
Quantization step map and quantization step sign;
Quantization step map, quantization step sign and the pure value of quantization step.
25. image compressing device according to claim 24, which is characterized in that the entropy code unit is suitable for when described
When quantization step is quantization step map, using regular length code encoding method to the prediction mould of each sub-block of present encoding block
Formula, quantization step map are encoded.
26. image compressing device according to claim 24, which is characterized in that the entropy code unit is suitable for when described
When quantization step is quantization step map and quantization step sign, using regular length code encoding method to each height of present encoding block
Prediction mode, quantization step map and the quantization step sign of block are encoded.
27. image compressing device according to claim 24, which is characterized in that the entropy code unit is suitable for when described
When quantization step is quantization step map, quantization step sign and quantization step pure value, compiled using regular length code encoding method to current
Prediction mode, quantization step map and the quantization step sign of the code each sub-block of block are encoded, and use Golomb-Rice
Coding mode encodes the pure value of quantization step of each sub-block of present encoding block.
28. image compressing device according to claim 19, which is characterized in that further include:
Judging unit, suitable for judging the encoded information of present encoding block after the encoded information for obtaining present encoding block
Whether corresponding compression ratio is less than the compression ratio threshold value;
Fills unit, suitable for being less than the compression ratio threshold value when the corresponding compression ratio of encoded information for determining present encoding block
When, the encoded information of the present encoding block is filled so that filling after present encoding block encoded information pair
The compression ratio answered is equal to the compression ratio threshold value.
29. the described in any item image compressing devices of 9-28 according to claim 1, which is characterized in that the encoded block it is big
Small is 64*1, and the size of sub-block is 8*1.
30. a kind of image decompression compression apparatus characterized by comprising
Acquiring unit, suitable for obtaining the encoded information of the corresponding multiple encoded blocks of original image;
Entropy decoding unit is traversed suitable for the encoded information to multiple encoded blocks, and to the present encoding block traversed
Encoded information carry out entropy decoding, obtain the prediction mode, quantization parameter and quantization step of each sub-block in present encoding block;
Inverse quantization unit, suitable for using the corresponding quantization step for decoding and obtaining to corresponding son in the present encoding block traversed
Block carries out inverse quantization processing, obtains the coefficient of frequency of the corresponding frequency domain of each sub-block in present encoding block;
Inverse transform unit, suitable for the coefficient of frequency of the corresponding frequency domain of sub-block each in present encoding block is carried out inverse transform
Processing, obtains the prediction error of the pixel of each sub-block in present encoding block;
Anti- predicting unit, suitable for obtained based on decoding prediction mode, corresponding prediction error, to corresponding in present encoding block
The pixel value of the pixel of sub-block carries out anti-prediction processing, obtains the pixel of each sub-block pixel in present encoding block
Reconstructed value;
First reconstruction unit, suitable for spelling the pixel reconstructed value of sub-block pixel each in present encoding block in sequence
It connects, the present encoding block after being rebuild, until multiple encoded blocks traversal is completed, the code area after obtaining multiple reconstructions
Block;
Second reconstruction unit obtains the original image suitable for splicing the encoded block after multiple reconstructions in sequence
Corresponding reconstruction image.
31. image decompression compression apparatus according to claim 30, which is characterized in that the inverse transform unit is suitable for using
The integer approximation discrete cosine transform matrix of HEVC, to the frequency system of the corresponding frequency domain of sub-block each in present encoding block
Number carries out inverse transform processing.
32. image decompression compression apparatus according to claim 30, which is characterized in that the anti-predicting unit is suitable for using
The prediction mode and corresponding prediction error that the reconstruction pixel value of the corresponding pixel points of an adjacent upper encoded block, decoding obtain,
Obtain the pixel reconstructed value of each sub-block pixel in present encoding block.
33. image expansion method according to claim 30, which is characterized in that the quantization step is using following wherein one
Kind:
Quantization step map;
Quantization step map and quantization step sign;Quantization step map, quantization step sign and the pure value of quantization step.
34. image decompression compression apparatus according to claim 33, which is characterized in that the entropy decoding unit is suitable for working as institute
State quantization step be quantization step map when, the prediction using fixed-length code coding/decoding method to each sub-block in present encoding block
Mode, quantization step map are decoded.
35. image decompression compression apparatus according to claim 33, which is characterized in that the entropy decoding unit is suitable for working as institute
When to state quantization step be quantization step map and quantization step sign, using fixed-length code coding/decoding method to each in present encoding block
Prediction mode, quantization step map and the quantization step sign of a sub-block are decoded.
36. image decompression compression apparatus according to claim 33, which is characterized in that the entropy decoding unit is suitable for working as institute
When to state quantization step be quantization step map, quantization step sign and quantization step pure value, using fixed-length code coding/decoding method to current
The prediction mode of each sub-block, quantization step map and quantization step sign are decoded in encoded block, and use Golomb-
Rice coding/decoding method is decoded the pure value of quantization step of each sub-block of present encoding block.
37. a kind of computer readable storage medium, which is characterized in that the computer instruction run when perform claim require 1 to
The step of 11 described in any item method for compressing image.
38. a kind of computer readable storage medium, which is characterized in that the computer instruction run when perform claim require 12 to
The step of 18 described in any item image expansion methods.
39. a kind of terminal, which is characterized in that including memory and processor, storing on the memory can be at the place
The computer instruction run on reason device, perform claim requires any one of 1 to 11 when the processor runs the computer instruction
The step of described method for compressing image.
40. a kind of terminal, which is characterized in that including memory and processor, storing on the memory can be at the place
The computer instruction run on reason device, perform claim requires any one of 12 to 18 when the processor runs the computer instruction
The step of described image expansion method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710360986.7A CN108965880B (en) | 2017-05-19 | 2017-05-19 | Image compression method, image decompression method, image compression device, image decompression device, storage medium and terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710360986.7A CN108965880B (en) | 2017-05-19 | 2017-05-19 | Image compression method, image decompression method, image compression device, image decompression device, storage medium and terminal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108965880A true CN108965880A (en) | 2018-12-07 |
CN108965880B CN108965880B (en) | 2021-06-25 |
Family
ID=64462249
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710360986.7A Active CN108965880B (en) | 2017-05-19 | 2017-05-19 | Image compression method, image decompression method, image compression device, image decompression device, storage medium and terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108965880B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
RU2816752C2 (en) * | 2019-04-25 | 2024-04-04 | Квэлкомм Инкорпорейтед | Assignment of pulse-code modulation of region of quantized on block basis residuals for intra-prediction mode derivation |
-
2017
- 2017-05-19 CN CN201710360986.7A patent/CN108965880B/en active Active
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
RU2816752C2 (en) * | 2019-04-25 | 2024-04-04 | Квэлкомм Инкорпорейтед | Assignment of pulse-code modulation of region of quantized on block basis residuals for intra-prediction mode derivation |
RU2816752C9 (en) * | 2019-04-25 | 2024-08-23 | Квэлкомм Инкорпорейтед | Assignment of pulse-code modulation of region of quantized on block basis residuals for intra-prediction mode derivation |
Also Published As
Publication number | Publication date |
---|---|
CN108965880B (en) | 2021-06-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR0162197B1 (en) | Image data variable length coding and decoding method and device | |
KR101563554B1 (en) | Video encoder with an integrated temporal filter for denoising | |
US20110002396A1 (en) | Reference Frames Compression Method for A Video Coding System | |
JP2010537534A (en) | Method and system for data compression | |
KR102390162B1 (en) | Apparatus and method for encoding data | |
US20190068981A1 (en) | Storing and retrieving lossy-compressed high bit depth image data | |
CN107018418A (en) | Reference data method for reusing, band width estimation method and associated video decoder | |
KR102238058B1 (en) | Encoder, decoder and method | |
CN109716768A (en) | Storage and retrieval bit-depth image data | |
CN105611292B (en) | Video decoding apparatus and video encoding/decoding method | |
CN109348231A (en) | Method and apparatus for encoding or decoding image by inter-layer motion information prediction according to motion information compression scheme | |
US8548062B2 (en) | System for low resolution power reduction with deblocking flag | |
JP2004007649A (en) | Parameterization for fading compensation | |
US11477465B2 (en) | Colour component prediction method, encoder, decoder, and storage medium | |
CN104919798A (en) | Method and apparatus of quantization matrix coding | |
KR20070028404A (en) | Method of storing pictures in a memory using compression coding and cost function including power consumption | |
US8249372B2 (en) | Methods and devices for coding and decoding multidimensional digital signals | |
CN105208394B (en) | A kind of real-time digital image compression prediction technique and system | |
CN104937934A (en) | Autoregressive pixel prediction in the neighborhood of image borders | |
RU2683614C2 (en) | Encoder, decoder and method of operation using interpolation | |
KR20100012738A (en) | Method and apparatus for compressing reference frame in video encoding/decoding | |
US20090245391A1 (en) | Lossy frame memory compression using intra refresh | |
CN1848960B (en) | Residual coding in compliance with a video standard using non-standardized vector quantization coder | |
JP2022503990A (en) | Video image component prediction methods and devices, computer storage media | |
CN108965880A (en) | Compression of images, decompression method and device, storage medium, terminal |
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 |