1. Field of the Invention
The invention relates to a data processing field, in particular to an AVS video compression encoding method and encoder.
2. Description of the Related Art
New generation of Audio Video Coding Standard (AVS) has been widely used. The AVS provides fixed quantization matrices. The frequency bands of the quantization matrices are divided as shown in
In view of the above described problems, the invention provides an AVS video compression encoding method and encoder to effectively reduce the code rate while guarantee quality of video encoding.
According to the first aspect of the invention, the invention provides an AVS video compression encoding method comprising:
According to the second aspect of the invention, the invention provides an AVS video encoder comprising:
The invention has the following advantageous effects:
The invention provides an AVS video compression encoding method and encoder which mainly adjusts the initial weighted quantization coefficient of every frequency band in a quantization matrix by using the average luminance value of an image to be encoded and average transformation coefficient of every frequency band obtained by calculation to obtain a final weighted quantization coefficient for quantization so as to be able to perform different step-size quantization on transformation coefficients of different frequency points obtained by transformation by using a quantization matrix constituted by final weighted quantization coefficients. Therefore, the process of quantization can fully take attributes of an image to be encoded into account, self-adaptively adjust weighted quantization coefficients in a quantization matrix and effectively lower the code rate while guaranteeing video encoding quality.
The invention is further explained in detail by embodiments and figures as below.
An AVS video compression encoding method in the embodiment mainly comprises: firstly, making an intra-frame or inter-frame prediction about an image to be encoded to obtain residual blocks; and secondly, obtaining the code rate by transformation and quantization of residual blocks and entropy encoding; in which, final weighted quantization coefficients in the embodiment are mainly used during the quantization process and final weighted quantization coefficients are obtained as shown in
Step 201: an image to be encoded is obtained.
Step 202: the average luminance value of the image to be encoded is calculated by the pixel luminance value of every pixel in the image to be encoded. In particular, the Step 202 can comprise steps shown in
Step 301: the image luminance value L of the image to be encoded is calculated by the pixel luminance value l(m) of every pixel in the image to be encoded, in which, the image to be encoded comprises M pixels, m∈{1, 2, . . . , M}. Then, the image luminance value of the image to be encoded can be calculated by the following Formula (1):
L=Σ
m=1
M
l(m) (1).
Step 302: the average luminance value
Step 203: an attribute component is extracted from the image to be encoded, the attribute component is divided into a plurality of attribute blocks, the transformation coefficient of every frequency point in the attribute block is obtained by transformation of the attribute block, and a first average transformation coefficient of every frequency point in all attribute blocks to which the frequency point belongs is calculated by the transformation coefficient of the frequency point; and a second average transformation coefficient of the frequency band is calculated by the first average transformation coefficients of all frequency points in the frequency band on the basis of initial frequency band division in the quantization matrix. In particular, a luminance component can be extracted from the image to be encoded; the luminance component is divided into a plurality of luminance blocks; the luminance transformation coefficient of each frequency point in the luminance block is obtained by transformation of the luminance block; the average luminance transformation coefficient of every frequency point in all luminance blocks to which the frequency point belongs is calculated as a first average transformation coefficient by the luminance transformation coefficient of the frequency point; the Discrete Cosine Transform (DCT), approximate DCT or orthogonal transformation can be used for transformation; and the luminance transformation coefficient of each frequency point can be represented as Cy(k,i,j), in which, the luminance component of the image to be encoded is divided into K luminance blocks, k∈{1, 2, . . . , K}; K is a positive integer; the size of a luminance block generally is a specification of 8×8 pixels; i and j represent the location of a frequency point in the luminance block; and then, the average luminance transformation coefficient
The second average transformation coefficient C(q) of the frequency band can be calculated by the following Formula (5):
C(q)=Σ(i,j)∈S(q)
in which, S(q) represents the frequency point contained in the qth frequency band.
Step 204: a final weighted quantization coefficient is obtained by using the average luminance value of the image to be encoded and the second average transformation coefficient of every frequency band to correspondingly adjust the initial weighted quantization coefficient of every frequency band in the quantization matrix. In particular, the initial frequency band division of the quantization matrix is to divide the whole frequency domain into 6 frequency bands whose initial weighted quantization coefficients are {w1, w2, w3, w4, w5, w6}, in which, wq is the initial weighted quantization coefficient of the qth frequency band, q∈{1, 2, 3, 4, 5, 6}, w1<w5<w4<w3<w6<w2. As shown in
WB(q)=wq×
After the final weighted quantization coefficient is obtained, the code rate can finally be obtained by the intra-frame or inter-frame prediction or transformation and the quantization and entropy encoding of the final weighted quantization coefficient.
Accordingly, an AVS video encoder in the embodiment can comprise a structure as shown in
The division module 503 is used for extracting an attribute component from the image to be encoded and dividing the attribute component into a plurality of attribute blocks;
The attribute component is a luminance component; and the attribute block is a luminance block. The transformation module 504 can be used for transforming a luminance block to obtain the luminance transformation coefficient of each frequency point in the luminance block. The average transformation coefficient calculation module 505 can be used for calculating the average luminance transformation coefficient of every frequency point in all luminance blocks to which the frequency point belongs as a first average transformation coefficient by the luminance transformation coefficient of the frequency point.
The adjustment module 506 is used for using the average luminance value of the image to be encoded and the second average transformation coefficient of every frequency band to correspondingly adjust the initial weighted quantization coefficient of every frequency band in the quantization matrix to obtain the final weighted quantization coefficient, in which, the luminance value calculation model 502 comprises the structure shown in
The adjustment module 506 comprises the structure shown in
The embodiment provides an AVS video compression encoding method and encoder which mainly adjusts the initial weighted quantization coefficient of every frequency band in a quantization matrix by using the average luminance value of an image to be encoded and average transformation coefficient of every frequency band obtained by calculation to obtain a final weighted quantization coefficient for quantization so as to be able to perform different step-size quantization on transformation coefficients of different frequency points obtained by transformation by using a quantization matrix constituted by final weighted quantization coefficients. Therefore, the process of quantization can fully take attributes of an image to be encoded such as luminance and chrominance into account, self-adaptively adjust weighted quantization coefficients in a quantization matrix and effectively lower the code rate while guaranteeing video encoding quality. In addition, since initial weighted quantization coefficients which comply with visual characteristics of human beings are used, the initial weighted quantization coefficients of the 6 frequency bands in the quantization matrix are {w1, w2, w3, w4, w5, w6}, in which, wq is the qth initial weighted quantization coefficient of the frequency band, q∈{1, 2, 3, 4, 5, 6}, w1<w5<w4<w3<w6<w2; and the preferred initial weighted quantization coefficients of the 6 frequency bands are {75, 225, 135, 120, 90, 150}. Thus the video compression encoding can further remove visual redundancy of the video sequence and further lower the code rate effectively while guaranteeing video encoding quality.
The main differences between Example 2 and Example 1 are that:
In the AVS video compression encoding method, the Step 202 can be realized by the flow shown in
in the Step 801, after an image to be encoded is divided into a plurality of blocks, the block luminance value of every block is calculated by pixel luminance values of all pixels in every block. In particular, the block luminance value can be calculated by the following Formula (7):
B(k)=Σm=1Nl(m) (7),
in which, l(m) represents the pixel luminance value of the mth pixel in the kth block, m∈{1, 2, . . . , N}, and N represents the number of pixels in the kth block.
In the Step 802, the average luminance value of the image to be encoded can be calculated by block luminance values of all blocks and the number of blocks. In particular, the average luminance value L of the image to be encoded can be calculated by the following Formula (8):
According, the luminance value calculation module 502 can be replaced with the structure shown in
The main differences between Example 3 and Example 1 or Example 2 are that:
In the AVS video compression encoding method, the Step 204 can be realized by the flow shown in
The Step 1001 sets the first transformation relation for representing the influence degree that the average luminance value of the image to be encoded has on the weighted quantization coefficient in the quantization matrix, and the second transformation relation for representing the influence degree that the second average transformation coefficient of every frequency band has on the weighted quantization coefficient in the quantization matrix. In particular, the first transformation relation can be as the following Formula (9):
in which,
The second transformation relation can be as the following Formula (10):
in which, C′ (q) represents the secondary second average transformation coefficient of every subsequent frequency band; and both e and f are settable constants. That is, the influence degree of the second average transformation coefficient of every frequency band on the weighted quantization coefficient in the quantization matrix can be adjusted by adjusting the constants e and f.
The Step 1002 transforms the average luminance value of the image to be encoded by using the first transformation relation to obtain the secondary average luminance value of the image to be encoded, and transforms the second average transformation coefficient of every frequency band by using the second transformation relation to obtain the secondary second average transformation coefficient of every frequency band. In particular, the Formulas (9) and (10) can be used to obtain the secondary average luminance value
The Step 1003 finds the product of the secondary average luminance value of the image to be encoded, the secondary second average transformation coefficient of every frequency band and the initial weighted quantization coefficient of every frequency band to obtain the final weighted quantization coefficient. In particular, the final weighted quantization coefficient WB(q) of the qth frequency band can be calculated by the following Formula (11):
WB(q)=wq×
Accordingly, the adjustment module 506 can be replaced with the structure shown in
The main differences between Example 4 and any one of the Examples 1, 2 and 3 are that:
In the Step 203 of the AVS Video compression encoding method, an attribute component is extracted from the image to be encoded, the attribute component is divided into a plurality of attribute blocks, the transformation coefficient of every frequency point in the attribute block is obtained by transformation of the attribute block. And the calculation of a first average transformation coefficient of every frequency point in all attribute blocks to which the frequency point belongs by the transformation coefficient of the frequency point can also be realized as follows: the luminance component and the chrominance component can be extracted from the image to be encoded; the luminance component is divided into a plurality of luminance blocks; the chrominance component is divided into a plurality of chrominance blocks; the luminance transformation coefficient of each frequency point in the luminance block is obtained by transformation of the luminance block; the chrominance transformation coefficient of each frequency point in the chrominance block is obtained by transformation of the chrominance block; the average combined transformation coefficient of every frequency point in all luminance blocks and chrominance blocks to which the frequency point belongs is calculated as a first average transformation coefficient by the luminance transformation coefficient and the chrominance transformation coefficient of the frequency point. In particular, the Discrete Cosine Transform (DCT), approximate DCT or orthogonal transformation can be used for transformation; and the luminance transformation coefficient of each frequency point can be represented as Cy(k,i,j). Since the chrominance comprises two categories Cr and Cb, the chrominance component correspondingly comprises the chrominance component Cr and the chrominance component Cb, and the chrominance transformation coefficient correspondingly comprises two sub-chrominance transformation coefficients Cv(k, i,j) and Cu(k, i,j), in which, the luminance component of the image to be encoded is divided into K luminance blocks, k∈{1, 2, . . . , K}; K is a positive integer; the chrominance component of the image to be encoded is divided into G chrominance blocks Cr and G chrominance blocks Cb, g∈{1, 2, . . . , G}; G is a positive integer and usually one fourth of K; the size of the luminance block, the chrominance blocks Cr and Cb are usually 8×8 pixels; i and j represent the locations of a frequency point in the luminance block and the chrominance blocks Cr and Cb; then, the average combined transformation coefficient C(i,j) of every frequency point in all luminance blocks and the chrominance blocks Cr and Cb to which the frequency point belongs is also a first average transformation coefficient
Accordingly, in the AVS video encoder of the embodiment, the attribute components comprise luminance component and chrominance component; and the attribute blocks comprise luminance blocks and chrominance blocks. The transformation module 504 can be used to obtain the luminance transformation coefficient of each frequency point in the luminance block by transformation of the luminance block and to obtain the chrominance transformation coefficient of each frequency point in the chrominance block by transformation of the chrominance block. The average transformation coefficient calculation module 505 can be used to calculate the average combined transformation coefficient of every frequency point in all luminance blocks and chrominance blocks to which the frequency point belongs as a first average transformation coefficient by the luminance transformation coefficient and the chrominance transformation coefficient of the frequency point.
The following points need to be further explained:
1. The initial weighted quantization coefficients of the 6 frequency bands can also choose other numerical values. For example, the initial weighted quantization coefficients of the 6 frequency bands can be {70, 220, 135, 115, 85, 140} or {80, 220, 140, 125, 90, 155}.
2. In the embodiments, the blocks are usually macro blocks.
The above content further explains the invention in detail with embodiments. The embodiments of the invention are not limited to these explanations. On the premise of adhering to the inventive concept of the invention, those skilled in the art can also make a plurality of simple deductions and replacements.
This application is a continuation-in-part of International Patent Application No. PCT/CN2013/078148 with an international filing date of Jun. 27, 2013, designating the United States, now pending. The contents of all of the aforementioned applications, including any intervening amendments thereto, are incorporated herein by reference. Inquiries from the public to applicants or assignees concerning this document or the related applications should be directed to: Matthias Scholl P. C., Attn.: Dr. Matthias Scholl Esq., 245 First Street, 18th Floor, Cambridge, Mass. 02142.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2013/078148 | Jun 2013 | US |
Child | 14981838 | US |