Intra Prediction Method and Apparatus
By acquiring and verifying the gradient histogram of the intra prediction mode and selecting the optimal intra prediction mode, the problem of inaccurate selection of intra prediction mode in the prior art is solved, and the prediction accuracy of video encoding and decoding is improved.
Patent Information
- Application Number
- CN202111144070.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-28
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2041-09-28
AI Technical Summary
Prior art In the case where adjacent regions and current encoded block textures are complex, the selection of intra prediction modes will reduce prediction accuracy.
By obtaining the intra prediction mode gradient histogram of the encoding unit, selecting the first and second candidate intra prediction modes, and verifying it according to other intra prediction modes in the gradient histogram, the optimal intra prediction mode is finally determined.
The accuracy of intra prediction is improved, ensuring that the selected intra prediction mode is optimal, thereby improving the prediction effect of video encoding and decoding.
Smart Images

Figure CN115883833B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of video coding standards, and particularly relates to an intra prediction method and apparatus. Background Art
[0002] Decoder-side intra mode derivation (DIMD) derives the intra prediction mode by calculating the texture directions of the adjacent regions above and to the left of the current coding block, and selects the two intra prediction modes with the largest amplitudes for deriving the intra prediction mode of the current coding block. However, this direct selection of the intra prediction mode reduces the prediction accuracy when dealing with complex textures in the adjacent regions and the current coding block. Summary of the Invention
[0003] Embodiments of this application provide an intra prediction method and apparatus to improve the prediction accuracy.
[0004] In a first aspect, an intra prediction method is provided, including:
[0005] Obtaining a gradient histogram of the intra prediction modes of a template corresponding to a coding unit to be decoded;
[0006] Obtaining a first intra prediction mode and a first candidate intra prediction mode in the gradient histogram;
[0007] Obtaining a second intra prediction mode according to the first candidate intra prediction mode and a set of candidate intra prediction modes;
[0008] Obtaining a prediction sample of the coding unit to be decoded according to the first intra prediction mode and the second intra prediction mode;
[0009] Wherein, the set of candidate intra prediction modes includes at least one intra prediction mode in the gradient histogram other than the first intra prediction mode and the first candidate intra prediction mode.
[0010] In a second aspect, an intra prediction apparatus is provided, including:
[0011] A first obtaining module, configured to obtain a gradient histogram of the intra prediction modes of a template corresponding to a coding unit to be decoded;
[0012] A second obtaining module, configured to obtain a first intra prediction mode and a first candidate intra prediction mode in the gradient histogram;
[0013] A third obtaining module, configured to obtain a second intra prediction mode according to the first candidate intra prediction mode and a set of candidate intra prediction modes;
[0014] A fourth obtaining module, configured to obtain prediction samples of a coding unit to be decoded according to the intra-frame prediction mode of the first frame and the intra-frame prediction mode of the second frame;
[0015] Wherein, the candidate intra-frame prediction mode set includes at least one intra-frame prediction mode in the gradient histogram other than the intra-frame prediction mode of the first frame and the first candidate intra-frame prediction mode.
[0016] In a third aspect, an intra-frame prediction device is provided, including a processor, a memory, and a program or instruction stored on the memory and executable on the processor. When the program or instruction is executed by the processor, the steps of the method described in the first aspect are implemented.
[0017] In a fourth aspect, an intra-frame prediction device is provided, including a processor and a communication interface. Wherein, the processor is configured to obtain a gradient histogram of intra-frame prediction modes of a template corresponding to a coding unit to be decoded;
[0018] Obtain a first intra-frame prediction mode and a first candidate intra-frame prediction mode in the gradient histogram;
[0019] Obtain a second intra-frame prediction mode according to the first candidate intra-frame prediction mode and a candidate intra-frame prediction mode set;
[0020] Obtain prediction samples of a coding unit to be decoded according to the first intra-frame prediction mode and the second intra-frame prediction mode;
[0021] Wherein, the candidate intra-frame prediction mode set includes at least one intra-frame prediction mode in the gradient histogram other than the intra-frame prediction mode of the first frame and the first candidate intra-frame prediction mode.
[0022] In a fifth aspect, a readable storage medium is provided, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0023] In a sixth aspect, a chip is provided, including a processor and a communication interface. The communication interface is coupled to the processor, and the processor is configured to run a program or instruction to implement the steps of the method described in the first aspect.
[0024] In a seventh aspect, a computer program / program product is provided. The computer program / program product is stored in a non-transitory storage medium, and the program / program product is executed by at least one processor to implement the steps of the method described in the first aspect.
[0025] In the embodiments of the present application, first, the intra prediction mode in the first frame and the intra prediction mode in the first candidate frame are obtained according to the histogram of oriented gradients (HOG). Then, according to the intra prediction mode in the first candidate frame and other intra prediction modes in the histogram of oriented gradients, the intra prediction mode in the second frame is determined. Finally, the prediction samples of the coding unit to be decoded are obtained according to the intra prediction mode in the first frame and the intra prediction mode in the second frame. Compared with the prior art method of directly selecting the intra prediction mode in the first frame and the intra prediction mode in the second frame, the embodiments of the present application add a secondary selection on the basis of the first selection, which can verify whether the initially selected intra prediction mode is optimal, ensuring that the finally determined intra prediction mode is optimal, thereby improving the prediction accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 is a schematic flowchart of the intra prediction method according to the embodiments of the present application;
[0027] Figure 2 is a schematic diagram showing the relationship between the coding unit to be decoded currently, the reference samples of its corresponding template, and the reconstructed samples;
[0028] Figure 3 is a schematic diagram of the modules of the intra prediction device according to the embodiments of the present application;
[0029] Figure 4 is a block diagram of the structure of the intra prediction device according to the embodiments of the present application;
[0030] Figure 5 is a block diagram of the structure of the communication device according to the embodiments of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0031] Next, the technical solutions in the embodiments of the present application will be clearly described with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art fall within the scope of protection of the present application.
[0032] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such terms can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order different from those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same type, and the number of objects is not limited. For example, the first object can be one or multiple. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally means an "or" relationship between the associated objects before and after.
[0033] The related prior art of the present application is briefly introduced as follows.
[0034] In video coding, a frame of image is divided into many macroblocks, and predictive blocks are obtained by intra-frame prediction or inter-frame prediction. The difference between the original block and the predictive block is the residual block, and then the residual block is transformed, quantized, and entropy-coded.
[0035] Image types in video standards usually include I pictures, P pictures, and B pictures. An I picture can be decoded independently without referring to other pictures. A P picture uses multiple pictures (past) in the display order before the current picture as reference pictures. A B picture can use multiple pictures (past) in the display order before the current picture and multiple pictures (future) in the display order after the current picture as reference pictures.
[0036] 1. Intra-frame prediction
[0037] There are many prediction modes in intra-frame prediction to process various types of textures in an image, including DC, planar, and some angular prediction modes. Using the surrounding reconstructed pixels as input, the predicted value of the current predictive block is obtained through the specified prediction mode, achieving the purpose of removing spatial redundancy. This specified prediction mode index can be obtained explicitly from the bitstream or implicitly inferred at the decoding end.
[0038] 2. Most probably mode (MPM)
[0039] MPM is a technique for explicitly deriving the intra-frame prediction mode. Considering the strong correlation between the current predictive block and the surrounding neighboring blocks, the prediction modes of the neighboring blocks are used to construct a list of the most likely intra-frame prediction mode candidates. If the optimal prediction mode is in the list, only the index of this mode in the list needs to be written into the bitstream, which can save the number of bits required for encoding the intra-frame prediction mode.
[0040] 3. Decoder-side intra mode derivation (DIMD)
[0041] The DIMD mode is a technique for implicitly deriving the intra-frame prediction mode. At the decoding end, horizontal and vertical Sobel filters are applied to the pixels in a template with a width of N around the block to perform gradient histogram calculation, and then the direction of the gradient is converted into an intra-frame prediction mode, and the intensity of the gradient is accumulated as the amplitude corresponding to the intra-frame prediction mode. The intra-frame prediction mode is derived by comparing the amplitudes in the gradient histogram. If the DIMD mode flag of the current coding unit to be decoded is true, the derived intra-frame prediction mode is used for intra-frame prediction; if the DIMD mode is false, the derived intra-frame prediction mode is used to construct the MPM list.
[0042] The following will combine the accompanying drawings and, through some embodiments and their application scenarios, elaborate in detail on the intra prediction method and apparatus provided by the embodiments of the present application.
[0043] As Figure 1 shown, the embodiments of the present application provide an intra prediction method, including:
[0044] Step 101, obtaining a gradient histogram of the intra prediction mode of the template corresponding to the coding unit to be decoded;
[0045] Step 102, obtaining a first intra prediction mode and a first candidate intra prediction mode in the gradient histogram;
[0046] Step 103, obtaining a second intra prediction mode according to the first candidate intra prediction mode and the candidate intra prediction mode set;
[0047] Step 104, obtaining a prediction sample of the coding unit to be decoded according to the first intra prediction mode and the second intra prediction mode;
[0048] Wherein, the candidate intra prediction mode set includes at least one intra prediction mode in the gradient histogram other than the first intra prediction mode and the first candidate intra prediction mode; further, the amplitudes of the first intra prediction mode and the first candidate intra prediction mode are both greater than or equal to the amplitude of each intra prediction mode in the candidate intra prediction mode set.
[0049] Optionally, the first intra prediction mode is the intra prediction mode corresponding to the largest (first largest) amplitude among the intra prediction modes included in the gradient histogram; the first candidate intra prediction mode is the intra prediction mode corresponding to the second largest amplitude among the intra prediction modes included in the gradient histogram; it should be noted that the implementation manner of obtaining the first intra prediction mode and the first candidate intra prediction mode in the embodiments of the present application may be: after obtaining the gradient histogram, sorting all intra prediction modes in descending order of amplitude, and selecting the two intra prediction modes with the frontmost sorting positions, which can be understood as directly determining the intra prediction modes with the first and second largest amplitudes in the gradient histogram.
[0050] Optionally, the amplitude of the first intra prediction mode in the embodiments of the present application is greater than or equal to that of the first candidate intra prediction mode.
[0051] In this application, the prediction samples of the coding unit to be decoded are not directly obtained by using the first intra prediction mode and the first candidate intra prediction mode. Since the two intra prediction modes selected in this way may not be optimal, the first candidate intra prediction mode is used as the to-be-determined intra prediction mode here. If it is found in the subsequent comparison process that the first candidate intra prediction mode can be directly used, the first candidate intra prediction mode is used as the second intra prediction mode. If the first candidate intra prediction mode cannot be directly used, an intra prediction mode that can be directly used is selected from other intra prediction modes in the comparison as the second intra prediction mode.
[0052] It should be noted that since video coding and decoding are performed on each frame image, and each frame image is divided into multiple coding units for prediction. That is to say, the coding unit to be decoded mentioned in the embodiments of this application can be understood as the coding unit to be decoded currently being processed (which can be called the current coding unit to be decoded).
[0053] Specifically, the implementation manner of step 101 in the embodiments of this application is as follows:
[0054] Obtain the reconstructed samples of the adjacent decoded pixels of the coding unit to be decoded;
[0055] Construct a template corresponding to the coding unit to be decoded according to the reconstructed samples;
[0056] Perform gradient analysis on the template to obtain the gradient histogram of the intra prediction mode corresponding to the coding unit to be decoded.
[0057] For example, as Figure 2 shown, Current CU represents the current coding unit to be decoded, the area indicated by Templete represents the reconstructed samples of the template corresponding to the current coding unit to be decoded, and the area indicated by Reference of the templete represents the reference samples of the template corresponding to the current coding unit to be decoded.
[0058] Optionally, an implementable manner that can be adopted for step 103 in the embodiments of this application is as follows:
[0059] Step 1031, use the first candidate intra prediction mode and each intra prediction mode in the candidate intra prediction mode set to generate prediction samples of the template for the reference samples of the template corresponding to the coding unit to be decoded;
[0060] It should be noted that in this step, prediction samples of one template are obtained by using each intra prediction mode respectively.
[0061] Step 1032: Perform a first operation on the reconstructed samples of the template and the predicted samples of the template.
[0062] It should be noted that the first operation in the embodiments of this application realizes the comparison of two samples, mainly obtaining the difference between the two samples. For example, this first operation can be cost calculation. Of course, the specific form of the first operation is not limited in the embodiments of this application, and any operation method that can obtain the difference between two samples belongs to the protection scope of the first operation.
[0063] Step 1033: Determine the second intra-frame prediction mode in the first candidate intra-frame prediction mode and the set of candidate intra-frame prediction modes according to the result corresponding to the first operation.
[0064] It should be noted that step 1033 mainly realizes selecting the intra-frame prediction mode with the smallest difference or discrepancy between the reconstructed sample and the predicted sample indicated by the result corresponding to the first operation as the second intra-frame prediction mode according to the result corresponding to the first operation.
[0065] Optionally, when the first operation is cost calculation, the implementation manner of step 1033 is as follows:
[0066] Determine the intra-frame prediction mode with the smallest result of the corresponding cost calculation in the first candidate intra-frame prediction mode and the set of candidate intra-frame prediction modes as the second intra-frame prediction mode.
[0067] That is to say, the smallest difference or discrepancy between the reconstructed sample and the predicted sample indicates the smallest result of the cost calculation.
[0068] Optionally, the result of this cost calculation can be the sum of absolute transform differences, the sum of absolute differences, etc. Of course, the specific form of the result of the cost calculation is not limited in the embodiments of this application, and any calculation result that can reflect the difference between two samples belongs to the protection scope of the result of the cost calculation.
[0069] It should be noted that since the intra-frame prediction mode derived at the decoding end is obtained in this application, optionally, the embodiments of this application can perform the second intra-frame prediction mode only when the flag of the intra-frame prediction mode derived at the decoding end (DIMD) is true. Of course, the embodiments of this application can also not consider the DIMD flag, that is, when obtaining the predicted sample, directly use this method to first obtain the first intra-frame prediction mode and the second intra-frame prediction mode, and then obtain the predicted sample.
[0070] It should be noted that when considering the DIMD flag, the DIMD flag needs to be obtained first. Optionally, the method for obtaining the DIMD flag in the embodiments of this application is as follows:
[0071] Before obtaining the gradient histogram of the intra prediction mode corresponding to the coding unit to be decoded, first obtain the intra prediction information of the coding unit to be decoded in the bitstream, where the intra prediction information includes: the indication of the decoded end-derived intra prediction mode DIMD.
[0072] Further, the implementation manner of step 103 is as follows:
[0073] When the DIMD indication is true, obtain a second intra prediction mode according to the first candidate intra prediction mode and the candidate intra prediction mode set.
[0074] Optionally, when the DIMD indication is true, it is also possible to further make a further determination according to the picture type of the picture to which the coding unit to be decoded belongs. Specifically, when the picture type of the picture to which the coding unit to be decoded belongs is an I picture, then obtain a second intra prediction mode according to the first candidate intra prediction mode and the candidate intra prediction mode set.
[0075] Optionally, when the DIMD indication is false, the decoding end no longer obtains the second intra prediction mode in the manner of step 103, but directly adds the first intra prediction mode and the first candidate intra prediction mode to the MPM list.
[0076] Optionally, without considering the DIMD indication, the method further includes one of the following:
[0077] A11. Add the first intra prediction mode and the first candidate intra prediction mode to the MPM list;
[0078] It should be noted that since obtaining the second intra prediction mode requires a certain processing time, in the case where the latency is not allowed, in order to improve the prediction rate, the first intra prediction mode and the first candidate intra prediction mode are selected to be added to the MPM list.
[0079] A12. Add the first intra prediction mode and the second intra prediction mode to the MPM list;
[0080] It should be noted that since the second intra prediction mode is a relatively accurate intra prediction mode, in the case where the latency is allowed, in order to improve the prediction accuracy, the first intra prediction mode and the second intra prediction mode are added to the MPM list.
[0081] The following gives an example of the specific application of the present application as follows.
[0082] The main implementation process of the first specific application scenario is as follows:
[0083] Step S101: Obtain the intra prediction information of the current coding unit to be decoded from the bitstream. The intra prediction information includes the DIMD mode flag, MPM mode flag, MPM index value, intra prediction mode index value, etc.
[0084] Step S102: Obtain the reconstructed samples of the adjacent decoded pixels of the current coding unit to be decoded;
[0085] Step S103: Construct a template that includes the reconstructed samples of the upper row (or several rows) and / or the left column (or several columns) of decoded pixels of the current coding unit to be decoded;
[0086] Step S104: Perform gradient analysis on the template to obtain the gradient histogram of the intra prediction mode;
[0087] Step S105: Select the intra prediction mode with the largest amplitude value and the second largest amplitude value from the gradient histogram as the first intra prediction mode and the first candidate intra prediction mode;
[0088] Step S106: Obtain the intra prediction mode of the current coding unit to be decoded according to the intra prediction information obtained in Step S101, specifically including one of the following:
[0089] If the DIMD mode flag is false and the MPM list is used, add the first intra prediction mode and the first candidate intra prediction mode obtained in Step S105 to the MPM list;
[0090] If the DIMD mode flag is true, derive the final second intra prediction mode in the following manner, and use the first intra prediction mode and the final second intra prediction mode as the intra prediction mode of the current coding unit to be decoded.
[0091] Specifically, the derivation method of the final second intra prediction mode is as follows:
[0092] Select an intra prediction mode with the third largest amplitude value from the gradient histogram as the second candidate intra prediction mode, compare it with the first candidate intra prediction mode, and select the final second intra prediction mode;
[0093] The comparison method is as follows:
[0094] For the second candidate intra prediction mode and the first candidate intra prediction mode, the predicted samples of the template are generated using the reference samples of the template respectively. The cost is calculated between the predicted samples of the template corresponding to the second candidate intra prediction mode and the reconstructed samples to obtain the sum of absolute transform differences corresponding to the second candidate intra prediction mode. The cost is calculated between the predicted samples of the template corresponding to the first candidate intra prediction mode and the reconstructed samples to obtain the sum of absolute transform differences corresponding to the first candidate intra prediction mode. Compare the sum of absolute transform differences corresponding to the second candidate intra prediction mode with the sum of absolute transform differences corresponding to the first candidate intra prediction mode. If the sum of absolute transform differences corresponding to the second candidate intra prediction mode is the smallest, then select the second candidate intra prediction mode as the final second intra prediction mode; if the sum of absolute transform differences corresponding to the first candidate intra prediction mode is the smallest, then select the first candidate intra prediction mode as the final second intra prediction mode.
[0095] Step S107: Calculate the predicted value of the currently to-be-decoded coding unit using the obtained intra prediction mode;
[0096] Specifically, the intra prediction mode is the first intra prediction mode and the first candidate intra prediction mode, or the intra prediction mode is the first intra prediction mode and the second intra prediction mode, or the intra prediction mode can also be an intra prediction mode obtained by other intra prediction methods (for example, other methods except the DIMD mode mentioned in the embodiments of the present application).
[0097] The main implementation process of specific application case two is as follows:
[0098] Step S201: Obtain the reconstructed samples of the adjacent decoded pixels of the currently to-be-decoded coding unit;
[0099] Step S202: Construct a template, where the template includes the reconstructed samples of the upper row (or several rows) and / or the left column (or several columns) of the currently to-be-decoded coding unit of the decoded pixels;
[0100] Step S203: Perform gradient analysis on the template to obtain the gradient histogram of the intra prediction mode;
[0101] Step S204: Select the intra prediction modes with the largest and the second largest amplitude values from the gradient histogram as the first intra prediction mode and the first candidate intra prediction mode;
[0102] Step S205: Select the intra prediction mode with the third largest amplitude value from the gradient histogram as the second candidate intra prediction mode and the intra prediction mode with the fourth largest amplitude value as the third candidate intra prediction mode, compare the selected intra prediction modes with the first candidate intra prediction mode, and select the final second intra prediction mode;
[0103] The comparison method is as follows:
[0104] For the second candidate intra prediction mode, the third candidate intra prediction mode, and the first candidate intra prediction mode, predictive samples of the template are generated using the reference samples of the template respectively. Cost calculation is performed on the predictive sample of the template corresponding to the second candidate intra prediction mode and the reconstructed sample to obtain the sum of absolute transform differences corresponding to the second candidate intra prediction mode. Cost calculation is performed on the predictive sample of the template corresponding to the third candidate intra prediction mode and the reconstructed sample to obtain the sum of absolute transform differences corresponding to the third candidate intra prediction mode. Cost calculation is performed on the predictive sample of the template corresponding to the first candidate intra prediction mode and the reconstructed sample to obtain the sum of absolute transform differences corresponding to the first candidate intra prediction mode. The sum of absolute transform differences corresponding to the second candidate intra prediction mode, the sum of absolute transform differences corresponding to the third candidate intra prediction mode, and the sum of absolute transform differences corresponding to the first candidate intra prediction mode are compared. If the sum of absolute transform differences corresponding to the second candidate intra prediction mode is the smallest, then the second candidate intra prediction mode is selected as the final second intra prediction mode; if the sum of absolute transform differences corresponding to the first candidate intra prediction mode is the smallest, then the first candidate intra prediction mode is selected as the final second intra prediction mode; if the sum of absolute transform differences corresponding to the third candidate intra prediction mode is the smallest, then the third candidate intra prediction mode is selected as the final second intra prediction mode.
[0105] It should be noted that the cost function can also be other calculation methods, which are not limited here.
[0106] Step S206: Obtain the intra prediction information of the current coding unit to be decoded from the bitstream. The intra prediction information includes: DIMD mode flag, MPM mode flag, MPM index value, intra prediction mode index value, etc.;
[0107] It should be noted that for the intra prediction method using the MPM list, in the first type of intra prediction mode, the first candidate intra prediction mode and the first intra prediction mode obtained in step 204 can be added to the MPM list; in the second type of intra prediction mode, the first intra prediction mode and the final second intra prediction mode obtained in step 205 can be added to the MPM list.
[0108] It should be noted that the first type of intra prediction mode and the second type of intra prediction mode can be implicitly derived or explicitly identified, which are not limited here.
[0109] The main implementation process of the specific application case 3 is as follows:
[0110] Step S301: Obtain the intra prediction information of the currently to-be-decoded coding unit from the bitstream. The intra prediction information includes DIMD mode identifier, MPM mode identifier, MPM index value, intra prediction mode index value, etc.
[0111] Step S302: Obtain the reconstructed samples of the adjacent decoded pixels of the currently to-be-decoded coding unit;
[0112] Step S303: Construct a template, which includes the reconstructed samples of the upper one (or several) rows and / or the left one (or several) columns of decoded pixels of the currently to-be-decoded coding unit;
[0113] Step S304: Perform gradient analysis on the template to obtain the gradient histogram of the intra angle prediction mode;
[0114] Step S305: Select the intra prediction mode with the largest amplitude value and the second largest amplitude value from the gradient histogram as the first intra prediction mode and the first candidate intra prediction mode;
[0115] Step S306: Obtain the intra prediction mode of the currently to-be-decoded coding unit according to the intra prediction information obtained in Step S301, specifically one of the following:
[0116] If the DIMD mode identifier is false and the MPM list is used, add the first intra prediction mode and the second candidate intra prediction mode obtained in Step S305 to the MPM list;
[0117] If the DIMD mode identifier is true and the current image type is an I image, derive the final second intra mode in the following manner, and use the first intra prediction mode and the final second intra prediction mode as the intra prediction mode of the currently to-be-decoded coding unit.
[0118] Specifically, the derivation method of the final second intra prediction mode is as follows:
[0119] Select an intra prediction mode with the third largest amplitude value from the gradient histogram as the candidate intra prediction mode, compare it with the first candidate intra prediction mode, and select the final second intra prediction mode;
[0120] The comparison method is as follows:
[0121] For the second candidate intra prediction mode and the first candidate intra prediction mode, the prediction samples of the template are generated using the reference samples of the template respectively. The cost is calculated between the prediction samples of the template corresponding to the second candidate intra prediction mode and the reconstructed samples to obtain the sum of absolute transform differences corresponding to the second candidate intra prediction mode. The cost is calculated between the prediction samples of the template corresponding to the first candidate intra prediction mode and the reconstructed samples to obtain the sum of absolute transform differences corresponding to the first candidate intra prediction mode. The sum of absolute transform differences corresponding to the second candidate intra prediction mode is compared with the sum of absolute transform differences corresponding to the first candidate intra prediction mode. If the sum of absolute transform differences corresponding to the second candidate intra prediction mode is the smallest, then the second candidate intra prediction mode is selected as the final second intra prediction mode; if the sum of absolute transform differences corresponding to the first candidate intra prediction mode is the smallest, then the first candidate intra prediction mode is selected as the final second intra prediction mode.
[0122] Step S307: Calculate the predicted value of the currently to-be-decoded coding unit using the obtained intra prediction mode.
[0123] Specifically, the intra prediction mode is the first intra prediction mode and the first candidate intra prediction mode, or the intra prediction mode is the first intra prediction mode and the second intra prediction mode, or the intra prediction mode can also be an intra prediction mode obtained by other intra prediction methods (for example, other methods except the DIMD mode mentioned in the embodiments of the present application).
[0124] It should be noted that the embodiments of the present application can make the intra prediction mode derived from the DIMD mode more accurate, improve the prediction accuracy, and thus improve the compression efficiency.
[0125] It should be noted that for the intra prediction method provided in the embodiments of the present application, the execution subject can be an intra prediction device, or a control module in the intra prediction device for executing the intra prediction method. In the embodiments of the present application, the case where the intra prediction device executes the intra prediction method is taken as an example to illustrate the intra prediction device provided in the embodiments of the present application.
[0126] As Figure 3 shown, the embodiments of the present application provide an intra prediction device 300, including:
[0127] A first acquisition module 301, configured to acquire a gradient histogram of an intra prediction mode of a template corresponding to a coding unit to be decoded;
[0128] A second acquisition module 302, configured to acquire a first intra prediction mode and a first candidate intra prediction mode in the gradient histogram;
[0129] A third acquisition module 303, configured to acquire a second intra prediction mode according to the first candidate intra prediction mode and the candidate intra prediction mode set;
[0130] A fourth acquisition module 304, configured to acquire prediction samples of a coding unit to be decoded according to the first intra prediction mode and the second intra prediction mode;
[0131] Wherein, the candidate intra prediction mode set includes at least one intra prediction mode in the gradient histogram except the first intra prediction mode and the first candidate intra prediction mode.
[0132] Optionally, the third acquisition module 303 includes:
[0133] A generation unit, configured to respectively use the first candidate intra prediction mode and each intra prediction mode in the candidate intra prediction mode set to generate prediction samples of a template corresponding to a coding unit to be decoded;
[0134] An operation unit, configured to perform a first operation on the reconstructed samples of the template and the prediction samples of the template;
[0135] A determination unit, configured to determine a second intra prediction mode from the first candidate intra prediction mode and the candidate intra prediction mode set according to the result corresponding to the first operation.
[0136] Optionally, the first operation is cost calculation;
[0137] The determination unit is configured to:
[0138] Determine, as the second intra prediction mode, the intra prediction mode with the smallest result of the cost calculation corresponding to the first candidate intra prediction mode and the candidate intra prediction mode set.
[0139] Optionally, before the first acquisition module 301 acquires the gradient histogram of the intra prediction mode of the template corresponding to the coding unit to be decoded, it further includes:
[0140] A fifth acquisition module, configured to acquire intra prediction information of a coding unit to be decoded in a bitstream, where the intra prediction information includes: a DIMD flag for deriving an intra prediction mode at a decoding end;
[0141] The third acquisition module 303 is configured to:
[0142] When the DIMD flag is true, acquire a second intra prediction mode according to the first candidate intra prediction mode and the candidate intra prediction mode set.
[0143] Optionally, the third acquisition module 303 is configured to:
[0144] When the picture type of the picture to which the coding unit to be decoded belongs is an I picture, a second intra prediction mode is obtained according to the first candidate intra prediction mode and the set of candidate intra prediction modes.
[0145] Optionally, the device further includes:
[0146] A first processing module, configured to add the first intra prediction mode and the first candidate intra prediction mode to the most probable intra prediction mode (MPM) list when the DIMD flag is false.
[0147] Optionally, the device further includes one of the following:
[0148] A second processing module, configured to add the first intra prediction mode and the first candidate intra prediction mode to the MPM list;
[0149] A third processing module, configured to add the first intra prediction mode and the second intra prediction mode to the MPM list.
[0150] Optionally, the amplitudes of the first intra prediction mode and the first candidate intra prediction mode are both greater than or equal to the amplitude of each intra prediction mode in the set of candidate intra prediction modes.
[0151] Optionally, the first intra prediction mode is the intra prediction mode corresponding to the largest amplitude among the intra prediction modes included in the gradient histogram.
[0152] Optionally, the first candidate intra prediction mode is the intra prediction mode corresponding to the second largest amplitude among the intra prediction modes included in the gradient histogram.
[0153] It should be noted that by first obtaining the first intra prediction mode and the first candidate intra prediction mode according to the gradient histogram, then determining the second intra prediction mode according to the first candidate intra prediction mode and other intra prediction modes in the gradient histogram, and finally obtaining the prediction sample of the coding unit to be decoded according to the first intra prediction mode and the second intra prediction mode; compared with the prior art method of directly selecting the first intra prediction mode and the second intra prediction mode, the embodiment of the present application adds a secondary selection on the basis of the first selection, which can verify whether the initially selected intra prediction mode is optimal, ensure that the finally determined intra prediction mode is optimal, and thus improve the prediction accuracy.
[0154] The intra-frame prediction device in the embodiments of the present application may be a device, a device with an operating system, or an electronic device, or may be a component, an integrated circuit, or a chip in a terminal. The device or electronic device may be a mobile terminal or a non-mobile terminal. Exemplarily, the mobile terminal may include, but is not limited to, the types of the terminal 11 listed above, and the non-mobile terminal may be a server, a Network Attached Storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc., which are not specifically limited in the embodiments of the present application.
[0155] The intra-frame prediction device provided in the embodiments of the present application can implement Figure 1 each process implemented by the method embodiments and achieve the same technical effects. To avoid repetition, they will not be elaborated here.
[0156] The embodiments of the present application further provide an intra-frame prediction device, including a processor and a communication interface. The processor is configured to obtain a gradient histogram of an intra-frame prediction mode of a template corresponding to an encoding unit to be decoded;
[0157] obtain a first intra-frame prediction mode and a first candidate intra-frame prediction mode in the gradient histogram;
[0158] obtain a second intra-frame prediction mode according to the first candidate intra-frame prediction mode and a candidate intra-frame prediction mode set;
[0159] obtain a prediction sample of the encoding unit to be decoded according to the first intra-frame prediction mode and the second intra-frame prediction mode;
[0160] wherein, the candidate intra-frame prediction mode set includes at least one intra-frame prediction mode in the gradient histogram except the first intra-frame prediction mode and the first candidate intra-frame prediction mode.
[0161] This device embodiment corresponds to the above device-side method embodiments. Each implementation process and implementation manner of the above method embodiments can be applied to this device embodiment and can achieve the same technical effects. Specifically, Figure 4 FIG. is a schematic hardware structure diagram of an intra-frame prediction device for implementing the embodiments of the present application.
[0162] The intra-frame prediction device 400 includes, but is not limited to, at least some components such as a radio frequency unit 401, a network module 402, an audio output unit 403, an input unit 404, a sensor 405, a display unit 406, a user input unit 407, an interface unit 408, a memory 409, and a processor 410, etc.
[0163] Those skilled in the art can understand that the intra-frame prediction device 400 may further include a power supply (such as a battery) for powering each component. The power supply can be logically connected to the processor 410 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. Figure 4 The structure of the intra-frame prediction device shown in Figure 4 does not constitute a limitation on the device. The intra-frame prediction device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0164] It should be understood that in the embodiments of the present application, the input unit 404 may include a Graphics Processing Unit (GPU) 4041 and a microphone 4042. The graphics processor 4041 processes the image data of static pictures or videos obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 406 may include a display panel 4061. The display panel 4061 may be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 407 includes a touch panel 4071 and other input devices 4072. The touch panel 4071 is also called a touch screen. The touch panel 4071 may include two parts: a touch detection device and a touch controller. The other input devices 4072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be elaborated here.
[0165] In the embodiments of the present application, after receiving the downlink data from the network-side device, the radio frequency unit 401 processes it for the processor 410; in addition, it sends the uplink data to the network-side device. Generally, the radio frequency unit 401 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, a duplexer, etc.
[0166] The memory 409 can be used to store software programs or instructions and various data. The memory 409 may mainly include a program or instruction storage area and a data storage area. Among them, the program or instruction storage area can store an operating system, application programs or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 409 may include high-speed random access memory and may also include non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. For example, at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
[0167] The processor 410 may include one or more processing units; optionally, the processor 410 may integrate an application processor and a modem processor. Among them, the application processor mainly processes an operating system, a user interface, and application programs or instructions, etc., and the modem processor mainly processes wireless communication, such as a baseband processor. It can be understood that the above-mentioned modem processor may not be integrated into the processor 410 either.
[0168] Among them, the processor 410 is used to implement:
[0169] Obtain the gradient histogram of the intra prediction mode of the template corresponding to the coding unit to be decoded;
[0170] Obtain the first intra prediction mode and the first candidate intra prediction mode in the gradient histogram;
[0171] Obtain a second intra prediction mode according to the first candidate intra prediction mode and the candidate intra prediction mode set;
[0172] Obtain the prediction samples of the coding unit to be decoded according to the first intra prediction mode and the second intra prediction mode;
[0173] Among them, the candidate intra prediction mode set includes at least one intra prediction mode in the gradient histogram except the first intra prediction mode and the first candidate intra prediction mode.
[0174] The intra prediction device according to the embodiment of the present application first obtains a first intra prediction mode and a first candidate intra prediction mode according to the gradient histogram, then determines a second intra prediction mode according to the first candidate intra prediction mode and other intra prediction modes in the gradient histogram, and finally obtains the prediction samples of the coding unit to be decoded according to the first intra prediction mode and the second intra prediction mode. Compared with the prior art method of directly selecting the first intra prediction mode and the second intra prediction mode, the embodiment of the present application adds a secondary selection on the basis of the first selection, which can verify whether the initially selected intra prediction mode is optimal, ensuring that the finally determined intra prediction mode is optimal, thereby improving the prediction accuracy.
[0175] Optionally, the processor 410 is configured to implement:
[0176] For the reference samples of the template corresponding to the coding unit to be decoded, use the first candidate intra prediction mode and each intra prediction mode in the candidate intra prediction mode set to generate the prediction samples of the template;
[0177] Perform a first operation on the reconstructed samples of the template and the prediction samples of the template;
[0178] Determine a second intra prediction mode in the first candidate intra prediction mode and the candidate intra prediction mode set according to the result corresponding to the first operation.
[0179] Optionally, the first operation is cost calculation;
[0180] Further, the processor 410 is configured to implement:
[0181] Determine the intra prediction mode with the smallest result of the cost calculation corresponding to the first candidate intra prediction mode and the candidate intra prediction mode set as the second intra prediction mode.
[0182] Optionally, the processor 410 is further configured to implement:
[0183] Obtain the intra prediction information of the coding unit to be decoded in the bitstream, where the intra prediction information includes: the DIMD flag of the intra prediction mode derived at the decoding end;
[0184] The obtaining the second intra prediction mode according to the first candidate intra prediction mode and the candidate intra prediction mode set includes:
[0185] When the DIMD flag is true, obtain the second intra prediction mode according to the first candidate intra prediction mode and the candidate intra prediction mode set.
[0186] Optionally, the processor 410 is further configured to implement:
[0187] When the picture type of the picture to which the coding unit to be decoded belongs is an I picture, a second intra prediction mode is obtained according to the first candidate intra prediction mode and the candidate intra prediction mode set.
[0188] Optionally, the processor 410 is further configured to implement:
[0189] When the DIMD flag is false, add the first intra prediction mode and the first candidate intra prediction mode to the most probable intra prediction mode (MPM) list.
[0190] Optionally, the processor 410 is further configured to implement one of the following:
[0191] Add the first intra prediction mode and the first candidate intra prediction mode to the MPM list;
[0192] Add the first intra prediction mode and the second intra prediction mode to the MPM list.
[0193] Optionally, the amplitudes of the first intra prediction mode and the first candidate intra prediction mode are both greater than or equal to the amplitude of each intra prediction mode in the candidate intra prediction mode set.
[0194] Optionally, the first intra prediction mode is the intra prediction mode corresponding to the largest amplitude among the intra prediction modes included in the gradient histogram.
[0195] Optionally, the first candidate intra prediction mode is the intra prediction mode corresponding to the second largest amplitude among the intra prediction modes included in the gradient histogram.
[0196] Preferably, an embodiment of the present application further provides an intra prediction device, including a processor, a memory, a program or instruction stored on the memory and executable on the processor. When the program or instruction is executed by the processor, each process of the intra prediction method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be elaborated here.
[0197] An embodiment of the present application further provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by the processor, each process of the intra prediction method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be elaborated here. The computer-readable storage medium includes, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc.
[0198] Optionally, as Figure 5As shown in the figure, an embodiment of the present application further provides a communication device 500, which includes a processor 501, a memory 502, and a program or instruction stored on the memory 502 and executable on the processor 501. For example, when the communication device 500 is an intra prediction device, when the program or instruction is executed by the processor 501, each process of the above-mentioned intra prediction method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be elaborated here.
[0199] Another embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run a program or instruction to implement each process of the above-mentioned intra prediction method embodiment, and the same technical effect can be achieved. To avoid repetition, it will not be elaborated here.
[0200] It should be understood that the chip mentioned in the embodiments of the present application may also be referred to as a system-on-chip, system chip, chip system, or system-on-chip.
[0201] It should be noted that in this article, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of another identical element in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in a reverse order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0202] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions for causing a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present application.
[0203] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them fall within the protection scope of the present application.
Claims
1. An intra prediction method, characterized in that, Comprising: Obtaining a gradient histogram of an intra prediction mode of a template corresponding to an encoding unit to be decoded; Obtaining a first intra prediction mode and a first candidate intra prediction mode in the gradient histogram; Obtaining a second intra prediction mode according to the first candidate intra prediction mode and a set of candidate intra prediction modes; Obtaining a prediction sample of the encoding unit to be decoded according to the first intra prediction mode and the second intra prediction mode; Wherein, the set of candidate intra prediction modes includes at least one intra prediction mode in the gradient histogram except the first intra prediction mode and the first candidate intra prediction mode.
2. The method according to claim 1, characterized in that, The obtaining a second intra prediction mode according to the first candidate intra prediction mode and a set of candidate intra prediction modes includes: Using the first candidate intra prediction mode and each intra prediction mode in the set of candidate intra prediction modes to generate corresponding prediction samples of the template for reference samples of the template corresponding to the encoding unit to be decoded; Performing a first operation on the reconstructed sample of the template and the prediction sample of the template; Determining a second intra prediction mode from the first candidate intra prediction mode and the set of candidate intra prediction modes according to the result corresponding to the first operation.
3. The method according to claim 2, wherein The first operation is cost calculation; The determining a second intra prediction mode from the first candidate intra prediction mode and the set of candidate intra prediction modes according to the result corresponding to the first operation includes: Determining the intra prediction mode with the smallest result of the corresponding cost calculation in the first candidate intra prediction mode and the set of candidate intra prediction modes as the second intra prediction mode.
4. The method according to claim 1, wherein Before obtaining the gradient histogram of the intra prediction mode of the template corresponding to the encoding unit to be decoded, it further includes: Obtaining intra prediction information of the encoding unit to be decoded in the bitstream, where the intra prediction information includes: a DIMD flag for the intra prediction mode derived at the decoding end; The obtaining a second intra prediction mode according to the first candidate intra prediction mode and a set of candidate intra prediction modes includes: When the DIMD flag is true, obtaining a second intra prediction mode according to the first candidate intra prediction mode and the set of candidate intra prediction modes.
5. The method according to claim 4, wherein The obtaining a second intra prediction mode according to the first candidate intra prediction mode and a set of candidate intra prediction modes includes: When the image type of the image to which the encoding unit to be decoded belongs is an I image, obtaining a second intra prediction mode according to the first candidate intra prediction mode and the set of candidate intra prediction modes.
6. The method according to claim 4, wherein It further includes: When the DIMD flag is false, adding the first intra prediction mode and the first candidate intra prediction mode to the most probable intra prediction mode (MPM) list.
7. The method according to claim 1, characterized in that It further includes one of the following: Adding the first intra prediction mode and the first candidate intra prediction mode to the MPM list; Adding the first intra prediction mode and the second intra prediction mode to the MPM list.
8. The method according to claim 1, characterized in that, The amplitudes of both the first intra prediction mode and the first candidate intra prediction mode are greater than or equal to the amplitude of each intra prediction mode in the candidate intra prediction mode set.
9. The method according to claim 1, wherein The first intra prediction mode is the intra prediction mode corresponding to the largest amplitude among the intra prediction modes included in the gradient histogram.
10. The method according to claim 1, wherein The first candidate intra prediction mode is the intra prediction mode corresponding to the second largest amplitude among the intra prediction modes included in the gradient histogram.
11. An intra prediction device, characterized in that, Comprising: A first acquisition module, configured to acquire a gradient histogram of intra prediction modes of a template corresponding to an encoding unit to be decoded; A second acquisition module, configured to acquire a first intra prediction mode and a first candidate intra prediction mode in the gradient histogram; A third acquisition module, configured to acquire a second intra prediction mode according to the first candidate intra prediction mode and the candidate intra prediction mode set; A fourth acquisition module, configured to acquire a prediction sample of the encoding unit to be decoded according to the first intra prediction mode and the second intra prediction mode; Wherein, the candidate intra prediction mode set includes at least one intra prediction mode in the gradient histogram other than the first intra prediction mode and the first candidate intra prediction mode.
12. The device according to claim 11, wherein The third acquisition module includes: A generation unit, configured to respectively use the first candidate intra prediction mode and each intra prediction mode in the candidate intra prediction mode set to generate prediction samples of the template for reference samples of the encoding unit to be decoded; An operation unit, configured to perform a first operation on the reconstructed sample of the template and the prediction sample of the template; A determination unit, configured to determine a second intra prediction mode in the first candidate intra prediction mode and the candidate intra prediction mode set according to the result corresponding to the first operation.
13. The device according to claim 12, characterized in that, The first operation is cost calculation; The determination unit is configured to: Determine, as the second intra prediction mode, the intra prediction mode with the smallest result of the corresponding cost calculation in the first candidate intra prediction mode and the candidate intra prediction mode set.
14. The device according to claim 11, characterized in that, Before the first acquisition module acquires a gradient histogram of intra prediction modes of a template corresponding to an encoding unit to be decoded, it further includes: A fifth acquisition module, configured to acquire intra prediction information of the encoding unit to be decoded in the bitstream, where the intra prediction information includes: a DIMD flag for deriving an intra prediction mode at the decoding end; The third acquisition module is configured to: In the case where the DIMD flag is true, acquire a second intra prediction mode according to the first candidate intra prediction mode and the candidate intra prediction mode set.
15. The device according to claim 14, characterized in that, The third acquisition module is configured to: In the case where the image type of the image to which the encoding unit to be decoded belongs is an I image, acquire a second intra prediction mode according to the first candidate intra prediction mode and the candidate intra prediction mode set.
16. The device according to claim 14, wherein It further includes: A first processing module, configured to add the first intra prediction mode and the first candidate intra prediction mode to the most probable intra prediction mode (MPM) list in the case where the DIMD flag is false.
17. The device according to claim 11, characterized in that, It further includes one of the following: A second processing module, configured to add the first intra prediction mode and the first candidate intra prediction mode to the MPM list; A third processing module, configured to add the first intra prediction mode and the second intra prediction mode to the MPM list.
18. An intra prediction device, characterized in that, It includes a processor, a memory, and a program or instruction stored on the memory and executable on the processor. When the program or instruction is executed by the processor, the steps of the intra prediction method according to any one of claims 1 to 10 are implemented.
19. A readable storage medium, characterized in that, A program or instruction is stored on the readable storage medium. When the program or instruction is executed by a processor, the steps of the intra prediction method according to any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Method and device for selecting optimal intra-frame coding mode for video sequence
CN102724509A
Video coding intra-frame prediction method based on image texture features
CN105120292A