Joint optimization method for rate-distortion based jpeg quantization table and clipping position
By jointly optimizing the JPEG quantization table and truncation position, the problem of improving coding efficiency in the existing technology is solved, and a more efficient image compression effect is achieved.
Patent Information
- Application Number
- CN202411772336.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2044-12-04
AI Technical Summary
The existing technology ignores the joint optimization of the quantization table and the truncation position in JPEG compression, which makes it difficult to improve the coding efficiency and find the optimal quantization table and truncation position.
A rate-distortion based method is used to jointly optimize the quantization table and truncation position of JPEG. A multi-objective optimization method is used to optimize the quantization table and truncation position respectively. A fitness evaluation method is designed to find the optimal quantization table and truncation position.
It effectively improves the JPEG encoding efficiency, reduces the redundant information of image data, and improves the encoding effect.
Smart Images

Figure CN119629357B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of JPEG encoding optimization, and specifically relates to a joint optimization method for a JPEG quantization table and a truncation position based on rate distortion. BACKGROUND
[0002] The JPEG standard provides an effective image compression method, so that a high-resolution image file can be compressed to a smaller size, facilitating storage and transmission, and plays an important role in multimedia fields, such as web pages, video conferencing, streaming media and the like. The JPEG technology plays an important role in the field of image storage and transmission due to its high compression performance, wide applicability and flexibility.
[0003] At present, in the JPEG compression, the solving and optimization of the quantization table have been widely studied and have been a research hotspot. With the explosive growth of digital images and video content, higher requirements are put forward for the storage and transmission efficiency of image data. As a widely used image compression standard, one of the cores of JPEG is to compress the image by using the DCT transform. After the DCT transform, the energy of the image is mainly concentrated in the low-frequency part, i.e. the upper left corner area of the DCT coefficient, so that different quantization tables and different DCT coefficient truncation positions can obtain compression images with different code rates.
[0004] The prior art (invention patent application with publication number CN114095727B) discloses a JPEG image encoding optimization method based on evolutionary calculation. The technical scheme is: from the perspective of evolutionary calculation, the quantization table of JPEG is optimized, the multi-functional image encoding optimization technology based on multi-objective optimization is researched for the code rate multi-functional requirement in image encoding, the multi-objective modeling of the image encoding problem is performed, the evolutionary operator and the environment selection strategy conforming to the rate distortion optimal principle are designed, and the optimal quantization table can be effectively found. The above scheme ignores the joint optimization of the use of the quantization table and the truncation position to improve the encoding efficiency, and it is difficult to find the optimal quantization table and the truncation position, and it is difficult to bring the improvement of the encoding efficiency.
[0005] Therefore, the application provides a joint optimization method for a JPEG quantization table and a truncation position based on rate distortion to solve the above problems. SUMMARY
[0006] The present application aims to solve at least one of the technical problems existing in the prior art; for this purpose, the present application proposes a rate-distortion-based joint optimization method for JPEG quantization table and truncation position, which is used to solve the technical problems that the joint optimization of using quantization table and truncation position is ignored to improve the coding efficiency in the JPEG compression scheme, and it is difficult to find the optimal quantization table and truncation position. From the perspective of evolutionary calculation combined with the JPEG compression method, the present application jointly optimizes the quantization table and the truncation position of JPEG, respectively optimizes the quantization table while fixing the truncation position, optimizes the truncation position while keeping the quantization table unchanged, designs an evaluation method for fitness evaluation, and based on the rate-distortion optimization method, the optimal quantization table and truncation position can be effectively found. The above problems are solved by optimizing the corresponding truncation position while generating multiple sets of quantization tables in the optimization process.
[0007] To achieve the above-mentioned purpose, the first aspect of the present application provides a rate-distortion-based joint optimization method for JPEG quantization table and truncation position, comprising:
[0008] The image is converted into YCbCr mode, and the Y, Cb and Cr three components are independently processed to obtain a discrete cosine block; the discrete cosine block is subjected to partial coefficient truncation and quantization processing, and an encoding operation is performed; wherein Y is a luminance component, and Cb and Cr are two chrominance components, and the partial coefficients include DCT coefficients;
[0009] In the DCT coefficient truncation and quantization process, different truncation positions and different quantization tables are selected to obtain different compressed images of code streams, and a multi-objective optimization method is used to solve the optimal truncation position and quantization table, and the process includes:
[0010] Step one: the default quantization table and the default truncation position combination are initialized as an individual, so as to optimize the MSE and code rate of the default quantization table and the default truncation position;
[0011] Step two: the truncation position is fixed and unchanged, and the quantization table updating strategy based on rate-distortion optimization is used; the obtained code rate and MSE are evaluated, and the obtained code rate and MSE are selected;
[0012] Step three: the quantization table is fixed and unchanged, and the truncation position updating strategy based on rate-distortion optimization is used; the obtained code rate and MSE are evaluated, and the obtained code rate and MSE are selected.
[0013] Preferably, the encoding operation comprises:
[0014] The quantized and truncated discrete cosine block is obtained by Z-type scanning to obtain a one-dimensional symbol string, and the one-dimensional symbol string is run-length encoded to obtain a final binary code stream, and the encoding process is completed.
[0015] Preferably, the three components Y, Cb and Cr are independently processed, including:
[0016] The image is divided into several 8x8 image blocks in left-to-right order, and each image block is subjected to DCT transformation, DCT coefficient position truncation, quantization and encoding; wherein the 8x8 image block is subjected to DCT transformation to obtain a discrete cosine block, and then the discrete cosine block is subjected to quantization processing, after quantization, the set position in the block is selected, and all quantization coefficients after the set position are set to zero, and information is selected by means of quantization division, coefficient zero truncation; the set position is obtained by experience.
[0017] Preferably, the default quantization table and the default truncation position combination are initialized as an individual, including:
[0018] The scale of the combination of the quantization table and the DCT coefficient truncation position is marked as pop, the maximum number of iterations is marked as maxgen, the initial number of iterations gen=0, the initial quantization table is set by using the default quantization table with different values of the quality factor QF to obtain different quantization tables;
[0019] The truncation position of the initial DCT coefficient is selected by using a random function in the range of 2-64 to obtain different quantization tables and truncation positions; the target of the problem optimization is defined as MSE and code rate, the default quantization table and the truncation position of the DCT coefficient are decision variables, and then the min function is used to optimize the MSE and the code rate; wherein the size of pop is the scale of the quantization table plus the number of 8x8 image blocks into which the image is divided.
[0020] Wherein, the code rate and The first-order entropy of the quantization coefficient is estimated by formula (6) and formula (7):
[0021] (6);
[0022] Wherein, represents the number of 8x8 image blocks in the original image, represents the coefficient value distribution range of the quantization index i, , is the number of frequency bands whose upper value is .
[0023] (7);
[0024] Wherein, represents the code rate saved when the truncation position of the i-th 8x8 block is , represents the position in the block DCT coefficients the number of.
[0025] Preferably, the step of obtaining the MSE and the code rate comprises:
[0026] quantizing the image, the quantization process of the image being:
[0027] (3);
[0028] wherein, is the frequency band coordinate, is the discrete cosine coefficient value located at the frequency band , and and are the quantization step and the quantized index located at the frequency band, respectively, and the quantization process is shown in equation (3);
[0029] the reconstruction process of the inverse quantization being:
[0030] (4);
[0031] the corresponding quantization error is estimated by equation (3) and equation (4):
[0032] (5).
[0033] Preferably, the quantization table updating strategy based on rate-distortion optimization and the truncation position updating strategy based on rate-distortion optimization comprise:
[0034] obtaining a rate-distortion metric criterion, and the updating of the quantization table and the truncation position evolves along the direction of the largest rate-distortion performance improvement according to the rate-distortion metric criterion: first, a random number k is generated, if k is less than 0.2, the individuals are subjected to crossover operation; if k is greater than 0.2, the individuals are subjected to mutation operation, the new quantization table and the truncation position with a size of pop generated by crossover and mutation become the child population, and the child population and the parent population are combined to obtain a new population.
[0035] Preferably, the obtaining of the rate-distortion metric criterion comprises:
[0036] (9);
[0037] (10);
[0038] wherein, and respectively represent the changes of the MSE and the code rate when the quantization step of the frequency band position in the quantization table changes, and respectively represent the changes of the MSE and the code rate caused by the change of the truncation position.
[0039] Preferably, the obtained code rate and MSE are evaluated, comprising:
[0040] The MSE and code rate of the new population are calculated based on formula (4) and formula (7), and the code rate and MSE can be used to judge how the image quality obtained by the current optimization parameter is; wherein the code rate and MSE are two mutually contradictory evaluation indexes, that is, the smaller the code rate is, the better, and the smaller the MSE is, the better.
[0041] Preferably, the obtained code rate and MSE are evaluated, comprising:
[0042] The obtained code rate and MSE are sorted according to the non-dominated sorting method, and a sorted solution with multiple front faces is obtained, the number of individuals on the first front face num is counted, and whether the number of individuals num is less than 50 is judged; if yes, the individuals on the first front face are directly entered into the next generation; if no, environmental selection is performed, and a scaling method of adding one and subtracting one to the truncation position value of the existing solution is randomly selected to obtain a new solution.
[0043] It should be noted that the scaling method of adding one and subtracting one to the truncation position value of the existing solution is randomly selected to obtain a new solution in order to enrich the diversity and uniformity of the solution space.
[0044] Compared with the prior art, the present application has the following beneficial effects:
[0045] 1. The present application combines the JPEG compression method from the perspective of evolutionary calculation to jointly optimize the quantization table and the truncation position of JPEG, the optimization of the quantization table aims at the optimal MSE under multiple code rates in image coding, the optimization of the truncation position can further optimize the coding effect of image coding on the basis of the optimized quantization table, a multi-objective optimization problem is established by jointly optimizing the quantization table and the truncation position, a population composed of the initial quantization table and the truncation position is initialized, the fixed truncation position is used when optimizing the quantization table, and the quantization table is unchanged when optimizing the truncation position, an evaluation method of fitness evaluation is designed, and the rate distortion optimization method can effectively find the optimal quantization table and the optimal truncation position, multiple sets of quantization tables are generated in the optimization process, and the corresponding truncation positions are optimized, which can more effectively compress image data, reduce redundant information, and improve coding efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0047] Fig. 1 Optimized flow chart for the present application;
[0048] Fig. 2 Optimized flow chart for the present application; DETAILED DESCRIPTION
[0049] The technical solutions of the present application will be described clearly and completely in connection with the embodiments. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.
[0050] Please refer to Figs. 1-2 The first aspect of the present application provides a joint optimization method of JPEG quantization table and truncation position based on rate distortion, which comprises:
[0051] The image is converted into YCbCr mode, and the three components of Y, Cb and Cr are independently processed to obtain a discrete cosine block. The discrete cosine block is subjected to partial coefficient truncation and quantization processing, and an encoding operation is performed. Y is a luminance component, and Cb and Cr are two chrominance components. The partial coefficients include DCT coefficients. In the DCT coefficient truncation and quantization process, different truncation positions and different quantization tables are selected to obtain compressed images with different code streams. A multi-objective optimization method is used to solve the optimal truncation position and quantization table. The process comprises:
[0052] Step one: the default quantization table and the default truncation position combination are initialized as an individual, so as to optimize the MSE and code rate of the default quantization table and the default truncation position.
[0053] Step two: the truncation position is fixed and unchanged, and the quantization table updating strategy based on rate distortion optimization is used. The obtained code rate and MSE are evaluated, and the obtained code rate and MSE are selected.
[0054] Step three: the quantization table is fixed and unchanged, and the truncation position updating strategy based on rate distortion optimization is used. The obtained code rate and MSE are evaluated, and the obtained code rate and MSE are selected.
[0055] It should be noted that the discrete cosine transform is an orthogonal orthogonal transform, so the error energy in the spatial domain and the error energy in the frequency domain remain unchanged. The energy error in the frequency domain is used to calculate the quantization error in the spatial domain. Since the discrete cosine block contains 64 frequency bands, and the entire image contains a plurality of 8x8 image blocks, the MSE and code rate of the compressed image can be accumulated by the MSE and code rate of each frequency band.
[0056] It should be noted that the JPEG image encoding optimization method is mainly divided into the following categories:
[0057] The first type: quantization table optimization based on rate-distortion optimization. Image compression can be regarded as a resource allocation problem, which is represented as how to obtain the minimum distortion within the code rate constraint, using a strategy to explore the optimal quantization table according to the code rate and distortion model. The solution problem of 64 quantization steps in the quantization table can also be converted into a 64-stage dynamic programming problem, and the dynamic programming method is used for solving.
[0058] The second type: quantization table optimization based on human visual characteristics. The design of the default quantization table of JPEG is based on the principle that the human eye is more sensitive to low-frequency signals than high-frequency signals, but the specific sensitivity degree only depends on the empirical value. With the deeper understanding of the visual system, some new visual models are used in the design of the quantization table. A new subjective quantization table is designed from a uniform quantizer combined with human visual characteristics, and better subjective quality is obtained. The structural similarity index is also proposed as a distortion criterion to generate a global quantization table, and a JND model is designed as a quality measurement standard.
[0059] The third type: quantization table optimization based on heuristic algorithm. Whether it is a search strategy or a dynamic programming method, it is difficult to guarantee that the quantization table can reach the global optimal solution. To solve this problem, some heuristic algorithms are used in the optimization process of the JPEG quantization table, including genetic algorithm, differential evolution algorithm, etc. These methods usually convert code rate and distortion into a single target, which has high complexity and poor flexibility.
[0060] In this application, the three components of Y, Cb and Cr are processed independently, including:
[0061] The image is divided into several 8x8 image blocks in the order from left to right, and DCT transformation, DCT coefficient position truncation, quantization and encoding are performed on each image block. Among them, the 8x8 image block is transformed into a discrete cosine block after DCT transformation, and then the discrete cosine block is quantized. After quantization, the set position in the block is selected, and all quantization coefficients after the set position are set to zero. The information is selected by means of quantization division and truncation coefficient zero. The set position is obtained by experience.
[0062] It should be noted that the standard JPEG encoder workflow includes the following steps:
[0063] A1: Convert the original image to YCbCr color space, in which Y represents the luminance component, Cr and Cb represent the chrominance component and saturation component respectively, and the three components are processed independently.
[0064] A2: Taking the Y channel as an example, the Y channel is divided into 8x8 image blocks from left to right and from top to bottom, and then each block is subjected to DCT transformation, DCT coefficient position truncation, quantization and encoding; wherein the 8x8 image block is subjected to DCT transformation to obtain a discrete cosine block, and then the discrete cosine block is subjected to quantization processing, and after quantization, a certain suitable position in the block is selected, and all quantization coefficients after the position are set to zero to obtain quantized and truncated data, the quantized data is read out in a zigzag shape, and the read-out data is divided into a direct current coefficient DC and an alternating current coefficient AC, the direct current coefficient DC is encoded by using differential pulse modulation coding DPCM, and the alternating current coefficient AC is encoded by using run length coding RLE;
[0065] A3: The intermediate format of the obtained direct current coefficient DC and alternating current coefficient AC is subjected to entropy encoding processing, and finally a binary data stream is obtained, so as to complete the JPEG image encoding process.
[0066] In the present application, the default quantization table and the default truncation position combination are initialized as an individual, including:
[0067] The scale of the combination of the quantization table and the DCT coefficient truncation position is marked as pop, the maximum number of iterations is marked as maxgen, the initial number of iterations is gen=0, and the initial quantization table is set by using the default quantization table to set different values through a quality factor QF to obtain different quantization tables;
[0068] The truncation position of the initial DCT coefficient is selected by using a random function in the range of 2-64 to obtain different quantization tables and truncation positions; the target of the problem optimization is defined as MSE and code rate, the default quantization table and the truncation position of the DCT coefficient are decision variables, and then the min function is used to optimize the MSE and the code rate; wherein the size of pop is the scale of the quantization table plus the number of 8x8 image blocks into which the image is divided;
[0069] wherein the code rate and The first-order entropy of the quantization coefficient is estimated by using formula (6) and formula (7):
[0070] (6);
[0071] wherein, represents the number of 8x8 image blocks in the original image, represents the coefficient value distribution range of the quantization index i, , is the number of frequency bands with the upper value of ;
[0072] (7);
[0073] wherein, denotes the truncated position of the 8x8 sub-block, the saved code rate, denotes the number of DCT coefficients at the position within the block.
[0074] It should be noted that in the process of quantization and DCT coefficient truncation, different quantization tables and different DCT coefficient truncation positions can obtain compressed images with different code rates, and the method of optimizing the quantization table and the coefficient truncation position by using the multi-objective optimization method includes the following steps:
[0075] S1: initializing the default quantization table and the DCT coefficient truncation position:
[0076] The scale of the combination of the quantization table and the DCT coefficient truncation position is denoted as pop, the maximum number of iterations is denoted as maxgen, the initial number of iterations gen=0, the initial quantization table is set by using the default quantization table to set different values through the quality factor QF to obtain different quantization tables; the initial DCT coefficient truncation position is selected by using a random function to select a value in the range of 2-64, and the scale pop is the size of the quantization table plus the number of 8x8 image blocks into which the image is divided; the default quantization table is:
[0077] (1);
[0078] The optimization target of the problem is defined as the MSE and the code rate, the default quantization table and the DCT coefficient are the decision variables, then the MSE and the code rate are optimized by using the function, and the specific process is as follows:
[0079] (2);
[0080] wherein, is the default quantization table, is the default truncation position, and are the MSE and the code rate when the default quantization table and the DCT coefficient truncation position are and respectively.
[0081] S2: in the specific implementation process, in order to avoid the complex encoding and decoding process, the estimated method is used to obtain the MSE and the code rate, and the specific process includes the following steps:
[0082] S21: quantizing the image, the quantization process of the image is as follows:
[0083] (3);
[0084] wherein, is the frequency band coordinate, is the discrete cosine coefficient value located at the frequency band , and are the quantization step and the quantized index respectively located at the frequency band ,
[0085] (4);
[0086] The corresponding quantization error can be estimated by formula (3) and formula (4):
[0087] (5);
[0088] S22: code rate The first-order entropy of the quantization coefficient is estimated by formula:
[0089] (6);
[0090] wherein, represents the number of 8x8 image blocks in the original image, represents the coefficient value distribution range of the quantized index , , is the number of frequency bands whose values are ;
[0091] S23: Further, on the basis of optimizing the quantization table, the optimization of the truncation position is introduced. When the truncation position is optimized, the estimation of the two target code rates and distortions before and after the truncation changes. The truncated DCT coefficient will cause the estimation of the two target code rates and distortions before and after the truncation to change. When the truncation positions of each 8x8 block are different, the estimation of the code rate saving brought by each block of each picture:
[0092] (7);
[0093] wherein, represents the code rate saved when the truncation position of the i-th 8x8 sub-block is , represents the number of DCT coefficients at the position in the block;
[0094] S24: In the implementation process, since the discrete cosine transform is an orthogonal regular transform, the error energy in the spatial domain and the error energy in the frequency domain remain unchanged, we can directly use the energy error in the frequency domain to calculate the quantization error in the spatial domain; since the discrete cosine block contains 64 frequency bands, and the entire image contains several 8x8 image blocks, the MSE and code rate of the compressed image can be accumulated by the MSE and code rate of each frequency band, that is:
[0095] (8);
[0096] wherein, and can be solved by the method defined in formula (4), and the code rate can be estimated by formula (6), can be estimated by formula (7);
[0097] S25: The frequency band with the largest rate-distortion performance improvement is obtained: define a slope to measure the change gradient of a specific frequency band, as shown in formula (9):
[0098] (9); (10);
[0099] wherein, and respectively represent the changes of MSE and code rate when the quantization step length of the frequency band position in the quantization table changes, and respectively represent the changes of MSE and code rate caused by the change of the truncation position;
[0100] S26: When the DCT coefficient truncation position is fixed, with the rate-distortion metric criterion, the update of the quantization table evolves in the direction of the largest rate-distortion performance improvement: first generate a random number k, if k is less than 0.2 individual, cross operation is performed, specifically, there are two individual quantization table parts and , take for example, for the 64 quantization parts, calculate the rate-distortion metric criterion from to , then sort them, find the largest number of positions, and update the corresponding quantization step length in to the value in the corresponding position of ; also cross according to the same method;
[0101] In the process of fixing the optimized quantization table, in the cross variation process, for two individual DCT coefficient truncation position parts and , take For all 8x8 image block quantity of truncation position, the truncation position from Update to The rate-distortion metric criterion is calculated, and then it is sorted to find the largest number of positions, and the The corresponding truncation position in the update is The value of the corresponding position in Also cross according to the same method;
[0102] S27: If k is greater than 0.2 individual mutation operation, in the fixed DCT coefficient truncation position, for the individual For all quantization steps, the possible updated values are all values except itself, and 254 values are calculated according to the rate-distortion metric criterion, and then the 254 values are sorted to find the largest number of positions, and the corresponding target quantization step value is updated;
[0103] In the fixed optimized quantization table, for the individual For all truncation positions, the possible values are all values except itself, and 62 values are calculated according to the rate-distortion metric criterion, and then the 62 values are sorted to find the largest number of positions, and the corresponding truncation position is updated;
[0104] S28: Cross mutation produces new combination of equal size of quantization table and truncation position individual, called sub-population, and the sub-population and parent population are combined to get new population.
[0105] S3: Fitness evaluation:
[0106] According to the formula (4), formula (6) and formula (7) in the initialization step, the MSE and code rate of the new population can be calculated, and the code rate and MSE can be used to judge how the image quality obtained by the current optimization parameter is, and the code rate and MSE are two contradictory evaluation indexes, that is, the smaller the code rate is, the better, and the smaller the MSE is, the better.
[0107] S4: Environmental selection:
[0108] According to the fitness value obtained by the non-dominated sorting method, the sorted quantization table with multiple front faces is obtained, and the number of individuals on the first front face num is counted, if num is less than 50, the individuals on the first front face are directly entered into the next generation, otherwise environmental selection is performed, in order to enrich the diversity and uniformity of the solution space, the existing solution is randomly selected to obtain new solution by scaling method of adding one and subtracting one of the truncation position value.
[0109] S41: All individuals in the new solution are used as the iteration of the gen+1 time, and steps S2, S3 and S4 are repeatedly executed until the maximum iteration number.
[0110] S42: select all individuals in the first front face from the solution obtained from the last iteration, that is, the optimized quantization table and the truncation position of the corresponding DCT coefficient.
[0111] Part of the data in the above formula is the numerical value obtained by removing the dimension, and the formula is obtained by software simulation of a large amount of collected data to obtain a formula closest to the real situation; the preset parameters and the preset threshold in the formula are set by the person skilled in the art according to the actual situation or obtained by a large amount of data simulation.
[0112] Working principle of the present application:
[0113] The image is converted into YCbCr mode, and the Y, Cb and Cr three components are independently processed to obtain a discrete cosine block; the discrete cosine block is subjected to partial coefficient truncation and quantization processing, the discrete cosine block after quantization and truncation processing is obtained through Z-type scanning to obtain a one-dimensional symbol string, and the one-dimensional symbol string is subjected to run-length encoding to obtain the final binary code stream, and the encoding process is completed;
[0114] In the DCT coefficient truncation and quantization process, different truncation positions and different quantization tables are selected to obtain different compressed images of code streams, and a multi-objective optimization method is used to solve the optimal truncation position and quantization table, and the process includes:
[0115] The default quantization table and the default truncation position combination are initialized as an individual, so that the MSE and the code rate of the default quantization table and the default truncation position are optimized;
[0116] The truncation position is fixed and unchanged, and the quantization table updating strategy based on rate-distortion optimization is used; the obtained code rate and MSE are evaluated, and the obtained code rate and MSE are selected.
[0117] The quantization table is fixed and unchanged, and the truncation position updating strategy based on rate-distortion optimization is used; the obtained code rate and MSE are evaluated, and the obtained code rate and MSE are selected.
[0118] The above embodiments are only used to illustrate the technical method of the present application and are not limited, although the present application has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical method of the present application can be modified or replaced equivalently without departing from the spirit and scope of the technical method of the present application.
Claims
1. A rate-distortion-based joint optimization method for JPEG quantization tables and truncation positions, characterized by: Convert the image into YCbCr mode and process the three components Y, Cb, and Cr independently to obtain discrete cosine blocks; perform partial coefficient truncation and quantization on the discrete cosine blocks and perform encoding operations; where Y is the luminance component, Cb and Cr are the two chrominance components, and some coefficients include DCT coefficients; During the DCT coefficient truncation and quantization process, different truncation positions and quantization tables are selected to obtain compressed images with different bitstreams. The optimal truncation position and quantization table are solved using a multi-objective optimization method. The process includes: Step 1: Initialize the default quantization table and default truncation position combination as an individual, so as to optimize the MSE and bit rate of the default quantization table and default truncation position; Step 2: The truncation position remains unchanged, and the quantization table update strategy based on rate-distortion optimization is adopted; the obtained bit rate and MSE are evaluated, and the obtained bit rate and MSE are selected; Step 3: The quantization table remains fixed, and the truncation position update strategy is based on rate-distortion optimization; the obtained bit rate and MSE are evaluated, and the obtained bit rate and MSE are selected.
2. The rate-distortion-based JPEG quantization table and truncation position joint optimization method according to claim 1, characterized in that: The encoding operation includes: The quantized and truncated discrete cosine block is subjected to Z-scanning to obtain a one-dimensional symbol string, which is then run-length encoded to obtain the final binary code stream, completing the encoding process.
3. The rate-distortion-based JPEG quantization table and truncation position joint optimization method according to claim 1, characterized in that: The independent processing of the three components Y, Cb and Cr includes: The image is divided into several 8x8 image blocks from left to right, and each image block is subjected to DCT transformation, DCT coefficient position truncation, quantization and encoding. Among them, the 8x8 image block is transformed into a discrete cosine block through DCT transformation, and then the discrete cosine block is quantized. After quantization, a set position is selected within the block, and all quantization coefficients after the set position are set to zero. Information is selected by rounding up the quantization division and truncating the coefficients to zero.
4. The rate-distortion-based JPEG quantization table and truncation position joint optimization method according to claim 1, wherein: Initializing the default quantization table and the default truncation position combination as an individual includes: The size of the combination of the quantization table and the DCT coefficient truncation position is recorded as pop, the maximum number of iterations is marked as maxgen, the initial number of iterations gen=0, and the initial quantization table is set with the default quantization table and different values of the quality factor QF are set to obtain different quantization tables; The truncation position of the initial DCT coefficients is randomly selected from a range of 2-64, resulting in different quantization tables and truncation positions. The optimization objectives are defined as MSE and bit rate. The default quantization table and DCT coefficient truncation position are used as decision variables, and the MSE and bit rate are optimized using the min function. The size of pop is the size of the quantization table plus the number of 8x8 blocks into which the image is divided. Among them, the bit rate and The first-order entropy of the quantization coefficient is estimated using formula (6) and formula (7): (6); in, Represents the number of 8x8 image blocks in the original image, represents the coefficient value distribution range of the quantization index i, , Frequency band The upvalue is the number of (7); in, Indicates the The truncation position of the 8x8 block is The bit rate saved when Indicates the position within the block DCT coefficients The number of 5. The rate-distortion-based JPEG quantization table and truncation position joint optimization method according to claim 4, characterized in that: The steps of obtaining the MSE and bit rate include: Quantize the image. The image quantization process is: (3); in, is the frequency band coordinate, In the frequency band The discrete cosine coefficient value at , and are the quantization step size and the quantized index under the frequency band respectively. The quantization process is shown in formula (3); The reconstruction process of inverse quantization is: (4); The corresponding quantization error is estimated by formula (3) and formula (4): (5)。 6. The rate-distortion-based JPEG quantization table and truncation position joint optimization method according to claim 1, characterized in that: The quantization table update strategy based on rate-distortion optimization and the truncation position update strategy based on rate-distortion optimization include: A rate-distortion metric is obtained, and the quantization table and truncation position are updated according to the rate-distortion metric in the direction of maximum rate-distortion performance improvement: first, a random number k is generated. If k is less than 0.2, the individual undergoes a crossover operation; if k is greater than 0.2, the individual undergoes a mutation operation. The crossover mutation generates a new quantization table and truncation position of size pop, which becomes a subpopulation. The subpopulation is merged with the parent population to obtain a new population.
7. The rate-distortion-based JPEG quantization table and truncation position joint optimization method according to claim 6, characterized in that: The obtained rate-distortion metric includes: (9); (10); in, and They represent the changes in MSE and bit rate when the quantization step size of the frequency band position in the quantization table changes. and They represent the MSE and bit rate changes caused by the change of truncation position.
8. The rate-distortion-based JPEG quantization table and truncation position joint optimization method according to claim 5, characterized in that: The evaluating of the obtained bit rate and MSE includes: Based on formula (4) and formula (7), the MSE and bit rate of the new population are calculated. The bit rate and MSE can be used to judge the image quality obtained by the current optimization parameters. Among them, the bit rate and MSE are two contradictory evaluation indicators, that is, the smaller the bit rate, the better, and the smaller the MSE, the better.
9. The rate-distortion-based JPEG quantization table and truncation position joint optimization method according to claim 1, characterized in that: The selecting and solving the obtained bit rate and MSE includes: The obtained bit rates and MSE are sorted according to the non-dominated sorting method to obtain a sorted solution with multiple frontier surfaces. The number of individuals num on the first frontier surface is counted to determine whether the number of individuals num is less than 50. If so, the individuals on the first frontier surface are directly promoted to the next generation. If not, an environment selection is performed to randomly select an existing solution and perform a scaling method of adding and subtracting one to the truncation position value to obtain a new solution.
Citation Information
Patent Citations
An JPEG image coding optimization method based on evolutionary computation
CN114095727B
Compressive sampling-based (CS-based) video coding / decoding system and method thereof
CN102572435A
JPEG image coding optimization method based on evolutionary computation
CN114095727A