Intra-frame prediction mode selection method, device, storage medium and electronic device
By using the sum-variance SSE model and the linear model to calculate the rate-distortion cost in AVS3 video coding, the problem of inaccurate RMD rate-distortion cost is solved, and the accuracy of intra-frame prediction mode selection and coding efficiency are improved.
Patent Information
- Application Number
- CN202210225632.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-07
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-03-07
AI Technical Summary
In the AVS3 video coding standard, the RMD rate-distortion cost calculation of the intra prediction mode is not accurate enough, which leads to inaccurate optimal mode ranking and affects coding efficiency.
The predicted distortion value D is obtained by using the sum-variance SSE model, and the bit rate is estimated in combination with the coding coefficient. The rate-distortion cost is calculated through a linear model, and the intra-frame prediction mode with a rate-distortion cost less than the threshold is screened out.
The calculation accuracy of the RMD rate-distortion cost is improved, ensuring more accurate selection of the optimal mode and improving coding efficiency without increasing computational complexity.
Smart Images

Figure CN114786008B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and more specifically, to a method, device, storage medium, and electronic device for selecting an intra-frame prediction mode. Background Art
[0002] The Audio Video Coding Standard (AVS) is the abbreviation of the "Advanced Audio and Video Coding for Information Technology" series of standards. It is a common basic standard for the digital audio and video industry. The AVS3 video coding standard belongs to the third generation of AVS standards, which mainly makes significant optimizations and substantial performance improvements in codec complexity control.
[0003] Currently, the complex division of coding units (CUs), the increase in intra-frame prediction modes, and the use of intra-frame coding tools in AVS3 all increase encoding time. Specifically, during the intra-frame prediction mode determination process, the rough mode decision (RMD) selection requires selecting several intra-frame prediction modes from 33 to enter the rate-distortion optimization stage. The optimal prediction mode is then selected during the intra-frame mode decision (MD) process. For intra-frame prediction modes in the RMD candidate list, the one at the front of the candidate list has a greater probability of being selected as the optimal intra-frame prediction mode. However, the RMD process calculates the mode rough cost, using the sum of absolute transform errors (SATD) as the estimated mode distortion cost. The rate cost is calculated using only the bit rate required to encode the intra-frame prediction mode. This results in inaccurate mode sorting by RMD, resulting in the optimal mode not being included in the final intra-frame candidate list, and low accuracy in RMD distortion cost calculation. Summary of the Invention
[0004] The embodiments of the present invention provide a method, device, storage medium and electronic device for selecting an intra-frame prediction mode, so as to at least solve the technical problem of low accuracy in RMD rate-distortion cost calculation in the related art.
[0005] According to one aspect of an embodiment of the present invention, a method for selecting an intra-frame prediction mode is provided, comprising: obtaining a predicted distortion value D of different intra-frame prediction modes under a coarse mode selection of a current coding unit based on a sum-variance model; determining a target estimated bit rate R corresponding to each intra-frame prediction mode under the coarse mode selection according to an original estimated bit rate and a coding coefficient estimated bit rate; wherein the above-mentioned coding coefficient estimated bit rate is obtained by summing the estimated bit rates of coefficient groups of multiple transform units in the above-mentioned coding unit using a preset linear model; determining the rate-distortion cost corresponding to each of the different intra-frame prediction modes under the coarse mode selection of the current video frame according to the above-mentioned predicted distortion value D and the target estimated bit rate R; and taking the intra-frame prediction mode having a rate-distortion cost less than a preset threshold as the target intra-frame prediction mode.
[0006] According to another aspect of an embodiment of the present invention, a device for selecting an intra-frame prediction mode is also provided, including: an acquisition unit, used to obtain a predicted distortion value D of different intra-frame prediction modes under the coarse mode selection of the current coding unit based on a sum-variance SSE model; a first determination unit, used to determine a target estimated bit rate R corresponding to each intra-frame prediction mode under the coarse mode selection according to the original estimated bit rate and the coding coefficient estimated bit rate; wherein the above-mentioned coding coefficient estimated bit rate is obtained by summing the estimated bit rates of the coefficient groups of multiple transformation units in the above-mentioned coding unit using a preset linear model; a second determination unit, used to determine the rate-distortion cost corresponding to each of the different intra-frame prediction modes under the coarse mode selection of the current video frame according to the above-mentioned predicted distortion value D and the target estimated bit rate R; and a third determination unit, used to take the intra-frame prediction mode with a rate-distortion cost less than a preset threshold as the target intra-frame prediction mode.
[0007] According to another aspect of an embodiment of the present invention, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the intra-frame prediction mode selection method through the computer program.
[0008] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the above-mentioned method for selecting the intra-frame prediction mode when running.
[0009] In an embodiment of the present invention, a sum-variance SSE model is adopted to obtain the predicted distortion value D of different intra-frame prediction modes under the coarse mode selection of the current coding unit; according to the original estimated bit rate and the coding coefficient estimated bit rate, the target estimated bit rate R corresponding to each intra-frame prediction mode under the coarse mode selection is determined; wherein the above-mentioned coding coefficient estimated bit rate is obtained by summing the estimated bit rates of the coefficient groups of multiple transformation units in the above-mentioned coding unit using a preset linear model; according to the above-mentioned predicted distortion value D and the target estimated bit rate R, the rate-distortion cost corresponding to each of the different intra-frame prediction modes under the coarse mode selection of the current video frame is determined; a method of using the intra-frame prediction mode with a rate-distortion cost less than a preset threshold as the target intra-frame prediction mode, in the above-mentioned method, since not only the bit rate used by the intra-frame mode is considered, but also the bit rate estimation of the coefficient part is added, the accuracy of the bit rate cost in RMD can be improved, thereby solving the technical problem of low accuracy of RMD rate-distortion cost calculation in the related art. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0011] Figure 1 is a schematic diagram of an application environment of an optional method for selecting an intra-frame prediction mode according to an embodiment of the present invention;
[0012] Figure 2 is a schematic diagram of an application environment of another optional method for selecting an intra-frame prediction mode according to an embodiment of the present invention;
[0013] Figure 3 is a flowchart of an optional method for selecting an intra-frame prediction mode according to an embodiment of the present invention;
[0014] Figure 4 is a schematic diagram of another optional RMD prediction process according to an embodiment of the present invention;
[0015] Figure 5 1 is a schematic diagram of a process for obtaining rate-distortion cost in an optional standard reference code according to an embodiment of the present invention;
[0016] Figure 6 2 is a schematic diagram of a process for obtaining an RMD rate-distortion cost according to an embodiment of the present invention;
[0017] Figure 7 is a structural diagram of an optional device for selecting an intra-frame prediction mode according to an embodiment of the present invention;
[0018] Figure 8FIG. 4 is a schematic structural diagram of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0019] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0020] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention 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 numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof 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 clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0021] According to one aspect of an embodiment of the present invention, a method for selecting an intra-frame prediction mode is provided. Optionally, as an optional implementation, the above method for selecting an intra-frame prediction mode can be applied to, but is not limited to, Figure 1 In the application environment shown. The application environment includes: a terminal device 102 for human-computer interaction with a user, a network 104, and a server 106. A user 108 can perform human-computer interaction with the terminal device 102, and an intra-frame prediction mode selection application is running in the terminal device 102. The above-mentioned terminal device 102 includes a human-computer interaction screen 1022, a processor 1024, and a memory 1026. The human-computer interaction screen 1022 is used to present the intra-frame prediction mode corresponding to the video frame; the processor 1024 is used to obtain the coding unit in the video frame. The memory 1026 is used to store the rate-distortion cost corresponding to each of the different intra-frame prediction modes under the coarse mode selection of the above-mentioned current video frame, as well as the target intra-frame prediction mode.
[0022] In addition, the server 106 includes a database 1062 and a processing engine 1064. The database 1062 is used to store the rate-distortion costs corresponding to different intra-frame prediction modes under the coarse mode selection of the current video frame, as well as the target intra-frame prediction mode. The processing engine 1064 is used to obtain a predicted distortion value D for different intra-frame prediction modes under the coarse mode selection of the current coding unit based on a sum-variance SSE model; determine a target estimated bit rate R corresponding to each intra-frame prediction mode under the coarse mode selection based on an original estimated bit rate and a coding coefficient estimated bit rate; wherein the coding coefficient estimated bit rate is obtained by summing the estimated bit rates of coefficient groups of multiple transform units in the coding unit using a preset linear model; determine the rate-distortion cost corresponding to different intra-frame prediction modes under the coarse mode selection of the current video frame based on the predicted distortion value D and the target estimated bit rate R; select the intra-frame prediction mode with a rate-distortion cost less than a preset threshold as the target intra-frame prediction mode; and send the target intra-frame prediction mode to the client of the terminal device 102.
[0023] In one or more embodiments, the above-mentioned intra-frame prediction mode selection method of the present application can be applied to Figure 2 In the application environment shown. Figure 2 As shown, human-computer interaction can be performed between user 202 and user device 204. User device 204 includes memory 206 and processor 208. In this embodiment, user device 204 can, but is not limited to, refer to and perform the operations performed by the terminal device 102 to output the target intra-frame prediction mode.
[0024] Optionally, the terminal device 102 and the user device 204 include but are not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop computer, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, etc. The target client can be a video client, an instant messaging client, a browser client, an education client, etc. The network 104 can include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication. The server 106 can be a single server, or a server cluster composed of multiple servers, or a cloud server. The above is only an example and is not limited to this in this embodiment.
[0025] As an optional implementation method, Figure 3 As shown, an embodiment of the present invention provides a method for selecting an intra-frame prediction mode, comprising the following steps:
[0026] S302 : Obtain prediction distortion values D of different intra prediction modes under coarse mode selection of the current coding unit based on a sum-variance model.
[0027] In the embodiment of the present invention, the RMD mode selection process is used to perform a rough selection of multiple intra-frame prediction modes through an effective pre-selection algorithm. Specifically, in the AVS3 standard reference code implementation process, the main focus is on the brightness prediction process, such as Figure 4 As shown, in each prediction partition mode of the current coding unit, N prediction modes can be finally selected through RMD, that is, N candidate prediction modes are selected from 33 prediction modes to enter the subsequent rate distortion optimization (RDO) process.
[0028] like Figure 5 As shown, in order to obtain N candidate prediction modes corresponding to each prediction division mode, the decision basis adopted by RMD is as follows:
[0029] J RMD =D RMD +λ RMD ·R
[0030] Among them, D RMD Represents the RMD prediction distortion, which is obtained by subtracting the prediction unit from the current coding unit, and performing Hadamard transform on the residual unit and accumulating all transform coefficients to obtain the absolute value error SATD value. RMD is the Lagrange multiplier in the RMD decision process, used to balance the prediction distortion cost D RMD and R, where R represents the value required for each prediction mode. The value of R in different intra prediction modes is equal to Rmode. The specific value of Rmode is shown in Table 1.
[0031] Table 1
[0032] Intra prediction mode Rmode value 0-1 mode 1 2-3 mode 2 4-7 mode 3 8-15 mode 4 16-31 mode 5 32 Mode 6
[0033] There are three commonly used models to measure image distortion: Sum of Square Error (SSE), Sum of Absolute Transformation Differences (SATD), and Sum of Absolute Differences (SAD). SSE is the sum of the squares of the errors between the original pixel value and the reconstructed pixel value. SAD is the cumulative sum of the absolute values of the residual matrix obtained by taking the difference between the original pixel and the predicted value. The formula is as follows:
[0034]
[0035]
[0036] Among them, Orig (i,j) Represents the pixel value of the original image, Reco (i,j) Represents the reconstructed pixel value after prediction. Among the three evaluation models, the SSE model has the highest accuracy, and the calculation result of SATD is close to SSE.
[0037] In the embodiment of the present invention, the SSE model is used to obtain the prediction distortion values D of different intra prediction modes under the coarse mode selection of the current coding unit.
[0038] S304, determining the target estimated bit rate R corresponding to each intra-frame prediction mode under the coarse mode selection based on the original estimated bit rate and the coding coefficient estimated bit rate; wherein the above-mentioned coding coefficient estimated bit rate is obtained by summing the estimated bit rates of the coefficient groups of multiple transformation units in the above-mentioned coding unit using a preset linear model.
[0039] In this embodiment of the present invention, the target estimated bit rate R corresponding to each intra-frame prediction mode under coarse mode selection includes, but is not limited to, a weighted sum of the original bit rate and the coding coefficient estimated bit rate corresponding to each prediction mode, or a sum of the two. Here, the original bit rate may be Rmode in Table 1 above.
[0040] S306 : Determine the rate-distortion costs corresponding to different intra-frame prediction modes under the coarse mode selection of the current video frame according to the predicted distortion value D and the target estimated bit rate R.
[0041] In the embodiment of the present invention, the rate-distortion cost corresponding to each of the different intra prediction modes is obtained by the following formula:
[0042] J RMD =D+λ RMD ·R
[0043] Among them, J RMD is the rate-distortion cost, λ RMD is the Lagrange multiplier in the RMD decision process.
[0044] S308 : Using the intra-frame prediction mode with a rate-distortion cost less than a preset threshold as the target intra-frame prediction mode.
[0045] Specifically, for example, if there are five intra-frame prediction modes whose rate-distortion cost is less than a preset threshold, then these five intra-frame prediction modes are used as target intra-frame prediction modes, thereby providing a basis for determining the optimal intra-frame prediction mode.
[0046] In an embodiment of the present invention, a sum-variance SSE model is used to obtain the predicted distortion value D of different intra-frame prediction modes under the coarse mode selection of the current coding unit; the target estimated bit rate R corresponding to each intra-frame prediction mode under the coarse mode selection is determined based on the original estimated bit rate and the coding coefficient estimated bit rate; wherein the above-mentioned coding coefficient estimated bit rate is obtained by summing the estimated bit rates of the coefficient groups of multiple transform units in the above-mentioned coding unit using a preset linear model; based on the above-mentioned predicted distortion value D and the target estimated bit rate R, the rate-distortion cost corresponding to each of the different intra-frame prediction modes under the coarse mode selection of the current video frame is determined; the intra-frame prediction mode with a rate-distortion cost less than a preset threshold is used as the target intra-frame prediction mode. In the above-mentioned method, since not only the bit rate used by the intra-frame mode is considered, but also the bit rate estimation of the coefficient part is added, the accuracy of the bit rate cost in the RMD can be improved, thereby solving the technical problem of low accuracy of RMD rate-distortion cost calculation in related technologies. Figure 6 As shown, the embodiment of the present invention can obtain the predicted distortion value D without going through the quantization, inverse transformation and reconstruction processes.
[0047] In one or more embodiments, obtaining the prediction distortion value D of different intra prediction modes under the coarse mode selection of the current coding unit based on the sum of squared differences (SSE) model includes:
[0048] Based on the sum-variance SSE model, the quantization distortion value di of each quantization coefficient of the transformation unit in the current coding unit is summed to obtain the above-mentioned prediction distortion value D.
[0049] In an embodiment of the present invention, inverse transformation and inverse quantization are not required when calculating SSE. The predicted distortion value D is obtained by summing the quantization distortion value di of each quantization coefficient of the transform unit in the current coding unit, so that the predicted distortion value D can be obtained accurately.
[0050] In one or more embodiments, the quantization distortion value d is obtained by formula (1): i , obtain the above-mentioned predicted distortion value D through formula (2);
[0051]
[0052] D=sΣd i (i=0…N 2 -1) (2)
[0053] Where f is the offset value, The low value of the transformation coefficient T The coefficient value of bit, T is the quantized transform coefficient in video coding, q Bits is a constant used in quantization, Qscale is a scaling constant related to the quantization step size, N is the width of the transform unit, and s is the number of transform units.
[0054] In one or more embodiments, before determining the target estimated bit rate R corresponding to each intra prediction mode under the coarse mode selection, the method includes:
[0055] The estimated bit rate of the above coding coefficient is obtained by formula (3);
[0056] R QT =ΣR CG (3)
[0057] Among them, R QT Represents the estimated bit rate of the above coding coefficients, R CG represents the estimated bit rate of the residual coefficients of each coefficient group of the transform unit in the above coding unit, the number of coefficient groups of each coding unit is n=N*N / 16, where N is the width of the transform unit;
[0058] The estimated bit rate R of the residual coefficient of each coefficient group CG Obtained by formula (4);
[0059] R CG =W kj L ij (4)
[0060] Among them, W kj Represents the weight coefficient, L ij represents the absolute value of the jth quantized coefficient in the i-th coefficient group CG in the transform unit, i represents the position of the coefficient group CG in the transform unit, j represents the position of the current coefficient in the coefficient group CG, k represents the division category of the coefficient group CG, W kj Indicates the weight value of the jth coefficient of the kth coefficient group CG. Here, the above CG is a coefficient group (CG).
[0061] In the embodiment of the present invention, W of each coefficient group kj Different, here W kj The obtained encoding sequences can be obtained by statistically analyzing various encoding sequences and clustering the obtained encoding sequences.
[0062] In one or more embodiments, the value range of the above i is 1 to N*N / 16, and the value range of the above j is 0 to 15; wherein the above N is the width of the transformation unit.
[0063] Specifically, for example, the size of the transform unit is 8*8, then N is equal to 8, so the value range of i is 1 to 4, and the value of the above j is in the range of 0 to 15; that is, the current transform unit contains 4 coefficient groups CG, and each coefficient group contains 16 coefficients.
[0064] In one or more embodiments, determining the rate-distortion costs corresponding to different intra-frame prediction modes under the coarse mode selection of the current video frame according to the predicted distortion value D and the target estimated bit rate R includes:
[0065] Determine the rate-distortion cost corresponding to each of the different intra-frame prediction modes under the coarse mode selection of the current video frame according to formula (5) and formula (6);
[0066] J=D+λ·R (5)
[0067] R=R mode +R QT (6)
[0068] Among them, J is the rate-distortion cost corresponding to the intra prediction mode, λ is the Lagrange multiplier, R mode is the original estimated bit rate corresponding to the current intra prediction mode, R QT Estimate the bit rate for the coding coefficients corresponding to the current intra prediction mode.
[0069] In video coding, coding distortion (D) primarily comes from three sources: distortion caused by the quantization process (DQ), distortion introduced by the transform clipping operation (DC), and distortion due to the non-orthogonality of the transform matrix (DT). Compared to DC and DT, quantization distortion (DQ) is the primary source of coding distortion (D). Most distortion estimation algorithms directly use quantization distortion (DQ) as coding distortion (D).
[0070] In the related art, the RMD mode selection process is to perform a rough selection of multiple intra-frame prediction modes through an effective pre-selection algorithm. Specifically, in the AVS3 standard reference code implementation process, the main focus is on the brightness prediction process, such as Figure 4 As shown, in each prediction partition mode of the current coding unit, N prediction modes can be finally selected through RMD, that is, N candidate prediction modes are selected from 33 prediction modes to enter the subsequent rate distortion optimization (RDO) process.
[0071] like Figure 5 As shown, in order to obtain N candidate prediction modes corresponding to each prediction division mode, the decision basis adopted by RMD is as follows:
[0072] J RMD =D RMD +λ RMD ·R
[0073] Among them, D RMDRepresents the RMD prediction distortion, which is obtained by subtracting the prediction unit from the current coding unit, and performing Hadamard transform on the residual unit and accumulating all transform coefficients to obtain the absolute value error SATD value. RMD is the Lagrange multiplier in the RMD decision process, used to balance the prediction distortion cost D RMD and R, where R represents the value required for each prediction mode. The value of R in different intra prediction modes is equal to Rmode. The specific value of Rmode is shown in Table 11.
[0074] Table 11
[0075] Intra prediction mode Rmode value 0-1 mode 1 2-3 mode 2 4-7 mode 3 8-15 mode 4 16-31 mode 5 32 Mode 6
[0076] The formula SATD is used to express the distortion cost D in the RMD prediction roughing process. RMD , SATD is calculated as follows:
[0077] DiffT(i,j)=H*Diff(i,j)*H
[0078]
[0079] Where H is the Hadamard transformation matrix, Diff (i,j) It is the difference between the original pixel and the predicted point. In HEVC encoding, two Hadamard methods are used to calculate SATD, where H4 corresponds to the 4th order Hadamard and H8 corresponds to the 8th order Hadamard. The transformation matrix is as follows:
[0080]
[0081] There are three commonly used models to measure image distortion: Sum of Square Error (SSE), Sum of Absolute Transformation Differences (SATD), and Sum of Absolute Differences (SAD). SSE is the sum of the squares of the errors between the original pixel and the reconstructed value, and SAD is the cumulative sum of the absolute values of the residual matrix obtained by taking the difference between the original pixel and the predicted value. The formula is as follows:
[0082]
[0083]
[0084] Among them, Orig (i,j) Represents the pixel value of the original image, Reco (i,j) Represents the pixel value of the reconstructed pixel after prediction. Among the three evaluation models, the SSE model has the highest accuracy, and the calculation result of SATD is close to SSE.
[0085] In an application embodiment, the method for selecting the intra prediction mode includes:
[0086] In video coding, the distortion D mainly comes from the quantization process. The quantization formula is shown in formula (11):
[0087] Q T =(T×Qscale+f)>>q Bits (11)
[0088] Among them, T is the transformation coefficient, Q T is the quantized transform coefficient, Qscale is the scaling constant related to the quantization step size, f is the offset value, q Bits is a constant used in quantization.
[0089] The distortion caused by quantization is shown in formula (22).
[0090]
[0091] in, The low value of the transformation coefficient T The coefficient value of the bit.
[0092] Formula (33) only obtains the distortion value d of one coefficient in the transform block; the quantization distortion d of all coefficients in the transform unit is i The distortion D of the entire block estimate can be obtained by summing up, as shown in the following formula (3), where N is the width of the change unit.
[0093] D=sΣd i (i=0…N 2 -1) (33)
[0094] Where N is the width of the transform unit and s is the number of transform units.
[0095] By using the above technical means to obtain the distortion cost D equal to SSE, the calculation accuracy of the distortion cost of RMD is improved without substantially increasing the calculation complexity of the system.
[0096] In addition to considering the bit rate required for intra-frame mode coding, the embodiment of the present invention also adds the bit rate estimation required for the residual coefficient. The specific estimation is as follows:
[0097] R=R mode +R QT
[0098] R mode is the estimated bit rate value of the intra-frame mode in the original algorithm (Rmode in Table 11 above), R QT Indicates the estimated bit rate of the coding coefficient.
[0099] The bit rate model adopts the following linear model, and the specific estimation is as follows:
[0100] R QT =ΣR CG
[0101] Among them, R QT Represents the estimated bit rate of the above coding coefficients, R CG represents the estimated bit rate of the residual coefficients of each coefficient group of the transform unit in the above coding unit, the number of coefficient groups of each coding unit is n=N*N / 16, where N is the width of the transform unit;
[0102] The estimated bit rate R of the residual coefficient of each coefficient group CG Obtained by formula (44);
[0103] R CG =W kj L ij (44)
[0104] Among them, W kj Represents the weight coefficient, L ij represents the absolute value of the jth quantized coefficient in the i-th coefficient group CG in the transform unit, i represents the position of the coefficient group CG in the transform unit, j represents the position of the current coefficient in the coefficient group CG, k represents the division category of the coefficient group CG, W kj Represents the weight value of the j-th coefficient of the k-th coefficient group CG.
[0105] The embodiment of the present invention also has the following beneficial effects: since RMD calculates a rough cost, the calculation cost of the RMD process is not accurate enough. The embodiment of the present invention improves the prediction accuracy of RMD without increasing the computational complexity. By using the distortion loss caused by the estimated quantization process to obtain the final distortion to replace the SATD value of RMD, the estimation algorithm based on the distortion D does not need to go through the inverse quantization and inverse transformation process, and the final distortion D obtained by this algorithm is consistent with the distortion D of the original (Rate Distortion optimization, RDO) process, and has high accuracy. The rate cost only considers the bit rate of the intra-frame mode, and does not consider the large difference between the bit rate occupied by the residual coefficient and the actual bit rate. In the embodiment of the present invention, the rate estimation of the residual coefficient is added to the rate cost of RMD, further improving the accuracy of the RMD cost calculation.
[0106] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0107] According to another aspect of the embodiments of the present invention, there is also provided an intra-frame prediction mode selection device for implementing the above-mentioned intra-frame prediction mode selection method. Figure 7 As shown, the device includes:
[0108] A first acquiring unit 702 is configured to acquire, based on a sum-variance SSE model, prediction distortion values D of different intra-frame prediction modes under coarse mode selection of a current coding unit;
[0109] A first determining unit 704 is configured to determine a target estimated bit rate R corresponding to each intra prediction mode under coarse mode selection based on the original estimated bit rate and the coding coefficient estimated bit rate, wherein the coding coefficient estimated bit rate is obtained by summing estimated bit rates of coefficient groups of multiple transform units in the coding unit using a preset linear model;
[0110] The second determining unit 706 is configured to determine the rate-distortion costs corresponding to different intra-frame prediction modes under the coarse mode selection of the current video frame according to the predicted distortion value D and the target estimated bit rate R;
[0111] The third determining unit 708 is configured to select the intra prediction mode with a rate-distortion cost less than a preset threshold as the target intra prediction mode.
[0112] In an embodiment of the present invention, a sum-variance SSE model is adopted to obtain the predicted distortion value D of different intra-frame prediction modes under the coarse mode selection of the current coding unit; according to the original estimated bit rate and the coding coefficient estimated bit rate, the target estimated bit rate R corresponding to each intra-frame prediction mode under the coarse mode selection is determined; wherein the above-mentioned coding coefficient estimated bit rate is obtained by summing the estimated bit rates of the coefficient groups of multiple transformation units in the above-mentioned coding unit using a preset linear model; according to the above-mentioned predicted distortion value D and the target estimated bit rate R, the rate-distortion cost corresponding to each of the different intra-frame prediction modes under the coarse mode selection of the current video frame is determined; a method of using the intra-frame prediction mode with a rate-distortion cost less than a preset threshold as the target intra-frame prediction mode, in the above-mentioned method, since not only the bit rate used by the intra-frame mode is considered, but also the bit rate estimation of the coefficient part is added, the accuracy of the bit rate cost in RMD can be improved, thereby solving the technical problem of low accuracy of RMD rate-distortion cost calculation in the related art.
[0113] In one or more embodiments, the obtaining unit 702 specifically includes:
[0114] The acquisition module is used to sum the quantization distortion value di of each quantization coefficient of the transformation unit in the current coding unit based on the sum variance SSE model to obtain the above-mentioned predicted distortion value D.
[0115] In one or more embodiments, the quantization distortion value d is obtained by formula (1): i , obtain the above-mentioned predicted distortion value D through formula (2);
[0116]
[0117] D=sΣd i (i=0…N 2 -1) (2)
[0118] Where f is the offset value, The low value of the transformation coefficient T The coefficient value of bit, T is the quantized transform coefficient in video coding, q Bits is a constant used in quantization, Qscale is a scaling constant related to the quantization step size, N is the width of the transform unit, and s is the number of transform units.
[0119] In one or more embodiments, the apparatus for selecting the intra-frame prediction mode further includes:
[0120] A second obtaining unit is used to obtain the estimated bit rate of the coding coefficient according to formula (3);
[0121] R QT =ΣR CG (3)
[0122] Among them, R QT Represents the estimated bit rate of the above coding coefficients, R CG represents the estimated bit rate of the residual coefficients of each coefficient group of the transform unit in the above coding unit, the number of coefficient groups of each coding unit is n=N*N / 16, where N is the width of the transform unit;
[0123] The estimated bit rate R of the residual coefficient of each coefficient group CG Obtained by formula (4);
[0124] R CG =W kj L ij (4)
[0125] Among them, W kj Represents the weight coefficient, L ijrepresents the absolute value of the jth quantized coefficient in the i-th coefficient group CG in the transform unit, i represents the position of the coefficient group CG in the transform unit, j represents the position of the current coefficient in the coefficient group CG, k represents the division category of the coefficient group CG, W kj Represents the weight value of the j-th coefficient of the k-th coefficient group CG.
[0126] In one or more embodiments, the value range of the above i is 1 to N*N / 16, and the value range of the above j is 0 to 15; wherein the above N is the width of the transformation unit.
[0127] In one or more embodiments, the second determining unit 706 specifically includes:
[0128] A determination module, configured to determine the rate-distortion costs corresponding to different intra-frame prediction modes under the coarse mode selection of the current video frame according to formula (5) and formula (6);
[0129] J=D+λ·R (5)
[0130] R=R mode +R QT (6)
[0131] Among them, J is the rate-distortion cost corresponding to the intra prediction mode, λ is the Lagrange multiplier, R mode is the original estimated bit rate corresponding to the current intra prediction mode, R QT Estimate the bit rate for the coding coefficients corresponding to the current intra prediction mode.
[0132] According to another aspect of the embodiments of the present invention, an electronic device for implementing the above-mentioned method for selecting an intra-frame prediction mode is provided. The electronic device may be Figure 8 The terminal device or server shown in FIG. This embodiment is described by taking the electronic device as a terminal as an example. Figure 8 As shown, the electronic device includes a memory 802 and a processor 804. The memory 802 stores a computer program, and the processor 804 is configured to execute the steps in any of the above method embodiments through the computer program.
[0133] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0134] Optionally, in this embodiment, the processor may be configured to execute the following steps through a computer program:
[0135] S1, based on the sum variance SSE model, obtain the prediction distortion value D of different intra prediction modes under the coarse mode selection of the current coding unit;
[0136] S2, determining a target estimated bit rate R corresponding to each intra prediction mode under the coarse mode selection based on the original estimated bit rate and the estimated bit rate of the coding coefficients; wherein the estimated bit rate of the coding coefficients is obtained by summing the estimated bit rates of the coefficient groups of the plurality of transform units in the coding unit using a preset linear model;
[0137] S3, determining the rate-distortion cost corresponding to each of the different intra-frame prediction modes under the coarse mode selection of the current video frame based on the predicted distortion value D and the target estimated bit rate R;
[0138] S4: The intra-frame prediction mode with a rate-distortion cost less than a preset threshold is used as a target intra-frame prediction mode.
[0139] Alternatively, those skilled in the art will appreciate that Figure 8 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, or other terminal devices. Figure 8 It does not limit the structure of the electronic device. For example, the electronic device may also include Figure 8 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 8 Different configurations shown.
[0140] Among them, the memory 802 can be used to store software programs and modules, such as the program instructions / modules corresponding to the method and device for selecting the intra-frame prediction mode in the embodiment of the present invention. The processor 804 executes various functional applications and data processing by running the software programs and modules stored in the memory 802, that is, realizing the above-mentioned method for selecting the intra-frame prediction mode. The memory 802 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 802 may further include a memory remotely located relative to the processor 804, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 802 can be used to store, but is not limited to, information such as intra-frame prediction modes. As an example, if Figure 8 As shown, the memory 802 may include, but is not limited to, the first acquisition unit 702, the first determination unit 704, the second determination unit 706, and the third determination unit 708 in the apparatus for selecting an intra-frame prediction mode. Furthermore, the memory 802 may also include, but is not limited to, other module units in the apparatus for selecting an intra-frame prediction mode, which will not be described in detail in this example.
[0141] Optionally, the transmission device 806 is configured to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one embodiment, the transmission device 806 includes a network interface controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In one embodiment, the transmission device 806 is a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.
[0142] In addition, the electronic device further includes: a display 808 for displaying the target intra-frame prediction mode; and a connection bus 810 for connecting various module components in the electronic device.
[0143] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting multiple nodes through network communication. The nodes may form a peer-to-peer (P2P) network, and any computing device, such as a server, terminal, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0144] According to one aspect of the present application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned method for selecting an intra-frame prediction mode. The computer program is configured to perform the steps of any of the aforementioned method embodiments when executed.
[0145] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0146] S1, based on the sum variance SSE model, obtain the prediction distortion value D of different intra prediction modes under the coarse mode selection of the current coding unit;
[0147] S2, determining a target estimated bit rate R corresponding to each intra prediction mode under the coarse mode selection based on the original estimated bit rate and the estimated bit rate of the coding coefficients; wherein the estimated bit rate of the coding coefficients is obtained by summing the estimated bit rates of the coefficient groups of the plurality of transform units in the coding unit using a preset linear model;
[0148] S3, determining the rate-distortion cost corresponding to each of the different intra-frame prediction modes under the coarse mode selection of the current video frame based on the predicted distortion value D and the target estimated bit rate R;
[0149] S4: The intra-frame prediction mode with a rate-distortion cost less than a preset threshold is used as a target intra-frame prediction mode.
[0150] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing the hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0151] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0152] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above-mentioned computer-readable storage medium. Based on this understanding, the technical solution of the present invention, 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. The computer software product is stored in a storage medium and includes a number of instructions for causing one or more computer devices (such as personal computers, servers, or network devices) to execute all or part of the steps of the methods of various embodiments of the present invention.
[0153] In the above embodiments of the present invention, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0154] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is merely a logical functional division. In actual implementation, there may be other division methods, such as combining or integrating multiple units or components into another system, or ignoring or not implementing some features. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interface, indirect coupling or communication connection of units or modules, and may be electrical or other forms.
[0155] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0156] In addition, the functional units in the various embodiments of the present invention may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0157] The above are only preferred embodiments of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for selecting an intra-frame prediction mode, characterized in that: include: Based on the sum-variance SSE model, obtain the prediction distortion value D of different intra-frame prediction modes under the coarse mode selection of the current coding unit; The estimated bit rate of the coding coefficient is obtained through formula (3); R QT = ΣR CG (3) Among them, R QT Represents the estimated bit rate of the coding coefficient, R CG Represents the estimated bit rate of the residual coefficients of each coefficient group of the transform unit in the coding unit, the number of coefficient groups of each coding unit is n=N*N / 16, where N is the width of the transform unit; The estimated bit rate R of the residual coefficient of each coefficient group CG Obtained by formula (4); R CG =W kj L ij (4) Among them, W kj Represents the weight coefficient, L ij represents the absolute value of the jth quantized coefficient in the i-th coefficient group CG in the transform unit, i represents the position of the coefficient group CG in the transform unit, j represents the position of the current coefficient in the coefficient group CG, k represents the division category of the coefficient group CG, W kj Represents the weight value of the jth coefficient of the kth coefficient group CG; determining a target estimated bit rate R corresponding to each intra prediction mode under coarse mode selection based on an original estimated bit rate and the estimated bit rate of the coding coefficients; wherein the estimated bit rate of the coding coefficients is obtained by summing estimated bit rates of coefficient groups of multiple transform units in the coding unit using a preset linear model; Determining rate-distortion costs corresponding to different intra-frame prediction modes under coarse mode selection of the current video frame according to the predicted distortion value D and the target estimated bit rate R; The intra-frame prediction mode with a rate-distortion cost less than a preset threshold is used as the target intra-frame prediction mode.
2. The method according to claim 1, characterized in that The method of obtaining the prediction distortion value D of different intra prediction modes under the coarse mode selection of the current coding unit based on the sum-variance SSE model includes: Based on the sum-variance SSE model, the quantization distortion value d of each quantization coefficient of the transform unit in the current coding unit is i The predicted distortion value D is obtained by summing up.
3. The method according to claim 2, characterized in that The quantization distortion value d is obtained by formula (1): i , obtain the predicted distortion value D through formula (2); D=sΣd i (i=0…N 2 -1) (2) Where f is the offset value, L qBit is the low q of the transform coefficient T Bits The coefficient value of bit, T is the quantized transform coefficient in video coding, q Bits is a constant used in quantization, Qscale is a scaling constant related to the quantization step size, N is the width of the transform unit, and s is the number of transform units.
4. The method according to claim 1, wherein The value range of i is 1 to N*N / 16, and the value range of j is 0 to 15; wherein N is the width of the transformation unit.
5. The method according to claim 1, characterized in that The determining, based on the predicted distortion value D and the target estimated bit rate R, rate-distortion costs corresponding to different intra-frame prediction modes under the coarse mode selection of the current video frame includes: Determine the rate-distortion cost corresponding to each of the different intra-frame prediction modes under the coarse mode selection of the current video frame according to formula (5) and formula (6); J=D+λ·R (5) R=R mode +R QT (6) Among them, J is the rate-distortion cost corresponding to the intra prediction mode, λ is the Lagrange multiplier, R mode is the original estimated bit rate corresponding to the current intra prediction mode, R QT Estimate the bit rate for the coding coefficients corresponding to the current intra prediction mode.
6. A device for selecting an intra-frame prediction mode, characterized in that: include: A first acquisition unit is configured to acquire, based on a sum-variance SSE model, prediction distortion values D of different intra-frame prediction modes under coarse mode selection of a current coding unit; A second obtaining unit is used to obtain the estimated bit rate of the coding coefficient using formula (3); R QT = ΣR CG (3) Among them, R QT Represents the estimated bit rate of the coding coefficient, R CG Represents the estimated bit rate of the residual coefficients of each coefficient group of the transform unit in the coding unit, the number of coefficient groups of each coding unit is n=N*N / 16, where N is the width of the transform unit; The estimated bit rate R of the residual coefficient of each coefficient group CG Obtained by formula (4); R CG =W kj L ij (4) Among them, W kj Represents the weight coefficient, L ij represents the absolute value of the jth quantized coefficient in the i-th coefficient group CG in the transform unit, i represents the position of the coefficient group CG in the transform unit, j represents the position of the current coefficient in the coefficient group CG, k represents the division category of the coefficient group CG, W kj Represents the weight value of the jth coefficient of the kth coefficient group CG; a first determining unit, configured to determine a target estimated bit rate R corresponding to each intra prediction mode under coarse mode selection based on an original estimated bit rate and the estimated bit rate of the coding coefficients; wherein the estimated bit rate of the coding coefficients is obtained by summing estimated bit rates of coefficient groups of multiple transform units in the coding unit using a preset linear model; A second determining unit is configured to determine rate-distortion costs corresponding to different intra-frame prediction modes under the coarse mode selection of the current video frame according to the predicted distortion value D and the target estimated bit rate R; The third determining unit is configured to use the intra-frame prediction mode with a rate-distortion cost less than a preset threshold as the target intra-frame prediction mode.
7. The device according to claim 6, characterized in that The acquisition unit specifically includes: The acquisition module is used to obtain the quantization distortion value d of each quantization coefficient of the transform unit in the current coding unit based on the sum variance SSE model. i The predicted distortion value D is obtained by summing up.
8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 5 through the computer program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program and a processor, wherein the processor implements the method described in any one of claims 1 to 5 when executing the program.
Citation Information
Patent Citations
Intraframe prediction coding optimum mode selecting method and apparatus for video coding
CN101141649A
Intra-frame prediction method and device for video coding, storage medium and electronic equipment
CN114630114A