WO2008151570A1 - Method, device and system for coding and decoding - Google Patents
Method, device and system for coding and decoding Download PDFInfo
- Publication number
- WO2008151570A1 WO2008151570A1 PCT/CN2008/071255 CN2008071255W WO2008151570A1 WO 2008151570 A1 WO2008151570 A1 WO 2008151570A1 CN 2008071255 W CN2008071255 W CN 2008071255W WO 2008151570 A1 WO2008151570 A1 WO 2008151570A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- transform
- transformed
- parameter
- quantization
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 136
- 238000013139 quantization Methods 0.000 claims description 345
- 230000009466 transformation Effects 0.000 claims description 204
- 238000000844 transformation Methods 0.000 claims description 42
- 230000001131 transforming effect Effects 0.000 claims description 11
- 238000005457 optimization Methods 0.000 claims description 2
- 230000000694 effects Effects 0.000 abstract description 8
- 230000003044 adaptive effect Effects 0.000 abstract description 4
- 238000012545 processing Methods 0.000 description 45
- 239000011159 matrix material Substances 0.000 description 21
- 230000008569 process Effects 0.000 description 20
- 238000004364 calculation method Methods 0.000 description 17
- 238000010586 diagram Methods 0.000 description 10
- 230000006835 compression Effects 0.000 description 8
- 238000007906 compression Methods 0.000 description 8
- 230000008859 change Effects 0.000 description 6
- 108010001267 Protein Subunits Proteins 0.000 description 5
- 238000012937 correction Methods 0.000 description 5
- 238000006243 chemical reaction Methods 0.000 description 4
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 238000012805 post-processing Methods 0.000 description 2
- 238000003672 processing method Methods 0.000 description 2
- 108091026890 Coding region Proteins 0.000 description 1
- 101000674728 Homo sapiens TGF-beta-activated kinase 1 and MAP3K7-binding protein 2 Proteins 0.000 description 1
- 102100021227 TGF-beta-activated kinase 1 and MAP3K7-binding protein 2 Human genes 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000009795 derivation Methods 0.000 description 1
- 238000006073 displacement reaction Methods 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000011002 quantification Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000011426 transformation method Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/189—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding
- H04N19/19—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the adaptation method, adaptation tool or adaptation type used for the adaptive coding using optimisation based on Lagrange multipliers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/102—Methods 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/124—Quantisation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/60—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
Definitions
- the present invention relates to video compression coding techniques, and in particular, to a coding and decoding method, apparatus and system. Background technique
- transform is an important technology, which is to transform an image, image content and information in an area into a specific area, so that the video compression algorithm can more effectively perform this part of the content. Compression. Then, after the transform is performed, the data is quantized, entropy encoded, etc., and then the compressed and encoded video data is formed.
- video coding and decoding standards such as Moving Pictures Experts Group (MPEG) MPEG-2, H.264, and Digital Audio Video Codec Standard (AVS) use transform technology.
- MPEG Moving Pictures Experts Group
- AVS Digital Audio Video Codec Standard
- an area of an image or image is divided into small blocks or sub-areas called sub-blocks, and the transformation is performed in units of sub-blocks.
- the sub-block size can be 4x4 or 8x8, where 4 and 8 are in image pixels.
- a video file is composed of multiple video images, and an image usually contains a lot of content, and different parts of the image have different characteristics. Therefore, if all the images in a video or an image is divided into sub-blocks of the same size (such as 8x8 size) and then transformed, the effect may not be optimal, that is, all the sub-blocks cannot be effectively The contents of the block are effectively transformed into a specific area after being transformed. Based on this, an adaptive block transform technique is proposed.
- the principle is: divide a specific region according to different sub-block sizes, and then perform different transforms for sub-blocks of different sizes (for example, dividing the image into 4x4 and 8x8 blocks, 4x4 transforms for 4x4 blocks, 8x8 transforms for 8x8 blocks), and then according to certain criteria, which transforms can more effectively focus block information on specific regions in different transform situations. Finally, the better transformation results are stored.
- the decoding end decodes the image transformed by the above manner, the decoding end acquires the information of the transform scale (such as 4x4 or 8x8) according to the corresponding information in the code stream, and then uses the corresponding inverse transform (such as 4x4 inverse transform or 8x8 inverse transform). The area is processed to obtain the original video data.
- the 4x4 transform matrix is based on Discrete Cosine Transform (DCT), and the 8x8 transform is based on wavelet.
- DCT Discrete Cosine Transform
- the two sets of transform matrices probably do not have too many identical transform features, and the same data passes.
- the degree of change in the range of values of these transformed data is inconsistent. Since the quantization may result in the damage of the data information, whether the same or different quantization tables are used for quantization in the quantization process, since the same data is inconsistently changed after the different values are converted, the data after the transformation is quantized.
- the degree of loss is inconsistent. In this case, it is impossible to determine a better conversion method by using certain judgment criteria, so that the data coding efficiency cannot be effectively improved. Summary of the invention
- the embodiments of the present invention provide a coding and decoding method, apparatus, and system, so that the numerical ranges of data after different transformations are substantially consistent.
- An encoding method including:
- the adjustment parameters are written into the encoded code stream.
- a decoding method including:
- Receiving a code stream decoding the code stream, obtaining first transformed data and adjusting parameters; and adjusting the first transformed data according to the adjustment parameter and the second transformed parameter.
- An encoding device comprising:
- a data receiving unit configured to receive data to be transformed
- a transform unit configured to perform first transform on the data to be transformed received by the receiving unit, to obtain first transformed data, and perform second transform on the data to be transformed to obtain second transformed data
- the first adjusting unit determines an adjustment parameter according to the first transformed data and the second transformed data, and adjusts the first transformed data according to the adjustment parameter and the second transformed parameter.
- a decoding device comprising: a code stream receiving unit, configured to receive a code stream;
- a decoding unit configured to decode the code stream to obtain first transformed data and adjustment parameters
- a second adjusting unit configured to adjust the first transformed data according to the adjustment parameter and the second transformed parameter
- a codec system comprising: an encoding device and a decoding device;
- the encoding device includes:
- a data receiving unit configured to receive data to be transformed
- a transform unit configured to perform first transform on the data to be transformed received by the receiving unit, to obtain first transformed data, and perform second transform on the data to be transformed to obtain second transformed data
- the first adjusting unit determines an adjustment parameter according to the second transformed parameter, the first transformed data, and the second transformed data, and adjusts the first transformed data according to the adjustment parameter and the second transformed parameter.
- the decoding device includes:
- a code stream receiving unit configured to receive a code stream
- a decoding unit configured to decode the code stream to obtain first transformed data and adjustment parameters
- a second adjusting unit configured to adjust the first transformed data according to the adjustment parameter and the second transformed parameter
- An encoding method including:
- the adjustment parameters are written into the encoded code stream.
- An encoding device comprising:
- a third receiving unit configured to receive data to be transformed and encoded parameter information
- a third transforming unit configured to perform first transform on the data to be transformed received by the third receiving unit, to obtain first transformed data
- a third adjusting unit configured to determine an adjustment parameter according to the encoded parameter information received by the third receiving unit and the second transformed parameter, and adjust the third according to the adjustment parameter and the second transformed parameter The first transformed data obtained by the transform unit;
- a third writing unit configured to write the adjustment parameter obtained by the third adjusting unit into the encoded code stream.
- the adjustment parameter is first determined according to the first transformed data and the second transformed data, and the first transformation is adjusted according to the adjustment parameter and the second transformed parameter.
- the data is such that the first transformed data is consistent with the numerical range of the second transformed data, so that when the adaptive block transform technique is applied, the influence of the transform on the data can be truly reflected to select a better transform, and then Improve coding efficiency.
- the codec method and device provided by the present invention can ensure that the first transformed data range and the second transformed data range are consistent, and the adjustment parameters are written into the code stream, so that the decoding end can be adjusted according to the adjustment parameter.
- the received data is processed accordingly.
- FIG. 1 is a general flowchart of a method for processing transformed data according to an embodiment of the present invention
- FIG. 2 is a schematic structural diagram of a transform data processing apparatus according to an embodiment of the present invention.
- FIG. 3 is a specific flowchart of a method for processing transformed data according to Embodiment 1 of the present invention.
- FIG. 4 is a detailed structural diagram of a transform data processing apparatus according to Embodiment 1 of the present invention.
- FIG. 5 is a specific flowchart of a method for processing transformed data according to Embodiment 2 of the present invention.
- FIG. 6 is a specific flowchart of a method for processing transformed data according to Embodiment 3 of the present invention.
- FIG. 7 is a detailed structural diagram of a transform data processing apparatus according to Embodiment 3 of the present invention.
- FIG. 9 is a detailed structural diagram of a transform data processing apparatus according to Embodiment 4 of the present invention.
- FIG. 10 is a schematic flowchart of an encoding method according to Embodiment 5 of the present invention.
- FIG. 11 is a schematic flowchart of a decoding method according to Embodiment 6 of the present invention.
- FIG. 12 is a schematic structural diagram of an encoding apparatus according to Embodiment 7 of the present invention.
- FIG. 13 is a schematic structural diagram of a decoding apparatus according to Embodiment 8 of the present invention.
- FIG. 15 is a schematic structural diagram of an encoding apparatus according to Embodiment 10 of the present invention. Detailed ways
- the data is subjected to two different transformed data value ranges, and then the transformed data is compensated according to the different transformed and quantized data value ranges to ensure the same.
- the range of values of the data to be encoded after the transformation and quantization is substantially consistent with the range of values of the data after another transformation and quantization to improve coding efficiency.
- FIG. 1 is a general flowchart of a method for processing transformed data according to an embodiment of the present invention. As shown in Figure 1, the method includes:
- Step 101 Calculate the range of values of the image data after the two transformations according to the transformation matrix required by the preset two transformations.
- Step 102 Calculate a difference value range characteristic value of the two transforms according to the two transformed numerical ranges.
- the values of the difference values of the above two types of transformations are also different, and the difference between the two types of image data and the corresponding quantized value range may be obtained, or the image data may be subjected to two types respectively.
- the feature difference is a difference between the two types of transforms and the corresponding quantized value range
- the calculation includes the quantization step size of each of the two transforms found according to the quantization point corresponding to the image data.
- the two transformed numerical range feature difference values are also different, and the difference between the two types of image data and the corresponding quantized value range may be obtained, or the image data may be subjected to two types respectively.
- the difference in the range of values after the transformation when the feature difference is a difference between the two types of transforms and the corresponding quantized value range
- the calculation includes the quantization step size of each of the two transforms found according to the quantization point corresponding to the image data.
- the two transformed numerical range feature difference values are also different, and the difference
- Step 103 Apply one of the two transformations to the data to be transformed, and compensate the transformed data according to the difference of the calculated numerical range.
- the transform data processing method may specifically include an encoding method, a decoding method, and the like.
- FIG. 2 is a general structural diagram of a transform data processing apparatus according to an embodiment of the present invention. As shown in FIG. 2, the apparatus includes a first value range estimating unit, a second value range estimating unit, and a numerical range difference unit. And transform compensation unit.
- the first value range estimating unit is configured to calculate a range of values of the image data after the first transformation according to a transformation matrix required by the first one of the preset two transformations, and provide the value range difference unit .
- a second value range estimating unit configured to calculate a range of values of the image data after the second transformation according to a transformation matrix required by the second transformation in the preset two transformations, and provide the value range difference unit.
- the numerical range difference unit is configured to calculate the numerical range characteristic difference values of the two transformed values according to the numerical ranges after the first and second transformations, respectively, and provide the same to the transform compensation unit.
- a transform compensation unit configured to apply a first transform to the data to be transformed, and compensate the first transformed data according to the calculated numerical range feature difference value.
- the transform data processing apparatus may be specifically an encoding apparatus or a decoding apparatus.
- the manner of compensating the transformed data may be: determining an appropriate adjustment factor according to the relationship between the numerical ranges of the two transformed data, and multiplying the data obtained by one of the transformations by the adjustment factor. Then, the quantization is performed according to the corresponding quantization points, so that the numerical range of the data obtained after the transformation and quantization is consistent with the numerical range of the data obtained by another transformation and quantization.
- the method for compensating the transformed data may be: adjusting the quantization points corresponding to one of the transformations according to the relationship between the numerical ranges of the two transformed data, and then adjusting the data according to the adjusted quantization points. Quantization is performed so that the numerical range of the data obtained by the transformation and quantization can be made to coincide with the numerical range of the data obtained by another transformation and quantization.
- the manner of compensating the transformed data may be: according to the relationship between the numerical ranges of the two transformed data, re-establishing the quantization table for one of the transformations, and then changing the quantization table according to the reconstructed quantization table.
- the data obtained is quantized, so that the numerical range of the data obtained by the transformation and the quantization can be made to be consistent with the numerical range of the data obtained by another transformation and quantization.
- the first embodiment is directed to the first processing mode
- the third embodiment is directed to the second processing mode
- the fourth embodiment is directed to the third processing mode.
- Embodiment 1 is a diagrammatic representation of Embodiment 1:
- the quantization point is used when encoding the data block C, and the quantization step sizes of the transform A and the transform B found at the quantization point are QTAB1 [s] and QTAB2[s], respectively.
- each different coding region for example, the data block C
- the corresponding quantization step size is found according to the quantization point, and the quantization process is performed.
- the range of values of the transformed A and the corresponding quantized data is adjusted to be consistent with the range of values of the transformed B and the corresponding quantized data.
- the difference value range of the two transformed values is the difference between the two types of image data and the corresponding quantized value range.
- FIG. 3 is a specific flowchart of a method for processing transformed data according to Embodiment 1 of the present invention. As shown in Figure 3, the method includes:
- Step 301 Calculate the range of values of the image data after the two transformations according to the transformation matrix required by the preset two transformations.
- the coding block C is divided into sub-blocks according to the scale of the transform and B, and the transforms A and B are respectively applied to the respective sub-blocks.
- the method of calculating the converted value range is the same. The following is an example of calculating the numerical range of each pixel data in the sub-block after the transformation A, and the specific calculation method is explained.
- transform A applies transform A to coding block C includes: calculating [TOT']®S, where S is a scaling factor Matrix, which is used to normalize the data after [ ⁇ '], multiply the symbols by the matrix, and @ to represent the respective elements of the matrix. According to the matrix multiplication, the numerical range increment of [ ⁇ ⁇ ,] can be calculated.
- the mathematical distribution of the coded block C is further considered when performing the numerical range calculation.
- the value in the block C has a certain mathematical distribution, and the transformation A is applied to the distribution, and then the above-mentioned method can be used to calculate the region where the numerical range of the C-transformed data is most likely to occur.
- the sub-block in the coding block C can be transformed.
- the value range of the data of each point after the sub-block in the coding block C is transformed is:
- Step 302 Calculate the transformed average value range for each of the two transformations.
- the calculation method for the average value range of the two transformations is the same. Still taking the transformation A as an example, the manner of calculating the transformed average value range may be:
- the average value range after the transformation is calculated as: The range of values of the pixel data of the first row and the jth column in the sub-block.
- Step 303 Calculate the difference between the two types of transforms and the corresponding quantized value range according to the transformed average value range obtained in step 302.
- the range of values after two transformations and corresponding quantization is first calculated.
- the transformation A and the corresponding quantization are still taken as an example.
- the quantization block is used for the coding block C corresponding to the quantization point
- the quantization step size of the transformation A is QTAB1[s]
- the A r calculated in step 202 is used to represent the data block obtained after the transformation A.
- the average numerical range, the numerical range is expressed in binary form, and the average value of the encoded data after transformation A is 2 Av .
- the quantization process of data usually in video codec can be expressed as:
- X is the value to be quantized
- s is the quantization point
- QTAB[n] is the quantization step size found in the quantization table according to the quantization point n
- shift[s] is the shift corresponding to the quantization point s.
- the average value obtained by quantization using the quantization step QTAB1[s] is (QTABl[s].2 Av ) »shift[s]
- the numerical range of the data is expressed in binary form (A ⁇ + log ⁇ TMSlW ⁇ hif ⁇ s )
- the value range of the obtained data is ( Avr B + log 2 QTAB2[s] )»shift[s].
- the specific calculation method is: Calculate the multiple relationship between the two transformations and the corresponding quantized values, ie (QTAB2[ S ]x 2 A » S hift[ S ] ⁇
- the data required in the above calculation process is a priori data, that is, data that can be obtained before encoding, so the above steps can be completed before encoding and the results are saved without calculation in the encoding process.
- the adjustment factor of the transform A may be adjusted due to the difference of the encoded data, so the adjustment factor of the transform A at the time of encoding can be appropriately adjusted according to the characteristics of the encoded data.
- the encoded data characteristic may be the actual average range of values after the data block has been transformed A.
- the adjustment factor of transform A is written into the encoded code stream.
- the adjustment factor of transform A can be written in the sequence header or image header or slice header or macroblock header of the code stream.
- the adjustment factor of the transformation A is used in the same manner as the above method, and will not be described here.
- Step 305 applying a transform A to the coding block C, obtaining the transformed data, and multiplying the obtained data by the adjustment factor of the transform A.
- the transform A is applied to the coding block C, and the specific process is the same as the existing one, and will not be described here.
- Step 306 quantizing each by using the quantization step size found by the transform A.
- each of the adjusted ones after the transformation A is quantized in accordance with the existing method. Since each C is reconstructed by using the adjustment factor in step 205 to obtain C, ', and the adjustment factor is determined according to the difference between the two types of transformations and the corresponding quantized value ranges, therefore, this step is performed by quantizing each The numerical range of the data can be consistent with the numerical range of the data obtained by the transforming block B and the corresponding quantized data.
- the average value range after the coding block C is applied to transform A is A r
- the value obtained by transforming the encoded data A is , then the result of multiplying the adjustment factor is
- the value range expressed in binary is A V r B + log 2 QTAB2[s] - log 2 QTAB ⁇ [s];
- the average value range after the coding block C is applied to the transform B is Avr B , and the value obtained by transforming the encoded data is A, and the result obtained by quantizing the quantization step QTAB2[s] is 2 ⁇ ⁇ ⁇ 73 ⁇ 452 , in binary.
- the range of values represented is ⁇ + log 2 QTAB2[s]. It can be seen that the same coding block C has the same value range as the data obtained after the transformation B and the corresponding quantization after the operations of steps 205 and 206. The purpose of making the final numerical range of the transformation A and the transformation B consistent is achieved.
- the data sent to the decoder is data processed by transform A and corresponding quantization and entropy coding.
- the inverse quantized result is divided by the adjustment factor of the transform A, and then inversely transformed to reconstruct the encoded end data.
- the adjustment factor of the transform A can be obtained at the decoding end according to the procedures of the foregoing steps 301-304. If the decoding end avoids the use of division, the decoded data can be multiplied and shifted to achieve the purpose of dividing the decoded data by the adjustment factor.
- the decoding end obtains the adjustment factor of the transform A from the place where the adjustment factor is included in the code stream, such as the sequence header, the picture header, the slice header, and the macroblock header.
- the adjustment factor of the transformation A is used in the same manner as the above method, and will not be described again here.
- This embodiment further provides a specific implementation of the transform data processing apparatus, which can be used to implement the method shown in FIG. Fig. 4 is a view showing a specific configuration of the down conversion data processing apparatus of the embodiment.
- the apparatus includes a first value range estimating unit, a second value range estimating unit, a numerical range difference unit, and a transform compensating unit.
- the transform compensation unit includes an adjustment factor determining sub-unit, a transform sub-unit, a post-transform processing sub-unit, and a quantized sub-unit.
- the first value range estimating unit is configured to calculate a range of values of the image data after the first transformation according to a transformation matrix required by the first one of the preset two transformations, and provide the value range difference unit.
- a second value range estimating unit configured to calculate a range of values of the image data after the second transformation according to a transformation matrix required by the second transformation in the preset two transformations, and provide the value range difference unit.
- a value range difference unit configured to calculate, according to the first and second transformed value ranges and the first and second transforms respectively corresponding to the second quantization point, the image data is subjected to the first and second transformations and the corresponding quantized values respectively.
- the difference in range is provided to the transform compensation unit.
- the adjustment factor determining subunit is used to calculate a difference value according to the numerical range
- the difference in the range of values provided by the element determines the adjustment factor and is provided to the post-transformation subunit.
- a transform subunit that applies a first transform to the data to be transformed and provides the transform result to the post-transform processing sub-unit.
- the post-transform processing sub-unit is configured to multiply the first transformed data by a determined adjustment factor, and provide the result to the quantizing sub-unit.
- the quantizing sub-unit quantizes the result obtained by multiplying the adjustment factor by the quantization point corresponding to the image data.
- the corresponding adjustment factor writing unit needs to be added to write the adjustment factor into the code stream.
- the data after the transformation A is first multiplied by an adjustment factor, and then quantized.
- the quantization process represented by the formula (1) in the quantization process, it is first multiplied by the quantization step size, and then the right multiplication is performed on the multiplication result, that is, the low-order information is discarded.
- the data after the transformation A is multiplied by the adjustment factor and the result is multiplied by the quantization step QTABl [s]
- the lower bit may not be 0, but some information is still concentrated, and when the shift is performed, This will result in a loss of data accuracy.
- an evolution processing method is also proposed based on the present embodiment, and the value of the data after the transformed A is changed by multiplying the adjustment factor of the transform A and increasing the shifting manner. range.
- the value of "the value is determined according to the hardware storage range of the encoding end. After the data after the guaranteed transformation is multiplied by the adjustment factor q', the data of the subsequent operation does not exceed the hardware storage range, and the value of "the value" The bigger the better, this will be able to focus the information in the data after the transformation A as high as possible.
- step 305 the transformed data is multiplied by the above adjustment factor q'.
- step 306 when the data is quantized in step 306, the bit number corresponding to the quantization point is further increased by "bit", that is, after the quantization operation is performed, the quantization result is shifted to the right by n bits. In this way, it will be able to In step 304 after the surface modification, the 2" times of the numerical range is expanded due to the change of the adjustment factor.
- the operations of the above modified steps 305 ⁇ 306 are: ( 2 D x2" xXxQTAB[s] )»shift[s]+n, where X represents the transformed data.
- the operation is the same as the operation in the original steps 305 ⁇ 306 (2 ⁇ ' xXxQTAB[s])»shift[s], but when implemented on a hardware platform, the accuracy loss of the former is better than The latter is small.
- the modified step 305 after multiplying the adjustment factor q', the data X is expanded by 2 ⁇ ' ⁇ 2" times, and the useful information is enlarged relative to the data after the original step 305 operation, More emphasis is placed on the upper bits, so that during the shifting process involved in the quantization step 306, the useful information lost by the shift is relatively reduced.
- the data accuracy can be more effectively improved.
- the decoding end when the decoding end uses the evolution mode of the first embodiment, when the decoding end performs inverse transform and inverse quantization on the data processed by the transform, the corresponding inverse operation is also performed. Specifically, in inverse quantization, the number of shift bits is reduced by n, and the inverse quantization result is divided by the adjustment factor q' of the transform A before inverse quantization, and then inversely transformed to more accurately reconstruct Encoding data.
- the present invention also provides a corresponding evolved device structure corresponding to the above evolution mode, and the structure is similar to the structure shown in FIG. 4, except that the transform compensation unit includes an adjustment coefficient and a shift offset quantum unit, a transform subunit, and a transform. Post-processing sub-unit and quantization sub-unit.
- the structure and function of the first numerical range estimating unit, the second numerical range estimating unit and the numerical range difference unit are the same as those shown in Fig. 4.
- the adjustment coefficient and the shift offset quantum unit are configured to determine the adjustment coefficient and the shift offset amount during quantization according to the calculated numerical range feature difference value, and respectively provide the transformed offset amount Processing subunits and quantizing subunits.
- a transform subunit that applies a first transform to the data to be transformed and provides the transform result to the post-transform processing sub-unit.
- the post-transform processing sub-unit is configured to multiply the first transformed data by the determined adjustment coefficient, and provide the result to the quantizing sub-unit.
- the quantizing sub-unit quantizes the result multiplied by the adjustment factor according to the shift offset and the quantization step size corresponding to the first type of transform.
- the averaged range of values after the two transforms is used. In order to make the numerical range calculation more accurate, it can also be carried out in the manner of the second embodiment.
- Embodiment 2 is a diagrammatic representation of Embodiment 1:
- the difference value range of the two transformed values is the difference between the two types of image data and the corresponding quantized value range, but the specific calculation method of the difference is compared with the first embodiment. Different in the middle.
- FIG. 5 is a specific flowchart of a method for processing transformed data provided in the embodiment. As shown in Figure 5, the method includes:
- Step 501 Calculate the range of values of the image data after the two transformations according to the transformation matrix required by the preset two transformations.
- step 301 The calculation method of this step is the same as that of step 301 in the first embodiment, and details are not described herein again.
- step 502 the average value range after the transformation B is calculated.
- Step 503 Calculate the two types of transforms and the corresponding quantized value range difference values according to the value range of each data after the transformed A obtained in step 501 and the average value range after the transformed B obtained in step 502.
- Step 504 Determine, according to the value range difference obtained in step 503, an adjustment factor of the transform ⁇ .
- the obtained adjustment factor is varied according to the change in the pixel position.
- Step 505 applying a transform A to the coding block C, obtaining the transformed data, and multiplying the obtained data by the adjustment factor of the transform A.
- Step 506 quantizing each of the quantization step sizes found by transform ⁇ .
- the compensation for the data obtained by the transformation A is completed, and the compensation principle is the same as that of the first embodiment, and will not be described here.
- the difference is that in the compensation process, the calculation of the adjustment factor changes for the change of the position of the pixel data, so that the compensation result is more accurate, so that the final two kinds of transformations and the corresponding quantized data have a higher degree of consistency. Thereby, a better transformation can be selected more effectively, and the coding efficiency is further improved.
- the adjustment factor of the position of the pixel according to the position of the pixel may be adjusted due to the difference of the encoded data, so the adjustment factor of the transform A at the time of encoding can be appropriately determined according to the characteristics of the encoded data. Adjustment.
- the encoded data characteristic may be a value of each pixel location after the data block is transformed A.
- the adjustment factor of transform A is written into the encoded code stream.
- the adjustment factor of transform A can be written in the sequence header or image header or strip header or macroblock header of the code stream.
- the adjustment factor of the transformation A is used in the same manner as the above method, and will not be described again here.
- the method in this embodiment can also be implemented by using the apparatus shown in FIG. 4 in the first embodiment.
- the present invention also provides a corresponding evolved device structure, which is similar to the structure shown in FIG. 4, wherein the transform compensation unit includes an adjustment factor and an offset quantum unit, a transform subunit, and a transform. Post-processing sub-unit and quantization sub-unit.
- the structure and function of the other first numerical range estimating unit, the second numerical range estimating unit, and the numerical range difference unit are the same as those shown in Fig. 4.
- the adjustment factor and the coefficient offset quantum unit are configured to determine an adjustment factor and a coefficient offset according to the value range difference value provided by the value range difference unit, and provide the converted processing subunit.
- a transform subunit that applies a first transform to the data to be transformed and provides the transform result to the post-transform processing sub-unit.
- the post-transform processing sub-unit is configured to multiply the first transformed data by a determined adjustment factor plus an offset, and provide the result to the quantizing sub-unit.
- Quantized sub-list The element quantizes the result obtained by multiplying the adjustment factor by the quantization step size corresponding to the first type of transform and adding the coefficient offset.
- the adjustment factor of the transform A can be calculated in advance at the decoding end.
- the decoding end divides the inverse quantization result by the adjustment of the corresponding transform A after performing inverse quantization.
- the factor is then inverse transformed to reconstruct the encoded data.
- the decoding end obtains the adjustment factor of the transform A from the place where the adjustment factor is included in the code stream, such as the sequence header, the picture header, the slice header, and the macroblock header.
- the adjustment factor of the transformation A is used in the same manner as the above method, and will not be described again here.
- Embodiment 3 is a diagrammatic representation of Embodiment 3
- FIG. 6 is a specific flowchart of a method for processing transformed data provided in Embodiment 3. As shown in Figure 6, the method includes:
- Steps 601 ⁇ 603, according to the transformation matrix required by the preset two transformations, calculate the range of values of the image data after the two transformations respectively; calculate the average range of values after the transformation for the two transformations; and calculate the two transformation sums The corresponding quantized value range difference.
- steps 601 to 603 are the same as the operations in steps 301 to 303 in the first embodiment, and will not be described here.
- Step 604 determining a quantization point offset according to the difference in step 603.
- the data obtained by the transform A is compensated, so that the numerical range consistent with the transform B is obtained, and the optimal transform mode is prepared.
- the quantization point corresponding to the transform A may be a preset quantization point, or may be obtained from the transform B. Quantization point.
- the quantization step size corresponding to two adjacent quantization points usually has a certain multiple relationship, including: Every A quantization points, the corresponding quantization step size is numerically changed to the original one-half. Therefore, the multiple relationship between the quantization step sizes corresponding to the adjacent quantization points is such that the multiple relationship between the quantization step sizes corresponding to the quantization points is (1/2) and the quantization step size and the quantization are utilized.
- the value obtained by quantizing the step size is proportional. Therefore, the method of adjusting the offset of the quantization point can also adjust the range of data values.
- the quantization point offset required to compensate the difference of the numerical range can be obtained.
- the specific numerical multiple corresponding to the numerical range difference D' is 2 D ', and after the quantization point plus the offset ⁇ ⁇ , the corresponding quantization step is the original quantization step.
- Step 605 Apply transform A to the coding block C to obtain the transformed data, subtract the quantized offset corresponding to the transform A by the determined quantization offset, and perform quantization according to the quantization step size found by the adjusted quantization point.
- the transform data processing on the encoding side is performed in accordance with the above method, thereby selecting the preferred transform method in transform A and transform B. If the final selected transform mode is transform A, the data sent to the decoder is the data processed by transform A and corresponding quantization and entropy coding. At this time, the decoding end needs to calculate the quantization point offset corresponding to the transform A according to steps 601 to 604 in advance, and compensate the quantization point offset, including adding ⁇ to the quantization point corresponding to the original transform A. ⁇ , the inverse quantization of the data and the inverse transformation of the data are performed by using the quantization step size corresponding to the changed quantization point to accurately reconstruct the data of the encoding end.
- the ⁇ ⁇ may be subtracted from the quantization point corresponding to the original A of the transformation A, and the data is inversely quantized by the quantization step corresponding to the changed quantization point. And inverse transformation. Adding or subtracting ⁇ from the quantization point corresponding to the transform primitive is determined by the quantization table characteristic, which is a preset step, and the purpose is that the data of the encoding end can be accurately recovered at the decoding end after being processed by the transform.
- the transform A quantization offset may be adjusted due to the difference of the encoded data, so the adjustment factor of the transform A at the time of encoding can be appropriately adjusted according to the characteristics of the encoded data.
- the encoded data characteristic may be an actual average range of values after the data block has been transformed A.
- the quantized offset of transform A is written into the encoded code stream. That is, the quantization offset subtracted by the quantization point corresponding to the transform A may depend on the range of values after the data is transformed A by encoding a sequence, an image, a strip or a macroblock, and the subtracted quantization offset The amount is written to the encoded code stream.
- the quantization offset of transform A can be written in the sequence header or image header or slice header or macroblock header of the code stream.
- the offset information is obtained by subtracting the quantization offset from the sequence header or the image header or the slice header or the macroblock header in the code stream, and subtracting the quantization offset from the quantization point corresponding to the original of the transform A.
- the quantization point corresponding to the coding end transform A and the quantization point corresponding to the decoding end transform A may be preset quantization points or the same quantization points as the transform B.
- FIG. 7 is a view showing a specific configuration of the down conversion data processing apparatus of the embodiment.
- the apparatus includes a first numerical range estimating unit, a second numerical range estimating unit, a numerical range difference unit, and a transform compensating unit.
- the transform compensation unit includes a quantization point correction subunit, a transformation subunit, and a quantization subunit.
- the first value range estimating unit is configured to calculate a range of values of the image data after the first transformation according to a transformation matrix required by the first one of the preset two transformations, and provide the value range difference unit.
- a second value range estimating unit configured to calculate a range of values of the image data after the second transformation according to a transformation matrix required by the second transformation in the preset two transformations, and provide the value range difference unit.
- a value range difference unit configured to calculate, according to the first and second transformed value ranges and the first and second transforms respectively corresponding to the second quantization point, the image data is subjected to the first and second transformations and the corresponding quantized values respectively.
- the difference in range is provided to the transform compensation unit.
- the quantization point correction sub-unit is configured to determine the quantization point offset according to the difference of the numerical range provided by the numerical range difference unit, and subtract the quantization point corresponding to the first type of the quantization point The offset, and the adjusted result is provided to the quantized subunit.
- a transform subunit applies a first transform to the data to be transformed, and provides the transformed result to the quantized subunit.
- a quantization subunit configured to quantize the transformed result according to the adjusted quantization point provided by the quantization point correction subunit.
- the difference of the numerical range after the transformation of A and B is calculated according to the average value range.
- the calculation of the difference can be performed in the manner of the second embodiment, that is, the difference of the numerical range is calculated for each pixel in the sub-block after the transformation A.
- the quantization point corresponding to the transform A is adjusted in step 604
- the pixels in the sub-block after the transform A are also adjusted, specifically, AQP lwx Ad' ⁇ ) ⁇
- quantizing according to the quantization step size corresponding to the adjusted quantization point is more accurate, and the numerical range of the final two kinds of transforms and the corresponding quantized data is more consistent, so that the better transform can be selected more effectively, and the coding efficiency is further improved.
- the quantization point offset corresponding to each pixel data after the transform A is obtained in advance according to the above method, and the corresponding data of the data to be inverse quantized is respectively quantized.
- the offset is added to the point, and then the quantization step size corresponding to the changed quantization point is used for inverse quantization and inverse transformation to accurately reconstruct the encoded data.
- the code stream can be written, parsed, and quantized according to the foregoing method.
- the quantization point offset is processed at the encoding end and the decoding end.
- the specific f and S can be set according to the A ⁇ and ⁇ ⁇ ⁇ data size relationship and the codec implementation conditions. If f and S need to be adjusted according to the image encoded data, f and S can be written to the sequence header, the image header, the slice header, the macroblock header, and the like in the encoded code stream. If the coded stream contains f and S, the decoding end is encoded. The corresponding position of the code stream, such as the sequence header, the image header, the slice header, the macroblock header, etc., is parsed to obtain f ⁇ . S.
- f ( ) and s ( ) can be set according to the data size relationship of A ⁇ and ⁇ and the codec implementation conditions. If .) and ⁇ ) need to be adjusted according to the image coded data, then .) and can be written to the sequence header, image header, slice header, macroblock header, etc. in the code stream.
- the same f ( os ( ) may be set in advance at the decoding end.
- the transform A is adjusted before the inverse quantization of the data. For the corresponding quantization point, add s ⁇ ) to the original quantization point, and divide the inverse quantized data by the corresponding adjustment factor f( ), and then use the quantized compensation pair corresponding to the changed quantization point by the adjustment factor.
- the inverse anti-quantized data is inverse quantized to accurately reconstruct the encoded data.
- the decoder extracts f() and s ( ) from the corresponding locations of the encoded stream, such as sequence headers, picture headers, slice headers, macroblock headers, and the like.
- the present invention also provides a corresponding device structure in response to the combination of the above two compensation methods.
- the structure of the apparatus is similar to that shown in FIG. 7, except that the transform compensation unit includes an adjustment factor and a quantization point correction subunit, a transformation subunit, a post-transformation processing sub-unit, and a quantization sub-unit.
- the structure and function of the other first numerical range estimating unit, the second numerical range estimating unit, and the numerical range difference unit are the same as those shown in Fig. 7.
- the adjustment factor and the quantization point correction sub-unit are configured to determine an adjustment factor and a quantization point offset according to a difference value range provided by the value range difference unit, and quantize the first type of transform
- the quantization point offset is subtracted from the point, the adjusted quantization point is provided to the quantization sub-unit, and the determined adjustment factor is provided to the transformed processing sub-unit.
- a transform subunit that applies a first transform to the data to be transformed and provides the transform result to the post-transform processing sub-unit. After the transformation a subunit, configured to multiply the first transformed data by a determined adjustment factor, and provide the result to the quantized subunit.
- the quantizing sub-unit quantizes the result multiplied by the adjustment factor according to the quantization step size corresponding to the adjusted quantization point.
- the transform A and the transform B may use different quantization tables, that is, the quantization step sizes found according to the quantization points are different, but for the same case of the quantization table, the above method is used. The loss of data accuracy is large.
- the present invention proposes an embodiment of the fourth embodiment.
- a set of quantization tables is redesigned so that the numerical ranges of the two transformations and the corresponding quantized data are identical.
- Embodiment 4 is a diagrammatic representation of Embodiment 4:
- the difference value range of the two transformed numerical ranges is the difference between the numerical values of the two transformed images of the image data.
- FIG. 8 is a specific flowchart of a method for processing transformed data according to Embodiment 4 of the present invention. As shown in Figure 8, the method includes:
- Steps 801 to 802 calculate the image data to undergo two converted numerical ranges respectively; for the two transformations, respectively calculate the transformed average numerical range; in steps 801-802
- the operation is the same as the operations of steps 301 to 302 in the first embodiment, except that the above operations are performed separately for different quantization points. That is to say, for all the different macroblocks, the average value range of the two transformed macroblocks is calculated separately: Avr and ⁇ where ⁇ is the quantization point index.
- Step 803 Calculate the difference between the two transformed numerical ranges.
- the quantization step size is reduced to half, so the value of ⁇ (1( «) There is also a certain regularity. Based on this, a simplification can be made here. Specifically, it is assumed that every m quantization points, the quantization step size is reduced to half, then a continuous m ⁇ (1( «) can be selected. For example, this step only calculates Ad(l), Ad(2), L, Ad(m), and the following is the calculation of the m differences.
- Step 804 setting a quantization step size and a shift bit number corresponding to each quantization point, and forming a quantization table.
- the quantization step size is set, it is performed according to the difference calculated in step 803.
- the quantization step corresponding to the first to mth quantization points is set to be: 2 AdW xR, 2 Ad(m) xR, where R is a constant coefficient
- R is a constant coefficient
- the value is to make the value of the quantization step size an integer and improve the calculation accuracy (the numerator is large, naturally more information can be retained), but considering the limitation of the hardware storage range, the R value has an upper limit.
- the quantization step size of the other quantization points can be derived from the quantization step corresponding to the 1st to mth quantization points.
- the quantization table is formed according to the shift bit number and the quantization step size set as described above, and the process is the same as the existing implementation, and will not be described here.
- Step 805 Receive data to be transformed, and apply transform A to obtain transformed data, and quantize the transformed data according to the quantization table.
- the value range of the data after the encoding end data is quantized by the transform A and the quantization table is substantially consistent with the transformed B and the corresponding quantized numerical range.
- the principle of the present invention is the same as that of the first embodiment. Specifically, since the quantization step size is proportional to the quantized data in the quantization process, the data obtained by the transform A is quantized according to the quantization step size.
- the process is in fact substantially equivalent to the process of multiplying the data obtained by transform A by an adjustment factor in the first embodiment, which is multiplied by 2 AdW . Therefore, this embodiment can also achieve the purpose of adjusting the value range so as to be consistent with the transformation B and the corresponding quantized value range.
- an inverse quantization table corresponding to the quantization table of the encoding end is also designed at the decoding end.
- the quantization step size of the nth quantization point is twice the quantization step size of the (n+m)th quantization point, and is utilized in the inverse quantization table.
- the number of shift bits of the 1st to mth inverse quantization points can be set to k, and the number of shift bits of the m+1th to 2m inverse quantization points is correspondingly k-l.
- the setting of the k value it is also considered in consideration of the storage range of the hardware, and the principle is the same as the case of considering the hardware storage range.
- the inverse quantization step size of the inverse quantization table is calculated as IQ(n), where n is the quantization point.
- FIG. 9 is a view showing a specific configuration of the down conversion data processing apparatus of the embodiment.
- the apparatus includes a first numerical range estimating unit, a second numerical range estimating unit, and a number Value range difference unit and transform compensation unit.
- the transform compensation unit includes a quantization table establishment subunit, a transformation subunit, and a quantization subunit.
- the first value range estimating unit is configured to calculate a range of values of the image data after the first transformation according to a transformation matrix required by the first one of the preset two transformations, and provide the value range difference unit.
- a second value range estimating unit configured to calculate a range of values of the image data after the second transformation according to a transformation matrix required by the second transformation in the preset two transformations, and provide the value range difference unit.
- the value range difference unit is configured to calculate a difference between the two transformed value ranges according to the first and second converted value ranges respectively, and provide the difference as a numerical range characteristic difference value to the The transformation compensation unit.
- the quantization table establishing subunit is configured to establish a corresponding quantization table for the first type of transform according to the numerical range feature difference value, and provide the quantized subunit.
- a transform subunit configured to apply a first transform to the data to be transformed, and provide the transform result to the quantized subunit.
- the quantizing subunit quantizes the first transformed result according to the quantization table corresponding to the first transform.
- the data of the transformed A is compensated as an example to illustrate the specific implementation of the present invention.
- the data of the transformed B can also be compensated, and the implementation manner is the same, but only The parameters corresponding to the transformation A and the transformation B are interchanged in the corresponding formula, and will not be described here.
- FIG. 10 is a schematic flowchart of an encoding method provided in Embodiment 5 of the present invention.
- the encoding method includes the following steps:
- the data to be transformed includes a predicted image block residual.
- A2 performing a first transformation on the data to be transformed to obtain first transformed data; Performing a second transformation on the data to be transformed to obtain second transformed data;
- the first transform is here a 4x4 size transform
- the second transform is here an 8x8 size transform
- A3. Determine an adjustment parameter of the first transformation according to the first transformed data and the second transformed data, and adjust the first transformed data according to the adjustment parameter and the second transformed parameter.
- the first transformed data and the second transformed data herein include the first converted numerical range and the second transformed numerical range.
- the first transformed data and the second transform are used.
- the name of the post data is used.
- Adjusting the parameter may include determining an adjustment factor according to the first transformed data and the second transformed data, and then adjusting the first transformed data according to the adjustment parameter and the second transformed parameter includes : multiplying the first transformed data by the adjustment factor; and quantizing the data multiplied by the adjustment factor according to the corresponding quantization step size.
- the adjustment parameter may include a quantization offset determined according to the first transformed data and the second transformed data, the second transformed parameter being a second transformed quantization point, and the adjusting parameter and the second Adjusting the first transformed data by the transformed parameter includes: subtracting the quantized offset corresponding to the second transform as the quantized point of the first transform; using the adjusted first transformed quantized point pair The first transformed data is quantized.
- the adjustment parameter may include a quantization offset and an adjustment factor determined according to the first transformed data and the second transformed data; the parameter of the second transformation is a quantization point corresponding to the second transformation, and then according to the Adjusting the parameter and the parameter of the second transform to adjust the first transformed data comprises: multiplying the first transformed data by the adjustment factor, and subtracting the quantization point corresponding to the second transform from the quantization
- the offset is used as a quantization point of the first transform; the data multiplied by the adjustment factor is quantized by the quantization point of the first transform.
- the adjustment parameter may further include an adjustment coefficient and a quantization shift offset determined according to the first transformed data and the second transformed data;
- the parameter of the second transformation includes: shifting a quantization point of the second transformed data Adjusting the first transformed data according to the adjustment parameter and the second transformed parameter includes: multiplying the first transformed data by the adjustment coefficient, and using the first transform And shifting the bit number of the quantization point to quantize the data multiplied by the adjustment coefficient;
- the shift bit number of the quantization point corresponding to the first transform is a shift bit number of the quantization point corresponding to the second transform
- the sum of the quantized shift offsets is described.
- the adjustment parameter may include an adjustment factor and a coefficient offset determined according to the first transformed data and the second transformed data, and then adjusting the first transformation according to the adjustment parameter and the second transformed parameter.
- the subsequent data includes: multiplying the first transformed data by the adjustment factor, adding the coefficient offset and performing quantization.
- FIG. 11 is a schematic flowchart of a decoding method according to Embodiment 6 of the present invention, where the method includes:
- the Bl receiving the code stream, decoding the code stream, obtaining the first transformed data and adjusting parameters; the first transformed data is obtained by entropy decoding if the currently decoded image block is determined to use the first transform
- the data after the image block residual is inverse transformed by the first transform;
- the first transform is here a 4x4 size inverse transform;
- the second transform is here an inverse transform of 8x8 size
- the adjustment parameter corresponds to an adjustment parameter written to the code stream at the time of encoding.
- This step includes a variety of methods, namely:
- the adjusting the first transformed data according to the quantized offset and the quantization point corresponding to the second transform comprises: using the quantization point corresponding to the first transform to the first transform
- the latter data is inverse quantized and the inverse quantization result is inversely transformed.
- the adjustment parameter includes a quantization offset and an adjustment factor for the first transformed data; then the parameter of the second transformation is a quantization point corresponding to the second transformation, and the quantization point of the first transformation is the The quantized point of the second transform is subtracted from the quantized offset; the adjusting the first transformed data according to the adjusting parameter and the second transformed parameter comprises: using a quantization point corresponding to the first transform Performing inverse quantization on the first transformed data; inversely transforming the inverse quantization result and the quotient of the adjustment factor.
- the adjustment parameter includes a first transformed adjustment coefficient and a quantization shift offset for the first transformed data
- the second transformed parameter includes a shift number of the quantized point of the second transformed data
- adjusting the first transformed data according to the adjusting parameter and the second transformed parameter comprising: subtracting the quantized shift of the quantized point corresponding to the second transform by the quantization shift An offset amount as a shift bit number of a quantization point corresponding to the first transform; a shift bit number of the quantization point corresponding to the first transform Performing inverse quantization on the data received by the first transform; and inversely transforming the inverse quantization result and the quotient of the adjustment coefficient.
- the adjusting the first transformed data according to the adjusting parameter and the second transformed parameter comprises: performing inverse quantization on the received data according to the quantization step size corresponding to the first transform, and The quantized result is subtracted from the coefficient offset, and the subtraction result is inversely transformed with the quotient of the adjustment factor.
- the adjustment parameters are obtained from a sequence header or an image header or a strip header or a macroblock header in the code stream.
- FIG. 12 is a schematic structural diagram of an encoding apparatus according to Embodiment 7 of the present invention, where the encoding apparatus includes: a data receiving unit, configured to receive data to be transformed;
- a transform unit configured to perform first transform on the data to be transformed received by the data receiving unit, to obtain first transformed data, and perform second transform on the data to be transformed to obtain second transformed data ;
- the first adjusting unit determines an adjustment parameter according to the second transformed parameter, the first transformed data, and the second transformed data, and adjusts the first transformed data according to the adjustment parameter and the second transformed parameter;
- a writing unit configured to write the adjustment parameter into the encoded code stream.
- FIG. 13 is a schematic structural diagram of a decoding apparatus according to Embodiment 8 of the present invention, where the decoding apparatus includes: a code stream receiving unit, configured to receive a code stream;
- Decoding unit decoding the code stream to obtain first transformed data and adjusting parameters; and second adjusting unit, configured to adjust the first transform according to the adjusting parameter and the second transformed parameter The data.
- Embodiment 9 An encoding method
- Embodiment 9 provides an encoding method, which can adaptively obtain a quantization offset (the aforementioned adjustment parameter) at the encoding end. As shown in FIG. 14, the method includes:
- the data to be transformed and the encoded parameter information are first received. Performing a first transformation on the data to be transformed to obtain first transformed data, and determining an adjustment parameter according to the encoded parameter information and the second transformation parameter.
- the second transform parameter is a quantization point corresponding to the second transform
- the adjustment parameter is a quantization offset.
- the encoded parameter information includes the number of intra-predicted image blocks using the first transform, the number of intra-predicted image blocks using the second transform, all using the number of intra-predicted image blocks, and the first in the P-frame or B-frame.
- the number of transformed intra-predicted image blocks, the number of intra-predicted image blocks using the first transform in P and B frames, the number of second transformed intra-predicted image blocks in P-frames or B-frames, P-frames and B-frames The number of intra-predicted image blocks used in the second transform, the number of intra-predicted image blocks in the P-frame and the B-frame, the number of image blocks in the P-frame using the skip mode or the direct mode, and the skipping in the P-frame Mode and The number of image blocks in the direct mode, the number of image blocks in the B frame using the skip mode or the direct mode, the number of image blocks in the B frame using the skip mode and the direct mode, and the inter prediction mode image block in the P frame.
- the number, or one or more of the number of inter prediction mode image blocks used in the B frame is a commonly used technique in video encoding and decoding, which means that the current image block motion vector is obtained according to the encoded or decoded image block information, and there is no coding residual in the image block; the direct mode meaning is based on the encoded or already The image block information is decoded to obtain a current image block motion vector, but the image block contains an encoded residual.
- the number of intra prediction image blocks using the first transform is img->intra4x4num
- the number of used intra prediction image blocks is img->intra-num
- the skip mode is used in the P frame and or directly
- the number of image blocks of the mode is img->pskip-num
- the number of intra prediction image blocks used in the P frame is img->p_in
- the number of image blocks in the P frame using the inter prediction mode is Img->pnum
- the quantization point corresponding to the second transform is i mg -> qp
- the quantization offset is img->qp_shift.
- each table contains 64 elements, which are recorded as QPshift_table[0], QPshift_table[l], and QPshift.
- table[2] three arrays, each containing 64 elements, represented as follows:
- QPshift_table[0] ⁇ 0,l, 1,1, 1,2,2,2,2,3,3,3,4,4,4,4,5,5,5,5,6, 6,6,6,7,8,8,8,8,8,8,8,8,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, ⁇ ,10,10 ⁇
- QPshift_table[2] ⁇ 0,l, 1,1,2,2,3,3,4,4,4,5,5,6,6,7,8,8,9,9,10, 10,10,10,10,10,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,13,13,13,1 3,13,13,13,13,13,13,13,13,13,13,13,13,13,0,
- img->intra4x4num, img->intra-num, img->pskip-num, Img -> p - intra and img -> pnum is 0.
- the image group referred to herein includes a plurality of I frames, P frames, B frames, or a combination of the above types.
- the determination value vl and the second determination value v2, vl and v2 are calculated as follows:
- Vl img->intra4x4num * 5.0/ img -> intra- num/ (img->QP_shift+ 12)
- the quantization offset is obtained according to the following logic: img->QP_ shift:
- img->QP_shift is indexed by img->qp and found in the table QPshift_table[0].
- Vl img->intra4x4num * 5.0/ img -> intra- num/ (img->QP_shift+ 12);
- V2 img->pskip_num* 1.0/img -> pnum
- the quantization offset is obtained according to the following logic: img->QP_ shift:
- img->QP_shift is indexed by img->qp and found in the table QPshift_table[0].
- the weight coefficient lambda corresponding to the first transform in the rate-distortion optimization is obtained according to the table pre-stored by the encoding end.
- This table is denoted as QP-lambda-table-4x4, which contains 16 elements in this embodiment.
- the lambda using the intra-coded image block is recorded as img->lambda4x4I
- the lambda of the image block using the inter-prediction mode is img->lambda4x4p, img->lambda4x4I and img->lambda4x4 :
- QP—lambda—table—4 ⁇ 4[16] ⁇ 1.0,1.1,1.3, 1.5,1.8,2.1,2.6,3.1,3.5,4.0,4.6,5.1,5.7,6. 3,100,100 ⁇ If the current image to be encoded is a P frame, then img->QP_shift is set to 5 and img->lambda4x4p is set to 1.6.
- img->QP_shift is set to 5.
- the quantization point of the first transform is calculated according to the parameter of the second transform (ie, the quantization point of the second transform), and the specific method is to subtract the quantized point of the second transform
- the quantization offset is used as the quantization point of the first transform.
- the first transformed data is quantized using the calculated first transformed quantized points.
- the quantization offset img->QP_shift is written into the encoded code stream.
- the tenth embodiment further provides an encoding device, which can be used to perform the encoding method provided in the ninth embodiment.
- the encoding device includes:
- a third receiving unit configured to receive data to be transformed and encoded parameter information
- a third transforming unit configured to perform first transform on the data to be transformed received by the third receiving unit, to obtain first transformed data
- a third adjusting unit configured to determine, according to the encoded parameter information and the second transformed parameter received by the third receiving unit, an adjustment parameter, and adjust the third transformation unit according to the adjustment parameter and the second transformed parameter First transformed data;
- a third writing unit configured to write the adjustment parameter obtained by the third adjusting unit into the encoded code stream.
- the third receiving unit receives the data to be transformed and the encoded parameter information.
- the third transform unit performs a first transform on the data to be transformed to obtain first transformed data, and the third adjusting unit determines the adjustment parameter according to the encoded parameter information and the second transform parameter.
- the second transform parameter is a quantization point corresponding to the second transform, and the adjustment parameter is a quantization offset.
- the encoded parameter information includes the number of intra-predicted image blocks using the first transform, the number of intra-predicted image blocks using the second transform, all using the number of intra-predicted image blocks, and the first in the P-frame or B-frame.
- Number of transformed intra prediction image blocks, intra prediction using the first transform in P and B frames Number of image blocks, number of second transformed intra-predicted image blocks used in P-frame or B-frame, number of second transformed intra-predicted image blocks in P-frame and B-frame, intra prediction used in P-frame and B-frame
- the number of image blocks, the number of image blocks using the skip mode or the direct mode in the P frame, the number of image blocks using the skip mode and the direct mode in the P frame, and the image block using the skip mode or the direct mode in the B frame The number of image blocks in the B frame using skip mode and direct mode, the number of inter prediction mode image blocks in the P frame, or the number of inter prediction mode image blocks in the B frame or A variety.
- the skip mode is a commonly used technique in video encoding and decoding, which means that the current image block motion vector is obtained according to the encoded or decoded image block information, and there is no coding residual in the image block; the direct mode meaning is based on the encoded or already The image block information is decoded to obtain a current image block motion vector, but the image block contains an encoded residual.
- the third adjusting unit calculates the quantized offset according to the encoded information and the quantized point of the second transform, and calculates the quantized point of the first transform according to the quantized offset and the quantized point of the second transform, and obtains the obtained quantized point.
- the first transformed quantized point quantizes the first transformed data (the first transformed data obtained by the third transform unit is adjusted according to the adjustment parameter and the second transformed parameter). The steps of the specific calculation can be referred to the description of the embodiment 9.
- the third write unit writes the quantization offset into the encoded code stream to obtain a quantized offset for decoding operation when decoding.
- the ninth embodiment and the tenth embodiment obtain the adjustment parameters (quantization offset) according to the encoded parameter information and the second transformation parameter, so that the coding end has better flexibility. Since the encoding end has written the calculated adjustment parameters into the encoded code stream, the decoding end only needs to obtain the adjustment parameter from the code stream.
- the method described in this embodiment takes into account the coding performance without additionally increasing the burden on the decoding end.
- ROM/RAM read-only memory
- diskette diskette
- optical disk etc.
- a computer device which may be a personal computer, server, or network device, etc.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
A coding method comprises the steps of: receiving the data to be transformed; implementing a first transform to the received data and obtaining a first transformed data; implementing a second transform to the received data and obtaining a second transformed data; determining an adjusting parameter based on the first transformed data and the second transformed data; adjusting the first transformed data according to the adjusting parameter and the parameter of the second transform. A method for decoding and a device, system for coding and decoding are also provided. The value range of the transformed data is adjusted so that the value range ofimage data transformed by different transforms can keep consistent and the influence caused by the transforms can be reflected truly when the adaptive block transform technique is adopted. The transform with preferred effect can be selected to improve the coding efficiency.
Description
编码、 解码方法和装置及系统 技术领域 Coding and decoding method and device and system
本发明涉及视频压缩编码技术, 特别涉及一种编码、 解码方法及装置和系 统。 背景技术 The present invention relates to video compression coding techniques, and in particular, to a coding and decoding method, apparatus and system. Background technique
为减小视频数据在传输或存储时的数据量, 一般需要对视频数据进行压缩 编码。 在视频压缩编码领域, 变换是一项重要技术, 其作用是将一副图像、 一 个区域中的图像内容及信息经变换后集中于某一特定区域, 以便视频压缩算法 对这部分内容进行更有效的压缩。 然后对变换后对数据进行量化、 熵编码等处 理后即形成压缩编码后的视频数据。 In order to reduce the amount of data of video data as it is transmitted or stored, it is generally necessary to compress and encode the video data. In the field of video compression coding, transform is an important technology, which is to transform an image, image content and information in an area into a specific area, so that the video compression algorithm can more effectively perform this part of the content. Compression. Then, after the transform is performed, the data is quantized, entropy encoded, etc., and then the compressed and encoded video data is formed.
在视频编解码的标准中,如动态图像专家组( Moving Pictures Experts Group, MPEG ) 的 MPEG-2,H.264,数字音视频编解码技术标准(AVS )都使用了变换技 术。 在这些标准中, 一幅图像或图像中的一个区域被划分成若干小块或子区域, 称为子块, 变换就是以子块为单位进行的。 一般情况下, 子块的大小可以为 4x4 或 8x8 , 其中, 4和 8均是以图像像素为单位的。 In video coding and decoding standards, such as Moving Pictures Experts Group (MPEG) MPEG-2, H.264, and Digital Audio Video Codec Standard (AVS) use transform technology. In these standards, an area of an image or image is divided into small blocks or sub-areas called sub-blocks, and the transformation is performed in units of sub-blocks. In general, the sub-block size can be 4x4 or 8x8, where 4 and 8 are in image pixels.
一段视频文件是由多幅视频图像组成, 并且一幅图像通常包含了丰富的内 容, 图像的不同部分所具有的特性也不同。 因此, 若将一段视频中所有图像或 将一幅图像以同样尺寸 (如 8x8 大小) 的子块进行划分, 然后对其进行变换, 其效果不一定能达到最优, 即不能有效的将所有子块中的内容经变换后有效的 集中于某一特定区域。 基于此, 提出了自适应块变换技术, 其原理是: 将一个 特定区域分别按照不同的子块大小进行划分, 然后针对不同大小的子块进行不 同的变换(例如, 将图像分别划分为 4x4和 8x8的块, 对 4x4块使用 4x4变换, 对 8x8块使用 8x8变换), 之后根据一定准则判断在不同变换情况下哪种变换能 更有效的将块的信息集中于特定区域。 最后将较优的变换结果存储起来。 解码 端在对经过上述方式变换后的图像进行解码时, 根据码流中相应的信息获取变 换尺度(如 4x4或 8x8 ) 的信息, 然后使用相应的逆变换(如 4x4逆变换或 8x8 逆变换)对该区域进行处理, 获取原始的视频数据。 A video file is composed of multiple video images, and an image usually contains a lot of content, and different parts of the image have different characteristics. Therefore, if all the images in a video or an image is divided into sub-blocks of the same size (such as 8x8 size) and then transformed, the effect may not be optimal, that is, all the sub-blocks cannot be effectively The contents of the block are effectively transformed into a specific area after being transformed. Based on this, an adaptive block transform technique is proposed. The principle is: divide a specific region according to different sub-block sizes, and then perform different transforms for sub-blocks of different sizes (for example, dividing the image into 4x4 and 8x8 blocks, 4x4 transforms for 4x4 blocks, 8x8 transforms for 8x8 blocks), and then according to certain criteria, which transforms can more effectively focus block information on specific regions in different transform situations. Finally, the better transformation results are stored. When the decoding end decodes the image transformed by the above manner, the decoding end acquires the information of the transform scale (such as 4x4 or 8x8) according to the corresponding information in the code stream, and then uses the corresponding inverse transform (such as 4x4 inverse transform or 8x8 inverse transform). The area is processed to obtain the original video data.
但是, 在对视频的压缩编码过程中, 出于各种目的可能需要融合不同的变
换, 例如, 4x4变换矩阵^^于离散余弦变换( Discrete Cosine Transform, DCT ) 的, 8x8变换则是基于小波的, 这两套变换矩阵很可能不具有太多的相同变换特 征, 相同的数据经过这些变换后数据的数值范围改变程度不一致。 由于量化会 导致数据信息受损, 无论在量化过程中使用相同或不同的量化表进行量化, 因 相同的数据经不同的变换后其数值范围改变程度不一致, 则会导致变换之后的 数据经过量化后的损失程度不一致。 在这种情况下, 无法使用一定的判断准则 确定较优的变换方式, 从而无法有效的提高数据编码效率。 发明内容 However, in the compression coding process of video, it may be necessary to fuse different changes for various purposes. For example, the 4x4 transform matrix is based on Discrete Cosine Transform (DCT), and the 8x8 transform is based on wavelet. The two sets of transform matrices probably do not have too many identical transform features, and the same data passes. The degree of change in the range of values of these transformed data is inconsistent. Since the quantization may result in the damage of the data information, whether the same or different quantization tables are used for quantization in the quantization process, since the same data is inconsistently changed after the different values are converted, the data after the transformation is quantized. The degree of loss is inconsistent. In this case, it is impossible to determine a better conversion method by using certain judgment criteria, so that the data coding efficiency cannot be effectively improved. Summary of the invention
有鉴于此, 本发明实施例提供一种编码、 解码方法及装置和系统, 以使数 据经不同变换后的数值范围基本保持一致。 In view of this, the embodiments of the present invention provide a coding and decoding method, apparatus, and system, so that the numerical ranges of data after different transformations are substantially consistent.
为实现上述目的, 本发明实施例釆用如下的技术方案: In order to achieve the above object, the following technical solutions are used in the embodiments of the present invention:
一种编码方法, 包括: An encoding method, including:
接收待变换的数据; Receiving data to be transformed;
对所述待变换的数据进行第一变换, 得到第一变换后的数据; Performing a first transformation on the data to be transformed to obtain first transformed data;
对所述待变换的数据进行第二变换, 得到第二变换后的数据; Performing a second transformation on the data to be transformed to obtain second transformed data;
根据第一变换后的数据和第二变换后的数据确定调整参数, 并根据所述调 整参数和第二变换的参数调整所述第一变换后的数据; And determining an adjustment parameter according to the first transformed data and the second transformed data, and adjusting the first transformed data according to the adjustment parameter and the second transformed parameter;
将所述调整参数写入编码码流中。 The adjustment parameters are written into the encoded code stream.
一种解码方法, 包括: A decoding method, including:
接收码流, 对所述码流进行解码, 获得第一变换后的数据和调整参数; 根据所述调整参数和第二变换的参数调整所述第一变换后的数据。 Receiving a code stream, decoding the code stream, obtaining first transformed data and adjusting parameters; and adjusting the first transformed data according to the adjustment parameter and the second transformed parameter.
一种编码装置, 包括: An encoding device comprising:
数据接收单元, 用于接收待变换的数据; a data receiving unit, configured to receive data to be transformed;
变换单元, 用于对接收单元接收到的所述待变换的数据进行第一变换, 得 到第一变换后的数据; 对所述待变换的数据进行第二变换, 得到第二变换后的 数据; a transform unit, configured to perform first transform on the data to be transformed received by the receiving unit, to obtain first transformed data, and perform second transform on the data to be transformed to obtain second transformed data;
第一调整单元, 根据第一变换后的数据和第二变换后的数据确定调整参数, 根据所述调整参数和第二变换的参数调整所述第一变换后的数据。 The first adjusting unit determines an adjustment parameter according to the first transformed data and the second transformed data, and adjusts the first transformed data according to the adjustment parameter and the second transformed parameter.
一种解码装置, 包括:
码流接收单元, 用于接收码流; A decoding device comprising: a code stream receiving unit, configured to receive a code stream;
解码单元, 对所述码流进行解码, 获得第一变换后的数据和调整参数; 第二调整单元, 用于根据所述调整参数和第二变换的参数调整第一变换后 的数据。 a decoding unit, configured to decode the code stream to obtain first transformed data and adjustment parameters, and a second adjusting unit, configured to adjust the first transformed data according to the adjustment parameter and the second transformed parameter.
一种编解码系统, 包括: 编码装置和解码装置; A codec system, comprising: an encoding device and a decoding device;
所述编码装置包括: The encoding device includes:
数据接收单元, 用于接收待变换的数据; a data receiving unit, configured to receive data to be transformed;
变换单元, 用于对接收单元接收到的所述待变换的数据进行第一变换, 得 到第一变换后的数据; 对所述待变换的数据进行第二变换, 得到第二变换后的 数据; a transform unit, configured to perform first transform on the data to be transformed received by the receiving unit, to obtain first transformed data, and perform second transform on the data to be transformed to obtain second transformed data;
第一调整单元, 根据第二变换的参数、 第一变换后的数据和第二变换后的 数据确定调整参数, 根据所述调整参数和第二变换的参数调整所述第一变换后 的数据。 The first adjusting unit determines an adjustment parameter according to the second transformed parameter, the first transformed data, and the second transformed data, and adjusts the first transformed data according to the adjustment parameter and the second transformed parameter.
所述解码装置包括: The decoding device includes:
码流接收单元, 用于接收码流; a code stream receiving unit, configured to receive a code stream;
解码单元, 对所述码流进行解码, 获得第一变换后的数据和调整参数; 第二调整单元, 用于根据所述调整参数和第二变换的参数调整第一变换后 的数据。 a decoding unit, configured to decode the code stream to obtain first transformed data and adjustment parameters, and a second adjusting unit, configured to adjust the first transformed data according to the adjustment parameter and the second transformed parameter.
一种编码方法, 包括: An encoding method, including:
接收待变换的数据和已编码参数信息; Receiving data to be transformed and encoded parameter information;
对所述待变换的数据进行第一变换, 得到第一变换后的数据; Performing a first transformation on the data to be transformed to obtain first transformed data;
根据已编码参数信息和第二变换的参数确定调整参数, 根据所述调整参数 和所述第二变换的参数调整所述第一变换后的数据; Determining an adjustment parameter according to the encoded parameter information and the second transformed parameter, and adjusting the first transformed data according to the adjustment parameter and the second transformed parameter;
将所述调整参数写入编码码流中。 The adjustment parameters are written into the encoded code stream.
一种编码装置, 包括: An encoding device comprising:
第三接收单元, 用于接收待变换的数据和已编码参数信息; a third receiving unit, configured to receive data to be transformed and encoded parameter information;
第三变换单元, 用于对所述第三接收单元接收的待变换的数据进行第一变 换, 得到第一变换后的数据; a third transforming unit, configured to perform first transform on the data to be transformed received by the third receiving unit, to obtain first transformed data;
第三调整单元, 用于根据第三接收单元接收的已编码参数信息和第二变换 的参数确定调整参数, 根据所述调整参数和所述第二变换的参数调整所述第三
变换单元得到的第一变换后的数据; a third adjusting unit, configured to determine an adjustment parameter according to the encoded parameter information received by the third receiving unit and the second transformed parameter, and adjust the third according to the adjustment parameter and the second transformed parameter The first transformed data obtained by the transform unit;
第三写单元, 用于将所述第三调整单元得到的调整参数写入编码码流中。 由上述技术方案可见, 在本发明实施例中, 首先根据第一变换后的数据和 第二变换后的数据确定调整参数, 根据所述调整参数和第二变换的参数调整所 述第一变换后的数据, 使得第一变换后的数据与第二变换后的数据的数值范围 一致, 从而在应用自适应块变换技术时, 能够真实反映变换对数据的影响, 来 选择效果较优的变换, 进而提高编码效率。 本发明提供的编解码方法和装置, 能够保证第一变换后的数据范围和第二变换后的数据范围保持一致, 同时将调 整参数写入码流中, 这样在解码端可以根据调整参数, 对接收到的数据进行相 应的处理。 附图说明 And a third writing unit, configured to write the adjustment parameter obtained by the third adjusting unit into the encoded code stream. It can be seen that, in the embodiment of the present invention, the adjustment parameter is first determined according to the first transformed data and the second transformed data, and the first transformation is adjusted according to the adjustment parameter and the second transformed parameter. The data is such that the first transformed data is consistent with the numerical range of the second transformed data, so that when the adaptive block transform technique is applied, the influence of the transform on the data can be truly reflected to select a better transform, and then Improve coding efficiency. The codec method and device provided by the present invention can ensure that the first transformed data range and the second transformed data range are consistent, and the adjustment parameters are written into the code stream, so that the decoding end can be adjusted according to the adjustment parameter. The received data is processed accordingly. DRAWINGS
图 1为本发明实施例中变换数据处理方法的总体流程图; 1 is a general flowchart of a method for processing transformed data according to an embodiment of the present invention;
图 2为本发明实施例中变换数据处理装置的总体结构图; 2 is a schematic structural diagram of a transform data processing apparatus according to an embodiment of the present invention;
图 3为本发明实施例一中变换数据处理方法的具体流程图; 3 is a specific flowchart of a method for processing transformed data according to Embodiment 1 of the present invention;
图 4为本发明实施例一中变换数据处理装置的具体结构图; 4 is a detailed structural diagram of a transform data processing apparatus according to Embodiment 1 of the present invention;
图 5为本发明实施例二中变换数据处理方法具体流程图; FIG. 5 is a specific flowchart of a method for processing transformed data according to Embodiment 2 of the present invention; FIG.
图 6为本发明实施例三中变换数据处理方法具体流程图; 6 is a specific flowchart of a method for processing transformed data according to Embodiment 3 of the present invention;
图 7为本发明实施例三中变换数据处理装置的具体结构图; 7 is a detailed structural diagram of a transform data processing apparatus according to Embodiment 3 of the present invention;
图 8为本发明实施例四中变换数据处理方法具体流程图; 8 is a specific flowchart of a method for processing transformed data according to Embodiment 4 of the present invention;
图 9为本发明实施例四中变换数据处理装置的具体结构图; 9 is a detailed structural diagram of a transform data processing apparatus according to Embodiment 4 of the present invention;
图 10为本发明实施例五提供的编码方法流程示意图; 10 is a schematic flowchart of an encoding method according to Embodiment 5 of the present invention;
图 11为本发明实施例六提供的解码方法流程示意图; FIG. 11 is a schematic flowchart of a decoding method according to Embodiment 6 of the present invention;
图 12为本发明实施例七提供的编码装置结构示意图; 12 is a schematic structural diagram of an encoding apparatus according to Embodiment 7 of the present invention;
图 13是本发明实施例八提供的解码装置结构示意图; 13 is a schematic structural diagram of a decoding apparatus according to Embodiment 8 of the present invention;
图 14是本发明实施例九提供的编码方法流程示意图; 14 is a schematic flowchart of an encoding method provided in Embodiment 9 of the present invention;
图 15是本发明实施例十提供的编码装置结构示意图。 具体实施方式 FIG. 15 is a schematic structural diagram of an encoding apparatus according to Embodiment 10 of the present invention. Detailed ways
为使本发明实施例的目的、 技术手段和优点更加清楚明白, 以下结合附图
对本发明实施例作进一步详细说明。 In order to make the objects, technical means and advantages of the embodiments of the present invention more clear, the following The embodiments of the present invention are further described in detail.
在本发明实施例中, 首先分析数据经两种不同变换后数据数值范围的变化, 然后根据不同变换和量化后数据数值范围的变化, 对其中一种变换后的数据进 行补偿, 以保证相同的待编码数据经该变换和量化后数据的数值范围与经另一 种变换和量化后数据的数值范围保持基本一致, 以提高编码效率。 In the embodiment of the present invention, firstly, the data is subjected to two different transformed data value ranges, and then the transformed data is compensated according to the different transformed and quantized data value ranges to ensure the same. The range of values of the data to be encoded after the transformation and quantization is substantially consistent with the range of values of the data after another transformation and quantization to improve coding efficiency.
图 1为本发明实施例中变换数据处理方法的总体流程图。 如图 1所示, 该方 法包括: FIG. 1 is a general flowchart of a method for processing transformed data according to an embodiment of the present invention. As shown in Figure 1, the method includes:
步骤 101 , 根据预设两种变换所需的变换矩阵, 计算图像数据分别经过两种 变换后的数值范围。 Step 101: Calculate the range of values of the image data after the two transformations according to the transformation matrix required by the preset two transformations.
步骤 102, 根据所述两种变换后的数值范围, 计算两种变换的数值范围特征 差值。 Step 102: Calculate a difference value range characteristic value of the two transforms according to the two transformed numerical ranges.
根据不同的补偿方式, 上述两种变换的数值范围特征差值取值也不同, 可 以为图像数据分别经过两种变换和对应量化后数值范围的差值, 或者也可以为 图像数据分别经过两种变换后数值范围的差值。 当该特征差值为分别经过两种 变换和对应量化后数值范围的差值时, 在计算该特征差值时, 包括根据图像数 据对应的量化点查找到的两种变换各自的量化步长计算所述两种变换的数值范 围特征差值。 According to different compensation methods, the values of the difference values of the above two types of transformations are also different, and the difference between the two types of image data and the corresponding quantized value range may be obtained, or the image data may be subjected to two types respectively. The difference in the range of values after the transformation. When the feature difference is a difference between the two types of transforms and the corresponding quantized value range, when calculating the feature difference, the calculation includes the quantization step size of each of the two transforms found according to the quantization point corresponding to the image data. The two transformed numerical range feature difference values.
步骤 103 , 对待变换的数据应用所述两种变换中的一种, 并根据计算的数值 范围的差值补偿该变换后的数据。 Step 103: Apply one of the two transformations to the data to be transformed, and compensate the transformed data according to the difference of the calculated numerical range.
在本发明实施例以及下述实施例中, 所述变换数据处理方法具体可以包括 编码方法或解码方法等。 In the embodiment of the present invention and the following embodiments, the transform data processing method may specifically include an encoding method, a decoding method, and the like.
图 2为本发明实施例中变换数据处理装置的总体结构图。 如图 2所示, 该 装置包括第一数值范围估计单元、 第二数值范围估计单元、 数值范围差值单元
和变换补偿单元。 FIG. 2 is a general structural diagram of a transform data processing apparatus according to an embodiment of the present invention. As shown in FIG. 2, the apparatus includes a first value range estimating unit, a second value range estimating unit, and a numerical range difference unit. And transform compensation unit.
其中, 第一数值范围估计单元, 用于根据预设两种变换中的第一种变换所 需的变换矩阵, 计算图像数据经过第一种变换后的数值范围, 并提供给数值范 围差值单元。 The first value range estimating unit is configured to calculate a range of values of the image data after the first transformation according to a transformation matrix required by the first one of the preset two transformations, and provide the value range difference unit .
第二数值范围估计单元, 用于根据预设两种变换中的第二变换所需的变换 矩阵, 计算图像数据经过第二变换后的数值范围, 并提供给数值范围差值单元。 And a second value range estimating unit, configured to calculate a range of values of the image data after the second transformation according to a transformation matrix required by the second transformation in the preset two transformations, and provide the value range difference unit.
数值范围差值单元, 用于根据分别经过第一、 第二变换后的数值范围, 计 算两种变换的数值范围特征差值, 并提供给变换补偿单元。 The numerical range difference unit is configured to calculate the numerical range characteristic difference values of the two transformed values according to the numerical ranges after the first and second transformations, respectively, and provide the same to the transform compensation unit.
变换补偿单元, 用于对待变换的数据应用第一种变换, 并根据计算的所述 数值范围特征差值补偿该第一种变换后的数据。 And a transform compensation unit, configured to apply a first transform to the data to be transformed, and compensate the first transformed data according to the calculated numerical range feature difference value.
需要说明的是, 在本发明实施例及下述所有实施例中, 所述变换数据处理 装置具体可以为编码装置或解码装置。 It should be noted that, in all embodiments of the present invention and the following embodiments, the transform data processing apparatus may be specifically an encoding apparatus or a decoding apparatus.
在上述方法和装置中, 补偿变换后数据的方式可以是: 根据两种变换后数 据的数值范围间的关系, 确定一个合适的调整因子, 对经过其中一种变换所得 的数据乘以该调整因子, 再按照其对应的量化点进行量化, 从而使经过该变换 及量化后所得数据的数值范围与经过另外一种变换和量化后所得数据的数值范 围一致。 In the above method and apparatus, the manner of compensating the transformed data may be: determining an appropriate adjustment factor according to the relationship between the numerical ranges of the two transformed data, and multiplying the data obtained by one of the transformations by the adjustment factor. Then, the quantization is performed according to the corresponding quantization points, so that the numerical range of the data obtained after the transformation and quantization is consistent with the numerical range of the data obtained by another transformation and quantization.
或者, 补偿变换后的数据的方式还可以是: 根据两种变换后数据的数值范 围间的关系, 对其中一种变换对应的量化点进行调整, 再按照调整后的量化点 对该变换所得数据进行量化, 从而也能实现使该变换及量化后所得数据的数值 范围与经过另外一种变换和量化后所得数据的数值范围一致。 Alternatively, the method for compensating the transformed data may be: adjusting the quantization points corresponding to one of the transformations according to the relationship between the numerical ranges of the two transformed data, and then adjusting the data according to the adjusted quantization points. Quantization is performed so that the numerical range of the data obtained by the transformation and quantization can be made to coincide with the numerical range of the data obtained by another transformation and quantization.
又或者, 补偿变换后的数据的方式还可以是: 根据两种变换后数据的数值 范围间的关系, 为其中一种变换重新建立量化表, 再按照重建的量化表对该变
换所得数据进行量化, 从而同样能实现使该变换及量化后所得数据的数值范围 与经过另外一种变换和量化后所得数据的数值范围一致。 Alternatively, the manner of compensating the transformed data may be: according to the relationship between the numerical ranges of the two transformed data, re-establishing the quantization table for one of the transformations, and then changing the quantization table according to the reconstructed quantization table. The data obtained is quantized, so that the numerical range of the data obtained by the transformation and the quantization can be made to be consistent with the numerical range of the data obtained by another transformation and quantization.
以下通过不同的实施例, 说明上述三种不同处理方式下本发明的具体实施 方式。 其中, 实施例一〜二针对第一种处理方式, 实施例三针对第二种处理方 式, 实施例四针对第三种处理方式。 The specific embodiments of the present invention in the above three different processing modes will be described below through different embodiments. The first embodiment is directed to the first processing mode, the third embodiment is directed to the second processing mode, and the fourth embodiment is directed to the third processing mode.
实施例一: Embodiment 1:
在本实施例中, 假定有编码数据块 C, 及变换 A和变换 B。 变换 A的尺度 为 nxn, 变换 B的尺度为 mxm。 在对数据块 C编码时使用量化点 , 变换 A 及变换 B在量化点为 时所查找到的量化步长分别为 QTABl [s]和 QTAB2[s]。 这里, 在对数据进行量化时, 每个不同的编码区域(例如, 数据块 C )对应一个 量化点, 根据该量化点查找到对应的量化步长, 进行量化处理。 调整经变换 A 和相应量化所得数据的数值范围, 使之与变换 B和相应量化后所得数据的数值 范围一致。 本实施例中, 两种变换的数值范围特征差值为图像数据分别经过两 种变换和对应量化后数值范围的差值。 In the present embodiment, it is assumed that there is an encoded data block C, and a transform A and a transform B. The scale of transformation A is nxn, and the scale of transformation B is mxm. The quantization point is used when encoding the data block C, and the quantization step sizes of the transform A and the transform B found at the quantization point are QTAB1 [s] and QTAB2[s], respectively. Here, when the data is quantized, each different coding region (for example, the data block C) corresponds to one quantization point, and the corresponding quantization step size is found according to the quantization point, and the quantization process is performed. The range of values of the transformed A and the corresponding quantized data is adjusted to be consistent with the range of values of the transformed B and the corresponding quantized data. In this embodiment, the difference value range of the two transformed values is the difference between the two types of image data and the corresponding quantized value range.
图 3为本发明实施例一中变换数据处理方法的具体流程图。 如图 3所示, 该方法包括: FIG. 3 is a specific flowchart of a method for processing transformed data according to Embodiment 1 of the present invention. As shown in Figure 3, the method includes:
步骤 301 , 根据预设两种变换所需的变换矩阵, 计算图像数据分别经过两种 变换后的数值范围。 Step 301: Calculate the range of values of the image data after the two transformations according to the transformation matrix required by the preset two transformations.
本步骤中, 将编码块 C按照变换 、 B的尺度划分成子块, 将变换 A、 B 分别应用到各子块上。根据变换 、 B对应的变换矩阵, 计算划分的子块中各个 像素数据经变换后的数值范围。 对于任意一种变换下, 计算变换后数值范围的 方式相同, 下面以计算经变换 A后子块内各个像素数据的数值范围为例, 说明 具体计算方法。
假定编码块 C大小为 MxN, T为变换 A对应的变换矩阵, T'为 T的转置矩阵, 则对于编码块 C应用变换 A包括: 计算 [TOT']®S, 其中, S为缩放因子矩阵, 该矩阵用于使 [ΤΟΤ']之后的数据归一化, ·为矩阵相乘符号, @表示矩阵的各个 对应元素相乘。 根据矩阵乘法可以算得 [Τ· Τ,]的数值范围增量。 In this step, the coding block C is divided into sub-blocks according to the scale of the transform and B, and the transforms A and B are respectively applied to the respective sub-blocks. Calculating the transformed range of values of each pixel data in the divided sub-blocks according to the transformation and the transformation matrix corresponding to B. For any type of transformation, the method of calculating the converted value range is the same. The following is an example of calculating the numerical range of each pixel data in the sub-block after the transformation A, and the specific calculation method is explained. Assuming that the coding block C size is MxN, T is the transformation matrix corresponding to transform A, and T' is the transposed matrix of T, then applying transform A to coding block C includes: calculating [TOT']®S, where S is a scaling factor Matrix, which is used to normalize the data after [ΤΟΤ'], multiply the symbols by the matrix, and @ to represent the respective elements of the matrix. According to the matrix multiplication, the numerical range increment of [Τ· Τ,] can be calculated.
首先计算 [Τ· Τ,]相对于 C的数值范围增量: Τ,中第列系数绝对值之和为 dp 则该列与 C中第 i行相乘后得到数据的数值范围, 最大变为 C中第 z行第列数据数 值范围的 倍。 由于计算机及硬件处理器均以二进制为单位进行信息存储, 故 本文中以二进制形式表示数值范围, 这里将该列与 C中第 z行相乘后数据的数值 范围最大增量表示为 log2( )。 如上可以算出 [Τ· Τ,]后 C中每一个元素的最大数 值范围增量。 First calculate the increment of the range of [Τ· Τ,] relative to C: Τ, the sum of the absolute values of the coefficient in the middle column is dp, then the value range of the data obtained by multiplying the column with the ith row in C, the maximum becomes The multiple of the value range of the data in the zth row and column column in C. Since both the computer and the hardware processor store information in binary units, the numerical range is represented in binary form herein. Here, the maximum increment of the numerical range of the data after multiplying the column by the zth row in C is expressed as log 2 ( ). As above, you can calculate the maximum value range increment for each element in C after [Τ· Τ,].
然后计算 [TOT']®S相对于 [Τ· Τ']的数值范围增量: 若 S中位于 (k,h)的元 素的绝对值为 S( ) , 则 [TOT']®S之后, 相对于 [ΤΟΤ'], 点 (k,h)的数值范围增 量为 log2(S(t ¾))。 Then calculate the increment of the value range of [TOT']®S relative to [Τ· Τ']: If the absolute value of the element at (k, h) in S is S( ), then after [TOT']®S, The value range increment for point (k,h) is log 2 (S( t 3⁄4 )) relative to [ΤΟΤ'].
将上述两步计算的数值范围增量相加,可以计算得出 [TOT,]®S之后 C中每 一点的最大数值范围增量。再根据编码块 C本身的数值范围,即可以得到变换后, 每个子块中各点的数值最大数值范围。 Adding the numerical range increments calculated in the above two steps, you can calculate the maximum value range increment for each point in C after [TOT,]®S. According to the numerical range of the coding block C itself, the maximum value range of the values of each point in each sub-block can be obtained after the transformation.
经过上述方式计算得到的是编码块 C经变换后的最大数值范围,而在实际编 码中一个普通编码块 C, 由于编码块 C中的数据服从一定的数学分布, 而很难均 达到自身的最大数值范围, 因此经变换后的数值范围很可能达不到最大数值范 围。 因此, 优选地, 在进行数值范围计算时, 进一步考虑编码块 C的数学分布状 况。 Calculated in the above manner is the maximum value range after the coding block C is transformed, and in the actual coding, a common coding block C, because the data in the coding block C obeys a certain mathematical distribution, it is difficult to reach its maximum The range of values, so the converted range of values is likely to fall short of the maximum value range. Therefore, preferably, the mathematical distribution of the coded block C is further considered when performing the numerical range calculation.
具体地, 假设块 C中的数值承一定数学分布, 将变换 A应用到该分布中, 再 通过上述方法可以计算得出 C经变换后数据的数值范围最有可能出现的区域。例
如, 假设 M x N大小数据块 C的数据的数学分布模型为 P(x,y), 该数据块第 i行各 点最大可能数值范围表示为
其中 /(·)为根据数学分布模型 Ρ求得的映射关系, 其含义为点 (x,y ) ,(0<=x<=M,0<=y<=N)所对应的最大可能 出现的数值范围, 即点 (x,y )在编码时最有可能的数值为 2/(p(w» , 将 2/(p(w»设 为 ^。 同时, 假设变换 T'第 j列各点的系数值为 T'G,y), ( 0<=y<=N ) , 则 T'第 j 列与 C中第 i行相乘后, C第 i行数据数值范围最大增量为: log2(|∑T j'x2v' |) , 由此 可计算得出经变换 [Τ· Τ,] ® S后数据块 C各点最大可能出现的数值范围。 Specifically, it is assumed that the value in the block C has a certain mathematical distribution, and the transformation A is applied to the distribution, and then the above-mentioned method can be used to calculate the region where the numerical range of the C-transformed data is most likely to occur. example For example, suppose the mathematical distribution model of the data of the M x N size data block C is P(x, y), and the maximum possible numerical range of each point of the i-th row of the data block is expressed as Where /(·) is the mapping relationship obtained according to the mathematical distribution model, and its meaning is the maximum possible occurrence of the point (x, y), (0<=x<=M, 0<=y<=N) The range of values, that is, the most likely value of the point (x, y) at the time of encoding is 2 / (p( w» , 2 / (p( w» is set to ^. Also, assume that transform T' j-th column The coefficient value of the point is T'G,y), ( 0<=y<=N ), then the maximum increment of the data range of the ith row of C is multiplied by the i-th row of C. Log 2 (|∑T j'x2 v ' |) , from which the maximum possible range of values for each point of the data block C after the transformation [Τ· Τ,] ® S can be calculated.
经过上述方式进行数值范围的计算后, 可以得到编码块 C中的子块经变换 After the calculation of the numerical range in the above manner, the sub-block in the coding block C can be transformed.
A后各点数据的数值范围: The range of values of the data after each point of A:
All A12 Α1(η-1) Α1η All A12 Α1(η-1) Α1η
A21 A22 A2(n-l) A2n A21 A22 A2(n-l) A2n
Anl An2 An(n-l) Ann Anl An2 An(n-l) Ann
而编码块 C中的子块经变换 B后各点数据的数值范围为: The value range of the data of each point after the sub-block in the coding block C is transformed is:
Bll B12 B13 Bl(m-2) Bl(m-l) Blmm Bll B12 B13 Bl(m-2) Bl(m-l) Blmm
B21 B22 B23 B2(m-2) B2(m-1) B2mm B21 B22 B23 B2(m-2) B2(m-1) B2mm
B31 B32 B33 B3(m-2) B3(m-1) B3mm
Bml Bm2 Bm3 Bm(m-2) Bm(m-l) Bmm B31 B32 B33 B3(m-2) B3(m-1) B3mm Bml Bm2 Bm3 Bm(m-2) Bm(ml) Bmm
步骤 302, 针对两种变换, 分别计算变换后的平均数值范围。 Step 302: Calculate the transformed average value range for each of the two transformations.
本步骤中, 对于两种变换的平均数值范围计算方法相同。 仍以变换 A为例, 计算变换后的平均数值范围的方式可以为: 其中, 为步骤
In this step, the calculation method for the average value range of the two transformations is the same. Still taking the transformation A as an example, the manner of calculating the transformed average value range may be:
301中得到的变换 A后的子块内第 ,行第 ·列像素数据的数值范围。 类似地, 变 换 Β后的平均数值范围计算方式为: 为变换 B后的
子块内第 I行第 j列像素数据的数值范围。 The numerical range of the pixel data of the first row and the row in the sub-block after the transformation A obtained in 301. Similarly, the average value range after the transformation is calculated as: The range of values of the pixel data of the first row and the jth column in the sub-block.
步骤 303 , 根据步骤 302中得到的变换后平均数值范围, 计算两种变换和相 应量化后的数值范围差值。 Step 303: Calculate the difference between the two types of transforms and the corresponding quantized value range according to the transformed average value range obtained in step 302.
本步骤中, 首先计算经两种变换和相应量化后的数值范围。 仍以变换 A和 相应量化为例说明。 如前所述, 对编码块 C使用量化点 对应于该量化点, 变换 A查找到的量化步长为 QTABl[s] , 利用步骤 202中计算的 A r表示经变换 A后所得数据块各点平均的数值范围, 数值范围以二进制形式表示, 则编码数 据经变换 A后所得数值平均值为 2Av 。 In this step, the range of values after two transformations and corresponding quantization is first calculated. The transformation A and the corresponding quantization are still taken as an example. As described above, the quantization block is used for the coding block C corresponding to the quantization point, the quantization step size of the transformation A is QTAB1[s], and the A r calculated in step 202 is used to represent the data block obtained after the transformation A. The average numerical range, the numerical range is expressed in binary form, and the average value of the encoded data after transformation A is 2 Av .
通常在视频编解码中数据的量化过程可以表示为: The quantization process of data usually in video codec can be expressed as:
( XxQTAB[s] ) »shift[s] ( 1 ), ( XxQTAB[s] ) »shift[s] ( 1 ),
其中 X为待量化的数值, s为量化点, QTAB[n]为根据量化点 n在量化表中 查得的量化步长, shift[s]为量化点 s所对应的移位。 根据上述步骤可知, 利用量 化步长 QTABl[s]进行量化后所得数值平均值为 (QTABl[s].2Av ) »shift[s] , 以 二进制的形式表示该数据的数值范围为(A ^ + log^TMSlW ^hif^s 同理, 经
过变换 B 和以 QTAB2[s]为量化步长的量化后, 所得数据的数值范围为 ( AvrB + log2 QTAB2[s] )»shift[s]。 接下来, 计算两种变换和相应量化后的数值范围差值。 具体计算方式为: 计算两种变换和相应量化后数值间的倍数关系, 即 (QTAB2[S]x 2A » Shift[S] ^ 将 Where X is the value to be quantized, s is the quantization point, QTAB[n] is the quantization step size found in the quantization table according to the quantization point n, and shift[s] is the shift corresponding to the quantization point s. According to the above steps, the average value obtained by quantization using the quantization step QTAB1[s] is (QTABl[s].2 Av ) »shift[s] , and the numerical range of the data is expressed in binary form (A ^ + log^TMSlW ^hif^s Similarly, by After over-transform B and quantification with QTAB2[s] as the quantization step size, the value range of the obtained data is ( Avr B + log 2 QTAB2[s] )»shift[s]. Next, the two transformations and the corresponding quantized numerical range difference are calculated. The specific calculation method is: Calculate the multiple relationship between the two transformations and the corresponding quantized values, ie (QTAB2[ S ]x 2 A » S hift[ S ] ^
(QTAB\[s]x 2AvrA ) » shift[s] 该倍数关 系转化为二进制形式表示的数值范 围 间 的差值为 : τν , QTAB2[s]x2Av¾ »shift[s] τΑ Ώ ν (QTAB\[s]x 2 AvrA ) » shift[s] The difference between the range of values expressed in binary form is: τν , QTAB2[s]x2 Av3⁄4 »shift[s] τΑ Ώ ν
52 QTABl[s]x2A¾ »shift[s] L」 52 QTABl[s]x2 A3⁄4 »shift[s] L ”
( A ^ + log^r^SlW 步骤 304, 根据步骤 303中的差值, 确定变换 A的调整因子。 (A ^ + log^r^SlW Step 304, determining the adjustment factor of the transform A according to the difference in step 303.
本步骤中, 根据步骤 303中得到的数值范围差值, 确定的变换 A的调整因 子为 q = 2D'。 In this step, according to the numerical range difference obtained in step 303, the adjustment factor of the transformed A is determined to be q = 2 D '.
上述步骤计算过程中所需数据均为先验数据, 即在编码之前可以获得的数 据, 因此上述步骤可以在编码前完成并将结果保存, 无需在编码过程中计算。 The data required in the above calculation process is a priori data, that is, data that can be obtained before encoding, so the above steps can be completed before encoding and the results are saved without calculation in the encoding process.
在实际编码中变换 A的调整因子可能会因编码数据的差异而做调整, 故在 编码时变换 A的调整因子可以根据编码数据的特性做适当的调整。 所述的编码 数据特性可以为数据块经变换 A之后的实际平均数值范围。 并将变换 A的调整 因子写入编码码流中。 变换 A的调整因子可以写在码流的序列头或图像头或条 带头或宏块头中。 变换 A的调整因子的使用方式与上述方法相同, 这里不再赘 述。 In the actual coding, the adjustment factor of the transform A may be adjusted due to the difference of the encoded data, so the adjustment factor of the transform A at the time of encoding can be appropriately adjusted according to the characteristics of the encoded data. The encoded data characteristic may be the actual average range of values after the data block has been transformed A. The adjustment factor of transform A is written into the encoded code stream. The adjustment factor of transform A can be written in the sequence header or image header or slice header or macroblock header of the code stream. The adjustment factor of the transformation A is used in the same manner as the above method, and will not be described here.
步骤 305, 对编码块 C应用变换 A, 获得变换后的数据, 并将所得数据均乘 以变换 A的调整因子。 Step 305, applying a transform A to the coding block C, obtaining the transformed data, and multiplying the obtained data by the adjustment factor of the transform A.
本步骤中, 对编码块 C应用变换 A, 其具体过程与现有的方式相同, 这里 就不再赘述。 将变换得到的数据乘以步骤 204 中的调整因子, 即对于变换后所
得的各个数据有: C, ' = C, .2D',其中, C,为变换后第 i行第 j列的像素数据值, 为调整后第 i行第 j列的像素数据的重建值。 In this step, the transform A is applied to the coding block C, and the specific process is the same as the existing one, and will not be described here. Multiply the transformed data by the adjustment factor in step 204, that is, after the transformation The obtained data are: C, ' = C, .2 D ', where C is the pixel data value of the i-th row and the j-th column after the transformation, and is the reconstructed value of the pixel data of the i-th row and the j-th column after the adjustment. .
步骤 306, 利用变换 A查找到的量化步长对各个 进行量化。 Step 306, quantizing each by using the quantization step size found by the transform A.
依照现有的方式对变换 A后经过调整的各个 进行量化。 由于步骤 205中 利用调整因子对各个 C,进行了重建得到 C, ' , 并且该调整因子是根据两种变换和 相应量化后数值范围的差值确定的, 因此, 本步骤对各个 进行量化后得到数 据的数值范围就能够与编码块 C经过变换 B和相应量化后得到数据的数值范围 保持一致。 Each of the adjusted ones after the transformation A is quantized in accordance with the existing method. Since each C is reconstructed by using the adjustment factor in step 205 to obtain C, ', and the adjustment factor is determined according to the difference between the two types of transformations and the corresponding quantized value ranges, therefore, this step is performed by quantizing each The numerical range of the data can be consistent with the numerical range of the data obtained by the transforming block B and the corresponding quantized data.
具体推导过程如下: 由于量化过程中的移位对变换 A和变换 B对影响是相 同的, 以下就不再考虑移位的影响。 The specific derivation process is as follows: Since the shift in the quantization process has the same effect on the transformation A and the transformation B, the influence of the displacement is not considered below.
如前所述, 编码块 C应用变换 A后的平均数值范围为 A r , 则编码数据经 变换 A 后所得数值为 , 那 么乘以调整因子后的结果即为 As described above, the average value range after the coding block C is applied to transform A is A r , and the value obtained by transforming the encoded data A is , then the result of multiplying the adjustment factor is
, 以二进制表 示的数值范围为 AVrB + log2 QTAB2[s] - log2 QTAB\[s]; 再利用量化步长 QTAB1 [S]进 行量化后得到的结果为 2Α +1°^™β2Μ_^β™ ] · ρ?¾ 1 = 2Av +1°gf w , 以二进制表 示的数值范围为 Αν + log2 QTAB2[s]。而编码块 C应用变换 B后的平均数值范围为 AvrB,则编码数据经变换 A后所得数值为 , 再利用量化步长 QTAB2[s]进行量 化后得到的结果为 2Αν · β7¾52 ,以二进制表示的数值范围为 Αν + log2 QTAB2[s]。 可见, 同样的编码块 C经过步骤 205和 206的操作后, 与经过变换 B和相应量 化后所得数据的数值范围相同。 实现了使变换 A和变换 B最终数值范围一致的 目的。 The value range expressed in binary is A V r B + log 2 QTAB2[s] - log 2 QTAB\[s]; The result obtained by quantizing the quantization step QTAB1 [S] is 2 Α +1 °^ TM β2 Μ_^βTM ] · ρ?3⁄4 1 = 2 Av +1 ° g f w , the range of values in binary is Αν + log 2 QTAB2[s]. The average value range after the coding block C is applied to the transform B is Avr B , and the value obtained by transforming the encoded data is A, and the result obtained by quantizing the quantization step QTAB2[s] is 2 Αν · β73⁄452 , in binary. The range of values represented is Αν + log 2 QTAB2[s]. It can be seen that the same coding block C has the same value range as the data obtained after the transformation B and the corresponding quantization after the operations of steps 205 and 206. The purpose of making the final numerical range of the transformation A and the transformation B consistent is achieved.
至此, 本实施例提供的对变换数据处理方法流程结束。 So far, the flow of the method for processing the transformed data provided by the embodiment ends.
依照上述方法进行编码侧的变换数据处理, 从而选择变换 A和变换 B中较
优的变换方式。 若最终选择的变换方式为变换 A, 则发送给解码端的数据即为 经变换 A和相应量化及熵编码等处理后的数据。 这时, 在解码端对数据依照变 换 A对应的量化点进行反量化后, 需要对反量化后的结果除以变换 A的调整因 子后再进行反变换, 以重建编码端数据。 其中, 变换 A的调整因子可以根据上 述步骤 301 ~ 304的过程在解码端获得。 若解码端为避免使用除法, 可让解码数 据通过乘法及移位方式达到解码数据除以调整因子的目的。 Performing transform data processing on the encoding side according to the above method, thereby selecting transform A and transform B Excellent transformation method. If the finally selected transform mode is transform A, the data sent to the decoder is data processed by transform A and corresponding quantization and entropy coding. At this time, after the data is inverse quantized according to the quantization point corresponding to the transform A at the decoding end, the inverse quantized result is divided by the adjustment factor of the transform A, and then inversely transformed to reconstruct the encoded end data. The adjustment factor of the transform A can be obtained at the decoding end according to the procedures of the foregoing steps 301-304. If the decoding end avoids the use of division, the decoded data can be multiplied and shifted to achieve the purpose of dividing the decoded data by the adjustment factor.
若在编码时编码码流已包含变换 A的调整因子, 则解码端从码流中包含有 调整因子的地方, 如序列头、 图像头、 条带头、 宏块头, 得到变换 A的调整因 子。 变换 A的调整因子的使用方式与上述方法相同, 这里不再赘述。 If the coded stream already contains the adjustment factor of the transform A at the time of encoding, the decoding end obtains the adjustment factor of the transform A from the place where the adjustment factor is included in the code stream, such as the sequence header, the picture header, the slice header, and the macroblock header. The adjustment factor of the transformation A is used in the same manner as the above method, and will not be described again here.
本实施例还提供了变换数据处理装置的一种具体实施方式, 可以用于实施 上述图 3所示的方法。 图 4即为该实施方式下变换数据处理装置的具体结构图。 如图 4 所示, 该装置包括第一数值范围估计单元、 第二数值范围估计单元、 数 值范围差值单元和变换补偿单元。 其中, 变换补偿单元包括调整因子确定子单 元、 变换子单元、 变换后处理子单元和量化子单元。 This embodiment further provides a specific implementation of the transform data processing apparatus, which can be used to implement the method shown in FIG. Fig. 4 is a view showing a specific configuration of the down conversion data processing apparatus of the embodiment. As shown in Fig. 4, the apparatus includes a first value range estimating unit, a second value range estimating unit, a numerical range difference unit, and a transform compensating unit. The transform compensation unit includes an adjustment factor determining sub-unit, a transform sub-unit, a post-transform processing sub-unit, and a quantized sub-unit.
第一数值范围估计单元, 用于根据预设两种变换中的第一种变换所需的变 换矩阵, 计算图像数据经过第一种变换后的数值范围, 并提供给数值范围差值 单元。 The first value range estimating unit is configured to calculate a range of values of the image data after the first transformation according to a transformation matrix required by the first one of the preset two transformations, and provide the value range difference unit.
第二数值范围估计单元, 用于根据预设两种变换中的第二变换所需的变换 矩阵, 计算图像数据经过第二变换后的数值范围, 并提供给数值范围差值单元。 And a second value range estimating unit, configured to calculate a range of values of the image data after the second transformation according to a transformation matrix required by the second transformation in the preset two transformations, and provide the value range difference unit.
数值范围差值单元, 用于根据分别经过第一、 第二变换后的数值范围和第 一、 第二变换各自对应第量化点, 计算图像数据分别经过第一、 第二变换和对 应量化后数值范围的差值, 并提供给变换补偿单元。 a value range difference unit, configured to calculate, according to the first and second transformed value ranges and the first and second transforms respectively corresponding to the second quantization point, the image data is subjected to the first and second transformations and the corresponding quantized values respectively. The difference in range is provided to the transform compensation unit.
在变换补偿单元中, 调整因子确定子单元, 用于根据所述数值范围差值单
元提供的数值范围的差值确定调整因子, 并提供给变换后处理子单元。 变换子 单元, 用于对待变换的数据应用第一种变换, 并将变换结果提供给变换后处理 子单元。 变换后处理子单元, 用于将经第一种变换后的数据乘以确定的调整因 子, 并将结果提供给量化子单元。 量化子单元, 根据图像数据对应的量化点对 乘以调整因子后的结果进行量化。 In the transform compensation unit, the adjustment factor determining subunit is used to calculate a difference value according to the numerical range The difference in the range of values provided by the element determines the adjustment factor and is provided to the post-transformation subunit. A transform subunit that applies a first transform to the data to be transformed and provides the transform result to the post-transform processing sub-unit. The post-transform processing sub-unit is configured to multiply the first transformed data by a determined adjustment factor, and provide the result to the quantizing sub-unit. The quantizing sub-unit quantizes the result obtained by multiplying the adjustment factor by the quantization point corresponding to the image data.
若编码端将调整因子写入码流中, 则相应的还需增加调整因子写入单元, 用于将调整因子写入码流中。 If the encoding end writes the adjustment factor into the code stream, the corresponding adjustment factor writing unit needs to be added to write the adjustment factor into the code stream.
在本实施例中, 首先对变换 A后的数据乘以一个调整因子, 然后再进行量 化处理。 由公式(1 )表示的量化过程可以看出, 在量化处理时, 首先要与量化 步长相乘, 然后再对相乘结果做右移位, 也就是舍掉其中的低位信息。 那么经 变换 A后的数据乘以该调整因子并对该结果乘以量化步长 QTABl [s]后,可能低 位并不为 0 , 而是仍然集中了部分信息, 这时在进行移位时, 就会造成数据精度 的损失。 基于此, 为降低量化过程中数据精度的损失, 在本实施例基础上还提 出了一种演进处理方式, 通过乘以变换 A的调整因子并增加移位的方式改变经 变换 A后数据的数值范围。 In the present embodiment, the data after the transformation A is first multiplied by an adjustment factor, and then quantized. As can be seen from the quantization process represented by the formula (1), in the quantization process, it is first multiplied by the quantization step size, and then the right multiplication is performed on the multiplication result, that is, the low-order information is discarded. Then, after the data after the transformation A is multiplied by the adjustment factor and the result is multiplied by the quantization step QTABl [s], the lower bit may not be 0, but some information is still concentrated, and when the shift is performed, This will result in a loss of data accuracy. Based on this, in order to reduce the loss of data precision in the quantization process, an evolution processing method is also proposed based on the present embodiment, and the value of the data after the transformed A is changed by multiplying the adjustment factor of the transform A and increasing the shifting manner. range.
具体地,对应图 3所示的流程, 步骤 301 ~ 303的操作不变,在步骤 304中, 确定的变换 A的调整因子变为 q' = 2ΰ' χ2" , 将其称为调整系数, 其中, 《的取值 根据编码端硬件存储范围而定, 在保证变换 Α后的数据与调整因子 q'相乘后, 其后续操作的数据均不超出硬件存储范围的条件下,《的取值越大越好。 这样能 够将变换 A后的数据中信息尽量集中于高位。 Specifically, corresponding to the flow shown in FIG. 3, the operations of steps 301 to 303 are unchanged. In step 304, the adjustment factor of the determined transformation A becomes q' = 2 ΰ ' χ 2", which is called an adjustment coefficient. Wherein, the value of "the value is determined according to the hardware storage range of the encoding end. After the data after the guaranteed transformation is multiplied by the adjustment factor q', the data of the subsequent operation does not exceed the hardware storage range, and the value of "the value" The bigger the better, this will be able to focus the information in the data after the transformation A as high as possible.
接下来, 在步骤 305中, 将变换所得数据与上述调整因子 q'相乘。 Next, in step 305, the transformed data is multiplied by the above adjustment factor q'.
最后, 在步骤 306中对数据进行量化时, 将量化点对应的移位位数再增加《 位, 也就是在执行完量化操作后, 再将量化结果右移 n位。 这样, 能够将由上
面修改后的步骤 304中因调整因子的改变而使数值范围扩大的 2"倍补偿回来。 简 单地讲 , 上述修改后 的 步骤 305 ~ 306 的操作 即 为 : ( 2D x2" xXxQTAB[s])»shift[s]+n, 其中, X表示变换后的数据。 直观地看, 该 操作与原步骤 305 ~ 306中的操作(2ΰ' xXxQTAB[s])»shift[s]相比, 其结果相同, 但是在硬件平台下实现时, 前者的精度损失要比后者小。 这是因为, 在修改后 的步骤 305 中, 乘以调整因子 q'后, 数据 X被扩大了 2ΰ' χ2"倍, 相对于原步骤 305操作后的数据, 其有用信息被放大了, 更多地集中于高位, 这样在修改后的 步骤 306 中量化所涉及的移位过程中, 被移位而损失的有用信息相对减少了。 这样, 便能够更有效地提高数据精度。 Finally, when the data is quantized in step 306, the bit number corresponding to the quantization point is further increased by "bit", that is, after the quantization operation is performed, the quantization result is shifted to the right by n bits. In this way, it will be able to In step 304 after the surface modification, the 2" times of the numerical range is expanded due to the change of the adjustment factor. Briefly, the operations of the above modified steps 305 ~ 306 are: ( 2 D x2" xXxQTAB[s] )»shift[s]+n, where X represents the transformed data. Intuitively, the operation is the same as the operation in the original steps 305 ~ 306 (2 ΰ ' xXxQTAB[s])»shift[s], but when implemented on a hardware platform, the accuracy loss of the former is better than The latter is small. This is because, in the modified step 305, after multiplying the adjustment factor q', the data X is expanded by 2 ΰ ' χ 2" times, and the useful information is enlarged relative to the data after the original step 305 operation, More emphasis is placed on the upper bits, so that during the shifting process involved in the quantization step 306, the useful information lost by the shift is relatively reduced. Thus, the data accuracy can be more effectively improved.
当编码端釆用上述实施例一的演进方式后, 在解码端对于经过变换 Α处理 的数据进行反变换和反量化时, 也要进行相应的逆操作。 具体地, 在反量化时, 将移位位数减小 n, 并在反量化后反变换前, 将反量化结果除以变换 A的调整 因子 q', 然后进行反变换, 以更准确地重建编码端数据。 When the encoding end uses the evolution mode of the first embodiment, when the decoding end performs inverse transform and inverse quantization on the data processed by the transform, the corresponding inverse operation is also performed. Specifically, in inverse quantization, the number of shift bits is reduced by n, and the inverse quantization result is divided by the adjustment factor q' of the transform A before inverse quantization, and then inversely transformed to more accurately reconstruct Encoding data.
当然, 对应上述演进方式本发明也提供了对应的演进装置结构, 该结构与 图 4 所示的结构类似, 区别在于该变换补偿单元包括调整系数及移位偏移量子 单元、 变换子单元、 变换后处理子单元和量化子单元。 而对于第一数值范围估 计单元、 第二数值范围估计单元和数值范围差值单元的结构与功能均与图 4 所 示的装置相同。 Of course, the present invention also provides a corresponding evolved device structure corresponding to the above evolution mode, and the structure is similar to the structure shown in FIG. 4, except that the transform compensation unit includes an adjustment coefficient and a shift offset quantum unit, a transform subunit, and a transform. Post-processing sub-unit and quantization sub-unit. The structure and function of the first numerical range estimating unit, the second numerical range estimating unit and the numerical range difference unit are the same as those shown in Fig. 4.
在该演进装置的变换补偿子单元中, 调整系数及移位偏移量子单元, 用于 根据计算的数值范围特征差值确定调整系数和量化时的移位偏移量, 并分别提 供给变换后处理子单元和量化子单元。 变换子单元, 用于对待变换的数据应用 第一种变换, 并将变换结果提供给变换后处理子单元。 变换后处理子单元, 用 于将经第一种变换后的数据乘以确定的调整系数, 并将结果提供给量化子单元。
量化子单元, 根据所述移位偏移量和第一种变换对应的量化步长对乘以调整因 子后的结果进行量化。 In the transform compensation subunit of the evolved device, the adjustment coefficient and the shift offset quantum unit are configured to determine the adjustment coefficient and the shift offset amount during quantization according to the calculated numerical range feature difference value, and respectively provide the transformed offset amount Processing subunits and quantizing subunits. A transform subunit that applies a first transform to the data to be transformed and provides the transform result to the post-transform processing sub-unit. The post-transform processing sub-unit is configured to multiply the first transformed data by the determined adjustment coefficient, and provide the result to the quantizing sub-unit. The quantizing sub-unit quantizes the result multiplied by the adjustment factor according to the shift offset and the quantization step size corresponding to the first type of transform.
在上述实施方式中, 计算两种变换和相应量化后数值范围的差值时, 利用 的是两种变换后的平均数值范围。 为使数值范围计算更加准确, 还可以釆用实 施例二的方式进行。 In the above embodiment, when calculating the difference between the two kinds of transforms and the corresponding quantized value ranges, the averaged range of values after the two transforms is used. In order to make the numerical range calculation more accurate, it can also be carried out in the manner of the second embodiment.
实施例二: Embodiment 2:
本实施例中, 与实施例一类似, 两种变换的数值范围特征差值为图像数据 分别经过两种变换和对应量化后数值范围的差值, 但是该差值的具体计算方式 与实施例一中不同。 In this embodiment, similar to the first embodiment, the difference value range of the two transformed values is the difference between the two types of image data and the corresponding quantized value range, but the specific calculation method of the difference is compared with the first embodiment. Different in the middle.
图 5为本实施例中提供的对变换数据处理方法具体流程图。 如图 5所示, 该方法包括: FIG. 5 is a specific flowchart of a method for processing transformed data provided in the embodiment. As shown in Figure 5, the method includes:
步骤 501 , 根据预设两种变换所需的变换矩阵, 计算图像数据分别经过两种 变换后的数值范围。 Step 501: Calculate the range of values of the image data after the two transformations according to the transformation matrix required by the preset two transformations.
本步骤的计算方式与实施例一中的步骤 301相同, 这里就不再赘述。 The calculation method of this step is the same as that of step 301 in the first embodiment, and details are not described herein again.
步骤 502, 计算变换 B后的平均数值范围。 In step 502, the average value range after the transformation B is calculated.
本步骤中计算变换 B 后平均数值范围的方式与实施例一中相同, 包括 AvrB = f Bij , 其中, 为变换 B后的子块内第 z行第 ·列像素数据的数值 范围。 The manner of calculating the average value range after the transformation B in this step is the same as that in the first embodiment, and includes Avr B = f Bij , where is the numerical range of the pixel data of the z-th row and the column in the sub-block after the transformation B.
步骤 503 , 根据步骤 501 中得到的经变换 A后各个数据的数值范围和步骤 502得到的经变换 B后的平均数值范围,计算两种变换和相应量化后的数值范围 差值。 Step 503: Calculate the two types of transforms and the corresponding quantized value range difference values according to the value range of each data after the transformed A obtained in step 501 and the average value range after the transformed B obtained in step 502.
本步骤中, 计算数值范围的差值时的方法原理与实施例一中相同, 区别在
于, 本实施例中的数据范围的差值, 根据变换 A后各个数据的数值范围和经变 换 B后的平均数值范围进行计算。 具体地, 对于编码块 C按照变换 A的尺度划 分成子块后, 该子块中第 i行第 j列的像素数据经变换 A后对应与变换 B后的 数据范围差值为: d'( ) =( AvrB + log2 QTAB2[n] )- ( Aij + log2 QTAB\[n] ) , (K=i<=w, \<=}<=m) ,其中, 为经变换 A后的子块内第 z行第 ·列像素数据的 数值范围。 In this step, the method principle when calculating the difference of the numerical range is the same as that in the first embodiment, and the difference is The difference of the data range in this embodiment is calculated according to the numerical range of each data after the transformation A and the average value range after the transformation B. Specifically, after the coding block C is divided into sub-blocks according to the scale of the transform A, the pixel data of the i-th row and the j-th column in the sub-block is transformed into A, and the data range difference corresponding to the transformed B is: d' ( ) =( Avr B + log 2 QTAB2[n] )- ( Aij + log 2 QTAB\[n] ) , (K=i<=w, \<=}<=m) , where is the transformed A The range of values of the pixel data of the zth row and column in the subblock.
步骤 504, 根据步骤 503中得到的数值范围差值, 确定变换 Α的调整因子。 本步骤中, 确定调整因子的方式与实施例一相同, 且针对子块中第 i行第 j 列的像素数据而定, 包括 = 。 Step 504: Determine, according to the value range difference obtained in step 503, an adjustment factor of the transform Α. In this step, the adjustment factor is determined in the same manner as in the first embodiment, and is determined for the pixel data of the i-th row and the j-th column in the sub-block, including =.
这样, 求得的调整因子是根据像素位置的变化而变化的。 Thus, the obtained adjustment factor is varied according to the change in the pixel position.
步骤 505, 对编码块 C应用变换 A, 获得变换后的数据, 并将所得数据均对 应乘以变换 A的调整因子。 Step 505, applying a transform A to the coding block C, obtaining the transformed data, and multiplying the obtained data by the adjustment factor of the transform A.
本步骤中, 在与调整因子相乘时, 将第 i行第 j列的像素数据变换后的结果 与相应的调整因子 q,y相乘, 即 ς.' = ς. · 2 这样, 将使得变换结果的调整更加准 确。 In this step, when multiplied by the adjustment factor, the result of transforming the pixel data of the i-th row and the j-th column is multiplied by the corresponding adjustment factor q, y , that is, ς.' = ς. · 2 The adjustment of the transformation result is more accurate.
步骤 506, 利用变换 Α查找到的量化步长对各个 进行量化。 Step 506, quantizing each of the quantization step sizes found by transform Α.
至此, 即完成了对变换 A的所得数据的补偿, 其补偿原理与实施例一的推 导过程相同, 这里就不再赘述。 其区别在于, 在补偿过程中, 调整因子的计算 针对像素数据所在位置的变化而变化, 使得补偿的结果更加准确, 使最终两种 变换和相应量化后所得数据的数值范围的一致程度更高, 从而能够更加有效地 选择较优的变换, 进一步提高编码效率。 At this point, the compensation for the data obtained by the transformation A is completed, and the compensation principle is the same as that of the first embodiment, and will not be described here. The difference is that in the compensation process, the calculation of the adjustment factor changes for the change of the position of the pixel data, so that the compensation result is more accurate, so that the final two kinds of transformations and the corresponding quantized data have a higher degree of consistency. Thereby, a better transformation can be selected more effectively, and the coding efficiency is further improved.
在实际编码中变换 A的根据像素所在位置调整因子可能会因编码数据的差 异而做调整, 故在编码时变换 A的调整因子可以根据编码数据的特性做适当的
调整。所述的编码数据特性可以为数据块经变换 A之后的各个像素位置的数值。 并将变换 A的调整因子写入编码码流中。 变换 A的调整因子可以写在码流的序 列头或图像头或条带头或宏块头中。 变换 A的调整因子的使用方式与上述方法 相同, 这里不再赘述。 In the actual encoding, the adjustment factor of the position of the pixel according to the position of the pixel may be adjusted due to the difference of the encoded data, so the adjustment factor of the transform A at the time of encoding can be appropriately determined according to the characteristics of the encoded data. Adjustment. The encoded data characteristic may be a value of each pixel location after the data block is transformed A. The adjustment factor of transform A is written into the encoded code stream. The adjustment factor of transform A can be written in the sequence header or image header or strip header or macroblock header of the code stream. The adjustment factor of the transformation A is used in the same manner as the above method, and will not be described again here.
本实施例中的方法也可以釆用实施例一中图 4所示的装置来实现。 The method in this embodiment can also be implemented by using the apparatus shown in FIG. 4 in the first embodiment.
考虑到补偿准确性的问题, 本实施例也提供了一种演进的补偿方式, 包括: 根据获得的两种变换和相应量化后数值范围的差值, 确定调整因子 f( )和系数偏 移量 s^) , 在进行补偿时, 首先利用 f( )与变换后的数据相乘, 然后再将该乘积 结果加上系数偏移量 s( ) , 目的在于让以下关系成立 f ( ) x Aij+ s(!. ) = AvrB ,Considering the problem of compensation accuracy, the embodiment also provides an evolved compensation method, including: determining an adjustment factor f( ) and a coefficient offset according to the obtained two transforms and the difference between the corresponding quantized value ranges s^) , when compensating, first multiply the transformed data by f( ), and then add the coefficient offset s( ) to the product result, so that the following relationship holds f ( ) x Aij+ s (! . ) = Avr B ,
(K=i<=n, K=j<=n), 从而保证补偿的准确性。 最后再将加上偏移量后的结果按 照变换 A对应的量化步长进行量化。 相应地, 在解码端, 与编码端相应设置 f( ) 和 s^) , 并对接收到的待反量化的数据进行反量化后, 减去 再除以 f( ) , 然后 再进行变换 A对应的反变换, 以准确重建编码端图像数据。 (K=i<=n, K=j<=n), thus ensuring the accuracy of the compensation. Finally, the result of adding the offset is quantized according to the quantization step corresponding to the transform A. Correspondingly, at the decoding end, f ( ) and s^) are set corresponding to the encoding end, and the received data to be dequantized is inversely quantized, subtracted and divided by f( ), and then transformed to A correspondingly. The inverse transform to accurately reconstruct the encoded image data.
对于上述演进的补偿方式, 本发明也提供了对应的演进装置结构, 该结构 与图 4 所示结构类似, 区别在于, 其中的变换补偿单元包括调整因子和偏移量 子单元、 变换子单元、 变换后处理子单元和量化子单元。 其它第一数值范围估 计单元、 第二数值范围估计单元、 数值范围差值单元的结构和功能均与图 4 所 示的装置相同。 For the above-mentioned evolved compensation mode, the present invention also provides a corresponding evolved device structure, which is similar to the structure shown in FIG. 4, wherein the transform compensation unit includes an adjustment factor and an offset quantum unit, a transform subunit, and a transform. Post-processing sub-unit and quantization sub-unit. The structure and function of the other first numerical range estimating unit, the second numerical range estimating unit, and the numerical range difference unit are the same as those shown in Fig. 4.
在变换补偿单元中, 调整因子和系数偏移量子单元, 用于根据所述数值范 围差值单元提供的数值范围差值确定调整因子和系数偏移量, 并提供给变换后 处理子单元。 变换子单元, 用于对待变换的数据应用第一种变换, 并将变换结 果提供给变换后处理子单元。 变换后处理子单元, 用于将经第一种变换后的数 据乘以确定的调整因子再加上偏移量, 并将结果提供给量化子单元。 量化子单
元, 根据第一种变换对应的量化步长对乘以调整因子并加上系数偏移量后的结 果进行量化。 In the transform compensation unit, the adjustment factor and the coefficient offset quantum unit are configured to determine an adjustment factor and a coefficient offset according to the value range difference value provided by the value range difference unit, and provide the converted processing subunit. A transform subunit that applies a first transform to the data to be transformed and provides the transform result to the post-transform processing sub-unit. The post-transform processing sub-unit is configured to multiply the first transformed data by a determined adjustment factor plus an offset, and provide the result to the quantizing sub-unit. Quantized sub-list The element quantizes the result obtained by multiplying the adjustment factor by the quantization step size corresponding to the first type of transform and adding the coefficient offset.
与实施例一类似, 在解码端可以预先计算变换 A的调整因子, 当变换 A作 为较优的变换方式时, 解码端在进行反量化后, 将反量化结果除以各自对应的 变换 A的调整因子, 然后再进行反变换, 从而重建编码端数据。 Similar to the first embodiment, the adjustment factor of the transform A can be calculated in advance at the decoding end. When the transform A is used as the better transform mode, the decoding end divides the inverse quantization result by the adjustment of the corresponding transform A after performing inverse quantization. The factor is then inverse transformed to reconstruct the encoded data.
若在编码时编码码流已包含变换 A的调整因子, 则解码端从码流中包含有 调整因子的地方, 如序列头、 图像头、 条带头、 宏块头, 得到变换 A的调整因 子。 变换 A的调整因子的使用方式与上述方法相同, 这里不再赘述。 If the coded stream already contains the adjustment factor of the transform A at the time of encoding, the decoding end obtains the adjustment factor of the transform A from the place where the adjustment factor is included in the code stream, such as the sequence header, the picture header, the slice header, and the macroblock header. The adjustment factor of the transformation A is used in the same manner as the above method, and will not be described again here.
实施例三: Embodiment 3:
本实施例中, 对变换 A所得数据的补偿方式与前两个实施例不同, 釆用的 是调整量化点的方式进行补偿。 另外, 与实施例一类似, 本实施例中两种变换 的数值范围特征差值为图像数据分别经过两种变换和对应量化后数值范围的差 值。 具体地, 图 6为实施例三中提供的对变换数据处理方法具体流程图。 如图 6 所示, 该方法包括: In this embodiment, the compensation method for the data obtained by transforming A is different from the previous two embodiments, and the method of adjusting the quantization points is used for compensation. In addition, similar to the first embodiment, the numerical value difference values of the two transformed values in the embodiment are the difference between the two types of image data and the corresponding quantized value ranges. Specifically, FIG. 6 is a specific flowchart of a method for processing transformed data provided in Embodiment 3. As shown in Figure 6, the method includes:
步骤 601 ~ 603 , 根据预设两种变换所需的变换矩阵, 计算图像数据分别经 过两种变换后的数值范围; 针对两种变换, 分别计算变换后的平均数值范围; 并计算两种变换和相应量化后的数值范围差值。 Steps 601 ~ 603, according to the transformation matrix required by the preset two transformations, calculate the range of values of the image data after the two transformations respectively; calculate the average range of values after the transformation for the two transformations; and calculate the two transformation sums The corresponding quantized value range difference.
步骤 601 ~ 603 中的操作与实施例一中步骤 301 ~ 303的操作相同, 这里就 不再赘述。 The operations in steps 601 to 603 are the same as the operations in steps 301 to 303 in the first embodiment, and will not be described here.
步骤 604, 根据步骤 603中的差值确定量化点偏移量。 Step 604, determining a quantization point offset according to the difference in step 603.
本实施例中,通过调整变换 A对应的量化点,对变换 A所得数据进行补偿, 从而使其获得与变换 B相一致的数值范围, 为选择较优的变换方式作准备。 In this embodiment, by adjusting the quantization points corresponding to the transform A, the data obtained by the transform A is compensated, so that the numerical range consistent with the transform B is obtained, and the optimal transform mode is prepared.
变换 A对应的量化点可以为预先设定好的量化点, 也可以为从变换 B得到
的量化点。 在视频标准中, 相邻两个量化点所对应量化步长通常成一定的倍数关系, 包括: 每隔 A个量化点, 其对应的量化步长在数值上变为原来的二分之一, 因 此可得相邻量化点所对应的量化步长间的倍数关系为 于是相隔 ,个量化点 所对应的量化步长间的倍数关系即为 (1/2) 又由于量化步长与利用该量化步 长进行量化后所得的数值呈正比, 因此, 通过调整量化点偏移量的方法亦可起 到数据数值范围调整的目的。 根据步骤 603中得到的变换 Α、 Β后的数值范围差值 D', 可以得到补偿该 数值范围的差值所需要的量化点偏移量。 具体地, 数值范围差值 D'对应的具体 数值倍数为 2D', 而量化点加上偏移量 Δ ρρ后, 其对应的量化步长是原量化步长The quantization point corresponding to the transform A may be a preset quantization point, or may be obtained from the transform B. Quantization point. In the video standard, the quantization step size corresponding to two adjacent quantization points usually has a certain multiple relationship, including: Every A quantization points, the corresponding quantization step size is numerically changed to the original one-half. Therefore, the multiple relationship between the quantization step sizes corresponding to the adjacent quantization points is such that the multiple relationship between the quantization step sizes corresponding to the quantization points is (1/2) and the quantization step size and the quantization are utilized. The value obtained by quantizing the step size is proportional. Therefore, the method of adjusting the offset of the quantization point can also adjust the range of data values. According to the transformed Α and the subsequent numerical range difference D′ obtained in step 603, the quantization point offset required to compensate the difference of the numerical range can be obtained. Specifically, the specific numerical multiple corresponding to the numerical range difference D' is 2 D ', and after the quantization point plus the offset Δ ρρ, the corresponding quantization step is the original quantization step.
「 门 ( _γ βρ "door ( _γ β ρ
的数为 (1/2;^ = 2 倍, 令二者相等, 则可以得到量化点偏移量 The number of the number is (1/2; ^ = 2 times, so that the two are equal, then the quantization point offset can be obtained.
- 」 、 J
'\ , 其中 I I为取整操作符。 因为量化步长的大小会影响数据的实际编 码效果, A QP可在上述计算公式基础上根据实验数据所得结果视量化步长的大 小进行调整。 当然, 量化点偏移量的计算也可以釆用其它公式, 只要能够反映步骤 603 中得到的数值范围的差值即可。 步骤 605 , 对编码块 C应用变换 A获得变换后的数据, 将变换 A对应的量 化点减去确定的量化偏移量, 再根据调整后的量化点查找到的量化步长进行量 化。 由步骤 604中推导 Δ
'|的过程可见,将量化点调整后,调整后的量 化步长与原量化步长的倍数关系为 2D' , 也就是调整后的量化步长变为
2D -QTABl[s] , 其中, QTABl [s]为原来的量化步长。 那么, 利用该 ^ί'爹正后的量化 步长进行量化后的结果为 2Α^ · ρ∑4 1 · 2ϋ = 2 Avr^eTAB2ls] , 以二进制表示的数值 范围为 Αν + log2 QTAB2[s]。显然该数值范围与经变换 B和相应量化后所得数据的 数值范围相同, 实现了使变换 A和变换 B最终数值范围一致的目的。 - ”, J '\ , where II is the rounding operator. Because the size of the quantization step will affect the actual coding effect of the data, A QP can be adjusted according to the results of the experimental data based on the size of the quantization step. Of course, the calculation of the quantization point offset can also use other formulas as long as the difference of the numerical range obtained in step 603 can be reflected. Step 605: Apply transform A to the coding block C to obtain the transformed data, subtract the quantized offset corresponding to the transform A by the determined quantization offset, and perform quantization according to the quantization step size found by the adjusted quantization point. Deriving Δ from step 604 The process of '| can be seen that after the quantization point is adjusted, the adjusted quantization step size has a relationship with the multiple of the original quantization step size of 2 D ', that is, the adjusted quantization step size becomes 2 D -QTABl[s] , where QTABl [s] is the original quantization step size. Then, using the result of the quantization step size 'the father ^ ί positive quantized to 2 Α ^ · ρΣ4 1 · 2 ϋ = 2 Avr ^ eTAB2ls], a numerical range is represented in binary Αν + log 2 QTAB2 [s]. Obviously, the numerical range is the same as the numerical range of the transformed B and the corresponding quantized data, and the purpose of making the final numerical range of the transform A and the transform B consistent is achieved.
至此, 本实施例提供的对变换数据处理方法流程结束。 So far, the flow of the method for processing the transformed data provided by the embodiment ends.
依照上述方法进行编码侧的变换数据处理, 从而选择变换 A和变换 B中较 优的变换方式。 若最终选择的变换方式为变换 A, 则发送给解码端的数据即为 经变换 A和相应量化及熵编码等处理后的数据。 这时, 在解码端需要预先根据 步骤 601 ~ 604计算变换 A对应的量化点偏移量,并对该量化点偏移量进行补偿, 包括将变换 A原对应的量化点基础上加上 Δ^ρ, 再利用该改变后的量化点对应 的量化步长对数据进行反量化和 Α的反变换, 以准确地重建编码端数据。 The transform data processing on the encoding side is performed in accordance with the above method, thereby selecting the preferred transform method in transform A and transform B. If the final selected transform mode is transform A, the data sent to the decoder is the data processed by transform A and corresponding quantization and entropy coding. At this time, the decoding end needs to calculate the quantization point offset corresponding to the transform A according to steps 601 to 604 in advance, and compensate the quantization point offset, including adding Δ^ to the quantization point corresponding to the original transform A. ρ, the inverse quantization of the data and the inverse transformation of the data are performed by using the quantization step size corresponding to the changed quantization point to accurately reconstruct the data of the encoding end.
在上述解码端步骤中, 对量化点偏移量进行补偿时, 亦可在变换 A原对应 的量化点基础上减去 ΔβΛ 再利用该改变后的量化点对应的量化步长对数据进 行反量化和反变换。在变换 Α原对应的量化点基础上加上或减去 Δρρ由量化表 特性决定, 为预先设定好的步骤, 其目的在于编码端数据经变换 Α处理后在解 码端能准确恢复。 In the decoding step, when the quantization point offset is compensated, the Δβ 减 may be subtracted from the quantization point corresponding to the original A of the transformation A, and the data is inversely quantized by the quantization step corresponding to the changed quantization point. And inverse transformation. Adding or subtracting Δρρ from the quantization point corresponding to the transform primitive is determined by the quantization table characteristic, which is a preset step, and the purpose is that the data of the encoding end can be accurately recovered at the decoding end after being processed by the transform.
在实际编码中变换 A量化偏移量可能会因编码数据的差异而做调整, 故在 编码时变换 A的调整因子可以根据编码数据的特性做适当的调整。 所述的编码 数据特性可以为数据块经变换 A之后的实际平均数值范围。 并将变换 A的量化 偏移量写入编码码流中。 即变换 A对应的量化点所减去的量化偏移量可取决于 编码一个序列、 一幅图像、 一个条带或一个宏块时数据经变换 A之后的数值范 围, 所减去的量化偏移量写入编码码流。 变换 A的量化偏移量可以写在码流的 序列头或图像头或条带头或宏块头中。 解码端若获知编码端码流包含了量化点
偏移量信息, 则从码流中的序列头或图像头或条带头或宏块头中获取量化偏移 量, 在变换 A原对应的量化点基础上减去量化偏移量。 这里所述编码端变换 A 对应的量化点及解码端变换 A原对应的量化点可以为预先设定好的量化点, 也 可以为与变换 B相同的量化点。 In the actual coding, the transform A quantization offset may be adjusted due to the difference of the encoded data, so the adjustment factor of the transform A at the time of encoding can be appropriately adjusted according to the characteristics of the encoded data. The encoded data characteristic may be an actual average range of values after the data block has been transformed A. The quantized offset of transform A is written into the encoded code stream. That is, the quantization offset subtracted by the quantization point corresponding to the transform A may depend on the range of values after the data is transformed A by encoding a sequence, an image, a strip or a macroblock, and the subtracted quantization offset The amount is written to the encoded code stream. The quantization offset of transform A can be written in the sequence header or image header or slice header or macroblock header of the code stream. If the decoding end knows that the coded code stream contains quantization points The offset information is obtained by subtracting the quantization offset from the sequence header or the image header or the slice header or the macroblock header in the code stream, and subtracting the quantization offset from the quantization point corresponding to the original of the transform A. Here, the quantization point corresponding to the coding end transform A and the quantization point corresponding to the decoding end transform A may be preset quantization points or the same quantization points as the transform B.
本实施例还提供了变换数据处理装置的另一种具体实施方式, 可以用于实 施上述图 6所示的方法。 图 7即为该实施方式下变换数据处理装置的具体结构 图。 如图 7所示, 该装置包括第一数值范围估计单元、 第二数值范围估计单元、 数值范围差值单元和变换补偿单元。 其中, 变换补偿单元包括量化点修正子单 元、 变换子单元和量化子单元。 This embodiment further provides another embodiment of the transform data processing apparatus, which can be used to implement the method shown in Fig. 6 above. Fig. 7 is a view showing a specific configuration of the down conversion data processing apparatus of the embodiment. As shown in FIG. 7, the apparatus includes a first numerical range estimating unit, a second numerical range estimating unit, a numerical range difference unit, and a transform compensating unit. The transform compensation unit includes a quantization point correction subunit, a transformation subunit, and a quantization subunit.
第一数值范围估计单元, 用于根据预设两种变换中的第一种变换所需的变 换矩阵, 计算图像数据经过第一种变换后的数值范围, 并提供给数值范围差值 单元。 The first value range estimating unit is configured to calculate a range of values of the image data after the first transformation according to a transformation matrix required by the first one of the preset two transformations, and provide the value range difference unit.
第二数值范围估计单元, 用于根据预设两种变换中的第二变换所需的变换 矩阵, 计算图像数据经过第二变换后的数值范围, 并提供给数值范围差值单元。 And a second value range estimating unit, configured to calculate a range of values of the image data after the second transformation according to a transformation matrix required by the second transformation in the preset two transformations, and provide the value range difference unit.
数值范围差值单元, 用于根据分别经过第一、 第二变换后的数值范围和第 一、 第二变换各自对应第量化点, 计算图像数据分别经过第一、 第二变换和对 应量化后数值范围的差值, 并提供给变换补偿单元。 a value range difference unit, configured to calculate, according to the first and second transformed value ranges and the first and second transforms respectively corresponding to the second quantization point, the image data is subjected to the first and second transformations and the corresponding quantized values respectively. The difference in range is provided to the transform compensation unit.
在变换补偿单元中, 量化点修正子单元, 用于根据数值范围差值单元提供 的数值范围的差值确定量化点偏移量, 并将第一种变换对应的量化点减去所述 量化点偏移量, 并将调整后的结果提供给量化子单元。 变换子单元, 用于对待 变换的数据应用第一种变换, 并将变换后的结果提供给量化子单元。 量化子单 元, 用于根据所述量化点修正子单元提供的调整后的量化点对变换后的结果进 行量化。
在上述本实施例的具体实施过程中,经变换 A、 B后的数值范围的差值是根 据平均数值范围计算的。 事实上, 该差值的计算可以釆用实施例二的方式进行, 即针对经变换 A后子块内各个像素, 分别计算数值范围的差值。 相应地, 在步 骤 604中调整变换 A对应的量化点时, 也针对经变换 A后子块内各个像素进行 调整, 具体地, AQP lwx Ad'^) ^ 然后, 在步骤 605中根据不同的像素, 按照调 整后的量化点对应的量化步长进行量化。 这样, 能够使补偿的结果更加准确, 使最终两种变换和相应量化后所得数据的数值范围的一致程度更高, 从而能够 更加有效地选择较优的变换, 进一步提高编码效率。 In the transform compensation unit, the quantization point correction sub-unit is configured to determine the quantization point offset according to the difference of the numerical range provided by the numerical range difference unit, and subtract the quantization point corresponding to the first type of the quantization point The offset, and the adjusted result is provided to the quantized subunit. A transform subunit applies a first transform to the data to be transformed, and provides the transformed result to the quantized subunit. And a quantization subunit, configured to quantize the transformed result according to the adjusted quantization point provided by the quantization point correction subunit. In the specific implementation process of the above embodiment, the difference of the numerical range after the transformation of A and B is calculated according to the average value range. In fact, the calculation of the difference can be performed in the manner of the second embodiment, that is, the difference of the numerical range is calculated for each pixel in the sub-block after the transformation A. Correspondingly, when the quantization point corresponding to the transform A is adjusted in step 604, the pixels in the sub-block after the transform A are also adjusted, specifically, AQP lwx Ad'^) ^ Then, according to different pixels in step 605 , quantizing according to the quantization step size corresponding to the adjusted quantization point. In this way, the result of the compensation can be made more accurate, and the numerical range of the final two kinds of transforms and the corresponding quantized data is more consistent, so that the better transform can be selected more effectively, and the coding efficiency is further improved.
相应地, 当编码端选择变换 A为较优的变换方式后, 在解码端预先根据上 述方法获得变换 A后各个像素数据对应的量化点偏移量, 并将待反量化的数据 各自对应的量化点加上偏移量, 再利用改变后的量化点对应的量化步长进行反 量化和反变换, 以准确地重建编码端数据。 Correspondingly, after the coding end selects the transform A as the preferred transform mode, the quantization point offset corresponding to each pixel data after the transform A is obtained in advance according to the above method, and the corresponding data of the data to be inverse quantized is respectively quantized. The offset is added to the point, and then the quantization step size corresponding to the changed quantization point is used for inverse quantization and inverse transformation to accurately reconstruct the encoded data.
当量化偏移量需要写入码流时, 可仿照前述方法进行码流的写入、 解析及 量化点偏移量在编码端和解码端对变换 A原对应的量化点的处理方法。 When the quantization offset needs to be written into the code stream, the code stream can be written, parsed, and quantized according to the foregoing method. The quantization point offset is processed at the encoding end and the decoding end.
在上述三个实施例中, 分别釆用了两种不同的方式对变换后的数据进行补 偿, 从而达到调整其数值范围的目的, 具体地, 一种方式是将变换后的数据乘 以一个调整因子, 另一种方式是改变该变换对应的量化点。 事实上, 可以将上 述两种方式结合起来进行变换后数据的补偿。 例如, 将变换后的数据乘以一个 调整因子 f, 同时将量化点偏移 s, 目的在于让以下关系成立: fx A ^ +s A ^ , (l<=i<=n, l<=j<=n)。 由于 A ^和 Αντβ为先验数据, f和 s可以为预先设定值, 且 值不唯一,具体 f和 S可以视 A ^和 Α τβ数据大小关系及编解码实现条件而设定。 若 f和 S需要根据图像编码数据进行调整, 则 f和 S可以写入编码码流中的序列 头、 图像头、 条带头、 宏块头等地方。 若编码码流含有 f和 S , 则解码端从编码
码流的相应位置, 例如序列头、 图像头、 条带头、 宏块头等, 解析得到 f^。S。 当然, 也可以将子块变换后的所有像素数据分别乘以一个对应的调整因子, 同时将量化点偏移 s( ) , 目的在于让以下关系成立: f ( ) x Aij+ s(!. ) = AvrB , (K=i<=n, l<=j<=n)。 其中, f( )和 s( )可以视 A ^和 ^数据大小关系及编解码 实现条件而设定。 若 .)和^)需要根据图像编码数据进行调整, 则 .)和 可 以写入编码码流中的序列头、 图像头、 条带头、 宏块头等地方。 In the above three embodiments, the transformed data is compensated in two different ways, so as to achieve the purpose of adjusting the range of values. Specifically, one way is to multiply the transformed data by an adjustment. Factor, another way is to change the quantization point corresponding to the transform. In fact, the above two methods can be combined to compensate the transformed data. For example, multiplying the transformed data by an adjustment factor f, and offsetting the quantization point by s, the purpose is to make the following relationship true: fx A ^ +s A ^ , (l<=i<=n, l<=j <=n). Since A ^ and Αντ β are a priori data, f and s can be preset values, and the values are not unique. The specific f and S can be set according to the A ^ and Α τ β data size relationship and the codec implementation conditions. If f and S need to be adjusted according to the image encoded data, f and S can be written to the sequence header, the image header, the slice header, the macroblock header, and the like in the encoded code stream. If the coded stream contains f and S, the decoding end is encoded. The corresponding position of the code stream, such as the sequence header, the image header, the slice header, the macroblock header, etc., is parsed to obtain f^. S. Of course, all the pixel data after sub-block transformation can also be multiplied by a corresponding adjustment factor, and the quantization point is offset by s ( ), so that the following relationship holds: f ( ) x Aij+ s (! . ) = Avr B , (K=i<=n, l<=j<=n). Among them, f ( ) and s ( ) can be set according to the data size relationship of A ^ and ^ and the codec implementation conditions. If .) and ^) need to be adjusted according to the image coded data, then .) and can be written to the sequence header, image header, slice header, macroblock header, etc. in the code stream.
若经过上述方式对经变换 A所得数据进行补偿, 在解码端可以预先设置相 同的 f( o s( ) , 当接收到对应变换 A的编码数据后,在对该数据进行反量化前, 调整变换 A对应的量化点,在原有量化点的基础上加上 s^) , 同时对待反量化的 数据除以对应的调整因子 f( ) , 再利用改变后的量化点对应的量化补偿对除以调 整因子后的待反量化数据进行反量化, 以准确重建编码端数据。 If the data obtained by the transformed A is compensated in the above manner, the same f ( os ( ) may be set in advance at the decoding end. After receiving the encoded data corresponding to the transformed A, the transform A is adjusted before the inverse quantization of the data. For the corresponding quantization point, add s^) to the original quantization point, and divide the inverse quantized data by the corresponding adjustment factor f( ), and then use the quantized compensation pair corresponding to the changed quantization point by the adjustment factor. The inverse anti-quantized data is inverse quantized to accurately reconstruct the encoded data.
若编码码流含有 f( )和 则解码端从编码码流的相应位置, 例如序列头、 图像头、 条带头、 宏块头等, 解析得到 f( )和 s( )。 If the coded stream contains f() and then the decoder extracts f() and s ( ) from the corresponding locations of the encoded stream, such as sequence headers, picture headers, slice headers, macroblock headers, and the like.
对应该上述两种补偿方式结合的方法, 本发明也提供了对应的装置结构。 该装置结构与图 7 所示的结构类似, 区别在于, 其中的变换补偿单元包括调整 因子及量化点修正子单元、 变换子单元、 变换后处理子单元和量化子单元。 其 它第一数值范围估计单元、 第二数值范围估计单元、 数值范围差值单元的结构 和功能均与图 7所示的装置相同。 The present invention also provides a corresponding device structure in response to the combination of the above two compensation methods. The structure of the apparatus is similar to that shown in FIG. 7, except that the transform compensation unit includes an adjustment factor and a quantization point correction subunit, a transformation subunit, a post-transformation processing sub-unit, and a quantization sub-unit. The structure and function of the other first numerical range estimating unit, the second numerical range estimating unit, and the numerical range difference unit are the same as those shown in Fig. 7.
在该变换补偿单元中, 调整因子及量化点修正子单元, 用于根据数值范围 差值单元提供的数值范围的差值确定调整因子和量化点偏移量, 并将第一种变 换对应的量化点减去所述量化点偏移量, 将调整后的量化点提供给所述量化子 单元, 将确定的调整因子提供给变换后处理子单元。 变换子单元, 用于对待变 换的数据应用第一种变换, 并将变换结果提供给变换后处理子单元。 变换后处
理子单元, 用于将经第一种变换后的数据乘以确定的调整因子, 并将结果提供 给量化子单元。 量化子单元, 根据所述调整后的量化点对应的量化步长对乘以 调整因子后的结果进行量化。 In the transform compensation unit, the adjustment factor and the quantization point correction sub-unit are configured to determine an adjustment factor and a quantization point offset according to a difference value range provided by the value range difference unit, and quantize the first type of transform The quantization point offset is subtracted from the point, the adjusted quantization point is provided to the quantization sub-unit, and the determined adjustment factor is provided to the transformed processing sub-unit. A transform subunit that applies a first transform to the data to be transformed and provides the transform result to the post-transform processing sub-unit. After the transformation a subunit, configured to multiply the first transformed data by a determined adjustment factor, and provide the result to the quantized subunit. The quantizing sub-unit quantizes the result multiplied by the adjustment factor according to the quantization step size corresponding to the adjusted quantization point.
在上述三个实施例中, 变换 A和变换 B可以釆用不同的量化表, 也就是根 据量化点查找到的量化步长是不同的, 但是对于量化表相同的情况而言, 釆用 上述方式对于数据精度的损失较大。 In the above three embodiments, the transform A and the transform B may use different quantization tables, that is, the quantization step sizes found according to the quantization points are different, but for the same case of the quantization table, the above method is used. The loss of data accuracy is large.
针对量化表相同的情况, 本发明提出了实施例四的实施方式, 对于其中的 一种变换, 重新设计一套量化表, 从而使两种变换和相应量化后数据的数值范 围相一致。 For the same case of the quantization table, the present invention proposes an embodiment of the fourth embodiment. For one of the transformations, a set of quantization tables is redesigned so that the numerical ranges of the two transformations and the corresponding quantized data are identical.
实施例四: Embodiment 4:
与前述三个实施例不同, 本实施例中, 两种变换的数值范围特征差值为图 像数据分别经过两种变换后数值范围的差值。 Different from the foregoing three embodiments, in this embodiment, the difference value range of the two transformed numerical ranges is the difference between the numerical values of the two transformed images of the image data.
图 8为本发明实施例四中变换数据处理方法的具体流程图。 如图 8所示, 该 方法包括: FIG. 8 is a specific flowchart of a method for processing transformed data according to Embodiment 4 of the present invention. As shown in Figure 8, the method includes:
步骤 801 ~ 802 , 根据预设两种变换所需的变换矩阵, 计算图像数据分别经 过两种变换后的数值范围; 针对两种变换, 分别计算变换后的平均数值范围; 步骤 801 ~ 802中的操作与实施例一中步骤 301 ~ 302的操作相同, 区别在 于, 针对不同的量化点分别进行上述操作。 也就是说, 对于所有不同的宏块, 分别计算该宏块经两种变换后的平均数值范围: Avr 和 Α^ ^μ 其中, η 为 量化点索引。 Steps 801 to 802, according to the transformation matrix required for the preset two transformations, calculate the image data to undergo two converted numerical ranges respectively; for the two transformations, respectively calculate the transformed average numerical range; in steps 801-802 The operation is the same as the operations of steps 301 to 302 in the first embodiment, except that the above operations are performed separately for different quantization points. That is to say, for all the different macroblocks, the average value range of the two transformed macroblocks is calculated separately: Avr and Α^^μ where η is the quantization point index.
步骤 803 , 计算两种变换后的数值范围差值。 Step 803: Calculate the difference between the two transformed numerical ranges.
针对不同的量化点计算两种变换后的数值范围差值, 具体地, Ad(«) = AvrB {n) - AvrA {n)。
事实上, 如前所述, 由于在视频编解码理论中, 通常使用均勾量化方法, 也就是每隔若干个量化点, 量化步长减小为原来一半, 因此 Δ(1(«)的数值也具有 一定规律性。 基于此, 这里可以做一个简化。 具体地, 设每隔 m个量化点, 量 化步长减小为原来一半, 则可以选择计算连续的 m个 Δ(1(«) , 例如, 本步骤仅计 算 Ad(l), Ad(2),L , Ad(m) , 下面即 4叚定计算了这 m个差值。 The two transformed value range differences are calculated for different quantization points, specifically, Ad(«) = Avr B {n) - Avr A {n). In fact, as mentioned above, since the video coding and decoding theory usually uses the homo-quantization method, that is, every few quantization points, the quantization step size is reduced to half, so the value of Δ(1(«) There is also a certain regularity. Based on this, a simplification can be made here. Specifically, it is assumed that every m quantization points, the quantization step size is reduced to half, then a continuous m Δ(1(«) can be selected. For example, this step only calculates Ad(l), Ad(2), L, Ad(m), and the following is the calculation of the m differences.
步骤 804, 设置各个量化点对应的量化步长和移位位数, 并形成量化表。 本步骤中,设置量化步长时,根据步骤 803中计算得到的差值进行。具体地, 对应于步骤 803中计算得到的 m个差值, 设置第 1至第 m个量化点所对应的量化步 长为: 2AdW xR, 2Ad(m) xR, 其中 R为一恒定系数值, 目的在于让量化步长的 值为一整数且提高计算精度(分子大了, 自然可以保留更多信息) , 但是考虑 到硬件存储范围的限制, 该 R值有其上限。 根据均匀量化原理, 由第 1至第 m个 量化点所对应的量化步长就可以推出其它量化点的量化步长。 Step 804, setting a quantization step size and a shift bit number corresponding to each quantization point, and forming a quantization table. In this step, when the quantization step size is set, it is performed according to the difference calculated in step 803. Specifically, corresponding to the m differences calculated in step 803, the quantization step corresponding to the first to mth quantization points is set to be: 2 AdW xR, 2 Ad(m) xR, where R is a constant coefficient The value is to make the value of the quantization step size an integer and improve the calculation accuracy (the numerator is large, naturally more information can be retained), but considering the limitation of the hardware storage range, the R value has an upper limit. According to the principle of uniform quantization, the quantization step size of the other quantization points can be derived from the quantization step corresponding to the 1st to mth quantization points.
当然, 在设置量化步长时, 也可以对所有的量化步长进行设置, 具体第 n个 量化点对应的量化步长为 2AdW xR。 Of course, when setting the quantization step size, all the quantization step sizes can also be set, and the quantization step size corresponding to the nth quantization point is 2 AdW xR.
在设置移位位数时将其设定为一固定值 t。 当该 t较大时, 编码效果较差, 压 缩编码率高; 当该 t较小时, 编码效果较好, 压缩编码率低。 因此, t的具体取值 需要综合考虑编码效果和压缩编码率, 找到一个较佳平衡点对应的 t。 Set the shift bit number to a fixed value t. When the t is large, the coding effect is poor, and the compression coding rate is high; when the t is small, the coding effect is good, and the compression coding rate is low. Therefore, the specific value of t needs to consider the coding effect and compression coding rate comprehensively, and find a t corresponding to a better balance point.
根据上述设置的移位位数和量化步长形成量化表, 该过程与现有的实现方 式相同, 这里就不再赘述。 The quantization table is formed according to the shift bit number and the quantization step size set as described above, and the process is the same as the existing implementation, and will not be described here.
步骤 805 , 接收待变换的数据, 并应用变换 A获得变换后的数据, 根据上述 量化表对变换后的数据进行量化。 Step 805: Receive data to be transformed, and apply transform A to obtain transformed data, and quantize the transformed data according to the quantization table.
经上述处理后,编码端数据经变换 A和上述量化表进行量化后数据的数值范 围与经变换 B和相应量化后的数值范围可达基本一致。
本实施例之所以实现发明目的的原理与实施例一相同, 具体地, 由于量化 过程中, 量化步长与量化后数据是成正比的, 因此根据上述量化步长对变换 A所 得数据进行量化的过程事实上与实施例一中对变换 A所得数据乘以一个调整因 子的过程基本等价, 都是乘以 2AdW的关系。 因此, 本实施例也可以实现调整数 值范围, 以使其与变换 B和相应量化后数值范围一致的目的。 After the above processing, the value range of the data after the encoding end data is quantized by the transform A and the quantization table is substantially consistent with the transformed B and the corresponding quantized numerical range. The principle of the present invention is the same as that of the first embodiment. Specifically, since the quantization step size is proportional to the quantized data in the quantization process, the data obtained by the transform A is quantized according to the quantization step size. The process is in fact substantially equivalent to the process of multiplying the data obtained by transform A by an adjustment factor in the first embodiment, which is multiplied by 2 AdW . Therefore, this embodiment can also achieve the purpose of adjusting the value range so as to be consistent with the transformation B and the corresponding quantized value range.
相应地, 在解码端还要设计与编码端的量化表相应的反量化表。 在反量化 表中,考虑到在编码端根据均匀量化的方法,第 n个量化点的量化步长为第 (n+m) 个量化点的量化步长的两倍, 在反量化表中利用移位来补偿量化步长间的倍数 关系, 也就是在反量化时第 n个量化点的移位位数 =第(11+111)个量化点的移位位数 +1。 第 1至 m个反量化点的移位位数可设为 k, 那么第 m+1至 2m个反量化点的移 位位数就相应为 k-l。 至于, k值的设定, 也是考虑硬件的存储范围而定, 原理与 前述考虑硬件存储范围的情况相同。 Correspondingly, an inverse quantization table corresponding to the quantization table of the encoding end is also designed at the decoding end. In the inverse quantization table, considering the method of uniform quantization at the encoding end, the quantization step size of the nth quantization point is twice the quantization step size of the (n+m)th quantization point, and is utilized in the inverse quantization table. The shift compensates for the multiple relationship between the quantization step sizes, that is, the number of shift bits of the nth quantization point in the inverse quantization = the shift number of the (11+111)th quantization point +1. The number of shift bits of the 1st to mth inverse quantization points can be set to k, and the number of shift bits of the m+1th to 2m inverse quantization points is correspondingly k-l. As for the setting of the k value, it is also considered in consideration of the storage range of the hardware, and the principle is the same as the case of considering the hardware storage range.
下面, 根据上述移位位数的设置, 计算反量化表的反量化步长为 IQ(n), 其 中 n为量化点。 IQ(n)需满足关系 2AdW xRxIQ(n)=
, 其中, 反映的是移位位 数的变化, 即每隔
Next, according to the setting of the shift bit number described above, the inverse quantization step size of the inverse quantization table is calculated as IQ(n), where n is the quantization point. IQ(n) needs to satisfy the relationship 2 AdW xRxIQ(n)= , where, reflects the change in the number of shift bits, ie every
m个量化点, 移位位数增加 1。 根据该公式可知 IQ(n)= m quantization points, the number of shift bits is increased by 1. According to this formula, IQ(n)=
2Ad(") . R 其中 h为一恒定常数, 其取值越大越好, 但是同样要受到硬件存储范围的限制。 按照上述方式建立反量化表, 这样在解码端, 使用变换 A的数据在进行反变 换后使用该建立的反量化表就可以恢复重建数据。 2 Ad (") . R where h is a constant constant, the larger the value, the better, but it is also limited by the hardware storage range. The inverse quantization table is established as described above, so that at the decoding end, the data of transform A is used. The reconstructed data can be recovered using the established inverse quantization table after the inverse transformation.
本实施例还提供了变换数据处理装置的一种具体实施方式, 可以用于实施 上述图 8所示的方法。 图 9即为该实施方式下变换数据处理装置的具体结构图。 如图 9 所示, 该装置包括第一数值范围估计单元、 第二数值范围估计单元、 数
值范围差值单元和变换补偿单元。 其中, 变换补偿单元包括量化表建立子单元、 变换子单元和量化子单元。 This embodiment further provides a specific implementation of the transform data processing apparatus, which can be used to implement the method shown in FIG. 8 above. Fig. 9 is a view showing a specific configuration of the down conversion data processing apparatus of the embodiment. As shown in FIG. 9, the apparatus includes a first numerical range estimating unit, a second numerical range estimating unit, and a number Value range difference unit and transform compensation unit. The transform compensation unit includes a quantization table establishment subunit, a transformation subunit, and a quantization subunit.
第一数值范围估计单元, 用于根据预设两种变换中的第一种变换所需的变 换矩阵, 计算图像数据经过第一种变换后的数值范围, 并提供给数值范围差值 单元。 The first value range estimating unit is configured to calculate a range of values of the image data after the first transformation according to a transformation matrix required by the first one of the preset two transformations, and provide the value range difference unit.
第二数值范围估计单元, 用于根据预设两种变换中的第二变换所需的变换 矩阵, 计算图像数据经过第二变换后的数值范围, 并提供给数值范围差值单元。 And a second value range estimating unit, configured to calculate a range of values of the image data after the second transformation according to a transformation matrix required by the second transformation in the preset two transformations, and provide the value range difference unit.
所述数值范围差值单元, 用于根据分别经过第一、 第二变换后的数值范围, 计算经过两种变换后数值范围的差值, 并将该差值作为数值范围特征差值提供 给所述变换补偿单元。 The value range difference unit is configured to calculate a difference between the two transformed value ranges according to the first and second converted value ranges respectively, and provide the difference as a numerical range characteristic difference value to the The transformation compensation unit.
在变换补偿单元中, 量化表建立子单元, 用于根据所述数值范围特征差值 为第一种变换建立对应的量化表, 并提供给量化子单元。 变换子单元, 用于对 待变换的数据应用第一种变换, 并将变换结果提供给量化子单元。 量化子单元, 根据所述第一种变换对应的量化表对第一种变换后的结果进行量化。 In the transform compensation unit, the quantization table establishing subunit is configured to establish a corresponding quantization table for the first type of transform according to the numerical range feature difference value, and provide the quantized subunit. A transform subunit, configured to apply a first transform to the data to be transformed, and provide the transform result to the quantized subunit. The quantizing subunit quantizes the first transformed result according to the quantization table corresponding to the first transform.
在上述本发明的实施例中, 均以对经变换 A的数据进行补偿为例, 说明本 发明的具体实施方式, 事实上, 也可以对经变换 B的数据进行补偿, 其实施方 式相同, 只是在对应公式中将变换 A和变换 B所对应的参量进行互换即可, 这 里就不再赘述。 In the above embodiments of the present invention, the data of the transformed A is compensated as an example to illustrate the specific implementation of the present invention. In fact, the data of the transformed B can also be compensated, and the implementation manner is the same, but only The parameters corresponding to the transformation A and the transformation B are interchanged in the corresponding formula, and will not be described here.
上述变换数据处理的方法可以用于编码方法中, 图 10是本发明实施例五提 供的编码方法流程示意图, 该编码方法包括以下步骤: The foregoing method for transforming data processing can be used in an encoding method. FIG. 10 is a schematic flowchart of an encoding method provided in Embodiment 5 of the present invention. The encoding method includes the following steps:
Al、 接收待变换的数据; Al, receiving data to be transformed;
所述待变换的数据包括经过预测得到的图像块残差。 The data to be transformed includes a predicted image block residual.
A2、 对所述待变换的数据进行第一变换, 得到第一变换后的数据; 对所述
待变换的数据进行第二变换, 得到第二变换后的数据; A2, performing a first transformation on the data to be transformed to obtain first transformed data; Performing a second transformation on the data to be transformed to obtain second transformed data;
所述的第一变换在这里为 4x4尺寸的变换; The first transform is here a 4x4 size transform;
所述的第二变换在这里为 8x8尺寸的变换; The second transform is here an 8x8 size transform;
A3、根据第一变换后的数据和第二变换后的数据确定第一变换的调整参数, 根据所述调整参数和第二变换的参数调整所述第一变换后的数据。 A3. Determine an adjustment parameter of the first transformation according to the first transformed data and the second transformed data, and adjust the first transformed data according to the adjustment parameter and the second transformed parameter.
这里的第一变换后的数据和第二变换后的数据包括前述的第一变换后的数 值范围和第二变换后的数值范围, 为描述方便, 釆用第一变换后的数据和第二 变换后的数据的叫法。 The first transformed data and the second transformed data herein include the first converted numerical range and the second transformed numerical range. For convenience of description, the first transformed data and the second transform are used. The name of the post data.
调整参数可以包括根据所述第一变换后的数据和第二变换后的数据确定调 整因子, 则所述根据所述调整参数和所述第二变换的参数调整所述第一变换后 的数据包括: 将经第一变换后的数据乘以所述调整因子; 根据对应的量化步长 对乘以调整因子后的数据进行量化。 Adjusting the parameter may include determining an adjustment factor according to the first transformed data and the second transformed data, and then adjusting the first transformed data according to the adjustment parameter and the second transformed parameter includes : multiplying the first transformed data by the adjustment factor; and quantizing the data multiplied by the adjustment factor according to the corresponding quantization step size.
调整参数可以包括根据第一变换后的数据和第二变换后的数据确定的量化 偏移量, 所述第二变换的参数为第二变换的量化点, 所述根据所述调整参数和 第二变换的参数调整所述第一变换后的数据包括: 将第二变换对应的量化点减 去所述量化偏移量作为第一变换的量化点; 利用调整后的第一变换的量化点对 经第一变换后的数据进行量化。 The adjustment parameter may include a quantization offset determined according to the first transformed data and the second transformed data, the second transformed parameter being a second transformed quantization point, and the adjusting parameter and the second Adjusting the first transformed data by the transformed parameter includes: subtracting the quantized offset corresponding to the second transform as the quantized point of the first transform; using the adjusted first transformed quantized point pair The first transformed data is quantized.
调整参数可以包括根据第一变换后的数据和第二变换后的数据确定的量化 偏移量和调整因子; 所述第二变换的参数为第二变换对应的量化点, 则所述根 据所述调整参数和所述第二变换的参数调整所述第一变换后的数据包括: 将经 第一变换后的数据乘以所述调整因子, 并将第二变换对应的量化点减去所述量 化偏移量作为第一变换的量化点; 利用所述第一变换的量化点对乘以调整因子 后的数据进行量化。
调整参数还可以包括根据第一变换后的数据和第二变换后的数据确定的调 整系数和量化移位偏移量; 所述第二变换的参数包括, 对第二变换数据的量化 点的移位数; 则所述根据所述调整参数和第二变换的参数调整所述第一变换后 的数据包括: 将经第一变换后的数据乘以所述调整系数, 并利用第一变换对应 的量化点的移位位数对所述与调整系数相乘后的数据进行量化; 所述第一变换 对应的量化点的移位位数为第二变换对应的量化点的移位位数与所述量化移位 偏移量之和。 The adjustment parameter may include a quantization offset and an adjustment factor determined according to the first transformed data and the second transformed data; the parameter of the second transformation is a quantization point corresponding to the second transformation, and then according to the Adjusting the parameter and the parameter of the second transform to adjust the first transformed data comprises: multiplying the first transformed data by the adjustment factor, and subtracting the quantization point corresponding to the second transform from the quantization The offset is used as a quantization point of the first transform; the data multiplied by the adjustment factor is quantized by the quantization point of the first transform. The adjustment parameter may further include an adjustment coefficient and a quantization shift offset determined according to the first transformed data and the second transformed data; the parameter of the second transformation includes: shifting a quantization point of the second transformed data Adjusting the first transformed data according to the adjustment parameter and the second transformed parameter includes: multiplying the first transformed data by the adjustment coefficient, and using the first transform And shifting the bit number of the quantization point to quantize the data multiplied by the adjustment coefficient; the shift bit number of the quantization point corresponding to the first transform is a shift bit number of the quantization point corresponding to the second transform The sum of the quantized shift offsets is described.
所述调整参数可以包括根据第一变换后的数据和第二变换后的数据确定的 调整因子和系数偏移量, 则所述根据所述调整参数和第二变换的参数调整所述 第一变换后的数据包括: 将经第一变换后的数据乘以所述调整因子, 再加上所 述系数偏移量并进行量化。 The adjustment parameter may include an adjustment factor and a coefficient offset determined according to the first transformed data and the second transformed data, and then adjusting the first transformation according to the adjustment parameter and the second transformed parameter. The subsequent data includes: multiplying the first transformed data by the adjustment factor, adding the coefficient offset and performing quantization.
A4、 将所述调整参数写入编码码流中。 A4. Write the adjustment parameter into the encoded code stream.
将所述调整参数写入编码码流中的序列头或图像头或条带头或宏块头中, 供解码端使用。 经上述处理后第一变换后数据的数值范围和第二变换后数据的数值范围大 致形同, 在编码时能更有效的反映变换对数据的影响, 来选择效果较优的变换, 进而提高编码效率。 图 11是本发明实施例六提供的解码方法流程示意图, 该方法包括: The adjustment parameter is written into a sequence header or an image header or a slice header or a macroblock header in the encoded code stream for use by the decoding end. After the above processing, the numerical range of the first transformed data is substantially the same as the numerical range of the second transformed data, and the effect of the transform on the data can be more effectively reflected in the encoding to select a better transform, thereby improving encoding. effectiveness. FIG. 11 is a schematic flowchart of a decoding method according to Embodiment 6 of the present invention, where the method includes:
Bl、 接收码流, 对所述码流进行解码, 获得第一变换后的数据和调整参数; 第一变换后的数据是指若当前解码图像块判断为使用第一变换, 则熵解码 后所得图像块残差经第一变换反变换后的数据;
所述的第一变换在这里为 4x4尺寸的反变换; Bl, receiving the code stream, decoding the code stream, obtaining the first transformed data and adjusting parameters; the first transformed data is obtained by entropy decoding if the currently decoded image block is determined to use the first transform The data after the image block residual is inverse transformed by the first transform; The first transform is here a 4x4 size inverse transform;
所述的第二变换在这里为 8x8尺寸的反变换; The second transform is here an inverse transform of 8x8 size;
所述调整参数与在编码时写入码流的调整参数相应。 The adjustment parameter corresponds to an adjustment parameter written to the code stream at the time of encoding.
B2、根据所述调整参数和所述第二变换的参数调整所述第一变换后的数据。 这个步骤包括多种方法, 分别是: B2. Adjust the first transformed data according to the adjustment parameter and the second transformed parameter. This step includes a variety of methods, namely:
( 1 )根据所述调整参数和所述第二变换的参数确定对第一变换后的数据的 调整因子: 根据第一变换对应的量化步长对第一变换后的数据进行反量化, 并 对反量化结果与所述调整因子之商进行反变换。 (1) determining, according to the adjustment parameter and the parameter of the second transformation, an adjustment factor for the first transformed data: performing inverse quantization on the first transformed data according to a quantization step size corresponding to the first transformation, and The inverse quantization result is inversely transformed with the quotient of the adjustment factor.
( 2 )若接收到的调整参数为量化偏移量, 则所述第二变换的参数为第二变 换对应的量化点, 第一变换的量化点为所述第二变换对应的量化点减去所述量 化偏移量, 所述根据所述量化偏移量和第二变换对应的量化点对第一变换后的 数据调整包括: 利用所述第一变换对应的量化点对所述第一变换后的数据进行 反量化, 并对反量化结果进行反变换。 (2) if the received adjustment parameter is a quantization offset, the parameter of the second transformation is a quantization point corresponding to the second transformation, and the quantization point of the first transformation is a quantization point corresponding to the second transformation minus The quantizing offset, the adjusting the first transformed data according to the quantized offset and the quantization point corresponding to the second transform comprises: using the quantization point corresponding to the first transform to the first transform The latter data is inverse quantized and the inverse quantization result is inversely transformed.
( 3 )若调整参数包括量化偏移量和对第一变换后的数据的调整因子; 则所 述第二变换的参数为第二变换对应的量化点, 第一变换的量化点为所述第二变 换的量化点减去所述量化偏移量; 所述根据所述调整参数和所述第二变换的参 数调整所述第一变换后的数据包括: 利用所述第一变换对应的量化点对第一变 换后的数据进行反量化; 对反量化结果与所述调整因子之商进行反变换。 (3) if the adjustment parameter includes a quantization offset and an adjustment factor for the first transformed data; then the parameter of the second transformation is a quantization point corresponding to the second transformation, and the quantization point of the first transformation is the The quantized point of the second transform is subtracted from the quantized offset; the adjusting the first transformed data according to the adjusting parameter and the second transformed parameter comprises: using a quantization point corresponding to the first transform Performing inverse quantization on the first transformed data; inversely transforming the inverse quantization result and the quotient of the adjustment factor.
( 4 )若所述调整参数包括第一变换的调整系数和对第一变换数据的量化移 位偏移量; 所述第二变换的参数包括, 对第二变换数据的量化点的移位数; 则 所述根据所述调整参数和所述第二变换的参数调整所述第一变换后的数据包 括: 将所述第二变换对应的量化点的移位位数减去所述量化移位偏移量作为第 一变换对应的量化点的移位位数; 利用所述第一变换对应的量化点的移位位数
对接收到第一变换后的数据进行反量化; 对反量化结果与所述调整系数之商进 行反变换。 (4) if the adjustment parameter includes a first transformed adjustment coefficient and a quantization shift offset for the first transformed data; the second transformed parameter includes a shift number of the quantized point of the second transformed data And adjusting the first transformed data according to the adjusting parameter and the second transformed parameter, comprising: subtracting the quantized shift of the quantized point corresponding to the second transform by the quantization shift An offset amount as a shift bit number of a quantization point corresponding to the first transform; a shift bit number of the quantization point corresponding to the first transform Performing inverse quantization on the data received by the first transform; and inversely transforming the inverse quantization result and the quotient of the adjustment coefficient.
(5)根据所述调整参数和所述第二变换的参数确定对第一变换数据的调整 因子; 根据所述调整参数和所述第二变换的参数确定对第一变换数据的系数偏 移量; 所述根据所述调整参数和所述第二变换的参数调整所述第一变换后的数 据包括: 根据所述第一变换对应的量化步长对接收到的数据进行反量化, 并对 反量化结果减去所述系数偏移量, 将所述相减结果与所述调整因子之商进行反 变换。 (5) determining an adjustment factor for the first transformed data according to the adjustment parameter and the parameter of the second transformation; determining a coefficient offset for the first transformed data according to the adjustment parameter and the parameter of the second transformation The adjusting the first transformed data according to the adjusting parameter and the second transformed parameter comprises: performing inverse quantization on the received data according to the quantization step size corresponding to the first transform, and The quantized result is subtracted from the coefficient offset, and the subtraction result is inversely transformed with the quotient of the adjustment factor.
与编码端相应, 所述调整参数从码流中的序列头或图像头或条带头或宏块 头中获得。 Corresponding to the encoding end, the adjustment parameters are obtained from a sequence header or an image header or a strip header or a macroblock header in the code stream.
图 12是本发明实施例七提供的编码装置结构示意图, 该编码装置包括: 数据接收单元, 用于接收待变换的数据; FIG. 12 is a schematic structural diagram of an encoding apparatus according to Embodiment 7 of the present invention, where the encoding apparatus includes: a data receiving unit, configured to receive data to be transformed;
变换单元, 用于对数据接收单元接收到的所述待变换的数据进行第一变换, 得到第一变换后的数据; 对所述待变换的数据进行第二变换, 得到第二变换后 的数据; a transform unit, configured to perform first transform on the data to be transformed received by the data receiving unit, to obtain first transformed data, and perform second transform on the data to be transformed to obtain second transformed data ;
第一调整单元, 根据第二变换的参数、 第一变换后的数据和第二变换后的 数据确定调整参数, 根据所述调整参数和第二变换的参数调整所述第一变换后 的数据; The first adjusting unit determines an adjustment parameter according to the second transformed parameter, the first transformed data, and the second transformed data, and adjusts the first transformed data according to the adjustment parameter and the second transformed parameter;
写单元, 用于将所述调整参数写入编码码流中。 And a writing unit, configured to write the adjustment parameter into the encoded code stream.
图 13是本发明实施例八提供的解码装置结构示意图, 该解码装置包括: 码流接收单元, 用于接收码流; 13 is a schematic structural diagram of a decoding apparatus according to Embodiment 8 of the present invention, where the decoding apparatus includes: a code stream receiving unit, configured to receive a code stream;
解码单元, 对所述码流进行解码, 获得第一变换后的数据和调整参数; 第二调整单元, 用于根据所述调整参数和第二变换的参数调整第一变换后
的数据。 Decoding unit, decoding the code stream to obtain first transformed data and adjusting parameters; and second adjusting unit, configured to adjust the first transform according to the adjusting parameter and the second transformed parameter The data.
上述编码装置和解码装置可以组成一套系统使用, 这里不在赘述。 实施例九: 一种编码方法 The above encoding device and decoding device can be used in a system, and are not described here. Embodiment 9: An encoding method
实施例九提供了一种编码方法,可以在编码端自适应地求取量化偏移量(前 述的调整参数) , 如图 14所示, 所述方法包括: Embodiment 9 provides an encoding method, which can adaptively obtain a quantization offset (the aforementioned adjustment parameter) at the encoding end. As shown in FIG. 14, the method includes:
Cl、 接收待变换的数据和已编码参数信息; Cl, receiving data to be transformed and encoded parameter information;
C2、 对所述待变换的数据进行第一变换, 得到第一变换后的数据; C2, performing a first transformation on the data to be transformed to obtain first transformed data;
C3、 根据已编码参数信息和第二变换的参数确定调整参数, 根据所述调整 参数和所述第二变换的参数调整所述第一变换后的数据; C3. Determine an adjustment parameter according to the encoded parameter information and the second transformed parameter, and adjust the first transformed data according to the adjustment parameter and the second transformed parameter;
C4、 将所述调整参数写入编码码流中。 C4. Write the adjustment parameter into the encoded code stream.
下面力 p以详细介绍。 The following force p is described in detail.
设变换 A的尺度为 4x4, 变换 B的尺度为 8x8。 Let the scale of transform A be 4x4, and the scale of transform B be 8x8.
本实施例中首先接收待变换的数据和已编码参数信息。 对所述待变换的数 据进行第一变换, 得到第一变换后的数据, 根据已编码参数信息和第二变换参 数确定调整参数。 这里所述第二变换参数为第二变换所对应的量化点, 所述调 整参数为量化偏移量。 In this embodiment, the data to be transformed and the encoded parameter information are first received. Performing a first transformation on the data to be transformed to obtain first transformed data, and determining an adjustment parameter according to the encoded parameter information and the second transformation parameter. The second transform parameter is a quantization point corresponding to the second transform, and the adjustment parameter is a quantization offset.
所述已编码参数信息包括使用第一变换的帧内预测图像块数目, 使用第二 变换的帧内预测图像块数目, 所有使用帧内预测图像块的数目, P帧或 B帧中 使用第一变换的帧内预测图像块数目, P帧和 B帧中使用第一变换的帧内预测 图像块数目, P帧或 B帧中使用第二变换帧内预测图像块的数目, P帧和 B帧 中使用第二变换帧内预测图像块的数目, P帧和 B帧中使用帧内预测图像块的 数目, P帧中使用跳过模式或直接模式的图像块的数目, P帧中使用跳过模式和
直接模式的图像块的数目, B帧中使用跳过模式或直接模式的图像块的数目, B 帧中使用跳过模式和直接模式的图像块的数目, P帧中使用帧间预测模式图像块 的数目, 或 B帧中使用帧间预测模式图像块的数目中的一种或多种。 其中跳过 模式为视频编解码中常用技术, 其含义为根据已编码或已解码图像块信息得到 当前图像块运动矢量, 并且该图像块中没有编码残差; 直接模式含义为根据已 编码或已解码图像块信息得到当前图像块运动矢量, 但该图像块中含有编码残 差。 The encoded parameter information includes the number of intra-predicted image blocks using the first transform, the number of intra-predicted image blocks using the second transform, all using the number of intra-predicted image blocks, and the first in the P-frame or B-frame. The number of transformed intra-predicted image blocks, the number of intra-predicted image blocks using the first transform in P and B frames, the number of second transformed intra-predicted image blocks in P-frames or B-frames, P-frames and B-frames The number of intra-predicted image blocks used in the second transform, the number of intra-predicted image blocks in the P-frame and the B-frame, the number of image blocks in the P-frame using the skip mode or the direct mode, and the skipping in the P-frame Mode and The number of image blocks in the direct mode, the number of image blocks in the B frame using the skip mode or the direct mode, the number of image blocks in the B frame using the skip mode and the direct mode, and the inter prediction mode image block in the P frame. The number, or one or more of the number of inter prediction mode image blocks used in the B frame. The skip mode is a commonly used technique in video encoding and decoding, which means that the current image block motion vector is obtained according to the encoded or decoded image block information, and there is no coding residual in the image block; the direct mode meaning is based on the encoded or already The image block information is decoded to obtain a current image block motion vector, but the image block contains an encoded residual.
记所述使用第一变换的帧内预测图像块数目为 img->intra4x4num,所述使用 帧内预测图像块的数目为 img->intra— num,所述 P帧中使用跳过模式和或直接模 式的图像块的数目为 img->pskip— num, 所述 P帧中使用帧内预测图像块的数目 为 img->p— intra, 所述 P帧中使用帧间预测模式图像块的数目为 img->pnum, 所 述第二变换所对应的量化点为 img->qp, 所述量化偏移量 img->qp— shift。 It is noted that the number of intra prediction image blocks using the first transform is img->intra4x4num, the number of used intra prediction image blocks is img->intra-num, the skip mode is used in the P frame and or directly The number of image blocks of the mode is img->pskip-num, the number of intra prediction image blocks used in the P frame is img->p_in, and the number of image blocks in the P frame using the inter prediction mode is Img->pnum, the quantization point corresponding to the second transform is i mg -> qp, and the quantization offset is img->qp_shift.
在本实施例中在编码端存储三张用于确定量化偏移量的表, 每张表包含 64 个元素, 这三张表记为 QPshift— table [0]、 QPshift— table[l]和 QPshift— table[2]三个 数组, 每个数组中包含 64个元素, 表现形式如下: In this embodiment, three tables for determining the quantization offset are stored at the encoding end, and each table contains 64 elements, which are recorded as QPshift_table[0], QPshift_table[l], and QPshift. — table[2] three arrays, each containing 64 elements, represented as follows:
QPshift_table[0]={0,l, 1,1, 1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,6,6,7,8,8,8,8,8,8,8 ,8,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, ^ ,10,10} QPshift_table[0]={0,l, 1,1, 1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6, 6,6,6,7,8,8,8,8,8,8,8,8,9,9,9,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,10,10,10,10, ^,10,10}
6,6,6,6,6,6,6,6,6,6,6,6 6,6,6,6,6,6,6,6,6,6,6,6
QPshift_table[2]={0,l, 1,1,2,2,3,3,3,4,4,4,5,5,6,6,7,8,8,9,9,10,10,10,10,10,11, 11, 11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,13,13,13,1 3,13,13,13,13,13,13,13,
在使用自适应块变换技术时,若当前编码图像为 I帧且为当前序列或当前图 像组的第一幅图像, 己 img->intra4x4num、 img -〉 intra— num、 img->pskip— num、 img -〉 p— intra和 img -〉 pnum值为 0 , 使用 QPshift— table [0]确定 img -〉 QP— shift, 确 定方法为: img->QP— shift=QPshift— table[0][img->qp]。 这里所说图像组为包含了 若干 I帧、 P帧、 B帧或上述几种类型中的组合。 QPshift_table[2]={0,l, 1,1,2,2,3,3,3,4,4,4,5,5,6,6,7,8,8,9,9,10, 10,10,10,10,11,11,11,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,13,13,13,1 3,13,13,13,13,13,13,13, When the adaptive block transform technique is used, if the current coded image is an I frame and is the first image of the current sequence or the current image group, img->intra4x4num, img->intra-num, img->pskip-num, Img -> p - intra and img -> pnum is 0. Use QPshift_table [0] to determine img -> QP-shift. The method is: img->QP_ shift=QPshift_table[0][img- >qp]. The image group referred to herein includes a plurality of I frames, P frames, B frames, or a combination of the above types.
若当前编码图像为 I 帧且不为当前序列或当前图像组的第一幅图像但当前 序列或当前图像组中还未有已经以 P帧编码的图像则设定两个参数, 记为第一 确定值 vl和第二确定值 v2 , vl和 v2的计算方法如下: If the current encoded image is an I frame and is not the current sequence or the first image of the current image group but there are no images already encoded in the P frame in the current sequence or the current image group, then two parameters are set, which is recorded as the first The determination value vl and the second determination value v2, vl and v2 are calculated as follows:
vl =img->intra4x4num * 5.0/ img -〉 intra— num/ (img->QP_shift+ 12) Vl =img->intra4x4num * 5.0/ img -> intra- num/ (img->QP_shift+ 12)
v2=0.2 V2=0.2
其中符号' *'代表乘法, 符号' /'代表除法。 Where the symbol '*' stands for multiplication and the symbol ' /' stands for division.
得到 vl和 v2之后根据以下逻辑判断得到量化偏移量 img->QP— shift: After obtaining vl and v2, the quantization offset is obtained according to the following logic: img->QP_ shift:
( 1 )如果 vl小于 0.3且 v2小于 0.4 , 或者 vl小于 0.4且 v2小于 0.15 , 或 者 vl小于 0.5且 v2小于 0.1 , 则 img->QP— shift的值以 img->qp为索引值, 在表 QPshift— table[l]中查找获得; (1) If vl is less than 0.3 and v2 is less than 0.4, or vl is less than 0.4 and v2 is less than 0.15, or vl is less than 0.5 and v2 is less than 0.1, the value of img->QP_shift is indexed by img->qp, in the table Find in QPshift_table[l];
若条件 ( 1 ) 不满足则进行以下判断: If condition (1) is not satisfied, the following judgment is made:
( 2 )如果 vl大于 0.5或者 v2大于 0.5或者 vl *v2大于 0.2 ,则 img -〉 QP— shift 的值以 img->qp为索引值, 在表 QPshift— table[2]中查找获得; (2) If vl is greater than 0.5 or v2 is greater than 0.5 or vl *v2 is greater than 0.2, the value of img -> QP_shift is indexed by img->qp and found in the table QPshift_table[2];
若条件( 1 ) 、 ( 2 )都不满足则 img->QP_shift的值以 img->qp为索引值, 在表 QPshift— table[0]中查找获得。 If the conditions (1) and (2) are not satisfied, the value of img->QP_shift is indexed by img->qp and found in the table QPshift_table[0].
若当前编码图像不为当前序列或当前图像组的第一幅图像且当前序列或当 前图像组中已有以 P帧编码的图像则设定两个参数, 记为第一确定值 vl和第二 确定值 v2 , vl和 v2的计算方法如下:
vl =img->intra4x4num * 5.0/ img -〉 intra— num/ (img->QP_shift+ 12); If the current encoded image is not the first image of the current sequence or the current image group and the image in the current sequence or the current image group has been encoded in the P frame, two parameters are set, which are recorded as the first determined value vl and the second The determined values v2, vl and v2 are calculated as follows: Vl =img->intra4x4num * 5.0/ img -> intra- num/ (img->QP_shift+ 12);
v2=img->pskip_num* 1.0/img -〉 pnum V2=img->pskip_num* 1.0/img -> pnum
其中符号' *'代表乘法, 符号' /'代表除法。 Where the symbol '*' stands for multiplication and the symbol ' /' stands for division.
得到 vl和 v2之后根据以下逻辑判断得到量化偏移量 img->QP— shift: After obtaining vl and v2, the quantization offset is obtained according to the following logic: img->QP_ shift:
( 1 )如果 vl小于 0.3且 v2小于 0.4 , 或者 vl小于 0.4且 v2小于 0.15 , 或 者 vl小于 0.5且 v2小于 0.1 , 则 img->QP— shift的值以 img->qp为索引值, 在表 QPshift— table[l]中查找获得; (1) If vl is less than 0.3 and v2 is less than 0.4, or vl is less than 0.4 and v2 is less than 0.15, or vl is less than 0.5 and v2 is less than 0.1, the value of img->QP_shift is indexed by img->qp, in the table Find in QPshift_table[l];
若条件 ( 1 ) 不满足则进行以下判断: If condition (1) is not satisfied, the following judgment is made:
( 2 )如果 vl大于 0.5或者 v2大于 0.5或者 vl *v2大于 0.2,则 img -〉 QP— shift 的值以 img->qp为索引值, 在表 QPshift— table[2]中查找获得; (2) If vl is greater than 0.5 or v2 is greater than 0.5 or vl *v2 is greater than 0.2, the value of img -> QP_shift is indexed by img->qp and found in the table QPshift_table[2];
若条件( 1 ) 、 ( 2 )都不满足则 img->QP_shift的值以 img->qp为索引值, 在表 QPshift— table[0]中查找获得。 If the conditions (1) and (2) are not satisfied, the value of img->QP_shift is indexed by img->qp and found in the table QPshift_table[0].
得到量化偏移量 img->QP— shift之后, 再根据编码端预先存储好的表格得到 率失真优化模型(rate-distortion optimization)中的第一变换所对应的权重系数 lambda。 该表格记为 QP— lambda— table— 4x4 , 在本实施例中包含有 16个元素。 第 一种变换中使用帧内编码图像块的 lambda记为 img->lambda4x4I, 使用帧间预 测模式的图像块的 lambda 己为 img->lambda4x4p , img->lambda4x4I 和 img->lambda4x4 的计算方法为: After the quantization offset img->QP_shift is obtained, the weight coefficient lambda corresponding to the first transform in the rate-distortion optimization is obtained according to the table pre-stored by the encoding end. This table is denoted as QP-lambda-table-4x4, which contains 16 elements in this embodiment. In the first transformation, the lambda using the intra-coded image block is recorded as img->lambda4x4I, and the lambda of the image block using the inter-prediction mode is img->lambda4x4p, img->lambda4x4I and img->lambda4x4 :
img->lambda4x4I=QP— lambda— table— 4x4[img->QP— shift] Img->lambda4x4I=QP— lambda—table— 4x4[img->QP— shift]
img->lambda4x4p=img->lambda4x4I* 0.9 Img->lambda4x4p=img->lambda4x4I* 0.9
QP— lambda— table— 4x4的表现形式如下: QP—lambda—table—4x4 behaves as follows:
QP— lambda— table— 4χ4[16]={1.0,1.1,1.3, 1.5,1.8,2.1,2.6,3.1,3.5,4.0,4.6,5.1,5.7,6. 3,100,100}
若当前待编码图像为 P帧, 则 img->QP— shift设为 5 , img->lambda4x4p设 为 1.6。 QP—lambda—table—4χ4[16]={1.0,1.1,1.3, 1.5,1.8,2.1,2.6,3.1,3.5,4.0,4.6,5.1,5.7,6. 3,100,100} If the current image to be encoded is a P frame, then img->QP_shift is set to 5 and img->lambda4x4p is set to 1.6.
若当前待编码图像为 B帧, 则 img->QP— shift设为 5。 If the current image to be encoded is a B frame, img->QP_shift is set to 5.
通过上述方法得到 img->QP— shift后, 根据第二变换的参数(即第二变换的 量化点)计算得到第一变换的量化点, 具体方法为将第二变换的量化点减去所 述量化偏移量作为第一变换的量化点。 利用计算所得的第一变换的量化点对经 第一变换后的数据进行量化。 将量化偏移量 img->QP— shift写进编码码流中。 After the img->QP_shift is obtained by the above method, the quantization point of the first transform is calculated according to the parameter of the second transform (ie, the quantization point of the second transform), and the specific method is to subtract the quantized point of the second transform The quantization offset is used as the quantization point of the first transform. The first transformed data is quantized using the calculated first transformed quantized points. The quantization offset img->QP_shift is written into the encoded code stream.
本实施例十还相应提供了一种编码装置, 可以用于执行实施例九提供的编 码方法, 如图 15所示, 所述编码装置包括: The tenth embodiment further provides an encoding device, which can be used to perform the encoding method provided in the ninth embodiment. As shown in FIG. 15, the encoding device includes:
第三接收单元, 用于接收待变换的数据和已编码参数信息; a third receiving unit, configured to receive data to be transformed and encoded parameter information;
第三变换单元, 用于对所述第三接收单元接收的待变换的数据进行第一变 换, 得到第一变换后的数据; a third transforming unit, configured to perform first transform on the data to be transformed received by the third receiving unit, to obtain first transformed data;
第三调整单元, 用于根据第三接收单元接收的已编码参数信息和第二变换 的参数确定调整参数, 根据所述调整参数和所述第二变换的参数调整所述第三 变换单元得到的第一变换后的数据; a third adjusting unit, configured to determine, according to the encoded parameter information and the second transformed parameter received by the third receiving unit, an adjustment parameter, and adjust the third transformation unit according to the adjustment parameter and the second transformed parameter First transformed data;
第三写单元, 用于将所述第三调整单元得到的调整参数写入编码码流中。 本实施例中第三接收单元接收待变换的数据和已编码参数信息。 第三变换 单元对所述待变换的数据进行第一变换, 得到第一变换后的数据, 第三调整单 元根据已编码参数信息和第二变换参数确定调整参数。 这里所述第二变换参数 为第二变换所对应的量化点, 所述调整参数为量化偏移量。 And a third writing unit, configured to write the adjustment parameter obtained by the third adjusting unit into the encoded code stream. In this embodiment, the third receiving unit receives the data to be transformed and the encoded parameter information. The third transform unit performs a first transform on the data to be transformed to obtain first transformed data, and the third adjusting unit determines the adjustment parameter according to the encoded parameter information and the second transform parameter. The second transform parameter is a quantization point corresponding to the second transform, and the adjustment parameter is a quantization offset.
所述已编码参数信息包括使用第一变换的帧内预测图像块数目, 使用第二 变换的帧内预测图像块数目, 所有使用帧内预测图像块的数目, P帧或 B帧中 使用第一变换的帧内预测图像块数目, P帧和 B帧中使用第一变换的帧内预测
图像块数目, P帧或 B帧中使用第二变换帧内预测图像块的数目, P帧和 B帧 中使用第二变换帧内预测图像块的数目, P帧和 B帧中使用帧内预测图像块的 数目, P帧中使用跳过模式或直接模式的图像块的数目, P帧中使用跳过模式和 直接模式的图像块的数目, B帧中使用跳过模式或直接模式的图像块的数目, B 帧中使用跳过模式和直接模式的图像块的数目, P帧中使用帧间预测模式图像块 的数目, 或 B帧中使用帧间预测模式图像块的数目中的一种或多种。 其中跳过 模式为视频编解码中常用技术, 其含义为根据已编码或已解码图像块信息得到 当前图像块运动矢量, 并且该图像块中没有编码残差; 直接模式含义为根据已 编码或已解码图像块信息得到当前图像块运动矢量, 但该图像块中含有编码残 差。 The encoded parameter information includes the number of intra-predicted image blocks using the first transform, the number of intra-predicted image blocks using the second transform, all using the number of intra-predicted image blocks, and the first in the P-frame or B-frame. Number of transformed intra prediction image blocks, intra prediction using the first transform in P and B frames Number of image blocks, number of second transformed intra-predicted image blocks used in P-frame or B-frame, number of second transformed intra-predicted image blocks in P-frame and B-frame, intra prediction used in P-frame and B-frame The number of image blocks, the number of image blocks using the skip mode or the direct mode in the P frame, the number of image blocks using the skip mode and the direct mode in the P frame, and the image block using the skip mode or the direct mode in the B frame The number of image blocks in the B frame using skip mode and direct mode, the number of inter prediction mode image blocks in the P frame, or the number of inter prediction mode image blocks in the B frame or A variety. The skip mode is a commonly used technique in video encoding and decoding, which means that the current image block motion vector is obtained according to the encoded or decoded image block information, and there is no coding residual in the image block; the direct mode meaning is based on the encoded or already The image block information is decoded to obtain a current image block motion vector, but the image block contains an encoded residual.
第三调整单元根据上述的已编码信息和第二变换的量化点计算得到量化偏 移量, 再根据量化偏移量和第二变换的量化点计算得到第一变换的量化点, 并 利用得到的第一变换的量化点对第一变换后的数据进行量化(根据所述调整参 数和所述第二变换的参数调整所述第三变换单元得到的第一变换后的数据)。 具 体计算的步骤可以参考实施例九描述的内容。 The third adjusting unit calculates the quantized offset according to the encoded information and the quantized point of the second transform, and calculates the quantized point of the first transform according to the quantized offset and the quantized point of the second transform, and obtains the obtained quantized point. The first transformed quantized point quantizes the first transformed data (the first transformed data obtained by the third transform unit is adjusted according to the adjustment parameter and the second transformed parameter). The steps of the specific calculation can be referred to the description of the embodiment 9.
第三写单元将量化偏移量写入编码码流中, 以便解码的时候获得量化偏移 量进行解码操作。 实施例九和实施例十根据已编码参数信息及第二变换参数得到了调整参数 (量化偏移量) , 使得编码端具有较好的灵活性。 由于编码端已将计算所得的 调整参数写入编码码流中, 因此解码端仅需从码流中获得此调整参数。 此实施 例所述方法兼顾了编码性能同时也不会额外增加解码端负担。
通过以上的实施方式的描述, 本领域的技术人员可以清楚地了解到本发明 可借助软件加必需的硬件平台的方式来实现, 当然也可以全部通过硬件来实施。 基于这样的理解, 本发明的技术方案对背景技术做出贡献的全部或者部分可以 以软件产品的形式体现出来, 该计算机软件产品可以存储在存储介质中, 如 The third write unit writes the quantization offset into the encoded code stream to obtain a quantized offset for decoding operation when decoding. The ninth embodiment and the tenth embodiment obtain the adjustment parameters (quantization offset) according to the encoded parameter information and the second transformation parameter, so that the coding end has better flexibility. Since the encoding end has written the calculated adjustment parameters into the encoded code stream, the decoding end only needs to obtain the adjustment parameter from the code stream. The method described in this embodiment takes into account the coding performance without additionally increasing the burden on the decoding end. Through the description of the above embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary hardware platform, and of course, can also be implemented entirely by hardware. Based on such understanding, all or part of the technical solution of the present invention contributing to the background art may be embodied in the form of a software product, which may be stored in a storage medium, such as
ROM/RAM, 磁碟、 光盘等, 包括若干指令用以使得一台计算机设备(可以是个 人计算机, 服务器, 或者网络设备等)执行本发明各个实施例或者实施例的某 些部分所述的方法。 ROM/RAM, diskette, optical disk, etc., comprising 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 or portions of the embodiments of the present invention. .
以上仅为本发明的较佳实施例而已, 并非用于限定本发明的保护范围。 凡 在本发明的精神和原则之内, 所作的任何修改、 等同替换、 改进等, 均应包含 在本发明的保护范围之内。
The above are only the preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.
Claims
1、 一种编码方法, 其特征在于, 包括: 1. An encoding method, comprising:
接收待变换的数据; Receiving data to be transformed;
对所述待变换的数据进行第一变换, 得到第一变换后的数据; Performing a first transformation on the data to be transformed to obtain first transformed data;
对所述待变换的数据进行第二变换, 得到第二变换后的数据; Performing a second transformation on the data to be transformed to obtain second transformed data;
根据第一变换后的数据和第二变换后的数据确定调整参数, 并根据所述调 整参数和第二变换的参数调整所述第一变换后的数据。 And adjusting the adjustment parameter according to the first transformed data and the second transformed data, and adjusting the first transformed data according to the adjustment parameter and the second transformed parameter.
2、 根据权利要求 1所述的方法, 其特征在于, 所述根据第一变换后的数据 和第二变换后的数据确定调整参数包括: 2. The method according to claim 1, wherein the determining the adjustment parameters according to the first transformed data and the second transformed data comprises:
根据第一变换后的数据和第二变换后的数据的数值范围, 计算两种变换的 数值范围特征差值。 The numerical range characteristic difference values of the two transformations are calculated based on the numerical range of the first transformed data and the second transformed data.
3、 根据权利要求 2所述的方法, 其特征在于, 所述计算两种变换的数值范 围特征差值包括: 3. The method according to claim 2, wherein the calculating the numerical range characteristic difference values of the two transformations comprises:
根据图像数据对应的量化点查找到的两种变换各自的量化步长计算所述两 种变换的数值范围特征差值; 其中, 所述两种变换的数值范围特征差值为图像 数据分别经过两种变换和对应量化后数值范围的差值。 Calculating the numerical range feature difference values of the two transforms according to the respective quantization step sizes of the two transforms found by the quantization points corresponding to the image data; wherein, the two types of transformed numerical range feature difference values are image data respectively passing through two The difference between the transform and the corresponding quantized value range.
4、 根据权利要求 3所述的方法, 其特征在于, 所述计算图像数据分别经过 两种变换和对应量化后数值范围的差值包括: The method according to claim 3, wherein the calculating the difference between the two types of transformed image data and the corresponding quantized value range includes:
对于两种变换, 分别计算变换后的平均数值范围 和
For the two transformations, calculate the average range of values after transformation and
AvrB = TBij , 其中, 为图像数据按照第一种变换的尺度划分得到的子块 内经第一种变换后第 ,行第 ·列像素数据的数值范围,^ /为图像数据按照两种变
换中的第二种变换的尺度划分得到的子块内经第二种变换后第 ,行第 列像素数 据的数值范围, 第一种变换的尺度为 wx« , 第二变换的尺度为 w xw; Avr B = TBij , where, for the image data, the value range of the pixel data of the first row after the first transformation is obtained according to the scale of the first transformation, ^ / is the image data according to two changes The value range of the pixel data of the first row and the second row after the second transformation in the sub-block obtained by the second transformation of the second transformation, the scale of the first transformation is wx«, and the scale of the second transformation is w xw;
根据两种变换后的平均数值范围和各自对应的量化步长, 计算图像数据分 别经过两种变换和对应量化后数值范围的差值 D'= ( AwB + log2 QTAB2[n] ) - ( AvrA + log2 QTABl[n] ) , 其中, 2∑4 [w]和 2∑432["]分别为根据第一、 第二种变换 对应的量化点查找到的量化步长。 According to the two transformed average value ranges and the corresponding quantization step sizes, the difference D'= ( Aw B + log 2 QTAB2[n] ) - ( ) is calculated for the image data after two transformations and corresponding quantized values. Avr A + log 2 QTABl[n] ) , where 2∑4 [w] and 2∑432["] are quantization step sizes respectively found according to the quantization points corresponding to the first and second transforms.
5、 根据权利要求 3所述的方法, 其特征在于, 当图像数据为视频数据时, 所述计算图像数据分别经过两种变换和对应量化后数值范围的差值为: 计算经所述两种变换中第二种变换后的平均数值范围 AwB =∑∑Bij; The method according to claim 3, wherein when the image data is video data, the difference between the two types of transformations and the corresponding quantized value ranges of the calculated image data is: The second transformed average value range in the transformation Aw B = ∑∑ Bij;
'■=1 =1 根据第二变换种后的平均数值范围和按照变换的尺度划分得到的子块经第 一种变换后所有像素数据的数值范围, 以及两种变换各自对应的量化点, 计算 所述子块经过第一种变换和对应量化后第 ,行第 列像素数据的数值范围与经过 第二种变换和对应量化后的平均数值范围的差值 d u) = ( AvrB + log 2 QTAB2[n] ) -'■=1 =1 Calculated according to the average value range after the second transform and the value range of all the pixel data of the sub-block obtained according to the scale of the transform, and the corresponding quantization points of the two transforms, The difference between the value range of the pixel data of the first row and the second column after the first transform and the corresponding quantization and the average value range after the second transform and the corresponding quantization d u) = ( Avr B + log 2 QTAB2[n] ) -
( Aij + log2 QTABl[n] ) , 其中, 为所述子块经第一种变换后第 z行第 _;列像素数 据的数值范围, ρ∑^ι[«]和 ρ∑^2[«]分别为根据第一、 第二变换对应的量化点查 找到的量化步长。 ( Aij + log 2 QTABl[n] ) , where is the value range of the pixel data of the _th column of the z-th row after the first transformation of the sub-block, ρ∑^ι[«] and ρ∑^2[ «] is the quantization step size found by the quantization points corresponding to the first and second transforms, respectively.
6、 根据权利要求 1至 5任意一项所述的方法, 其特征在于, 所述调整参数 包括根据所述第一变换后的数据和第二变换后的数据确定的调整因子, 所述根 据所述调整参数和所述第二变换的参数调整所述第一变换后的数据包括: The method according to any one of claims 1 to 5, wherein the adjustment parameter comprises an adjustment factor determined according to the first transformed data and the second transformed data, Adjusting the parameter and the parameter of the second transform to adjust the first transformed data includes:
将经第一变换后的数据乘以所述调整因子; Multiplying the first transformed data by the adjustment factor;
根据第一变换对应的量化步长对乘以调整因子后的数据进行量化。 The data multiplied by the adjustment factor is quantized according to the quantization step size corresponding to the first transform.
7、 根据权利要求 1至 5任意一项所述的方法, 其特征在于, 所述调整参数
包括根据第一变换后的数据和第二变换后的数据确定的量化偏移量, 所述第二 变换的参数为第二变换的量化点, 所述根据所述调整参数和第二变换的参数调 整所述第一变换后的数据包括: The method according to any one of claims 1 to 5, characterized in that the adjustment parameter And including a quantization offset determined according to the first transformed data and the second transformed data, where the parameter of the second transformation is a quantization point of the second transformation, and the parameter according to the adjustment parameter and the second transformation Adjusting the first transformed data includes:
将第二变换对应的量化点减去所述量化偏移量作为第一变换的量化点; 利用调整后的第一变换的量化点对经第一变换后的数据进行量化。 And subtracting, by the quantized point corresponding to the second transform, the quantized offset as the quantized point of the first transform; and quantizing the first transformed data by using the adjusted quantized point of the first transform.
8、 根据权利要求 1至 5任意一项所述的方法, 其特征在于, 所述调整参数 包括根据第一变换后的数据和第二变换后的数据确定的量化偏移量和调整因 子; 所述第二变换的参数为第二变换对应的量化点, 所述根据所述调整参数和 所述第二变换的参数调整所述第一变换后的数据包括: The method according to any one of claims 1 to 5, wherein the adjustment parameter comprises a quantization offset and an adjustment factor determined according to the first transformed data and the second transformed data; The parameter of the second transformation is the quantization point corresponding to the second transformation, and the adjusting the first transformed data according to the adjustment parameter and the parameter of the second transformation includes:
将经第一变换后的数据乘以所述调整因子, 并将第二变换对应的量化点减 去所述量化偏移量作为第一变换的量化点; Multiplying the first transformed data by the adjustment factor, and subtracting the quantization offset from the quantization point corresponding to the second transform as the quantization point of the first transform;
利用所述第一变换的量化点对乘以调整因子后的数据进行量化。 The data multiplied by the adjustment factor is quantized using the quantized points of the first transform.
9、 根据权利要求 1至 5任意一项所述的方法, 其特征在于, 所述调整参数 包括根据第一变换后的数据和第二变换后的数据确定的调整系数和量化移位偏 移量, 所述第二变换的参数包括第二变换对应的量化点的移位位数; The method according to any one of claims 1 to 5, wherein the adjustment parameter comprises an adjustment coefficient and a quantization shift offset determined according to the first transformed data and the second transformed data. The parameter of the second transform includes a shift bit number of the quantization point corresponding to the second transform;
所述根据所述调整参数和第二变换的参数调整所述第一变换后的数据包 括: The adjusting the first transformed data according to the adjusting parameter and the second transformed parameter includes:
将经第一变换后的数据乘以所述调整系数, 并利用第一变换对应的量化点 的移位位数对所述与调整系数相乘后的数据进行量化; Multiplying the first transformed data by the adjustment coefficient, and quantizing the data multiplied by the adjustment coefficient by using a shift bit of the quantization point corresponding to the first transform;
所述第一变换对应的量化点的移位位数为第二变换对应的量化点的移位位 数与所述量化移位偏移量之和。 The shift bit number of the quantization point corresponding to the first transform is the sum of the shift bit number of the quantization point corresponding to the second transform and the quantized shift offset.
10、 根据权利要求 1 至 5任意一项所述的方法, 其特征在于, 所述调整参 数包括根据第一变换后的数据和第二变换后的数据确定的调整因子和系数偏移
量, 所述根据所述调整参数和第二变换的参数调整所述第一变换后的数据包括: 将经第一变换后的数据乘以所述调整因子, 再加上所述系数偏移量并进行 量化。 The method according to any one of claims 1 to 5, wherein the adjustment parameter comprises an adjustment factor and a coefficient offset determined according to the first transformed data and the second transformed data. The adjusting the first transformed data according to the adjusting parameter and the second transformed parameter comprises: multiplying the first transformed data by the adjustment factor, and adding the coefficient offset And quantify.
11、根据权利要求 1至 5任意一项所述的方法, 其特征在于, 所述方法还包 括: The method according to any one of claims 1 to 5, wherein the method further comprises:
将所述调整参数写入编码码流中。 The adjustment parameters are written into the encoded code stream.
12、 根据权利要求 11所述的方法, 其特征在于, 所述将所述调整参数写入 编码码流中包括: The method according to claim 11, wherein the writing the adjustment parameter to the encoded code stream comprises:
将所述调整参数写入编码码流中的序列头或图像头或条带头或宏块头中。 The adjustment parameters are written to a sequence header or image header or strip header or macroblock header in the encoded code stream.
13、 根据权利要求 1所述的方法, 其特征在于, 所述第一变换为 4x4变换, 所述第二变换为 8x8变换。 13. The method according to claim 1, wherein the first transform is a 4x4 transform and the second transform is an 8x8 transform.
14、 一种解码方法, 其特征在于, 包括: 14. A decoding method, comprising:
接收码流, 对所述码流进行解码, 获得第一变换对应的数据和调整参数; 根据所述调整参数和第二变换的参数调整所述第一变换对应的数据。 Receiving a code stream, decoding the code stream, obtaining data corresponding to the first transform, and adjusting parameters; and adjusting data corresponding to the first transform according to the adjustment parameter and the second transformed parameter.
15、 根据权利要求 14所述的方法, 其特征在于, 所述根据所述调整参数和 第二变换的参数调整所述第一变换对应的数据包括: The method according to claim 14, wherein the adjusting the data corresponding to the first transform according to the adjusting parameter and the second transformed parameter comprises:
根据所述调整参数和所述第二变换的参数确定所述第一变换对应的数据的 调整因子: Determining, by the adjustment parameter and the parameter of the second transformation, an adjustment factor of data corresponding to the first transformation:
根据第一变换对应的量化步长对第一变换对应的数据进行反量化, 并对反 量化结果与所述调整因子之商进行第一变换对应的反变换。 And dequantizing the data corresponding to the first transform according to the quantization step size corresponding to the first transform, and performing inverse transform corresponding to the first transform on the quotient of the inverse quantization result and the adjustment factor.
16、 根据权利要求 14所述的方法, 其特征在于, 所述调整参数为量化偏移 量, 所述第二变换的参数为第二变换对应的量化点, 第一变换的量化点为所述 第二变换对应的量化点减去所述量化偏移量, 所述根据所述调整参数和所述第
二变换的参数对第一变换对应的数据调整包括: The method according to claim 14, wherein the adjustment parameter is a quantization offset, the parameter of the second transformation is a quantization point corresponding to the second transformation, and the quantization point of the first transformation is the Subtracting the quantization offset from the quantization point corresponding to the second transform, according to the adjustment parameter and the The data adjustment of the parameter of the second transformation to the first transformation includes:
利用所述第一变换对应的量化点对所述第一变换对应的数据进行反量化, 并对反量化结果进行第一变换对应的反变换。 And performing inverse quantization on the data corresponding to the first transform by using the quantization point corresponding to the first transform, and performing inverse transform corresponding to the first transform on the inverse quantization result.
17、 根据权利要求 14所述的方法, 其特征在于, 17. The method of claim 14 wherein:
所述调整参数包括量化偏移量和所述第一变换对应的数据的调整因子; 所述第二变换的参数为第二变换对应的量化点, 第一变换的量化点为所述 第二变换的量化点减去所述量化偏移量; The adjustment parameter includes a quantization offset and an adjustment factor of data corresponding to the first transformation; a parameter of the second transformation is a quantization point corresponding to the second transformation, and a quantization point of the first transformation is the second transformation a quantized point minus the quantized offset;
所述根据所述调整参数和第二变换的参数调整所述第一变换对应的数据包 括: The adjusting the data corresponding to the first transformation according to the adjusting parameter and the second transformed parameter includes:
利用所述第一变换对应的量化点对第一变换对应的数据进行反量化; 对反量化结果与所述调整因子之商进行第一变换对应的反变换。 And performing inverse quantization on the data corresponding to the first transform by using the quantization point corresponding to the first transform; and performing inverse transform corresponding to the first transform on the quotient of the inverse quantization result and the adjustment factor.
18、 根据权利要求 14所述的方法, 其特征在于, 18. The method of claim 14 wherein:
所述调整参数包括第一变换的调整系数和对第一变换数据的量化移位偏移 量; The adjustment parameter includes an adjustment coefficient of the first transformation and a quantization shift offset of the first transformed data;
所述第二变换的参数包括第二变换对应的量化点的移位位数; The parameter of the second transform includes a shift bit number of the quantization point corresponding to the second transform;
所述根据所述调整参数和第二变换的参数调整所述第一变换对应的数据包 括: The adjusting the data corresponding to the first transformation according to the adjusting parameter and the second transformed parameter includes:
将所述第二变换对应的量化点的移位位数减去所述量化移位偏移量作为第 一变换对应的量化点的移位位数; And subtracting the quantized shift offset from the shift bit number of the quantization point corresponding to the second transform as a shift bit number of the quantization point corresponding to the first transform;
利用所述第一变换对应的量化点的移位位数对接收到第一变换对应的数据 进行反量化; Performing inverse quantization on the data corresponding to the first transform by using the number of shift bits of the quantization point corresponding to the first transform;
对反量化结果与所述调整系数之商进行第一变换对应的反变换。 An inverse transform corresponding to the first transform is performed on the quotient of the inverse quantization result and the adjustment coefficient.
19、 根据权利要求 14所述的方法, 其特征在于,
根据所述调整参数和所述第二变换的参数确定对第一变换数据的调整因 子; 19. The method of claim 14 wherein: Determining an adjustment factor for the first transformed data according to the adjustment parameter and the parameter of the second transformation;
根据所述调整参数和所述第二变换的参数确定对第一变换数据的系数偏移 量; Determining a coefficient offset for the first transformed data according to the adjustment parameter and the second transformed parameter;
所述根据所述调整参数和所述第二变换的参数调整所述第一变换对应的数 据包括: The adjusting the data corresponding to the first transform according to the adjusting parameter and the second transformed parameter includes:
根据所述第一变换对应的量化步长对接收到的数据进行反量化, 并对反量 化结果减去所述系数偏移量, 将所述相减结果与所述调整因子之商进行第一变 换对应的反变换。 And performing inverse quantization on the received data according to the quantization step size corresponding to the first transform, and subtracting the coefficient offset from the inverse quantization result, and performing the first quotient of the subtraction result and the adjustment factor Transform the corresponding inverse transform.
20、 根据权利要求 14所述的方法, 其特征在于, 所述获得调整参数具体可 以通过从所述码流中的序列头或图像头或条带头或宏块头中获得。 20. The method according to claim 14, wherein the obtaining the adjustment parameter is specifically obtainable by using a sequence header or an image header or a strip header or a macroblock header in the code stream.
21、 根据权利要求 14所述的方法, 其特征在于, 所述获得调整参数包括: 接收待解码的数据; The method according to claim 14, wherein the obtaining the adjustment parameter comprises: receiving data to be decoded;
对所述待解码的数据进行第一变换, 得到第一变换后的数据; Performing a first transformation on the data to be decoded to obtain first transformed data;
对所述待解码的数据进行第二变换, 得到第二变换后的数据; Performing a second transformation on the data to be decoded to obtain second transformed data;
根据第一变换后的数据和第二变换后的数据确定调整参数。 The adjustment parameter is determined based on the first transformed data and the second transformed data.
22、根据权利要求 14所述的方法, 其特征在于, 所述第一变换为 4x4变换, 所述第二变换为 8x8变换。 The method according to claim 14, wherein the first transform is a 4x4 transform and the second transform is an 8x8 transform.
23、 一种编码装置, 其特征在于, 包括: 23. An encoding device, comprising:
数据接收单元, 用于接收待变换的数据; a data receiving unit, configured to receive data to be transformed;
变换单元, 用于对接收单元接收到的所述待变换的数据进行第一变换, 得 到第一变换后的数据; 对所述待变换的数据进行第二变换, 得到第二变换后的 数据;
第一调整单元, 根据第一变换后的数据和第二变换后的数据确定调整参数, 根据所述调整参数和第二变换的参数调整所述第一变换后的数据。 a transform unit, configured to perform first transform on the data to be transformed received by the receiving unit, to obtain first transformed data, and perform second transform on the data to be transformed to obtain second transformed data; The first adjusting unit determines an adjustment parameter according to the first transformed data and the second transformed data, and adjusts the first transformed data according to the adjustment parameter and the second transformed parameter.
24、 如权利要求 23所述的装置, 其特征在于, 还包括: The device of claim 23, further comprising:
写单元, 用于将所述调整参数写入编码码流中。 And a writing unit, configured to write the adjustment parameter into the encoded code stream.
25、 一种解码装置, 其特征在于, 包括: 25. A decoding apparatus, comprising:
码流接收单元, 用于接收码流; a code stream receiving unit, configured to receive a code stream;
解码单元, 对所述码流进行解码, 获得第一变换对应的数据和调整参数; 第二调整单元, 用于根据所述调整参数和第二变换的参数调整第一变换对 应的数据。 a decoding unit that decodes the code stream to obtain data and adjustment parameters corresponding to the first transform; and a second adjusting unit, configured to adjust data corresponding to the first transform according to the adjustment parameter and the second transformed parameter.
26、 一种编解码系统, 其特征在于, 包括: 编码装置和解码装置; 所述编码装置包括: 26. A codec system, comprising: an encoding device and a decoding device; the encoding device comprising:
数据接收单元, 用于接收待变换的数据; a data receiving unit, configured to receive data to be transformed;
变换单元, 用于对所述数据接收单元接收到的所述待变换的数据进行第一 变换, 得到第一变换后的数据; 对所述待变换的数据进行第二变换, 得到第二 变换后的数据; a transform unit, configured to perform first transform on the data to be transformed received by the data receiving unit, to obtain first transformed data; perform second transform on the data to be transformed, to obtain a second transform The data;
第一调整单元, 根据第二变换的参数、 第一变换后的数据和第二变换后的 数据确定调整参数, 根据所述调整参数和第二变换的参数调整所述第一变换后 的数据。 The first adjusting unit determines an adjustment parameter according to the second transformed parameter, the first transformed data, and the second transformed data, and adjusts the first transformed data according to the adjustment parameter and the second transformed parameter.
所述解码装置包括: The decoding device includes:
码流接收单元, 用于接收码流; a code stream receiving unit, configured to receive a code stream;
解码单元, 对所述码流进行解码, 获得第一变换后的数据和调整参数; 第二调整单元, 用于根据所述调整参数和第二变换的参数调整第一变换后 的数据。
a decoding unit, configured to decode the code stream to obtain first transformed data and adjustment parameters, and second adjustment unit, configured to adjust the first transformed data according to the adjustment parameter and the second transformed parameter.
27、 一种编码方法, 其特征在于, 包括: 27. An encoding method, comprising:
接收待变换的数据和已编码参数信息; Receiving data to be transformed and encoded parameter information;
对所述待变换的数据进行第一变换, 得到第一变换后的数据; Performing a first transformation on the data to be transformed to obtain first transformed data;
根据已编码参数信息和第二变换的参数确定调整参数, 根据所述调整参数 和所述第二变换的参数调整所述第一变换后的数据; Determining an adjustment parameter according to the encoded parameter information and the second transformed parameter, and adjusting the first transformed data according to the adjustment parameter and the second transformed parameter;
将所述调整参数写入编码码流中。 The adjustment parameters are written into the encoded code stream.
28、 根据权利要求 27所述的方法, 其特征在于, 所述调整参数包括根据已 编码参数信息和所述第二变换的参数确定的量化偏移量, 所述第二变换的参数 为第二变换的量化点, 所述根据所述调整参数和第二变换的参数调整所述第一 变换后的数据包括: The method according to claim 27, wherein the adjustment parameter comprises a quantization offset determined according to the encoded parameter information and the second transformed parameter, and the second transformed parameter is a second And the adjusting the quantized points, the adjusting the first transformed data according to the adjusting parameter and the second transformed parameter includes:
将第二变换对应的量化点减去所述量化偏移量作为第一变换的量化点; 利用调整后的第一变换的量化点对经第一变换后的数据进行量化。 And subtracting, by the quantized point corresponding to the second transform, the quantized offset as the quantized point of the first transform; and quantizing the first transformed data by using the adjusted quantized point of the first transform.
29、 根据权利要求 27所述方法, 其特征在于, 所述已编码参数信息包括当 前序列或当前图像组中对当前图像编码之前已经得到的统计数据, 所述统计数 据包括使用第一变换的帧内预测图像块数目, 使用第二变换的帧内预测图像块 数目, 所有使用帧内预测图像块的数目, P帧或 B帧中使用第一变换的帧内预 测图像块数目, P帧和 B帧中使用第一变换的帧内预测图像块数目, P帧或 B 帧中使用第二变换帧内预测图像块的数目, P帧和 B帧中使用第二变换帧内预 测图像块的数目, P帧和 B帧中使用帧内预测图像块的数目, P帧中使用跳过模 式或直接模式的图像块的数目, P 帧中使用跳过模式和直接模式的图像块的数 目, B帧中使用跳过模式或直接模式的图像块的数目, B帧中使用跳过模式和直 接模式的图像块的数目, P帧中使用帧间预测模式图像块的数目或 B帧中使用
The method according to claim 27, wherein the encoded parameter information comprises statistical data that has been obtained before encoding the current image in the current sequence or the current image group, and the statistical data includes a frame using the first transform. Number of intra-predicted image blocks, number of intra-predicted image blocks using the second transform, number of all intra-predicted image blocks used, number of intra-predicted image blocks using the first transform in P-frame or B-frame, P-frame and B The number of intra-predicted image blocks using the first transform in the frame, the number of second transformed intra-predicted image blocks in the P-frame or B-frame, and the number of second transformed intra-predicted image blocks in the P-frame and the B-frame, The number of intra prediction image blocks used in P frames and B frames, the number of image blocks using skip mode or direct mode in P frames, the number of image blocks using skip mode and direct mode in P frames, in B frames The number of image blocks using the skip mode or the direct mode, the number of image blocks using the skip mode and the direct mode in the B frame, the number of image blocks in the interframe prediction mode or the B frame in the P frame use
30、 根据权利要求 28或 29所述的方法, 其特征在于, 根据已编码参数信 息确定量化偏移量步骤包括: The method according to claim 28 or 29, wherein the step of determining the quantization offset based on the encoded parameter information comprises:
通过已编码参数信息进行数学运算得到第一确定值和第二确定值; 使用第一确定值和第二确定值和预先设定好的条件进行逻辑判断, 根据逻 辑判断结果从预先设定好的表格中选择一张用于确定量化偏移量的表格; Performing a mathematical operation on the encoded parameter information to obtain a first determined value and a second determined value; performing logical determination using the first determined value and the second determined value and a predetermined condition, and the predetermined result is determined according to the logic Select a table in the table to determine the quantization offset;
在所述用于确定量化偏移量的表格中根据所述第二变换的参数确定量化偏 移量。 A quantization offset amount is determined based on the parameter of the second transform in the table for determining the quantization offset.
31、 根据权利要求 30所述的方法, 其特征在于, 对所述已编码参数信息进 行数学运算得到第一确定值和第二确定值步骤包括: The method according to claim 30, wherein the step of performing mathematical operations on the encoded parameter information to obtain the first determined value and the second determined value comprises:
计算所述各帧内预测图像块数目之间的比例关系得到第一关系值, 计算各 使用跳过模式或直接模式的图像块数目与各帧间预测模式图像块数目之间的比 例关系, 或计算各使用跳过模式和直接模式的图像块数目与各帧间预测模式图 像块数目之间的比例关系得到第二关系值; Calculating a proportional relationship between the number of the intra-predicted image blocks to obtain a first relationship value, and calculating a proportional relationship between the number of image blocks using each skip mode or direct mode and the number of image blocks of each inter-prediction mode, or Calculating a proportional relationship between the number of image blocks using each skip mode and the direct mode and the number of image blocks of each inter prediction mode to obtain a second relationship value;
通过对所述第一关系值、 第二关系值及所述第二变换的参数进行数学运算, 得到所述第一确定值和所述第二确定值。 The first determined value and the second determined value are obtained by performing mathematical operations on the first relationship value, the second relationship value, and the second transformed parameter.
32、 根据权利要求 28或 29或 31所述的方法, 其特征在于, 在计算得到量 化偏移量后, 根据量化偏移量及预先设定好的表格得到率失真优化模型中的权 重参数 lambda。 32. The method according to claim 28 or 29 or 31, wherein after calculating the quantized offset, the weight parameter lambda in the rate-distortion optimization model is obtained according to the quantization offset and a preset table. .
33、 一种编码装置, 其特征在于, 包括: 33. An encoding device, comprising:
第三接收单元, 用于接收待变换的数据和已编码参数信息; a third receiving unit, configured to receive data to be transformed and encoded parameter information;
第三变换单元, 用于对所述第三接收单元接收的待变换的数据进行第一变 换, 得到第一变换后的数据; a third transforming unit, configured to perform first transform on the data to be transformed received by the third receiving unit, to obtain first transformed data;
第三调整单元, 用于根据第三接收单元接收的已编码参数信息和第二变换
的参数确定调整参数, 根据所述调整参数和所述第二变换的参数调整所述第三 变换单元得到的第一变换后的数据; a third adjusting unit, configured to receive the encoded parameter information and the second transform according to the third receiving unit The parameter determining the adjustment parameter, and adjusting the first transformed data obtained by the third transform unit according to the adjustment parameter and the second transformed parameter;
第三写单元, 用于将所述第三调整单元得到的调整参数写入编码码流中。
And a third writing unit, configured to write the adjustment parameter obtained by the third adjusting unit into the encoded code stream.
Applications Claiming Priority (6)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN200710112378.0 | 2007-06-13 | ||
CN200710112378 | 2007-06-13 | ||
CN200810008671 | 2008-01-31 | ||
CN200810008671.7 | 2008-01-31 | ||
CN200810087919.3 | 2008-03-19 | ||
CN 200810087919 CN101325714B (en) | 2007-06-13 | 2008-03-19 | Transform data processing method and device, encoding and decoding method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2008151570A1 true WO2008151570A1 (en) | 2008-12-18 |
Family
ID=40129261
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2008/071255 WO2008151570A1 (en) | 2007-06-13 | 2008-06-10 | Method, device and system for coding and decoding |
Country Status (1)
Country | Link |
---|---|
WO (1) | WO2008151570A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105898299A (en) * | 2015-12-14 | 2016-08-24 | 乐视云计算有限公司 | Self-adaptive quantification method and device based on size of transform block |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0522715A (en) * | 1991-07-12 | 1993-01-29 | Sony Corp | Picture encoder |
JPH08241416A (en) * | 1995-03-03 | 1996-09-17 | Matsushita Electric Ind Co Ltd | Image compression device |
CN1496653A (en) * | 2002-01-07 | 2004-05-12 | 三菱电机株式会社 | Moving picture coding apparatus and moving picture decoding apparatus |
CN1672166A (en) * | 2002-07-29 | 2005-09-21 | 高通股份有限公司 | Digital image encoding |
WO2006054507A1 (en) * | 2004-11-19 | 2006-05-26 | Matsushita Electric Industrial Co., Ltd. | Moving-image encoding method, and moving-image decoding method |
-
2008
- 2008-06-10 WO PCT/CN2008/071255 patent/WO2008151570A1/en active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0522715A (en) * | 1991-07-12 | 1993-01-29 | Sony Corp | Picture encoder |
JPH08241416A (en) * | 1995-03-03 | 1996-09-17 | Matsushita Electric Ind Co Ltd | Image compression device |
CN1496653A (en) * | 2002-01-07 | 2004-05-12 | 三菱电机株式会社 | Moving picture coding apparatus and moving picture decoding apparatus |
CN1672166A (en) * | 2002-07-29 | 2005-09-21 | 高通股份有限公司 | Digital image encoding |
WO2006054507A1 (en) * | 2004-11-19 | 2006-05-26 | Matsushita Electric Industrial Co., Ltd. | Moving-image encoding method, and moving-image decoding method |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105898299A (en) * | 2015-12-14 | 2016-08-24 | 乐视云计算有限公司 | Self-adaptive quantification method and device based on size of transform block |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101325714B (en) | Transform data processing method and device, encoding and decoding method and device | |
CN101888556B (en) | Encoding, decoding method and encoding, decoding device | |
JP5384694B2 (en) | Rate control for multi-layer video design | |
JP4393875B2 (en) | System and method for providing a single layer video encoded bitstream suitable for reduced complexity decoding | |
JP5350404B2 (en) | Early macroblock delta QP decision | |
CN1283100C (en) | Method and device for adaptive encoding of moving images based on temporal and spatial complexity | |
KR101185146B1 (en) | Efficient rate control techniques for video encoding | |
US8331449B2 (en) | Fast encoding method and system using adaptive intra prediction | |
CN101959065B (en) | Method and apparatus for adaptive quantization in digital video coding | |
KR101621854B1 (en) | Tsm rate-distortion optimizing method, encoding method and device using the same, and apparatus for processing picture | |
JP2005354686A (en) | Method and system for selecting optimal coding mode for each macroblock in video | |
JP5133290B2 (en) | Video encoding apparatus and decoding apparatus | |
US20040247030A1 (en) | Method for transcoding an MPEG-2 video stream to a new bitrate | |
WO2009157581A1 (en) | Image processing device and image processing method | |
KR101166732B1 (en) | Video coding mode selection using estimated coding costs | |
CN1232125C (en) | Method for motion estimation (me) through discrete cosine transform (dct) and an apparatus therefor | |
JP2012034352A (en) | Stereo moving image encoding apparatus and stereo moving image encoding method | |
US8447104B2 (en) | Method, medium and system adjusting predicted values based on similarities between color values for image compressing/recovering | |
JPH089375A (en) | Inverse discrete cosine transformation anticoincidence controller and picture encoding device | |
WO2008151570A1 (en) | Method, device and system for coding and decoding | |
EP1484925A2 (en) | Method and device for compressing image data | |
JP4784618B2 (en) | Moving picture encoding apparatus, moving picture decoding apparatus, moving picture encoding program, and moving picture decoding program | |
KR20100082700A (en) | Wyner-ziv coding and decoding system and method | |
KR20030083109A (en) | apparatus for transcoding bit rate | |
KR20010104058A (en) | Adaptive quantizer according to DCT mode in MPEG2 encoder |
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: 08757666 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: 08757666 Country of ref document: EP Kind code of ref document: A1 |