A method, device and medium for fast selection of HEVC intra prediction mode

CN116781898BActive Publication Date: 2026-09-18SICHUAN HONGMEI INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310407687.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-17
Publication Date
2026-09-18
Estimated Expiration
2043-04-17

AI Technical Summary

Technical Problem

但是,目前的预测模式数量较多,编码时间较长,编码复杂度的急剧增加

Benefits of technology

[0014] The HEVC intra-prediction mode fast selection method, apparatus and medium provided in this embodiment of the invention utilize the spatial correlation between adjacent prediction units to skip the complex selection process, and quickly determine the optimal prediction mode of the prediction unit by calculating the structural similarity index of adjacent prediction units, thereby reducing the complexity of intra-frame coding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116781898B_ABST
    Figure CN116781898B_ABST
Patent Text Reader

Abstract

The application provides a HEVC intra prediction mode fast selection method, device and medium, wherein the HEVC intra prediction mode fast selection method comprises the following steps: obtaining the size of a prediction unit; when the size of the prediction unit is less than or equal to a preset size, calculating the structural similarity index of a neighboring prediction unit of the prediction unit; when the structural similarity index is greater than a preset threshold, adding the prediction mode corresponding to the structural similarity index greater than the preset threshold to a set; and determining an optimal prediction mode according to the prediction modes in the set and the minimum rate-distortion cost principle. The scheme provided by the application can reduce the encoding time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of video coding technology, and in particular to a fast selection method, apparatus and medium for HEVC intra-frame prediction modes. Background Technology

[0002] As high-definition and ultra-high-definition video applications gradually become part of people's lives, the increasing sophistication of video applications poses a significant challenge to existing video coding technologies. To address this, High Efficiency Video Coding (HEVC), the next-generation video coding technology, has been officially released. In the HEVC standard, the intra-prediction mode selection process combines Rough Mode Decision (RMD) and Rate-Distortion Optimization (RDO) to select the optimal intra-prediction mode. However, the current method involves a large number of prediction modes, resulting in longer coding times and a sharp increase in coding complexity. Summary of the Invention

[0003] This invention provides a method, apparatus, and medium for fast selection of HEVC intra-prediction mode, which can reduce coding time.

[0004] According to one aspect of the present invention, an embodiment of the present invention provides a fast selection method for HEVC intra-frame prediction modes, comprising: obtaining the size of a prediction unit; when the size of the prediction unit is less than or equal to a preset size, calculating a structural similarity index between the prediction unit and adjacent prediction units; when the structural similarity index is greater than a preset threshold, adding the prediction modes corresponding to the structural similarity indices greater than the preset threshold to a set; and determining the optimal prediction mode based on the prediction modes in the set and the principle of minimizing rate-distortion cost.

[0005] In one embodiment, after calculating the structural similarity index between the prediction unit and its neighboring prediction units, the fast selection of HEVC intra-frame prediction modes further includes: when the structural similarity index is less than or equal to the preset threshold, calculating the gradient magnitude value of the prediction unit in a preset direction; obtaining a corresponding preset set of prediction modes based on the gradient magnitude value; arranging the prediction modes in the set of prediction modes in ascending order of cost value; selecting a corresponding number of prediction modes as candidate modes based on the size of the prediction unit; wherein, determining the optimal prediction mode based on the prediction modes in the set and the principle of minimizing rate-distortion cost value includes: determining the optimal prediction mode based on the candidate modes and the principle of minimizing rate-distortion cost value.

[0006] In one embodiment, before determining the optimal prediction mode based on the prediction modes in the set and the principle of minimizing rate-distortion cost, the fast selection of HEVC intra-frame prediction modes further includes: when the size of the prediction unit is larger than the preset size, calculating the gradient magnitude value of the prediction unit in a preset direction; obtaining a corresponding preset prediction mode set based on the gradient magnitude value; arranging the prediction modes in the prediction mode set in ascending order of cost; and selecting a corresponding number of prediction modes as candidate modes based on the size of the prediction unit; wherein, determining the optimal prediction mode based on the prediction modes in the set and the principle of minimizing rate-distortion cost includes: determining the optimal prediction mode based on the candidate modes and the principle of minimizing rate-distortion cost.

[0007] In one embodiment, the preset direction includes: a vertical direction, a horizontal direction, a π / 4 direction, a 3π / 4 direction, a vertical right π / 8 direction, a vertical left π / 8 direction, a horizontal upward π / 8 direction, and a horizontal downward π / 8 direction; wherein, when the size of the prediction unit is larger than the preset size, calculating the gradient magnitude value of the prediction unit in the preset direction includes: when the size of the prediction unit is larger than the preset size, calculating eight gradient magnitude values ​​of the prediction unit in the vertical direction, horizontal direction, π / 4 direction, 3π / 4 direction, vertical right π / 8 direction, vertical left π / 8 direction, horizontal upward π / 8 direction, and horizontal downward π / 8 direction.

[0008] In one embodiment, obtaining a corresponding preset prediction mode set based on the gradient magnitude value includes: comparing multiple gradient magnitude values ​​with preset parameters to obtain the prediction mode set corresponding to gradient magnitude values ​​that are less than the preset parameters; wherein, the prediction mode includes 33 angle prediction modes, and the prediction mode set includes multiple sets of the 33 angle prediction modes divided according to the vertical direction, horizontal direction, π / 4 direction, 3π / 4 direction, vertically to the right π / 8 direction, vertically to the left π / 8 direction, horizontally upward π / 8 direction, and horizontally downward π / 8 direction.

[0009] In one embodiment, the preset parameter is positively correlated with the sum of the gradient magnitude values, and the preset parameter is negatively correlated with the number of gradient magnitude values; wherein, the sum of gradient magnitude values ​​includes the sum of the gradient values ​​of the prediction unit in each preset direction, and the number of gradient magnitude values ​​includes the sum of the number of gradient values ​​of the prediction unit in each preset direction.

[0010] In one embodiment, determining the optimal prediction mode based on the candidate modes and the principle of minimizing rate-distortion cost includes: calculating the rate-distortion cost of multiple candidate modes respectively; and selecting the candidate mode with the minimum rate-distortion cost from the multiple candidate modes as the optimal prediction mode.

[0011] In one embodiment, the preset size includes a 4×4 dimension; wherein, when the size of the prediction unit is less than or equal to the preset size, calculating the structural similarity index between the prediction unit and adjacent prediction units includes: when the size of the prediction unit is less than or equal to a 4×4 dimension, calculating the structural similarity index between the prediction unit and a first adjacent prediction unit, the structural similarity index between a second adjacent prediction unit, and the structural similarity index between a third adjacent prediction unit; wherein, the first adjacent prediction unit is located to the left of the prediction unit, the second adjacent prediction unit is located to the upper left of the prediction unit, and the third adjacent prediction unit is located above the prediction unit.

[0012] According to another aspect of the present invention, an embodiment of the present invention provides a fast HEVC intra-frame prediction mode selection device, comprising: an acquisition module for acquiring the size of a prediction unit; a calculation module for calculating a structural similarity index between the prediction unit and adjacent prediction units when the size of the prediction unit is less than or equal to a preset size; an addition module for adding prediction modes corresponding to the structural similarity index greater than a preset threshold to a set when the structural similarity index is greater than a preset threshold; and a determination module for determining the optimal prediction mode based on the prediction modes in the set and the principle of minimizing rate-distortion cost.

[0013] According to another aspect of the present invention, an embodiment of the present invention provides a computer-readable medium storing computer instructions, which, when executed by a processor, cause the processor to perform the HEVC intra-prediction mode fast selection method described in any of the above embodiments.

[0014] The HEVC intra-prediction mode fast selection method, apparatus and medium provided in this embodiment of the invention utilize the spatial correlation between adjacent prediction units to skip the complex selection process, and quickly determine the optimal prediction mode of the prediction unit by calculating the structural similarity index of adjacent prediction units, thereby reducing the complexity of intra-frame coding. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is a flowchart illustrating a fast selection method for HEVC intra-frame prediction modes according to an embodiment of the present invention.

[0017] Figure 2 This is a flowchart illustrating a fast selection method for HEVC intra-frame prediction modes provided in another embodiment of the present invention.

[0018] Figure 3 This is a schematic diagram of the structure of 35 prediction modes for intra-frame prediction provided in one embodiment of the present invention.

[0019] Figure 4 This is a schematic diagram of gradient magnitude calculation of a prediction unit provided in an embodiment of the present invention.

[0020] Figure 5 This is a schematic diagram of the structure of a prediction unit and adjacent prediction units provided in an embodiment of the present invention.

[0021] Figure 6 This is a schematic diagram illustrating the principle of a fast selection method for HEVC intra-frame prediction modes provided in an embodiment of the present invention.

[0022] Figure 7 This is a schematic diagram of a fast selection device for HEVC intra-frame prediction mode provided in an embodiment of the present invention.

[0023] Figure 8 This is a schematic diagram of a fast selection device for HEVC intra-frame prediction mode provided in another embodiment of the present invention. Detailed Implementation

[0024] As high-definition and ultra-high-definition video applications gradually enter people's lives, video apps are also entering the smart refrigerator field, such as large-scale video applications with resolutions of 4K×2K and 8K×4K. The high-definition nature of video applications poses a significant challenge to existing video coding technologies. To address this, the officially released video coding technology—High Efficiency Video Coding (HEVC)—offers nearly double the compression efficiency of its predecessor, H.264 / AVC, while reducing the video coding bitrate by approximately 50% while maintaining video image quality. HEVC employs many new coding techniques, such as a quadtree-based recursive partitioning structure, intra-frame prediction modes at different angles, and sample adaptive compensation. To more flexibly and effectively adapt to video content, HEVC defines coding units (CU), prediction units (PU), and transform units (TU) for video image block partitioning. To more accurately reflect the texture characteristics of high-definition video, HEVC intra-frame coding employs 35 prediction modes, specifically Planar, DC, and 33 angle prediction modes. While adding prediction modes can effectively remove spatial redundancy and achieve better prediction results, it also increases the complexity of the coding. It takes a lot of time to go through all 35 prediction modes one by one.

[0025] Therefore, this invention provides a method, apparatus, and medium for fast selection of HEVC intra-prediction modes. By utilizing the spatial correlation between adjacent prediction units, the complex selection process is skipped. The optimal prediction mode of the prediction unit is quickly determined by calculating the structural similarity index of adjacent prediction units, thereby reducing the complexity of intra-frame coding.

[0026] Figure 1 This is a flowchart illustrating a fast selection method for HEVC intra-frame prediction modes according to an embodiment of the present invention, as shown below. Figure 1 As shown, the fast selection method for HEVC intra-prediction mode includes:

[0027] Step 100: Obtain the size of the prediction cell.

[0028] Fast prediction mode selection methods for HEVC intra-frame prediction include those based on structural similarity indices and those based on gradient magnitude. The appropriate method can be selected based on the size of the prediction unit, thereby reducing coding time and complexity. For example, for a 4×4 prediction unit, the optimal prediction mode can be quickly determined by calculating the structural similarity index between adjacent units, utilizing spatial correlation. For prediction units larger than 4×4 (e.g., 8×8 to 64×64), the gradient magnitude-based method can be used to determine the prediction mode set, reducing the number of prediction modes processed through the Rough Mode Decision (RMD) process and lowering the complexity of intra-frame coding.

[0029] Step 200: When the size of the prediction unit is less than or equal to the preset size, calculate the structural similarity index between the prediction unit and the adjacent prediction units.

[0030] The preset size can be set to 4×4. When the size of the prediction unit is less than or equal to 4×4, a prediction mode set R is defined and initialized. Then, the structural similarity index (SSIM) of the 4×4 prediction unit is calculated between it and its adjacent left, top-left, and top prediction units of 4×4 size. When calculating the intra-prediction unit structural similarity index, each prediction unit can be treated as an image, and its SSIM value with neighboring images is calculated. The higher the structural similarity index between two prediction units, the smaller the error between them, indicating better prediction performance. If the size of the prediction unit is larger than the preset size, a fast intra-prediction mode selection method based on gradient magnitude can be selected.

[0031] Step 300: When the structural similarity index is greater than a preset threshold, add the prediction patterns corresponding to the structural similarity indices that are greater than the preset threshold to the set.

[0032] After obtaining the structural similarity index, a preset threshold can be set by testing different video sequences. If the structural similarity index is greater than the preset threshold, the optimal prediction mode of the prediction unit corresponding to the structural similarity index is added to the set R. If the structural similarity index is less than or equal to the preset threshold, a fast intra-frame prediction mode selection method based on gradient magnitude can be selected.

[0033] Step 400: Determine the optimal prediction model based on the prediction models in the set and the principle of minimizing rate-distortion cost.

[0034] Based on the formula for calculating rate-distortion cost, the cost of prediction patterns in the set R is calculated. The prediction pattern with the minimum cost is selected from the set as the final optimal prediction pattern to be implemented. The prediction pattern with the minimum cost, given the data transmission rate and distortion metric, enables data to be transmitted with minimal distortion, maintaining data quality while maximizing data compression, reducing data transmission costs and storage space requirements.

[0035] The HEVC intra-prediction mode fast selection method provided in this embodiment utilizes the spatial correlation between adjacent prediction units to skip the complex selection process. By calculating the structural similarity index of adjacent prediction units, the optimal prediction mode of the prediction unit is quickly determined, reducing the complexity of intra-frame coding.

[0036] Figure 2 This is a flowchart illustrating a fast selection method for HEVC intra-frame prediction modes according to another embodiment of the present invention, as shown below. Figure 2 As shown, after step 200 above, the fast selection of HEVC intra-prediction mode may further include:

[0037] Step 500: When the structural similarity index is less than or equal to a preset threshold, calculate the gradient magnitude value of the prediction unit in the preset direction.

[0038] When the structural similarity index is less than or equal to a preset threshold, a fast intra-frame prediction mode selection method based on gradient magnitude can be chosen. This involves calculating the gradient magnitude of the prediction unit in preset directions, which can include the gradient magnitude values ​​in the vertical, horizontal, π / 4 (45-degree), 3π / 4 (135-degree), vertically to the right (π / 8), vertically to the left (π / 8), horizontally upward (π / 8), and horizontally downward (π / 8). Calculating gradient magnitude values ​​in multiple directions can more accurately describe the edge directions in the image, which is beneficial for subsequent image processing tasks.

[0039] Step 600: Obtain the corresponding preset prediction mode set based on the gradient magnitude value.

[0040] HEVC intra-frame coding employs 35 prediction modes, specifically Planar, DC, and 33 angular prediction modes. These 33 angular prediction modes are further divided into eight groups based on the following directions: vertical, horizontal, π / 4 (45-degree), 3π / 4 (135-degree), vertically to the right (π / 8), vertically to the left (π / 8), horizontally upward (π / 8), and horizontally downward (π / 8). Each group contains multiple prediction modes. Planar and DC modes are also added to these groups. Each gradient magnitude is compared to the average gradient magnitude. If a gradient magnitude is less than the average, the group containing the smallest gradient magnitude less than the average is selected as the final prediction mode group.

[0041] Step 700: Arrange the prediction patterns in the prediction pattern set in ascending order of their cost value.

[0042] Based on this, the SATD (Sum of Absolute Transformed Difference) cost value of each prediction model in the prediction model set is calculated, and all prediction models in the set are arranged in ascending order of SATD cost value.

[0043] Step 800: Select the corresponding number of prediction modes as candidate modes according to the size of the prediction unit.

[0044] For example, if the prediction unit size is 4×4 and 8×8, the corresponding number of prediction modes is 8; if the PU size is 16×16, 32×32 and 64×64, the corresponding number of prediction modes is 3. The corresponding number of prediction modes are selected as candidate modes for rate-distortion optimization (RDO).

[0045] Step 400 above may include:

[0046] Step 410: Determine the optimal prediction model based on the candidate models and the principle of minimizing rate-distortion cost.

[0047] Based on the formula for calculating rate-distortion cost, the rate-distortion cost of the determined candidate modes is calculated. The prediction mode corresponding to the candidate mode with the lowest cost is selected as the final optimal prediction mode for implementation. The prediction mode with the lowest cost, given the data transmission rate and distortion metric, enables data to be transmitted with minimal distortion, maintaining data quality while maximizing data compression, reducing data transmission costs and storage space requirements.

[0048] Dividing the angular prediction modes of the prediction unit into eight different mode sets and determining the prediction mode set by the gradient magnitude value of the prediction unit can effectively reduce the number of times the Rough Mode Decision (RMD) process is performed, thereby reducing the time required for HEVC intra-frame coding.

[0049] In one embodiment, such as Figure 2 As shown, prior to step 400 above, the fast selection of HEVC intra-prediction mode may further include:

[0050] Step 900: When the size of the prediction unit is larger than the preset size, calculate the gradient magnitude value of the prediction unit in the preset direction.

[0051] If the prediction unit size is larger than 4×4 (e.g., 8×8 to 64×64), a fast intra-prediction mode selection method based on gradient magnitude can be chosen. By dividing the angular prediction modes of the prediction units into eight different mode sets, and determining the prediction mode set based on the gradient magnitude value of the prediction units, the number of times the Rough Mode Decision (RMD) process is performed can be effectively reduced, thus reducing the time required for HEVC intra-frame coding.

[0052] Step 600: Obtain the corresponding preset prediction mode set based on the gradient magnitude value.

[0053] HEVC intra-frame coding employs 35 prediction modes, specifically Planar, DC, and 33 angular prediction modes. These 33 angular prediction modes are further divided into eight groups based on the following directions: vertical, horizontal, π / 4 (45-degree), 3π / 4 (135-degree), vertically to the right (π / 8), vertically to the left (π / 8), horizontally upward (π / 8), and horizontally downward (π / 8). Each group contains multiple prediction modes. Planar and DC modes are also added to these groups. Each gradient magnitude is compared to the average gradient magnitude. If a gradient magnitude is less than the average, the group containing the smallest gradient magnitude less than the average is selected as the final prediction mode group.

[0054] Step 700: Arrange the prediction patterns in the prediction pattern set in ascending order of their cost value.

[0055] Based on this, the SATD (Sum of Absolute Transformed Difference) cost value of each prediction model in the prediction model set is calculated, and all prediction models in the set are arranged in ascending order of SATD cost value.

[0056] Step 800: Select the corresponding number of prediction modes as candidate modes according to the size of the prediction unit.

[0057] For example, if the prediction unit size is 4×4 and 8×8, the corresponding number of prediction modes is 8; if the PU size is 16×16, 32×32 and 64×64, the corresponding number of prediction modes is 3. The corresponding number of prediction modes are selected as candidate modes for rate-distortion optimization (RDO).

[0058] Step 400 above may include:

[0059] Step 410: Determine the optimal prediction model based on the candidate models and the principle of minimizing rate-distortion cost.

[0060] Based on the formula for calculating rate-distortion cost, the rate-distortion cost of the determined candidate modes is calculated. The prediction mode corresponding to the candidate mode with the lowest cost is selected as the final optimal prediction mode for implementation. The prediction mode with the lowest cost, given the data transmission rate and distortion metric, enables data to be transmitted with minimal distortion, maintaining data quality while maximizing data compression, reducing data transmission costs and storage space requirements.

[0061] For example, when using a frame from an encoded video sequence to obtain the luminance value distribution of an 8×8 prediction cell, the fast prediction mode selection method based on structural similarity cannot determine the candidate mode set for the rate-distortion optimization (RDO) process. Therefore, a fast prediction mode selection method based on gradient magnitude is required. First, Figure 3 This is a schematic diagram of the structure of 35 prediction modes for intra-frame prediction provided in one embodiment of the present invention. Figure 4 This is a schematic diagram of gradient magnitude calculation of a prediction unit provided in an embodiment of the present invention, as shown below. Figure 3 and Figure 4 The 35 angular prediction patterns are divided into 8 pattern sets according to the vertical direction, horizontal direction, π / 4 direction, 3π / 4 direction, vertical to the right π / 8 direction, vertical to the left π / 8 direction, horizontal upward π / 8 direction, and horizontal downward π / 8 direction, respectively, resulting in pattern sets S1, S2, S3, S4, S5, S6, S7, and S8. The gradient magnitude of the prediction unit in each of these 8 directions is calculated to obtain the gradient magnitude value G of the prediction unit. v G h G 45° G 135° G h-u G h-d G v-r G v-lThe values ​​are 12.01, 9.14, 12.25, 12.22, 6.33, 10.38, 8.54, and 9.08, respectively. At these values, the minimum gradient magnitude is G. h-u Compare G h-u The relationship with preset parameters: if the preset parameters are set to 7 after testing different video sequences, then G... h-u If the value is less than 7, select G. h-u The corresponding pattern set S6 is used as the prediction pattern set. Planar and DC patterns are added to set S6 as candidate patterns after the Rough Mode Decision (RMD) process. The SATD cost value of all prediction patterns in set S6 is calculated according to the SATD cost value calculation formula. The top 8 prediction patterns with the lowest cost values ​​are selected, and the optimal prediction pattern for the current prediction unit is finally determined through the Rate Distortion Optimization (RDO) process. The SATD cost value calculation formula is: J SATD =SATD + λ × B; where SATD represents the sum of the absolute values ​​of the coefficients after the residual undergoes Hadamard transformation, λ represents the Lagrange coefficients, and B represents the number of bits required to encode the current mode.

[0062] By using a fast prediction mode selection method based on gradient magnitude, we can avoid fully traversing all 35 prediction modes for the current prediction unit, reduce the number of times the coarse mode selection process is performed, and save encoding time.

[0063] In one embodiment, the preset direction may include: vertical direction, horizontal direction, π / 4 direction, 3π / 4 direction, vertical right π / 8 direction, vertical left π / 8 direction, horizontal up π / 8 direction, and horizontal down π / 8 direction; wherein, the above step 900 may include: when the size of the prediction unit is larger than the preset size, calculating eight gradient magnitude values ​​of the prediction unit in the vertical direction, horizontal direction, π / 4 direction, 3π / 4 direction, vertical right π / 8 direction, vertical left π / 8 direction, horizontal up π / 8 direction, and horizontal down π / 8 direction.

[0064] For prediction units larger than 4×4 (e.g., 8×8 to 64×64), a fast intra-prediction mode selection method based on gradient magnitude can be chosen. HEVC intra-coding employs 35 prediction modes, including Planar, DC, and 33 angular prediction modes. These 33 angular prediction modes are further divided into eight groups based on the following directions: vertical, horizontal, π / 4 (45-degree), 3π / 4 (135-degree), vertical to the right π / 8, vertical to the left π / 8, horizontal upward π / 8, and horizontal downward π / 8. Each group contains multiple prediction modes. By dividing the angular prediction modes of the prediction units into these eight groups and calculating the gradient magnitude values ​​of the prediction units in each of the eight directions, the prediction mode set is determined based on the gradient magnitude values ​​of the prediction units. This effectively reduces the number of Rough Mode Decision (RMD) processes, thus reducing the time required for HEVC intra-coding.

[0065] The formula for calculating the gradient magnitude can be:

[0066]

[0067]

[0068]

[0069]

[0070]

[0071]

[0072]

[0073]

[0074] Among them, G v G represents the gradient magnitude of the prediction unit in the vertical direction. h G represents the gradient magnitude of the prediction unit in the horizontal direction. 45° G represents the gradient magnitude of the prediction unit in the π / 4 direction (i.e., the 45-degree direction). 135° G represents the gradient magnitude of the prediction cell in the 3π / 4 direction (i.e., the 135-degree direction). v-r G represents the gradient magnitude of the prediction unit in the vertical rightward direction (π / 8). v-l G represents the gradient magnitude of the prediction unit in the vertical leftward direction (π / 8). h-u G represents the gradient magnitude of the prediction unit in the horizontal upward direction of π / 8. h-dP represents the gradient magnitude of the prediction unit at a horizontal downward distance of π / 8. i,j Let n be the brightness value of the pixel at (i,j), where n can be equal to 4.

[0075] For prediction units with sizes of 8×8, 16×16, 32×32, and 64×64, they can be divided into 4, 16, 64, and 256 sub-PU units of size 4×4, respectively. The gradient magnitude values ​​are shown below:

[0076]

[0077] Among them G i Let j represent the gradient magnitude values ​​of a 4×4 sub-prediction cell in the vertical, horizontal, π / 4 (i.e., 45-degree direction), 3π / 4 (i.e., 135-degree direction), vertically to the right π / 8, vertically to the left π / 8, horizontally upward π / 8, and horizontally downward π / 8 directions. Let j represent prediction cells of 8×8, 16×16, 32×32, and 64×64, with sizes of 1, 2, 3, and 4, respectively.

[0078] In one embodiment, step 600 may include: comparing multiple gradient magnitude values ​​with preset parameters to obtain a set of prediction modes corresponding to gradient magnitude values ​​that are less than the preset parameters; wherein the prediction modes include 33 angle prediction modes, and the set of prediction modes includes multiple sets of the 33 angle prediction modes divided according to the vertical direction, horizontal direction, π / 4 direction, 3π / 4 direction, vertical to the right π / 8 direction, vertical to the left π / 8 direction, horizontal upward π / 8 direction, and horizontal downward π / 8 direction.

[0079] HEVC intra-frame coding employs 35 prediction modes, specifically Planar, DC, and 33 angular prediction modes. These 33 angular prediction modes are further divided into eight groups based on the following directions: vertical, horizontal, π / 4 (45-degree), 3π / 4 (135-degree), vertically to the right (π / 8), vertically to the left (π / 8), horizontally upward (π / 8), and horizontally downward (π / 8). Each group contains multiple prediction modes. Planar and DC modes are also included in these mode sets. Preset parameters may include the average gradient magnitude. Each gradient magnitude is compared to the average gradient magnitude. If a gradient magnitude is less than the average gradient magnitude, the set of modes corresponding to the smallest value among these smaller gradient magnitudes is selected as the prediction mode set.

[0080] In one embodiment, the preset parameters are positively correlated with the sum of gradient magnitude values ​​and negatively correlated with the number of gradient magnitude values; wherein, the sum of gradient magnitude values ​​includes the sum of gradient values ​​of the prediction unit in each preset direction, and the number of gradient magnitude values ​​includes the sum of the number of gradient values ​​of the prediction unit in each preset direction.

[0081] The formula for calculating the preset parameters can be:

[0082]

[0083] Where α is a preset parameter, λ is an adjustment factor, 8 is the number of gradient magnitude values, and G v G is the gradient magnitude of the predicted cell in the vertical direction. h G is the gradient magnitude of the prediction unit in the horizontal direction. 45° G is the gradient magnitude of the prediction cell in the π / 4 direction (i.e., the 45-degree direction). 135° To predict the gradient magnitude of the cell in the 3π / 4 direction (i.e., the 135-degree direction), G v-r G represents the gradient magnitude of the prediction cell in the vertical rightward direction (π / 8). v-l G represents the gradient magnitude of the prediction cell in the vertical leftward direction (π / 8). h-u To predict the gradient magnitude of the cell in the horizontal upward π / 8 direction, G h-d λ represents the gradient magnitude of the prediction unit at a downward horizontal distance of π / 8. Different values ​​of λ can be set based on testing with different video sequences.

[0084] In one embodiment, step 410 may include: calculating the rate-distortion cost of multiple candidate modes respectively; and selecting the candidate mode with the smallest rate-distortion cost from the multiple candidate modes as the optimal prediction mode.

[0085] The formula for calculating rate-distortion cost can be:

[0086] J = SSE + λ R ×R m°de

[0087] Where SSE is the sum of squared errors between the reconstructed image and the original image, and λ R R is the Lagrange multiplier. mode The number of bits required to encode the image.

[0088] In one embodiment, the preset size includes a 4×4 size; wherein, the above step 200 may include: when the size of the prediction unit is less than or equal to the 4×4 size, calculating the structural similarity index between the prediction unit and the first adjacent prediction unit, the structural similarity index between the second adjacent prediction unit and the third adjacent prediction unit; wherein, the first adjacent prediction unit is located to the left of the adjacent prediction unit, the second adjacent prediction unit is located to the upper left of the adjacent prediction unit, and the third adjacent prediction unit is located above the adjacent prediction unit.

[0089] The structural similarity index can be determined by the following formula:

[0090] SSIM(x,y)=l(x,y)c(x,y)s(x,y)

[0091]

[0092]

[0093]

[0094] Where SSIM represents the structural similarity index, x and y represent two pixel blocks respectively, l(x,y), c(x,y), and s(x,y) are the brightness function, contrast function, and structural function of x and y respectively, and u, σ, σ xy Let x, c2, and c3 be the mean, variance, and covariance of x and y, respectively; c1, c2, and c3 are constants.

[0095] For example, Figure 5 This is a schematic diagram of the structure of a prediction unit and adjacent prediction units provided in an embodiment of the present invention. Figure 5 In the frame shown, the pixel brightness distribution of the current 4×4 prediction unit and its adjacent 4×4 prediction units is obtained. When the current prediction unit selects a prediction mode, it first calculates the structural similarity index between the current prediction unit and its adjacent prediction units in the image. Using the above formula for calculating the structural similarity index, the SSIM (Structural Similarity Index) between the current prediction unit and its left-side adjacent prediction unit can be obtained. pu_l = 0.832, the structural similarity index (SSIM) between the current prediction unit and its upper-left adjacent prediction unit. pu_lu = 0.838, the structural similarity index (SSIM) between the current prediction unit and its adjacent prediction unit above it. pu_u =0.05.

[0096] The structural similarity obtained above is compared with a preset threshold. At this point, the optimal prediction modes of the left-adjacent prediction unit, the upper-adjacent prediction unit, and the upper-left-adjacent prediction unit are 29, 22, and 0, respectively. If the structural similarity index between adjacent prediction units is greater than the preset threshold, the optimal prediction mode of the corresponding adjacent prediction unit is added to the mode set R. For example, after testing different video sequences, a preset threshold of 0.8 can be set, at which point the prediction mode set R is {0, 29}. The set R is used as the candidate mode set for the rate-distortion optimization (RDO) process. According to the principle of minimizing rate-distortion cost, the optimal prediction mode can be selected. This step skips the rough mode decision (RMD) process, reducing coding time and lowering the complexity of intra-frame coding.

[0097] Figure 6This is a schematic diagram illustrating the principle of a fast HEVC intra-frame prediction mode selection method according to an embodiment of the present invention, as shown below. Figure 6 As shown, the prediction mode selection for the prediction unit begins. It is determined whether the size of the prediction unit (PU) is 4×4 (step 21). If the size of the prediction unit is 4×4, the structural similarity index between adjacent PUs (prediction units) is calculated, and the mode set R is initialized (step 22). After the calculation is completed, it is determined whether the structural similarity index between adjacent PUs (prediction units) is greater than a preset threshold (step 23). If the structural similarity index between the prediction unit and the adjacent prediction unit is greater than the preset threshold, the optimal prediction mode of the adjacent PU (prediction unit) is added to the prediction mode set R (step 24). Finally, according to the principle of minimizing rate-distortion cost, the optimal prediction mode is selected (step 31), and the prediction mode with the minimum cost is determined as the optimal prediction mode of the prediction unit (step 32).

[0098] If the prediction unit size is not 4×4, for example, larger than 4×4, then first calculate the gradient magnitude values ​​of each pixel in the PU (prediction unit) in the 8 main directions (step 25), select the set containing the minimum gradient magnitude value as the prediction mode set S (step 26), and determine whether the gradient magnitude value is less than the preset parameter (step 27). If there is no gradient magnitude value less than the preset parameter, then perform the normal RMD (coarse selection mode) process (step 28). If a gradient magnitude value is less than a preset parameter, first add the Planar and DC modes to the mode set S (step 29). Calculate the cost value based on SATD in set S to obtain the first n prediction modes with the smallest cost value (step 30). Based on this, calculate the SATD (Sum of Absolute Transformed Difference) cost value for each prediction mode in the prediction mode set, and arrange all prediction modes in the set in ascending order of SATD cost value. The value of n is related to the size of the PU. If the PU size is 4×4 and 8×8, then the value of n is 8; if the PU size is 16×16, 32×32, and 64×64, then the value of n is 3. Finally, according to the principle of minimizing rate-distortion cost value, select the optimal prediction mode (step 31), and determine the prediction mode with the smallest cost value as the optimal prediction mode of the prediction unit (step 32).

[0099] Figure 7 This is a schematic diagram of a fast selection device for HEVC intra-frame prediction mode according to an embodiment of the present invention, as shown below. Figure 7As shown, an embodiment of the present invention provides a fast HEVC intra-frame prediction mode selection device 8, comprising: an acquisition module 81 for acquiring the size of a prediction unit; a calculation module 82 for calculating the structural similarity index between the prediction unit and adjacent prediction units when the size of the prediction unit is less than or equal to a preset size; an addition module 83 for adding prediction modes corresponding to structural similarity indices greater than a preset threshold to a set when the structural similarity index is greater than a preset threshold; and a determination module 84 for determining the optimal prediction mode based on the prediction modes in the set and the principle of minimizing rate-distortion cost.

[0100] The HEVC intra-prediction mode fast selection device provided in this embodiment of the invention utilizes the spatial correlation between adjacent prediction units to skip the complex selection process. By calculating the structural similarity index of adjacent prediction units, it quickly determines the optimal prediction mode of the prediction unit, thereby reducing the complexity of intra-frame coding.

[0101] Figure 8 This is a schematic diagram of a fast HEVC intra-prediction mode selection device according to another embodiment of the present invention, as shown below. Figure 8 As shown, the HEVC intra-prediction mode fast selection device 8 can also be configured as follows: a first calculation module 85, used to calculate the gradient magnitude value of the prediction unit in a preset direction when the structural similarity index is less than or equal to a preset threshold; a second acquisition module 86, used to acquire a corresponding preset prediction mode set according to the gradient magnitude value; an arrangement module 87, used to arrange the prediction modes in the prediction mode set in ascending order of cost value; and a selection module 88, used to select a corresponding number of prediction modes as candidate modes according to the size of the prediction unit; wherein, the above-mentioned determination module 84 can be configured as follows: a determination unit 841, used to determine the optimal prediction mode according to the candidate modes and the principle of minimizing rate-distortion cost value.

[0102] In one embodiment, such as Figure 8 As shown, the HEVC intra-prediction mode fast selection device 8 can also be configured as: a second calculation module 89, used to calculate the gradient magnitude value of the prediction unit in a preset direction when the size of the prediction unit is larger than the preset size; a second acquisition module 86, used to acquire a corresponding preset prediction mode set according to the gradient magnitude value; an arrangement module 87, used to arrange the prediction modes in the prediction mode set in ascending order of cost value; and a selection module 88, used to select a corresponding number of prediction modes as candidate modes according to the size of the prediction unit; wherein, the above-mentioned determination module 84 can be configured as: a determination unit 841, used to determine the optimal prediction mode according to the candidate modes and the principle of minimizing rate distortion cost value.

[0103] In one embodiment, the preset direction may include: vertical direction, horizontal direction, π / 4 direction, 3π / 4 direction, vertical right π / 8 direction, vertical left π / 8 direction, horizontal upward π / 8 direction, and horizontal downward π / 8 direction; wherein, the second calculation module 89 may be configured to: when the size of the prediction unit is larger than the preset size, calculate eight gradient magnitude values ​​of the prediction unit in the vertical direction, horizontal direction, π / 4 direction, 3π / 4 direction, vertical right π / 8 direction, vertical left π / 8 direction, horizontal upward π / 8 direction, and horizontal downward π / 8 direction.

[0104] In one embodiment, the second acquisition module 86 may include: comparing multiple gradient magnitude values ​​with preset parameters to acquire a set of prediction modes corresponding to gradient magnitude values ​​that are less than the preset parameters; wherein the prediction modes include 33 angle prediction modes, and the set of prediction modes includes multiple sets of the 33 angle prediction modes divided according to the vertical direction, horizontal direction, π / 4 direction, 3π / 4 direction, vertical to the right π / 8 direction, vertical to the left π / 8 direction, horizontal upward π / 8 direction, and horizontal downward π / 8 direction.

[0105] In one embodiment, the HEVC intra-prediction mode fast selection device 8 can also be configured such that: the preset parameters include the average value of multiple gradient magnitude values; wherein the preset parameters are positively correlated with the sum of gradient magnitude values ​​and negatively correlated with the number of gradient magnitude values; wherein the sum of gradient magnitude values ​​includes the sum of gradient values ​​of the prediction unit in each preset direction, and the number of gradient magnitude values ​​includes the sum of the number of gradient values ​​of the prediction unit in each preset direction.

[0106] In one embodiment, the upper determination unit 841 may be configured to: calculate the rate-distortion cost of multiple candidate modes respectively; and select the candidate mode with the smallest rate-distortion cost from the multiple candidate modes as the optimal prediction mode.

[0107] In one embodiment, the preset size includes a 4×4 size; wherein, the above-mentioned calculation module 82 can be configured to: when the size of the prediction unit is less than or equal to the 4×4 size, calculate the structural similarity index between the prediction unit and the first adjacent prediction unit, the structural similarity index between the second adjacent prediction unit and the third adjacent prediction unit; wherein, the first adjacent prediction unit is located to the left of the prediction unit, the second adjacent prediction unit is located to the upper left of the prediction unit, and the third adjacent prediction unit is located above the prediction unit.

[0108] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the HEVC intra-frame prediction mode fast selection device. In other embodiments of the present invention, the HEVC intra-frame prediction mode fast selection device may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0109] The information interaction and execution process between the various units in the above-mentioned device are based on the same concept as the method embodiment of the present invention, and the specific details can be found in the description of the method embodiment of the present invention, and will not be repeated here.

[0110] This invention also provides a fast HEVC intra-prediction mode selection apparatus, comprising: at least one memory and at least one processor; the at least one memory is used to store a machine-readable program; the at least one processor is used to call the machine-readable program to execute the fast HEVC intra-prediction mode selection method in any embodiment of this invention.

[0111] This invention also provides a computer-readable medium storing computer instructions. When executed by a processor, the computer instructions cause the processor to perform the HEVC intra-frame prediction mode fast selection method according to any embodiment of this invention. Specifically, a system or apparatus equipped with a storage medium storing software program code that implements the functions of any of the above embodiments can be provided, and the computer (or CPU or MPU) of the system or apparatus can read and execute the program code stored in the storage medium.

[0112] In this case, the program code read from the storage medium can itself implement the function of any of the above embodiments, and therefore the program code and the storage medium storing the program code constitute part of the present invention.

[0113] Examples of storage media used to provide program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, program code can be downloaded from a server computer via a communication network.

[0114] Furthermore, it should be clear that not only can the program code read by the computer be executed, but also the operating system or other components operating on the computer can be instructed based on the program code to perform some or all of the actual operations, thereby realizing the function of any of the embodiments described above.

[0115] Furthermore, it is understood that the program code read from the storage medium is written to the memory set in the expansion board inserted into the computer or to the memory set in the expansion unit connected to the computer. Then, based on the instructions of the program code, the CPU or other components installed on the expansion board or expansion unit execute some and all of the actual operations, thereby realizing the function of any of the embodiments described above.

[0116] It should be noted that not all steps and modules in the above processes and system structure diagrams are mandatory; some steps or modules can be omitted as needed. The execution order of each step is not fixed and can be adjusted as required. The system structure described in the above embodiments can be a physical structure or a logical structure. That is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or they may be jointly implemented by certain components in multiple independent devices.

[0117] In the above embodiments, the hardware units can be implemented mechanically or electrically. For example, a hardware unit may include permanent dedicated circuitry or logic (such as a dedicated processor, FPGA, or ASIC) to perform the corresponding operation. The hardware unit may also include programmable logic or circuitry (such as a general-purpose processor or other programmable processor), which can be temporarily configured by software to perform the corresponding operation. The specific implementation method (mechanical, dedicated permanent circuitry, or temporarily configured circuitry) can be determined based on cost and time considerations.

[0118] The present invention has been shown and described in detail above with reference to the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above embodiments, those skilled in the art will know that more embodiments of the present invention can be obtained by combining the code review methods in the different embodiments. These embodiments are also within the protection scope of the present invention.

Claims

1. A fast selection method for HEVC intra-frame prediction mode, characterized in that, include: Obtain the size of the prediction unit; When the size of the prediction unit is less than or equal to the preset size, the structural similarity index between the prediction unit and the adjacent prediction units is calculated; When the structural similarity index is greater than a preset threshold, the prediction patterns corresponding to adjacent prediction units are added to the set; as well as Based on the prediction patterns in the set and the principle of minimizing rate-distortion cost, determine the optimal prediction pattern; The fast selection method for HEVC intra-prediction mode further includes: After calculating the structural similarity index between the prediction unit and its neighboring prediction units, when the structural similarity index is less than or equal to the preset threshold, eight gradient magnitude values ​​of the prediction unit in a preset direction are calculated; the preset direction includes: vertical direction, horizontal direction, and so on. direction, Direction, perpendicular to the right Direction, perpendicular to the left Direction, horizontal and upward Direction, horizontal downwards Direction; and, when the size of the prediction unit is larger than the preset size, calculate the prediction unit in the vertical direction and horizontal direction. direction, Direction, perpendicular to the right Direction, perpendicular to the left Direction, horizontal and upward Direction, horizontal downwards Eight gradient magnitude values ​​in the direction; Based on the eight gradient magnitude values ​​and preset parameters, obtain the corresponding preset prediction mode set; The prediction patterns in the prediction pattern set are arranged in ascending order of SATD value. Based on the size of the prediction unit, a corresponding number of the prediction modes are selected as candidate modes; The optimal prediction mode is determined based on the candidate modes and the principle of minimizing rate-distortion cost.

2. The method for fast selection of HEVC intra-prediction mode according to claim 1, characterized in that, The step of obtaining the corresponding preset prediction mode set based on the gradient magnitude value includes: By comparing multiple gradient magnitude values ​​with a preset parameter, a set of prediction modes corresponding to gradient magnitude values ​​smaller than the preset parameter is obtained; wherein, the prediction modes include 33 angle prediction modes, and the set of prediction modes includes 33 angle prediction modes based on the vertical direction, horizontal direction, and so on. direction, Direction, perpendicular to the right Direction, perpendicular to the left Direction, horizontal and upward Direction, horizontal downwards Multiple sets divided by direction.

3. The method for fast selection of HEVC intra-prediction mode according to claim 2, characterized in that, The preset parameter is positively correlated with the sum of the gradient magnitude values, and negatively correlated with the number of gradient magnitude values; wherein, the sum of the gradient magnitude values ​​includes the sum of the gradient values ​​of the prediction unit in each preset direction, and the number of gradient magnitude values ​​includes the sum of the number of gradient values ​​of the prediction unit in each preset direction.

4. The method for fast selection of HEVC intra-prediction mode according to claim 1, characterized in that, The step of determining the optimal prediction mode based on the candidate modes and the principle of minimizing rate-distortion cost includes: Calculate the rate-distortion cost of each of the candidate modes; The candidate mode with the lowest rate-distortion cost is selected from among the multiple candidate modes as the optimal prediction mode.

5. The method for fast selection of HEVC intra-prediction mode according to claim 1, characterized in that, The preset size includes a 4×4 dimension; wherein, when the size of the prediction unit is less than or equal to the preset size, calculating the structural similarity index between the prediction unit and adjacent prediction units includes: When the size of the prediction unit is less than or equal to 4×4, the structural similarity index between the prediction unit and the first adjacent prediction unit, the structural similarity index between the second adjacent prediction unit and the third adjacent prediction unit is calculated; wherein, the first adjacent prediction unit is located to the left of the prediction unit, the second adjacent prediction unit is located to the upper left of the prediction unit, and the third adjacent prediction unit is located above the prediction unit.

6. A fast selection device for HEVC intra-frame prediction mode, characterized in that, include: The acquisition module is used to obtain the size of the prediction unit; The calculation module is used to calculate the structural similarity index between the prediction unit and adjacent prediction units when the size of the prediction unit is less than or equal to a preset size; An addition module is used to add the prediction modes corresponding to adjacent prediction units to the set when the structural similarity index is greater than a preset threshold. as well as The determination module is used to determine the optimal prediction mode based on the prediction modes in the set and the principle of minimizing rate-distortion cost; The first calculation module is used to calculate the eight gradient magnitude values ​​of the prediction unit in a preset direction when the structural similarity index is less than or equal to a preset threshold; the preset direction includes: vertical direction, horizontal direction, and so on. direction, Direction, perpendicular to the right Direction, perpendicular to the left Direction, horizontal and upward Direction, horizontal downwards Direction; when the size of the prediction unit is larger than the preset size, calculate the prediction unit in the vertical and horizontal directions. direction, Direction, perpendicular to the right Direction, perpendicular to the left Direction, horizontal and upward Direction, horizontal downwards Eight gradient magnitude values ​​in the direction; The second acquisition module is used to acquire the corresponding preset prediction mode set based on the 8 gradient magnitude values ​​and preset parameters; The permutation module is used to arrange the prediction patterns in the prediction pattern set from smallest to largest according to their SATD cost. The selection module is used to select a corresponding number of prediction modes as candidate modes based on the size of the prediction unit; The determination module is configured as follows: a determination unit, used to determine the optimal prediction mode based on the candidate modes and the principle of minimizing rate-distortion cost.

7. A computer-readable medium, characterized in that, The computer-readable medium stores computer instructions that, when executed by a processor, cause the processor to perform the HEVC intra-prediction mode fast selection method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Intra-frame prediction coding complexity reduction method suitable for HEVC standard

    CN112752105A