Background technology
Along with multimedia and development of internet technology and application, existing Joint Photographic Experts Group JPEG can not satisfy current market and requirement of actual application, and International Standards Organization has formulated the new standard JPEG2000 of rest image compression in November, 2000 for this reason.This new standard has adopted Australian scholar David Taubman at High PerformanceScalable Image Compression with EBCOT (IEEE Trans.Image Processing, vol.9, no.7, pp.1158-1170, July 2000) wavelet transformation and the rate-distortion optimization intercepting built-in code block encryption algorithm EBCOT that propose in the literary composition, this algorithm is divided into T1 encoder and T2 encoder two parts.T1 is made up of embedded bit-plane coding and MQ arithmetic encoder, finishes context and forms and arithmetic coding; Control of T2 part completion rate and code stream tissue.When carrying out rate-distortion optimization intercepting built-in code block encryption algorithm EBCOT coding, each wavelet sub-band is divided into littler code block, as 64 * 64, is that unit independently makes the T1 coding with the code block.The bitstream length that different code blocks produces is inequality, and they also are different to the contribution that recovers picture quality.Therefore for the bit stream of all code blocks generations, T2 has adopted the rate-distortion optimization technology to carry out the back compression and has handled, and finishes the rate control and the tissue of code stream.
JPEG2000 adopts PCRD (compression back rate-distortion optimization) algorithm accurately to carry out rate control, and this algorithm can make compressed image best in quality under the constant bit rate condition.But the PCRD optimized Algorithm is the global optimization procedure on entire image, after finishing, all channel codings that it must wait until all code blocks of entire image just can carry out the search of layering intercept point, and the T1 encoder has comprised most of amount of calculation in the JPEG2000 encoder, be about 45%~60%, yet T1 encoder a big chunk amount of calculation and memory space are redundant for final code stream, and huge amount of calculation and a large amount of internal memories are the bottlenecks of JPEG2000 hardware real-time implementation.
By optimization rate distortion intercepting algorithm as can be known: must learn the code length Δ Rik of coding pass of all code blocks and the distortion reduction amount of each coding pass
, this also just requires the T1 encoder must be to all bit-plane codings, and the coded data and the relevant information of storing each subband, as storage
With
Deng.Obviously, most of coded data wherein is not included in the final compressed bit stream, and this just causes most of amount of calculation of T1 encoder and memory use amount to be wasted on the useless data of final compressed bit stream.In order to improve the operating efficiency of encoder, the T1 encoder there is no need all bit-planes or all sub-band codings, as long as can in the process of T1 coding, determine a suitable coding depth at different bit rate self adaptations, guarantee that in this coding range each code block rate-distortion slope curve is that strictly monotone descends, carry out intercept point again and select, can reach the compression effectiveness of JPEG2000 standard substantially.According to EBCOT actual coding characteristics as can be known: the first, slope only compares computing when selecting to optimize intercept point, that is to say that the actual value of slope is unimportant, the magnitude relationship between the importantly used slope, this also is that we can be to the prerequisite of its prediction.Second, the rate-distortion slope curve of each code block is relevant with the type of the bit-planes of coding and the subband of encoding, and except individual other singular point, it is on a declining curve substantially, in same bit-planes, early the subband of coding is bigger than the rate-distortion slope of the subband of late coding.
Therefore, shortening time and minimizing memory space press for, and many scholars have made number of research projects in this respect, have proposed some algorithms, improve code efficiencies from different degree.Y.M.Yeung is at Efficient rate control forJPEG2000 image coding (IEEE Trans.on Circuits and Systems for Video Technology, vol.15, no.3, pp.335-344, March, 2005) high more in the literary composition according to bit-planes in the coding code block, the characteristics that the importance of its contained information is high have more proposed priority scan rate allocation algorithm PSRA, basic thought is to find out a maximum coding pass number in entire image coding code block, then according to this maximum coding pass number, all code blocks are encoded from high to low according to coding pass, until reaching target bit rate.On the basis of PSRA algorithm, Y.M.Yeung has proposed the best intercepting of priority scan algorithm PSOT again, its algorithm thought is according to the PSRA algorithm, high coding pass priority encoding, up to reaching the target code stream, then from finding out the minimum coding pass of rate-distortion slope the coding pass, each code block rate-distortion slope of encoding is greater than the coding pass of minimum rate-distortion slope, and the code stream with gained carries out the final code stream of rate-distortion optimization intercepting output at last.The PSOT algorithm has improved the performance of PSRA algorithm, and its Y-PSNR PSNR is substantially equal to the JPEG2000 canonical algorithm, but comparing the PSRA algorithm has but increased amount of calculation and memory space greatly, and has increased T2 rate-distortion optimization intercepting algorithm.In this high coding pass priority encoding framework, need in all code blocks, circulate and switch the code block coding, and the state informations such as context state variable that need to preserve all code blocks, algorithm complex is higher, the relevant information memory space is big, and this is difficult to accomplish in real-time system.Therefore the real-time JPEG2000 compression ratio control algolithm of low, the low memory requirement of designing and calculating amount is very important.Wu Zongze blocks Rate Control new algorithm and VLSI structural design (electronic letters, vol thereof in real time at JPEG2000, vol.33, no.8, pp.1457-1460.August, 2005) allocate the compressed code number of words of each code block in the literary composition in advance according to small echo quantization weight and coding pass number, proposed the preallocated rate control algolithm of JPEG2000 code check.This algorithm has greatly reduced the amount of calculation and the memory space of the T1 encoder of JPEG2000, realized blocking in real time coding, and the code stream of gained needn't carry out the intercepting of T2 rate-distortion optimization and directly carry out the code stream tissue and pack getting final product, algorithm complex is very low, helps large scale integrated circuit VLSI and realizes.But the Y-PSNR PSNR of this algorithm is lower, generally will be lower than more than the PCRD algorithm 0.8dB, and image quality loss is bigger.TaekonKim is at Memory Efficient Progressive Rate-Distortion Algorithm for JPEG2000 (IEEE Trans.on Circuits and Systems for Video Technology, vol.15, no.1, pp.181-187.January, 2005) the progressive rate-distortion optimization algorithm of efficient internal memory MEPRD has been proposed, the thought that the minimum slope that this algorithm proposes abandons makes the T1 encoder advantage of association rate distortion slope optimization intercepting algorithm effectively, its performance and canonical algorithm are basic identical, and encode required operand and time have been reduced significantly, but increase along with code check, coding redundancy also increases thereupon, and has increased the minimum slope searching algorithm.
The content of invention
The objective of the invention is to overcome the deficiency of above-mentioned prior art, provide a kind of based on code check preallocated JPEG2000 adaptive rate control system and method, simplify rate control algorithm complexity height, improve code efficiency and recover picture quality, realize the code check optimal control of JPEG2000.
The key problem in technology of realizing the object of the invention is to have introduced a prediction module, independently entropy estimation is carried out on significant bit plane to image wavelet transform and quantification back EBCOT coding code block, and estimate that with code block the entropy summation instructs code check preassignment, simultaneously the T2 encoder by the preassignment coding bit rate adaptively the FEEDBACK CONTROL coding depth, finish and optimize intercepting.
The present invention propose based on the preallocated JPEG2000 adaptive rate of code check control system, comprise: preliminary treatment, wavelet transformation, quantification, T1 encoder, T2 encoder, this T1 encoder is made up of bit-planes+MQ encoder, this T2 encoder intercepts by optimizing, the code stream tissue is formed, it is characterized in that having additional the entropy estimation module in the T1 encoder, have additional Data Rate Distribution module and coding depth control module in the T2 encoder; The code block of original image after preliminary treatment, wavelet transformation and quantification divides two-way output, one the tunnel directly enters bit-planes+MQ encoder, another road estimates the entropy of each code block by the entropy estimation module, send into the Data Rate Distribution module and carry out Data Rate Distribution, and the code check of each code block is fed back to bit-planes+MQ encoder by the coding depth control module, after carrying out the code block bit-plane coding, feed back to the coding depth control module again and determine the coding output code flow of each code block, and to this output code flow be optimized the intercepting and the code stream tissue, export final code stream.
The code check that adds up of the code block after described bit-planes+input of MQ encoder quantizes and each code block of coding depth control module feedback, be by the add up bit-plane coding of each code block of Rate Control of each code block, the code block code stream of each code block coding back output carries out self adaptation to the coding depth control module again and adjusts coding depth, to control the bit-plane coding code stream of each code block.
Described entropy coding module adopts the JPEG-LS prediction algorithm that the code block that quantizes input is estimated, and each code block entropy that will estimate is exported to the Data Rate Distribution module.
Estimation entropy and each code block preassignment weights that each code block entropy that described Data Rate Distribution module will be imported adds up and obtains entire image are exported the encoder bit rate of each code block and are given the coding depth control module.
Described coding depth control module adds up each code block code stream of bit-planes+MQ encoder output, and compare by the coding depth control module with the code block encoder bit rate of Data Rate Distribution module input, add up code check and code block code stream of output code block given bit-planes+MQ encoder respectively and optimized interception module.
The present invention propose based on the preallocated JPEG2000 self-adaption code rate of code check control system, comprise following process:
Step 1 utilizes the JPEG-LS prediction algorithm to through each code block after wavelet transformation and the quantification, carries out code block entropy H
bEstimation, calculate the estimation entropy H of entire image and the encoder bit rate C of each code block
b, scan by the code block scanning sequency of JPEG2000 standard, for the T1 coding of all code blocks is prepared;
Step 2, the initial code degree of depth that current code block is set is controlled thresholding d
b=0;
Step 3 is carried out T1 coding to current code block, and the encoding code stream of the high channel of exporting that current code block do not encoded also adds up, promptly
Wherein
Be the encoding code stream length of k coding pass of current code block, when the distortion reduction amount of k coding pass of code block is
In the formula, b is the current code block number of image, and k is the current sign indicating number port number of current code block;
Step 4 compares encoding code stream and the code block allocated code code check that adds up, and adjusts coding depth control thresholding, and the coding of controlling each code block according to thresholding ends, and exports the encoding code stream of the code block of having encoded;
Step 5 is according to obtaining
With
, in the coding pass of having encoded, reject the singular point of each code block by rate-distortion optimization intercept point algorithm, calculate the rate-distortion slope between the neighboring candidate intercept point in each code block, search optimum intercept point at last, finish the code stream intercepting;
Step 6 is organized algorithm by the code stream of JPEG2000 standard, finishes code stream tissue and packing, exports final code stream.
Described step 4, carry out according to the following procedure:
1) coding depth of judging current code block is controlled thresholding d
iWhether be 1, if d
bBe not 1, then carry out (2), if d
b=1, then carry out (3);
2) the encoding code stream R that adds up of judgement code block
iWhether greater than the encoder bit rate C of code block
bIf, R
b≤ C
b, returned for the 3rd step the high channel of not encoded of current code block carried out the T1 coding, if R
bC
b, coding depth control thresholding d is set
b Be 1, returned for the 3rd step;
3) judge whether encoded finishing of all code blocks,, then export the encoding code stream of all code blocks, return the optimization intercepting that step 5 is carried out code stream again,, then carry out (4) if coding does not finish if all code blocks codings finish;
4), prepare the T1 coding of next code block, and return step 2 by the T1 of current code block coding.
The present invention is because employing is carried out independently entropy estimation to the significant bit plane of image wavelet transform and quantification back EBCOT coding code block, and estimate that with code block the entropy summation instructs code check preassignment, and by the preassignment encoder bit rate adaptively the FEEDBACK CONTROL coding depth, finish and optimize intercepting, thereby code check preassignment is accurate, amount of calculation and memory space have been reduced significantly, under different code checks, all improved code efficiency effectively, and obtained and the essentially identical high compression performance of canonical algorithm.
The compare test result of the PCRD algorithm that is adopted among the present invention and the JPEG2000 is as table 1~table 4.Relatively content comprises three aspects: the one, and the difference DELTA PSNR of Y-PSNR PSNR; The 2nd, the slip of amount of calculation, the slip of this amount of calculation is weighed with the coding pass number of T1 encoder encodes; The 3rd, the code stream byte number and the relevant information of storage, i.e. the distortion reduction amount of coding pass during the slip of the memory space of algorithm, the slip of this memory space are encoded with T1
, encoding code stream length
And rate-distortion slope
Byte number weigh;
The test of the Barbara image of table 1 couple standard 512*512 relatively
The test of the Lena image of table 2 couple standard 512*512 relatively
The test of the Field image of table 3 couple standard 1024*1024 relatively
The test of the Bridge image of table 4 couple standard 2048*2048 relatively
As can be seen, the present invention is under low code check from table 1~table 4, and mean P SNR difference is minimum to be 0.213dB, and along with the increase of code check, image quality loss is considerably less, and is approaching with the performance of PCRD standard method basically; Under different code checks, amount of calculation of the present invention and memory space all have significantly reduction, especially under 0.125bpp, the average computation amount slip of four width of cloth images and average memory space slip are respectively 77.6% and 92.6%, the rate distortion control structure that adopts the present invention to propose, can be reduced to originally 7.4% on storage resources, and under 2bpp, the average computation amount slip of four width of cloth images and average memory space slip are respectively 47.3% and 61.5%.As seen under different code checks, because the present invention has all significantly reduced amount of calculation and memory space, therefore not only can keep under the image quality loss prerequisite seldom, the amount of calculation and the memory space of whole JPEG2000 coded system have been reduced effectively, improve the efficient of encoder, and be easy to the hardware realization.
Embodiment
With reference to figure 1, JPEG2000 core encoder system mainly comprises: preliminary treatment, wavelet transform, quantification, bit-planes+MQ encoder, optimization intercepting, code stream tissue.After the original processing image of input at first passes through preliminary treatment and wavelet transform, be transformed into a series of different frequency bands; Then the coefficient after the conversion is carried out quantification treatment according to compression requirements; Subband after quantizing is divided into code block, as the basic processing unit of JPEG2000 entropy coding; Each code block is carried out the entropy coding of arithmetic encoder MQ respectively and handle, generate the original compression code stream; Then, adopt the rate-distortion optimization intercepting algorithm in the T2 encoder to carry out the code stream intercepting according to demand; Carry out the code stream tissue at last and generate final compressed bit stream output.
With reference to figure 2, the present invention has increased entropy estimation module, Data Rate Distribution module and coding depth control module on the basis of JPEG2000 core encoder system.After the original processing image of input at first passes through preliminary treatment, wavelet transform and quantification, be divided into many code blocks, input to bit-planes+MQ encoder and entropy coding module respectively.The code check that adds up of the code block after this bit-planes+input of MQ encoder quantizes and each code block of coding depth control module feedback, by the add up bit-plane coding of each code block of Rate Control of each code block, the code block code stream of each code block coding back output carries out self adaptation to the coding depth control module again and adjusts coding depth, to control the bit-plane coding code stream of each code block.This entropy coding module adopts the JPEG-LS prediction algorithm that the code block that quantizes input is estimated, and each code block entropy that will estimate is exported to the Data Rate Distribution module.Estimation entropy and each code block preassignment weights that each code block entropy that this Data Rate Distribution module will be imported adds up and obtains entire image are exported the encoder bit rate of each code block and are given the coding depth control module.This coding depth control module adds up each code block code stream of bit-planes+MQ encoder output, and compare by coding depth control code block with the code block encoder bit rate of Data Rate Distribution module input, add up code check and code block code stream of output code block given bit-planes+MQ encoder respectively and optimized interception module.Then, adopt the rate-distortion optimization intercepting algorithm in the T2 encoder to carry out the code stream intercepting according to demand; Carry out the code stream tissue at last and generate final compressed bit stream output.
With reference to figure 4, utilize system of the present invention to realize that the process of self-adaption code rate control is as follows:
One. estimate the entropy of each code block, be each code block allocated code code stream
1. entropy estimation principle
Carry out the entropy method of estimation of independent estimations based on code block significant bit plane in the wavelet field, specifically describe as follows:
If it is x that certain image wavelet decomposes the coefficient of a certain subband in back
Ij, i=0,1 ... .N-1, j=0,1 ... .M-1, the resolution of image is N * M, if be Δ with a step-length during image compression process
lQuantizer quantize, l=0 wherein, 1 ... L-1, L are the subband number of types behind the wavelet transformation, have certain zero bit-planes through the code block after quantizing, and establishing the zero bit-planes number of code block is z
b, b=0,1 ... B-1, B are the code block number of image, and the coefficient of code block coding is after then passing through quantification and removing code block zero bit-planes number:
By coefficient
The entropy estimated value of each code block of forming is considered the accuracy that algorithm complex and entropy are estimated, the present invention adopts based on the JPEG-LS prediction algorithm, and its prediction module is shown in Fig. 3 (a), and predictor formula is:
If the pixel of prediction is first row or first row of code block, then use the prediction module of Fig. 3 (b) and Fig. 3 (c) respectively, predicted value is the value of previous pixel.This moment code block prediction entropy H
bFor:
Then the estimation entropy H of entire image is:
Make W
bBe each code block preassignment weights, then:
And
The preallocated byte number of each code block is C
b=R
Max* W
b, R wherein
MaxPacked byte number for original image; Then each code block is pressed C
bCarrying out the EBCOT coding gets final product.
Calculating before code block estimates that entropy is encoded, at first to do preliminary treatment to image, wavelet transformation and quantification, thus obtain the code coefficient of each code block
The embodiment of the invention has adopted the classical test patterns of 4 width of cloth: be of a size of 512 * 512 Lena image, be of a size of 512 * 512 Barbara image, be of a size of 1024 * 1024 Field image, be of a size of 2048 * 2048 Bridge image, these images all carry out 4 grades of wavelet transformations by the Daubechies9/7 filter, and code block size is set at 64 * 64.13 subbands that image produces behind 4 grades of wavelet transformations are wherein with the resolution minimum of 4 subbands of low frequency sub-band LL peer.It to resolution 512 * 512 image, its subband minimum resolution is 32 * 32, and is littler than the code block size of original start, and then the code block size of these subbands is the size of subband resolution, thereby 4 32 * 32 code block and 63 64 * 64 code block, totally 67 code blocks are arranged.For resolution is 1024 * 1024 and 2048 * 2048 image, and all code block size are 64 * 64, and the image of these two kinds of resolution has 256 and 1024 code blocks respectively.
2. entropy estimation procedure
(1) to the prediction of all code block code coefficients.Each code block code coefficient after utilizing the JPEG-LS prediction algorithm to process wavelet transformation and quantification
Predict according to prediction masterplate shown in Figure 3, if
Be the value of code block first row or first row, then with this row maybe should row previous value as predicted value, as the prediction module of Fig. 3 (b) shown in (c), promptly
Or
If
Be first value of code block, then predicted value is itself, promptly
If other positions of code block then adopt the prediction masterplate shown in Fig. 3 (a) to predict by predictor formula.For example the value of initial adjacent 4 pixels of first code block is respectively
Then the predicted value of each point is respectively
Again because of
So
Predicted value
(2) the estimation entropy H of calculating entire image.After the predicted value that obtains all code block coefficients, can pass through earlier
Calculate the prediction entropy of each code block, pass through again
Calculate the estimation entropy of entire image.
At three kinds of image in different resolution in the foregoing description, there are 67,256 and 1024 code blocks to estimate entropy respectively, estimate that with these code blocks the entropy summation instructs code check preassignment during coding.
(3) distribute the encoder bit rate C of each code block
bIf W
bBe the preassignment weights of code block b, then:
The preallocated byte number of each code block is C
b=R
Max* W
b, R wherein
MaxPacked byte number for original image.
At three kinds of image in different resolution in the foregoing description, the encoder bit rate of 67,256 and 1024 code blocks is arranged respectively, the encoder bit rate with these code blocks during coding instructs coding depth control module control code block encoding.
(4) do the early-stage preparations that T1 encodes.Code block scanning sequency by the JPEG2000 standard scans all code blocks, arranges all code blocks according to scanning sequency, prepares the T1 coding of code block.
Two. the degree of depth control thresholding d of current code block is set
b=0, be used for representing that current code block does not satisfy the coding depth of required code stream length.
The coding depth control thresholding d that introduces in the inventive method, its effect is the coding depth that control increases, and is made as 0 at this degree of depth control thresholding with current code block.
Three. carry out the T1 coding of current code block and carry out code stream and add up.
When coding code block b, the high channel that this code block of at first encoding had not been encoded, with gained code stream, this coding pass
With
Put into memory, according to
Calculate the accumulative total code stream, and compare, wherein with the distribution code check of code block
Be the encoding code stream length of k coding pass of current code block,
It is the distortion reduction amount of k coding pass of current code block; B is the current code block number of image, and k is the current sign indicating number port number of current code block.
Four. self-adaption code rate control.
The encoding code stream and the code block allocated code code check that add up are compared, adjust coding depth control thresholding, the coding of controlling each code block according to thresholding ends, and exports the encoding code stream of the code block of having encoded.
(1) coding depth of judging current code block is controlled thresholding d
bWhether be 1,
If d
bBe not 1, then carry out (2),
If d
b=1, then carry out (3);
(2) the encoding code stream R that adds up of judgement code block
bWhether greater than the encoder bit rate C of code block
b,
If R
b≤ C
b, current code block is carried out T1 coding, the encoding code stream of the high channel of exporting that current code block do not encoded also adds up,
If R
bC
b, coding depth control thresholding d is set
b Be 1, current code block is carried out T1 coding, the encoding code stream of the high channel of exporting that current code block do not encoded also adds up;
(3) judge whether encoded finishing of all code blocks,
If all code block codings finish, then export the encoding code stream of all code blocks and be optimized intercepting, if coding does not finish, then carry out (4);
(4), prepare the T1 coding of next code block, and the initial code degree of depth control thresholding d of current code block is set by the T1 of current code block coding
b=0.
Five optimize intercepting.
According to obtaining
With
In the coding pass of having encoded, by rate-distortion optimization intercept point algorithm reject successively each code block singular point, calculate the rate-distortion slope between the neighboring candidate intercept point in each code block, search optimum intercept point, finish the code stream intercepting;
Six code stream tissues are also exported final code stream.
Code stream by the JPEG2000 standard is organized algorithm, finishes code stream tissue and packing, exports final encoding code stream, realizes image compression.
Effect of the present invention can further specify by Fig. 5~7:
From Fig. 5 as seen, the present invention is under low code check, and mean P SNR difference is minimum to be 0.213dB, and along with the increase of code check, the present invention is substantially equal to the performance of PCRD standard method, and visible image quality loss of the present invention is considerably less.
From Fig. 6 as seen, along with the increase of compression multiple, amount of calculation of the present invention has significantly reduction, and especially under 0.125bpp, the average computation amount slip of four width of cloth images is 77.6%.
From Fig. 7 as seen, along with the increase of compression multiple, memory space of the present invention has significantly reduction, especially under 0.125bpp, the average memory space slip of four width of cloth images is 92.6%, and the rate distortion control structure that adopts the present invention to propose can be reduced to original 7.4% on storage resources.
As seen under different code checks, the present invention has all significantly reduced amount of calculation and memory space.Therefore the present invention improved the efficient of encoder, and algorithm complex of the present invention is low keeping having reduced amount of calculation and the memory space of EBCOT effectively under the image quality loss prerequisite seldom, is easy to hardware and realizes.
Specify:
Introduced coding depth control thresholding d in the inventive method, its effect is the coding depth that control increases, the thresholding of d is made as 1 in said method, the code check of compressed bit stream that is code block b gained is greater than target bit rate, and coding depth control module notice T1 encoder increases a coding pass again and encodes.The effect of introducing coding depth control thresholding is the range of choice that enlarges final code stream, thereby reduces indivedual rate-distortion slopes greater than the coding pass of the final λ influence intercepting effect that is not encoded as far as possible.Certainly the threshold value of coding depth control thresholding d is big more, and the quality and the canonical algorithm of the recovery image of the inventive method are close more, but take all factors into consideration, and it is 1 that the present invention selects the threshold value of d.