WO2012097639A1 - 编码方法、解码方法及装置 - Google Patents

编码方法、解码方法及装置 Download PDF

Info

Publication number
WO2012097639A1
WO2012097639A1 PCT/CN2011/082591 CN2011082591W WO2012097639A1 WO 2012097639 A1 WO2012097639 A1 WO 2012097639A1 CN 2011082591 W CN2011082591 W CN 2011082591W WO 2012097639 A1 WO2012097639 A1 WO 2012097639A1
Authority
WO
WIPO (PCT)
Prior art keywords
rot
transform
shift
coefficients
coefficient
Prior art date
Application number
PCT/CN2011/082591
Other languages
English (en)
French (fr)
Inventor
闻兴
区子廉
孙林
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2012097639A1 publication Critical patent/WO2012097639A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/154Measured or subjectively estimated visual quality after decoding, e.g. measurement of distortion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/12Selection from among a plurality of transforms or standards, e.g. selection between discrete cosine transform [DCT] and sub-band transform or selection between H.263 and H.264
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock

Definitions

  • the present application relates to the field of communications technologies, and in particular, to an encoding method, a decoding method, and an apparatus. Background technique
  • DCT Discrete Cosine Transform
  • the DCT transform matrix has symmetrical characteristics, the dishing algorithm is usually used when implementing the transform in hardware. Since the DCT transform is implemented by two one-dimensional transforms, which are in the vertical direction and in the horizontal direction, respectively, when the input two-dimensional data to be encoded has significant directional characteristics, for example, the main direction of the data is not in the vertical direction or the horizontal direction. , it is difficult to better describe the signal characteristics through DCT.
  • a MDDT mode dependent directional transform
  • the ROT Rotational Transform
  • m ( ⁇ ⁇ ) is the input signal, m. It is a signal after DCT transform and ROT transform, D is a DCT matrix, is a ROT horizontal transform matrix, and R v is a ROT vertical transform matrix.
  • the coefficients at the position (1, 1) in the DCT matrix need to be multiplied by the coefficients at the position (1, 1) in the Rh matrix (position (1). , 1) represents the coefficient in the first row and the first column in the matrix), and the coefficient at the position (1, 1) in the corresponding output matrix m is the first row coefficient in the DCT matrix and the first column in the Rh matrix
  • position (1). , 1) represents the coefficient in the first row and the first column in the matrix
  • the coefficient at the position (1, 1) in the corresponding output matrix m is the first row coefficient in the DCT matrix and the first column in the Rh matrix
  • m ( 1,1 ) D(l,l) R h (l,l) + D(2,l) R h (l,2) + D(3,l) x R h (l,3)
  • each multiplier is used to compute a set of multiplicative components, ie the first multiplier is used to compute D(l,l) R h (l,l), and the second multiplier is used to compute D(2,l) R h (l, 2), the third multiplier is used to calculate D(3,l) x R h (l,3), each multiplier corresponds to a register, and after the multiplier runs the multiplication operation, the intermediate result is stored in the corresponding In the register, after waiting for all registers to store data, the stored data is input into the adder for accumulation.
  • the embodiment of the present application provides an encoding method, a decoding method, and a device, so as to solve the problem that the ROT conversion process in the prior art codec is easy to waste computing resources and reduce hardware utilization.
  • a code conversion method includes:
  • the DCT transformed input signal is respectively performed according to a preset number of sets of ROT positive transformation matrices.
  • the ROT is transformed to obtain transform coefficients after the ROT is transformed, and each coefficient in the ROT positive transform matrix can be decomposed into a plurality of shift coefficients, each shift coefficient consisting of one shift bit and one sign bit;
  • the ROT positive transform matrix corresponding to the output signal with the least distortion is selected as the optimal ROT positive transform matrix of the current coding block, and is coded according to the optimal ROT positive transform matrix.
  • An encoding device comprising:
  • a DCT transform unit configured to perform DCT transform on the input signal
  • the ROT forward transform unit is configured to perform ROT forward transform on the DCT transformed input signal according to a preset plurality of sets of ROT positive transform matrices to obtain a ROT positive transform transform coefficient, each coefficient in the ROT positive transform matrix Can be decomposed into several shift coefficients, each shift coefficient consisting of one shift bit and one sign bit;
  • a quantization unit configured to quantize the transform coefficients after the ROT is transformed
  • a comparing unit configured to compare distortion of the output signal calculated according to each set of quantized transform coefficients
  • a coding unit configured to select an ROT positive transform matrix corresponding to the least-distorted output signal as an optimal ROT positive transform matrix of the current coding block, and perform coding according to the optimal ROT positive transform matrix.
  • a decoding method including:
  • each coefficient in the ROT inverse transform matrix can be decomposed into several shifts a coefficient, each shifting factor consisting of one moving bit and one sign bit;
  • Decoding is performed according to the matrix coefficients after the DCT inverse transform.
  • a decoding device comprising:
  • An obtaining unit configured to obtain, from the input code stream, the quantized transform coefficients obtained in the encoding process; and an ROT inverse transform unit, configured to perform ROT on the quantized transform coefficients according to preset preset sets of ROT inverse transform matrices respectively Inverse transform, obtaining matrix coefficients after DCT transformation, the ROT
  • Each coefficient in the inverse transform matrix can be decomposed into a plurality of shift coefficients, each shift coefficient consisting of one shift bit and one sign bit;
  • the DCT inverse transform unit is configured to perform DCT inverse transform on the DCT transformed matrix coefficients
  • a decoding unit configured to perform decoding according to the DCT inverse transformed matrix coefficients.
  • the embodiment of the present application performs the training on the coefficients in the ROT transformation matrix according to the preset training model.
  • the multiplication operation is converted into a shift operation and an addition operation, since there is no need to design a large number of multipliers for the multiplication operation, thereby reducing the complexity of the hardware implementation and the number of clocks required for the ROT transformation; and because of the ROT After each coefficient in the transformation matrix is trained, the number of shifts and the number of additions required in the calculation process are the same, that is, the number of clocks required for each coefficient to perform the multiplication operation is the same, and thus the prior art is Compared, it will not waste the computing resources in the codec process and improve the computing efficiency.
  • 1A is a schematic diagram of operation of binary multiplication in the prior art
  • 1B is a schematic structural diagram of hardware implementation of ROT transformation in the prior art
  • 2A is a schematic diagram of a coefficient of a positive transform matrix of a coding end ROT in the prior art
  • 2B is a schematic diagram of coefficients of a ROT inverse transform matrix of a decoding end in the prior art
  • 2C is a schematic structural diagram of a transformation matrix coefficient training model in the embodiment of the present application.
  • 3A is a schematic structural diagram of hardware of performing ROT transformation according to an embodiment of the present application.
  • FIG. 3B is a schematic structural diagram of each processing unit PE in FIG. 3A; FIG.
  • FIG. 5 is a flowchart of an embodiment of a decoding method of the present application.
  • FIG. 6 is a flow chart of an embodiment of an encoding apparatus of the present application.
  • FIG. 7 is a flow chart of an embodiment of a decoding apparatus of the present application.
  • the following embodiments of the present invention provide an encoding method, a decoding method, and an apparatus.
  • the ROT transformation in the code process is relatively complicated, which is disadvantageous to the hardware implementation.
  • the embodiment of the present application aims to provide an ROT transformation matrix that is easy to implement in hardware, and performs a codec process through the ROT transformation matrix to achieve codec efficiency. At the same time, reduce the computational complexity.
  • the DCT transform and the ROT transform are required in both the encoding process and the decoding process in the embodiment of the present application.
  • the ROT transformation in the prior art will be described.
  • a set of rotation angles ⁇ 1 to ⁇ 6 can be taken as ( ⁇ , ⁇ 2, ⁇ 3) and ( ⁇ 4, ⁇ 5, respectively. ⁇ 6 ), where l , ⁇ 2, ⁇ 3 ) are the rotation angles in the horizontal transformation matrix, ( ⁇ 4, ⁇ 5 , ⁇ 6 ) are the rotation angles in the vertical transformation matrix, and the above six angle values are brought into the above formulas of R h and R v
  • the calculation is performed to obtain the ROT transformation matrix. In the actual calculation process, it is not necessary to know the specific values of the respective corners, but to derive the transformation matrix. In the specific codec process, four sets of angles can be selected for ROT transformation, in order to select the optimal set of transformation matrices.
  • each element in the transformation matrix is normalized to the form of 2 ⁇ ⁇ .
  • the four sets of coefficients are as shown in Fig. 2B: where the numbers on the left (1, 2, 3, 4) represent the coefficients in the ROT transformation matrix under the four sets of angles in the ROT transformation, each set of coefficients is 36.
  • the values are composed of Ro to R 35 respectively.
  • FWD is expressed as the ROT positive transform in the encoding process.
  • D(2,1) will be binary multiplied with R v (l,2) to get the intermediate operand
  • D (3,1 ) will be R v (l,3 Perform binary multiplication to get the intermediate operand, and then add all the intermediate operands through the adder.
  • the coefficient m (1,1) in the output matrix the following calculations are needed:
  • m ( 1,1 ) D(l,l) R h (l,l) + D(2,l) R h (l,2) + D(3,l) x R h (l,3)
  • the operation of each set of multiplicative components in the matrix multiplication operation needs to perform different shift operations according to the number of bits of the binary number.
  • the multiplication component R v (l, l) xD(l, l) requires 10 shift operations and 9 addition operations
  • the multiplication component R v (l, 3) xD (3, l) requires only four Sub-shift operation and 3 addition operations.
  • the number of multiplication shift operations here is determined by the non-zero number of binary numbers Rv, that is, the number of non-zero numbers in the binary number of 1 ⁇ (1,1) is 10, and the corresponding shift operation needs ten times, the addition operation Less than one shift operation, that is, nine times.
  • FIG. 2C is a schematic structural diagram of a transformation matrix coefficient training model in the embodiment of the present application: using the training model in FIG. 2C, each of the coefficients of each set of matrix transformation coefficients in FIG. 2A and FIG. 2B are respectively trained. Each coefficient is transformed into a form of addition of several components according to the training result, and each component is composed of a sign bit and a shift bit.
  • the process of training the matrix is equivalent to quantizing the transformation matrix, and each transform coefficient in the ROT transformation matrix to be quantized is input into the input module in FIG. 2C, and the sign bit of the coefficient is first obtained, and then obtained by the absolute value module.
  • the absolute value of the coefficient is calculated by the calculation module for log2(), and the calculation result is taken as an integer, and the integer is taken as the number of moving bits, and then the moving bit is taken as K, and 2 ⁇ ⁇ , the input module is input.
  • the difference between the input coefficient and 2 ⁇ is used, and the result is returned to the input module through the difference feedback module, and the foregoing process is repeated until each symbol bit and moving bit of the coefficient is obtained.
  • sign() indicates the sign bit
  • () bit indicates the shift bit
  • n value is obtained in advance based on the test result.
  • the number of quantization bits of the inverse transform matrix is obtained in advance based on the test result.
  • the inverse transformation matrix obtained after training is hf_inv-nbit
  • the positive transformation matrix is as follows:
  • the positive transformation matrix hf_fwd-mbit can also be obtained according to the foregoing procedure, wherein the m value is obtained in advance according to the experimental result.
  • m and n may or may not be equal.
  • the sizes of m and n can be selected according to different applications, different data types, different video sizes, and different system requirements, so as to achieve a different balance between coding efficiency and hardware complexity.
  • a preset rounding strategy may be specifically adopted, for example, adding a certain amount of displacement to the input signal and then rounding down, and the rounding formula is expressed as round.
  • (Rij+pij) which is the value output by the calculation module, which is the displacement amount, which can take different values with the change of position, or take the globally consistent value for different positions.
  • the 8 x 8 matrix is still taken as an example, assuming g_F WD ROT MATRIX 8 [4] [36] represents a positive transform matrix having four sets of matrix transform coefficients, g_INV- ROT—MATRIX—8[4][36] indicates that there are four sets of inverse transform matrices of matrix transform coefficients. It is assumed that m-bit quantization is performed on the positive transform matrix, and n-bit quantization is used on the inverse transform matrix, where m and n may be the same or different.
  • the coefficients in the positive transformation matrix can be expressed as follows:
  • FWD Rv ( i,j ) sign— 8— l*ROT— shift— FWD—8—1 + ... + sign— 8— m*ROT— shift— FWD— 8— m;
  • INV Rv ( i,j ) sign— 8— l*ROT— shift— INV— 8—1 + ... + sign— 8— n*ROT— shift— INV— 8— n;
  • sign—8—n denotes a sign bit
  • ROT—shift—INV—8—n denotes a shift bit
  • each transform matrix coefficient after training can be expressed as a summed form of components consisting of a moving bit and a sign bit which are the same as the number of quantized bits, the multiplication operation is removed. , instead, it is implemented by shifting and adding operations, so the corresponding transform matrix is advantageous for hardware implementation, and since all coefficients are quantized by the same number of bits, the number of clocks required for the operation result of each coefficient in the transform matrix is completely the same. Therefore, the utilization of hardware is improved.
  • FIG. 3A a hardware structure diagram of performing ROT transformation in the embodiment of the present application is provided.
  • a hardware architecture for time division multiplexing is proposed in Figure 3A.
  • processing units PE processing element
  • adder adder
  • register register
  • the processing unit PE is configured to determine the movement bit and the sign bit of the input data, wherein the input data is the transformation matrix coefficient after training by the training model; the adder connected to the processing unit PE is responsible for the i-th of the three input data ( Assuming that the quantized bits are m, the shift result of i from 1 to m) is accumulated, and the temporary result after the i-th accumulation is input to the storage register by the second adder for saving, and when the i+1th time When the accumulated temporary result is input to the second adder, The second adder adds the i-th accumulated temporary result stored in the register to the accumulated temporary result, and so on, and performs m-1 times of total accumulation, thereby obtaining the final result.
  • FIG. 3B is a schematic structural diagram of each processing unit PE in FIG. 3A:
  • the processing unit PE includes: a multi-shift element unit (MSE), a data register DR (data register), and a symbol.
  • MSE multi-shift element unit
  • DR data register
  • SDE sign determination element
  • the sign bit sign obtained from the transformed transform matrix coefficients is input to the SDE, and the SDE determines the sign bit of the output signal according to the corresponding sign bit sign and the sign bit of each input signal, and the DR is Each time the intermediate data input to the SDE is accumulated, the result of processing a matrix transform coefficient by one PE is finally input to the first-stage adder.
  • the MSE will move the ROT_shift_ 8.1 bit to the input signal D ( 1,1 ) and save the result in the DR;
  • the MSE moves the ROT_shift_8-2 bits to the input signal D(1,1) and saves the result in the DR.
  • the DR inputs the result of the original saved first shift operation into the SDE, SDE. Performing sign bit judgment on sign_8-1, and outputting the intermediate data after the first shift operation to the adder adder according to the judgment result;
  • the MSE moves the ROT_shift_8-m bits to the input signal D(1,1) and saves the result in the DR.
  • the DR inputs the result of the m-1th shift operation originally saved to the SDE.
  • SDE performs sign bit judgment on sign_8-m-1, and outputs intermediate data after the m-1th shift operation to the adder adder according to the judgment result;
  • the m+1th clock cycle :
  • the DR inputs the result of the mth shift operation originally saved to the SDE, and the SDE performs the sign bit judgment on the sign_8-m, and outputs the intermediate data after the mth shift operation to the adder adder according to the judgment result. .
  • the adder adder mentioned in the above process is the first adder connected to the PE in FIG. 3A. Since the data processing flow of the other two PEs is consistent with the above PE processing flow, the required clock cycles are also the same. It is m+1 clock cycles, and will not be described here.
  • the three PEs output the intermediate result after the first shift operation to the first adder, and the first adder will have three intermediates.
  • the result is accumulated and input to the second adder, and is input to the register by the second adder; in the third clock cycle, the three PEs output the second shift operation to the first adder.
  • the first adder accumulates the three intermediate results and inputs them to the second adder.
  • the second adder takes the registered result of the previous accumulation from the register, and accumulates with this time. After the result is added, it is input to the register for saving.
  • the three PEs output to the first adder the intermediate result after the third shift operation, and the first adder will be three.
  • the intermediate results are accumulated and input to the second adder.
  • the second adder takes the previously accumulated registration result from the register and adds it to the accumulated result to output the final result data.
  • the hardware architecture in the embodiment of the present application uses a processing unit PE (replacement element) instead of the multiplier, and adds a first-stage flow, and removes Primary register. Since the area required by the PE is only one tenth or one-tenth of the original multiplier, the area occupied by the hardware implementation is reduced. Second, since the number of quantized bits per coefficient is the same, three PE pairs The processing time of the data stream is the same, and the accumulation process does not need to wait, which can improve the data throughput of the system and improve the efficiency of the system hardware.
  • PE replacement element
  • Table 3 As can be seen from the above Table 3, when m is 3, the number of clocks required to operate each inverse transform matrix coefficient is only 5 clock cycles, compared with the prior art, since it is not necessary to determine the number of bits according to each coefficient. The number of clocks required, so the number of clocks required is greatly reduced, and all the coefficients need only 2m-l clock cycles to complete the multiplication operation. Since the operation of the data stream is highly regular and the clock cycles are consistent, it is advantageous for hardware implementation.
  • Step 401 Perform DCT transformation on the input signal.
  • Step 402 Perform DCT positive conversion on the DCT transformed input signal according to a preset set of ROT positive transform matrices to obtain a transform coefficient after the ROT positive transform, and each coefficient in the ROT positive transform matrix can be decomposed into several shifts. Bit coefficients, each shifting factor consisting of one shifted bit and one signed bit.
  • the plurality of sets of ROT positive transform matrices may specifically be four sets of ROT positive transform matrices.
  • Each coefficient in the ROT positive transform matrix can be decomposed into shift coefficients that coincide with preset quantized bits such that each of the coefficients has the same shift coefficient.
  • each coefficient can be trained by the training model. When each coefficient is trained, the training process is repeated according to the preset quantized bits for each coefficient input to the training model, and the quantification is obtained. The shifting coefficients of the same number of bits are such that each of the coefficients has the same shift coefficient.
  • the moving bits and sign bits of the N sets of shift coefficients constituting each coefficient in each set of positive transform coefficients are obtained, where N is a natural number; for the Mth group of shift coefficients in the N sets of shift coefficients, shifting the DCT transformed matrix coefficients according to the shift bits of the Mth group of shift coefficients, and shifting the Mth group
  • the sign bit of the coefficient is judged, and an intermediate result of the shift operation is obtained according to the judgment result;
  • the intermediate results of the shift operations obtained according to the Mth group shift coefficient of each coefficient are accumulated to obtain the Mth accumulated result; after all the N accumulated results are added, each set of positive transform coefficient pairs is obtained.
  • the transform coefficients of the ROT forward transform are performed by the DCT transformed matrix coefficients.
  • Step 403 After quantizing the transform coefficients after the ROT is transformed, comparing the distortion of the output signal calculated according to the quantized transform coefficients of each group.
  • Step 404 Select an ROT positive transform matrix corresponding to the output signal with the smallest distortion as the optimal ROT forward transform matrix of the current coding block, and perform coding according to the optimal ROT positive transform matrix.
  • FIG. 5 a flowchart of an embodiment of a decoding method of the present application is as follows:
  • Step 501 Obtain the quantized transform coefficients obtained in the encoding process from the input code stream.
  • Step 502 performing inverse ROT transformation on the quantized transform coefficients according to preset preset ROT inverse transform matrices to obtain matrix coefficients after DCT transform, and each coefficient in the ROT inverse transform matrix can be decomposed into several shift coefficients.
  • Each shift coefficient consists of one shift bit and one sign bit.
  • ROT inverse transformation matrices are specifically four sets of ROT inverse transform matrices.
  • Each coefficient in the ROT inverse transform matrix can be decomposed into shift coefficients that coincide with preset quantized bits such that each of the coefficients has the same shift coefficient.
  • each coefficient can be trained by the training model. When each coefficient is trained, for each coefficient input into the training model, the training process is repeated according to the preset quantized bits, and the quantization is obtained. The shifting coefficients of the same number of bits are such that each of the coefficients has the same shift coefficient.
  • Step 503 Perform DCT inverse transformation on the matrix coefficients after DCT transformation.
  • Step 504 Decode according to the matrix coefficient after the inverse transform of the DCT.
  • the ROT transform operation in the process of implementing encoding and decoding in the embodiment of the present application
  • the multiplication operation can be converted into the shift operation and the addition operation in the hardware implementation of the ROT transformation according to the training result, since no design is needed.
  • a large number of multipliers perform multiplication operations, thus reducing the complexity of the hardware implementation and the number of clocks required for ROT transformation; and because each coefficient in the ROT transformation matrix is trained, the number of shifts required in the calculation process and The number of additions is the same, that is, the number of clocks required for each multiplication operation is the same. Therefore, compared with the prior art, the computational resources are not wasted and the computational efficiency is improved.
  • the number of quantized bits quantized by the positive transform matrix and the inverse transform matrix can be variously combined. According to the test results, the following combinations are listed. The listed combinations are still based on the 8 ⁇ 8 matrix, and each matrix provides four sets of coefficients:
  • the first combination the positive transform matrix uses 5-bit quantization and the inverse transform matrix uses 3-bit quantization. It should be noted that, for the test results, the result of this combination is optimal, and a good balance between coding and decoding efficiency and hardware implementation can be achieved.
  • g-INV_ROT_MATRIX-8 is the corresponding inverse transformation matrix using 3-bit approximate quantization, and the four sets of transformation matrix coefficients are:
  • ROT—shift— INV— 8—m is the number of bits of the mth shift of the inverse transform
  • ROT—shift— IN V—8—1 is the number of bits of the first shift
  • ROT— shift— INV— 8—2 is the number of bits of the second shift, Bay' J
  • ROT— shift— INV— 8—3 is the number of bits of the third shift, Bay' J
  • g-FWD-ROT-MATRIX-8 is a corresponding positive transform matrix using 5-bit approximate quantization, and the four sets of transform matrix coefficients are:
  • ROT— shift— FWD— 8—m is the number of bits of the mth shift of the positive transform
  • ROT—shift—F WD—8—1 is the number of bits of the first shift
  • ROT— shift— FWD 8 2 is the number of bits shifted for the second time, Bay' J
  • ROT— shift— FWD 8 3 is the number of bits for the third shift, Bay' J
  • ROT— shift—FWD 8 4 is the number of digits of the fourth shift, Bay' J
  • ROT— shift— FWD 8 5 is the number of digits for the fifth shift, Bay' J
  • Sign— FWD—8—1 is the first shift of the positive transform matrix ROT— shift—the sign bit of FWD—8—1
  • Sign— FWD— 8—2 is the second shift of the positive transformation matrix ROT— shift—the sign bit of FWD—8— 2
  • Sign— FWD— 8—4 is the fourth shift of the positive transformation matrix ROT— shift—the sign bit of FWD—8—4, then
  • the second combination the positive transform matrix uses 5-bit quantization, and the inverse transform matrix uses 4-bit quantization.
  • g-INV_ROT_MATRIX-8 is the corresponding inverse transform matrix using 4-bit approximate quantization, and the four sets of transform matrix coefficients are:
  • ROT—shift— INV— 8—m is the number of bits of the mth shift of the inverse transform
  • ROT—shift—INV—8—1 is the number of bits of the first shift
  • ROT— shift— INV— 8—2 is the number of bits of the second shift, Bay' J
  • ROT— shift— INV— 8—3 is the number of bits of the third shift, Bay' J
  • ROT— shift— INV— 8—4 is the number of bits of the fourth shift, Bay' J
  • Sign— INV— 8—2 is the second shift of the inverse transform matrix ROT— shift—the sign bit of INV—8— 2
  • Sign— INV— 8—3 is the second shift of the inverse transform matrix ROT—shift—the sign bit of INV—8—3, then
  • T6SZ80/llOZN3/X3d 6£9 60 ⁇ OAV ⁇ 1,2,0,1,4,1,2,1,2,0,2,0,1,0,0,0,1,1,1,2,0,1,4,1,2 ,1,2,0,2,0,1,0,0,0,1,1, ⁇ , ⁇ 5,4,0,5,2,4,0,3,0,0,3,0, 3,5,2,0,1,0,5,4,0,5,2,4,0,3,0,0,3,0,3,5,2,0,1,0, ⁇ ,
  • ROT— shift— FWD 8 5 is the number of bits of the fifth shift of the positive transformation matrix
  • Sign— FWD—8—1 is the first shift of the positive transform matrix ROT— shift—the sign bit of FWD—8—1
  • Sign— FWD— 8—2 is the second shift of the positive transformation matrix ROT— shift—the sign bit of FWD—8— 2
  • Sign— FWD— 8— 3 is the sign bit of the third shift of the positive transformation matrix ROT— shift— FWD— 8— 3
  • Sign— FWD— 8—4 is the fourth shift of the positive transformation matrix ROT— shift—the sign bit of FWD—8—4, then
  • the third combination The positive transform matrix still uses 5-bit quantization, and the inverse transform matrix still uses 4-bit quantization.
  • the difference from the second combination is that the sign bit can only be represented by 1 or -1, that is, the sign bit does not take zero.
  • g-FWD-ROT-MATRIX- 8 is a corresponding positive transform matrix using 5-bit approximate quantization, and the four sets of transform matrix coefficients are:
  • T6SZ80/llOZN3/X3d 6£9 60 Z OAV ⁇ 5,4,3,4,7,4,3,5,5,4,4,1,5,4,0,1,4,2,5,4,3,4,7,4,3 ,5,5,4,4,1,5,4,0,1,4,2, ⁇ , ⁇ 8,6,4,7,4,7,4,6,3,6,5,3, 6,6,4,0,4,1,8,6,4,7,4,7,4,6,3,6,5,3,6,6,4,0,4,1, ⁇ ,
  • ROT— shift— FWD 8 4 is the number of bits of the fourth shift of the positive transformation matrix, Bay' J
  • ROT— shift— FWD 8 5 is the number of bits of the fifth shift of the positive transformation matrix
  • Sign— FWD— 8—2 is the second shift of the positive transformation matrix ROT— shift—the sign bit of FWD—8— 2
  • Sign— FWD— 8— 3 is the sign bit of the third shift of the positive transformation matrix ROT— shift— FWD— 8— 3
  • g-INV_ROT_MATRIX-8 is the corresponding inverse transform matrix using 4-bit approximate quantization, and the four sets of transform matrix coefficients are:
  • ROT—shift— INV— 8—m is the number of bits of the mth shift of the inverse transform
  • ROT—shift—INV—8—1 is the number of bits of the first shift
  • ROT— shift— INV— 8—2 is the number of bits of the second shift, Bay' J
  • ROT— shift— INV— 8—3 is the number of bits of the third shift, Bay' J
  • ROT— shift— INV— 8—4 is the number of bits of the fourth shift, Bay' J
  • Sign— INV— 8—2 is the second shift of the inverse transform matrix ROT— shift—the sign bit of INV—8— 2
  • INV—8—3 is the inverse transformation matrix
  • Sign— INV— 8—4 is the second shift of the inverse transform matrix ROT—shift—the sign bit of INV—8—4
  • the present application also provides an embodiment of an encoding device and a decoding device.
  • the encoding device includes: a DCT transform unit 610, an ROT forward transform unit 620, and a quantization unit
  • the DCT transform unit 610 is configured to perform DCT transform on the input signal.
  • the ROT forward transform unit 620 is configured to perform ROT forward transform on the DCT transformed input signal according to a preset plurality of sets of ROT positive transform matrices to obtain transform coefficients after the ROT forward transform, and each of the ROT positive transform matrices
  • the coefficient can be decomposed into a plurality of shift coefficients, each shift coefficient consisting of one shift bit and one sign bit;
  • the quantization unit 630 is configured to quantize the transform coefficients that are positively transformed by the ROT, and the comparing unit 640 is configured to compare the distortion of the output signal calculated according to each set of the quantized transform coefficients;
  • the coding unit 650 is configured to select an ROT positive transform matrix corresponding to the minimum distortion output signal as an optimal ROT forward transform matrix of the current coding block, and encode according to the optimal ROT positive transform matrix.
  • each coefficient in the ROT positive transform matrix can be decomposed into shift coefficients that coincide with preset quantized bits so that each of the coefficients has the same shift coefficient.
  • the encoding apparatus may further include (not shown in FIG. 6): a training unit, configured to: repeat, for each coefficient inputting the training model, a training process according to a preset number of quantization bits, and obtain the The shift coefficients with the same number of bits are quantized so that each of the coefficients has the same shift coefficient.
  • the ROT forward transform unit 620 can include (not shown in FIG. 6):
  • An information acquiring unit configured to acquire, for each set of positive transform coefficients in the ROT positive transform matrix, a moving bit and a sign bit of the N sets of shift coefficients constituting each coefficient in each set of positive transform coefficients, where Said N is a natural number;
  • a coefficient operation unit configured to perform, for the Mth group of the N sets of shift coefficients, a shift operation of the DCT transformed matrix coefficients according to the moving bits of the Mth group of shift coefficients, and Determining a sign bit of the M group shift coefficient, and obtaining an intermediate result of the shift operation according to the judgment result;
  • a first accumulating unit configured to accumulate an intermediate result of the shift operation obtained according to the Mth group shift coefficient of each coefficient, to obtain an Mth accumulated result
  • the second accumulating unit is configured to add all the N accumulated results to obtain transform coefficients for each of the sets of positive transform coefficients to perform ROT forward transform on the DCT transformed input signal.
  • FIG. 7 a block diagram of an embodiment of a decoding apparatus of the present application is as follows:
  • the decoding apparatus includes: an obtaining unit 710, an ROT inverse transform unit 720, a DCT inverse transform unit 730, and a decoding unit 740.
  • the obtaining unit 710 is configured to obtain, from the input code stream, the quantized transform coefficients obtained in the encoding process
  • the ROT inverse transform unit 720 is configured to perform inverse ROT transformation on the quantized transform coefficients according to preset preset sets of ROT inverse transform matrices to obtain matrix coefficients after DCT transform, and each of the ROT inverse transform matrices
  • the coefficient can be decomposed into a plurality of shift coefficients, each shift coefficient consisting of one shift bit and one sign bit;
  • the DCT inverse transform unit 730 is configured to perform DCT inverse transform on the DCT transformed matrix coefficients.
  • the decoding unit 740 is configured to perform decoding according to the matrix coefficients after the DCT inverse transform.
  • each coefficient in the ROT inverse transform matrix can be decomposed into shift coefficients that coincide with preset quantized bits so that each of the coefficients has the same shift coefficient.
  • the encoding apparatus may further include (not shown in FIG. 7): a training unit, configured to: repeat, for each coefficient input into the training model, a training process according to a preset quantized number of bits, and obtain the The shift coefficients with the same number of bits are quantized so that each of the coefficients has the same shift coefficient.
  • the ROT inverse transform unit 720 can include (not shown in FIG. 7):
  • An information acquiring unit configured to acquire, for each set of inverse transform coefficients in the inverse transform matrix of the ROT, moving bits and sign bits of N sets of shift coefficients constituting each coefficient in each set of inverse transform coefficients, Said N is a natural number;
  • a coefficient operation unit configured to perform, for the Mth group of the N sets of shift coefficients, a shift operation on the quantized transform coefficients according to the shift bits of the Mth group of shift coefficients, and The sign bit of the M group shift coefficient is judged, and an intermediate result of the shift operation is obtained according to the judgment result;
  • a first accumulating unit configured to accumulate an intermediate result of the shift operation obtained according to the Mth group shift coefficient of each coefficient, to obtain an Mth accumulated result
  • the second accumulating unit is configured to add all the N accumulated results to obtain transform coefficients of each set of inverse transform coefficients for performing inverse ROT transformation on the quantized transform coefficients.
  • the embodiment of the present application implements the encoding and decoding process.
  • the multiplication operation since the coefficients in the ROT transformation matrix are trained in advance according to the preset training model, the multiplication operation can be converted into the shift operation and the addition operation when performing the hardware implementation of the ROT transformation according to the training result. Since there is no need to design a large number of multipliers for multiplication, the complexity of the hardware implementation and the number of clocks required for the ROT transformation are reduced; and because each coefficient in the ROT transformation matrix is trained, the required shift in the calculation process The number of bits and the number of additions are the same, that is, the number of clocks required for each multiplication operation is the same. Therefore, compared with the prior art, the computational resources are not wasted and the computational efficiency is improved.
  • the techniques in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform.
  • the technical solution in the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product, and the computer software product may be stored in a storage medium such as a ROM/RAM. , a diskette, an optical disk, etc., includes instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform the methods described in various embodiments of the present invention or in some portions of the embodiments.
  • a computer device which may be a personal computer, server, or network device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • Discrete Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

一种编码方法、解码方法及装置,所述编码方法包括:将DCT变换后的输入信号按照预设的若干组ROT正变换矩阵分别进行ROT正变换,得到ROT正变换后的变换系数,ROT正变换矩阵中的每个系数能够分解为若干个移位系数,每个移位系数由一个移动位和一个符号位组成;对ROT正变换后的变换系数进行量化后,比较根据每一组量化后的变换系数计算得到的输出信号的失真情况;选择失真最小的输出信号所对应的ROT正变换矩阵为当前编码块的最优ROT正变换矩阵,根据最优ROT正变换矩阵进行编码。本申请将ROT变换过程中的乘法操作转换为移位操作和加法操作,提高了运算。

Description

编码方法、 解码方法及装置 本申请要求于 2011 年 1 月 19 日提交中国专利局、 申请号为 201110021893.4、 发明名称为"编码方法、 解码方法及装置"的中国专利申请的 优先权, 其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信技术领域, 特别是涉及一种编码方法、 解码方法及装置。 背景技术
DCT ( Discrete Cosine Transform, 离散余弦变换 )是视频图像编解码过程 中广泛使用的变换方式。 由于 DCT变换矩阵具有对称特性, 因此在硬件实现 该变换时, 通常采用碟形算法。 由于 DCT变换通过两个一维变换实现, 分别 为沿垂直方向和沿水平方向,因此当输入的二维待编码数据具有显著的方向特 性时, 例如, 数据的主要方向不在垂直方向或水平方向上, 则通过 DCT难以 更好地描述信号特性。
有鉴于此, 为了更好地描述信号特性,提高编解码压缩效果, 引入 MDDT ( mode dependent directional transform, 多变换编码 )技术。 由于 MDDT变换 比较复杂, 需要大量内存来存储变换矩阵, 因此现有技术中选择 ROT ( Rotational Transform,旋转变换 )对 DCT变换后仍然具有方向特性的变换系 数信号进行处理。 ROT变换采用一个水平变换矩阵和一个垂直变换矩阵。
基于 DCT变换和 ROT变换的编码过程可以用公式表示如下: m (》 】) '
Figure imgf000003_0001
上式中, m; 是输入的信号, m。 是经过 DCT变换和 ROT变换后的信号, D是 DCT矩阵, 是 ROT水平变换矩阵, Rv是 ROT垂直变换矩阵。
以 8x8的 ROT变换矩阵为例, 在进行矩阵乘法运算过程中, DCT矩阵中 位置( 1 , 1 )处的系数需要与 Rh矩阵中位置(1 , 1 )处的系数相乘(位置( 1 , 1 )表示矩阵中位于第一行和第一列上的系数), 而相应输出矩阵 m中位置 ( 1 , 1 )处的系数是 DCT矩阵中第一行系数与 Rh矩阵中第一列对应位置上的 系数分别相乘后求和的结果。 假设 Rh矩阵中除第一行位置( 1 , 1 ), 位置(1 , 2 )和位置 (1 , 3 )上的系数外, 其余系数都为零, 则相应的进行矩阵乘法 后, 输出信号矩阵 m中位置(1 , 1 )上的系数按照下式计算:
m ( 1,1 ) = D(l,l) Rh(l,l) + D(2,l) Rh(l,2) + D(3,l) x Rh(l,3)
在编码技术中,通常采用二进制方式进行乘法计算, 即需要将上述矩阵中 每个非零的十进制系数转换为二进制系数, 因此 D(l,l) x Rh(l,l)实际是两个二 进制数的乘法运算。假设 D(l,l) x Rh(l,l)对应的十进制数分别为 10和 5 , 则转 换为二进制乘法后, 为 1010与 0101相乘, 其乘法运算过程如图 1A所示。 由 图 1A可知, 由于十进制数 5的二进制数为四位, 因此在乘法运算过程中有四 组中间结果, 四组中间结果之间顺次移位,移位后进行同一位置上的数值的加 法运算得到最终的二进制乘法运算结果。 由此可知,在进行二进制乘法运算的 硬件实现时,有多少组乘法运算就需要设置相应数量的乘法器, 例如对于上述 m ( 1,1 )的计算, 需要设计三组乘法器; 并且根据二进制数的位数不同, 需要 进行不同次数的移位操作。 如图 1B所示, 为现有技术中基于上述示例的 ROT 变换的硬件实现结构示意图。 其中, 每个乘法器用于运算一组乘法分量, 即第 一个乘法器用于运算 D(l,l) Rh(l,l),第二个乘法器用于运算 D(2,l) Rh(l,2), 第三个乘法器用于运算 D(3,l) x Rh(l,3), 每个乘法器对应一个寄存器, 乘法器 运行完乘法运算后,将中间结果存储在对应的寄存器中, 等待所有寄存器都存 储数据后, 将存储数据输入加法器中进行累加。
由上述对现有技术中编解码过程中的 ROT变换的筒单描述描述可知, 在 对 ROT变换进行硬件实现时, 各个乘法器之间完成乘法运算所需要的时间不 同, 只有等到处理最慢的乘法器完成运算后, 才能进行下一组数据的运算, 由 此造成编解码过程中运算资源的浪费。
发明内容
为了解决上述技术问题, 本申请实施例提供了一种编码方法、解码方法及 装置, 以解决现有技术编解码时 ROT变换过程容易浪费计算资源, 降低硬件 利用率的问题。
本申请实施例公开了如下技术方案:
一种编码变换方法, 包括:
对输入信号进行 DCT变换;
将 DCT变换后的输入信号按照预设的若干组 ROT正变换矩阵分别进行 ROT正变换, 得到 ROT正变换后的变换系数, 所述 ROT正变换矩阵中的每 个系数能够分解为若干个移位系数,每个移位系数由一个移动位和一个符号位 组成;
对所述 ROT正变换后的变换系数进行量化后, 比较根据每一组量化后的 变换系数计算得到的输出信号的失真情况;
选择失真最小的输出信号所对应的 ROT正变换矩阵为当前编码块的最优 ROT正变换矩阵, 根据所述最优 ROT正变换矩阵进行编码。
一种编码装置, 包括:
DCT变换单元, 用于对输入信号进行 DCT变换;
ROT正变换单元,用于将 DCT变换后的输入信号按照预设的若干组 ROT 正变换矩阵分别进行 ROT正变换,得到 ROT正变换后的变换系数,所述 ROT 正变换矩阵中的每个系数能够分解为若干个移位系数,每个移位系数由一个移 动位和一个符号位组成;
量化单元, 用于对所述 ROT正变换后的变换系数进行量化;
比较单元,用于比较根据每一组量化后的变换系数计算得到的输出信号的 失真情况;
编码单元, 用于选择失真最小的输出信号所对应的 ROT正变换矩阵为当 前编码块的最优 ROT正变换矩阵, 根据所述最优 ROT正变换矩阵进行编码。
一种解码方法, 包括:
从输入码流中获取编码过程中得到的量化后的变换系数;
对所述量化后的变换系数按照预设的若干组 ROT 逆变换矩阵分别进行 ROT逆变换, 获得 DCT变换后的矩阵系数, 所述 ROT逆变换矩阵中的每个 系数能够分解为若干个移位系数,每个移位系数由一个移动位和一个符号位组 成;
对所述 DCT变换后的矩阵系数进行 DCT反变换;
根据所述 DCT反变换后的矩阵系数进行解码。
一种解码装置, 包括:
获取单元, 用于从输入码流中获取编码过程中得到的量化后的变换系数; ROT逆变换单元, 用于对所述量化后的变换系数按照预设的若干组 ROT 逆变换矩阵分别进行 ROT逆变换, 获得 DCT变换后的矩阵系数, 所述 ROT 逆变换矩阵中的每个系数能够分解为若干个移位系数,每个移位系数由一个移 动位和一个符号位组成;
DCT反变换单元, 用于对所述 DCT变换后的矩阵系数进行 DCT反变换; 解码单元, 用于根据所述 DCT反变换后的矩阵系数进行解码。
由上述实施例可以看出, 本申请实施例在实现编码和解码过程中的 ROT 变换操作时, 由于按照预设训练模型预先对 ROT变换矩阵中的系数进行了训 练, 因此可以根据训练结果在进行 ROT变换的硬件实现时, 将乘法操作转换 为移位操作和加法操作, 由于无需设计大量乘法器进行乘法操作, 因此减少了 硬件实现的复杂性, 以及 ROT变换所需要的时钟数; 并且由于 ROT变换矩阵 中的每个系数经过训练后, 在计算过程中所需要的移位次数和加法次数均一 致,即每个系数在进行乘法操作时所需要的时钟数一致,因此与现有技术相比, 不会造成编解码过程中运算资源的浪费, 提高了运算效率。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施 例或现有技术描述中所需要使用的附图作筒单地介绍,显而易见地,对于本领 域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图 获得其他的附图。
图 1A为现有技术中二进制乘法的运算示意图;
图 1B为现有技术中 ROT变换的硬件实现结构示意图;
图 2A为现有技术中编码端 ROT正变换矩阵系数示意图;
图 2B为现有技术中解码端 ROT逆变换矩阵系数示意图;
图 2C为本申请实施例中变换矩阵系数训练模型的结构示意图;
图 3 A为本申请实施例进行 ROT变换的硬件结构示意图;
图 3B为图 3A中每一个处理单元 PE的结构示意图;
图 4为本申请编码方法的实施例流程图;
图 5为本申请解码方法的实施例流程图;
图 6为本申请编码装置的实施例流程图;
图 7为本申请解码装置的实施例流程图。
具体实施方式
本发明如下实施例提供了一种编码方法、解码方法及装置。鉴于现有编解 码过程中 ROT变换比较复杂, 不利于硬件实现的缺点, 本申请实施例旨在提 供一种易于硬件实现的 ROT变换矩阵,通过该 ROT变换矩阵进行编解码过程 , 以实现在保证编解码效率的同时, 降低运算复杂度。
为了使本技术领域的人员更好地理解本发明实施例中的技术方案,并使本 发明实施例的上述目的、特征和优点能够更加明显易懂, 下面结合附图对本发 明实施例中技术方案作进一步详细的说明。
本申请实施例中的编码过程和解码过程中均需要进行 DCT变换和 ROT变 换。在描述本申请编码和解码过程中的 ROT变换之前,先对现有技术中的 ROT 变换进行描述。
由现有技术可知, ROT 变换时需要应用一个水平方向的变换矩阵和一个 垂直方向的变换矩阵, 分别用 Rh和 Rv表示, Rh和 Rv可以具体用下式表述:
Rh - Κζί θι )ϋχ ίθ2)Η ^
其中,
Figure imgf000007_0001
上式中, 一组旋转角 Θ1至 Θ6可以分别取值为( αΐ , α2, α3 )和( α4, α5 , α6 ), 其中 l , α2, α3 ) 为水平变换矩阵中的旋转角, ( α4, α5 , α6 ) 为垂 直变换矩阵中的旋转角,将上述六个角度值带入上述 Rh和 Rv公式中进行计算 即可得到 ROT变换矩阵。 在实际计算过程中无需知道各个角的具体值, 而是 推导出变换矩阵即可。 在具体编解码过程中, 可以选用四组角度进行 ROT变 换, 以便从中选出最优的一组变换矩阵, 在 ROT变换过程中, 变换矩阵中的 各个元素被归一化为 2Λρ的形式。 例如, 编码端和解码端可以分别使用 ρ=12 和 ρ=8。
以 8 X 8的 ROT变换矩阵为例, 在编码端变换矩阵中的元素按照 p=12归 一化后的四组系数如图 2A所示, 在编码端变换矩阵中的元素按照 p=8归一化 后的四组系数如图 2B所示: 其中, 左边的编号(1 , 2, 3 , 4 )分别表示在 ROT 变换中 4组角度下的 ROT变换矩阵中的系数,每组系数由 36个值组成, 分别 用 Ro到 R35表示。 FWD 表示为编码过程中的 ROT 正变换, 正变换矩阵 g—FWD— ROT— MATRIX— 8[4][36]中的值都被归一化到 2Λ12=4096,并取近似值; INV 表 示 为 编 码 过 程 中 的 ROT 逆 变 换 , 逆 变 换 矩 阵 g—INV— ROT— MATRIX— 8[4][36]中的值都被归一化到 2Λ8=256, 并取近似值。
利用图 2Α和图 2Β中的每一组系数构成的 ROT变换矩阵,进行如下的编 码过程操作:
Figure imgf000008_0001
R6 R, 0 0 0 0 0 if D T m i D * Rn R14 Rn 0 0 0 0 0
0 0 0 ^18 ^19 R20 0 0 0 0 0 R27 R30 ^33 0 0
0 0 0 R21 R22 R23 0 0 0 0 0 R2S R3 l R34 0 0
0 0 0 R24 R25 R26 0 0 0 0 0 R29 R32 R35 0 0
0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 以编码过程中的正变换矩阵为例, 则将图 2A 中的变换系数恢复到 8 的正变换矩阵后, 如下表 1所示, 示出了垂直方向的变换矩阵: 表 1
Rv(i,i) Rv(l,2) Rv(l,3) 0 0 0 0 0
Rv(2,i) Rv(2,2) Rv(2,3) 0 0 0 0 0
Rv(3,i) Rv(3,2) Rv(3,3) 0 0 0 0 0 0 0 0 Rv(4,4) Rv(4,5) Rv(4,6) 0 0
0 0 0 Rv(5,4) Rv(5,5) Rv(5,6) 0 0
0 0 0 Rv(6,4) Rv(6,5) Rv(6,6) 0 0
0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 1 上表 1中, 除了左上角的 9个系数及右下的 9个系数, 以及位置 (7,7)和 位置(8,8) 的两个 "1"外, 其余系数都为 0。 其中两组 9个系数完全一致, 也就 是说, Rv (4,4)和 Rv ( 1,1 )完全相等, 同理, Rv (6,5)和 Rv (3,2)完全相等。 因此在实际的计算过程中, 可以仅考虑计算两组系数中的一组 9个系数即可, 另一组 9个系数的计算过程和结果与其相同。
下面以表 1中的第一行, 即 Rv (l,l) , Rv (1,2) , Rv (l,3) 的乘法运算 说明现有技术中的变换过程。 假设采用图 2A中第 2组系数为例, 其中 Rv (l,l) 的值为 3903, 对应的二进制值为 111100111111, Rv ( 1,2 )的值为 -983, 对应的 二进制值为 1111010111, Rv( 1,3 )的值为 -802,对应的二进制值为 1100100010, 当与矩阵 D进行乘法运算的时候, D ( 1,1 )将会和 Rv(l,l)进行二进制乘法, 得 到中间操作数, 同理, D (2,1)将会和 Rv(l,2)进行二进制乘法, 得到中间操作 数, D (3,1 )将会和 Rv(l,3)进行二进制乘法, 得到中间操作数, 然后再通过加 法器将所有中间操作数累加起来, 即为了得到输出矩阵中的系数 m ( 1,1) , 需 要进行如下计算:
m ( 1,1 ) = D(l,l) Rh(l,l) + D(2,l) Rh(l,2) + D(3,l) x Rh(l,3)
根据二进制乘法的特性可知, 矩阵乘法运算过程中每一组乘法分量的运算 操作需要根据二进制数的位数不同进行不同的移位操作。 上式中, 乘法分量 Rv(l,l)xD(l,l)需要 10次移位操作及 9次加法操作, 而乘法分量 Rv(l,3)xD(3,l) 只需要四次移位操作及 3次加法操作。 在这里乘法移位操作的次数由二进制数 Rv的非零个数决定, 即1^(1,1)的二进制数中非零个数为 10个,相应的移位操作 需要十次, 加法操作比移位操作少一次, 即需要九次。 如下表 2所示, 为计算 m ( 1,1 ) 时各个系数的移位操作和加 的次数:
Figure imgf000009_0001
Figure imgf000010_0001
假设移位操作和加法操作都只需要一个时钟周期, 则1^(1,1 0(1,1)需要 19 个时钟周期完成, 而 Rv(l,3) x D(3,l)只需要 7个时钟周期完成。如果我们使用三 组同样的硬件来分别运算 Rv(l,l)xD(l,l), Rv(l,2)xD(2,l)和 Rv(l,3)xD(3,l), 那 么 m ( 1,1 )只有等三组运算都完成之后才能得到, 也就是需要等到最慢的一组 分量完成运算后才能得到。 结合图 1B可知, 在首先完成 Rv(l,3)xD(3,l)之后, 需要将 Rv(l,3)xD(3,l)的结果保存在相应的寄存器中, 由于 Rv(l,3)xD(3,l)只需 要 7个时钟周期, 所以需要等待 19-7=11个时钟周期让 Rv(l,l)xD(l,l)完成运算, 由此导致硬件的使用效率降低。
由于在应用现有技术中的变换矩阵系数进行 ROT变换时, 需要进行二进 制的矩阵乘法, 因此在对应设计的硬件结构中, 需要根据矩阵系数的位数使用 不同位数的乘法器。 而决定整个运算处理效率的是位数最长的系数, 其它位数 的系数在运算完成后都处于闲置状态, 消耗了编解码资源。 因此, 本申请实施 例对现有的 ROT变换矩阵系数进行重新设计,以获得利于硬件实现的 ROT变 换矩阵。
参见图 2C, 为本申请实施例中变换矩阵系数训练模型的结构示意图: 利用图 2C中的训练模型,分别对图 2A和图 2B中的每一组矩阵变换系数 中的每一个系数进行训练,根据训练结果将每个系数变换为若干个分量相加的 形式, 每个分量由符号位(sign bit )和移动位(shift bits )组成。 对矩阵进行 训练的过程相当于对变换矩阵进行量化, 分别将待量化 ROT变换矩阵中的每 个变换系数输入图 2C中的输入模块中, 首先取得该系数的符号位, 然后通过 绝对值模块获得该系数的绝对值, 通过计算模块对该系数进行 log2()的计算, 对计算结果取整数, 将该整数作为移动位的数量, 然后将该移动位作为 K, 求 2ΛΚ, 将输入模块中输入的系数与 2ΛΚ之间求差, 并将结果通过差值反馈模块 返回到输入模块中, 重复前述流程, 直至获得该系数的各个符号位和移动位。
以解码过程中的逆变换矩阵为例,假设想要获得原始逆变换矩阵的 η位量 化后的矩阵, 则将原始的逆变换输入上述训练流程中,对逆变换矩阵中的每个 系数, 重复整个流程(n-1 ) 次, 然后把结果相加, 即可得到一个新的用于硬 件实现的逆变换矩阵, 该逆变换矩阵中的每个值用如下公式表达:
^(1) * 2lbit + sign{2) * 22bit +… sign(n) * 2nbit 上式中, sign()表示符号位, ()bit表示移动位, n值为根据试验结果预先得 到逆变换矩阵的量化位数。
假设通过训练后得到的逆变换矩阵为 hf— inv— nbit, 则对于正变换矩阵, 为 了保持其可逆性, 可以直接对逆变换矩阵求逆变换矩阵获得, 即正变换矩阵如 下式所示:
fwd = {hf _ inv _ nbit)
同理,正变换矩阵 hf— fwd— mbit也可以½照前述流程获得, 其中 m值为根 据试验结果预先得到正变换矩阵的量化位数。 在同一编解码过程中, m和 n 可以相等也可以不相等。 m和 n的大小可以根据不同的应用场合, 不同的数据 类型, 不同的视频大小, 不同的系统要求来分别选择, 以便在编码效率和硬件 复杂度之间取得不同的平衡。 根据实验结果可知, ROT 的逆变换矩阵取的量 化值 n=3 , ROT的正变换矩阵的量化值 m=5时会得到与原始 ROT变换矩阵(即 图 2A和图 2B中的四组系数)最接近的结果。
进一步, 图 2C中, 在取整模块进行取整的过程中, 可以具体采用预先设 置的取整策略, 例如, 对输入信号加上一定的位移量后向下取整, 取整公式表 示为 round(Rij+pij), 其中 即为计算模块输出的数值, 为位移量, 其可以 随着位置的变化取不同的数值, 或对于不同的位置取全局一致的数值。本申请 实施例中,优选采用对于不同的位置取全局一致的 p值。在通过试验确定最优 的 p值过程中, 可以通过改变位移量 p的值, 例如, p从 -0.9到 0.9 , 步长为 0.01 , 在每一个特定的 p值下, 计算出近似矩阵和原始矩阵的差别, 从中选择 一个可以得到最小的差别的最优 p值。根据实验结果, 当 p = 0.47时的误差达 到最小。
下面以正变换矩阵中的一个系数 -3788 为例, 描述采用图 2C中的训练模 型对系数进行训练的过程进行进一步说明。首先,将 -3788输入到输入模块中, 然后将符号位 "-Γ存储在符号位 bit矩阵中, 然后通过绝对值模块取 -3788的 绝对值得到 3788 , 将 3788输入计算模块 log2()中, 计算结果为 11.887 , iili9i 取整模块中选择的取整策略为 p = 0.47 , 则得到的移动位取整数值为 12 , 通过 求值模块计算 2Λ12, 然后计算( 3788-2Λ12 ), 并将得到的差值继续输入到输入 模块中得到余下的移动位和符号位。
基于前述通过训练模型得到的每个变换矩阵系数,仍然以 8 x 8矩阵为例, 假设 g_F WD ROT MATRIX 8 [4] [36]表示有四组矩阵变换系数的正变换矩阵, g—INV— ROT— MATRIX— 8[4][36]则表示有四组矩阵变换系数的逆变换矩阵。 假 设对正变换矩阵进行 m位量化, 对逆变换矩阵使用 n位量化, 其中, m与 n 可以相同也可以不相同。
则根据训练结果, 正变换矩阵中的系数可以按照如下公式表示:
FWD Rv ( i,j ) = sign— 8— l*ROT— shift— FWD— 8—1 + ... + sign— 8— m*ROT— shift— FWD— 8— m;
上式中, sign— 8— m表示符号位, ROT— shift— FWD— 8— m表示移动位; 同理, 逆变换矩阵中的系数可以按照如下公式表示:
INV Rv ( i,j ) = sign— 8— l*ROT— shift— INV— 8—1 + ... + sign— 8— n*ROT— shift— INV— 8— n;
上式中, sign— 8— n表示符号位, ROT— shift— INV— 8— n表示移动位。
由上述对图 2C中的训练模型的描述可知, 由于训练后的每个变换矩阵系 数可以表示为与量化位数相同的由移动位和符号位组成的分量的求和形式,因 此去除了乘法操作, 改为由移位和加法操作实现, 因此相应的变换矩阵利于硬 件实现, 并且由于所有系数按照相同的位数进行量化, 因此变换矩阵中每个系 数的运算结果所需的时钟数完全一致, 因此提高了硬件的利用率。
参加见图 3A, 提供一种本申请实施例进行 ROT变换的硬件结构示意图: 如前对现有技术的描述可知, 对于 8x8的 ROT变换矩阵, 实际上需要对 一组 9个系数进行乘法操作,而矩阵的每一行只有三个系数需要同时操作来得 到一个特定的变换后矩阵的结果,因此图 3A中提出一个时分复用的硬件架构。 其中, 包括三个处理单元 PE ( processing element ), 两个加法器( adder )及一 个寄存器( register )。 处理单元 PE用于对输入数据进行移动位和符号位的判 断, 其中输入数据即为通过训练模型训练后的变换矩阵系数; 与处理单元 PE 相连的加法器负责将三个输入数据的第 i (假设量化位数为 m , i从 1到 m ) 次的移位结果进行累加, 第 i次累加后的临时结果通过第二个加法器输入到存 寄存器中进行保存,并且当第 i+1次累加后的临时结果输入到第二个加法器时, 第二个加法器再将寄存器中存储的第 i次的累加后的临时结果与本次累加后的 临时结果相加, 以此类推, 共进行 m-1次累加后, 从而得到最后的结果。
进一步, 参见图 3B, 为图 3A中每一个处理单元 PE的结构示意图: 图 3B中, 处理单元 PE包括: 多位移位单元 MSE ( multi-shift element ), 数据寄存器 DR ( data register ) 及符号决定单元 SDE ( sign determination element )。首先根据从训练后的变换矩阵系数中获得移动位控制信号 Shift— bit, 将移动位输入到 MSE中, 由 MSE根据移动位对输入数据进行移位操作,将移 位操作后的数据输入 DR, 同时将从训练后的变换矩阵系数中获得的符号位 sign— bit输入 SDE, 由 SDE根据对应的符号位 sign— bit及每次输入信号的符号 位, 来决定输出信号的符号位, 并将 DR每次输入到 SDE的中间数据进行累 加, 最终一个 PE对一个矩阵变换系数的处理结果输入到第一级加法器中。
为了进一步说明上述 PE的处理流程,下面结合图 3A和图 3B列举一个实 例进行说明。
图 3B中, 假设变换矩阵系数进行 m位量化, 且输入信号的 DCT变换矩 阵 D全为 1 , 则三个 PE分别负责运算 Rv(l,l) D ( 1,1 ) , Rv(l,2) D(2,l)和 Rv(l,3) D(3,l), 由于三个 PE的运算过程一致, 因此仅以 PE对 Rv(l,l) D ( 1,1 )进行处理进行说明:
在第一个时钟周期:
MSE将会对输入信号 D ( 1,1 )移动 ROT— shift— 8—1 位, 并将结果保存在 DR中;
第二个时钟周期:
MSE对输入信号 D ( 1,1 )移动 ROT— shift— 8— 2位, 并将结果保存在 DR 中; 同时, DR将原来保存的第一次移位操作后的结果输入到 SDE 中, SDE 对 sign— 8—1进行符号位判断,并根据判断结果向加法器 adder输出第一次移位 操作后的中间数据;
以此类推, 到第 m个时钟周期:
MSE对输入信号 D ( 1,1 )移动 ROT— shift— 8— m位, 并将结果保存在 DR 中; 同时, DR将原来保存的第 m-1次移位操作后的结果输入到 SDE中, SDE 对 sign— 8— m-1进行符号位判断, 并根据判断结果向加法器 adder输出第 m-1 次移位操作后的中间数据; 第 m+1个时钟周期:
DR将原来保存的第 m 次移位操作后的结果输入到 SDE 中, SDE 对 sign— 8— m进行符号位判断, 并根据判断结果向加法器 adder输出第 m次移位 操作后的中间数据。
上述过程中的提到的加法器 adder为图 3A中与 PE相连的第一个加法器, 由于另外两个 PE的数据处理流程与上述 PE处理流程一致, 因此所需要的时 钟周期也一致, 均为 m+1个时钟周期, 在此不再赘述。
结合图 3A, 以三次移位操作为例, 在第二个时钟周期, 三个 PE向第一 个加法器输出第 1次移位操作后的中间结果,则第一个加法器将三个中间结果 进行累加后输入到第二个加法器, 并由第二个加法器输入到寄存器中保存; 在 第三个时钟周期, 三个 PE向第一个加法器输出的是第 2次移位操作后的中间 结果, 则第一个加法器将三个中间结果进行累加后输入到第二个加法器中, 第 二个加法器从寄存器中取出前次累加后的寄存结果,并与本次累加后的结果相 加后, 输入到寄存器进行保存; 第四个时钟周期, 三个 PE向第一个加法器输 出的是第 3次移位操作后的中间结果,则第一个加法器将三个中间结果进行累 加后输入到第二个加法器中,第二个加法器从寄存器中取出前次累加后的寄存 结果, 并与本次累加后的结果相加, 输出最终的结果数据。
由此可知, 与图 1A所示的现有 ROT变换的硬件结构相比, 本申请实施 例中的硬件架构采用了处理单元 PE ( processing element )取代了乘法器, 并增 加了一级流水, 去掉一级寄存器。 因为 PE所需要的面积仅为原乘法器的十分 之一或几十分之一, 因此减小硬件实现所占用的面积; 其次, 由于每个系数的 量化位数相同, 因此三个 PE对数据流的处理时间相同, 累加过程无需等待, 可以提高系统的数据吞吐量及提高系统硬件的效率。
应用上述硬件结构的有益效果进一步说明如下:假设以 ROT逆变换为例, 如果对 ROT逆变换矩阵进行训练的量化位数为 m, 则所有系数在进行乘法操 作时, 所需要的移位次数和加法次数均一致, 即每个系数在进行乘法操作时, 只需要 m次移位操作, 以及 m-1次加法操作, 如下表 3所示, 为应用本申请 实施例进行 ROT逆变换时计算 m ( 1,1 )时各个系数的移位操作和加法操作的 次数:
表 3
Figure imgf000015_0001
由上表 3可知, 当 m为 3时, 每个逆变换矩阵系数所需要操作的时钟数 仅为 5个时钟周期, 与现有技术相比, 由于无需根据每个系数的二进制位数确 定所需要的时钟数, 因此所需要的时钟数量大大减少, 并且所有系数完成乘法 运算都只需要 2m-l个时钟周期, 由于数据流的运算高度规则, 时钟周期均一 致, 因此利于硬件实现,
前面对本申请编码和解码过程中使用到的 ROT变换矩阵的训练过程, 和 应用训练后生成的新的 ROT 变换矩阵进行乘法操作时的硬件架构进行了描 述, 下面结合前述内容对本申请实施例的编码过程和解码过程进行整体描述。
参见图 4, 为本申请编码方法的实施例流程图:
步骤 401: 对输入信号进行 DCT变换。
步骤 402: 将 DCT变换后的输入信号按照预设的若干组 ROT正变换矩阵 分别进行 ROT正变换, 得到 ROT正变换后的变换系数, ROT正变换矩阵中 的每个系数能够分解为若干个移位系数,每个移位系数由一个移动位和一个符 号位组成。
其中, 若干组 ROT正变换矩阵具体可以为四组 ROT正变换矩阵。 所述 ROT 正变换矩阵中的每个系数能够分解为与预设量化位数一致的移位系数, 以使所述每个系数具有相同的移位系数。具体实现时可以通过训练模型对每个 系数进行训练,在实现对每个系数进行训练时,对于输入所述训练模型的每个 系数,按照预设量化位数重复训练流程,获得与所述量化位数一致的移位系数, 以使所述每个系数具有相同的移位系数。
具体的,在进行 ROT正变换时,对于 ROT正变换矩阵中的每一组正变换 系数, 获取每一组正变换系数中组成每个系数的 N组移位系数的移动位和符 号位, 其中 N为自然数; 对于 N组移位系数中的第 M组移位系数, 根据第 M 组移位系数的移动位对 DCT变换后的矩阵系数进行移位操作, 并对所述第 M 组移位系数的符号位进行判断, 根据所述判断结果获得移位操作的中间结果; 将根据每个系数的第 M组移位系数获得的移位操作的中间结果进行累加, 得 到第 M个累加结果; 将所有 N个累加结果相加后, 得到每一组正变换系数对 所述 DCT变换后的矩阵系数进行 ROT正变换的变换系数。
步骤 403: 对所述 ROT正变换后的变换系数进行量化后, 比较根据每一 组量化后的变换系数计算得到的输出信号的失真情况。
步骤 404: 选择失真最小的输出信号所对应的 ROT正变换矩阵为当前编 码块的最优 ROT正变换矩阵, 根据所述最优 ROT正变换矩阵进行编码。
参见图 5, 为本申请解码方法的实施例流程图:
步骤 501 : 从输入码流中获取编码过程中得到的量化后的变换系数。
步骤 502: 对量化后的变换系数按照预设的若干组 ROT逆变换矩阵分别 进行 ROT逆变换, 获得 DCT变换后的矩阵系数, ROT逆变换矩阵中的每个 系数能够分解为若干个移位系数,每个移位系数由一个移动位和一个符号位组 成。
其中, 若干组 ROT逆变换矩阵具体为四组 ROT逆变换矩阵。 所述 ROT 逆变换矩阵中的每个系数能够分解为与预设量化位数一致的移位系数,以使所 述每个系数具有相同的移位系数。具体实现时可以通过训练模型对每个系数进 行训练, 在实现对每个系数进行训练时, 对于输入所述训练模型的每个系数, 按照预设量化位数重复训练流程, 获得与所述量化位数一致的移位系数, 以使 所述每个系数具有相同的移位系数。
具体的,在进行 ROT逆变换时,对于所述 ROT逆变换矩阵中的每一组逆 变换系数, 获取所述每一组逆变换系数中组成每个系数的 N组移位系数的移 动位和符号位, 所述 N为自然数; 对于所述 N组移位系数中的第 M组移位系 数, 根据所述第 M组移位系数的移动位对量化后的变换系数进行移位操作, 并对所述第 M组移位系数的符号位进行判断, 根据所述判断结果获得移位操 作的中间结果; 将根据每个系数的第 M组移位系数获得的移位操作的中间结 果进行累加, 得到第 M个累加结果; 将所有 N个累加结果相加后, 得到每一 组逆变换系数对所述量化后的变换系数进行 ROT逆变换的变换系数。
步骤 503: 对 DCT变换后的矩阵系数进行 DCT反变换。
步骤 504: 根据 DCT反变换后的矩阵系数进行解码。
由上述描述可知, 本申请实施例在实现编码和解码过程中的 ROT变换操 作时, 由于按照预设训练模型预先对 ROT变换矩阵中的系数进行了训练, 因 此可以根据训练结果在进行 ROT变换的硬件实现时, 将乘法操作转换为移位 操作和加法操作, 由于无需设计大量乘法器进行乘法操作, 因此减少了硬件实 现的复杂性, 以及 ROT变换所需要的时钟数; 并且由于 ROT变换矩阵中的每 个系数经过训练后,在计算过程中所需要的移位次数和加法次数均一致, 即每 个系数在进行乘法操作时所需要的时钟数一致, 因此与现有技术相比, 不会造 成编解码过程中运算资源的浪费, 提高了运算效率。
应用本申请实施例进行编码和解码时,对正变换矩阵及逆变换矩阵进行量 化的量化位数可以有多种组合。 根据试验结果, 列举如下几种组合方式, 所列 举的组合仍然以 8 X 8矩阵为例, 并且每个矩阵提供四组系数:
第一种组合方式: 正变换矩阵采用 5位量化, 逆变换矩阵采用 3位量化。 需要说明的是, 针对试验结果, 这种组合方式的结果最优, 能够在编码解码效 率和硬件实现之间取得一个良好的平衡。
其中, g—INV— ROT— MATRIX— 8为对应的使用 3位近似量化的逆变换矩阵, 其四组变换矩阵系数为:
const Int g—INV— ROT— MATRIX— 8 [4] [36]=
[252,-36,-31,24,240,-94,48,96,240,240,-100,3,100,240,-25,7,24,255,252,-36,- 31 ,24,240,-94,48,96,240,240,- 100,3, 100,240,-25,7,24,255;
244,-61,-50,-80,-232,-96,-25,94,-240,254,-28,-18,24,249,-56,24,56,249,244,-6 1,-50,-80,-232,-96,-25,94,-240,254,-28,-18,24,249,-56,24,56,249;
244,-80,12,80,232,-72,12,72,248,252,-48,-9,-48,-252,-28,-4,29,-254,244,-80,1 2,80,232,-72,12,72,248,252,-48,-9,-48,-252,-28,-4,29,-254;
192,-192,24,192,160,-96,49,80,240,240,-100,-10,-100,-240,-25,1,28,-255,192, -192,24,192,160,-96,49,80,240,240,-100,-10,-100,-240,-25,1,28,-255;]
ROT— shift— INV— 8— m 为逆变换第 m次移位的位数, ROT— shift— IN V— 8—1 为第一次移位的位数, 则
const Int ROT— shift— INV— 8—1 [4] [36] =
{
{8,5,5,4,8,7,5,6,8,8,7,2,7,8,5,3,5,8,8,5,5,4,8,7,5,6,8,8,7,2,7,8,5,3,5,8,}, {8,6,6,6,8,6,5,7,8,8,5,4,4,8,6,5,6,8,8 6,6,6,8,6,5,7,8,8,5,4,4,8,6,5,6,8,} {8,6,4,6,8,6,3,6,8,8,5,3,5,8,5,2,5,8,8 6,4,6,8,6,3,6,8,8,5,3,5,8,5,2,5,8,} {7,8,4,7,7,6,6,6,8,8,7,3,7,8,5,0,5,8,7: 8,4,7,7,6,6,6,8,8,7,3,7,8,5,0,5,8,}
ROT— shift— INV— 8— 2为第二次移位的位数, 贝' J
const Int ROT— shift— INV— 8— 2 [4] [36] =
{
{2,2,0,3,4,5,3,5,4,4,5,0,5,4,3,0,3,0,2,2,0,3,4,5,3,5,4,4,5,0,5,4,3,0,3,0,} {4,2,4,3,5,4,3,5,4,1,2,1,3,3,3,3,3,3,4,2,4,3,5,4,3,5,4,1,2,1,3,3,3,3,3,3,} {4,4,2,4,5,3,2,3,3,2,3,0,3,2,2,0,2,1,4,4,2,4,5,3,2,3,3,2,3,0,3,2,2,0,2,1,} {5,6,3,6,5,4,4,3,4,4,5,1,5,4,3,0,2,0,5,6,3,6,5,4,4,3,4,4,5,1,5,4,3,0,2,0,}
};
ROT— shift— INV— 8— 3为第三次移位的位数, 贝' J
const Int ROT— shift— INV— 8— 3 [4] [36] =
{
{0,0,0,0,2,1,1,3,2,2,2,0,2,3,0,0,0,0,0,0,0,0,2,1,1,3,2,2,2,0,2,3,0,0,0,0,}, {2,0,1,2,3,2,0,1,2,0,0,0,1,0A0JA2,0,1,2,3,2,0,1,2,0,0,0,1,0,0,0,1,0,}, {2,0,0,0,3,1,0,0,1,0,0,0,1,0,0,0,0,0,2,0,0,0,3,1,0,0,1,0,0,0,1,0,0,0,0,0,}, {4,3,0,3,1,3,0,2,0,2,2,0,2,2,0,0,0,0,4,3,0,3,1,3,0,2,0,2,2,0,2,2,0,0,0,0,},
}; sign— INV— 8—1 为逆变换矩阵第一次移位 ROT— shift— INV— 8—1 的符号位, const Int sign— INV— 8—1 [4] [36] =
{
{1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,1,1,1
{1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1 ,-1,1,1,1,},
{1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,
-ι,ι,-ι,},
{1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1, 1,1,-1,},
}; sign— INV— 8— 2为逆变换矩阵第二次移位 ROT— shift— INV— 8— 2的符号位, 则
const Int sign— INV— 8— 2 [4] [36] =
{
{-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1 ,1,-1,-1,-1,},
{-1,1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1, 1,-1,-1,-1,},
{-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,0,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1 ,1,1,0,-1,1,},
{1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,0,-1,1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,0,-1
,1,},
}; sign— INV— 8— 3为逆变换矩阵第三次移位 ROT— shift— INV— 8— 3的符号位, 则
const Int sign— INV— 8— 3 [4] [36] =
{
{-i,o,o,-i,-i,i,i,-i,-i,-i,-i,o,i,-i,-i,o,o,o,-i,o,o,-i,-i,i,i,-i,-i,-i,-i,o,i,-i,-
1,0,0,0,},
{i,-i,-i,-i,-i,-i,-i,-i,i,o,i,o,-i,i,o,o,-i,i,i,-i,-i,-i,-i,-i,-i,-i,i,o,i,o,-i,i,
0,0,-1,1,},
{1,-1,0,1,1,1,-1,-1,-1,0,-1,0,-1,1,0,0,1,0,1,-1,0,1,1,1,-1,-1,-1,0,-1,0,-1,1,0,0,1 ,0,},
{1,1,-1,-1,-1,-1,1,1,0,-1,-1,0,-1,1,-1,0,-1,0,1,1,-1,-1,-1,-1,1,1,0,-1,-1,0,-1,1,- 1,0,-1,0,},
};
其中, g—FWD— ROT— MATRIX— 8为对应的使用 5位近似量化的正变换矩 阵, 其四组变换矩阵系数为:
const Int g—FWD— ROT— MATRIX— 8 [4] [36]=
[4008,-624,-560,352,3728,-1560,656,1408,3688,3728,-1548,44,1541,3688,-39 0,108,380,4074,4008,-624,-560,352,3728,-1560,656,1408,3688,3728,-1548,44,154 1,3688,-390,108,380,4074;
3888,-1008,-799,-1160,-3588,-1284,-352,1648,-3696,4058,-456,-289,372,396 7,-928,377,864,3982,3888,-1008,-799,-1160,-3588,-1284,-352,1648,-3696,4058,-4 56,-289,372,3967,-928,377,864,3982;
3870,-1278,184,1278,3728,-1144,184,1144,3887,4016,-752,-152,-771,-3965,- 441,-57,464,-4076,3870,-1278,184,1278,3728,-1144,184,1144,3887,4016,-752,-15 2,-771,-3965,-441,-57,464,-4076;
2572,-2848,420,2688,2512,-1408,816,1286,3774,3728,-1535,-154,-1551,-368 0,-412,6,424,-4066,2572,-2848,420,2688,2512,-1408,816,1286,3774,3728,-1535,-1 54,-1551,-3680,-412,6,424,-4066;]
ROT— shift— FWD— 8— m 为正变换第 m次移位的位数, ROT— shift— F WD— 8—1 为第一次移位的位数, 则
const Int ROT— shift— FWD— 8—1 [4] [36]=
{
{12,9,9,8,12,11,9,10,12,12,11,6,11,12,9,7,9,12,12,9,9,8,12,11,9,10,12,12,11, 6,11,12,9,7,9,12,},
{12,10,10,10,12,10,9,11,12,12,9,8,8,12,10,9,10,12,12,10,10,10,12,10,9,11,1 2,12,9,8,8,12,10,9,10,12,},
{12,10,8,10,12,10,7,10,12,12,9,7,9,12,9,6,9,12,12,10,8,10,12,10,7,10,12,12, 9,7,9,12,9,6,9,12,},
{11,12,9,11,11,10,10,10,12,12,11,7,11, 12,9,3,9,12,11,12,9,11,11,10,10,10,1 ,12,11,7,11,12,9,3,9,12,},
};
ROT— shift— FWD 8 2为第二次移位的位数, 贝' J
const Int ROT— shift— 8— 2 [4] [36]=
{
{6,6,4,7,8,9,7,9,8,8,9,4,9,8,7,4,7,5,6,6,4,7,8,9,7,9,8,8,9,4,9,8,7,4,7,5,}, {8,5,8,7,9,8,7,9,8,5,6,5,7,7,7,7,7,7,8,5,8,7,9,8,7,9,8,5,6,5,7,7,7,7,7,7,},
{8,8,6,8,8,7,6,7,7,6,7,3,7,6,6,2,5,4,8,8,6,8,8,7,6,7,7,6,7,3,7,6,6,2,5,4,}, {9,10J,10,9,8,8,8,8,8,9,5,9,9,7,0,6,5,9,10J,10,9,8,8,8,8,8,9,5,9,9J,0,6^ };
ROT— shift— FWD 8 3为第三次移位的位数, 贝' J
const Int ROT— shift— 8— 3 [4] [36]=
{
{0,4,0,4,5,6,5,7,6,6,6,0,6,6,4,1,3,3,0,4,0,4,5,6,5,7,6,6,6,0,6,6,4,1,3,3,}, {6,3,5,5,6,6,4,5,5,1,4,3,5,3,0,3,5,4,6,3,5,5,6,6,4,5,5,1,4,3,5,3,0,3,5,4,}, {4,3,3AV,4,4,5,5,4,4,2,5,4,0,1,4,3,4,3,3,4J,4,4,5,5,4,4,2,5,4,0,1,4,3,}, {8,6,2,8,3,7,3,6,4,6,5,3,6,7,4,0,4,1,8,6,2,8,3,7,3,6,4,6,5,3,6,7,4,0,4,1,},
};
ROT— shift— FWD 8 4为第四次移位的位数, 贝' J
const Int ROT_shift_8_4[4][36]=
{
{0,0,0,2,3,4,1,5,3,4,4,0,3,3,0,0,1,0,0,0,0,2,3,4,1,5,3,4,4,0,3,3,0,0,1,0,}, {4,0,2,0,1,4,1,2,3,0,3,2,3,1,0,1,0,2,4,0,2,0,1,4,1,2,3,0,3,2,3,1,0,1,0,2,}, {2,0Α2Λ1Λ2,2,0,3,0,1,0,0,0,1, 1,2,0,0,2,4,1,2,2,2,0,3,0,1,0,0,0,1,1,}, {6,2,0,5,2,4,1,3,0,3,4,0,2,4,0,0,2,0,6,2,0,5,2,4,1,3,0,3,4,0,2,4,0,0,2,0,},
};
ROT— shift— FWD 8 5为第五次移位的位数, 贝' J
const Int ROT— shift— 8— 5 [4] [36]=
{
{0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,}, {ο,ο,ο,ο,ο,ο,ο,ο,ο,ο,ι,ο,ο,ο,ο,ο,ο,ο,ο,ο,ο,ο,ο,ο,ο,ο,ο,ο,ι,ο,ο,ο,ο,ο,ο,ο,}, {ο,ο,ο,ο,ι,ο,ο,ο,ι,ο,ι,ο,ο,ο,ο,ο,ο,ο,ο,ο,ο,ο,ι,ο,ο,ο,ι,ο,ι,ο,ο,ο,ο,ο,ο,ο,},
{4,0,0,1,0,2,0,0,0,0,2,0,0,2,0,0,0,0,4,0,0,1,0,2,0,0,0,0,2,0,0,2,0,0,0,0,},
};
sign— FWD— 8—1为正变换矩阵第一次移位 ROT— shift— FWD— 8—1的符号位, 则
const Int sign— 8—1 [4] [36]=
{
{1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,1,1,1
},
{1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1 ,-1,1,1,1},
{1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1, -1,1,-1},
{1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,
1,1,-1},
};
sign— FWD— 8— 2为正变换矩阵第二次移位 ROT— shift— FWD— 8— 2的符号 位, 则
const Int sign— 8— 2 [4] [36]=
{
{-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1 ,1,-1,-1,-1,},
{-1,1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,-1,-1,-1,1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1, 1,-1,-1,-1,},
{-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,- 1,1,1,-1,-1,1,},
{1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,0,-1,1,1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,0,
-1,1,}, sign— FWD— 8— 3 为正变换矩阵第三次移位 ROT— shift— FWD— 8— 3 的符号 位, 则
const Int sign— 8— 3 [4] [36]=
{
{0,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,1,1,0,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1 ,-1,1,1,1,},
{1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1 ,1,-1,-1,-1,1,},
{1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1,0,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,-1,1, 0,-1,-1,1,},
{1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,0,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,
-1,-1,0,-1,-1,},
};
sign— FWD— 8— 4为正变换矩阵第四次移位 ROT— shift— FWD— 8— 4的符号位, 则
const Int sign— 8— 4 [4] [36]=
{
{0,1,0,-1,1,-1,1,1,1,-1,-1,0,1,1,0,0,-1,0,0,1,0,-1,1,-1,1,1,1,-1,-1,0,1,1,0,0,-1,0
,},
{-i,i,-i,-i,-i,i,-i,i,i,o,i,-i,i,i,o,-i,o,i,-i,i,-i,-i,-i,i,-i,i,i,o,i,-i,i,i,o,-i
,0,1,},
{ΐ,ο,-ι,-ι,ι,ι,ι,ι,-ι,ο,-ι,ο,ι,ο,ο,ο,ι,-ι,ι,ο,-ι,-ι,ι,ι,ι,ι,-ι,ο,-ι,ο,ι,ο,ο,ο,ι,-ι
,},
{-1,1,-1, 1,-1, 1,1, 1,-1,-1,-1,0,1,-1,0,0,-1,-1,-1, 1,-1, 1,-1, 1,1, 1,-1,-1,-1,0,1,-1,0, 0,-1,-1,},
};
sign— FWD— 8— 5为正变换矩阵第五次移位 ROT— shift— FWD— 8— 5 的符号 位, 则
const Int sign— 8— 5 [4] [36]= {0,0,0,0,-1,0,0,1,1,-1,1,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,1,1,-1,1,0,0,0,0,0,0,0,},
{-1,0,1,0,0,0,0,0,0,0,-1,1,-1,0,0,0,0,0,-1,0,1,0,0,0,0,0,0,0,-1,1,-1,0,0,0,0,0,}, {0,0,0,1,-1,0,0,-1,-1,0,1,0,0,0,0,0,0,0,0,0,0,1,-1,0,0,-1,-1,0,1,0,0,0,0,0,0,0,},
{ΐ,-ι,ο,-ι,ι,ι,ο,-ι,ο,-ι,ι,ο,ι,ι,ο,ο,-ι,ο,ι,-ι,ο,-ι,ι,ι,ο,-ι,ο,-ι,ι,ο,ι,ι,ο,ο,-ι,ο ,},
};
第二种组合方式: 正变换矩阵采用 5位量化, 逆变换矩阵采用 4位量化。 其中, g—INV— ROT— MATRIX— 8为对应的使用 4位近似量化的逆变换矩阵, 其四组变换矩阵系数为:
const Int g—INV— ROT— MATRIX— 8 [4] [36]=
[251,-36,-31,23,236,-94,40,88,236,236,-100,3,100,232,-25,7,24,255,251,-36,- 31,23,236,-94,40,88,236,236,-100,3,100,232,-25,7,24,255;
243,-61,-50,-72,-230,-80,-25,94,-236,254,-27,-18,22,249,-56,24,54,249,243,-6 1,-50,-72,-230,-80,-25,94,-236,254,-27,-18,22,249,-56,24,54,249;
243,-81,12,81,232,-70,11,71,246,252,-40,-9,-40,-251,-28,-4,29,-254,243,-81,1 2,81,232,-70,11,71,246,252,-40,-9,-40,-251,-28,-4,29,-254;
160,-184,23,176,158,-80,49,72,240,236,-99,-10,-99,-232,-25,1,27,-255,160,-1 84,23,176,158,-80,49,72,240,236,-99,-10,-99,-232,-25,1,27,-255;]
ROT— shift— INV— 8— m 为逆变换第 m次移位的位数, ROT— shift— INV— 8—1 为第一次移位的位数, 则
const Int ROT— shift— INV— 8—1 [4] [36] =
{
{8,5,5,4,8,6,5,6,8,8,7,1,7,8,5,3,4,8,8,5,5,4,8,6,5,6,8,8,7,1,7,8,5,3,4,8,}, {8,6,6,6,8,6,5,6,8,8,5,4,4,8,6,4,6,8,8,6,6,6,8,6,5,6,8,8,5,4,4,8,6,4,6,8,}, {8,6,3,6,8,6,3,6,8,8,5,3,5,8,5,2,5,8,8,6,3,6,8,6,3,6,8,8,5,3,5,8,5,2,5,8,}, {7,7,4,7,7,6,6,6,8,8,7,3,7,8,5,0,5,8,7,7,4,7,7,6,6,6,8,8,7,3,7,8,5,0,5,8,},
};
ROT— shift— INV— 8— 2为第二次移位的位数, 贝' J
const Int ROT— shift— INV— 8— 2 [4] [36] =
{ {2,2,0,3,4,5,3,5,4,4,5,0,5,4,3,0,3,0,2,2,0,3,4,5,3,5,4,4,5,0,5,4,3,0,3,0,} {4,1,4,3,5,4,3,5,4,1,2,1,2,3,3,3,3,3,4,1,4,3,5,4,3,5,4,1,2,1,2,3,3,3,3,3,} {4,4,2,4,4,2,1,3,3,2,3,0,3,2,2,0,1,1,4,4,2,4,4,2,1,3,3,2,3,0,3,2,2,0,1,1,} {5,6,3,6,5,4,4,3,4,4,5,1,5,4,3,0,2,0,5,6,3,6,5,4,4,3,4,4,5,1,5,4,3,0,2,0,}
};
ROT— shift— INV— 8— 3为第三次移位的位数, 贝' J
const Int ROT— shift— IN V— 8— 3 [4] [36] = //optimal
{
{0,0,0,1,1,1,2,2,2,2,0,2,2,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,0,2,2,0,0,0,0,},
{0,1,1,2,1,0,1,1,0,0,0,1,0,0,0,1,0,1,0,1,1,2,1,0,1,1,0,0,0,1,0,0,0,1,0,}, {0,0,0,3,1,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,3,1,0,0,1,0,0,0,1,0,0,0,0,0,},
{2,0,3,1,3,0,1,0,2,1,0,1,2,0,0,0,0,4,2,0,3,1,3,0,1,0,2,1,0,1,2,0,0,0,0,},
};
ROT— shift— INV— 8— 4为第四次移位的位数, 贝' J
const Int ROT— shift— INV— 8— 4 [4] [36] =
{
0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,}
Figure imgf000025_0001
};
sign— INV— 8—1 为逆变换矩阵第一次移位 ROT— shift— INV— 8—1 的符号位, const Int sign— INV— 8—1 [4] [36] = II optimal
{
1,1,-1,1,1,1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,1,1,1,},
{1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1 ,-1,1,1,1,}, {1,-1, 1,
1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,},
{1,-1, 1,
1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,},
};
sign— INV— 8— 2为逆变换矩阵第二次移位 ROT— shift— INV— 8— 2的符号位, 则
const Int sign— INV— 8— 2 [4] [36] = //optimal
{
{-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1, 1,-1,1,-1,},
{-1,1,1,-1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,-1,1,-1,1,1
{-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,0,-1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1 ,1,0,-1,1,},
{1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,0,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,0,
-1,1,},
};
sign— INV— 8— 3为逆变换矩阵第二次移位 ROT— shift— INV— 8— 3的符号位, 则
const Int sign— INV— 8— 3 [4] [36] =
{
{-i,o,o,-i,-i,i,i,-i,-i,-i,-i,o,i,-i,-i,o,o,o,-i,o,o,-i,-i,i,i,-i,-i,-i,-i,o,i,-i,-
1,0,0,0,},
{1,1,-1,-1,-1,-1,-1,-1,1,0,1,0,1,1,0,0,-1,1,1,1,-1,-1,-1,-1,-1,-1,1,0,1,0,1,1,0,0,
-1,1,},
{I,-I,O,I,-I,-I,I,-I,-I,O,-I,O,-I,I,O,O,-I,O,I,-I,O,I,-I,-I,I,-I,-I,O,-I,O,-I,I,O,
0,-1,0,},
{1,1,-1,-1,-1,-1,1,1,0,-1,-1,0,-1,1,-1,0,-1,0,1,1,-1,-1,-1,-1,1,1,0,-1,-1,0,-1,1,- 1,0,-1,0,}, /3/:ϋ O I6ss0nl£ 6εοίAV
ς
ς I
Figure imgf000027_0001
^
9901lo∞016A£∞09I1SIzi」-」」
} 0£ '{Wi'o'i ^W '^' 'sVi ^o'i'o'i' Wo' W 'sVi'o'o} oe '{'O'O'O'IV^O^VO'S'O^V^O'^O'O'O'O'IV^O^VO'S'O^V^O'^O}
} fii ' m ^ ¾ Ύ ^ ~2~α/Αά— qs—丄 ea
■{ ςζ
'{'iVoV9'9' 's'9' '9V V V9'8'iVoV9'9' 's'9' '9V V V9'8}
'{ Vi'oVs'^Vi's's' 'iW Vs' Vi'oVs^Vi's's' V V 'i's}
'{Vs' O' 's' Vi'9'sV9' 's's' '9'^s' 'o' 's' Vi'9'sV9' 's's' '9}
'{' '^oV9'9O'9'9'9' 's's'9's'i' O' ^OV9'9O'9'9'9' 's's'9's'i' O}
} oz
I腿 μάο// =[9£][ ]£~ ~Q/Ad—輕—丄 O — ; suoo
'{'ς'9'0' '8'6 '6'8'8' '8'8'6'0ΐ' '0ΐ'6'ς'9'0' '8'6 '6'8'8' '8'8'6'0ΐ' '0ΐ'6}
'{VS'^9'9' ' ' 'S' ' '9' '8'8'9'8'8'^S'^9'9' ' ' 'S'^'9' '8'8'9'8'8} \
'{'L'L'L'L'L'L' '9' 'S'6'L'S 'L'S' 'L'L'L'L'L'L'L' '9' 'S'6'L'S'6'L'S' 'L}
'{V ' '6' '8'8'6' '6'8' W9V V '8'6V6'8'8'6' '6'8' W9}
}
Figure imgf000028_0001
isuoo
'{'zVe'i'e'zViVL'u'zV '0ΐ'0ΐ'0ΐ'ΐΐ'ΐΐ'8'ΐΐ'ΐΐ'π'6'ε'6'π'ΐΐ' 'ΐΐ'π'π'0ΐ'0ΐ'0ΐ'ΐΐ'ΐΐ'8'ΐΐ'ΐΐ}
'{' '6'9'6' '6' '6
'π' '0ΐ' '0ΐ'π'0ΐ'8'0ΐ'π'π'6'9'6'π'6' '6'π'π'0ΐ' '0ΐ' ΐ'0ΐ'8'0ΐ'π} 9
'{' '0ΐ'8'0ΐ'π'8'8'6'π' ΐ'0ΐ'6'0ΐ' '0ΐ'0ΐ'0ΐ'π'π'0ΐ'8'0ΐ'π'8'8'6'π'π'0ΐ'6'0ΐ' ΐ'0ΐ'0ΐ'0ΐ'π} ΐΐ'π'π'0ΐ'6'0ΐ'π'8'6'6' 'π'8' '6'π'ΐΐ' 'ΐΐ'π'π'0ΐ'6'0ΐ'π'8'6'6'π}
91
T6SZ80/llOZN3/X3d 6£9 60 Ζ OAV {1,2,0,1,4,1,2,1,2,0,2,0,1,0,0,0,1,1,1,2,0,1,4,1,2,1,2,0,2,0,1,0,0,0,1,1,}, {5,4,0,5,2,4,0,3,0,0,3,0,3,5,2,0,1,0,5,4,0,5,2,4,0,3,0,0,3,0,3,5,2,0,1,0,},
} ;
ROT— shift— FWD 8 5为正变换矩阵第五次移位的位数, 贝' J
const Int ROT— shift— FWD_8_5[4][36]=
{
{0,0,0,0,0,0,0,3,0,2,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,3,0,2,0,0,0,2,0,0,0,0,}, {0,0,0,0,2,0,0,1,2,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,2,0,1,0,0,0,0,0,0,0,},
{0,0,0,0,2,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,1,0,0,0,0,0,0,0,},
{3,1,0,4,1,3,0,0,0,0,0,0,1,2,0,0,0,0,3,1,0,4,1,3,0,0,0,0,0,0,1,2,0,0,0,0,},
};
sign— FWD— 8—1为正变换矩阵第一次移位 ROT— shift— FWD— 8—1的符号位, 则
const Int sign— FWD— 8— 1 [4][36]=
{
{1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,1,1,1
},
{1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1 ,-1,1,1,1 },
{1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1, {1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,
1,1,-1 },
};
sign— FWD— 8— 2为正变换矩阵第二次移位 ROT— shift— FWD— 8— 2的符号位 , 则
const Int— FWD— sign— 8— 2 [4] [36]= //optimal
{
{-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1, 1,-1,1,-1,}, {-1,1,1,-1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,-1,1,-1,1,1
,-ι,-ι,},
{-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,- 1,1,1,-1,-1,1,},
{1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,0,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,0,
-1,1,},
};
sign— FWD— 8— 3 为正变换矩阵第三次移位 ROT— shift— FWD— 8— 3 的符号 位, 则
const Int— sign— FWD— 8— 3 [4] [36]= //optimal
{
{0,-1,1,-1,-1,1,1,-1,-1,-1,-1,0,1,-1,-1,0,1,-1,0,-1,1,-1,-1,1,1,-1,-1,-1,-1,0,1,-1, -1,0,1,-1,},
{-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1, -1,1,-1,-1,-1,1,},
{1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,0,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1, 1,0,-1,-1,1,},
{1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,0,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1 ,1,-1,0,-1,-1,},
};
sign— FWD— 8— 4为正变换矩阵第四次移位 ROT— shift— FWD— 8— 4的符号 位, 则
const Int_sign_FWD_8_4[4][36]=
{
{ο,-ι,ο,ι,ι,-ι,ο,ι,ι,-ι,-ι,ο,-ι,-ι,ι,ο,-ι,ο,ο,-ι,ο,ι,ι,-ι,ο,ι,ι,-ι,-ι,ο,-ι,-ι,ι,ο,
-1,0,},
{o,o,-i,-i,i,i,-i,-i,-i,o,i,-i,i,i,o,-i,o,i,o,o,-i,-i,i,i,-i,-i,-i,o,i,-i,i,i,o,-i
,0,1,},
{i,i,o,i,i,i,-i,i,-i,o,-i,o,i,o,o,o,i,-i,i,i,o,i,i,i,-i,i,-i,o,-i,o,i,o,o,o,i,-i, {-1,1,1,-1,-1,1,0,-1,0,0,-1,0,1,1,-1,0,-1,0,-1,1,1,-1,-1,1,0,-1,0,0,-1,0,1,1,-1,0,
-ι,ο,},
};
sign— FWD— 8— 5为正变换矩阵第五次移位 ROT— shift— FWD— 8— 5的符号位, 则
const Int— sign— FWD— 8— 5 [4] [36]=
{
{O,I,O,I,-I,-I,O,-I,O,I,I,O,O,-I,O,O,O,O,O,I,O,I,-I,-I,O,-I,O,I,I,O,O,-I,O,O,O,O,
},
{0,0,0,0,-1,0,1,-1,-1,0,1,1,-1,0,0,0,0,0,0,0,0,0,-1,0,1,-1,-1,0,1,1,-1,0,0,0,0,0,
},
{0,0,0,0,-1,1,0,1,-1,0,-1,0,0,0,0,0,0,0,0,0,0,0,-1,1,0,1,-1,0,-1,0,0,0,0,0,0,0,}, {-1,-1,0,-1,-1,1,0,-1,0,0,1,0,1,-1,1,0,0,0,-1,-1,0,-1,-1,1,0,-1,0,0,1,0,1,-1,1,0,0
,0,},
};
第三种组合方式: 正变换矩阵仍然采用 5位量化, 逆变换矩阵仍然采用 4 位量化。 与第二种组合方式的不同在于, 其中符号位仅能用 1或 -1表示, 也就 是符号位不取零。
其中, g—FWD— ROT— MATRIX— 8为对应的使用 5位近似量化的正变换矩 阵, 其四组变换矩阵系数为:
const Int g—FWD— ROT— MATRIX— 8 [4] [36]=
{
{4032,-587,-494,357,3791,-1509,672,1432,3777,3762,-1603,48,1597,3756, -397,112,387,4073,4032,-587,-494,357,3791,-1509,672,1432,3777,3762,-1603,48, 1597,3756,-397,112,387,4073,},
{3903,-983,-802,-1200,-3684,-1335,-403,1498,-3788,4062,-426,-299,359,3 978,-897,374,864,3988,3903,-983,-802,-1200,-3684,-1335,-403,1498,-3788,4062,- 426,-299,359,3978,-897,374,864,3988,},
{3874,-1292,200,1298,3724,-1133,180,1123,3930,4048,-662,-139,-669,-40 16,-448,-70,466,-4074,3874,-1292,200,1298,3724,-1133,180,1123,3930,4048,-662, '{Vs' O' 's' Vi'9'sV9' 's's' '9'^s' 'o' 's' Vi'9'sV9' 's's' '9} oe
'{ 'l 9W9'9'9 S'S'9'S'l' '0' 'l'0V9'9'0'9 'S'S'9'S'l' '0}
} fii ' m ^ ¾ ΤΓ ^ £~2~α/Αά— qs—丄 era
{ ςζ
'{'ς'9'0' '8'6 ' 6'8'8' '8'8'6'0ΐ' '0ΐ'6'ς'9'0' '8'6 '6'8'8' '8'8'6'0ΐ' '0ΐ'6}
'{VS'^9'9' ' ' 'S' ' '9' '8'8'9'8'8'^S'^9'9' ' ' 'S'^'9' '8'8'9'8'8}
'{'L'L'L'L'L'L' '9' 'S'6'L'S 'L'S' 'L'L'L'L'L'L'L' '9' 'S'6'L'S'6'L'S' 'L}
'{V ' '6' '8'8'6' '6'8' W9V V '8'6V6'8'8'6' '6'8' W9}
} OZ
Figure imgf000032_0001
~URs"io¾";ui; suoo
fii ' m ^ ― ¾ Ύ ^ ζ~2~α/Αά— qs—丄 era
'{'zVe'i'e'zViVL'u'zV π'0ΐ'0ΐ'0ΐ'ΐΐ'ΐΐ'8'ΐΐ'ΐΐ'π'6'ε'6'π'ΐΐ' 'ΐΐ'π'π'0ΐ'0ΐ'0ΐ'ΐΐ'ΐΐ'8'ΐΐ'ΐΐ} 91
'{' '6'9'6' '6' '6
'π' '0ΐ' '0ΐ'π'0ΐ'8'0ΐ'π'π'6'9'6'π'6' '6'π'π'0ΐ' '0ΐ' ΐ'0ΐ'8'0ΐ'π}
'{' '0ΐ'8'0ΐ'π'8'8'6'π' ΐ'0ΐ'6'0ΐ' '0ΐ'0ΐ'0ΐ'π'π'0ΐ'8'0ΐ'π'8'8'6'π'π'0ΐ'6'0ΐ' ΐ'0ΐ'0ΐ'0ΐ'π}
'{' '8' '6'π'ΐΐ' ' Οΐ ΐΐ'π'π'0ΐ'6'0ΐ'π'8'6'6' 'π'8' '6'π'ΐΐ' 'ΐΐ' ΐ'π'0ΐ'6'0ΐ'π'8'6'6'π}
}
Figure imgf000032_0002
—輕—丄 O — iui; suoo
fii ' ^ ^H^— ¥ Γ8—L J— qs—丄 era
■{ ς
'{'ί90 -'6Ζ '2'£0 -'2 ί£-'06ς\-'ζς\-'ς SI-'9 '^ 8 ' 0^l'l8 'l8 i-'8 S^968^69 'l66^-'9 ^90l-'6^l'8' 0l-'8l
-'06SI-'^I-'^SI-'9 ^ 8 ' 0^I^8 ^8 i-'8 S^968^69 ^66^-'9^}
'V L0 -'99 '0L-'S -'910 -'699-'6£\-
T6SZ80/llOZN3/X3d 6£9 60 Z OAV {5,4,3,4,7,4,3,5,5,4,4,1,5,4,0,1,4,2,5,4,3,4,7,4,3,5,5,4,4,1,5,4,0,1,4,2,}, {8,6,4,7,4,7,4,6,3,6,5,3,6,6,4,0,4,1,8,6,4,7,4,7,4,6,3,6,5,3,6,6,4,0,4,1,},
}
ROT— shift— FWD 8 4为正变换矩阵第四次移位的位数, 贝' J
const Int ROT— shift— FWD_8_4[4][36]=
{
{0,1,0,2,4,2,0,5,0,4,2,0,1,4,1,0,0,0,0,1,0,2,4,2,0,5,0,4,2,0,1,4,1,0,0,0,}, {0,0,1,4,5,3,1,2,3,0,2,1,3,1,0,1,0,2,0,0,1,4,5,3,1,2,3,0,2,1,3,1,0,1,0,2,},
{1,2,0,1Λ1,2,1,2,0,2,0,1,0,0,0,1, 1,1,2,0,1,4,1,2,1,2,0,2,0,1,0,0,0,1,1,}, {5,4,0,5,2,4,0,3,0,0,3,0,3,5,1,0,1,0,5,4,0,5,2,4,0,3,0,0,3,0,3,5,1,0,1,0,},
}
ROT— shift— FWD 8 5为正变换矩阵第五次移位的位数, 贝' J
const Int ROT— shift— FWD_8_5[4][36]=
{
{0,0,0,0,0,0,0,3,0,1,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,3,0,1,0,0,0,2,0,0,0,0,}, {0,0,0,0,2,0,0,1,2,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,2,0,1,0,0,0,0,0,0,0,},
{0,0,0,0,2,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,1,0,1,0,0,0,0,0,0,0,},
{3,1,0,4,1,3,0,0,0,0,0,0,1,2,0,0,0,0,3,1,0,4,1,3,0,0,0,0,0,0,1,2,0,0,0,0,},
};
sign— FWD— 8—1为正变换矩阵第一次移位 ROT— shift— FWD— 8—1的符号位, const Int sign— FWD— 8— 1[4][36]=
{
{ i,- 1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,1,1,1 ,},
{ i,- 1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1
,-1,1,1,1,},
{l 1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1, -1,1,-1,},
{1,- 1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1 1,1,-1,},
};
sign— FWD— 8— 2为正变换矩阵第二次移位 ROT— shift— FWD— 8— 2的符号位, 则
const Int sign— FWD— 8— 2 [4] [36]=
{
{-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1, 1,-1,1,-1,},
{-1,1,1,-1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,-1,1,-1,1,1
{-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,- 1,1,1,-1,-1,1,},
{1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,- 1,-1,1,},
};
sign— FWD— 8— 3 为正变换矩阵第三次移位 ROT— shift— FWD— 8— 3 的符号 位, 则
const Int sign— FWD— 8— 3 [4] [36]=
{
{-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1 ,-1,-1,1,1,-1,} ,
{-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1, -1,1,-1,-1,-1,1,},
{1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,-1 ,1,-1,-1,-1,1,},
{1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,-1,-1,- 1,1,-1,-1,-1,-1,},
};
sign— FWD— 8— 4为正变换矩阵第四次移位 ROT— shift— FWD— 8— 4的符号位, const Int sign— FWD— 8— 4[4][36]=
{
{-1,-1,1,1,1,-1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,1,-1,-1,1,1,1,-1,-1,1,1,-1,-1,1,-1,-1, 1,-1,1,1,},
{-1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,1,- 1,-1,-1,1,},
{1,1,-1,1,1,1,-1,1,-1,1,-1,-1,1,1,1,1,1,1,1,1,-1,1,1,1,-1,1,-1,1,-1,-1,1,1,1,1,1,1
,},
{-1,1,1,-1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,-1,1,-1,-1,-1,1,-1,1,1,1, -1,-1,-1,-1,},
};
sign— FWD— 8— 5为正变换矩阵第五次移位 ROT— shift— FWD— 8— 5的符号位, 则
const Int sign— FWD— 8— 5 [4] [36]=
{
{-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,- 1,1,-1,1,-1,},
{1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,- 1,-1,-1,-1,1,-1,},
{1,-1,-1,1,-1,1,1,1,-1,-1,-1,1,1,1,-1,1,-1,-1,1,-1,-1,1,-1,1,1,1,-1,-1,-1,1,1,1,-1,
{-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,1,-1,-1,-1,1,-1 ,1,-1,-1,-1,-1,-1,},
};
其中, g—INV— ROT— MATRIX— 8为对应的使用 4位近似量化的逆变换矩阵, 其四组变换矩阵系数为:
const Int— g—INV— ROT— MATRIX— 8 [4] [36]=
{
{251,-36,-31,23,237,-94,42,90,236,236,-100,3,100,234,-25,7,24,255,251,-3 6,-31,23,237,-94,42,90,236,236,-100,3,100,234,-25,7,24,255,}, {243,-61,-50,-75,-230,-83,-25,94,-237,254,-27,-18,22,249,-56,24,54,249,24
3, -61,-50,-75,-230,-83,-25,94,-237,254,-27,-18,22,249,-56,24,54,249,},
{243,-81,12,81,232,-70,11,71,246,252,-41,-9,-42,-251,-28,-4,29,-254,243,-8 1,12,81,232,-70,11,71,246,252,-41,-9,-42,-251,-28,-4,29,-254,},
{174,-186,23,182,158,-87,49,75,240,236,-99,-10,-99,-235,-25,1,27,-255,17
4, -186,23,182,158,-87,49,75,240,236,-99,-10,-99,-235,-25,1,27,-255,},
};
ROT— shift— INV— 8— m 为逆变换第 m次移位的位数, ROT— shift— INV— 8—1 为第一次移位的位数, 则
const Int ROT— shift— INV— 8—1 [4] [36] =
{
{8,5,5,4,8,6,5,6,8,8,7,1,7,8,5,3,4,8,8,5,5,4,8,6,5,6,8,8,7,1,7,8,5,3,4,8,}, {8,6,6,6,8,6,5,6,8,8,5,4,4,8,6,4,6,8,8,6,6,6,8,6,5,6,8,8,5,4,4,8,6,4,6,8,}, {8,6,3,6,8,6,3,6,8,8,5,3,5,8,5,2,5,8,8,6,3,6,8,6,3,6,8,8,5,3,5,8,5,2,5,8,}, {7,7,4,7,7,6,6,6,8,8,7,3,7,8,5,0,5,8,7,7,4,7,7,6,6,6,8,8,7,3,7,8,5,0,5,8,},
};
ROT— shift— INV— 8— 2为第二次移位的位数, 贝' J
const Int ROT— shift— INV— 8— 2 [4] [36] =
{
{2,2,0,3,4,5,3,5,4,4,5,0,5,4,3,0,3,0,2,2,0,3,4,5,3,5,4,4,5,0,5,4,3,0,3,0,}, {4,1,4,3,5,4,3,5,4,1,2,1,2,3,3,3,3,3,4,1,4,3,5,4,3,5,4,1,2,1,2,3,3,3,3,3,} {4,4,2,4,4,2,1,3,3,2,3,0,3,2,2,0,1,1,4,4,2,4,4,2,1,3,3,2,3,0,3,2,2,0,1,1,}, {5,6,3,6,5,4,4,3,4,4,5,1,5,4,3,0,2,0,5,6,3,6,5,4,4,3,4,4,5,1,5,4,3,0,2,0,},
};
ROT— shift— INV— 8— 3为第三次移位的位数, 贝' J
const Int ROT— shift— IN V— 8— 3 [4] [36] = //optimal
{
{0,0,0,0,1,1,1,2,2,2,2,0,2,2,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,0,2,2,0,0,0,0,},
{1,0,1,1,2,1,0,1,1,0,0,0,1,0,0,0,1,0,1,0,1,1,2,1,0,1,1,0,0,0,1,0,0,0,1,0,}, {1,0,0,0,3,1,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,3,1,0,0,1,0,0,0,1,0,0,0,0,0,}, {4,2,0,3, 1,3,0,1,0,2,1,0,1,2,0,0,0,0,4,2,0,3, 1,3,0,1,0,2,1,0,1,2,0,0,0,0,},
}
ROT— shift— INV— 8— 4为第四次移位的位数, 贝' J
const Int ROT— shift— INV— 8— 4 [4] [36] = II optimal 0.4
{
o,o,o,o,o,o,o,i,o,o,o,o,o,i,o,o,o,o,o,o,o,o,o,o,o,i,o,o,o,o,o,i,o,o,o,o,};
Figure imgf000037_0001
}
sign— INV— 8—1 为逆变换矩阵第一次移位 ROT— shift— INV— 8—1 的符号位, const Int sign— INV— 8—1 [4] [36] = II optimal
{
{1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,1,1,-1,1,1,1
{1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1 ,-1,1,1,1,},
{1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1, -1,1,-1,},
{1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,1,1,1,-1,-1,-1,-1,-1, 1,1,-1,},
};
sign— INV— 8— 2为逆变换矩阵第二次移位 ROT— shift— INV— 8— 2的符号位, 则
const Int sign— INV— 8— 2 [4] [36] = //optimal
{
{-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1, 1,-1,1,-1;
{-1,1,1,-1,1,-1,1,1,1,-1,1,-1,1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,1,1,-1,1,-1,1,-1,1,1 ,-1,-1;
{-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1 ,1,1,-1,1;
{1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,1,-1,1,1,1,1, -1,1;] sign— INV— 8— 3为逆变换矩阵第二次移位 ROT— shift— INV— 8— 3的符号位, 则
const Int sign— INV— 8— 3 [4] [36] =
{
{-1,1,1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,1,1,-1,1,1,-1,-1,1,1,-1,-1,-1,-1,1,1,-1,-1,1,
1,1;
{1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,1,1,1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1,-1,1; {1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,1,1,1,-1, 1;
{1,1,-1,-1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,1,-1,1,1,1,-1,-1,-1,-1,1,1,1,-1,-1,1,-1,1,-1,1,- 1,1;]
};
sign— INV— 8— 4为逆变换矩阵第二次移位 ROT— shift— INV— 8— 4的符号位, 则
const Int sign— INV— 8— 4 [4] [36] =
{
{1,1,1,1,-1,1,1,-1,1,1,1,1,1,-1,1,1,1,1,1,1,1,1,-1,1,1,-1,1,1,1,1,1,-1,1,1,1,1,}, {1,1,1,-1,-1,-1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-1,-1,-1,1,1,1,1,1,1,1,1,1,1,1,1,}, {1,1, 1, 1,1, 1,1, 1,1, 1,1, 1,1,1, 1,1,1,1, 1,1, 1,1,1, 1,1,1, 1,1,1,1,1,1,1,1,1, 1,},
{-1,1,1,-1,1,1,1,1,1,1,-1,1,-1,1,1,1,1,1,-1,1,1,-1,1,1,1,1,1,1,-1,1,-1,1,1,1,1,1,},
};
与本申请编码方和解码方法的实施例相对应,本申请还提供了编码装置和 解码装置的实施例。
参见图 6, 为本申请编码装置的实施例框图: 该编码装置包括: DCT变换单元 610、 ROT正变换单元 620、 量化单元
630、 比较单元 640和编码单元 650。
其中, DCT变换单元 610, 用于对输入信号进行 DCT变换;
ROT正变换单元 620, 用于将 DCT变换后的输入信号按照预设的若干组 ROT正变换矩阵分别进行 ROT正变换, 得到 ROT正变换后的变换系数, 所 述 ROT正变换矩阵中的每个系数能够分解为若干个移位系数, 每个移位系数 由一个移动位和一个符号位组成;
量化单元 630, 用于对所述 ROT正变换后的变换系数进行量化; 比较单元 640, 用于比较根据每一组量化后的变换系数计算得到的输出信 号的失真情况;
编码单元 650, 用于选择失真最小的输出信号所对应的 ROT正变换矩阵 为当前编码块的最优 ROT正变换矩阵,根据所述最优 ROT正变换矩阵进行编 码。
进一步, 所述 ROT正变换矩阵中的每个系数能够分解为与预设量化位数 一致的移位系数, 以使所述每个系数具有相同的移位系数。 在具体实现时, 该 编码装置还可以包括(图 6中未示出 ): 训练单元, 用于对于输入所述训练模 型的每个系数,按照预设量化位数重复训练流程, 获得与所述量化位数一致的 移位系数, 以使所述每个系数具有相同的移位系数。
具体的, ROT正变换单元 620可以包括(图 6中未示出):
信息获取单元, 用于对于所述 ROT正变换矩阵中的每一组正变换系数, 获取所述每一组正变换系数中组成每个系数的 N组移位系数的移动位和符号 位, 所述 N为自然数;
系数操作单元, 用于对于所述 N组移位系数中的第 M组移位系数, 根据 所述第 M组移位系数的移动位对 DCT变换后的矩阵系数进行移位操作,并对 所述第 M组移位系数的符号位进行判断, 根据所述判断结果获得移位操作的 中间结果;
第一累加单元, 用于将根据每个系数的第 M组移位系数获得的移位操作 的中间结果进行累加, 得到第 M个累加结果;
第二累加单元, 用于将所有 N个累加结果相加后, 得到每一组正变换系 数对所述 DCT变换后的输入信号进行 ROT正变换的变换系数。 参见图 7, 为本申请解码装置的实施例框图:
该解码装置包括: 获取单元 710、 ROT逆变换单元 720、 DCT反变换单元 730和解码单元 740。
其中, 获取单元 710, 用于从输入码流中获取编码过程中得到的量化后的 变换系数;
ROT逆变换单元 720, 用于对所述量化后的变换系数按照预设的若干组 ROT逆变换矩阵分别进行 ROT逆变换, 获得 DCT变换后的矩阵系数, 所述 ROT逆变换矩阵中的每个系数能够分解为若干个移位系数, 每个移位系数由 一个移动位和一个符号位组成;
DCT反变换单元 730,用于对所述 DCT变换后的矩阵系数进行 DCT反变 换;
解码单元 740, 用于根据所述 DCT反变换后的矩阵系数进行解码。
进一步, 所述 ROT逆变换矩阵中的每个系数能够分解为与预设量化位数 一致的移位系数, 以使所述每个系数具有相同的移位系数。 在具体实现时, 该 编码装置还可以包括(图 7中未示出 ): 训练单元, 用于对于输入所述训练模 型的每个系数,按照预设量化位数重复训练流程, 获得与所述量化位数一致的 移位系数, 以使所述每个系数具有相同的移位系数。
具体的, ROT逆变换单元 720可以包括(图 7中未示出 ):
信息获取单元, 用于对于所述 ROT逆变换矩阵中的每一组逆变换系数, 获取所述每一组逆变换系数中组成每个系数的 N组移位系数的移动位和符号 位, 所述 N为自然数;
系数操作单元, 用于对于所述 N组移位系数中的第 M组移位系数, 根据 所述第 M组移位系数的移动位对量化后的变换系数进行移位操作, 并对所述 第 M组移位系数的符号位进行判断, 根据所述判断结果获得移位操作的中间 结果;
第一累加单元, 用于将根据每个系数的第 M组移位系数获得的移位操作 的中间结果进行累加, 得到第 M个累加结果;
第二累加单元, 用于将所有 N个累加结果相加后, 得到每一组逆变换系 数对所述量化后的变换系数进行 ROT逆变换的变换系数。
通过对以上实施方式的描述可知,本申请实施例在实现编码和解码过程中 的 ROT变换操作时,由于按照预设训练模型预先对 ROT变换矩阵中的系数进 行了训练, 因此可以根据训练结果在进行 ROT变换的硬件实现时, 将乘法操 作转换为移位操作和加法操作, 由于无需设计大量乘法器进行乘法操作, 因此 减少了硬件实现的复杂性, 以及 ROT变换所需要的时钟数; 并且由于 ROT变 换矩阵中的每个系数经过训练后,在计算过程中所需要的移位次数和加法次数 均一致, 即每个系数在进行乘法操作时所需要的时钟数一致, 因此与现有技术 相比, 不会造成编解码过程中运算资源的浪费, 提高了运算效率。
本领域的技术人员可以清楚地了解到本发明实施例中的技术可借助软件 加必需的通用硬件平台的方式来实现。基于这样的理解, 本发明实施例中的技 术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现 出来, 该计算机软件产品可以存储在存储介质中, 如 ROM/RAM、 磁碟、 光盘 等, 包括若干指令用以使得一台计算机设备(可以是个人计算机, 服务器, 或 者网络设备等)执行本发明各个实施例或者实施例的某些部分所述的方法。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相 似的部分互相参见即可, 每个实施例重点说明的都是与其他实施例的不同之 处。 尤其, 对于系统实施例而言, 由于其基本相似于方法实施例, 所以描述的 比较筒单, 相关之处参见方法实施例的部分说明即可。
以上所述的本发明实施方式, 并不构成对本发明保护范围的限定。任何在 本发明的精神和原则之内所作的修改、等同替换和改进等, 均应包含在本发明 的保护范围之内。

Claims

权 利 要 求
1、 一种编码方法, 其特征在于, 包括:
对输入信号进行离散余弦变换 DCT变换;
将 DCT变换后的输入信号按照预设的若干组旋转变换 ROT正变换矩阵分 别进行 ROT正变换, 得到 ROT正变换后的变换系数, 所述 ROT正变换矩阵 中的每个系数能够分解为若干个移位系数,每个移位系数由一个移动位和一个 符号位组成;
对所述 ROT正变换后的变换系数进行量化后, 比较根据每一组量化后的 变换系数计算得到的输出信号的失真情况;
选择失真最小的输出信号所对应的 ROT正变换矩阵为当前编码块的最优
ROT正变换矩阵, 根据所述最优 ROT正变换矩阵进行编码。
2、根据权利要求 1所述的方法, 其特征在于, 所述若干组 ROT正变换矩 阵具体为四组 ROT正变换矩阵;
所述 ROT正变换矩阵中的每个系数能够分解为若干个移位系数包括: 所述 ROT正变换矩阵中的每个系数能够分解为与预设量化位数一致的移 位系数, 以使所述每个系数具有相同的移位系数。
3、 根据权利要求 2所述的方法, 其特征在于, 所述预设量化位数为 5 , 所述四组 ROT正变换矩阵均为 8 x 8矩阵, 所述四组 ROT正变换矩阵的系数 包括:
第一组为:
4008,-624,-560,352,3728,-1560,656,1408,3688,3728,-1548,44,1541,3688,-390,108 ,380,4074,4008,-624,-560,352,3728,-1560,656,1408,3688,3728,-1548,44,1541,368 8,-390,108,380,4074;
第二组为:
3888,-1008,-799,-1160,-3588,-1284,-352,1648,-3696,4058,-456,-289,372,3967,-92 8,377,864,3982,3888,-1008,-799,-1160,-3588,-1284,-352,1648,-3696,4058,-456,-2 89,372,3967,-928,377,864,3982;
第三组为:
3870,-1278,184,1278,3728,-1144,184,1144,3887,4016,-752,-152,-771,-3965,- 441,-57,464,-4076,3870,-1278,184,1278,3728,-1144,184,1144,3887,4016,-752,-15 2,-771,-3965,-441,-57,464,-4076;
第四组为:
2572,-2848,420,2688,2512,-1408,816,1286,3774,3728,-1535,-154,-1551,-368 0,-412,6,424,-4066,2572,-2848,420,2688,2512,-1408,816,1286,3774,3728,-1535,-1 54,-1551,-3680,-412,6,424,-4066。
4、 根据权利要求 1所述的方法, 其特征在于, 按照预设的一组 ROT正变 换矩阵进行 ROT正变换包括:
对于所述 ROT正变换矩阵中的每一组正变换系数, 获取所述每一组正变 换系数中组成每个系数的 N组移位系数的移动位和符号位,所述 N为自然数; 对于所述 N组移位系数中的第 M组移位系数,根据所述第 M组移位系数 的移动位对 DCT变换后的矩阵系数进行移位操作,并对所述第 M组移位系数 的符号位进行判断, 根据所述判断结果获得移位操作的中间结果;
将根据每个系数的第 M组移位系数获得的移位操作的中间结果进行累 加, 得到第 M个累加结果;
将所有 N个累加结果相加后, 得到每一组正变换系数对所述 DCT变换后 的矩阵系数进行 ROT正变换的变换系数。
5、 一种编码装置, 其特征在于, 包括:
DCT变换单元, 用于对输入信号进行离散余弦变换 DCT变换;
ROT正变换单元, 用于将 DCT变换后的输入信号按照预设的若干组旋转 变换 ROT正变换矩阵分别进行 ROT正变换,得到 ROT正变换后的变换系数, 所述 ROT正变换矩阵中的每个系数能够分解为若干个移位系数, 每个移位系 数由一个移动位和一个符号位组成;
量化单元, 用于对所述 ROT正变换后的变换系数进行量化;
比较单元,用于比较根据每一组量化后的变换系数计算得到的输出信号的 失真情况;
编码单元, 用于选择失真最小的输出信号所对应的 ROT正变换矩阵为当 前编码块的最优 ROT正变换矩阵, 根据所述最优 ROT正变换矩阵进行编码。
6、根据权利要求 5所述的装置, 其特征在于, 所述若干组 ROT正变换矩 阵具体为四组 ROT正变换矩阵; 所述 ROT正变换单元用于将所述 ROT正变换矩阵中的每个系数能够分解 为若干个移位系数具体为: 用于将所述 ROT正变换矩阵中的每个系数能够分 解为与预设量化位数一致的移位系数, 以使所述每个系数具有相同的移位系 数。
7、根据权利要求 5所述的装置,其特征在于,所述 ROT正变换单元包括: 信息获取单元, 用于对于所述 ROT正变换矩阵中的每一组正变换系数, 获取所述每一组正变换系数中组成每个系数的 N组移位系数的移动位和符号 位, 所述 N为自然数;
系数操作单元, 用于对于所述 N组移位系数中的第 M组移位系数, 根据 所述第 M组移位系数的移动位对 DCT变换后的矩阵系数进行移位操作,并对 所述第 M组移位系数的符号位进行判断, 根据所述判断结果获得移位操作的 中间结果;
第一累加单元, 用于将根据每个系数的第 M组移位系数获得的移位操作 的中间结果进行累加, 得到第 M个累加结果;
第二累加单元, 用于将所有 N个累加结果相加后, 得到每一组正变换系 数对所述 DCT变换后的输入信号进行 ROT正变换的变换系数。
8、 一种解码方法, 其特征在于, 包括:
从输入码流中获取编码过程中得到的量化后的变换系数;
对所述量化后的变换系数按照预设的若干组旋转变换 ROT逆变换矩阵分 别进行 ROT逆变换, 获得离散余弦变换 DCT变换后的矩阵系数, 所述 ROT 逆变换矩阵中的每个系数能够分解为若干个移位系数,每个移位系数由一个移 动位和一个符号位组成;
对所述 DCT变换后的矩阵系数进行 DCT反变换;
根据所述 DCT反变换后的矩阵系数进行解码。
9、根据权利要求 8所述的方法, 其特征在于, 所述若干组 ROT逆变换矩 阵具体为四组 ROT逆变换矩阵;
所述 ROT逆变换矩阵中的每个系数能够分解为若干个移位系数包括: 所述 ROT逆变换矩阵中的每个系数能够分解为与预设量化位数一致的移 位系数, 以使所述每个系数具有相同的移位系数。
10、 根据权利要求 8所述的方法, 其特征在于, 所述预设量化位数为 3 , 所述四组 ROT逆变换矩阵均为 8 x 8矩阵, 所述四组 ROT逆变换矩阵的系数 包括:
第一组为:
252,-36,-31,24,240,-94,48,96,240,240,-100,3,100,240,-25,7,24,255,252,-36,-3 1,24,240,-94,48,96,240,240,-100,3,100,240,-25,7,24,255;
第二组为:
244,-61,-50,-80,-232,-96,-25,94,-240,254,-28,-18,24,249,-56,24,56,249,244,-6 1,-50,-80,-232,-96,-25,94,-240,254,-28,-18,24,249,-56,24,56,249;
第三组为:
244,-80,12,80,232,-72,12,72,248,252,-48,-9,-48,-252,-28,-4,29,-254,244,-80,1 2,80,232,-72,12,72,248,252,-48,-9,-48,-252,-28,-4,29,-254;
第四组为:
192,-192,24,192,160,-96,49,80,240,240,-100,-10,-100,-240,-25,1,28,-255,192, -192,24,192,160,-96,49,80,240,240,-100,-10,-100,-240,-25,1,28,-255。
11、 根据权利要求 8所述的方法, 其特征在于, 按照预设的一组 ROT逆 变换矩阵进行 ROT逆变换包括:
对于所述 ROT逆变换矩阵中的每一组逆变换系数, 获取所述每一组逆变 换系数中组成每个系数的 N组移位系数的移动位和符号位,所述 N为自然数; 对于所述 N组移位系数中的第 M组移位系数,根据所述第 M组移位系数 的移动位对量化后的变换系数进行移位操作, 并对所述第 M组移位系数的符 号位进行判断, 根据所述判断结果获得移位操作的中间结果;
将根据每个系数的第 M组移位系数获得的移位操作的中间结果进行累 加, 得到第 M个累加结果;
将所有 N个累加结果相加后, 得到每一组逆变换系数对所述量化后的变 换系数进行 ROT逆变换的变换系数。
12、 一种解码装置, 其特征在于, 包括:
获取单元, 用于从输入码流中获取编码过程中得到的量化后的变换系数; 旋转变换 ROT逆变换单元, 用于对所述量化后的变换系数按照预设的若 干组 ROT逆变换矩阵分别进行 ROT逆变换, 获得离散余弦变换 DCT变换后 的矩阵系数,所述 ROT逆变换矩阵中的每个系数能够分解为若干个移位系数, 每个移位系数由一个移动位和一个符号位组成;
DCT反变换单元, 用于对所述 DCT变换后的矩阵系数进行 DCT反变换; 解码单元, 用于根据所述 DCT反变换后的矩阵系数进行解码。
13、 根据权利要求 12所述的装置, 其特征在于, 所述若干组 ROT正变换 矩阵具体为四组 ROT正变换矩阵;
所述 ROT正变换单元用于将所述 ROT正变换矩阵中的每个系数能够分解 为若干个移位系数具体为: 用于将所述 ROT逆变换矩阵中的每个系数能够分 解为与预设量化位数一致的移位系数, 以使所述每个系数具有相同的移位系 数。
14、 根据权利要求 12所述的装置, 其特征在于, 所述 ROT逆变换单元包 括:
信息获取单元, 用于对于所述 ROT逆变换矩阵中的每一组逆变换系数, 获取所述每一组逆变换系数中组成每个系数的 N组移位系数的移动位和符号 位, 所述 N为自然数;
系数操作单元, 用于对于所述 N组移位系数中的第 M组移位系数, 根据 所述第 M组移位系数的移动位对量化后的变换系数进行移位操作, 并对所述 第 M组移位系数的符号位进行判断, 根据所述判断结果获得移位操作的中间 结果;
第一累加单元, 用于将根据每个系数的第 M组移位系数获得的移位操作 的中间结果进行累加, 得到第 M个累加结果;
第二累加单元, 用于将所有 N个累加结果相加后, 得到每一组逆变换系 数对所述量化后的变换系数进行 ROT逆变换的变换系数。
PCT/CN2011/082591 2011-01-19 2011-11-22 编码方法、解码方法及装置 WO2012097639A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201110021893.4A CN102611883B (zh) 2011-01-19 2011-01-19 编码方法、解码方法及装置
CN201110021893.4 2011-01-19

Publications (1)

Publication Number Publication Date
WO2012097639A1 true WO2012097639A1 (zh) 2012-07-26

Family

ID=46515129

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/082591 WO2012097639A1 (zh) 2011-01-19 2011-11-22 编码方法、解码方法及装置

Country Status (2)

Country Link
CN (1) CN102611883B (zh)
WO (1) WO2012097639A1 (zh)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20010059970A (ko) * 1999-12-31 2001-07-06 이계철 이산여현변환을 위한 비동기식 매트릭스-벡터 곱셈기
CN1858998A (zh) * 2006-04-20 2006-11-08 上海交通大学 数字音频滤波器的无乘法实现方法
WO2009148858A2 (en) * 2008-05-30 2009-12-10 Microsoft Corporation Factorization of overlapping transforms into two block transforms

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8521540B2 (en) * 2007-08-17 2013-08-27 Qualcomm Incorporated Encoding and/or decoding digital signals using a permutation value

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20010059970A (ko) * 1999-12-31 2001-07-06 이계철 이산여현변환을 위한 비동기식 매트릭스-벡터 곱셈기
CN1858998A (zh) * 2006-04-20 2006-11-08 上海交通大学 数字音频滤波器的无乘法实现方法
WO2009148858A2 (en) * 2008-05-30 2009-12-10 Microsoft Corporation Factorization of overlapping transforms into two block transforms

Also Published As

Publication number Publication date
CN102611883B (zh) 2014-07-30
CN102611883A (zh) 2012-07-25

Similar Documents

Publication Publication Date Title
CA2653692C (en) Reduction of errors during computation of inverse discrete cosine transform
JP4924904B2 (ja) データフレームのシーケンスの効率的な符号化/復号
CN101796506B (zh) 具有比例缩放式和非比例缩放式接口的变换设计
TWI471013B (zh) 轉換式數位媒體編解碼器之計算複雜度及精確性控制
KR101362696B1 (ko) 하이브리드 아키텍쳐가 적용된 신호 변환 장치, 신호 변환 방법 및 기록매체
JP2007520948A5 (zh)
CN101584215B (zh) 综合空时预测
JP2007151131A (ja) ビデオまたはイメージのデータを復号化するための方法
TWI227840B (en) Method and apparatus for multiplying based on Booth's algorithm
JP2009512075A (ja) 信号およびデータ処理のための効率的な無乗算計算
KR20090007279A (ko) 공통 인수를 갖는 변환
CN108200439B (zh) 提高数字信号变换性能的方法及数字信号变换方法和装置
RU2009102250A (ru) Уменьшение ошибок во время вычисления обратного дискретного косинусного преобразования
WO2012097639A1 (zh) 编码方法、解码方法及装置
WO2023011005A1 (zh) 图像处理方法及装置、电子设备和存储介质
CN115442617A (zh) 一种基于视频编码的视频处理方法和装置
BRPI0713321B1 (pt) aproximações eficientes para ponto fixo de transformadas de cosseno discretas diretas e inversas
CN101729886B (zh) 一种视频解码方法、系统和设备
JP2008206211A5 (zh)
JP2008219291A5 (zh)
WO2012175033A1 (zh) 图像变换处理方法、设备和系统
CN206962992U (zh) 用于数字视频编解码的3乘3整数dct变换量化器
CN102413331A (zh) 图像或视频的编码方法
CN1642280B (zh) 图像和视频信号的变换装置及其方法
CN113286150B (zh) 用于视频编解码的变换编码硬件实现方法、装置及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11856571

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11856571

Country of ref document: EP

Kind code of ref document: A1