Rate-distortion optimization method, image encoding method, device and computer storage medium

Through the rate-distortion optimization method and hardware full pipeline architecture, the resource consumption and complexity issues of the rate-distortion optimization algorithm in video/image coding are solved, and high-efficiency coding performance and hardware implementation are achieved.

CN118317091BActive Publication Date: 2024-09-06ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410733766.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-09-06
Estimated Expiration
2044-06-07

AI Technical Summary

Technical Problem

In video/image coding, the existing medium-rate distortion optimization algorithm consumes a large amount of hardware resources, and there are data-dependent loops and coding complexity, which hinders the hardware from executing effective pipelines, especially in AV1 intra-frame prediction and inter-frame prediction. Coding complexity and hardware pipeline difficulty are prominent.

Method used

A rate-distortion optimization method is proposed. By obtaining the syntax elements and transform blocks of the block to be encoded, the code rate estimator and the distortion estimator are used to determine the rate-distortion cost. High-frequency coefficient zeroing and all-zero block feature compensation are used to design low-complexity Highly fast RDO algorithm and implements a fully pipelined hardware architecture to improve efficiency.

Benefits of technology

On the premise of ensuring coding performance and reducing complexity, the hardware implementation of rate-distortion optimization is achieved, which improves the efficiency of rate-distortion optimization, simplifies the coding process, and reduces hardware resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118317091B
    Figure CN118317091B
Patent Text Reader

Abstract

The present application proposes a rate-distortion optimization method, an image coding method, an image coding and decoding device, and a computer storage medium. The rate-distortion optimization method comprises: obtaining a syntax element of a block to be coded, wherein the syntax element indicates a preset prediction mode and a transform type combination; using the prediction mode and the transform type combination, obtaining a transform block of the block to be coded, wherein the transform block includes a number of transform coefficients; inputting the syntax element into a rate estimator to obtain an estimated bit rate of the block to be coded; inputting the transform coefficient into a distortion estimator to obtain an estimated distortion of the block to be coded; based on the estimated bit rate and the estimated distortion, determining the rate-distortion cost of the block to be coded using the prediction mode and the transform type combination. Through the above-mentioned rate-distortion optimization method, the hardware implementation of rate-distortion optimization is realized while ensuring a good compromise between coding performance loss and complexity reduction, thereby improving the efficiency of rate-distortion optimization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video / image coding technology, and in particular to a rate-distortion optimization method, an image coding method, an image coding and decoding device, and a computer storage medium. Background Art

[0002] Rate Distortion Optimization (RDO) is an optimization algorithm to improve video compression performance. In AV1 (AOMedia Video 1) intra-frame prediction and inter-frame prediction, RDO is recursively performed to determine the best coding structure and prediction mode for each coding unit, achieving the best compromise between compression distortion and bit rate.

[0003] However, for example, when calculating D (Distortion), the residual coefficient obtained by subtracting the predicted pixel from the original pixel needs to be transformed, quantized, inversely quantized, inversely transformed and reconstructed, which consumes a lot of hardware resources and forms a data-dependent loop, hindering the hardware from executing an effective pipeline.

[0004] In addition, the bitrate calculation in AV1 uses multi-symbol arithmetic entropy coding, which does not have a binarization step. However, the context of the conditional probability model still depends on the coded coefficients to be constructed, which will lead to dependencies when encoding the coefficients in the transform block, increasing the encoding complexity and the difficulty of hardware pipelining. Summary of the invention

[0005] In order to solve the above technical problems, the present application proposes a rate-distortion optimization method, an image encoding method, an image encoding and decoding device, and a computer storage medium.

[0006] In order to solve the above technical problems, the present application proposes a rate-distortion optimization method, which includes:

[0007] Obtaining a syntax element of a block to be encoded, wherein the syntax element indicates a preset prediction mode and transform type combination;

[0008] Acquire a transform block of the block to be encoded by using the prediction mode and the transform type combination, wherein the transform block includes a number of transform coefficients;

[0009] Inputting the syntax element into a bit rate estimator to obtain an estimated bit rate of the block to be encoded;

[0010] Inputting the transform coefficient into a distortion estimator to obtain an estimated distortion of the block to be encoded;

[0011] Based on the estimated bit rate and the estimated distortion, a rate-distortion cost of the block to be encoded using the combination of the prediction mode and the transform type is determined.

[0012] Wherein, the rate estimator includes a transform type rate estimator, a block end identifier rate estimator and a coefficient amplitude rate estimator;

[0013] The step of inputting the syntax element into a bit rate estimator to obtain an estimated bit rate of the block to be encoded includes:

[0014] Based on the syntax element, determining a transform type combination, a block end identifier and a transform characteristic parameter of the block to be encoded;

[0015] Inputting the transform type combination of the block to be encoded into the transform type rate estimator to obtain the transform type rate;

[0016] Inputting the block end identifier of the block to be encoded into the block end identifier code rate estimator to obtain the block end identifier code rate;

[0017] Inputting the transformation characteristic parameters of the block to be encoded into the coefficient amplitude rate estimator to obtain the coefficient amplitude rate;

[0018] The transform type code rate, the block end identifier code rate and the transform characteristic parameter are input into an adder to obtain an estimated code rate of the block to be encoded.

[0019] The step of obtaining the block end identifier code rate includes:

[0020] Obtain the block end identifier, and obtain the block end index of the block to be encoded;

[0021] When the block end index is less than a preset index, obtaining a first block end identifier code rate based on a first model coefficient and a first deviation term;

[0022] When the block end index is greater than or equal to a preset index, obtaining a second block end identifier code rate based on a second model coefficient and a second deviation term;

[0023] The first model coefficient is greater than the second model coefficient, and / or the first deviation term is greater than the second deviation term.

[0024] Wherein, the rate-distortion optimization method further includes:

[0025] quantizing the transform coefficients of the transform block to obtain the quantized coefficients of the transform block;

[0026] Acquire a first number of quantization coefficients whose absolute values ​​of quantization coefficients are within a first preset range among the quantization coefficients of the transform block;

[0027] Obtaining the number of second quantization coefficients whose absolute values ​​of quantization coefficients are within a second preset range among the quantization coefficients of the transform block;

[0028] Acquire the number of third quantization coefficients whose absolute values ​​are within a third preset range among the quantization coefficients of the transform block;

[0029] A transform feature parameter of the transform block is generated based on the first quantization coefficient number, the second quantization coefficient number, and the third quantization coefficient number.

[0030] The obtaining of the estimated distortion of the block to be encoded includes:

[0031] Obtain pixel domain low-frequency distortion, all-zero block low-frequency distortion and pixel domain global distortion of the transform block, wherein the all-zero block low-frequency distortion is the low-frequency distortion after high frequencies in the pixel domain are set to zero;

[0032] Obtaining high-frequency distortion compensation based on a difference between the pixel domain global distortion and the all-zero block low-frequency distortion;

[0033] The pixel domain low-frequency distortion and the high-frequency distortion compensation are added together to obtain an estimated distortion of the block to be encoded.

[0034] The step of obtaining the pixel domain low-frequency distortion of the transform block includes:

[0035] Based on the square of the difference between the quantization coefficient and the inverse quantization coefficient of the transform block in the low-frequency pixel domain, the pixel-domain low-frequency distortion of the transform block is obtained.

[0036] Wherein, after obtaining the transform block of the block to be encoded by combining the prediction mode and the transform type, the rate-distortion optimization method further comprises:

[0037] In response to the transform block size being larger than a preset size, transform coefficients of the preset size within the transform block are retained, and remaining transform coefficients are set to zero.

[0038] In order to solve the above technical problems, the present application also proposes an image encoding method, which includes:

[0039] Based on the above rate-distortion optimization method, a rate-distortion cost value of the block to be encoded using each encoding mode is obtained;

[0040] The coding mode with the smallest rate-distortion cost value is selected to encode the block to be encoded, and a coded bit stream is obtained.

[0041] In order to solve the above-mentioned technical problems, the present application also proposes an image coding and decoding device, which includes a memory and a processor coupled to the memory; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the rate-distortion optimization method and / or image encoding method as mentioned above.

[0042] To solve the above technical problems, the present application also proposes a computer storage medium, which is used to store program data. When the program data is executed by a computer, it is used to implement the above rate-distortion optimization method and / or image encoding method.

[0043] Compared with the prior art, the beneficial effects of the present application are as follows: the image coding and decoding device obtains the syntax elements of the block to be coded, wherein the syntax elements indicate a preset prediction mode and transform type combination; the transform block of the block to be coded is obtained by using the prediction mode and the transform type combination, wherein the transform block includes a number of transform coefficients; the syntax elements are input into a code rate estimator to obtain the estimated code rate of the block to be coded; the transform coefficients are input into a distortion estimator to obtain the estimated distortion of the block to be coded; based on the estimated code rate and the estimated distortion, the rate-distortion cost of the block to be coded using the prediction mode and the transform type combination is determined. Through the above-mentioned rate-distortion optimization method, the hardware implementation of rate-distortion optimization is realized while ensuring a good compromise between coding performance loss and complexity reduction, thereby improving the efficiency of rate-distortion optimization. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:

[0045] Figure 1 It is a flow chart of the parallel RDOQ (Rate Distortion Optimized Quantization) algorithm provided by this application;

[0046] Figure 2 It is a flow chart of an embodiment of a rate-distortion optimization method provided by the present application;

[0047] Figure 3 is a schematic diagram of the real-time rate-distortion estimation hardware architecture provided by the present application;

[0048] Figure 4 is a schematic diagram of reconstructing approximate pixels as reference pixels for intra-frame prediction provided by the present application;

[0049] Figure 5 is a schematic diagram comparing the original SB pipeline and the improved SB pipeline provided by the present application;

[0050] Figure 6 It is a schematic diagram of high frequency zeroing of DCT transformation for 64×64 TU provided by the present application;

[0051] Figure 7 yes Figure 2 The specific flow chart of step S13 of the rate-distortion optimization method is shown;

[0052] Figure 8 It is a schematic diagram of decomposing the quantization coefficient amplitude |V| provided by the present application into BR, LR and HR symbols and corresponding sign bits;

[0053] Fig. 9 It is a schematic diagram of the proportion of each characteristic parameter at the TU level provided in this application;

[0054] Fig.10 yes Figure 2 The specific flow chart of step S14 of the rate-distortion optimization method is shown;

[0055] Fig.11 Schematic diagram of high frequency coefficient distortion compensation based on all-zero block features provided by the present application;

[0056] Fig.12 It is a flowchart of an embodiment of an image encoding method provided by the present application;

[0057] Fig.13 It is a structural schematic diagram of an embodiment of an image encoding and decoding device provided by the present application;

[0058] Fig.14 It is a structural diagram of an embodiment of a computer storage medium provided by the present application. DETAILED DESCRIPTION

[0059] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0060] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0061] This application determines the optimal coding structure and optimal prediction mode for each coding unit through a rate-distortion optimization algorithm to achieve the best compromise between compression distortion and bit rate. The calculation process of the RD cost in the rate-distortion optimization algorithm can be found in Figure 1 , the RD cost function formula is as follows:

[0062]

[0063] Where D is the distortion, usually expressed as the sum of the squared differences between the original pixels and the reconstructed pixels in the current block; R is the bit rate for encoding the entire block through multivariate arithmetic entropy coding; λ is the Lagrange multiplier related to the quantization parameter (QP).

[0064] In order to enable the AV1 encoder to be used in real-time encoding applications, a fast RDO algorithm with low complexity and high accuracy is very necessary.

[0065] Therefore, the present application discloses a low-complexity fast RDO algorithm. In the transformation stage, a high-frequency coefficient is set to zero to optimize the coefficients of a larger transform block (TU, transform unit) (including 64×64, 64×32 and 32×64) after one-dimensional column transformation. In the code rate stage, an efficient code rate estimation method is invented by statistically analyzing the relationship between the number of quantization coefficient value ranges and the true entropy coding cost. In the distortion stage, the high-frequency part distortion of the larger transform block is compensated based on the all-zero block feature, and an effective distortion estimation method is invented. Finally, an approximate reconstruction model is used to solve the problem of low parallelism caused by the coupling of pixel reconstruction and mode decision data. In addition, a hardware full-pipeline architecture is designed for the improved RDO algorithm. In terms of hardware implementation, a full-pipeline hardware architecture with a four-stage pipeline stage is designed. 16 coefficients are processed per cycle, and when the height is less than 16, multiple transform blocks can be processed simultaneously.

[0066] The above-mentioned transform block TU stores the transform quantization information of the CU (coding unit), which is a type of coding and decoding information. The predicted image obtained by prediction has a difference with the original image, and the transform block unit stores this difference.

[0067] Please refer to Figure 2 and Figure 3 , Figure 2 is a flow chart of an embodiment of a rate-distortion optimization method provided by the present application. Figure 3 It is a schematic diagram of the real-time rate-distortion estimation hardware architecture provided by this application.

[0068] The rate-distortion optimization method of the present application is applied to an image coding and decoding device, wherein the image coding and decoding device of the present application can be a server, a terminal device, or a system in which a server and a terminal device cooperate with each other. Accordingly, the various parts included in the image coding and decoding device, such as various units, sub-units, modules, and sub-modules, can all be set in the server, can all be set in the terminal device, or can be set in the server and the terminal device respectively.

[0069] Furthermore, the above-mentioned server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules, such as software or software modules used to provide distributed servers, or it can be implemented as a single software or software module, which is not specifically limited here.

[0070] like Figure 2 As shown, the specific steps are as follows:

[0071] Step S11: Obtain syntax elements of the block to be encoded, wherein the syntax elements indicate a preset prediction mode and transform type combination.

[0072] In the embodiment of the present application, the TU size range in AV1 is from 4×4 to 64×64. Figure 3 The proposed rate distortion estimation hardware architecture supports all TUs. The RDO hardware architecture is designed with a parallelism of 16 pixels, that is, a column can process up to 16 pixels at the same time.

[0073] In order to achieve real-time rate-distortion estimation coding. Figure 3 The hardware architecture shown in the figure specifically includes a 4-stage pipeline stage, which consists of two modules: rate estimator (Rate Estimation) and distortion estimator (Dist Estimation). Figure 3As shown, one input of the hardware architecture is a syntax element (SE) of a block to be encoded, wherein the syntax element records a prediction mode and a transform type combination that need to be calculated for the block to be encoded.

[0074] Please refer to Figure 4 and Figure 5 , Figure 4 is a schematic diagram of reconstructing approximate pixels as reference pixels for intra-frame prediction provided by the present application, Figure 5 It is a schematic diagram comparing the original SB pipeline and the improved SB pipeline provided by this application.

[0075] exist Figure 3 In the hardware architecture, distortion estimation removes inverse transformation and pixel reconstruction, and each TU can be executed in parallel. However, when the current TU makes intra-frame mode decisions, it needs to reconstruct pixels as reference pixels for mode prediction, which will cause dependencies between TUs and cause idleness in the spatiotemporal pipeline.

[0076] In order to break the inter-data dependency, the original residual pixels can usually be directly used as reference pixels, but this results in a large loss in coding performance. Therefore, this application uses an approximate reconstructed pixel method to predict TUs, while real reconstructed pixels are still used between macroblocks (MBs), such as Figure 4 shown.

[0077] Furthermore, compared with the original mode decision pipeline, the reconstruction approximation model proposed in this application adds one level of pipeline before the mode decision to complete pixel reconstruction separately. Figure 5 This is a comparison chart of the original and improved macroblock pipeline architectures. Specifically, a fixed prediction mode and transform type combination is directly selected, and then the residual coefficients are transformed, quantized, dequantized, inversely transformed, and pixel reconstructed. This method has two advantages. First, it avoids the traversal process of mode and type combinations, which will create a good compromise between performance loss and computational complexity. Second, it reduces the pipeline delay between TUs, and the entire mode decision has an efficient hardware pipeline architecture.

[0078] Step S12: using the prediction mode and the transform type combination to obtain a transform block of the block to be encoded, wherein the transform block includes a number of transform coefficients.

[0079] In an embodiment of the present application, an image coding and decoding device uses a fixed prediction mode and transform type combination indicated in a syntax element to first obtain a prediction block of a block to be encoded, and uses the block to be encoded and the prediction block to perform a difference to obtain a residual coefficient of the block to be encoded, and then performs a two-dimensional DCT transform (Discrete Cosine Transform) on the residual coefficient to obtain a transform block of the block to be encoded, wherein the transform block includes a transform coefficient of each pixel in the block to be encoded.

[0080] Furthermore, in order to further improve the rate-distortion optimization efficiency, the present application provides a transformation simplification solution in the two-dimensional DCT transformation process.

[0081] Specifically, for larger TUs, such as 64×64, 64×32, and 32×64, the maximum memory needs to be set in hardware design to meet data storage needs. However, larger TU mode decisions are not widely used. In order to reduce the amount of calculation and save hardware area, this application adopts a method of setting high-frequency coefficients to zero, because most of the energy after DCT transformation is concentrated in the low-frequency part.

[0082] by Figure 6 Taking the 64×64 TU in the figure as an example, the zeroing scheme of DCT high-frequency coefficients with a TU size of 64×64 is described. Specifically, after the one-dimensional column transform, only the transform coefficients of the upper left corner 32×32 are retained, and the remaining coefficients are all set to zero. Therefore, when using registers to store data, 3 / 4 of the memory can be saved compared to the original, and the hardware area is also reduced by 3 / 4 accordingly, which is a good compromise between hardware area and performance loss.

[0083] Step S13: Input the syntax element into a bit rate estimator to obtain an estimated bit rate of the block to be encoded.

[0084] In the embodiment of the present application, the image encoding and decoding device inputs the syntax element of the block to be encoded into Figure 3 A bit rate estimator in the hardware architecture obtains an estimated bit rate of the to-be-encoded block output by the bit rate estimator.

[0085] Specifically, Figure 3 The rate estimators in the hardware architecture include transform type rate estimator, end of block (EOB) rate estimator and coefficient amplitude rate estimator. In order to maximize the hardware throughput, in the proposed rate estimator, the syntax elements are divided into three independent groups and processed in parallel in the above three rate estimators.

[0086] Please continue to read Figure 7 , Figure 7 yes Figure 2 The specific flow chart of step S13 of the rate-distortion optimization method is shown in FIG. Figure 7 As shown, step S13 specifically includes the following steps:

[0087] Step S131: Based on the syntax elements, determine the transformation type combination, block end identifier and transformation feature parameters of the block to be encoded.

[0088] In the embodiment of the present application, AV1 uses a hierarchical mapping coding method to encode the quantized coefficients in the current TU. First, the TU transform type is encoded. Then, the last non-zero coefficient in the scanning order is encoded. Next, the quantized coefficient is decomposed into four symbols for encoding, including a sign bit, a basic range (BR) coefficient, a low range (LR) coefficient, and a high range (HR) coefficient, such as Figure 8 As shown in the figure, the BR and LR coefficients are coded using context-based arithmetic entropy, and the HR coefficient is coded using exponential Golomb coding.

[0089] This application mainly estimates the transform type rate, EOB rate and coefficient amplitude rate, and uses a linear model to remove the context dependency involved in the rate calculation. Among them, the transform type rate is calculated by transform type combination, the EOB rate is calculated by block end identifier, and the coefficient amplitude rate is calculated by transform feature parameters.

[0090] Step S132: input the transform type combination of the to-be-encoded block into a transform type rate estimator to obtain a transform type rate.

[0091] In the embodiment of the present application, the transform type bit rate includes two types, intra-frame and inter-frame, which is mainly calculated according to the index value mapped by the transform set type, the transform block size and the transform type, which results in too large hardware storage and the encoding involves the update of the probability model.

[0092] Therefore, this application selects a univariate linear regression method to fit this bit rate, and in order to improve the accuracy of the estimation of intra-frame and inter-frame respectively, the index values ​​corresponding to the two are used as independent variables. Among them, the univariate linear regression equation used by the transform type bit rate estimator calculation is expressed as follows:

[0093]

[0094] in, express Estimated value, represents the regression coefficient, Indicates a constant term, and TxSet indicates the index value of the transform type combination. Please refer to the following table for the transform type set and its sequence number in AV1:

[0095]

[0096] At this time, a new code rate LUT is generated through the above-mentioned univariate linear regression equation, which reduces the storage size on the one hand and removes the update of the entropy coding probability model on the other hand.

[0097] Step S133: inputting the block end identifier of the to-be-encoded block into a block end identifier code rate estimator to obtain a block end identifier code rate.

[0098] In the embodiment of the present application, the block end identifier indicates the coordinate position of the last non-zero point in the transformation block, that is, the pixel coordinate or the position index value.

[0099] For EOB code rate , which includes the basic bit rate and additional bitrate It consists of two parts, which are specifically expressed as follows:

[0100]

[0101] For bit rate and , this application is based on As the independent variable, the code rate is estimated for different scanning modes. The formula is as follows:

[0102]

[0103] in, and They represent the model coefficients corresponding to different scanning modes of encoding, and is the deviation term corresponding to the model, The value of the basic block end identifier. and The combination relationship of and The combination relationship is: for the same ,use and The combined relationship is calculated Greater than using and The combined relationship is calculated .

[0104] Step S134: input the transformation characteristic parameters of the block to be encoded into the coefficient amplitude rate estimator to obtain the coefficient amplitude rate.

[0105] In the embodiment of the present application, the syntax elements related to AV1 coefficient coding have been optimized. Therefore, the quantitative characteristics of five types of quantization coefficients are statistically analyzed in the following table:

[0106] Characteristic parameter table of linear model

[0107]

[0108] The quantization coefficient is a value obtained after the transform coefficient is quantized.

[0109] Please continue reading Fig. 9 , Fig. 9is the proportion of each characteristic parameter at the TU level provided by this application. Fig. 9 It can be seen that under different TU sizes and different QP (Quantizer Parameter), The number of features accounts for the largest proportion, while The number of features is negligible.

[0110] Considering that the multiplication operation will increase the hardware area, this application uses the remaining four features for fitting, and the bit rate estimation model is defined as follows:

[0111]

[0112] in, is the estimated bit rate, Indicates the feature parameters in the current TU. and are the regression coefficients and bias.

[0113] It should be noted that, for the linear regression model, this application selects the data of the sequences BasketballDrive and BQSquare as the training set.

[0114] Step S135: input the transform type code rate, the block end identifier code rate and the transform characteristic parameter into an adder to obtain the estimated code rate of the block to be encoded.

[0115] In the embodiment of the present application, the image coding and decoding device inputs the transform type code rate, block end identifier code rate and transform feature parameter calculated in the above process into an adder (ADDER), and finally outputs the estimated code rate Rate of the block to be encoded.

[0116] Step S14: input the transform coefficients into a distortion estimator to obtain an estimated distortion of the block to be encoded.

[0117] In an embodiment of the present application, the image coding and decoding device inputs the transform coefficient (Transform Coefficient, TC) of the transform block of the to-be-encoded block into the distortion estimator, applies it to the distortion estimation after Round (quantization) in the distortion estimator, and finally outputs the estimated distortion of the to-be-encoded block.

[0118] Please continue to read Fig.10 , Fig.10 yes Figure 2 The specific flow chart of step S14 of the rate-distortion optimization method is shown in FIG. Fig.10 As shown, step S14 specifically includes the following steps:

[0119] Step S141: obtaining pixel domain low-frequency distortion, all-zero block low-frequency distortion and pixel domain global distortion of the transformed block, wherein the all-zero block low-frequency distortion is the low-frequency distortion after the high frequency in the pixel domain is set to zero.

[0120] In the embodiment of the present application, in order to reduce the hardware resource area, the present application calculates the distortion of a larger block based on the characteristics of the all-zero block. The complete distortion estimation includes: for the distortion of the quantization domain of the 32x32 low-frequency part, the calculation method is:

[0121]

[0122] If it is an all-zero block, the inverse quantization coefficient in the above formula is Equal to zero, at this time the low-frequency distortion calculation formula is:

[0123]

[0124] in, It is the calculated frequency domain distortion based on the low-frequency part of the all-zero block. are the row and column index values ​​in the transform block respectively.

[0125] Furthermore, the pixel domain distortion formula is:

[0126]

[0127] Among them, W and H are the width and height of the current TU respectively. is the original residual coefficient value, It is the sum of the squares of all transform coefficients in the current transform block.

[0128] Step S142: obtaining high-frequency distortion compensation based on the difference between the pixel domain global distortion and the all-zero block low-frequency distortion.

[0129] In the embodiment of the present application, the residual coefficient is energy-lossless after DCT transformation. Therefore, Fig.11 As shown, this application uses the difference between the two As compensation for high frequency distortion, the formula is as follows:

[0130]

[0131] Step S143: Add the pixel domain low-frequency distortion and high-frequency distortion compensation to obtain the estimated distortion of the block to be encoded.

[0132] In the embodiment of the present application, finally, the image encoding and decoding device will compensate the high frequency distortion By adding the pixel domain low-frequency distortion SSE, the frequency domain of the entire TU can be calculated. , and as the estimated distortion, the formula is as follows:

[0133]

[0134] Step S15: Based on the estimated bit rate and the estimated distortion, determine the rate-distortion cost of the combination of prediction mode and transform type used by the block to be encoded.

[0135] In the embodiment of the present application, the image encoding and decoding device is Figure 3 The hardware architecture of the present invention is used to obtain the estimated bit rate of the block to be encoded by using the above step S13, and the estimated distortion of the block to be encoded by using the above step S14, and finally the rate-distortion cost J is calculated by the RD cost function.

[0136] Furthermore, please combine Figure 3 Continue reading Fig.11 , this application is in Fig.11 The time-space diagram of time scheduling for different TU sizes is depicted in . To improve data parallelism when the TU height is less than 16, multiple TUs can be combined by reusing hardware resources. Specifically, Figure 3 The hardware architecture shown can process 4 W×4 TUs or 2 W×8 TUs simultaneously.

[0137] In an embodiment of the present application, an image coding and decoding device obtains a syntax element of a block to be encoded, wherein the syntax element indicates a preset prediction mode and a transform type combination; uses the prediction mode and the transform type combination to obtain a transform block of the block to be encoded, wherein the transform block includes a number of transform coefficients; inputs the syntax element into a bit rate estimator to obtain an estimated bit rate of the block to be encoded; inputs the transform coefficient into a distortion estimator to obtain an estimated distortion of the block to be encoded; and based on the estimated bit rate and the estimated distortion, determines the rate-distortion cost of the block to be encoded using the prediction mode and the transform type combination. Through the above-mentioned rate-distortion optimization method, the hardware implementation of rate-distortion optimization is realized while ensuring a good compromise between coding performance loss and complexity reduction, thereby improving the efficiency of rate-distortion optimization.

[0138] based on Figures 2 to 11 The rate-distortion optimization method and the hardware architecture for its implementation are shown in the figure. This application can improve the coding efficiency of the image coding process by using the rate-distortion cost quickly calculated by the rate-distortion optimization method. For details, please refer to Fig.12 , Fig.12 It is a flowchart of an embodiment of an image encoding method provided by the present application.

[0139] like Fig.12 As shown, the specific steps are as follows:

[0140] Step S21: obtaining a rate-distortion cost value of encoding the block to be encoded using each encoding mode based on a rate-distortion optimization method.

[0141] In the embodiment of the present application, through the hardware architecture of rate-distortion optimization, the image encoding and decoding device can quickly calculate the rate-distortion cost value of the to-be-encoded block encoded using each encoding mode, and the specific calculation process will not be repeated here.

[0142] Step S22: Select a coding mode with the smallest rate distortion cost to encode the block to be coded, and obtain a coded bitstream.

[0143] In the embodiment of the present application, the image coding and decoding device uses the coding mode with the smallest rate-distortion cost value to encode the coding block, which can effectively improve the coding efficiency and effect.

[0144] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0145] In order to implement the above rate-distortion optimization method and / or image encoding method, the present application also proposes an image encoding and decoding device, for details, please refer to Fig.13 , Fig.13 It is a structural diagram of an embodiment of an image encoding and decoding device provided by the present application.

[0146] The image coding and decoding apparatus 400 of this embodiment includes a processor 41 , a memory 42 , an input and output device 43 , and a bus 44 .

[0147] The processor 41, memory 42, and input / output device 43 are respectively connected to a bus 44. The memory 42 stores program data. The processor 41 is used to execute the program data to implement the rate-distortion optimization method and / or the image encoding method described in the above embodiments.

[0148] In the embodiment of the present application, the processor 41 may also be referred to as a CPU (Central Processing Unit). The processor 41 may be an integrated circuit chip having the ability to process signals. The processor 41 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or the processor 41 may also be any conventional processor, etc.

[0149] This application also provides a computer storage medium, please continue to refer to Fig.14 , Fig.14 It is a structural diagram of an embodiment of a computer storage medium provided in the present application. The computer storage medium 600 stores a computer program 61. When the computer program 61 is executed by a processor, it is used to implement the rate-distortion optimization method and / or image encoding method of the above-mentioned embodiment.

[0150] When the embodiments of the present application are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

[0151] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A rate-distortion optimization method, characterized in that: The rate-distortion optimization method comprises: Obtaining a syntax element of a block to be encoded, wherein the syntax element indicates a preset prediction mode and transform type combination; Acquire a transform block of the block to be encoded by using the prediction mode and the transform type combination, wherein the transform block includes a number of transform coefficients; Inputting the syntax element into a bit rate estimator to obtain an estimated bit rate of the block to be encoded; Inputting the transform coefficient into a distortion estimator to obtain an estimated distortion of the block to be encoded; Determining, based on the estimated bit rate and the estimated distortion, a rate-distortion cost of the block to be encoded using the combination of the prediction mode and the transform type; The rate estimator includes a transform type rate estimator, a block end identifier rate estimator and a coefficient amplitude rate estimator; The step of inputting the syntax element into a bit rate estimator to obtain an estimated bit rate of the block to be encoded includes: Based on the syntax element, determining a transform type combination, a block end identifier and a transform characteristic parameter of the block to be encoded; Inputting the transform type combination of the block to be encoded into the transform type rate estimator to obtain the transform type rate; Inputting the block end identifier of the block to be encoded into the block end identifier code rate estimator to obtain the block end identifier code rate; Inputting the transformation characteristic parameters of the block to be encoded into the coefficient amplitude rate estimator to obtain the coefficient amplitude rate; The transform type code rate, the block end identifier code rate and the transform characteristic parameter are input into an adder to obtain an estimated code rate of the block to be encoded.

2. The rate-distortion optimization method according to claim 1, characterized in that: The obtaining of the block end identifier code rate comprises: Obtain the block end identifier, and obtain the block end index of the block to be encoded; When the block end index is less than a preset index, obtaining a first block end identifier code rate based on a first model coefficient and a first deviation term; When the block end index is greater than or equal to a preset index, obtaining a second block end identifier code rate based on a second model coefficient and a second deviation term; The first model coefficient is greater than the second model coefficient, and / or the first deviation term is greater than the second deviation term.

3. The rate-distortion optimization method according to claim 1 or 2, characterized in that: The rate-distortion optimization method further includes: quantizing the transform coefficients of the transform block to obtain the quantized coefficients of the transform block; Acquire a first number of quantization coefficients whose absolute values ​​of quantization coefficients are within a first preset range among the quantization coefficients of the transform block; Obtaining the number of second quantization coefficients whose absolute values ​​of quantization coefficients are within a second preset range among the quantization coefficients of the transform block; Acquire the number of third quantization coefficients whose absolute values ​​are within a third preset range among the quantization coefficients of the transform block; A transform feature parameter of the transform block is generated based on the first quantization coefficient number, the second quantization coefficient number, and the third quantization coefficient number.

4. The rate-distortion optimization method according to claim 1, characterized in that: The obtaining the estimated distortion of the block to be encoded includes: Obtain pixel domain low-frequency distortion, all-zero block low-frequency distortion and pixel domain global distortion of the transform block, wherein the all-zero block low-frequency distortion is the low-frequency distortion after high frequencies in the pixel domain are set to zero; Obtaining high-frequency distortion compensation based on a difference between the pixel domain global distortion and the all-zero block low-frequency distortion; The pixel domain low-frequency distortion and the high-frequency distortion compensation are added together to obtain an estimated distortion of the block to be encoded.

5. The rate-distortion optimization method according to claim 4, characterized in that: The obtaining of the pixel domain low-frequency distortion of the transform block comprises: Based on the square of the difference between the quantization coefficient and the inverse quantization coefficient of the transform block in the low-frequency pixel domain, the pixel-domain low-frequency distortion of the transform block is obtained.

6. The rate-distortion optimization method according to claim 1, characterized in that: After obtaining the transform block of the block to be encoded by combining the prediction mode and the transform type, the rate-distortion optimization method further includes: In response to the transform block size being larger than a preset size, transform coefficients of the preset size within the transform block are retained, and remaining transform coefficients are set to zero.

7. An image encoding method, characterized in that: The image encoding method comprises: Obtaining a rate-distortion cost value of encoding a block to be encoded using each encoding mode based on the rate-distortion optimization method according to any one of claims 1 to 6; The coding mode with the smallest rate-distortion cost value is selected to encode the block to be encoded, and a coded bit stream is obtained.

8. An image encoding and decoding device, characterized in that: The image coding and decoding device includes a memory and a processor coupled to the memory; The memory is used to store program data, and the processor is used to execute the program data to implement the rate-distortion optimization method according to any one of claims 1 to 6, or the image encoding method according to claim 7.

9. A computer storage medium, characterized in that The computer storage medium is used to store program data, and when the program data is executed by a computer, it is used to implement the rate-distortion optimization method according to any one of claims 1 to 6, or the image encoding method according to claim 7.