Intra-frame prediction mode selection method, device, computer equipment and storage medium
By combining the intra-frame prediction mode and the original pixel values and reference values of adjacent prediction blocks, the intra-frame prediction mode selection of HEVC video coding is optimized, which solves the problems of long intra-frame prediction time and low quality and achieves more efficient coding quality.
Patent Information
- Application Number
- CN202311740691.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-18
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2043-12-18
AI Technical Summary
In HEVC video coding, intra-frame prediction requires the use of pixel reference values of adjacent prediction blocks for prediction, which results in excessively long calculation time and reduced coding quality.
By combining the intra-frame prediction mode in the intra-frame prediction mode set and the original pixel values of adjacent prediction blocks, the pixel prediction value of each prediction block is predicted, and the optimal intra-frame prediction mode is selected according to the coding quality index, and further optimized in combination with the pixel reference value.
The coding quality and efficiency of intra-frame prediction are improved without significantly increasing the overall coding time.
Smart Images

Figure CN117714684B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of signal processing technology, and in particular to a method, apparatus, computer equipment, storage medium, and computer program product for determining an intra-frame prediction mode. Background Art
[0002] Predictive coding is a core technology in High Efficiency Video Coding (HEVC). It uses one or more previously encoded sample values to predict the current sample value based on a model or method, and then encodes the difference between the actual sample value and the predicted value. The video encoder transforms, quantizes, and entropy encodes the predicted residual rather than the original pixel values, significantly improving coding efficiency. Predictive coding includes intra-frame prediction and inter-frame prediction. Intra-frame prediction removes spatial redundancy between adjacent pixels within a frame, while inter-frame prediction removes temporal redundancy between adjacent images.
[0003] When a frame of image data enters the encoder, the frame type to be encoded is first determined. If it is an intra-frame coded frame (I frame), all its coding units must perform intra-frame prediction. If it is a forward predictive coded frame (P frame) or a bidirectional predictive interpolation coded frame (B frame), its coding units can choose either intra-frame prediction or inter-frame prediction. Therefore, in the encoder, the I frame serves as a reference frame for subsequent P / B frames, and its encoding quality has a certain impact on the encoding quality of subsequent P / B frames, especially when the quantization parameter (qp) is large.
[0004] When performing intra-frame prediction on an I-frame, for a prediction block, given an intra-frame prediction mode, the pixel prediction value of the current prediction block needs to be calculated using the pixel reference values of the adjacent prediction blocks. In other words, it is necessary to complete the intra-frame prediction mode search, residual transform quantization, and inverse quantization changes in the adjacent prediction blocks, and then determine the pixel reference values of the adjacent prediction blocks before intra-frame prediction can be performed on the current prediction block. This process consumes a lot of time and affects the search speed. If the pixel prediction value of the current prediction block is adjusted to be predicted based on the original pixel value of the adjacent prediction block, the error between the original pixel value and the pixel reference value will cause the pixel prediction value of the current prediction block to also have an error, thereby reducing the encoding quality of the I-frame. Summary of the Invention
[0005] Based on this, it is necessary to provide a highly adaptable intra-frame prediction mode selection method, apparatus, computer equipment, computer-readable storage medium and computer program product to address the above technical issues.
[0006] In a first aspect, the present application provides a method for selecting an intra-frame prediction mode. The method comprises:
[0007] For any pixel block in the target frame image, predict a first pixel prediction value of each prediction block based on the intra prediction mode in the first intra prediction mode set and the pixel original values of the adjacent prediction blocks of each prediction block in any pixel block;
[0008] Determining, according to the first pixel prediction value of each prediction block, a reference intra prediction mode corresponding to each prediction block from a first intra prediction mode set;
[0009] predicting a second pixel prediction value of each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block, wherein the pixel reference value of each prediction block is determined according to the original pixel value and the second pixel prediction value, and the second intra prediction mode set includes a reference intra prediction mode;
[0010] A target intra prediction mode corresponding to each prediction block is determined from a second intra prediction mode set according to the second pixel prediction value of each prediction block.
[0011] In one embodiment, predicting a first pixel prediction value of each prediction block based on an intra prediction mode in a first intra prediction mode set and original pixel values of neighboring prediction blocks of each prediction block in any pixel block includes:
[0012] Based on the division level of the prediction block within any pixel block, the first pixel prediction value of each level prediction block is predicted upward one by one according to the intra prediction mode in the first intra prediction mode set and the pixel original values of the adjacent prediction blocks of the lowest level prediction block.
[0013] In one embodiment, determining a reference intra prediction mode corresponding to each prediction block from a first intra prediction mode set according to a first pixel prediction value of each prediction block includes:
[0014] Calculating a coding quality indicator corresponding to each prediction block in each first intra prediction mode according to the original pixel value of each prediction block and the first pixel prediction value corresponding to each prediction block in each first intra prediction mode;
[0015] The first intra-frame prediction mode corresponding to the minimum encoding quality indicator is used as the reference intra-frame prediction mode corresponding to each prediction block.
[0016] In one embodiment, the coding quality indicator includes a prediction distortion cost, and the coding quality indicator corresponding to each prediction block in each first intra prediction mode is calculated based on the original pixel value of each prediction block and the first pixel prediction value corresponding to each prediction block in each first intra prediction mode, including:
[0017] Determining a pixel reference value corresponding to each prediction block in each first intra prediction mode according to a first pixel prediction value corresponding to each prediction block in each first intra prediction mode;
[0018] Calculating a difference between an original pixel value of each prediction block and a corresponding pixel reference value of each prediction block in each first intra prediction mode, and determining a sum and variance of the corresponding pixel prediction values of each prediction block in each first intra prediction mode according to the difference;
[0019] The prediction distortion cost corresponding to each prediction block in each first intra prediction mode is calculated according to the sum and variance.
[0020] In one embodiment, predicting a second pixel prediction value of each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block includes:
[0021] Based on the division level of the prediction blocks within any pixel block, the second pixel prediction value of each level prediction block is predicted upward one by one according to the intra-frame prediction mode in the second intra-frame prediction mode set and the pixel reference value of the adjacent prediction block of the lowest-level prediction block, and the pixel reference value of each prediction block is determined according to the second pixel prediction value and the original pixel value of each prediction block.
[0022] In one embodiment, based on the division level of the prediction block within any pixel block, the second pixel prediction value of each level prediction block is predicted upward one by one according to the intra prediction mode in the second intra prediction mode set and the pixel reference value of the neighboring prediction block of the lowest level prediction block, and the pixel reference value of each prediction block is determined according to the second pixel prediction value and the original pixel value of each prediction block, including:
[0023] For any two adjacent partitioning levels in the partitioning levels of the prediction block within any pixel block, including a first partitioning level with a relatively low level and a second partitioning level with a relatively high level;
[0024] determining a second pixel prediction value for each first-level prediction block based on the intra prediction modes in the second intra prediction mode set and the pixel reference values of the neighboring first-level prediction blocks of each first-level prediction block, and determining a pixel reference value for a pixel at a predetermined position within each first-level prediction block based on the pixel prediction value of each first-level prediction block;
[0025] Determine the adjacent second-level prediction blocks of each second-level prediction block, and when the pixel reference values of the pixels at preset positions in the four first-level prediction blocks included in the adjacent second-level prediction blocks are all determined, determine the second pixel prediction value of each second-level prediction block according to the intra prediction mode in the second intra prediction mode set and the pixel reference values of the pixels at preset positions in the adjacent second-level prediction blocks, and determine the pixel reference values of the pixels at preset positions in each second-level prediction block based on the second pixel prediction value of each second-level prediction block.
[0026] In a second aspect, the present application also provides an intra-frame prediction mode selection device. The device includes:
[0027] A first prediction module is configured to predict, for any pixel block in the target frame image, a first pixel prediction value of each prediction block based on an intra-frame prediction mode in a first intra-frame prediction mode set and pixel original values of adjacent prediction blocks of each prediction block in any pixel block;
[0028] A first selection module is configured to determine, based on a first pixel prediction value of each prediction block, a reference intra prediction mode corresponding to each prediction block from a first intra prediction mode set;
[0029] a second prediction module, configured to predict a second pixel prediction value of each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block, wherein the pixel reference value of each prediction block is determined based on the original pixel value and the second pixel prediction value, and the second intra prediction mode set includes a reference intra prediction mode;
[0030] The second selection module is configured to determine a target intra-frame prediction mode corresponding to each prediction block from a second intra-frame prediction mode set according to a second pixel prediction value of each prediction block.
[0031] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the following steps are performed:
[0032] For any pixel block in the target frame image, predict a first pixel prediction value of each prediction block based on the intra prediction mode in the first intra prediction mode set and the pixel original values of the adjacent prediction blocks of each prediction block in any pixel block;
[0033] Determining, according to the first pixel prediction value of each prediction block, a reference intra prediction mode corresponding to each prediction block from a first intra prediction mode set;
[0034] predicting a second pixel prediction value of each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block, wherein the pixel reference value of each prediction block is determined according to the original pixel value and the second pixel prediction value, and the second intra prediction mode set includes a reference intra prediction mode;
[0035] According to the second pixel prediction value of each prediction block, a target intra prediction mode corresponding to each prediction block is determined from the second intra prediction mode set.
[0036] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the following steps:
[0037] For any pixel block in the target frame image, predict a first pixel prediction value of each prediction block based on the intra prediction mode in the first intra prediction mode set and the original pixel values of the neighboring prediction blocks of each prediction block in any pixel block;
[0038] Determining, according to the first pixel prediction value of each prediction block, a reference intra prediction mode corresponding to each prediction block from a first intra prediction mode set;
[0039] predicting a second pixel prediction value of each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block, wherein the pixel reference value of each prediction block is determined according to the original pixel value and the second pixel prediction value, and the second intra prediction mode set includes a reference intra prediction mode;
[0040] According to the second pixel prediction value of each prediction block, a target intra prediction mode corresponding to each prediction block is determined from the second intra prediction mode set.
[0041] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the following steps:
[0042] For any pixel block in the target frame image, predict a first pixel prediction value of each prediction block based on the intra prediction mode in the first intra prediction mode set and the original pixel values of the neighboring prediction blocks of each prediction block in any pixel block;
[0043] Determining, according to the first pixel prediction value of each prediction block, a reference intra prediction mode corresponding to each prediction block from a first intra prediction mode set;
[0044] predicting a second pixel prediction value of each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block, wherein the pixel reference value of each prediction block is determined according to the original pixel value and the second pixel prediction value, and the second intra prediction mode set includes a reference intra prediction mode;
[0045] A target intra prediction mode corresponding to each prediction block is determined from a second intra prediction mode set according to the second pixel prediction value of each prediction block.
[0046] The above-mentioned intra-frame prediction mode selection method, apparatus, computer device, storage medium and computer program product predict, for any pixel block in the target frame image, the first pixel prediction value of each prediction block based on the intra-frame prediction mode in the first intra-frame prediction mode set and the pixel original values of the adjacent prediction blocks of each prediction block in any pixel block; determine the reference intra-frame prediction mode corresponding to each prediction block from the first intra-frame prediction mode set based on the first pixel prediction value of each prediction block; predict the second pixel prediction value of each prediction block based on the intra-frame prediction mode in the second intra-frame prediction mode set and the pixel reference values of the adjacent prediction blocks of each prediction block; wherein the pixel reference value of each prediction block is determined based on the pixel original value and the second pixel prediction value, and the second intra-frame prediction mode set includes the reference intra-frame prediction mode; and determine the target intra-frame prediction mode corresponding to each prediction block from the second intra-frame prediction mode set based on the second pixel prediction value of each prediction block. When performing intra-frame prediction, the scheme of predicting based on the original pixels of the prediction block is combined with the scheme of predicting based on the reference pixels of the prediction block to select the intra-frame prediction mode with the best coding quality without significantly increasing the overall coding time. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 FIG1 is a schematic diagram of CTU / CU division in one embodiment;
[0048] Figure 2 A schematic diagram of a partial PU division in one embodiment;
[0049] Figure 3 1 is a flow chart of a method for selecting an intra-frame prediction mode in one embodiment;
[0050] Figure 4 A schematic diagram of prediction blocks in a 16×16 pixel block in one embodiment;
[0051] Figure 5 Schematic diagram of each prediction block in a 32×32 pixel block in one embodiment;
[0052] Figure 6 A schematic diagram of prediction blocks in a 64×64 pixel block in one embodiment;
[0053] Figure 7 is a schematic diagram of a prediction block and its adjacent pixel blocks in one embodiment;
[0054] Figure 8 FIG1 is a schematic diagram of the parallel execution of Coarse INP and Fine INP in one embodiment;
[0055] Figure 9 A flowchart of Coarse INP execution in one embodiment;
[0056] Figure 10 is a flowchart of a method for selecting an intra-frame prediction mode in another embodiment;
[0057] Figure 11 is a serial execution flow chart of Fine INP in one embodiment;
[0058] Figure 12 It is a structural block diagram of an intra-frame prediction mode selection device in one embodiment;
[0059] Figure 13 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0061] Before introducing the intra-frame prediction coding mode selection method provided by the embodiment of the present application, the concept of block division encountered in HEVC is first introduced to facilitate understanding of the subsequent explanation of the embodiment of the present application:
[0062] (1) Coding tree units (CTU) and coding tree blocks (CTB)
[0063] A CTU is the largest coding processing unit supported by the HEVC encoder, and its size can be defined by the encoder's general profile. The HEVC standard stipulates that each CTU contains one luma CTB, two chroma CTBs, and their corresponding syntax elements. A frame of image data is first divided into CTUs, and then a quadtree is used to partition the CTUs into CUs.
[0064] (2) Coding units (CU) and coding blocks (CB)
[0065] The coding unit CU is the most basic coding unit of HEVC formed by dividing the coding tree unit CTU according to the quadtree structure. The HEVC standard stipulates that the size of CTU can be 16×16, 32×32, 64×64, and the size of CU can be 8×8, 16×16, 32×32, 64×64. Figure 1 The figure shows the CTU / CU division diagram. A CTB may contain a CU or be divided into several smaller CUs. During HEVC encoding, each CU is divided into prediction units (PUs) and transform units (TUs) according to a predefined syntactic structure and participates in the encoding process.
[0066] (3) Prediction units (PU) and prediction blocks (PB)
[0067] The basic unit used in HEVC intra / inter prediction is PU, which mainly includes luminance PU and chrominance PU and related syntax elements, which are divided downward from CU as the root node. PU division methods include quadtree division, symmetric binary tree division and asymmetric binary tree division. Figure 2 Shown is a partial PU partition diagram.
[0068] (4) Transform units (TU) and transform blocks (TB)
[0069] The prediction residual within or between frames is encoded using transform units (TUs), which are the basic units in the HEVC transform and quantization process.
[0070] In HEVC, the luma component has 35 intra-frame prediction modes, including the planar mode, the DC mode, and 33 angular modes. The chroma component has 5 intra-frame prediction modes, including the planar mode, the DC mode, the horizontal mode, the vertical mode, and the intra-frame prediction mode corresponding to the luma component. The numbers and names of the 35 intra-frame prediction modes are shown in Table 1 below:
[0071] Table 1 Numbers and names of the 35 intra prediction modes
[0072]
[0073] The intra-frame prediction mode selection method provided in the embodiments of the present application is applied to a video encoder. It can be applied during real-time video encoding or before real-time video encoding to determine the optimal intra-frame prediction mode. The video encoder is present in, but not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart car devices. Portable wearable devices can include smart watches, smart bracelets, and head-mounted devices.
[0074] In one embodiment, Figure 3 As shown, a method for selecting an intra-frame prediction mode is provided, which is described by applying the method to a video encoder, and includes the following steps:
[0075] Step 302: for any pixel block in the target frame image, predict a first pixel prediction value of each prediction block based on an intra prediction mode in a first intra prediction mode set and pixel original values of adjacent prediction blocks of each prediction block in the pixel block;
[0076] First of all, it should be understood that video is a moving image, which is composed of multiple frames of images, and each frame of image is a still picture. In video coding, a frame of image is usually encoded as a frame of data, and the target frame of image is the frame of data that needs to be encoded at the moment. The pixel block refers to the coding unit CU in video coding. The coding unit is generally an L×L pixel block, so it is referred to as a pixel block for short. Among them, the value of L can be 16, 32, 64, etc., and this embodiment of the application does not specifically limit this. The prediction block is the prediction unit PU in the coding prediction.
[0077] According to the above concept, a pixel block includes multiple prediction blocks. Depending on the L value of the pixel block, the types of prediction blocks included in the pixel block will be different. Figure 4 Shown are the individual prediction blocks in a 16×16 pixel block. Figure 5 For each prediction block in the 32×32 pixel block, Figure 6 It should be noted that in actual application scenarios, since the size of the prediction block of video coding will limit the storage capacity of the video encoder and the chip where it is located, the size of the pixel block can be limited to 32×32.
[0078] The original pixel value refers to the original value of the pixel value of each pixel in the target frame image when it is input to the encoder for encoding, that is, the pixel value before image compression and encoding and decoding. Among them, the pixel value refers to the parameter value of the pixel. When encoding the brightness, the pixel value is the brightness, and when encoding the chrominance, the pixel value is the chrominance. They are collectively referred to as pixel values here. It can be known that for the target frame image, the original pixel values of all its pixels are known before encoding. The prediction block is obtained by dividing the target frame image layer by layer, which includes m×m pixels. Therefore, the number of pixel original values of the prediction block and the pixel prediction value of the prediction block in the embodiment of the present application is m. 2 indivual.
[0079] The first intra-frame prediction mode set belongs to all intra-frame prediction mode sets of HEVC, that is, the intra-frame prediction modes in the first intra-frame prediction mode set are arbitrarily selected from all intra-frame prediction modes of HEVC, and the number of intra-frame prediction modes in the first intra-frame prediction mode set does not exceed the total number of all intra-frame prediction modes. For example, the number of intra-frame prediction modes in the first intra-frame prediction mode set corresponding to the luma component does not exceed 35.
[0080] The adjacent prediction blocks of each prediction block refer to the prediction blocks that are pixel-adjacent to the pixel block. It can be seen that the number of all adjacent prediction blocks of each prediction block is 3, namely 2, 3 and 4. When predicting the pixel values of each pixel block, the adjacent pixel blocks required are generally two of all its adjacent pixel blocks, for example, the adjacent pixel blocks on the left and above. It should be noted that the determination of the adjacent pixel blocks can be pre-set, and the method of selecting adjacent prediction blocks for all prediction blocks can be consistent or inconsistent. For example, all prediction blocks are predicted based on the adjacent pixel blocks on the left and above, or the prediction blocks from the first row to the second to last row are predicted based on the adjacent pixel blocks on the left and below, and the prediction blocks in the last row are predicted based on the adjacent pixel blocks on the left and above. The embodiment of the present application does not specifically limit the selection of the adjacent prediction blocks of each prediction block in this step.
[0081] Specifically, in one embodiment, the neighboring prediction blocks of each prediction block are set to the prediction blocks on its left and above, see Figure 7As shown in the figure, the pixel prediction value of each pixel in the 4×4 prediction block PU3 is determined by the original pixel values of pixels I, J, K, and L in its adjacent prediction block PU2 and pixels A, B, C, and D in the adjacent prediction block PU1. For example, if the intra-frame prediction mode is INTRA_DC mode, the pixel prediction value of each pixel in the prediction block PU3 is the average of the original pixel values of pixels A, B, C, D, I, J, K, and L. If the intra-frame prediction mode is INTRA_PLANAR mode, the pixel prediction value of each column of pixels in the prediction block PU3 is equal to the original pixel value of the pixels above it. For example, the pixel prediction value of the first column of pixels is equal to the original pixel value of pixel A.
[0082] Step 304 , determining a reference intra prediction mode corresponding to each prediction block from the first intra prediction mode set according to the first pixel prediction value of each prediction block;
[0083] The reference intra-frame prediction mode refers to a scheme for determining a pixel prediction value by using an original pixel value, and is an intra-frame prediction mode selected from the first intra-frame prediction mode set that can ensure prediction coding efficiency.
[0084] For any prediction block, given an intra-frame prediction mode, the pixel prediction value of any prediction block can be determined based on the original pixel values of its adjacent prediction blocks. Then, the difference between the original pixel value and the pixel prediction value of any prediction block is calculated. This difference is quantized and entropy encoded to obtain the encoding result of any prediction block, and the encoding result of the target frame image can be determined. It can be understood that each encoding result corresponds to its own encoding quality. From this, it can be seen that different intra-frame prediction modes will result in different pixel prediction values, and thus different differences, that is, different encoding results. In other words, different intra-frame prediction modes will directly lead to different encoding quality.
[0085] In this step, the first intra-frame prediction modes are screened based on the difference between the first pixel predicted value and the original pixel value of each prediction block in each first intra-frame prediction mode. The intra-frame prediction mode with the best encoding quality is determined as the reference intra-frame prediction mode for each prediction block. Specifically, the encoding quality is determined by analyzing the encoding results.
[0086] Step 306: predicting a second pixel prediction value for each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block; wherein the pixel reference value of each prediction block is determined based on the original pixel value and the second pixel prediction value, and the second intra prediction mode set includes a reference intra prediction mode;
[0087] The second intra-frame prediction mode set includes a reference intra-frame prediction mode, and the number M of intra-frame prediction modes included therein is artificially set based on coding experience and the requirements of the actual application scenario for coding speed and quality. For example, when the chip operating frequency configured for the video encoder is relatively high, in some non-real-time application scenarios where the coding speed requirement is not high, the value of M can be set to a larger value to search for more modes to obtain higher coding quality; when the chip operating frequency is relatively low or in some real-time application scenarios, the value of M can be set to a smaller value to search for fewer modes. The minimum value of the number of intra-frame prediction modes M should be no less than 1, and the maximum value should be no greater than the maximum number of intra-frame prediction modes specified by the standard followed by the video codec in the application scenario.
[0088] The other M-1 intra-frame prediction modes, excluding the reference intra-frame prediction mode, are selected from all intra-frame prediction modes in HEVC. Specifically, all intra-frame prediction modes can be sorted, and after setting M, the first M-1 intra-frame prediction modes from all sorted intra-frame prediction modes are directly added to the second intra-frame prediction mode set. Alternatively, M-1 intra-frame prediction modes can be randomly selected from all intra-frame prediction modes and added to the second intra-frame prediction mode set.
[0089] The pixel reference value of the prediction block is determined based on the second pixel prediction value and the original pixel value after obtaining the second pixel prediction value. Taking the prediction block PU1 as an example, the determination process and use process of the pixel reference value are explained as follows: (1) The second pixel prediction value of the prediction block PU1 is obtained based on the pixel reference value of the adjacent prediction block with a known pixel reference value; (2) The difference d between the second pixel prediction value of the prediction block PU1 and the original pixel value is calculated; (3) The difference d is then quantized and entropy encoded to obtain the encoding result of the prediction block PU1; (4) The difference d is then entropy decoded and inverse quantized to obtain ; (5) will The pixel reference value of prediction block PU1 is added to the second pixel prediction value of prediction block PU1 to obtain the pixel reference value of prediction block PU1. After the pixel reference value of prediction block PU1 is obtained, prediction block PU1 can be used as an adjacent prediction block with known pixel reference value to predict other prediction blocks.
[0090] Step 308 : Determine a target intra prediction mode corresponding to each prediction block from the second intra prediction mode set according to the second pixel prediction value of each prediction block.
[0091] As can be seen from the above explanation, different intra-frame prediction modes directly lead to different encoding quality. Similarly, for a prediction block, when the second pixel prediction value is determined by the pixel reference value, different intra-frame prediction modes in the second intra-frame prediction mode set will also result in different encoding quality of the resulting encoding. Therefore, in this step, it is also necessary to analyze the encoding results of each prediction block under each second intra-frame prediction mode, and determine the intra-frame prediction mode corresponding to the encoding result with the best encoding quality, which will be used as the target intra-frame prediction mode for each prediction block.
[0092] Finally, the above steps 302 to 308 describe the intra prediction mode selection process for a pixel block. However, for a coding tree unit, it has multiple pixel blocks, that is, a CTU is divided into multiple L×L pixel blocks according to the maximum L value of the CU. Under the premise of considering the encoding speed, Figure 8 As shown, the execution flow of the intra prediction mode selection method for multiple L×L pixel blocks can be performed in parallel using Coarse INP (determining pixel prediction values based on original pixel values) and Fine INP (determining pixel prediction values based on reference pixel values). Specifically, from 0 to t0, Coarse INP is first performed on all prediction blocks in the L×L_0 pixel block to determine the reference intra prediction mode for each prediction block. From t0 to t1, Fine INP is performed on each prediction block in the L×L_0 pixel block to determine the target intra prediction mode. Simultaneously, Coarse INP is performed on each prediction block in the L×L_1 pixel block. This process continues for L×L_2 through L×L_# until the target intra prediction mode is determined for all L×L pixel blocks. Here, # is the total number of L×L pixel blocks in a CTU.
[0093] In the method provided by the above embodiment, for any pixel block in the target frame image, a first pixel prediction value of each prediction block is predicted based on an intra-frame prediction mode in a first intra-frame prediction mode set and the original pixel values of the neighboring prediction blocks of each prediction block in any pixel block; a reference intra-frame prediction mode corresponding to each prediction block is determined from the first intra-frame prediction mode set based on the first pixel prediction value of each prediction block; a second pixel prediction value of each prediction block is predicted based on an intra-frame prediction mode in a second intra-frame prediction mode set and the pixel reference values of the neighboring prediction blocks of each prediction block; wherein the pixel reference value of each prediction block is determined based on the original pixel value and the pixel prediction value, and the second intra-frame prediction mode set includes the reference intra-frame prediction mode; and a target intra-frame prediction mode corresponding to each prediction block is determined from the second intra-frame prediction mode set based on the second pixel prediction value of each prediction block. When performing intra-frame prediction, a scheme of predicting based on the original pixels of the prediction block is combined with a scheme of predicting based on the reference pixels of the prediction block, so as to select the intra-frame prediction mode with the best coding quality without significantly increasing the overall coding time.
[0094] In one embodiment, predicting a first pixel prediction value of each prediction block based on an intra prediction mode in a first intra prediction mode set and original pixel values of neighboring prediction blocks of each prediction block in any pixel block includes:
[0095] Based on the division level of the prediction block within any pixel block, the first pixel prediction value of each level prediction block is predicted upward one by one according to the intra prediction mode in the first intra prediction mode set and the pixel original values of the adjacent prediction blocks of the lowest level prediction block.
[0096] The division level refers to the level of the division size of the prediction block in the L×L pixel block. The order of the division level is determined according to the size of the division size. The division levels of the prediction block in the L×L pixel block are L×L, , where L×L is the highest level, It should be noted that the value of n is related to the actual application scenario. For example, the minimum prediction block size supported by HEVC luminance component intra prediction is 4×4.
[0097] When predicting the pixel prediction value of a prediction block, the original pixel values of its adjacent prediction blocks are needed. Therefore, when there are multiple division levels in any pixel block, the pixel value prediction can be started from the lowest level in the division level, and then the first pixel prediction value of the prediction block of each level can be predicted one by one from the lowest to the highest. The process of determining the first pixel prediction value of each prediction block in a 64×64 pixel block is as follows: Figure 9 shown.
[0098] When this step is implemented in actual hardware, since the original pixel value of each pixel in any pixel block is known, this step is predicted based on the original pixel value, and there is no need to wait for the reference value of the pixel to be determined. Therefore, the prediction process of the pixel prediction values of prediction blocks at different levels can be executed in parallel to shorten the prediction time.
[0099] In the method provided in the above embodiment, the process of determining the first pixel prediction value of the prediction block is serially controlled according to the division level of the prediction block, which can reduce the amount of computer calculation; and when parallel control is performed, the prediction time can be effectively shortened.
[0100] In one embodiment, Figure 10 As shown, according to the first pixel prediction value of each prediction block, a reference intra prediction mode corresponding to each prediction block is determined from the first intra prediction mode set, including:
[0101] Step 1002: Calculate the encoding quality index corresponding to each prediction block in each first intra prediction mode based on the original pixel value of each prediction block and the first pixel prediction value corresponding to each prediction block in each first intra prediction mode.
[0102] Step 1004 : Using the first intra-frame prediction mode corresponding to the minimum coding quality indicator as the reference intra-frame prediction mode corresponding to each prediction block.
[0103] The coding quality index is used to measure the quality of the prediction block after encoding based on the pixel prediction value. It is usually related to the difference between the pixel prediction value and the original pixel value of the prediction block. The smaller the value of the coding quality index, the closer the predicted value is to the original value, which means that the distortion of the encoded image after decoding is less. In each first intra-frame prediction mode, the prediction block corresponds to a coding result. Therefore, a coding quality index value is calculated for each intra-frame prediction mode. After determining the values of the coding quality index corresponding to all intra-frame prediction modes, the first intra-frame prediction mode corresponding to the minimum value is used as the reference intra-frame prediction mode for each prediction block.
[0104] In the method provided in the above embodiment, the difference between the encoded prediction block and the original prediction block is measured by calculating the encoding quality index, and the reference intra-frame prediction mode can be quickly determined according to the encoding quality index.
[0105] In one embodiment, the coding quality indicator includes a prediction distortion cost, and the coding quality indicator corresponding to each prediction block in each first intra prediction mode is calculated based on the original pixel value of each prediction block and the first pixel prediction value corresponding to each prediction block in each first intra prediction mode, including:
[0106] Determining a pixel reference value corresponding to each prediction block in each first intra prediction mode according to a first pixel prediction value corresponding to each prediction block in each first intra prediction mode;
[0107] Calculating a difference between an original pixel value of each prediction block and a corresponding pixel reference value of each prediction block in each first intra prediction mode, and determining a sum and variance of the corresponding pixel prediction values of each prediction block in each first intra prediction mode according to the difference;
[0108] The prediction distortion cost corresponding to each prediction block in each first intra prediction mode is calculated according to the sum and variance.
[0109] The prediction distortion cost is used to measure the degree of distortion between the pixel reference value and the original pixel value of the prediction block. It can be understood that the original pixel value of the prediction block is the input pixel value that has not been video-encoded, while the pixel reference value of the prediction block is the pixel value obtained by decoding the prediction block after video encoding, and the pixel reference value is related to the pixel prediction value, or the intra-frame prediction mode. Therefore, the prediction distortion cost of the intra-frame prediction mode is determined by the difference between the pixel reference value and the original pixel value. It should be noted that the prediction block will have a prediction distortion cost in each first intra-frame prediction mode.
[0110] Specifically, in one embodiment, the calculation formula of the prediction distortion cost RD_Cost corresponding to the prediction block in any intra prediction mode is:
[0111] ;
[0112] ;
[0113] in, The number represents the number of coded bits after quantization of the prediction residual corresponding to any intra prediction mode; It is a constant whose size is related to the quantization parameter qp; is the pixel reference value of the pixel in the prediction block, is the original pixel value of the pixel in the prediction block, and N is the total number of pixels in the prediction block.
[0114] In the method provided in the above embodiment, the calculation of the prediction distortion cost takes into account the number of coding bits of the coefficients after the quantization of the encoded prediction residual transformation. Therefore, the screening of the intra-frame prediction mode by the prediction distortion cost will take into account the impact of the bit rate; and there is a certain correlation between the sum variance SSE in the prediction distortion cost and the peak signal-to-noise ratio. Therefore, it is possible to comprehensively consider the impact of the peak signal-to-noise ratio and the bit rate.
[0115] In one embodiment, predicting a second pixel prediction value of each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block includes:
[0116] Based on the division level of the prediction blocks within any pixel block, the second pixel prediction value of each level prediction block is predicted upward one by one according to the intra-frame prediction mode in the second intra-frame prediction mode set and the pixel reference value of the adjacent prediction block of the lowest-level prediction block, and the pixel reference value of each prediction block is determined according to the second pixel prediction value and the original pixel value of each prediction block.
[0117] Similarly, when determining an intra prediction mode in a second intra prediction mode set, the second pixel prediction value of the prediction block is determined based on the pixel reference values of the neighboring prediction blocks of the prediction block. The second pixel prediction value determination is also completed from the lowest level in the division hierarchy upwards one by one. Specifically, from arrive , and then , and finally to L×L.
[0118] It should be noted that, in this embodiment, after determining the second pixel prediction value of the prediction block, it is also necessary to determine the pixel reference value of the prediction block to determine the second pixel prediction value of other prediction blocks. Specifically, when determining the pixel reference value of the prediction block, the pixel reference values of all pixels in the prediction block can be determined, or the pixel reference values of some pixels in the prediction block can be determined. The determination of some pixels is related to the method for determining adjacent prediction blocks. For example, if the adjacent prediction blocks of a certain prediction block are the prediction blocks to the left and above the prediction block, it means that the pixel reference values of the rightmost column of pixels in the left adjacent prediction block and the pixel reference values of the bottom row of pixels in the upper adjacent prediction block are needed. In the predictive coding of a pixel block, the pixel reference values of each prediction block determined can be at the same position or at different positions. This is not specifically limited in the embodiments of the present application. However, in general, the method for determining the adjacent prediction blocks of all prediction blocks is set to be the same, and accordingly, the positions of the pixels selected to determine the pixel reference values in the prediction blocks are consistent.
[0119] In one embodiment, the pixel reference values of a column of pixels at the right boundary and a row of pixels at the bottom boundary of each prediction block are set. The process of determining the second pixel prediction value of each prediction block in a 64×64 pixel block is as follows: Figure 11 It should be noted that Figure 11The following is a serial execution flow chart of the Fine INP within each L×L pixel block. In hardware implementation, the Fine INPs of each prediction block in the L×L pixel block can be performed in parallel. Assuming L is 32, the Fine INPs of the 32×32 prediction block, 16×16 prediction block, and 8×8 prediction block in the 32×32 pixel block can be performed in parallel.
[0120] In the method provided in the above embodiment, the process of determining the second pixel prediction value of the prediction block is serially controlled according to the division level of the prediction block, which can reduce the amount of computer calculation; and when parallel control is performed, the prediction time can be effectively shortened.
[0121] In one embodiment, based on the division level of the prediction block within any pixel block, the second pixel prediction value of each level prediction block is predicted upward one by one according to the intra prediction mode in the second intra prediction mode set and the pixel reference value of the neighboring prediction block of the lowest level prediction block, and the pixel reference value of each prediction block is determined according to the second pixel prediction value and the original pixel value of each prediction block, including:
[0122] For any two adjacent partitioning levels in the partitioning levels of the prediction block within any pixel block, including a first partitioning level with a relatively low level and a second partitioning level with a relatively high level;
[0123] determining a second pixel prediction value for each first-level prediction block based on the intra prediction modes in the second intra prediction mode set and the pixel reference values of the neighboring first-level prediction blocks of each first-level prediction block, and determining a pixel reference value for a pixel at a predetermined position within each first-level prediction block based on the pixel prediction value of each first-level prediction block;
[0124] Determine the adjacent second-level prediction blocks of each second-level prediction block, and when the pixel reference values of the pixels at preset positions in the four first-level prediction blocks included in the adjacent second-level prediction blocks are all determined, determine the second pixel prediction value of each second-level prediction block according to the intra prediction mode in the second intra prediction mode set and the pixel reference values of the pixels at preset positions in the adjacent second-level prediction blocks, and determine the pixel reference values of the pixels at preset positions in each second-level prediction block based on the second pixel prediction value of each second-level prediction block.
[0125] It should be noted that in the method steps provided in this embodiment, prediction is performed step by step from the lowest level with the smallest size upwards according to the size of the prediction block, and all prediction blocks in each divided level are predicted and encoded one by one according to the order of the prediction blocks.
[0126] For example, when the size of any pixel block is 32×32, its prediction block division levels include 8×8 prediction blocks, 16×16 prediction blocks, and 32×32 prediction blocks. Among them, the 8×8 prediction block is the prediction block with the lowest division level. Then, the 8×8 prediction block and the 16×16 prediction block are two adjacent division levels, and the 16×16 prediction block and the 32×32 prediction block are two adjacent division levels. When predicting the 32×32 pixel block, prediction coding is first performed from the 8×8 prediction block to the 16×16 prediction block, and then from the 16×16 prediction block to the 32×32 prediction block. The second pixel prediction value and the pixel reference value are determined for every two adjacent division levels according to the method provided in this embodiment.
[0127] Specifically, all 8×8 prediction blocks are predictively coded one by one according to the order of the prediction blocks. All 16×16 prediction blocks are also predictively coded one by one according to the order of the prediction blocks, and the 32×32 prediction blocks are also predictively coded. That is, although the coding result of the 16×16 prediction block is theoretically determined after all four 8×8 prediction blocks in the 16×16 prediction block have completed predictive coding, in this embodiment, the coding quality index of the 16×16 prediction block after predictive coding is compared with the sum of the coding quality indexes of the four 8×8 prediction blocks it includes to determine the minimum coding quality index achievable in the intra-frame prediction mode and the corresponding predictive coding method. For another example, when the size of any pixel block is 64×64, it is determined that the pixel block includes an 8×8 prediction block, a 16×16 prediction block, a 32×32 prediction block, and a 64×64 prediction block. In this case, predictive coding can be performed step by step from the 8×8 prediction block, to the 16×16 prediction block, to the 32×32 prediction block, and finally to the 64×64 prediction block. Among them, the process from 8×8 prediction block to 16×16 prediction block and then to 32×32 prediction block is performed by defining N in this embodiment as 1, and the process from 16×16 prediction block to 32×32 prediction block and then to 64×64 prediction block is performed by defining N in this embodiment as 2.
[0128] In the method provided in the above embodiment, the process of determining the prediction of the higher-level prediction block based on the four lower-level prediction blocks and the process of predictive encoding based on the higher-level prediction block itself are performed simultaneously, which can determine the optimal prediction method under the same intra-frame prediction mode, thereby improving the accuracy of selecting the intra-frame prediction mode.
[0129] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0130] Based on the same inventive concept, embodiments of the present application further provide an intra-frame prediction mode selection device for implementing the aforementioned intra-frame prediction mode selection method. The implementation solution provided by this device is similar to the implementation solution described in the aforementioned method. Therefore, the specific limitations in one or more embodiments of the intra-frame prediction mode selection device provided below can be found in the above-mentioned limitations of the intra-frame prediction mode selection method and will not be further elaborated here.
[0131] In one embodiment, Figure 12 As shown, an intra-frame prediction mode selection device is provided, comprising: a first prediction module 1201, a first selection module 1202, a second prediction module 1203, and a second selection module 1204, wherein:
[0132] A first prediction module 1201 is configured to predict, for any pixel block in a target frame image, a first pixel prediction value of each prediction block based on an intra prediction mode in a first intra prediction mode set and pixel original values of adjacent prediction blocks of each prediction block in any pixel block;
[0133] A first selection module 1202 is configured to determine a reference intra prediction mode corresponding to each prediction block from a first intra prediction mode set according to a first pixel prediction value of each prediction block;
[0134] a second prediction module 1203 configured to predict a second pixel prediction value of each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block, wherein the pixel reference value of each prediction block is determined based on the original pixel value and the second pixel prediction value, and the second intra prediction mode set includes a reference intra prediction mode;
[0135] The second selection module 1204 is configured to determine a target intra prediction mode corresponding to each prediction block from the second intra prediction mode set according to the second pixel prediction value of each prediction block.
[0136] In one embodiment, the first prediction module 1201 is further configured to:
[0137] Based on the division level of the prediction block within any pixel block, the first pixel prediction value of each level prediction block is predicted upward one by one according to the intra prediction mode in the first intra prediction mode set and the pixel original values of the adjacent prediction blocks of the lowest level prediction block.
[0138] In one embodiment, the first selection module 1202 is further configured to:
[0139] Calculating a coding quality indicator corresponding to each prediction block in each first intra prediction mode according to the original pixel value of each prediction block and the first pixel prediction value corresponding to each prediction block in each first intra prediction mode;
[0140] The first intra-frame prediction mode corresponding to the minimum encoding quality indicator is used as the reference intra-frame prediction mode corresponding to each prediction block.
[0141] In one embodiment, the first selection module 1202 is further configured to:
[0142] Determining a pixel reference value corresponding to each prediction block in each first intra prediction mode according to a first pixel prediction value corresponding to each prediction block in each first intra prediction mode;
[0143] Calculating a difference between an original pixel value of each prediction block and a corresponding pixel reference value of each prediction block in each first intra prediction mode, and determining a sum and variance of the corresponding pixel prediction values of each prediction block in each first intra prediction mode according to the difference;
[0144] The prediction distortion cost corresponding to each prediction block in each first intra prediction mode is calculated according to the sum and variance.
[0145] In one embodiment, the second prediction module 1203 is further configured to:
[0146] Based on the division level of the prediction blocks within any pixel block, the second pixel prediction value of each level prediction block is predicted upward one by one according to the intra-frame prediction mode in the second intra-frame prediction mode set and the pixel reference value of the adjacent prediction block of the lowest-level prediction block, and the pixel reference value of each prediction block is determined according to the second pixel prediction value and the original pixel value of each prediction block.
[0147] In one embodiment, the second prediction module 1203 is further configured to:
[0148] For any two adjacent partitioning levels in the partitioning levels of the prediction block within any pixel block, including a first partitioning level with a relatively low level and a second partitioning level with a relatively high level;
[0149] determining a second pixel prediction value for each first-level prediction block based on the intra prediction modes in the second intra prediction mode set and the pixel reference values of the neighboring first-level prediction blocks of each first-level prediction block, and determining a pixel reference value for a pixel at a predetermined position within each first-level prediction block based on the pixel prediction value of each first-level prediction block;
[0150] Determine the adjacent second-level prediction blocks of each second-level prediction block, and when the pixel reference values of the pixels at preset positions in the four first-level prediction blocks included in the adjacent second-level prediction blocks are all determined, determine the second pixel prediction value of each second-level prediction block according to the intra prediction mode in the second intra prediction mode set and the pixel reference values of the pixels at preset positions in the adjacent second-level prediction blocks, and determine the pixel reference values of the pixels at preset positions in each second-level prediction block based on the second pixel prediction value of each second-level prediction block.
[0151] Each module in the above-mentioned intra-frame prediction mode selection device can be implemented in whole or in part through software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0152] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 13 As shown. The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store encoded data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, it implements a method for selecting an intra-frame prediction mode.
[0153] Those skilled in the art will understand that Figure 13 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0154] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0155] For any pixel block in the target frame image, predict a first pixel prediction value of each prediction block based on the intra prediction mode in the first intra prediction mode set and the pixel original values of the adjacent prediction blocks of each prediction block in any pixel block;
[0156] Determining, according to the first pixel prediction value of each prediction block, a reference intra prediction mode corresponding to each prediction block from a first intra prediction mode set;
[0157] predicting a second pixel prediction value of each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block, wherein the pixel reference value of each prediction block is determined according to the original pixel value and the second pixel prediction value, and the second intra prediction mode set includes a reference intra prediction mode;
[0158] A target intra prediction mode corresponding to each prediction block is determined from a second intra prediction mode set according to the second pixel prediction value of each prediction block.
[0159] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0160] Based on the division level of the prediction block within any pixel block, the first pixel prediction value of each level prediction block is predicted upward one by one according to the intra prediction mode in the first intra prediction mode set and the pixel original values of the adjacent prediction blocks of the lowest level prediction block.
[0161] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0162] Calculating a coding quality indicator corresponding to each prediction block in each first intra prediction mode according to the original pixel value of each prediction block and the first pixel prediction value corresponding to each prediction block in each first intra prediction mode;
[0163] The first intra-frame prediction mode corresponding to the minimum encoding quality indicator is used as the reference intra-frame prediction mode corresponding to each prediction block.
[0164] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0165] Determining a pixel reference value corresponding to each prediction block in each first intra prediction mode according to a first pixel prediction value corresponding to each prediction block in each first intra prediction mode;
[0166] Calculating a difference between an original pixel value of each prediction block and a corresponding pixel reference value of each prediction block in each first intra prediction mode, and determining a sum and variance of the corresponding pixel prediction values of each prediction block in each first intra prediction mode according to the difference;
[0167] The prediction distortion cost corresponding to each prediction block in each first intra prediction mode is calculated according to the sum and variance.
[0168] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0169] Based on the division level of the prediction blocks within any pixel block, the second pixel prediction value of each level prediction block is predicted upward one by one according to the intra-frame prediction mode in the second intra-frame prediction mode set and the pixel reference value of the adjacent prediction block of the lowest-level prediction block, and the pixel reference value of each prediction block is determined according to the second pixel prediction value and the original pixel value of each prediction block.
[0170] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0171] For any two adjacent partitioning levels in the partitioning levels of the prediction block within any pixel block, including a first partitioning level with a relatively low level and a second partitioning level with a relatively high level;
[0172] determining a second pixel prediction value for each first-level prediction block based on the intra prediction modes in the second intra prediction mode set and the pixel reference values of the neighboring first-level prediction blocks of each first-level prediction block, and determining a pixel reference value for a pixel at a predetermined position within each first-level prediction block based on the pixel prediction value of each first-level prediction block;
[0173] Determine the adjacent second-level prediction blocks of each second-level prediction block, and when the pixel reference values of the pixels at preset positions in the four first-level prediction blocks included in the adjacent second-level prediction blocks are all determined, determine the second pixel prediction value of each second-level prediction block according to the intra prediction mode in the second intra prediction mode set and the pixel reference values of the pixels at preset positions in the adjacent second-level prediction blocks, and determine the pixel reference values of the pixels at preset positions in each second-level prediction block based on the second pixel prediction value of each second-level prediction block.
[0174] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0175] For any pixel block in the target frame image, predict a first pixel prediction value of each prediction block based on the intra prediction mode in the first intra prediction mode set and the original pixel values of the neighboring prediction blocks of each prediction block in any pixel block;
[0176] Determining, according to the first pixel prediction value of each prediction block, a reference intra prediction mode corresponding to each prediction block from a first intra prediction mode set;
[0177] predicting a second pixel prediction value of each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block, wherein the pixel reference value of each prediction block is determined according to the original pixel value and the second pixel prediction value, and the second intra prediction mode set includes a reference intra prediction mode;
[0178] According to the second pixel prediction value of each prediction block, a target intra prediction mode corresponding to each prediction block is determined from the second intra prediction mode set.
[0179] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0180] Based on the division level of the prediction block within any pixel block, the first pixel prediction value of each level prediction block is predicted upward one by one according to the intra prediction mode in the first intra prediction mode set and the pixel original values of the adjacent prediction blocks of the lowest level prediction block.
[0181] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0182] Calculating a coding quality indicator corresponding to each prediction block in each first intra prediction mode according to the original pixel value of each prediction block and the first pixel prediction value corresponding to each prediction block in each first intra prediction mode;
[0183] The first intra-frame prediction mode corresponding to the minimum encoding quality indicator is used as the reference intra-frame prediction mode corresponding to each prediction block.
[0184] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0185] Determining a pixel reference value corresponding to each prediction block in each first intra prediction mode according to a first pixel prediction value corresponding to each prediction block in each first intra prediction mode;
[0186] Calculating a difference between an original pixel value of each prediction block and a corresponding pixel reference value of each prediction block in each first intra prediction mode, and determining a sum and variance of the corresponding pixel prediction values of each prediction block in each first intra prediction mode according to the difference;
[0187] The prediction distortion cost corresponding to each prediction block in each first intra prediction mode is calculated according to the sum and variance.
[0188] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0189] Based on the division level of the prediction blocks within any pixel block, the second pixel prediction value of each level prediction block is predicted upward one by one according to the intra-frame prediction mode in the second intra-frame prediction mode set and the pixel reference value of the adjacent prediction block of the lowest-level prediction block, and the pixel reference value of each prediction block is determined according to the second pixel prediction value and the original pixel value of each prediction block.
[0190] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0191] For any two adjacent partitioning levels in the partitioning levels of the prediction block within any pixel block, including a first partitioning level with a relatively low level and a second partitioning level with a relatively high level;
[0192] determining a second pixel prediction value for each first-level prediction block based on the intra prediction modes in the second intra prediction mode set and the pixel reference values of the neighboring first-level prediction blocks of each first-level prediction block, and determining a pixel reference value for a pixel at a predetermined position within each first-level prediction block based on the pixel prediction value of each first-level prediction block;
[0193] Determine the adjacent second-level prediction blocks of each second-level prediction block, and when the pixel reference values of the pixels at preset positions in the four first-level prediction blocks included in the adjacent second-level prediction blocks are all determined, determine the second pixel prediction value of each second-level prediction block according to the intra prediction mode in the second intra prediction mode set and the pixel reference values of the pixels at preset positions in the adjacent second-level prediction blocks, and determine the pixel reference values of the pixels at preset positions in each second-level prediction block based on the second pixel prediction value of each second-level prediction block.
[0194] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0195] For any pixel block in the target frame image, predict a first pixel prediction value of each prediction block based on the intra prediction mode in the first intra prediction mode set and the original pixel values of the neighboring prediction blocks of each prediction block in any pixel block;
[0196] Determining, according to the first pixel prediction value of each prediction block, a reference intra prediction mode corresponding to each prediction block from a first intra prediction mode set;
[0197] predicting a second pixel prediction value of each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block, wherein the pixel reference value of each prediction block is determined according to the original pixel value and the second pixel prediction value, and the second intra prediction mode set includes a reference intra prediction mode;
[0198] A target intra prediction mode corresponding to each prediction block is determined from a second intra prediction mode set according to the second pixel prediction value of each prediction block.
[0199] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0200] Based on the division level of the prediction block within any pixel block, the first pixel prediction value of each level prediction block is predicted upward one by one according to the intra prediction mode in the first intra prediction mode set and the pixel original values of the adjacent prediction blocks of the lowest level prediction block.
[0201] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0202] Calculating a coding quality indicator corresponding to each prediction block in each first intra prediction mode according to the original pixel value of each prediction block and the first pixel prediction value corresponding to each prediction block in each first intra prediction mode;
[0203] The first intra-frame prediction mode corresponding to the minimum encoding quality indicator is used as the reference intra-frame prediction mode corresponding to each prediction block.
[0204] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0205] Determining a pixel reference value corresponding to each prediction block in each first intra prediction mode according to a first pixel prediction value corresponding to each prediction block in each first intra prediction mode;
[0206] Calculating a difference between an original pixel value of each prediction block and a corresponding pixel reference value of each prediction block in each first intra prediction mode, and determining a sum and variance of the corresponding pixel prediction values of each prediction block in each first intra prediction mode according to the difference;
[0207] The prediction distortion cost corresponding to each prediction block in each first intra prediction mode is calculated according to the sum and variance.
[0208] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0209] Based on the division level of the prediction blocks within any pixel block, the second pixel prediction value of each level prediction block is predicted upward one by one according to the intra-frame prediction mode in the second intra-frame prediction mode set and the pixel reference value of the adjacent prediction block of the lowest-level prediction block, and the pixel reference value of each prediction block is determined according to the second pixel prediction value and the original pixel value of each prediction block.
[0210] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0211] For any two adjacent partitioning levels in the partitioning levels of the prediction block within any pixel block, including a first partitioning level with a relatively low level and a second partitioning level with a relatively high level;
[0212] determining a second pixel prediction value for each first-level prediction block based on the intra prediction modes in the second intra prediction mode set and the pixel reference values of the neighboring first-level prediction blocks of each first-level prediction block, and determining a pixel reference value for a pixel at a predetermined position within each first-level prediction block based on the pixel prediction value of each first-level prediction block;
[0213] Determine the adjacent second-level prediction blocks of each second-level prediction block, and when the pixel reference values of the pixels at preset positions in the four first-level prediction blocks included in the adjacent second-level prediction blocks are all determined, determine the second pixel prediction value of each second-level prediction block according to the intra prediction mode in the second intra prediction mode set and the pixel reference values of the pixels at preset positions in the adjacent second-level prediction blocks, and determine the pixel reference values of the pixels at preset positions in each second-level prediction block based on the second pixel prediction value of each second-level prediction block.
[0214] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), data processing logic devices based on quantum computing, and the like.
[0215] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0216] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A method for selecting an intra-frame prediction mode, characterized in that: The method comprises: For any pixel block in the target frame image, predict a first pixel prediction value of each prediction block based on an intra prediction mode in a first intra prediction mode set and pixel original values of neighboring prediction blocks of each prediction block in the any pixel block; the neighboring prediction blocks include two prediction blocks among all prediction blocks having pixel adjacent to the prediction block; the first pixel prediction value is determined by pixel original values of pixels adjacent to the prediction block in the two prediction blocks adjacent to the prediction block; Determining a pixel reference value corresponding to each prediction block in each first intra prediction mode according to a first pixel prediction value corresponding to each prediction block in each first intra prediction mode; Calculating a difference between an original pixel value of each prediction block and a corresponding pixel reference value of each prediction block in each first intra prediction mode, and determining a sum and variance of the corresponding pixel prediction values of each prediction block in each first intra prediction mode according to the difference; Calculating the prediction distortion cost corresponding to each prediction block in each first intra prediction mode according to the sum variance; The first intra-frame prediction mode corresponding to the minimum prediction distortion cost is used as the reference intra-frame prediction mode corresponding to each prediction block; predicting a second pixel prediction value of each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block, wherein the second intra prediction mode set includes the reference intra prediction mode; and the number of intra prediction modes in the second intra prediction mode set is less than the number of intra prediction modes in the first intra prediction mode set; determining, according to the second pixel prediction value of each prediction block, a target intra prediction mode corresponding to each prediction block from the second intra prediction mode set; The process of determining the pixel reference value of each prediction block includes: quantizing and entropy coding the difference between the second pixel prediction value and the original pixel value to obtain a coding result of the prediction block; The sum of a result obtained by entropy decoding and inverse quantization of the encoding result and the second pixel prediction value is used as a pixel reference value of the prediction block.
2. The method according to claim 1, characterized in that The predicting a first pixel prediction value of each prediction block based on the intra prediction mode in the first intra prediction mode set and the original pixel values of the neighboring prediction blocks of each prediction block in any one of the pixel blocks includes: Based on the division level of the prediction block within any pixel block, the first pixel prediction value of each level prediction block is predicted upward one by one according to the intra-frame prediction mode in the first intra-frame prediction mode set and the pixel original value of the adjacent prediction block of the lowest-level prediction block.
3. The method according to claim 1, characterized in that The predicting the second pixel prediction value of each prediction block based on the intra prediction mode in the second intra prediction mode set and the pixel reference value of the neighboring prediction block of each prediction block includes: Based on the division level of the prediction blocks within any pixel block, the second pixel prediction value of each level prediction block is predicted upward one by one according to the intra-frame prediction mode in the second intra-frame prediction mode set and the pixel reference value of the adjacent prediction block of the lowest-level prediction block, and the pixel reference value of each prediction block is determined according to the second pixel prediction value and the pixel original value of each prediction block.
4. The method according to claim 3, characterized in that The step of upwardly predicting the second pixel prediction value of each prediction block in each level based on the division level of the prediction block within any pixel block according to the intra prediction mode in the second intra prediction mode set and the pixel reference value of the neighboring prediction block of the lowest level prediction block, and determining the pixel reference value of each prediction block according to the second pixel prediction value and the original pixel value of each prediction block includes: For any two adjacent division levels in the division levels of the prediction block within any pixel block, the division levels include a first division level with a relatively low level and a second division level with a relatively high level; determining a second pixel prediction value for each first-level prediction block based on the intra prediction modes in the second intra prediction mode set and the pixel reference values of the neighboring first-level prediction blocks of each first-level prediction block, and determining a pixel reference value for a pixel at a predetermined position within each first-level prediction block based on the pixel prediction value of each first-level prediction block; Determine the adjacent second-level prediction blocks of each second-level prediction block, and when the pixel reference values of the pixels at preset positions in the four first-level prediction blocks included in the adjacent second-level prediction blocks are all determined, determine the second pixel prediction value of each second-level prediction block according to the intra-frame prediction mode in the second intra-frame prediction mode set and the pixel reference values of the pixels at preset positions in the adjacent second-level prediction blocks, and determine the pixel reference values of the pixels at preset positions in each second-level prediction block according to the second pixel prediction value of each second-level prediction block.
5. An intra-frame prediction mode selection device, characterized in that: The device comprises: a first prediction module configured to predict, for any pixel block in a target frame image, a first pixel prediction value of each prediction block based on an intra-frame prediction mode in a first intra-frame prediction mode set and pixel original values of neighboring prediction blocks of each prediction block in the pixel block; the neighboring prediction blocks include two prediction blocks among all prediction blocks having pixel adjacent to the prediction block; the first pixel prediction value is determined by pixel original values of pixels adjacent to the prediction block in the two prediction blocks adjacent to the prediction block; A first selection module is configured to determine a pixel reference value corresponding to each prediction block in each first intra-frame prediction mode according to a first pixel prediction value corresponding to each prediction block in each first intra-frame prediction mode; Calculating the difference between the original pixel value of each prediction block and the pixel reference value corresponding to each prediction block in each first intra-frame prediction mode, determining the sum and variance of the pixel prediction values corresponding to each prediction block in each first intra-frame prediction mode based on the difference; calculating the prediction distortion cost corresponding to each prediction block in each first intra-frame prediction mode based on the sum and variance; and using the first intra-frame prediction mode corresponding to the minimum prediction distortion cost as the reference intra-frame prediction mode corresponding to each prediction block; a second prediction module, configured to predict a second pixel prediction value of each prediction block based on an intra prediction mode in a second intra prediction mode set and pixel reference values of neighboring prediction blocks of each prediction block; wherein the second intra prediction mode set includes the reference intra prediction mode; and the number of intra prediction modes in the second intra prediction mode set is smaller than the number of intra prediction modes in the first intra prediction mode set; The second selection module is used to determine the target intra-frame prediction mode corresponding to each prediction block from the second intra-frame prediction mode set based on the second pixel prediction value of each prediction block; wherein the process of determining the pixel reference value of each prediction block includes: quantizing and entropy encoding the difference between the second pixel prediction value and the original pixel value to obtain the encoding result of the prediction block; and performing entropy decoding and inverse quantization on the encoding result and the sum of the result and the second pixel prediction value as the pixel reference value of the prediction block.
6. The device according to claim 5, characterized in that The first prediction module is also used to predict the first pixel prediction value of each level prediction block one by one based on the division level of the prediction block within any pixel block, according to the intra-frame prediction mode in the first intra-frame prediction mode set and the pixel original value of the adjacent prediction block of the lowest-level prediction block.
7. The device according to claim 5, characterized in that The second prediction module is also used to predict the second pixel prediction value of each level prediction block one by one based on the division level of the prediction block within any pixel block, according to the intra-frame prediction mode in the second intra-frame prediction mode set and the pixel reference value of the adjacent prediction block of the lowest-level prediction block, and determine the pixel reference value of each prediction block based on the second pixel prediction value and the original pixel value of each prediction block.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Selection method and device of rate distortion coding mode and coding method and system
CN116033162A
Intra prediction method, image encoding method, image decoding method, and apparatus
CN116156180A