JPEG2000 bit rate control method based on picture quality and constrained code rate
Technical field
The present invention relates to bit rate control method in a kind of JPEG2000 image compression, particularly a kind of JPEG2000 bit rate control method based on picture quality and constrained code rate.
Background technology
The JPEG2000 compression algorithm just is being widely used in the image compression field at present with its superior performance.The Rate Control core is rate-distortion optimal problem in the JPEG2000 compression algorithm, when promptly reaching to constant bit rate, and the distortion minimum.Adopt PCRD-opt (Post-Compression Rate-Distortionoptimization) algorithm to carry out Rate Control in the JPEG2000 standard, the code stream of this Rate Control after to arithmetic coding is optimized layering and blocks, promptly according to constrained code rate, code stream is blocked, to satisfy the picture quality best (being the distortion minimum) after the code stream that keeps reaches compression.
Suppose a given layering interceptive value, make R
iAnd D
iPresentation code piece i blocks code check and the distortion that the back produces respectively, and the overall code check and the distortion of the image that obtains after then coding blocks are:
With
In JPEG2000, in the standard bit rate control method, only need to consider constrained code rate, promptly obtain
In time, guarantee
Minimum.
Adopt Lagrange multiplier method, the problem of Rate Control be converted into formula (a):
Fig. 1 is a cataloged procedure in the JPEG2000 standard code algorithm, and it has comprised Tier-1 coding, Rate Control and Tier-2 coding three phases.Wherein, in the Tier-1 stage, the optimum point of cut-off set H of each encoding block i will be calculated
i, the element in this set is: slope
And point of cut-off
(0≤j≤‖ H
i‖-1), λ
i(z
i) with z
iMonotone decreasing is right
Calculating as shown in Equation (2):
According to formula (a),, be converted into rate-distortion optimal problem of finding the solution each encoding block with the image optimal problem.λ for different utilizes binary chop, at set H
iIn search minimum λ greater than λ
i(z
i) corresponding point of cut-off z
i, and this blocks point set { z
iSatisfy image code rate less than the code check threshold value.
The specific implementation process of the JPEG2000 standard bit rate control method among Fig. 1 is as follows:
Step 1, initialization procedure: in initialization procedure, the rate-distortion slope λ in the initialization binary chop
MinAnd λ
MaxMake λ
Min=0, λ
Max=M, wherein M realizes different and different according to the JPEG2000 compressibility;
Step 2, refresh: in this step, make λ=(λ when antecedent-distortion slope value
Min+ λ
Max)/2;
Step 3, the current code check R of computed image: the point of cut-off z of encoding block i in the current quality layers
iλ
i(z) be set H
iDuring greater than the minimum value of λ, the current code check of computed image
Step 4, judge whether code check R satisfies code check threshold value R
ThresholdRequire: if R R
Threshold, then make λ
MinStep 5 is changeed in=λ+1; Otherwise, make λ
BestIf=λ is R=R
Threshold, whole Rate Control finishes, otherwise makes λ
Max=λ;
Step 5, Rate Control stop: if λ
Maxλ
Min, change step 2; Otherwise whole Rate Control finishes.
But about the further information list of references 1:ISO/IEC15444-1 of JPEG2000 standard bit rate control method, 2002, JPEG 2000 Image Coding System, page216-219; And list of references 2:D.Taubman and M.Marcellin, " JPEG2000:Image Compression Fundamentals, Standardsand Practice ", Kluwer Academic Publishers, Boston, MA, 2002, page 339-378.
During JPEG2000 compression single-frame images, Rate Control is when reaching given compression bit rate, the image fault minimum.Yet,, picture quality is more paid attention at aspects such as medical image, remote sensing images, videos.And, when using JPEG2000 compressed image sequence, if adopt the constant code rate compression, picture quality difference after its compression of images with different complexity, and the simple image compression bit rate is too high, not only can waste memory space and transmission bandwidth, and can influence the image sequence total quality.Therefore, the bit rate control method in the JPEG2000 canonical algorithm is not suitable for the squeeze operation that picture quality is had relatively high expectations.
Summary of the invention
The objective of the invention is when code stream is controlled, only to adopt the code stream constraint in the existing JPEG2000 compression algorithm in order to overcome, can not guarantee the defective of picture quality, thereby code stream control method a kind of JPEG2000 of meeting, the constraint of combining image qualitative restrain and code stream is provided.
To achieve these goals, the invention provides a kind of JPEG2000 bit rate control method, comprising based on picture quality and constrained code rate:
Step 10), input one two field picture are set picture quality constraint Y-PSNR PSNR
ThresholdWith constrained code rate R
Threshold
Step 20), according to the Y-PSNR PSNR that sets in the step 10)
ThresholdInitialization compressed image distortion threshold value D
Threshold, and the rate-distortion slope λ in the initialization binary chop
MinAnd λ
MaxWherein,
Described compressed image distortion threshold value D
ThresholdBy Y-PSNR PSNR
ThresholdCalculate, its computing formula is:
B represents the bit depth of simple component, N
1, N
2Be respectively the height and the width of image, C is the picture content number, described B, N
1, N
2With C all be attributes of images information, from image file, obtain;
Step 30), refresh when antecedent-distortion slope value, make λ=(λ
Min+ λ
Max)/2;
Step 40), the current code check R of computed image and distortion D, the point of cut-off z of encoding block i in the current quality layers
iRate-distortion slope λ
i(z) be set H
iIn greater than when the minimum value of antecedent-distortion slope value λ, the current code check of computed image
And distortion
Described set H
iOptimum point of cut-off set for each encoding block i;
This step comprises:
Step 41), calculate each component quadratic sum of image of each encoding block
Step 42), if encoding block i is point of cut-off z
i λThe time, calculate among each encoding block i all smaller or equal to z
i λThe distortion decrease Δ D sum of point of cut-off
Step 43), according to step 41) and step 42) result of calculation, the whole distortion factor D of computed image,
Step 50), determining step 40) in the current code check R of image that calculates whether satisfy the code check threshold value R that sets in the step 10)
ThresholdIf, R〉and R
Threshold, then make λ
Min=λ+1, execution in step 70 then); Otherwise, make λ
BestBehind=the λ, carry out next step;
Step 60), determining step 40) in the distortion D that calculates whether satisfy step 20) in the distortion threshold value D that obtains of initialization
ThresholdIf, D〉and D
Threshold, then make λ
Max=λ carries out next step; If D<D
Threshold, make λ
Min=λ+1; If D==D
Threshold, whole Rate Control finishes;
Step 70) if λ
Maxλ
Min, execution in step 30); Otherwise whole Rate Control finishes.
In the technique scheme, in described step 10), picture quality constraint Y-PSNR PSNR
ThresholdWith constrained code rate R
ThresholdBy the user according to code check and picture quality demands of applications are set.
In the technique scheme, in described step 20) in, described rate-distortion slope λ
MinAnd λ
MaxWhen initialization, λ
Min=0, λ
Max=M, wherein M is a concrete value, sets according to the realization of JPEG2000 compressibility.
Described step 41) in, described D
i sTwo kinds of computational methods are arranged, comprising:
41-1), the distortion decrease Δ D sum of all point of cut-offs of encoding block i,
41-2)、
Wherein, y
i[j] is the sampled value among the encoding block i, b
iBe encoding block i place subband,
Square norm for the comprehensive base vector of this subband.
The invention has the advantages that: the present invention can realize on JPEG2000 standard Rate Control basis, finishes Rate Control in coding, does not increase under the situation of computation complexity, has realized the Rate Control based on picture quality and constrained code rate.
Description of drawings
Fig. 1 is the entropy coding flow chart in existing JPEG2000 compression algorithm;
Fig. 2 is for adopting the entropy coding flow chart of the JPEG2000 bit rate control method based on picture quality and constrained code rate of the present invention;
Fig. 3 is the lena original image;
Fig. 4 adopts figure after the JPEG2000 bit rate control method based on picture quality and constrained code rate of the present invention carries out image compression for embodiments of the invention;
Fig. 5 is the flow chart of the JPEG2000 bit rate control method of picture quality of the present invention and constrained code rate.
Embodiment
Below in conjunction with the drawings and specific embodiments, the JPEG2000 bit rate control method based on picture quality and constrained code rate of the present invention is further described.
Compared with prior art, JPEG2000 bit rate control method based on picture quality and constrained code rate of the present invention not only meets the constrained code rate in the JPEG2000 standard Rate Control PCRD-opt method, and added the condition of picture quality constraint, under the situation that satisfies the requirement of image code rate threshold value, satisfy the requirement of picture quality threshold value.Rate Control model of the present invention is as follows:
Wherein, R represents code check, and D represents distortion, D
ThresholdExpression compressed image distortion threshold value, R
ThresholdExpression code check threshold value.
The distortion factor decrease Δ D computed image distortion value that the present invention utilizes JPEG2000 standard rate control algorithm to calculate, the distortion value of calculating compressed image in the process of coding.Bit rate control method of the present invention has improved the bit rate control method in the standard JPEG2000 compression algorithm, finishes Rate Control in coding, under the situation that does not increase computation complexity, has realized the Rate Control based on picture quality and constrained code rate.
JPEG2000 bit rate control method based on picture quality and constrained code rate of the present invention specifically may further comprise the steps:
Step 10, setting picture quality constraint PSNR
Threshold(Y-PSNR) and constrained code rate R
ThresholdIn this step, the value of picture quality constraint and constrained code rate by the user according to code check and picture quality demands of applications are set.
Step 20, according to the Y-PSNR PSNR that sets in the step 10
ThresholdInitialization compressed image distortion threshold value D
Threshold, and the rate-distortion slope λ in the initialization binary chop
MinAnd λ
Max
In this step, to compressed image distortion threshold value D
ThresholdCalculating as shown in Equation (1):
Wherein, B represents the bit depth of simple component, N
1, N
2Be respectively the height and the width of image, C is the picture content number.B, N
1, N
2With C all be attributes of images information, can from image file, obtain.
At initialization rate-distortion slope λ
MinAnd λ
MaxThe time, make λ
Min=0, λ
Max=M, wherein M realizes different and different according to the JPEG2000 compressibility.
Step 30, refresh: make λ=(λ when antecedent-distortion slope value
Min+ λ
Max)/2;
Step 40, the current code check R of computed image and distortion D, the point of cut-off z of encoding block i in the current quality layers
iRate-distortion slope λ
i(z) be set H
iIn greater than when the minimum value of antecedent-distortion slope value λ, the current code check of computed image
And distortion
Described set H
iBe the optimum point of cut-off set of each encoding block i, the element that comprised in this set and the calculating of each element are described in background technology.
Compare with existing JPEG2000 standard, the calculating to distortion D in this step is very different, and below its concrete realization is described.
In the prior art, it is that the original image and the difference of compression back each component of reconstructed image are asked quadratic sum that compressed image distortion value D is calculated, promptly as shown in Equation (2):
Wherein, N
1, N
2Be respectively the height and the width of image, C is the picture content number, I
c(i, j) and
Pixel (i, the gray value of component c j) of representing original image and compression back reconstructed image respectively.
In this mode, the image fault value is the calculating that remakes after compressed image is rebuild, and need adjust code check according to the scalability of image, and this adjustment process need be done repeatedly encoding and decoding to image.Therefore, the calculation of complex of image fault value, the time of Rate Control is long, is unfavorable for the real-time processing of image.Fig. 1 is the associative operation process in the JPEG2000 canonical algorithm, in the Tier-1 of JPEG2000 system cataloged procedure, calculate all of current scan channel of each encoding block i and blocked the distortion decrease Δ D that bring to reconstructed image the back, and to calculate the code word number of present encoding passage behind the arithmetic encoder coding be Δ R.Therefore, in Tier-2 stage Rate Control process, the phase points of known each encoding block
, then can obtain the whole distortion factor of image.
And in the present invention, be to realize in the cataloged procedure to the distortion computation of compressed image, do not need to obtain image fault according to original image and reconstructed image.As shown in Figure 2, the concrete steps of calculated distortion value D comprise: step 41, in the Tier-1 stage shown in Figure 2, calculate each component quadratic sum of image of each encoding block
Following two kinds of computational methods are arranged, when concrete calculating, as long as adopt wherein a kind of.
The distortion decrease of A, all point of cut-offs of encoding block i (Δ D) sum,
Distortion decrease Δ D utilizes the PCRD-opt algorithm in the existing JPEG2000 standard to obtain.
B、
Y wherein
i[j] is the sampled value among the encoding block i, b
iBe encoding block i place subband,
Square norm for the comprehensive base vector of this subband.Right
Calculating specifically can be referring to list of references 3:D.Taubman and M.Marcellin, " JPEG2000:Image Compression Fundamentals, Standards and Practice ", Kluwer Academic Publishers, Boston, MA, 2002, page339-378.
Step 42, when Rate Control, if encoding block i is point of cut-off z
i λThe time, calculate among each encoding block i all smaller or equal to z
i λDistortion decrease (Δ D) sum of point of cut-off
Its computational process is as shown in Equation (3):
Step 43, according to the result of calculation of step 41 and step 42, the whole distortion factor D of computed image, it calculates as shown in Equation (4):
Whether the current code check R of the image that calculates in step 50, the determining step 40 satisfies code check threshold value R
ThresholdIf requirement is R〉R
Threshold, then make λ
Min=λ+1, execution in step 70 then; Otherwise, make λ
BestBehind=the λ, carry out next step;
Whether the distortion D that calculates in step 60, the determining step 40 satisfies distortion threshold value D
ThresholdIf requirement is D〉D
Threshold, then make λ
Max=λ carries out next step; If D<D
Threshold, make λ
Min=λ+1; If D==D
Threshold, whole Rate Control finishes;
If step 70 λ
Maxλ
Min, execution in step 30; Otherwise whole Rate Control finishes.
Whole bit rate control method can obtain the value that optimum blocks slope, compression back code check and compression back distortion at last, finishes the packing that meets JPEG2000 code stream call format in the Tier-2 of Fig. 2 process, obtains the JPEG2000 compressed bit stream.
Be example with the lena image compression below, illustrate and adopt bit rate control method of the present invention that the lena image as shown in Figure 3.Lena image size is 512*512, and every pixel is 24 bits, adopts 9/7 wavelet transformation, and other parameters adopt JPEG2000 coding default parameters.
In step 10, set picture quality constraint PSNR
Threshold=40dB and constrained code rate R
Threshold=2bpp (bpp, the every pixel of bit).According to the correlation formula in the step 20, utilize PSNR
ThresholdObtain D
Threshold=5113774.08, initialization rate-distortion slope λ then
Min=0 and λ
Max=65535.In step 30, refresh when antecedent-distortion slope value, obtain λ=(λ
Min+ λ
Max)/2=32768.In step 40, according to current code check R=2.01422119140625 of formula computed image and distortion D=391296.0.The current code check R of the image that calculates in step 40 (2.01422119140625) is greater than code check threshold value R
Threshold(2), therefore make λ
Min=λ+1=32769, execution in step 70 then.In step 70, because λ
Maxλ
MinSo, turn to step 30 to carry out.After carrying out some these circulations, can obtain following result:
Optimum blocks slope: λ
Best=51461;
Compression back code check is: 0.459686bpp;
Compression artefacts is: 5076288.0; Being equivalent to PSNR is: 40.0320dB.
The compressed bit stream that obtains behind the Tier-2 coding is rebuild the back image as shown in Figure 4, compares indifference visually with original image.