Video encoding method, hardware encoder and video encoding and decoding chip
By using the encoding cost of Intra prediction mode in VVC hardware encoder to guide the prediction direction of BDPCM, the number of MD units of BDPCM is reduced, and the problem of high resource consumption of VVC hardware encoder is solved, and the encoding cost-effectiveness and prediction accuracy are improved.
Patent Information
- Application Number
- CN202410057160.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-15
- Publication Date
- 2024-12-13
AI Technical Summary
VVC's hardware encoder resources and area are facing huge challenges due to the significant increase in the number and complexity of new encoding tools, especially the excessive consumption of MD unit resources, resulting in low cost-effectiveness of encoding.
By determining the encoding cost in the Intra prediction mode, selecting the best prediction mode from the BDPCM prediction mode, reducing the number of MD units of the BDPCM, thereby saving hardware resources and improving the cost-effectiveness of the encoding.
It realizes that while ensuring the encoding effect, saves BDPCM hardware resources, improves the encoding cost-effectiveness of BDPCM, and the accuracy of BDPCM prediction direction reaches 70%, and the encoding performance loss is only 0.13%.
Smart Images

Figure CN119135891A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of video coding and decoding, and in particular to a video coding method, a hardware encoder and a video coding and decoding chip. Background Art
[0002] VVC (Versatile Video Coding) is a new generation of video coding standard, also known as H.266. VVC integrates the most advanced video compression technology. Compared with the previous generation standard HEVC (High Efficiency Video Coding), VVC can improve the video compression rate by nearly 50%.
[0003] In the related technology, in order to perform intra-frame encoding on blocks in video frames, VVC integrates multiple encoding tools such as intra-frame coding intra unit, block-based differential pulse code modulation BDPCM (Block-based Differential Pulse-Code Modulation) unit, and intra-frame block copy IBC (Intra Block Copy) unit.
[0004] However, due to the significant increase in the number and complexity of new encoding tools, VVC's hardware encoder resources and area face huge challenges. Summary of the invention
[0005] The embodiment of the present application provides a video encoding method, a hardware encoder and a video encoding and decoding chip. The technical solution is as follows:
[0006] On the one hand, an embodiment of the present application provides a video encoding method, the method being performed by a hardware encoder, the method comprising:
[0007] For each current block in the video frame, determining an Intra candidate prediction mode of the current block from a plurality of Intra prediction modes based on encoding costs corresponding to different Intra prediction modes;
[0008] Determine a BDPCM candidate prediction mode of the current block from the BDPCM prediction modes based on coding costs corresponding to at least two target Intra prediction modes in the Intra prediction modes, wherein the BDPCM candidate prediction mode is a BDPCM horizontal prediction mode or a BDPCM vertical prediction mode;
[0009] Determine the best prediction mode from a candidate prediction mode set, wherein the candidate prediction mode set includes the Intra candidate prediction mode and the BDPCM candidate prediction mode;
[0010] Obtain an intra-frame encoding result of the current block in the optimal prediction mode.
[0011] On the other hand, an embodiment of the present application provides a hardware encoder, the hardware encoder comprising:
[0012] A Pre-intra unit for intra-frame coding preselection is used to determine, for each current block in a video frame, an Intra candidate prediction mode of the current block from a plurality of Intra prediction modes based on coding costs corresponding to different Intra prediction modes;
[0013] The Pre-intra unit is further configured to determine a BDPCM candidate prediction mode of the current block from the BDPCM prediction modes based on coding costs corresponding to at least two target Intra prediction modes in the Intra prediction modes, wherein the BDPCM candidate prediction mode is a BDPCM horizontal prediction mode or a BDPCM vertical prediction mode;
[0014] An MD unit, configured to determine an optimal prediction mode from a candidate prediction mode set, wherein the candidate prediction mode set includes the Intra candidate prediction mode and the BDPCM candidate prediction mode;
[0015] The MD unit is further used to obtain the intra-frame encoding result of the current block in the optimal prediction mode.
[0016] On the other hand, an embodiment of the present application provides a video codec chip, which includes a hardware encoder as described in the above aspect.
[0017] On the other hand, an embodiment of the present application provides a computer device, which is provided with a hardware encoder as described in the above aspect.
[0018] In an embodiment of the present application, based on the coding cost corresponding to the target Intra prediction mode in the Intra prediction mode, a BDPCM candidate prediction mode is determined from the BDPCM prediction mode, wherein the BDPCM candidate prediction mode is a BDPCM horizontal prediction mode or a BDPCM vertical prediction mode. The coding cost of the Intra prediction mode can be used to guide the horizontal or vertical prediction direction of the BDPCM, thereby saving the hardware resources of the MD unit in the BDPCM while ensuring the coding effect, thereby greatly improving the coding cost performance of the BDPCM. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 It is a schematic diagram of 67 Intra prediction modes in the related art;
[0021] Figure 2 is a schematic diagram of performing intra-frame coding on a current block in the related art;
[0022] Figure 3 is a flowchart of a video encoding method provided by an exemplary embodiment of the present application;
[0023] Figure 4 is a schematic diagram of performing intra-frame coding on a current block provided by an exemplary embodiment of the present application;
[0024] Figure 5 It is a schematic diagram of intra-frame coding based on intra-frame coding tools such as intra, BDPCM and IBC in the related art;
[0025] Figure 6 It is a schematic diagram of performing intra-frame coding based on intra-frame coding tools such as intra, BDPCM and IBC provided by an exemplary embodiment of the present application;
[0026] Figure 7 is a flowchart of determining a BDPCM candidate prediction mode provided by an exemplary embodiment of the present application;
[0027] Figure 8 is a schematic diagram of a horizontal prediction mode and a vertical prediction mode provided by an exemplary embodiment of the present application;
[0028] Fig. 9 is a flowchart of determining a BDPCM candidate prediction mode provided by another exemplary embodiment of the present application;
[0029] Fig.10 is a structural block diagram of a hardware encoder provided by an exemplary embodiment of the present application;
[0030] Fig.11 It is a structural block diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0032] Compared with previous video standards (such as HEVC), the VVC protocol has significantly increased the number and complexity of new coding tools, and the hardware encoder resources and area face huge challenges. Among them, the Intra unit and the BDPCM unit are two intra-frame coding tools with different principles in VCC. In the encoding process of VCC, the Intra unit and the BDPCM unit will provide several candidate prediction modes. The hardware encoder evaluates the rate-distortion loss corresponding to different candidate prediction modes, and finally determines the best prediction mode from multiple candidate prediction modes for intra-frame coding of the current block to obtain the intra-frame coding result of the current block.
[0033] The Intra unit is used to generate a prediction block of the current block by performing spatial prediction using the original pixels corresponding to the current block and the neighboring pixels corresponding to the neighboring blocks of the current block. In some related technologies, Intra corresponds to 67 different Intra prediction modes, including 65 Intra prediction modes with different integer angle prediction directions, Planar mode (mode 0) and DC mode (mode 1). In the related technology, in the selection stage, by calculating the encoding costs corresponding to the 67 different Intra prediction modes, several candidate Intra prediction modes can be determined from the 67 different Intra prediction modes for subsequent determination of the best prediction mode. Among them, the 67 different Intra prediction modes include Intra horizontal prediction mode and Intra vertical prediction mode.
[0034] The BDPCM unit can also be called an RDPCM (Residual Differential Pulse Coded Modulation) unit. In the related art, the BDPCM unit transmits the BDPCM prediction direction flag during use to indicate that the prediction direction uses the BDPCM horizontal prediction mode or the BDPCM vertical prediction mode. The BDPCM unit quantizes the residual and encodes the difference between the quantized residual value and its predicted value.
[0035] See also Figure 1 , Figure 1 It is a schematic diagram of 67 Intra prediction modes in the related art.
[0036] like Figure 1 As shown, the Planar mode is represented by number 0, the DC mode is represented by number 1, and the solid arrows from number 2 to number 66 represent the Intra prediction modes corresponding to 65 different integer angle prediction directions within the prediction angle range of -135° to 45°.
[0037] Among them, the prediction direction represented by number 18 is the horizontal direction, and number 18 corresponds to the Intra horizontal prediction mode; the prediction direction represented by number 50 is the vertical direction, and number 50 corresponds to the Intra vertical prediction mode.
[0038] For BDPCM, the VVC protocol defines that BDPCM encoding has two prediction modes corresponding to prediction directions, namely BDPCM horizontal prediction mode and BDPCM vertical prediction mode.
[0039] In the related art, several Intra candidate prediction modes (e.g., the best 9) are usually determined from 67 different Intra prediction modes, and then the one with the smallest rate-distortion loss in the candidate prediction mode set is calculated as the best prediction mode, so as to use the best prediction mode to perform intra-frame coding on the current block. The candidate prediction mode set includes the Intra candidate prediction mode, the BDPCM horizontal prediction mode, and the BDPCM vertical prediction mode, and may also include candidate prediction modes corresponding to other intra-frame coding tools (e.g., the IBC candidate mode).
[0040] In the related art, since the candidate prediction mode set includes the Intra candidate prediction mode, the BDPCM horizontal prediction mode and the BDPCM vertical prediction mode, for different candidate prediction modes, a set of MD (Mode Decision, mode selection) units are required to calculate the rate distortion loss corresponding to the prediction mode. For example, for the optimal 9 Intra candidate prediction modes, the BDPCM horizontal prediction mode and the BDPCM vertical prediction mode, a total of 9+1+1=11 sets of MD units are required.
[0041] See also Figure 2 , Figure 2 Schematic diagram of intra-frame coding of the current block in the related art. Figure 2 As shown, in the related art, intra-frame coding of the current block includes the following steps:
[0042] In step S11, the data fetching unit (Data Fetch) 210 fetches original pixels and neighboring pixels of the current block from a random access memory (RAM) according to the position and size of the current block.
[0043] In step S12, the intra-coding pre-selection Pre-intra unit 220 determines the best 9 candidate Intra prediction modes (Top 9) from different Intra prediction modes.
[0044] In step S13, for the nine Intra candidate prediction modes (Intra(9)), the BDPCM horizontal prediction mode (BDPCM(hor)) and the BDPCM vertical prediction mode (BDPCM(ver)), a set of MD units is required for calculating the rate-distortion loss.
[0045] Among them, a set of MD units includes a Pred (Prediction) unit 230, a TQ / IQT (Transform and Quantization / Inverse Quantization and inverse Transform) unit and an RDOQ (Rate Distortion Optimization Quantization) unit 240, and a RDO (Rate Distortion Optimization) unit 250.
[0046] In order to ensure the encoding speed and throughput, it is necessary to provide two complete MD resources for BDPCM and calculate the rate-distortion loss of the BDPCM horizontal prediction mode and the BDPCM vertical prediction mode respectively. Figure 2 A total of 11 sets of MD units are needed, where each set of MD units is used to calculate the rate-distortion loss of each candidate prediction mode, and the prediction mode corresponding to the minimum rate-distortion loss is taken as the optimal prediction mode.
[0047] Step S14, intra-frame encoding is performed on the current block based on the best prediction mode, and the intra-frame encoding result of the current block is processed through a loop filter 260 (LoopFilter) and an entropy encoder 270 (Context Adaptive Binary Arithmetic Coding, CABAC) to obtain a bit stream.
[0048] Since the MD unit is the most resource- and time-consuming unit in the hardware encoder, and VVC's MD consumes more resources than previous video protocols (such as HEVC), in the related technology, two sets of MD units need to be set for BDPCM (one set for the BDPCM horizontal prediction mode and one set for the BDPCM vertical prediction mode). Compared with the encoding quality benefits obtained, the required hardware cost is too large.
[0049] Therefore, this application proposes a video encoding method, which can reduce the number of MD units of BDPCM from 2 sets to 1 set by exploring and utilizing the encoding information between multiple encoding tools and guiding BDPCM to decide the prediction direction with the help of Intra's prediction information on the direction, thereby saving hardware resources and improving the encoding cost-effectiveness of BDPCM.
[0050] See also Figure 3 , Figure 3 1 is a flowchart of a video encoding method provided by an exemplary embodiment of the present application. In some embodiments, the method is performed by a hardware encoder proposed in the present application. The method includes the following steps.
[0051] Step 301 : for each current block in a video frame, based on the coding costs corresponding to different Intra prediction modes, determine an Intra candidate prediction mode of the current block from a plurality of Intra prediction modes.
[0052] The current block refers to the coding unit (CU) currently being encoded, which can also be called a CU block. The CU block is a leaf node on the coding tree structure.
[0053] Optionally, the size of the current block may be 32×32, 16×16, 8×8 or 4×4, and the embodiment of the present application does not limit the size of the current block.
[0054] In some embodiments, step 301 is performed by a Pre-intra unit.
[0055] The intra-frame coding pre-selection Pre-intra unit is used to calculate the coding costs corresponding to different Intra prediction modes, and determine the N Intra prediction modes with the lowest coding costs as Intra candidate prediction modes.
[0056] For example, N=9, then the Intra candidate prediction modes are the top 9 Intra prediction modes with the smallest encoding costs among the multiple Intra prediction modes.
[0057] In some embodiments, the Intra prediction mode includes at least an Intra horizontal prediction mode and an Intra vertical prediction mode.
[0058] The Intra horizontal prediction mode is an Intra prediction mode in which the prediction direction is horizontal (e.g. Figure 1 The Intra prediction mode corresponding to number 18 in the figure), the Intra vertical prediction mode is an Intra prediction mode that indicates that the prediction direction is the vertical direction (for example Figure 1 Intra prediction mode corresponding to number 50).
[0059] In some embodiments, the Intra prediction mode includes Figure 1The 67 prediction modes shown include an Intra prediction mode with 65 different integer angle prediction directions, a Planar mode (mode 0) and a DC mode (mode 1).
[0060] It should be noted that the number of Intra prediction modes may be 67, or may be other values greater or less than 67. For example, Figure 1 The fractional angle mode represented by the dotted arrow is used as the Intra prediction mode. The specific number and setting method of the Intra prediction mode are not limited in this application.
[0061] In different Intra prediction modes, different prediction directions are used to perform intra-frame coding on the current block, resulting in different coding results.
[0062] In order to measure the quality of different encoding results, the encoding costs corresponding to different Intra prediction modes can be calculated. The encoding costs are used to reflect the difference between the encoding results under different Intra prediction modes and the original pixels of the current block. The encoding costs can be in the form of any possible cost function.
[0063] Optionally, the coding cost is SAD (Sum of Absolute Difference, sum of absolute error in time domain).
[0064] Optionally, the coding cost is SATD (Sum of Absolute Transformed Difference, frequency domain absolute error sum).
[0065] It should be noted that the coding cost can also be other forms of cost functions, such as the sum of squared errors, mean square error, etc. The embodiments of the present application do not limit the specific form of the coding cost.
[0066] Step 302: determine a BDPCM candidate prediction mode of the current block from the BDPCM prediction mode based on coding costs corresponding to at least two target Intra prediction modes in the Intra prediction mode, wherein the BDPCM candidate prediction mode is a BDPCM horizontal prediction mode or a BDPCM vertical prediction mode.
[0067] In some embodiments, step 302 is also performed by an intra-frame coding pre-selection Pre-intra unit.
[0068] The target Intra prediction mode is at least two Intra prediction modes among the plurality of Intra prediction modes.
[0069] In some embodiments, the target Intra prediction mode includes an Intra horizontal prediction mode and an Intra vertical prediction mode. In other embodiments, the target Intra prediction mode includes a horizontal class prediction mode and a vertical class prediction mode.
[0070] Among them, the horizontal prediction mode may include two or more Intra prediction modes whose mode number difference with the Intra horizontal prediction mode is less than the difference threshold; the vertical prediction mode may include two or more Intra prediction modes whose mode number difference with the Intra vertical prediction mode is less than the difference threshold.
[0071] The difference threshold may be a value preset by the hardware encoder, such as 16 or 2.
[0072] For more information about horizontal prediction mode and vertical prediction mode, see Figure 8 And the related description will not be repeated here.
[0073] In a possible implementation, the intra-coding pre-selection Pre-intra unit may determine the coding tendency direction based on the coding cost corresponding to the target Intra prediction mode; and determine the BDPCM prediction mode matching the coding tendency direction as the BDPCM candidate prediction mode.
[0074] The encoding tendency direction is one of a horizontal direction and a vertical direction.
[0075] For example, when the encoding tendency direction is the horizontal direction, the BDPCM horizontal prediction mode is determined as the BDPCM candidate prediction mode; when the encoding tendency direction is the vertical direction, the BDPCM vertical prediction mode is determined as the BDPCM candidate prediction mode.
[0076] Step 303: determine the best prediction mode from the candidate prediction mode set, where the candidate prediction mode set includes the Intra candidate prediction mode and the BDPCM candidate prediction mode.
[0077] In some embodiments, step 303 is performed by the intra-frame coding Intra unit and the block differential pulse code modulation BDPCM unit. In some embodiments, step 303 is performed by the intra-frame coding Intra unit, the block differential pulse code modulation BDPCM unit and other intra-frame coding tools (such as the intra-frame block copy unit IBC).
[0078] In some embodiments, the candidate prediction mode set may also include one or more candidate modes corresponding to other intra-coding tools, such as an IBC candidate mode.
[0079] Different intra-frame coding tools (such as Intra, BDPCM or) can respectively use their corresponding MD units to calculate the rate distortion cost (Rate Distortion Cost, RDCost) corresponding to different prediction modes under the intra-frame coding tool, and determine the prediction mode corresponding to the minimum rate distortion loss as the optimal prediction mode.
[0080] Among them, since there is only one BDPCM candidate prediction mode (one of the BDPCM horizontal prediction mode or the BDPCM vertical prediction mode), only one set of MD units needs to be set in the BDPCM, thereby saving hardware resources and improving the encoding cost-effectiveness of the BDPCM.
[0081] Step 304: Obtain the intra-frame encoding result of the current block in the best prediction mode.
[0082] The best prediction mode is the prediction mode corresponding to the minimum rate-distortion loss in the candidate prediction mode set.
[0083] The best prediction mode may be one of the Intra candidate prediction modes, may be a BDPCM candidate prediction mode, or may be a candidate mode corresponding to other intra-frame coding tools.
[0084] After the best prediction mode is determined, the best prediction mode may be used to perform intra-frame coding on the current block based on an intra-frame coding tool corresponding to the best prediction mode, so as to obtain an intra-frame coding result of the current block.
[0085] After intra-frame coding, other units in the hardware encoder, such as a loop filter (LoopFilter) and an entropy encoder (CABAC), may be needed to process the intra-frame coding result to obtain a bit stream.
[0086] Experiments have shown that the video encoding method proposed in this application can achieve an accuracy of 70% in the BDPCM prediction direction and only introduce a 0.13% encoding performance loss.
[0087] To summarize, based on the coding cost corresponding to the target Intra prediction mode in the Intra prediction mode, the BDPCM candidate prediction mode is determined from the BDPCM prediction mode, wherein the BDPCM candidate prediction mode is the BDPCM horizontal prediction mode or the BDPCM vertical prediction mode. The coding cost of the Intra prediction mode can be used to guide the horizontal or vertical prediction direction of the BDPCM, thereby saving the hardware resources of the MD unit in the BDPCM while ensuring the coding effect, and greatly improving the coding cost performance of the BDPCM.
[0088] See also Figure 4 , Figure 41 is a schematic diagram of performing intra-frame coding on a current block provided by an exemplary embodiment of the present application. In some embodiments, the video coding method proposed in the present application is executed by a hardware encoder. Using the video coding method proposed in the present application to perform intra-frame coding on the current block includes the following steps:
[0089] In step S21 , the data fetching unit (Data Fetch) 410 fetches original pixels and neighboring pixels of the current block from a random access memory (RAM) according to the position and size of the current block.
[0090] The current block refers to the coding unit (CU) currently being encoded, which can also be called a CU block. The CU block is a leaf node on the coding tree structure.
[0091] Optionally, the size of the current block may be 32×32, 16×16, 8×8 or 4×4, and the embodiment of the present application does not limit the size of the current block.
[0092] The original pixel refers to the pixel before the current block is encoded, and the neighborhood pixel refers to the pixel of the neighborhood block of the current block.
[0093] In some embodiments, the neighboring block may refer to a block in a row above and a column to the left of the current block. For example, if the size of the current block is 2N×2N, the size of the neighboring block in the row above is 1×(2N+1), and the size of the neighboring block in the column to the left is (2N+1)×1.
[0094] In some embodiments, the neighborhood block may also refer to the block three rows above and three columns to the left of the current block. It should be noted that the neighborhood block may have any other possible settings. For example, those skilled in the art may set the size, number of rows, number of columns or position of the neighborhood block in any possible way. This application does not impose any limitation on the specific setting method of the neighborhood block.
[0095] In step S22, the intra-coding pre-selection Pre-intra unit 420 determines the best 9 Intra candidate prediction modes (Top 9) from different Intra prediction modes.
[0096] In some embodiments, Pre-intra is used to calculate the coding costs corresponding to different Intra prediction modes, and the Top N (such as Top 9) Intra prediction modes with the smallest coding costs are used as Intra candidate prediction modes.
[0097] The number of different Intra prediction modes can be as follows: Figure 1The 67 types shown by the solid arrows may also be other values greater or less than 67. For example, Figure 1 The fractional angle mode represented by the dotted arrow is used as the Intra prediction mode. The specific number and setting method of the Intra prediction mode are not limited in this application.
[0098] In some embodiments, the Intra prediction mode includes at least an Intra horizontal prediction mode and an Intra vertical prediction mode. Therefore, Pre-intra can be used to calculate the coding cost corresponding to the Intra horizontal prediction mode and the coding cost corresponding to the Intra vertical prediction mode.
[0099] Step S23 , the intra-frame coding pre-selection Pre-intra unit 420 determines a BDPCM candidate prediction mode from the BDPCM prediction modes based on the coding cost corresponding to the target Intra prediction mode in the Intra prediction mode.
[0100] The BDPCM candidate prediction mode is a BDPCM horizontal prediction mode (expressed as hor) or a BDPCM vertical prediction mode (expressed as ver), and the determined BDPCM candidate prediction mode is expressed as Figure 4 The Top 1 in represents.
[0101] In some embodiments, Pre-intra is also used to determine the coding tendency direction based on the coding cost corresponding to the target Intra prediction mode in the Intra prediction mode; and determine the BDPCM prediction mode matching the coding tendency direction as the BDPCM candidate prediction mode.
[0102] In one possible implementation, the target Intra prediction mode includes an Intra horizontal prediction mode and an Intra vertical prediction mode. In another possible implementation, the target Intra prediction mode includes a horizontal prediction mode and a vertical prediction mode. For more information about the horizontal prediction mode and the vertical prediction mode, see Figure 8 And the related description will not be repeated here.
[0103] In step S24, for the nine Intra candidate prediction modes (Intra(9)) and the BDPCM candidate prediction mode (one of the BDPCM horizontal prediction mode or the BDPCM vertical prediction mode, represented by BDPCM(hor||ver)), a set of MD units is required for calculating the rate-distortion loss.
[0104] A set of MD units includes a Pred unit 430, a TQ / IQT unit, an RDOQ unit 440, and an RDO unit 450. The TQ / IQT unit includes a Transform, a Quantization, an InverseQuantization, and an Inverse Transform unit. The RDO unit 450 includes an EstimateRate unit and a Calculate Rdcost unit.
[0105] In some embodiments, the TQ / IQT unit and the RDOQ unit 440 are used to calculate 9 Intra candidate prediction modes (Intra(9)) based on the original pixels of the current block, as well as the values corresponding to the Residual, Coefficient and distortion of the BDPCM candidate prediction modes.
[0106] In some embodiments, the RDO unit 450 is used to determine the rate-distortion loss corresponding to the above-mentioned various prediction modes based on 9 Intra candidate prediction modes (Intra(9)) and the values corresponding to the Residual, Coefficient and distortion of the BDPCM candidate prediction modes.
[0107] In some embodiments, the hardware encoder determines the prediction mode corresponding to the minimum rate-distortion loss in the candidate prediction mode set as the best prediction mode.
[0108] Depend on Figure 4 It can be seen that, using the video encoding method proposed in this application, for BDPCM, only one set of complete MD resources is needed to calculate the corresponding rate-distortion loss in the BDPCM horizontal prediction mode or the BDPCM vertical prediction mode. Figure 4 The CCP needs 9+1=10 sets of MD units.
[0109] contrast Figure 2 and Figure 4 It can be seen that when the number of Intra candidate prediction modes is 9, Figure 2 In the related art, 11 sets of MD resources are needed to calculate the rate-distortion loss corresponding to the optimal 9 Intra candidate prediction modes, BDPCM horizontal prediction mode, and BDPCM vertical prediction mode; Figure 4In the video encoding method proposed in this application, only 10 sets of MD resources are needed to calculate the optimal 9 Intra candidate prediction modes and the rate-distortion loss corresponding to the BDPCM candidate prediction mode. Since the MD unit is the most resource- and time-consuming unit in the hardware encoder, saving a complete set of MD units can significantly save hardware costs; at the same time, since the target Intra prediction mode guides the direction of the BDPCM prediction mode, the video encoding method proposed in this application still guarantees the encoding quality, and the BDPCM encoding is cost-effective.
[0110] Step S25, intra-frame encoding is performed on the current block based on the optimal prediction mode, and the intra-frame encoding result of the current block is processed through a loop filter 460 (LoopFilter) and an entropy encoder 470 (CABAC) to obtain a bit stream.
[0111] It should be noted that LoopFilter and CABAC are only one of the possible implementation methods. Those skilled in the art can understand that other types of filters or entropy encoders can also be used in hardware encoders. The embodiments of the present application do not impose any restrictions on the specific types of filters or entropy encoders.
[0112] In one possible scenario, the hardware encoder includes multiple intra-frame coding tools, which may include IBC or other types of intra-frame coding tools in addition to Intra and BDPCM. The following takes the example of the hardware encoder also including IBC to illustrate the determination of the best prediction mode from the candidate prediction mode set. It can be understood by those skilled in the art that other intra-frame coding tools may include one or more intra-frame coding tools other than Intra and BDPCM, and the present application does not impose any restrictions on the specific types and quantities of other intra-frame coding tools.
[0113] When other intra-coding tools also include IBC, the candidate prediction mode set includes the IBC candidate prediction mode in addition to the Intra candidate prediction mode and the BDPCM candidate prediction mode.
[0114] The IBC candidate prediction modes may be one or more optimal prediction modes selected from the IBC prediction modes.
[0115] See also Figure 5 , Figure 5 It is a schematic diagram of intra-frame coding based on intra-frame coding tools such as intra, BDPCM and IBC in the related art.
[0116] like Figure 5As shown, the intra-frame coding pre-selection Pre-intra unit 521 corresponding to intra determines the optimal 9 Intra candidate prediction modes from different Intra prediction modes based on the original pixels and neighboring pixels of the current block obtained by Data Fetch. The intra-frame coding pre-selection Pre-IBC unit 522 corresponding to IBC determines the optimal 2 IBC candidate prediction modes from different IBC prediction modes based on the original pixels and neighboring pixels of the current block obtained by Data Fetch. It should be noted that the optimal 9 or 2 candidate prediction modes are only examples, and the number of candidate prediction modes corresponding to different intra-frame coding tools can be set by those skilled in the art as needed.
[0117] In the related art, for 9 Intra candidate prediction modes (Intra(9)), 2 IBC candidate prediction modes (IBC(2)), BDPCM horizontal prediction mode, and BDPCM vertical prediction mode, a complete set of MD units is required to calculate the rate-distortion loss corresponding to each prediction mode. That is, 9+2+1+1=13 sets of MD units are required in the related art.
[0118] See also Figure 6 , Figure 6 It is a schematic diagram of intra-frame coding based on intra-frame coding tools such as intra, BDPCM and IBC provided by an exemplary embodiment of the present application.
[0119] like Figure 6 As shown, the intra-frame coding pre-selection Pre-intra unit 621 corresponding to intra determines the best 9 Intra candidate prediction modes from different Intra prediction modes based on the original pixels and neighboring pixels of the current block obtained by Data Fetch, and determines the BDPCM candidate prediction mode as the BDPCM horizontal prediction mode or the BDPCM vertical prediction mode (Top 1) from the BDPCM prediction mode based on the encoding cost corresponding to the target Intra prediction mode in the Intra prediction mode; the intra-frame coding pre-selection Pre-IBC unit 622 corresponding to IBC determines the best 2 IBC candidate prediction modes from different IBC prediction modes based on the original pixels and neighboring pixels of the current block obtained by Data Fetch.
[0120] Since there is only one BDPCM candidate prediction mode (BDPCM horizontal prediction mode or BDPCM vertical prediction mode), one complete set of MD units can be saved. Figure 6 In the video encoding method proposed in this application, 9+2+1=12 sets of MD units are required, and Figure 5Compared with the related technology, one set of MD units is reduced. Therefore, when the hardware encoder includes other intra-frame coding tools, a set of MD hardware resources in BDPCM can also be saved, thereby improving the encoding cost-effectiveness of BDPCM.
[0121] See also Figure 7 , Figure 7 FIG. 1 is a flowchart of determining a BDPCM candidate prediction mode provided by an exemplary embodiment of the present application. The flowchart includes the following steps.
[0122] Step 710: determine a first coding cost of the Intra prediction mode in the horizontal direction and a second coding cost of the Intra prediction mode in the vertical direction.
[0123] The Intra prediction mode in the horizontal direction refers to an Intra prediction mode that can reflect prediction information in the horizontal direction; and the Intra prediction mode in the vertical direction refers to an Intra prediction mode that can reflect prediction information in the vertical direction.
[0124] In some embodiments, the Intra prediction mode in the horizontal direction includes the Intra horizontal prediction mode (ie Figure 1 In some embodiments, the coding cost corresponding to the Intra horizontal prediction mode can be determined as the first coding cost. For example, Pre-intra can perform intra-frame coding on the current block according to the Intra horizontal prediction mode, and determine the coding cost corresponding to the Intra horizontal prediction mode as the first coding cost based on the difference between the coding result and the original pixel.
[0125] In some embodiments, the Intra prediction mode in the vertical direction includes the Intra vertical prediction mode (ie Figure 1 In some embodiments, the coding cost corresponding to the Intra vertical prediction mode may be determined as the second coding cost. For example, Pre-intra may perform intra-frame coding on the current block according to the Intra vertical prediction mode, and determine the coding cost corresponding to the Intra vertical prediction mode as the second coding cost based on the difference between the coding result and the original pixel.
[0126] In some other embodiments, the Intra prediction mode in the horizontal direction includes a horizontal-like prediction mode, and the Intra prediction mode in the vertical direction includes a vertical-like prediction mode.
[0127] Among them, the mode number difference between the horizontal prediction mode and the Intra horizontal prediction mode is less than the difference threshold, and the mode number difference between the vertical prediction mode and the Intra vertical prediction mode is less than the difference threshold.
[0128] The difference threshold may be a value preset by the hardware encoder, for example, the difference threshold may be 16 or 2.
[0129] After determining the horizontal prediction mode and the vertical prediction mode, the first coding cost can be determined based on the coding cost corresponding to the horizontal prediction mode in the Intra prediction mode, and the second coding cost can be determined based on the coding cost corresponding to the vertical prediction mode in the Intra prediction mode.
[0130] See also Figure 8 , Figure 8 It is a schematic diagram of a horizontal prediction mode and a vertical prediction mode provided by an exemplary embodiment of the present application.
[0131] like Figure 8 As shown, the prediction direction represented by number 18 is the horizontal direction, and the prediction direction represented by number 50 is the vertical direction.
[0132] In some embodiments, the difference threshold is 16, and the numbers between 2 and 34 can all represent horizontal prediction modes, and the numbers between 34 and 66 can all represent vertical prediction modes.
[0133] In some other embodiments, the difference threshold is 2, and the numbers between 16 and 20 can all represent horizontal prediction modes, and the numbers between 48 and 52 can all represent vertical prediction modes.
[0134] It is understandable that the difference threshold may also be other values, and those skilled in the art may set the difference threshold as required.
[0135] In some embodiments, in addition to representing the prediction modes corresponding to different prediction directions by numbers, different prediction modes may also be represented by angles or other identifiers.
[0136] To determine the first encoding cost and the second encoding cost, different prediction modes may have different weights.
[0137] In some embodiments, the horizontal weighted weights corresponding to each horizontal prediction mode can be determined; and the encoding costs corresponding to the horizontal prediction modes are weighted and summed based on the horizontal weighted weights to obtain a first encoding cost; the vertical weighted weights corresponding to each vertical prediction mode are determined; and the encoding costs corresponding to the vertical prediction modes are weighted and summed based on the vertical weighted weights to obtain a second encoding cost.
[0138] In order to make the first coding cost reflect the prediction information in the horizontal direction as much as possible, and the second coding cost reflect the prediction information in the vertical direction as much as possible. In some embodiments, the horizontal weighted weight corresponding to the horizontal prediction mode is negatively correlated with the mode number difference; the vertical weighted weight corresponding to the vertical prediction mode is negatively correlated with the mode number difference.
[0139] For example only, Figure 8 In the example, if the horizontal prediction modes are prediction modes represented by numbers 16, 17, 18, 19, and 20, and the vertical prediction modes are prediction modes represented by numbers 48, 49, 50, 51, and 52, the horizontal weighted weights corresponding to numbers 16-20 can be determined based on the difference between numbers 16-20 and 18, and the vertical weighted weights corresponding to numbers 16-20 are 0.1, 0.15, 0.5, 0.15, and 0.1, respectively; the vertical weighted weights corresponding to numbers 48-52 can be determined based on the difference between numbers 48-52 and 50, and are 0.1, 0.15, 0.5, 0.15, and 0.1, respectively.
[0140] For example, the coding costs corresponding to numbers 16-20 are 32, 10, 8, 20, and 8 respectively, and the weighted first coding cost is 12.5; the coding costs corresponding to numbers 48-52 are 20, 20, 4, 10, and 5 respectively, and the weighted second coding cost is 9.
[0141] Step 721, when the first coding cost is less than or equal to the second coding cost, determining the BDPCM candidate prediction mode as the BDPCM horizontal prediction mode;
[0142] Step 722: when the first coding cost is greater than the second coding cost, the BDPCM candidate prediction mode is determined as the BDPCM vertical prediction mode.
[0143] For example, in the above example, the first coding cost 12.5 is greater than the second coding cost 9, so the BDPCM candidate prediction mode is determined to be the BDPCM vertical prediction mode.
[0144] Regarding the determination method of the horizontal weighting weight or the vertical weighting weight, in some embodiments, it can also be obtained by fitting through a large amount of experimental data. For example, the rate-distortion loss corresponding to the BDPCM horizontal prediction mode and the BDPCM vertical prediction mode can be calculated for multiple sample blocks by two sets of MD units through the method in the related art to determine the corresponding BDPCM candidate prediction mode label, and the weight fitting model is trained based on the multiple sample blocks and the BDPCM candidate prediction mode label, wherein the weight fitting model can be a machine learning model for determining the horizontal weighting weight and the vertical weighting weight based on the rate-distortion loss corresponding to different prediction modes.
[0145] In this embodiment, by adopting different horizontal weighting weights for different horizontal prediction modes and different vertical weighting weights for different vertical prediction modes, the prediction information of the Intra horizontal and vertical directions can be better reflected, thereby guiding BDPCM to determine a more accurate BDPCM candidate prediction mode, thereby improving the encoding quality.
[0146] To further improve the accuracy of BDPCM candidate prediction modes, see Fig. 9 , Fig. 9 FIG. 1 is a flowchart of determining a BDPCM candidate prediction mode provided by another exemplary embodiment of the present application. The flowchart includes the following steps.
[0147] Step 910: determine a first coding cost of the Intra prediction mode in the horizontal direction and a second coding cost of the Intra prediction mode in the vertical direction.
[0148] For more details on determining the first coding cost and the second coding cost, please refer to the description in the previous embodiment, which will not be repeated here.
[0149] Step 920: Determine whether the difference between the first encoding cost and the second encoding cost is greater than a cost threshold.
[0150] Optionally, the cost threshold is a fixed value set by the hardware encoder, such as 10.
[0151] If so, execute step 930.
[0152] If not, execute step 950.
[0153] Step 930, determining whether the first encoding cost is greater than the second encoding cost.
[0154] If yes, execute step 941 to determine the BDPCM candidate prediction mode as the BDPCM vertical prediction mode.
[0155] If not, execute step 942 to determine the BDPCM candidate prediction mode as the BDPCM horizontal prediction mode.
[0156] Step 950: determine at least one neighboring block around the current block.
[0157] In some embodiments, the neighborhood block may be a block above the current block, or a block to the left of the current block. In some embodiments, the neighborhood block may be a block whose distance from the current block is less than a distance threshold. The size of the neighborhood block may be the same or different from that of the current block.
[0158] Step 961: Determine the BDPCM candidate prediction mode corresponding to the current block based on the BDPCM candidate prediction modes corresponding to the neighboring blocks of the current block.
[0159] When the number of neighboring blocks is 1, the BDPCM candidate prediction mode corresponding to the neighboring block can be directly used as the BDPCM candidate prediction mode corresponding to the current block. For example, if the BDPCM candidate prediction mode corresponding to the neighboring block is a BDPCM horizontal prediction mode, then the BDPCM candidate prediction mode corresponding to the current block is also a BDPCM horizontal prediction mode.
[0160] When the number of the neighboring blocks is 2 or more, the BDPCM candidate prediction modes corresponding to the neighboring blocks may be counted to obtain a first number and a second number.
[0161] The first number is the number of neighboring blocks using the BDPCM horizontal prediction mode, and the second number is the number of neighboring blocks using the BDPCM vertical prediction mode.
[0162] For example, the current block has 8 neighboring blocks, 3 of which adopt the BDPCM horizontal prediction mode and 5 adopt the BDPCM vertical prediction mode. Then the first number is 3 and the second number is 5.
[0163] When the first number is greater than the second number, the BDPCM candidate prediction mode corresponding to the current block is determined to be the BDPCM horizontal prediction mode; when the first number is less than or equal to the second number, the BDPCM candidate prediction mode corresponding to the current block is determined to be the BDPCM vertical prediction mode.
[0164] Step 962, based on the third coding cost corresponding to the Intra prediction mode of the neighboring blocks of the current block in the horizontal direction and the fourth coding cost corresponding to the Intra prediction mode in the vertical direction, determine the BDPCM candidate prediction mode corresponding to the current block.
[0165] Similarly, the third coding cost can be the coding cost corresponding to the Intra horizontal prediction mode in the process of intra-frame encoding of the neighboring blocks, or the coding cost obtained by weighting the coding costs of different horizontal prediction modes; the fourth coding cost can be the coding cost corresponding to the Intra vertical prediction mode in the process of intra-frame encoding of the neighboring blocks, or the coding cost obtained by weighting the coding costs of different vertical prediction modes.
[0166] In a possible implementation, the weight of the neighboring block may be determined according to the distance between the neighboring block and the current block, wherein the length of the line between the center of the neighboring block and the center of the current block may be determined as the distance between the neighboring block and the current block, or the shortest line length between the neighboring block and the current block may be determined as the distance.
[0167] For example, the distance between the neighbor block A and the current block is 32, and the distance between the neighbor block B and the current block is 8. The neighborhood block weight of the neighbor block A can be determined to be 0.8, and the neighborhood block weight of the neighbor block B can be determined to be 0.2.
[0168] After determining the neighborhood block weights of different neighborhood blocks, different third coding costs can be weighted and summed based on different neighborhood block weights to obtain the neighborhood horizontal coding cost, and different fourth coding costs can be weighted and summed based on different neighborhood block weights to obtain the neighborhood vertical coding cost.
[0169] For example, the third coding cost corresponding to neighborhood block A is 22, and the fourth coding cost is 5; the third coding cost corresponding to neighborhood block B is 7, and the fourth coding cost is 14. Then, the neighborhood horizontal coding cost obtained after weighting based on the neighborhood block weights is 19, and the neighborhood vertical coding cost is 6.8.
[0170] In some embodiments, the BDPCM candidate prediction mode corresponding to the current block can be determined based on the neighborhood horizontal coding cost and the neighborhood vertical coding cost. When the neighborhood horizontal coding cost is less than or equal to the neighborhood vertical coding cost, the BDPCM candidate prediction mode is determined as the BDPCM horizontal prediction mode;
[0171] When the neighborhood horizontal coding cost is greater than the neighborhood vertical coding cost, the BDPCM candidate prediction mode is determined as the BDPCM vertical prediction mode.
[0172] In another possible implementation, the BDPCM candidate prediction mode corresponding to the current block may also be determined based on the sum of the third coding cost and the first coding cost, and the sum of the fourth coding cost and the second coding cost. For example, when the sum of the third coding cost and the first coding cost is greater, the BDPCM candidate prediction mode corresponding to the current block is determined to be the BDPCM vertical prediction mode.
[0173] In this embodiment, when the cost difference between the first coding cost and the second coding cost is less than the cost threshold, the BDPCM candidate prediction mode of the current block is determined in combination with the BDPCM directional decision information corresponding to the neighboring block, which can further improve the accuracy of the BDPCM candidate prediction mode to improve the intra-frame coding quality of the current block.
[0174] See also Fig.10 , Fig.10 is a structural block diagram of a hardware encoder provided by an exemplary embodiment of the present application. Fig.10 As shown, the hardware encoder includes components such as an intra-frame coding pre-selection Pre-intra unit 1001, an intra-frame coding intra unit 1002, a block differential pulse code modulation BDPCM unit 1003, a filter 1004, and an entropy encoder 1005.
[0175] The intra-frame coding pre-selection Pre-intra unit 1001 is used to determine, for each current block in a video frame, an Intra candidate prediction mode of the current block from a plurality of Intra prediction modes based on the coding costs corresponding to different Intra prediction modes.
[0176] At the same time, the intra-frame coding pre-selection Pre-intra unit 1001 is also used to determine the BDPCM candidate prediction mode of the current block from the BDPCM prediction mode based on the coding costs corresponding to at least two target Intra prediction modes in the Intra prediction mode, wherein the BDPCM candidate prediction mode is the BDPCM horizontal prediction mode or the BDPCM vertical prediction mode.
[0177] The intra-frame coding unit 1002 is used to perform spatial prediction through original pixels of the current block and neighboring pixels to generate a coding result of intra-frame coding for the current block.
[0178] In some embodiments, the intra-coding unit 1002 includes multiple sets of MD units, which are used to respectively calculate rate-distortion losses corresponding to multiple Intra candidate prediction modes.
[0179] In some embodiments, the block differential pulse code modulation (BDPCM) unit 1003 includes a set of MD units for calculating the rate-distortion loss corresponding to the BDPCM candidate prediction mode.
[0180] Therefore, both the intra-frame coding intra unit 1002 and the block differential pulse code modulation BDPCM unit 1003 are provided with an MD unit, and the MD unit is used to determine the best prediction mode from the candidate prediction mode set, wherein the candidate prediction mode set includes the Intra candidate prediction mode and the BDPCM candidate prediction mode.
[0181] The MD unit is also used to obtain the intra-frame encoding result of the current block in the best prediction mode.
[0182] A set of MD units includes a Pred (Prediction) unit, a TQ / IQT (Transform and Quantization / Inverse Quantization and inverse Transform) unit, an RDOQ (Rate Distortion Optimization Quantization) unit, and an RDO (Rate Distortion Optimization) unit. In some embodiments, the number of MD units in the intra unit 1002 is the same as the number of Intra candidate prediction modes.
[0183] The block differential pulse code modulation BDPCM unit 1003 is based on the block-level intra-frame prediction for screen content developed in VVC. In some implementations, the use of BDPCM requires passing bdpcm_flag during encoding. When bdpcm_flag=1, the BDPCM prediction residual signal can be calculated by performing horizontal or vertical BDPCM prediction on the quantized residual signal for each block.
[0184] In the hardware encoder proposed in this application, the block differential pulse code modulation BDPCM unit 1003 includes only one set of MD units for calculating the rate distortion loss corresponding to the BDPCM candidate prediction mode, wherein the BDPCM candidate prediction mode is one of the BDPCM horizontal prediction mode and the BDPCM vertical prediction mode.
[0185] The filter 1004 is used to receive the intra-frame coding result obtained by intra-frame coding the current block, and process the intra-frame coding result through a deblocking filter, a sample adaptive offset or an adaptive loop filter.
[0186] The entropy encoder 1005 is used to utilize the entropy redundancy between information, and represents the large amount of information with a long code stream and the small amount of information with a short code stream, thereby compressing the data. The bit stream output by the entropy encoder 1005 can be stored in a computer-readable storage medium, or sent to the outside through a wired or wireless transmission channel.
[0187] It should be noted that the above embodiment only describes a possible architecture of the hardware encoder, and the hardware encoder may also include more or fewer components, or combine certain components, which is not limited by this embodiment. For example, the hardware encoder may also include other components such as IBC, inter-frame prediction unit, buffer, etc.
[0188] The present application also provides a computer device, see Fig.11, Fig.11 It is a structural block diagram of a computer device provided by an exemplary embodiment of the present application.
[0189] Specifically, the computer device 1100 includes a central processing unit (CPU) 1101, a system memory 1104 including a random access memory 1102 and a read-only memory 1103, and a system bus 1105 connecting the system memory 1104 and the central processing unit 1101. The computer device 1100 also includes a basic input / output system (I / O system) 1106 for facilitating information transmission between various components in the computer, and a large-capacity storage device 1107 for storing an operating system 1113, application programs 1114, and other program modules 1115.
[0190] The computer device also includes a hardware encoder 1116 that can execute the video encoding method proposed in the present application.
[0191] The basic input / output system 1106 includes a display 1108 for displaying information and an input device 1109 such as a mouse and a keyboard for user inputting information. The display 1108 and the input device 1109 are connected to the central processing unit 1101 through an input / output controller 1110 connected to the system bus 1105. The basic input / output system 1106 may also include an input / output controller 1110 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 1110 also provides output to a display screen, a printer, or other types of output devices.
[0192] The mass storage device 1107 is connected to the central processing unit 1101 through a mass storage controller (not shown) connected to the system bus 1105. The mass storage device 1107 and its associated computer readable media provide non-volatile storage for the computer device 1100. That is, the mass storage device 1107 may include a computer readable medium (not shown) such as a hard disk or drive.
[0193] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include random access memory (RAM), read-only memory (ROM), flash memory or other solid-state storage technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, cassette, magnetic tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above. The above-mentioned system memory 1104 and mass storage device 1107 can be collectively referred to as memory.
[0194] The memory stores one or more programs, and the one or more programs are configured to be executed by one or more central processing units 1101. The one or more programs contain instructions for implementing the above-mentioned methods. The central processing unit 1101 executes the one or more programs to implement the methods provided by the above-mentioned various method embodiments.
[0195] According to various embodiments of the present application, the computer device 1100 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 1100 can be connected to the network 1112 through the network interface unit 1111 connected to the system bus 1105, or the network interface unit 1111 can be used to connect to other types of networks or remote computer systems (not shown).
[0196] The memory also includes one or more programs, which are stored in the memory and include steps executed by a computer device in the method provided in the embodiment of the present application.
[0197] An embodiment of the present application provides a video codec chip, which includes a hardware encoder as described in the above aspects.
[0198] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A video encoding method, characterized in that: The method is performed by a hardware encoder, and the method comprises: For each current block in the video frame, determining an Intra candidate prediction mode of the current block from a plurality of Intra prediction modes based on encoding costs corresponding to different Intra prediction modes; Determine a BDPCM candidate prediction mode of the current block from the BDPCM prediction modes based on coding costs corresponding to at least two target Intra prediction modes in the Intra prediction modes, wherein the BDPCM candidate prediction mode is a BDPCM horizontal prediction mode or a BDPCM vertical prediction mode; Determine the best prediction mode from a candidate prediction mode set, wherein the candidate prediction mode set includes the Intra candidate prediction mode and the BDPCM candidate prediction mode; Obtain an intra-frame encoding result of the current block in the optimal prediction mode.
2. The method according to claim 1, characterized in that The determining of the BDPCM candidate prediction mode from the BDPCM prediction mode based on the coding cost corresponding to the target Intra prediction mode in the Intra prediction mode includes: Determine a first coding cost of the Intra prediction mode in a horizontal direction and a second coding cost of the Intra prediction mode in a vertical direction; In a case where the first coding cost is less than or equal to the second coding cost, determining the BDPCM candidate prediction mode as the BDPCM horizontal prediction mode; When the first encoding cost is greater than the second encoding cost, the BDPCM candidate prediction mode is determined as the BDPCM vertical prediction mode.
3. The method according to claim 2, characterized in that The determining of a first coding cost of the Intra prediction mode in a horizontal direction and a second coding cost of the Intra prediction mode in a vertical direction includes: Determine the coding cost corresponding to the Intra horizontal prediction mode as the first coding cost; The coding cost corresponding to the Intra vertical prediction mode is determined as the second coding cost.
4. The method according to claim 2, characterized in that: The determining of a first coding cost of the Intra prediction mode in a horizontal direction and a second coding cost of the Intra prediction mode in a vertical direction includes: Determining the first coding cost based on the coding cost corresponding to the horizontal class prediction mode in the Intra prediction mode, wherein the mode number difference between the horizontal class prediction mode and the Intra horizontal prediction mode is less than a difference threshold; The second coding cost is determined based on the coding cost corresponding to the vertical class prediction mode in the Intra prediction mode, wherein a mode number difference between the vertical class prediction mode and the Intra vertical prediction mode is less than a difference threshold.
5. The method according to claim 4, characterized in that The determining the first coding cost based on the coding cost corresponding to the horizontal class prediction mode in the Intra prediction mode includes: Determining the horizontal weighting weights corresponding to the horizontal class prediction modes; Performing weighted summation on the encoding costs corresponding to the horizontal class prediction modes based on the horizontal weighted weights to obtain the first encoding cost; The determining the second coding cost based on the coding cost corresponding to the vertical prediction mode in the Intra prediction mode includes: Determine the vertical weighting weights corresponding to the vertical prediction modes; The encoding costs corresponding to the vertical class prediction mode are weightedly summed based on the vertical weighted weight to obtain the second encoding cost.
6. The method according to claim 5, characterized in that The horizontal weight corresponding to the horizontal class prediction mode is negatively correlated with the mode number difference; The vertical weight corresponding to the vertical prediction mode is negatively correlated with the mode number difference.
7. The method according to claim 2, characterized in that The step of determining the BDPCM candidate prediction mode as the BDPCM horizontal prediction mode when the first encoding cost is less than or equal to the second encoding cost includes: When the first coding cost is less than or equal to the second coding cost, and the coding cost difference between the first coding cost and the second coding cost is greater than a cost threshold, determining the BDPCM candidate prediction mode as the BDPCM horizontal prediction mode; The step of determining the BDPCM candidate prediction mode as the BDPCM vertical prediction mode when the first encoding cost is greater than the second encoding cost includes: When the first coding cost is greater than the second coding cost and the coding cost difference between the first coding cost and the second coding cost is greater than the cost threshold, the BDPCM candidate prediction mode is determined as the BDPCM vertical prediction mode.
8. A hardware encoder, characterized in that: The hardware encoder includes: A Pre-intra unit for intra-frame coding preselection is used to determine, for each current block in a video frame, an Intra candidate prediction mode of the current block from a plurality of Intra prediction modes based on coding costs corresponding to different Intra prediction modes; The Pre-intra unit is further configured to determine a BDPCM candidate prediction mode of the current block from the BDPCM prediction modes based on coding costs corresponding to at least two target Intra prediction modes in the Intra prediction modes, wherein the BDPCM candidate prediction mode is a BDPCM horizontal prediction mode or a BDPCM vertical prediction mode; An MD unit, configured to determine an optimal prediction mode from a candidate prediction mode set, wherein the candidate prediction mode set includes the Intra candidate prediction mode and the BDPCM candidate prediction mode; The MD unit is further used to obtain the intra-frame encoding result of the current block in the optimal prediction mode.
9. The hardware encoder according to claim 8, characterized in that: The Pre-intra unit is also used to: Determine a first coding cost of the Intra prediction mode in a horizontal direction and a second coding cost of the Intra prediction mode in a vertical direction; In a case where the first coding cost is less than or equal to the second coding cost, determining the BDPCM candidate prediction mode as the BDPCM horizontal prediction mode; When the first encoding cost is greater than the second encoding cost, the BDPCM candidate prediction mode is determined as the BDPCM vertical prediction mode.
10. The hardware encoder according to claim 9, characterized in that: The Pre-intra unit is also used to: Determine the coding cost corresponding to the Intra horizontal prediction mode as the first coding cost; The coding cost corresponding to the Intra vertical prediction mode is determined as the second coding cost.
11. The hardware encoder according to claim 9, characterized in that: The Pre-intra unit is also used to: Determining the first coding cost based on the coding cost corresponding to the horizontal class prediction mode in the Intra prediction mode, wherein the mode number difference between the horizontal class prediction mode and the Intra horizontal prediction mode is less than a difference threshold; The second coding cost is determined based on the coding cost corresponding to the vertical class prediction mode in the Intra prediction mode, wherein a mode number difference between the vertical class prediction mode and the Intra vertical prediction mode is less than a difference threshold.
12. The hardware encoder according to claim 11, characterized in that: The Pre-intra unit is also used to: Determining the horizontal weighting weights corresponding to the horizontal class prediction modes; Performing weighted summation on the encoding costs corresponding to the horizontal class prediction modes based on the horizontal weighted weights to obtain the first encoding cost; Determine the vertical weighting weights corresponding to the vertical prediction modes; The encoding costs corresponding to the vertical class prediction mode are weightedly summed based on the vertical weighted weight to obtain the second encoding cost.
13. The hardware encoder according to claim 12, characterized in that: The horizontal weight corresponding to the horizontal class prediction mode is negatively correlated with the mode number difference; The vertical weight corresponding to the vertical prediction mode is negatively correlated with the mode number difference.
14. The hardware encoder according to claim 9, characterized in that: The Pre-intra unit is also used to: When the first coding cost is less than or equal to the second coding cost, and the coding cost difference between the first coding cost and the second coding cost is greater than a cost threshold, determining the BDPCM candidate prediction mode as the BDPCM horizontal prediction mode; When the first coding cost is greater than the second coding cost and the coding cost difference between the first coding cost and the second coding cost is greater than the cost threshold, the BDPCM candidate prediction mode is determined as the BDPCM vertical prediction mode.
15. The hardware encoder according to claim 14, characterized in that: The Pre-intra unit is also used to: When the coding cost difference between the first coding cost and the second coding cost is less than or equal to the cost threshold, the BDPCM candidate prediction mode corresponding to the current block is determined based on the BDPCM candidate prediction mode corresponding to the neighboring block of the current block.
16. The hardware encoder according to claim 15, characterized in that: The MD unit is further used for: Counting the BDPCM candidate prediction modes corresponding to the neighboring blocks to obtain a first number and a second number, wherein the first number is the number of neighboring blocks that adopt the BDPCM horizontal prediction mode, and the second number is the number of neighboring blocks that adopt the BDPCM vertical prediction mode; In a case where the first number is greater than the second number, determining that the BDPCM candidate prediction mode corresponding to the current block is the BDPCM horizontal prediction mode; When the first number is less than or equal to the second number, the BDPCM candidate prediction mode corresponding to the current block is determined to be the BDPCM vertical prediction mode.
17. The hardware encoder according to claim 14, characterized in that: The Pre-intra unit is also used to: When the coding cost difference between the first coding cost and the second coding cost is less than or equal to the cost threshold, the BDPCM candidate prediction mode corresponding to the current block is determined based on the third coding cost corresponding to the Intra prediction mode in the horizontal direction of the neighboring block of the current block and the fourth coding cost corresponding to the Intra prediction mode in the vertical direction.
18. The hardware encoder according to claim 17, characterized in that: The Pre-intra unit is also used to: Determine a neighborhood block weight according to a distance between the neighborhood block and the current block; Based on the neighborhood block weight, weighted summing the third coding costs of the neighborhood blocks to obtain a neighborhood horizontal coding cost, and based on the neighborhood block weight, weighted summing the fourth coding costs of the neighborhood blocks to obtain a neighborhood vertical coding cost; In a case where the neighborhood horizontal coding cost is less than or equal to the neighborhood vertical coding cost, determining the BDPCM candidate prediction mode as the BDPCM horizontal prediction mode; In a case where the neighborhood horizontal coding cost is greater than the neighborhood vertical coding cost, the BDPCM candidate prediction mode is determined as the BDPCM vertical prediction mode.
19. A video codec chip, characterized in that: The video codec chip comprises the hardware encoder as described in any one of claims 8 to 18.
20. A computer device, characterized in that: The computer device is provided with a hardware encoder as claimed in any one of claims 8 to 18.
