Summary of the invention
In view of this, the embodiment of the present invention provides a kind of new Video coding change quantization method and apparatus, solve existing
There are inverse transformation step and the shift step before quantization in technology after inverse quantization that cannot carry out parallel, entire Video coding is caused to become
The problem of changing the operation efficiency of quantization flow reduces.
The embodiment of the invention provides a kind of Video coding change quantization methods, comprising: carries out direct transform to matrix data
Processing;Wherein, the direct transform processing includes horizontal forward transformation step and vertical forward transformation step;The matrix data is carried out
Quantification treatment and inverse quantization processing;Inverse transformation processing is carried out to the matrix data;Wherein, the inverse transformation processing includes level
Inverse transformation step and vertical inverse transformation step;Wherein, further comprise:
The shift step executed after in the direct transform processing is horizontal forward transformation step, is first held in the inverse transformation processing
Capable shift step is horizontal reverse shift step;Or,
The shift step executed after in the direct transform processing is vertical forward transformation step, is first held in the inverse transformation processing
Capable shift step is vertical inverse transformation step.
A kind of Video coding change quantization device provided in an embodiment of the present invention, comprising: horizontal direct transform module is configured to
Horizontal direct transform processing is carried out to matrix data;
Vertical direct transform module is configured to carry out vertical direct transform processing to matrix data;
Quantization modules are configured to carry out quantification treatment to the matrix data;
Inverse quantization module is configured to carry out inverse quantization processing to the matrix data;
Horizontal inverse transform block is configured to carry out horizontal reverse conversion process to matrix data;
Vertical inverse transform block is configured to carry out vertical inverse transformation processing to matrix data;
Wherein, the horizontal direct transform module, vertical direct transform module, quantization modules, inverse quantization module, vertical inverse transformation
Module and horizontal inverse transform block are sequentially connected;Or,
The vertical direct transform module, horizontal direct transform module, quantization modules, inverse quantization module, horizontal inverse transform block
It is sequentially connected with vertical inverse transform block.
Using Video coding change quantization method and apparatus provided by the embodiment of the present invention, the transformation that is carried out after inverse quantization
Step does not have to just start to carry out after the completion of shift step before quantization, since the two is all horizontal transformation or vertical transitions, because
And what can be synchronized carries out line by line or by column, to improve the operation efficiency of entire Video coding change quantization process, realizes
Streamlined operation.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
Fig. 2 show the flow diagram of Video coding change quantization method provided by one embodiment of the invention.Such as Fig. 2
Shown, which includes:
Step 201: matrix data is handled into direct transform;Wherein, direct transform processing include horizontal transformation step and
Vertical transitions step.The inverse transformation step first carried out when the forward transformation step wherein executed afterwards is horizontal direct transform, in step 204
For horizontal inverse transformation;Or, the inverse transformation first carried out when the forward transformation step wherein executed afterwards is vertical direct transform, in step 204
Step is vertical inverse transformation.
Step 202: quantification treatment is carried out to the matrix data.
Step 203: inverse quantization processing is carried out to the matrix data.
Step 204: inverse transformation processing is carried out to the matrix data;Wherein, the inverse transformation processing includes horizontal transformation
Step and vertical transitions step.As previously mentioned, when the inverse transformation step wherein first carried out is horizontal inverse transformation, in step 201 after
The forward transformation step of execution is horizontal direct transform;Or, when the inverse transformation step wherein first carried out is vertical inverse transformation, step 201
In after execute forward transformation step be vertical direct transform.
Fig. 3 show the schematic illustration of Video coding change quantization method provided by one embodiment of the invention.Wherein
The square marked as 1~4 represent the row numbers of 4 × 4 matrix datas, the row of 8 × 8 matrix data of square marked as 1~8 is compiled
Number, A~M respectively respectively represents level-one operation.In the inverse transformation of the shift step and step 204 that are executed after the direct transform of step 201
The shift step first carried out is all vertical transitions step, after the vertical transitions in such step 201 complete the calculating of data line,
The row data can start the vertical transitions in step 204 after quantization and inverse quantization.
Specifically, by taking the change quantization process of 4 × 4 matrix datas in Fig. 3 as an example, it can only be to number in A grades of operations
Horizontal direct transform is carried out for 1 row;It, can also be right while the row for being 1 to number carries out vertical direct transform in B grades of operations
The horizontal direct transform of row carry out that number is 2;And so on into E grades of operations, can to 1 carry out vertical inverse transformation while,
The row that can be respectively also 2~3 to number carries out corresponding calculation step, and does not have to carry out inverse quantization until the row that number is 4
Inverse transformation is carried out to 1 again afterwards, to make the change quantization of the every a line of matrix data can pipeline parallel method operation.Such 4 × 4 matrix
Data only need 9 grades of (A~I) operations that entire change quantization process can be completed, and 8 × 8 matrix datas only need 13 grades of (A~M) operations
Entire change quantization process can be completed.
Similarly, the shift step first carried out in the shift step and step 204 executed after step 201 is all horizontal transformation
When step, the change quantization of the every a line of matrix data can also pipeline parallel method operation.
In an embodiment of the present invention, horizontal forward transformation step, vertical forward transformation step, horizontal reverse shift step and vertical
Inverse transformation step is discrete cosine transform.
In an embodiment of the present invention, conversion process, inverse transformation processing, quantification treatment and inverse quantization processing follow SVAC view
Frequency coding standard.
In actual Video coding, need to carry out the matrix that the matrix data of change quantization processing is 4 × 4 or 8 × 8
Block.Below with the forward transformation step executed rear in step 201 for horizontal direct transform, while the inverse transformation first carried out in step 204
Step is for horizontal reverse converts, to be described in greater detail by taking the change quantization process of 4 × 4 matrix datas as an example.
When matrix data is 4 × 4 matrix-block T4, the vertical direct transform of matrix data can be indicated in direct transform processing
Are as follows: K '=S4 × T4;Wherein S4 is 4x4 direct transform matrix, and K ' indicates the intermediate result after vertical direct transform.Then direct transform is handled
In to matrix K ' carry out horizontal direct transform may be expressed as: K=K ' × S4T;Wherein, S4TFor the transposed matrix of S4, K indicates positive and becomes
4 × 4 matrix-blocks after changing.
At this point, in order to control the size of element data in matrix, it is also necessary to by the member in 4 × 4 matrix-blocks after direct transform
Element carries out shifting function, is converted to transformation coefficient sampling point matrix, conversion calculating process may be expressed as: cij=(kij+2) > > 2,
(i, j=0 ... 3);Wherein kij is the element of K matrix, and CoeffMatrix [i, j] is transformation coefficient sampling point matrix
The element of CoeffMatrix;> > 2 (right shift 2) can be realized to the element in 4x4 matrix-block except 4 effect, and "+2 " are then
The correction value for rounding up and adding to realize division result, to improve computational accuracy.
It will be understood by those skilled in the art that according to matrix data be 4 × 4 matrixes or 8 × 8 matrixes, horizontal transformation with
The carry digit of shifting function and in order to realize that the correction value for rounding up and adding is different in vertical transitions, and specifically shift
Depending on several and correction value is by SVAC coding standard, which is not limited by the present invention.
Then, quantization parameter matrix QuantCoeffMatrix is obtained by transformation coefficient sampling point Matrix C oeffMatrix
Quantizing process (step 202) can be realized by following algorithm:
Wherein i, j=0 ... 3, QP are quantization parameter, and qcoeff4 is the quantized coefficients of 4x4, QuantCoeffMatrix
[i, j] is the element of quantization parameter matrix QuantCoeffMatrix;Qp_const is to eliminate the compensation system for calculating error
Number;Since the value for operating penalty coefficient in frame is larger than the value of non-frame interior operation supplement coefficient, " if in algorithm
(intra) " judgment step is to judge whether the operation of current macro is to operate in frame before quantizing process.
It will be understood by those skilled in the art that quantization parameter, dequantized coefficients and specific benefit in quantization and de-quantization process
Repay the value of coefficient qp_const also by SVAC coding standard depending on, the present invention to this equally without limitation.
The transformation coefficient sampling point matrix after inverse quantization is obtained by quantization parameter matrix QuantCoeffMatrix
Process (the step 203) of CoeffMatrix can be realized by following algorithm:
Wij=(QuantCoeffMatrix [i, j] × iqcoeff4 [QP%7, i, j]) < < (QP/7)
Wherein i, j=0 ... 3, QP are quantization parameter, and iqcoeff4 is the dequantized coefficients of 4x4, and wij is after inverse quantization
The element of transformation coefficient sampling point Matrix C oeffMatrix.
Finally the transformation coefficient sampling point Matrix C oeffMatrix inverse transformation for carrying out step 204 is handled.Inverse transformation processing
In horizontal reverse shift step may be expressed as: H '=CoeffMatrix × F4T;Wherein F4TFor the transposition of 4x4 reverse transform matrix F4
Matrix, H ' indicate the transformed intermediate result of horizontal reverse.
Vertical inverse transformation step in inverse transformation processing may be expressed as: H=F4 × H ';Wherein F4 is 4x4 reverse transform matrix,
H indicates the 4x4 matrix after inverse transformation.
The element rij of finally obtained matrix R also need to carry out displacement calculate it is as follows:
Rij=(hij+29) > > 10, (i, j=0 ... 3);Wherein hij is the element of H-matrix.
However when matrix data is 8 × 8 matrix-block T8, entire change quantization process and 4 × 4 matrix-blocks can not
Together, detailed process is as follows.
Direct transform processing (step 201) is carried out to 8 × 8 matrix-block first.It hangs down in direct transform processing to matrix data
Straight direct transform may be expressed as: K '=S8 × T8;Wherein S8 is 8x8 direct transform matrix, and K ' indicates the intermediate result after vertical transitions.
Then direct transform processing in matrix K ' carry out horizontal direct transform may be expressed as: K=K ' × S8T;Wherein, S8TFor S8
Transposed matrix, K indicate direct transform after 8x8 matrix-block.
Similarly, in order to control the size of element data in matrix, the 8x8 matrix-block after direct transform is also required to be converted to change
Coefficient sampling point matrix is changed, conversion calculating process is represented by cij=(kij+25) > > 6, (i, j=0 ... 7);Wherein kij is K square
The element of battle array, CoeffMatrix [i, j] are the element of transformation coefficient sampling point Matrix C oeffMatrix.
It can be by following algorithm by the quantizing process (step 202) that the transformation coefficient sampling point matrix obtains quantization parameter matrix
It realizes:
Wherein i, j=0 ... 7, QP are quantization parameter, and qcoeff8 is the quantized coefficients of 8x8, QuantCoeffMatrix
[i, j] is the element of quantization parameter matrix QuantCoeffMatrix.
Process (the step of the transformation coefficient sampling point Matrix C oeffMatrix after inverse quantization is obtained by the quantization parameter matrix
It is rapid 203) to be realized by following algorithm:
Wij=(QuantCoeffMatrix [i, j] × iqcoeff8 [QP%7, i&3, j&3]) < < (QP/7)
Wherein i, j=0 ... 7, QP are quantization parameter, and iqcoeff8 is the dequantized coefficients of 8x8, and wij is after inverse quantization
The element of transformation coefficient sampling point Matrix C oeffMatrix.
And then inverse transformation processing (step 204) in horizontal reverse shift step may be expressed as: H=(F8 × H ') > > 3;Its
Middle F4T is the transposed matrix of 8x8 reverse transform matrix F8, and H ' indicates the transformed intermediate result of horizontal reverse.
Vertical inverse transformation step in inverse transformation processing may be expressed as: H=F8 × H ';Wherein F8 is 8x8 reverse transform matrix,
H indicates the 8x8 matrix after inverse transformation.
It is as follows that the element rij of finally obtained matrix R carries out displacement calculating:
Rij=(hij+27) > > 8, (i, j=0 ... 3);Wherein hij is the element of H-matrix.
Fig. 4 show the structural schematic diagram of Video coding change quantization device provided by one embodiment of the invention.Such as Fig. 4
Shown, which includes:
Horizontal direct transform module is configured to the horizontal direct transform processing of matrix data carry out;
Vertical direct transform module is configured to carry out vertical direct transform processing to matrix data;
Quantization modules are configured to carry out quantification treatment to matrix data;
Inverse quantization module is configured to carry out inverse quantization processing to matrix data;
Horizontal inverse transform block is configured to carry out horizontal reverse conversion process to matrix data;
Vertical inverse transform block is configured to carry out vertical inverse transformation processing to matrix data;
Wherein, horizontal direct transform module, vertical direct transform module, quantization modules, inverse quantization module, vertical inverse transform block
It is sequentially connected with horizontal inverse transform block.
It will be understood by those skilled in the art that being also possible to vertical direct transform module, horizontal direct transform module, quantization mould
Block, inverse quantization module, horizontal inverse transform block and vertical inverse transform block are sequentially connected.As long as the module before quantization modules
It is all to execute horizontal transformation or vertical transitions with the module after inverse quantization, which is not limited by the present invention.
Fig. 5 show the structural schematic diagram of Video coding change quantization device provided by one embodiment of the invention.Such as Fig. 5
It is shown, wherein sequentially connected vertical direct transform module, quantization modules, inverse quantization module and vertical inverse transform block are integrated in one
In a join operation module.It will be understood by those skilled in the art that being also possible to sequentially connected horizontal direct transform module, quantization
Module, inverse quantization module and horizontal inverse transform block are integrated in a join operation module.
In an embodiment of the present invention, which further comprises control module;Control module
It is connect respectively with horizontal direct transform module, join operation module and horizontal inverse transform block;Or, control module respectively with it is vertical just
Conversion module, join operation module are connected with vertical inverse transform block.The matrix data of control module control input successively carries out
Vertical direct transform, three calculating processes of join operation and vertical inverse transformation or horizontal direct transform, join operation and horizontal inverse transformation
Three calculating processes, finally export obtained matrix data.
In an embodiment of the present invention, which further comprises memory module, is configured to deposit
The calculated result of water storage straight and even conversion module and vertical inverse transform block;Or,
It is configured to store the calculated result of vertical direct transform module and horizontal inverse transform block.
In an embodiment of the present invention, memory module is the register that a size is 8 × 8 × 20bits.Due to matrix
Data are up to 8x8, and the result sizes of vertical transitions and horizontal transformation are 15bits and 20bits respectively, therefore size is
The register of 8 × 8 × 20bits can be used as memory module to meet storage demand.
The above is merely preferred embodiments of the present invention, be not intended to limit the invention, it is all in spirit of the invention and
Within principle, made any modification, equivalent replacement etc. be should all be included in the protection scope of the present invention.