Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer,, the present invention is further elaborated below in conjunction with drawings and Examples.Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
In embodiments of the present invention, by the inverse quantization process of the first video decode standard being carried out simplification, conversion to a certain degree, be unified into and the similar inverse quantization process of the inverse quantization process of the second video decode standard, realize the hardware multiplexing of the inverse quantization process of two kinds of video decode standards.
Fig. 1 shows the realization principle of the inverse quantization process of the first video decode standard that prior art provides.Inverse quantization is actually the two-dimensional array QF[v of the residual error coefficient that counter-scanning is obtained] [u], producing the process of rebuilding conversion coefficient by inverse quantization, details are as follows for concrete implementation procedure:
Step 1: the two-dimensional array QF[v of the residual error coefficient that counter-scanning is obtained by the inverse quantization algorithm] [u] carry out inverse quantization and handle, and obtains coefficient F " [v] [u] behind the inverse quantization.
Two-dimensional array QF[v to residual error] [u] calculate by certain inverse quantization algorithm, just can obtain coefficient F " [v] [u] behind the inverse quantization.Wherein, the inverse quantization algorithm of this video decode has two kinds of situations:
First kind of inverse quantization algorithm:
The first step: calculate the DC coefficient of intra-frame prediction block, this DC coefficient is calculated by following formula:
F″[0][0]=dc_scalar*QF[0][0]
F wherein " [0] [0] is a DC coefficient of calculating the intra-frame prediction block of gained; dc_scalar is the quantization step of DC coefficient; luminance macroblock has different dc_scalar values, QF[0 with chrominance macroblock] [0] be the DC coefficient in the two-dimensional array of the residual error coefficient that obtains of counter-scanning.
Second step: calculate other coefficient except that the intra-frame prediction block DC coefficient, this coefficient is calculated by following formula:
wher?e:
W[w wherein] [v] [u] represent weight matrix, it is quantization table, the w value is 0 or 1, which kind of weight matrix indicates this matrix is, W[0] [v] [u] be the weight matrix that intra-frame macro block uses, W[1] [v] [u] be the weight matrix that non-intra-frame macro block uses, quantiser_scale is the quantization step of macro block, and each macro block value is fixed.
Second kind of inverse quantization algorithm:
The first step: the DC coefficient of calculating intra-frame prediction block.
Identical with first kind of inverse quantization algorithm.
Second step: calculate other coefficient except that the intra-frame prediction block DC coefficient, this coefficient is calculated by following formula:
F wherein " symbol of [v] [u] is by QF[v] [u] decision, promptly
F″[v][u]=Sign(QF[v][u])×|F″[v][u]|
Step 2: by saturated control, the coefficient that inverse quantization is obtained carries out saturation, with its value restriction within limits.
The coefficient F that inverse quantization obtains " [v] [u] will be saturated between [2048,2047], controlled by following formula:
Step 3: carry out ERROR CONTROL, the coefficient behind the inverse quantization of supersaturation control is revised.
Wherein ERROR CONTROL only is suitable for first kind of quantification method, ERROR CONTROL can be used with the arbitrary process of following equivalence and realize, at first to suing for peace through the reconstructed coefficients F ' of saturated control [v] [u] in the macro block, investigating this value then is odd number or even number, if this value is an even number, then coefficient F ' [7] [7] will be corrected, and concrete implementation procedure is controlled by following formula:
Fig. 2 shows the realization principle of the inverse quantization process of the second video decode standard that prior art provides.This inverse quantization process does not have the ERROR CONTROL part, the coefficient QF[v before the inverse quantization] after [u] obtain coefficient F ' [v] [u] by the inverse quantization algorithm, can obtain rebuilding DCT coefficient F[v through saturation arithmetic] [u], details are as follows for concrete implementation procedure:
Step 1: the two-dimensional array QF[v of the residual error that counter-scanning is obtained by the inverse quantization algorithm] [u] carry out inverse quantization and handle, and obtains the coefficient F ' [v] [u] behind the inverse quantization, and this coefficient is calculated by following formula:
F′[v][u]=QF[v][u]×W[w][v][u]
W[w wherein] [v] [u] represent quantization table, the w value is 0 or 1, which kind of matrix indicates this matrix is, wherein W[0] [v] [u] be the matrix that chrominance block is used, W[1] [v] [u] be the matrix that luminance block is used.
Step 2: by saturated control the result that inverse quantization obtains is carried out saturation, within limits with its value restriction.
Similar with saturated control in the first video decode standard, just the coefficient that obtains of inverse quantization will be saturated between [1024,1023], promptly
Embodiments of the invention are for the hardware multiplexing of the inverse quantization of realizing two kinds of video decode standards, the inverse quantization process of the first video decode standard has been carried out simplification to a certain degree, conversion, finally obtained and the similar inverse quantization process of the second video decode standard.
Fig. 3 shows the realization flow of the video encoding/decoding method that the embodiment of the invention provides, and details are as follows:
In step S301, flow through decoding, counter-scanning obtains residual error coefficient to the data bit behind the video coding.
In step S302, convert the first inverse quantization computing of the first video decode standard to second inverse quantization computing, and adopt the second inverse quantization computing that described residual error coefficient is carried out inverse quantization and handle, the described second inverse quantization computing is identical with the device that the inverse quantization computing of the second video decode standard is adopted.
Concrete step is:
The first step: the formula that the DC coefficient of the first video decode standard is calculated is changed, be unified into and second kind of second inverse quantization computing that the video decode standard is similar, can calculate by following formula after the conversion:
F″[0][0]=(QF[0][0]×8×dc_scalar)>>3
Second step: the formula to other coefficients of calculating except that the intra-frame prediction block DC coefficient of the first video decode standard is changed, and is unified into the second inverse quantization computing similar with the second video decode standard.
The calculating of other coefficients of first kind of inverse quantization algorithm except that the intra-frame prediction block DC coefficient of the first video decode standard, because F ' [v] [u]=QF[v is satisfied in the inverse quantization computing of second video decode] [u] * W[w] [v] [u], wherein use multiplier, and adder and divider have been used in first kind of inverse quantization algorithm computation other coefficients except that the intra-frame prediction block DC coefficient of the first video decode standard, the added k value of adder is ± 1, other coefficients of comparing in the inverse quantization algorithmic formula are very little, can ignore, do not influence the effect of decoding, and used in the formula of other coefficients of first kind of inverse quantization algorithm computation except that the intra-frame prediction block DC coefficient of the first video decode standard and taken advantage of 2 to remove 16 computings, wherein relating to divider divider hardware, to implement difficulty big, can change, realize that with multiplier and shift unit the second inverse quantization computing after the conversion can be calculated by following formula:
F″[v][u]=(QF[v][u]×W[w][v][u]×quantiser_scale)>>3
The calculating of other coefficients of second kind of inverse quantization algorithm except that the intra-frame prediction block DC coefficient of the first video decode standard, because F ' [v] [u]=QF[v is satisfied in the inverse quantization computing of second video decode] [u] * W[w] [v] [u], wherein only use multiplier, relate in the formula of other coefficients of second kind of inverse quantization algorithm computation except that the intra-frame prediction block DC coefficient of the first video decode standard and add 1, subtract 1 computing, but other coefficients of comparing in the inverse quantization algorithmic formula are very little, can ignore, do not influence the effect of decoding, therefore second kind of inverse quantization algorithm of the first video decode standard changed, the second inverse quantization computing after the conversion can be calculated by following formula:
F″[v][u]=(QF[v][u]×16×quantiser_scale)>>3
The core that the inverse quantization algorithm changes be make first video decode the inverse quantization algorithm can with formula F ' [v] [u]=QF[v of the second video decode inverse quantization algorithm] [u] * W[w] [v] [u] be approaching, and for hardware realizes that simply different situations are rewritten into identical expression formula.
The direct application of formula F ' of inverse quantization algorithm [v] [u]=QF[v to the second video decode standard] [u] * W[w] [v] [u] get final product.
In step S303, the coefficient after the inverse quantization processing is carried out saturated control.
Carry out saturated control, the coefficient that obtains after inverse quantization is handled carries out saturation, with its value restriction within limits.In saturated being controlled at [2048, the 2047] scope, the second video decode standard then is controlled in [1024,1023] scope behind the first video decode standard inverse quantization.
In step S304, the coefficient that saturated control is obtained carries out the inverse transformation computing.
The algorithm of the IDCT process of two kinds of video decode standards is identical, and matrix size is that the two-dimentional idct transform of NxN is calculated by following formula:
Because the ERROR CONTROL of the first video decode inverse quantization process only is suitable for first kind of inverse quantization algorithm, and the second video decode inverse quantization process does not have ERROR CONTROL, so when carrying out hardware multiplexing, can ignore error control procedure, directly carry out inverse transformation after saturated control, the inverse transformation device of two kinds of video decode standard employings is identical.
As one embodiment of the present of invention, because the inverse transformation algorithm is identical, after the coefficient that obtains after inverse quantization handled carries out saturated control, directly carry out inverse transformation, can realize the hardware multiplexing of inverse quantization and IDCT.
As another preferred embodiment of the present invention, because after the saturated control, inverse quantization result's coefficient is inequality, width for unified IDCT input coefficient, when receiving the data bit flow of the second video decode standard, the coefficient that obtains after the inverse quantization processing be multiply by 2 after saturated control, after carrying out inverse transformation, the video image reconstructed coefficients that this inverse transformation is obtained is divided by 2, also can realize the hardware multiplexing of inverse quantization and IDCT, and can improve the operational precision of IDCT part by the adjustment of this coefficient.
Fig. 4 shows the structure of the video decoding system that the embodiment of the invention provides, and for convenience of explanation, only shows the relevant part of the embodiment of the invention.Wherein, video decoding system 41 can be the software unit that is built in the video decoding apparatus, the unit of hardware cell or soft or hard combination.
Residual error coefficient acquiring unit 42, be used for to the data bit flow behind the video coding decode, counter-scanning obtains residual error coefficient.
Inverse quantization computing converting unit 43 converts the first inverse quantization computing of the first video decode standard to second inverse quantization computing, and the residual error coefficient that adopts the second inverse quantization computing that described residual error coefficient acquiring unit is obtained carries out inverse quantization and handles, and the described second inverse quantization computing is identical with the device of the inverse quantization computing employing of the second video decode standard.Its detailed process does not repeat them here as mentioned above.
Coefficient after 44 pairs of described inverse quantization computing converting unit inverse quantizations of saturated control unit are handled carries out saturated control.Its detailed process does not repeat them here as mentioned above.
The coefficient that the 45 pairs of saturated controls in inverse transformation unit obtain carries out the inverse transformation computing.
Coefficient adjustment unit 46 is handled after the coefficient of saturated control and adjust through the video image reconstructed coefficients that inverse transformation obtains inverse quantization when receiving the video image of the second video decode standard.Its detailed process does not repeat them here as mentioned above.
Fig. 5 shows the structure of the hardware system that inverse quantization that the first video decode standard that the embodiment of the invention provides and the second video decode standard carry out video decode handles, and for convenience of explanation, only shows the relevant part of the embodiment of the invention.
The structure of the hardware system that inverse quantization is handled comprises first multiplier, and second multiplier, shift unit and video decode standard judging unit judge that the video that will decode meets the first video decode standard or meets the second video decode standard.Wherein multiplier 1 is the coefficient value that counter-scanning obtains, and bit wide is 11 bits; Multiplier 2 is from quantization table W[w] read the value that obtains [v] [u], bit wide is 12 bits, and the DC coefficient of all 8x8 pieces and calculate the value of not using quantization table in the inverse quantization algorithm of non-DC coefficient with second kind of quantification method in the first video decode standard picture, therefore the value of all DC coefficient corresponding quantitative tables is preset as 8, is preset as 16 with the value of the non-DC coefficient corresponding quantitative table of second kind of quantification method; Multiplier 3 is quantiser_scale in the first video decode standard or the value of dc_scalar.This inverse quantization treatment system is at first calculated the product of multiplier 1 and multiplier 2 by first multiplier, carry out the video that inverse quantization handles by video decode standard judgment unit judges then and whether meet the second video decode standard, directly give saturated control unit and handle if then first multiplier is calculated the coefficient of gained; Otherwise the result who multiplier 3 is given second multiplier and the first multiplier gained carries out product calculation, moves to right by shift unit and gives saturated control unit with the gained result after 3 and handle.
In embodiments of the present invention, when the inverse quantization algorithm similarity of two kinds of video decode standards is higher, by the inverse quantization process of the first video decode standard being carried out simplification to a certain degree, be converted to the similar process of inverse quantization process with the second video decode standard, can realize the inverse quantization hardware multiplexing of two kinds of different video decoding standards, under the prerequisite that guarantees the multimedia processor performance, effectively saved chip area, simplified control logic, and it is portable strong, as long as the inverse quantization part algorithm of several video decode standards is similar, just can adopt the method multiplexing.
One of ordinary skill in the art will appreciate that, realize that all or part of step in the foregoing description method is to instruct relevant hardware to finish by program, described program can be in being stored in a computer read/write memory medium, described storage medium is as ROM/RAM, disk, CD etc.
The above only is preferred embodiment of the present invention, not in order to restriction the present invention, all any modifications of being done within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.