Video coding method, device and equipment and computer readable storage medium

By determining the target cost based on the motion vector in video encoding and screening the target prediction mode for rate-distortion optimization, the problem of time-consuming calculation of the inter-frame prediction mode in the existing technology is solved, and a more efficient video encoding process is achieved.

CN120676167APending Publication Date: 2025-09-19MALANSHAN AUDIO & VIDEO LABORATORY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511001915.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-21
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

In existing video coding technologies, the rate-distortion optimization calculation of the inter-frame prediction mode is too time-consuming, resulting in low coding efficiency and difficulty in application in real-time coding scenarios.

Method used

By determining the motion vector corresponding to the prediction mode and determining the target cost based on the motion vector, a target prediction mode is screened out from a preset number of prediction modes for rate-distortion optimization, and a complete RDO calculation is performed only on the screened modes.

Benefits of technology

The coding efficiency of video encoding is improved, and unnecessary rate-distortion optimization calculation time is reduced, thereby improving the speed and efficiency of the encoding process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120676167A_ABST
    Figure CN120676167A_ABST
Patent Text Reader

Abstract

The invention discloses a video coding method, device and equipment and a computer readable storage medium, which are applied to the video coding method, device and equipment and the readable storage medium, and comprise the following steps: determining a motion vector corresponding to a prediction mode; determining a target cost corresponding to the prediction mode based on the motion vector; and determining a target prediction mode from a preset number of prediction modes based on the target cost, performing rate-distortion optimization on the target prediction mode to obtain an optimal coding parameter, and performing video coding based on the optimal coding parameter, wherein the preset number is greater than 1. Compared with the prior art that rate-distortion optimization needs to be carried out on all prediction modes, the prediction modes can be screened based on the target cost determined by the motion vector to obtain the target prediction mode, so that only rate-distortion optimization needs to be carried out on the target prediction mode, and rate-distortion optimization does not need to be carried out on all prediction modes; therefore, the AVS3 coding speed is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of video coding technology, and in particular to a video coding method, apparatus, device, and computer-readable storage medium. Background Art

[0002] Inter-frame prediction is a core technology in modern video coding standards such as AVS3, H.266 / VVC, and AV1. To achieve optimal coding performance, encoders typically need to perform rate-distortion optimization (RDO) on multiple inter-frame prediction modes. Traditional AVS3 encoders require complete RDO calculations for all candidate modes, but the excessive number of candidate mode tests results in excessive encoding time and makes it difficult to apply in real-time coding scenarios.

[0003] It can be seen that how to improve the encoding efficiency of an encoder is a technical problem that those skilled in the art urgently need to solve. Summary of the Invention

[0004] In view of this, an object of the present invention is to provide a video encoding method, apparatus, device and readable storage medium, which solve the technical problem of low encoding efficiency in the prior art.

[0005] To solve the above technical problems, the present invention provides a video encoding method, comprising:

[0006] Determine a motion vector corresponding to a prediction mode;

[0007] Determining a target cost corresponding to a prediction mode based on the motion vector;

[0008] Based on the target cost, a target prediction mode is selected from a preset number of prediction modes, and rate-distortion optimization is performed on the target prediction mode to obtain optimal encoding parameters, so as to perform video encoding based on the optimal encoding parameters; wherein the preset number is greater than 1.

[0009] Optionally, determining a target cost corresponding to a prediction mode based on the motion vector includes:

[0010] Obtaining an initial prediction mode corresponding to a current block, and determining a reference block corresponding to the current block;

[0011] Determining the accuracy of the motion vector corresponding to the reference block;

[0012] Determining whether the motion vector accuracy is less than a set value;

[0013] When the motion vector accuracy is less than the set value, it is determined to use the motion vector of the current initial prediction mode as the target cost.

[0014] Optionally, the video encoding method, after determining whether the motion vector accuracy is less than a set value, further includes:

[0015] When the motion vector accuracy is not less than the set value, calculating motion compensation of the current motion vector and determining a compensation result;

[0016] The compensation result is transformed to obtain a compensated motion vector, and motion compensation is performed based on the motion vector and the compensated motion vector to determine the target cost.

[0017] Optionally, selecting a target prediction mode from a preset number of prediction modes based on the target cost, performing rate-distortion optimization on the target prediction mode to obtain optimal encoding parameters, and performing video encoding based on the optimal encoding parameters, includes:

[0018] Determining the target cost as the cost corresponding to the initial prediction mode corresponding to the current block;

[0019] Determining a threshold parameter in the initial prediction mode, and obtaining a cost threshold parameter based on the threshold parameter and an actual optimal loss value;

[0020] Determining whether the target cost is less than the cost threshold parameter;

[0021] If the target cost is less than the cost threshold parameter, a rate-distortion optimization calculation is performed to obtain an actual loss value;

[0022] Determining whether the actual loss value is greater than the actual optimal loss value;

[0023] If the actual loss value is not greater than the actual optimal loss value, the actual optimal loss value is updated, and the prediction model is updated accordingly.

[0024] Optionally, after determining whether the target cost is less than the cost threshold parameter, the method further includes:

[0025] If the target cost is not less than the cost threshold parameter, the next prediction mode is determined, and the steps of calculating the target cost and cost threshold parameter corresponding to the next prediction mode and comparing the target cost corresponding to the next prediction mode with the cost threshold parameter corresponding to the next prediction mode are performed.

[0026] Optionally, after determining whether the actual loss value is greater than the actual optimal loss value, the method further includes:

[0027] If the actual loss value is greater than the actual optimal loss value, the original optimal prediction mode and its corresponding actual optimal loss value are maintained.

[0028] Optionally, the prediction mode includes a unidirectional prediction mode, a bidirectional prediction mode, an affine prediction mode and a symmetric motion vector difference mode.

[0029] An embodiment of the present invention further provides a video encoding device, comprising:

[0030] A motion vector determination module, used to determine the motion vector corresponding to the prediction mode;

[0031] a target cost determination module, configured to determine a target cost corresponding to a prediction mode based on the motion vector;

[0032] A target prediction mode determination module is used to select a target prediction mode from a preset number of prediction modes based on the target cost, perform rate-distortion optimization on the target prediction mode, and obtain optimal encoding parameters to perform video encoding based on the optimal encoding parameters; wherein the preset number is greater than 1.

[0033] An embodiment of the present invention further provides a video encoding device, including:

[0034] Memory for storing computer programs;

[0035] A processor is configured to execute the computer program to implement the steps of the above-mentioned video encoding method.

[0036] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned video encoding method are implemented.

[0037] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned video encoding method when executed by a processor.

[0038] As can be seen, the present invention determines a motion vector corresponding to a prediction mode; determines a target cost corresponding to the prediction mode based on the motion vector; determines a target prediction mode from a preset number of prediction modes based on the target cost, and performs rate-distortion optimization on the target prediction mode; wherein the preset number is greater than 1. Compared to the current method of performing rate-distortion optimization on all prediction modes, the present invention can filter prediction modes based on the target cost determined by the motion vector to obtain the target prediction mode, thereby only performing rate-distortion optimization on the target prediction mode, rather than on all prediction modes, thereby improving coding efficiency.

[0039] In addition, the present invention also provides a video encoding device, equipment and computer-readable storage medium, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0041] Figure 1 A flowchart of a video encoding method provided by an embodiment of the present invention;

[0042] Figure 2 An example flow chart of a rate-distortion optimization method provided in an embodiment of the present invention;

[0043] Figure 3 An example diagram of a process for determining a target cost provided by an embodiment of the present invention;

[0044] Figure 4 An example flow chart of a target prediction mode determination method provided by an embodiment of the present invention;

[0045] Figure 5 A schematic structural diagram of a video encoding device provided by an embodiment of the present invention;

[0046] Figure 6 A schematic structural diagram of a video encoding device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0047] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0048] Some of the terms that appear in the description of the embodiments of this application are subject to the following interpretations:

[0049] Unidirectional prediction mode: uses L0 or L1 reference frame list for prediction.

[0050] Bidirectional prediction mode: uses both L0 and L1 reference frame lists for prediction.

[0051] Affine prediction mode: uses an affine transformation model for motion compensation.

[0052] SMVD mode: Symmetric motion vector difference mode.

[0053] Please refer to Figure 1 , Figure 1 A flowchart of a video encoding method provided by an embodiment of the present invention. The method may include:

[0054] S101, determining a motion vector corresponding to a prediction mode.

[0055] The executor of this embodiment is an encoder. This embodiment does not limit the video coding standard corresponding to the encoder. For example, the video coding standard in this embodiment may be AVS3 (third-generation digital audio and video codec technology standard), H.266 / VVC (versatile video coding standard), AV1 (open media video coding standard), etc. This embodiment does not limit the specific prediction mode. For example, the prediction mode in this embodiment may be a unidirectional prediction mode; or the prediction mode in this embodiment may be a bidirectional prediction mode; or the prediction mode in this embodiment may be all prediction modes, for example, all prediction modes include a unidirectional prediction mode, a bidirectional prediction mode, an affine prediction mode, and a symmetric motion vector difference mode. The prediction mode in this embodiment is a mode for performing inter-frame prediction. The prediction mode in this embodiment performs motion search to obtain a motion vector. In this embodiment, the method for determining the motion vector (MV) corresponding to the prediction mode is to use SATD (Sum of Absolute Transformed Difference), which is a Hadamard transform followed by the sum of absolute values. SATD is a measure of the size of a video residual signal. This is a transformation method commonly used by encoders for simple calculations. The calculation is time-blocked and has low complexity, and a rough loss cost result can be obtained without performing an actual encoding process.

[0056] S102: Determine a target cost corresponding to the prediction mode based on the motion vector.

[0057] This embodiment does not limit the specific method of determining the target cost based on the motion vector. For example, this embodiment can directly use the motion vector as the target cost; or this embodiment can also determine the target cost based on the motion vector and the motion compensation corresponding to the motion vector.

[0058] It should be further explained that, based on any of the above embodiments, in order to improve the accuracy of determining the target cost, the above determination of the target cost corresponding to the prediction mode based on the motion vector may include:

[0059] S1021, obtaining an initial prediction mode corresponding to the current block, and determining a reference block corresponding to the current block;

[0060] S1022, determining the motion vector accuracy corresponding to the reference block;

[0061] S1023, determining whether the motion vector accuracy is less than a set value;

[0062] S1024: When the motion vector accuracy is less than the set value, determine to use the motion vector of the current initial prediction mode as the target cost.

[0063] This embodiment will first determine an initial prediction mode, and then only calculate the target cost of the initial prediction mode, thereby further improving the efficiency of encoding. This embodiment does not limit the specific initial prediction mode. The initial prediction mode in this embodiment is any one of a preset number of prediction modes. The set value in this embodiment is 2. The overall process of this embodiment can be to obtain the initial candidate mode of the current block, determine the reference block of the current block, and determine the MVR (motion vector accuracy, which is a level of 0, 1, or 2) corresponding to the reference block; if the MVR is less than 2, the motion vector of the current initial prediction mode is used as the target cost. After testing, it was found that the overall encoding effect and speed are best when the MVR is less than 2.

[0064] It should be further explained that, based on any of the above embodiments, after determining whether the motion vector accuracy is less than a set value, the following steps may also be included:

[0065] S1025: When the motion vector accuracy is not less than the set value, calculate the motion compensation of the current motion vector and determine the compensation result;

[0066] S1026 , transforming the compensation result to obtain a compensated motion vector, and performing motion compensation based on the motion vector and the compensated motion vector to determine a target cost.

[0067] This embodiment checks the MVR corresponding to the reference block based on the selected prediction mode. If the MVR is less than 2, the motion estimate is directly used as the satd_cost (target cost) for the current prediction mode. Otherwise, the satd_cost is recalculated for the current mode. Motion compensation is calculated, and the compensated cost is then subjected to a Hadamard transform (or, in this embodiment, a DCT transform, etc.) to obtain the compensated cost. The motion vector is then added to obtain the final satd_cost for the current mode. It should be noted that the use of the Hadamard transform can reduce computational complexity and increase computational speed.

[0068] S103, determining a target prediction mode from a preset number of prediction modes based on the target cost, performing rate-distortion optimization on the target prediction mode, obtaining optimal encoding parameters, and performing video encoding based on the optimal encoding parameters; wherein the preset number is greater than 1.

[0069] This embodiment does not limit the specific method for determining the target prediction model from a preset number of prediction models based on the target cost. For example, this embodiment can directly use the prediction model with the smallest target cost as the target prediction model. Alternatively, this embodiment can first determine the target cost corresponding to an initial prediction model. If the target cost is less than the set parameter value, the initial prediction model can be directly used as the target prediction model. In this way, the target prediction model can be obtained by calculating the target cost only once, and rate-distortion optimization only needs to be performed on one prediction model.

[0070] It should be further explained that, based on any of the above embodiments, the above-mentioned screening of a target prediction mode from a preset number of prediction modes based on the target cost and performing rate-distortion optimization on the target prediction mode may include:

[0071] S1031, determining the target cost as the cost corresponding to the initial prediction mode corresponding to the current block;

[0072] S1032, determining a threshold parameter in the initial prediction mode, and obtaining a cost threshold parameter based on the threshold parameter and the actual optimal loss value;

[0073] S1033, determining whether the target cost is less than a cost threshold parameter;

[0074] S1034, if the target cost is less than the threshold parameter, perform rate-distortion optimization calculation to obtain the actual loss value;

[0075] S1035, determining whether the actual loss value is greater than the actual optimal loss value;

[0076] S1036: If the actual loss value is not greater than the actual optimal loss value, the actual optimal loss value is updated, and the prediction model is updated accordingly.

[0077] The target cost calculated in this embodiment is that if the satd_cost (target cost, a roughly calculated cost, in order to skip the RDO calculation, an approximate cost value) of the current prediction mode is less than the set threshold parameter (for example, it can be 1.05) multiplied by the optimal satd_cost (actual optimal loss value), then the RDO (rate distortion optimization) calculation is performed. The target cost in this embodiment is a rough calculation, so it needs to be compared with the actual optimal loss value. After the RDO process is completed, if the loss is the optimal value at this time, the optimal prediction mode and the actual optimal loss value are updated, otherwise the original inter-frame prediction mode and its corresponding optimal loss value are maintained. If the target cost of the current prediction mode is greater than the threshold multiplied by the optimal satd_cost, then the prediction mode is skipped, and the calculation of the next prediction mode is started, and the above process is repeated.

[0078] It should be further explained that, based on the above embodiment, after determining whether the target cost is less than the cost threshold parameter, the following steps may also be included: if the target cost is not less than the cost threshold parameter, determining the next prediction mode, calculating the target cost and the cost threshold parameter corresponding to the next prediction mode, and comparing the target cost corresponding to the next prediction mode with the cost threshold parameter corresponding to the next prediction mode. In this embodiment, if the current initial prediction mode is not used, rate-distortion optimization will not be performed on the current initial prediction model, thereby reducing rate-distortion optimization calculations and improving coding efficiency.

[0079] It should be further explained that, based on the above embodiment, after determining whether the actual loss value is greater than the actual optimal loss value, the following may be further included: if the actual loss value is greater than the actual optimal loss value, maintaining the original optimal prediction mode and its corresponding actual optimal loss value. In this embodiment, the smaller the actual loss value, the better. An update is only performed when the actual loss value is less than the actual optimal loss value. If the actual loss value is equal to the actual optimal loss value, an update may or may not be performed.

[0080] A video encoding method provided by an embodiment of the present invention may include: S101, determining a motion vector corresponding to a prediction mode; S102, determining a target cost corresponding to the prediction mode based on the motion vector;

[0081] S103: Determine a target prediction mode from a preset number of prediction modes based on the target cost, and perform rate-distortion optimization on the target prediction mode; wherein the preset number is greater than 1. Compared to the current practice of performing rate-distortion optimization on all prediction modes, the present invention can screen prediction modes based on the target cost determined by the motion vector to obtain the target prediction mode, thereby only performing rate-distortion optimization on the target prediction mode, rather than on all prediction modes, thereby improving coding efficiency.

[0082] In order to make the present invention easier to understand, please refer to Figure 2 , Figure 2 A flow chart illustrating a rate-distortion optimization method provided in an embodiment of the present invention may include:

[0083] S201. Obtain an initial prediction mode for the current block, determine a reference block for the current block, determine an MVR corresponding to the reference block, and determine whether the MVR is less than 2.

[0084] S202: If the MVR is less than 2, directly use the motion vector obtained by the current prediction mode as the target cost of the current prediction mode.

[0085] S203 , otherwise, calculate motion compensation of the current motion vector, determine a compensation result, perform Hadamard transform on the compensation result to obtain a compensated motion vector, and perform motion compensation based on the motion vector and the compensated motion vector to determine a target cost.

[0086] This embodiment checks the MVR of the reference block based on the selected initial prediction mode. If the MVR is less than 2, the motion estimate is directly used as the satd_cost of the current mode. Otherwise, the satd_cost is recalculated for the current mode, and the cost is obtained by calculating motion compensation and performing Hadamard transform (HAD transform) on the compensation result. The motion vector cost is then added to obtain the final satd_cost (target cost) of the current mode. For easier understanding, please refer to Figure 3 , Figure 3 An example diagram of a process for determining a target cost provided by an embodiment of the present invention. Figure 3 The candidate mode in is the candidate initial prediction mode, and curr_mvr is the MVR. Recalculating STAD (the estimated cost, i.e., the target cost) recalculates the target cost. Using the motion estimated cost, the target cost is determined using the motion vector of the initial prediction mode. The MV_COST in the figure (corresponds to the target cost above) indicates that the target cost in this step is the sum of motion compensation and the target cost calculated previously.

[0087] S204: Determine a threshold parameter in the initial prediction mode, and judge whether the target cost of the initial prediction mode is less than the threshold parameter multiplied by the actual optimal loss value.

[0088] S205: If the target cost of the initial prediction mode is less than the threshold parameter multiplied by the actual optimal loss value, perform RDO calculation to obtain the actual loss value, and perform rate-distortion optimization based on the target cost.

[0089] S206: Determine whether the actual loss value is less than the actual optimal loss value.

[0090] S207. If the actual loss value is less than the optimal loss value, update the optimal candidate mode and the actual optimal loss value.

[0091] S208. Otherwise, the original optimal prediction mode and its corresponding actual optimal loss value are maintained.

[0092] S209: If the cost of the initial prediction mode is greater than the threshold parameter multiplied by the actual optimal loss value, then the initial prediction mode is skipped, and the calculation of the next candidate mode is started, and the above process is repeated.

[0093] Compare the target cost with the product of the threshold parameter and the actual optimal loss value in the current prediction mode. If the satd_cost of the current prediction mode is less than the threshold parameter (threshold) multiplied by the optimal satd_cost (actual optimal loss value, inter_cost), then run the RDO calculation. After the RDO process is completed, if the loss value at this time is the actual optimal loss value, then update the optimal prediction mode and the actual optimal loss value, otherwise keep the original optimal prediction mode and its corresponding actual optimal loss value (inter_cost). If the satd_cost of the current mode is greater than the threshold parameter multiplied by the optimal satd_cost, then skip the prediction mode and start the calculation of the next prediction mode, and repeat the above process. For ease of understanding, please refer to Figure 4 , Figure 4 This is a flowchart illustrating a method for determining a target prediction model according to an embodiment of the present invention. Figure 4 The candidate STAD cost in is the target cost of the current initial prediction mode.

[0094] The core idea of ​​the embodiment of the present invention is to use the SATD cost of the encoded optimal prediction mode as a reference benchmark, and to filter out prediction modes with excessively high encoding costs by setting a reasonable threshold multiple, thereby avoiding unnecessary RDO calculations, greatly reducing the inter-frame prediction time, and thus improving coding efficiency.

[0095] The video encoding device provided by an embodiment of the present invention is introduced below. The video encoding device described below and the video encoding method described above can refer to each other.

[0096] Please refer to Figure 5 , Figure 5 A schematic structural diagram of a video encoding device provided in an embodiment of the present invention may include:

[0097] A motion vector determination module 100 is configured to determine a motion vector corresponding to a prediction mode;

[0098] A target cost determination module 200 is configured to determine a target cost corresponding to a prediction mode based on the motion vector;

[0099] The target prediction mode determination module 300 is used to select a target prediction mode from a preset number of prediction modes based on the target cost, perform rate-distortion optimization on the target prediction mode, obtain optimal encoding parameters, and perform video encoding based on the optimal encoding parameters; wherein the preset number is greater than 1.

[0100] Further, based on any of the above embodiments, the target cost determination module 200 may include:

[0101] a reference block determining unit, configured to obtain an initial prediction mode corresponding to a current block and determine a reference block corresponding to the current block;

[0102] a motion vector accuracy determination unit, configured to determine the accuracy of the motion vector corresponding to the reference block;

[0103] A first judging unit, configured to judge whether the motion vector accuracy is less than a set value;

[0104] The first target cost determining unit is configured to determine to use the motion vector of the current initial prediction mode as the target cost when the motion vector is smaller than the set value.

[0105] Furthermore, based on the above embodiment, the prediction model filtering device may further include:

[0106] a compensation result determining unit, configured to calculate motion compensation of the current motion vector and determine a compensation result when the motion vector accuracy is not less than the set value;

[0107] The second target cost determination unit is configured to perform transformation processing on the compensation result to obtain a compensated motion vector, and perform motion compensation based on the motion vector and the compensated motion vector to determine the target cost.

[0108] Further, based on any of the above embodiments, the target prediction mode determination module 300 may include:

[0109] a third target cost determining unit, configured to determine the target cost as a cost corresponding to the initial prediction mode corresponding to the current block;

[0110] a cost threshold parameter determining unit, configured to determine a threshold parameter in the initial prediction mode, and obtain a cost threshold parameter based on the threshold parameter and an actual optimal loss value;

[0111] A second judging unit, configured to judge whether the target cost is less than the cost threshold parameter;

[0112] an actual loss value determining unit, configured to perform rate-distortion optimization calculation to obtain an actual loss value if the target cost is less than the cost threshold parameter;

[0113] A third judgment unit is used to judge whether the actual loss value is greater than the actual optimal loss value;

[0114] An updating unit is used to update the actual optimal loss value if the actual loss value is not greater than the actual optimal loss value, and to update the prediction model accordingly.

[0115] Furthermore, based on the above embodiment, the video encoding apparatus may further include:

[0116] The next prediction mode determination unit is used to determine the next prediction mode if the target cost is not less than the cost threshold parameter, execute the steps of calculating the target cost and cost threshold parameter corresponding to the next prediction mode, and compare the target cost corresponding to the next prediction mode with the cost threshold parameter corresponding to the next prediction mode.

[0117] Furthermore, based on the above embodiment, the video encoding apparatus may further include:

[0118] The non-updating unit is used to maintain the original optimal prediction mode and its corresponding actual optimal loss value if the actual loss value is greater than the actual optimal loss value.

[0119] Further, based on any of the above embodiments, the prediction mode includes a unidirectional prediction mode, a bidirectional prediction mode, an affine prediction mode and a symmetric motion vector difference mode.

[0120] It should be noted that the order of the modules and units in the above video encoding device can be changed without affecting the logic.

[0121] A video encoding device provided by an embodiment of the present invention may include: a motion vector determination module 100 for determining a motion vector corresponding to a prediction mode; a target cost determination module 200 for determining a target cost corresponding to the prediction mode based on the motion vector; and a target prediction mode determination module 300 for selecting a target prediction mode from a preset number of prediction modes based on the target cost, performing rate-distortion optimization on the target prediction mode, obtaining optimal encoding parameters, and performing video encoding based on the optimal encoding parameters; wherein the preset number is greater than 1. Compared to the current method of requiring rate-distortion optimization for all prediction modes, the present invention can select prediction modes based on the target cost determined by the motion vector to obtain the target prediction mode, thereby only requiring rate-distortion optimization for the target prediction mode, rather than for all prediction modes, thereby improving encoding efficiency.

[0122] A video encoding device provided by an embodiment of the present invention is introduced below. The video encoding device described below and the video encoding method described above can refer to each other.

[0123] Please refer to Figure 6 , Figure 6 A schematic structural diagram of a video encoding device provided in an embodiment of the present invention may include:

[0124] Memory 10, for storing computer programs;

[0125] The processor 20 is configured to execute a computer program to implement the above-mentioned video encoding method.

[0126] The memory 10 , the processor 20 , and the communication interface 30 all communicate with each other via a communication bus 40 .

[0127] In the embodiment of the present invention, the memory 10 is used to store one or more programs. The program may include program code, and the program code includes computer operation instructions. In the embodiment of the present invention, the memory 10 may store programs for implementing the following functions:

[0128] Determine a motion vector corresponding to a prediction mode;

[0129] Determine the target cost corresponding to the prediction mode based on the motion vector;

[0130] A target prediction mode is determined from a preset number of prediction modes based on a target cost, and rate-distortion optimization is performed on the target prediction mode; wherein the preset number is greater than 1.

[0131] In one possible implementation, the memory 10 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and applications required for at least one function, etc.; the data storage area may store data created during use.

[0132] In addition, the memory 10 may include a read-only memory and a random access memory, and provides instructions and data to the processor. A portion of the memory may also include NVRAM. The memory stores an operating system and operating instructions, executable modules or data structures, or a subset or an extended set thereof. The operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and processing hardware-based tasks.

[0133] The processor 20 may be a central processing unit (CPU), an application-specific integrated circuit, a digital signal processor, a field programmable gate array, or other programmable logic device. The processor 20 may be a microprocessor or any conventional processor. The processor 20 may call a program stored in the memory 10 .

[0134] The communication interface 30 may be an interface of a communication module, and is used to connect to other devices or systems.

[0135] Of course, it needs to be explained that Figure 6 The structure shown does not constitute a limitation on the video encoding device in the embodiment of the present invention. In actual applications, the video encoding device may include Figure 6 More or fewer components than shown, or combinations of certain components.

[0136] The following describes a computer-readable storage medium provided by an embodiment of the present invention. The computer-readable storage medium described below and the video encoding method described above may refer to each other.

[0137] The present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned video encoding method are implemented.

[0138] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., which can store program codes.

[0139] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.

[0140] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0141] Finally, it should be noted that, in this document, relationships such as first and second, etc., are used solely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0142] The above is a detailed introduction to a video encoding method, apparatus, device, and readable storage medium provided by the present invention. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only intended to help understand the method and core ideas of the present invention. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the contents of this specification should not be understood as limiting the present invention.

Claims

1. A video encoding method, characterized in that: include: Determine a motion vector corresponding to a prediction mode; Determining a target cost corresponding to a prediction mode based on the motion vector; Based on the target cost, a target prediction mode is selected from a preset number of prediction modes, and rate-distortion optimization is performed on the target prediction mode to obtain optimal encoding parameters, so as to perform video encoding based on the optimal encoding parameters; wherein the preset number is greater than 1.

2. The video encoding method according to claim 1, wherein: Determining a target cost corresponding to a prediction mode based on the motion vector includes: Obtaining an initial prediction mode corresponding to a current block, and determining a reference block corresponding to the current block; Determining the accuracy of the motion vector corresponding to the reference block; Determining whether the motion vector accuracy is less than a set value; When the motion vector is smaller than the set value, it is determined to use the motion vector of the current initial prediction mode as the target cost.

3. The video encoding method according to claim 2, wherein: After determining whether the motion vector accuracy is less than a set value, the method further includes: When the motion vector accuracy is not less than the set value, calculating motion compensation of the current motion vector and determining a compensation result; The compensation result is transformed to obtain a compensated motion vector, and motion compensation is performed based on the motion vector and the compensated motion vector to determine the target cost.

4. The video encoding method according to any one of claims 1 to 3, characterized in that: The method further comprises: selecting a target prediction mode from a preset number of prediction modes based on the target cost, performing rate-distortion optimization on the target prediction mode to obtain optimal encoding parameters, and performing video encoding based on the optimal encoding parameters, including: Determining the target cost as the cost corresponding to the initial prediction mode corresponding to the current block; Determining a threshold parameter in the initial prediction mode, and obtaining a cost threshold parameter based on the threshold parameter and an actual optimal loss value; Determining whether the target cost is less than the cost threshold parameter; If the target cost is less than the cost threshold parameter, a rate-distortion optimization calculation is performed to obtain an actual loss value; Determining whether the actual loss value is greater than the actual optimal loss value; If the actual loss value is not greater than the actual optimal loss value, the actual optimal loss value is updated, and the prediction model is updated accordingly.

5. The video encoding method according to claim 4, wherein: After determining whether the target cost is less than the cost threshold parameter, the method further includes: If the target cost is not less than the cost threshold parameter, the next prediction mode is determined, and the steps of calculating the target cost and cost threshold parameter corresponding to the next prediction mode and comparing the target cost corresponding to the next prediction mode with the cost threshold parameter corresponding to the next prediction mode are performed.

6. The video encoding method according to claim 4, wherein: After determining whether the actual loss value is greater than the actual optimal loss value, the method further includes: If the actual loss value is greater than the actual optimal loss value, the original optimal prediction mode and its corresponding actual optimal loss value are maintained.

7. The video encoding method according to claim 1, wherein: The prediction modes include unidirectional prediction mode, bidirectional prediction mode, affine prediction mode and symmetric motion vector difference mode.

8. A video encoding device, characterized in that: include: A motion vector determination module, used to determine the motion vector corresponding to the prediction mode; a target cost determination module, configured to determine a target cost corresponding to a prediction mode based on the motion vector; A target prediction mode determination module is used to select a target prediction mode from a preset number of prediction modes based on the target cost, perform rate-distortion optimization on the target prediction mode, and obtain optimal encoding parameters to perform video encoding based on the optimal encoding parameters; wherein the preset number is greater than 1.

9. A video encoding device, characterized in that include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the video encoding method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the video encoding method according to any one of claims 1 to 7.

Citation Information

Cited By

  • HDR video rate distortion optimization method and device based on adaptive distortion weight, equipment and medium

    CN121864971A