Motion estimation method and device in video coding, equipment, storage medium and program product
By estimating the entire pixel motion and calculating the corresponding threshold value of the image block in video encoding, it is determined whether to perform pixel motion estimation, which solves the problems of computational complexity and compression performance loss in video encoding, reduces calculation overhead and maintains high efficiency compression performance.
Patent Information
- Application Number
- CN202411748839.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-01-07
AI Technical Summary
In video encoding, processing based on pixel motion estimation increases computational complexity, resulting in increased computational overhead for video encoding and potentially introduces compression performance losses.
By estimating the entire pixel motion of the current image block in the video, calculating the encoding cost and quantization parameters, the motion vector length threshold is obtained. If the length of the entire pixel motion vector is greater than or equal to the threshold, then perform pixel motion estimation to determine the appropriate accuracy and Number of precisions for encoding processing.
The number of pixel searches of the motion estimation unit is reduced, the overall calculation overhead of the video encoding process is reduced, and the compression performance loss caused by the decrease in motion compensation accuracy is avoided.
Smart Images

Figure CN119277104A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of video coding, and in particular to a motion estimation method, apparatus, computer equipment, storage medium and computer program product in video coding. Background Art
[0002] Motion estimation and compensation are key technologies in video coding and are of great significance for efficient lossy compression of videos. Video coding standards have introduced a variety of techniques based on sub-pixel motion estimation for compensation, based on compensation based on whole-pixel motion estimation, which further improves the compression performance of the corresponding standards. Compensation based on sub-pixel motion estimation involves a relatively complex pixel interpolation process, which makes this type of technology more computationally complex in the corresponding encoding and decoding process.
[0003] In video coding technology, in order to obtain the optimal motion compensation position, the motion estimation unit will extensively search for possible suitable motion compensation positions. This search process usually introduces a large amount of compensation processing based on pixel-by-pixel motion estimation, which seriously increases the computational complexity of video coding. Summary of the invention
[0004] Based on this, it is necessary to provide a motion estimation method, apparatus, computer device, storage medium and computer program product in video coding to address the above technical issues.
[0005] The present application provides a motion estimation method in video coding, the method comprising:
[0006] Performing integer pixel motion estimation on a current image block in the video to obtain an integer pixel motion vector and a target integer pixel motion compensation position corresponding to the integer pixel motion vector;
[0007] Determine a coding cost of the current image block at the target integer-pixel motion compensation position and a quantization parameter of the current image block;
[0008] According to the coding cost and the quantization parameter, a motion vector length threshold of the current image block is obtained; the coding cost is positively correlated with the motion vector length threshold, and the quantization parameter is negatively correlated with the motion vector length threshold;
[0009] If the length of the integer pixel motion vector is greater than or equal to the motion vector length threshold, sub-pixel motion estimation is performed on the current image block to obtain a sub-pixel motion vector to perform encoding processing on the current image block.
[0010] In one embodiment, obtaining the motion vector length threshold of the current image block according to the encoding cost and the quantization parameter includes:
[0011] Taking the first constant as an exponent and the encoding cost as a base, a first result is obtained;
[0012] Using the second constant as an exponent and the quantization parameter as a base, a second result is obtained;
[0013] The first result is divided by the second result to obtain a motion vector length threshold of the current image block.
[0014] In one embodiment, dividing the first result by the second result to obtain the motion vector length threshold of the current image block includes:
[0015] Dividing the first result by the second result to obtain a ratio;
[0016] A product result of a third constant and the ratio is obtained to obtain a motion vector length threshold of the current image block.
[0017] In one embodiment, obtaining the product result of the third constant and the ratio to obtain the motion vector length threshold of the current image block includes:
[0018] Obtaining a product result of a third constant and the ratio and an encoding speed control parameter;
[0019] The motion vector length threshold of the current image block is obtained according to the product of the multiplication result and the encoding speed control parameter.
[0020] In one embodiment, if the length of the integer pixel motion vector is greater than or equal to the motion vector length threshold, performing pixel-by-pixel motion estimation on the current image block includes:
[0021] If the length of the integer-pixel motion vector is greater than or equal to the motion vector length threshold, then according to the degree of excess of the length of the integer-pixel motion vector relative to the motion vector length threshold, the precision and the number of precisions required for the sub-pixel motion estimation method are determined, so as to determine a target sub-pixel motion estimation method among sub-pixel motion estimation methods with different precisions; the smaller the excess, the lower the precision required for the sub-pixel motion estimation method and the smaller the number of precisions;
[0022] According to the target sub-pixel motion estimation method, sub-pixel motion estimation is performed on the current image block.
[0023] In one embodiment, according to the degree to which the length of the integer pixel motion vector exceeds the motion vector length threshold, the precision and precision number required for the sub-pixel motion estimation method are determined, so as to determine a target sub-pixel motion estimation method among sub-pixel motion estimation methods with different precisions, including:
[0024] Obtaining twice the value of the motion vector length threshold;
[0025] If the length of the integer pixel motion vector is greater than or equal to the motion vector length threshold, and the length of the integer pixel motion vector is less than twice the value, then the half-pixel motion estimation method is used as the target sub-pixel motion estimation method;
[0026] If the length of the integer pixel motion vector is greater than or equal to the twice value, the half-pixel motion estimation method and the quarter-pixel motion estimation method are used as the target sub-pixel motion estimation method.
[0027] The present application provides a motion estimation device in video coding, the device comprising:
[0028] An integer pixel motion estimation module is used to perform integer pixel motion estimation on a current image block in a video to obtain an integer pixel motion vector and a target integer pixel motion compensation position corresponding to the integer pixel motion vector;
[0029] An information determination module, used to determine the encoding cost of the current image block at the target integer pixel motion compensation position and the quantization parameter of the current image block;
[0030] A threshold determination module, configured to obtain a motion vector length threshold of the current image block according to the coding cost and the quantization parameter; the coding cost is positively correlated with the motion vector length threshold, and the quantization parameter is negatively correlated with the motion vector length threshold;
[0031] The pixel-by-pixel motion estimation module is used to perform pixel-by-pixel motion estimation on the current image block to obtain the pixel-by-pixel motion vector if the length of the integer pixel motion vector is greater than or equal to the motion vector length threshold, so as to encode the current image block.
[0032] The present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the above method.
[0033] The present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to execute the above method.
[0034] The present application provides a computer program product, on which a computer program is stored, and the computer program is executed by a processor to perform the above method.
[0035] The motion estimation method, device, computer equipment, storage medium and computer program product in the above-mentioned video encoding perform integer pixel motion estimation on the current image block in the video to obtain an integer pixel motion vector and a target integer pixel motion compensation position corresponding to the integer pixel motion vector; determine the coding cost of the current image block at the target integer pixel motion compensation position and the quantization parameter of the current image block; obtain the motion vector length threshold of the current image block according to the coding cost and the quantization parameter; the coding cost is positively correlated with the motion vector length threshold, and the quantization parameter is negatively correlated with the motion vector length threshold; if the length of the integer pixel motion vector is greater than or equal to the motion vector length threshold, perform sub-pixel motion estimation on the current image block to obtain the sub-pixel motion vector, so as to perform coding processing on the current image block. In the solution provided by the present application, integer-pixel motion estimation is first performed on the current image block to calculate the coding cost; according to the coding cost and the quantization parameter, the corresponding motion vector length threshold, the coding cost is positively correlated with the motion vector length threshold, and the quantization parameter is negatively correlated with the motion vector length threshold; when the length of the integer-pixel motion vector is greater than or equal to the motion vector length threshold, sub-pixel motion estimation is performed on the current image block; when the length of the integer-pixel motion vector is less than the motion vector length threshold, sub-pixel motion estimation may not be performed on the current image block, thereby reducing the number of sub-pixel searches of the motion estimation unit during the encoding process, reducing the overall computational overhead of the video encoding process, and at the same time can largely avoid the compression performance loss caused by the reduction in motion compensation accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are 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 paying creative work.
[0037] Figure 1 is a schematic flow chart of a motion estimation method in video encoding in one embodiment;
[0038] Figure 2 A schematic diagram of a process for obtaining a motion vector length threshold in one embodiment;
[0039] Figure 3 is a flow chart of a motion estimation method in video encoding in another embodiment;
[0040] Figure 4 is a structural block diagram of a motion estimation device in video encoding in one embodiment;
[0041] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0043] The following are the technical terms involved in this application:
[0044] Motion Estimation (ME): For the current image block within a specific search range of the reference frame, find the matching image block that is most similar to the current image block according to certain matching criteria.
[0045] Motion Vector (MV): The relative displacement between the matching image block on the reference frame and the current image block.
[0046] Motion Compensation (MC): Use the encoded image block to predict and compensate the current image block, thereby reducing the redundant information of the frame sequence.
[0047] Integer-pixel motion estimation: Motion estimation based on integer-pixel displacements.
[0048] Half-pixel motion estimation: Motion estimation in units of 1 / 2 pixel displacement.
[0049] Quarter-pel motion estimation: Motion estimation in units of 1 / 4 pixel displacement.
[0050] SATD (Sum of Absolute Transform Difference): The sum of the absolute values of the image block after the Hadamard transform.
[0051] QP (Quantization Parameters): A value that determines the degree of quantization when encoding a video.
[0052] BD-rate (Bjontegaard Delta-Rate): A widely used method for calculating the average difference of rate-distortion curves, which is used to compare the compression efficiency of different video encoding methods. When a value less than zero is obtained, it indicates that the compression efficiency of the current encoding method is better than the compared encoding method.
[0053] Prediction Unit (PU): is the basic unit for module prediction.
[0054] The motion estimation method in video coding provided in this application is applicable to video coding systems implemented based on common video coding standards, including but not limited to: H.265 / HEVC video coding standard, VP9 video coding standard, AV1 video coding standard, etc. The corresponding video coding standard should include at least one compensation method based on integer pixel motion estimation and at least one compensation method based on sub-pixel motion estimation.
[0055] The method provided in the present application can be executed by a computer device, including Figure 1 Steps shown.
[0056] Step S101 , performing integer pixel motion estimation on a current image block in a video to obtain an integer pixel motion vector and a target integer pixel motion compensation position corresponding to the integer pixel motion vector.
[0057] The current image block in the video can be recorded as PU. By performing integer pixel motion estimation on the current image block PU, the image block in the reference frame that is most similar to the current image block PU can be determined. This image block can be called a matching image block. A motion vector can be obtained based on the current image block PU and the matching image block in the reference frame. This motion vector is called an integer pixel motion vector. The integer pixel motion compensation position obtained based on the integer pixel motion vector belongs to the optimal integer pixel motion compensation position and can be called the target integer pixel motion compensation position.
[0058] Step S102, determining the encoding cost of the current image block at the target integer-pixel motion compensation position and the quantization parameter of the current image block.
[0059] Specifically, the residual matrix between the current image block and the matching image block can be calculated; the residual matrix is subjected to Hadamard transformation, and the sum of the absolute values of the elements of the transformed residual matrix is calculated to obtain SATD, which is used as the coding cost of the current image block at the target integer pixel motion compensation position.
[0060] The quantization parameter is a parameter that controls the degree of quantization of the current image block.
[0061] Step S103, obtaining a motion vector length threshold of the current image block according to the coding cost and the quantization parameter; the coding cost is positively correlated with the motion vector length threshold, and the quantization parameter is negatively correlated with the motion vector length threshold.
[0062] After the coding cost and the quantization parameter are obtained, the coding cost is positively correlated with the motion vector length threshold, and the quantization parameter is negatively correlated with the motion vector length threshold. According to this relationship, the motion vector length threshold of the current image block can be obtained.
[0063] Step S104: if the length of the integer pixel motion vector is greater than or equal to the motion vector length threshold, sub-pixel motion estimation is performed on the current image block to obtain a sub-pixel motion vector to perform encoding processing on the current image block.
[0064] The length of the integer pixel motion vector is denoted as L, and the motion vector length threshold is denoted as M.
[0065] If the length L of the integer pixel motion vector is greater than or equal to the motion vector length threshold M, it indicates that the accuracy of the integer pixel motion estimation does not meet the requirements. At this time, sub-pixel motion estimation can be performed on the current image block; the accuracy of sub-pixel motion estimation is higher than that of integer pixel motion estimation. A motion vector can be obtained based on the sub-pixel motion estimation, and the motion vector is called a sub-pixel motion vector. The current image block is encoded based on the sub-pixel motion vector.
[0066] If the length L of the integer pixel motion vector is less than the motion vector length threshold M, it indicates that the accuracy of the integer pixel motion estimation meets the requirement, and at this time, the sub-pixel motion estimation is not performed on the current image block. The current image block is encoded according to the integer pixel motion vector.
[0067] In the motion estimation method in the above video encoding, integer pixel motion estimation is first performed on the current image block to calculate the encoding cost; according to the encoding cost and the quantization parameter, the corresponding motion vector length threshold, the encoding cost is positively correlated with the motion vector length threshold, and the quantization parameter is negatively correlated with the motion vector length threshold; when the length of the integer pixel motion vector is greater than or equal to the motion vector length threshold, sub-pixel motion estimation is performed on the current image block; when the length of the integer pixel motion vector is less than the motion vector length threshold, sub-pixel motion estimation may not be performed on the current image block, thereby reducing the number of sub-pixel searches of the motion estimation unit during the encoding process, reducing the overall computational overhead of the video encoding process, and at the same time can largely avoid the compression performance loss caused by the reduction in motion compensation accuracy.
[0068] In one embodiment, the motion vector length threshold of the current image block is obtained according to the coding cost and the quantization parameter, including: Figure 2 The steps shown are:
[0069] Step S201, using the first constant as the exponent and the encoding cost as the base to obtain a first result; step S202, using the second constant as the exponent and the quantization parameter as the base to obtain a second result; step S203, dividing the first result by the second result to obtain a motion vector length threshold of the current image block.
[0070] The first constant is β, the second constant is γ, the coding cost is SATD, and the quantization parameter is QP. Then the first result is SATD β , the second result is QPγ ; The first result SATD β Divide by the second result QP γ , and then obtain the motion vector length threshold of the current image block.
[0071] In one embodiment, dividing the first result by the second result to obtain a motion vector length threshold of the current image block includes:
[0072] The first result is divided by the second result to obtain a ratio; and a product result of a third constant and the ratio is obtained to obtain a motion vector length threshold of the current image block.
[0073] The first constant is denoted as α. The first result SATD β Divide by QP γ , the ratio obtained is SATD β / QP γ The third constant α and the ratio SATD β / QP γ The product of is α×SATD β / QP γ , and then obtain the motion vector length threshold of the current image block.
[0074] In one embodiment, obtaining the product result of the third constant and the ratio to obtain the motion vector length threshold of the current image block includes:
[0075] A product result of the third constant and the ratio and a coding speed control parameter are obtained; and a motion vector length threshold of the current image block is obtained according to the product of the product result and the coding speed control parameter.
[0076] The encoding speed control parameter is recorded as T. The third constant α and the ratio SATD β / QP γ The product of is α×SATD β / QP γ , we can convert α×SATD β / QP γ After adding 1, it is multiplied by the encoding speed control parameter T, and the result is used as the motion vector length threshold M, which can be expressed as M=T×[1+α×SATD β / QP γ ].
[0077] In one embodiment, if the length of the integer pixel motion vector is greater than or equal to the motion vector length threshold, performing pixel-by-pixel motion estimation on the current image block includes:
[0078] If the length of the integer-pixel motion vector is greater than or equal to the motion vector length threshold, the accuracy and precision quantity required for the sub-pixel motion estimation method are determined according to the degree to which the length of the integer-pixel motion vector exceeds the motion vector length threshold, so as to determine the target sub-pixel motion estimation method among the sub-pixel motion estimation methods with different precisions; the smaller the degree of excess, the lower the accuracy required for the sub-pixel motion estimation method and the smaller the precision quantity; according to the target sub-pixel motion estimation method, sub-pixel motion estimation is performed on the current image block.
[0079] The following examples are used to introduce various precision sub-pixel motion estimation methods, including half-pixel motion estimation method and quarter-pixel motion estimation method. Among them, the precision of whole-pixel motion estimation is lower than that of half-pixel motion estimation, and the precision of half-pixel motion estimation is lower than that of quarter-pixel motion estimation.
[0080] If the length L of the integer pixel motion vector is greater than or equal to the motion vector length threshold M, the target sub-pixel motion estimation method can be determined in the half-pixel motion estimation method and the quarter-pixel motion estimation method according to the degree to which the length L of the integer pixel motion vector exceeds the motion vector length threshold M.
[0081] If the degree of excess is small, the half-pixel motion estimation method can be used as the target sub-pixel motion estimation method to perform half-pixel motion estimation on the current image block, and then obtain a half-pixel motion vector; the current image block is encoded according to the half-pixel motion vector.
[0082] If the degree of excess is large, the half-pixel motion estimation method and the quarter-pixel motion estimation method can be used as the target sub-pixel motion estimation method, and half-pixel motion estimation and quarter-pixel motion estimation are performed on the current image block to obtain a half-pixel motion vector and a quarter-pixel motion vector; the current image block is encoded according to the half-pixel motion vector and the quarter-pixel motion vector.
[0083] In one embodiment, according to the extent to which the length of the integer pixel motion vector exceeds the motion vector length threshold, the required precision and precision number of the sub-pixel motion estimation method are determined, so as to determine the target sub-pixel motion estimation method among the sub-pixel motion estimation methods with different precisions, including:
[0084] Obtain twice the value of the motion vector length threshold; if the length of the integer-pixel motion vector is greater than or equal to the motion vector length threshold, and the length of the integer-pixel motion vector is less than twice the value, then use the half-pixel motion estimation method as the target sub-pixel motion estimation method; if the length of the integer-pixel motion vector is greater than or equal to twice the value, then use the half-pixel motion estimation method and the quarter-pixel motion estimation method as the target sub-pixel motion estimation method.
[0085] The twice value of the motion vector length threshold is denoted as 2M.
[0086] If the length L of the integer pixel motion vector is greater than or equal to the motion vector length threshold M, and the length L of the integer pixel motion vector is less than twice the value 2M, the half-pixel motion estimation method can be used as the target sub-pixel motion estimation method to perform half-pixel motion estimation on the current image block to obtain a half-pixel motion vector.
[0087] If the length of the integer pixel motion vector is greater than or equal to twice the value 2M, the half-pixel motion estimation method and the quarter-pixel motion estimation method can be used as the target sub-pixel motion estimation method; then, half-pixel motion estimation can be performed on the current image block first, and then quarter-pixel motion estimation can be performed on the current image block to obtain a half-pixel motion vector and a quarter-pixel motion vector; the current image block is encoded according to the half-pixel motion vector and the quarter-pixel motion vector.
[0088] In order to better understand the above method, the following Figure 3 An application example of the motion estimation method in video encoding of the present application is described in detail.
[0089] Step S301 , performing integer pixel motion estimation on the current image block to obtain an integer pixel motion vector and a target integer pixel motion compensation position corresponding to the integer pixel motion vector.
[0090] Step S302, determining the encoding cost SATD of the current image block at the target integer-pixel motion compensation position.
[0091] Step S303: determine the quantization parameter QP of the current image block.
[0092] Step S304: Calculate the motion vector length threshold M according to the coding cost SATD and the quantization parameter QP.
[0093] Step S305 , determining whether the length L of the integer pixel motion vector is less than the motion vector length threshold M. If yes, proceed to step S306 ; if no, proceed to step S307 .
[0094] Step S306: No pixel-by-pixel motion estimation is performed on the current image block, and encoding is performed on the current image block according to the integer pixel motion vector.
[0095] Step S307, determine whether the length of the integer pixel motion vector is less than twice the motion vector length threshold value 2M. If yes, proceed to step S308; if no, proceed to step S309.
[0096] Step S308, performing half-pixel motion estimation on the current image block, and no longer performing quarter-pixel motion estimation on the current image block; obtaining a half-pixel motion vector obtained by the half-pixel motion estimation, and encoding the current image block according to the half-pixel motion vector.
[0097] Step S309, first perform half-pixel motion estimation on the current image block, and then perform quarter-pixel motion estimation on the current image block; obtain a half-pixel motion vector obtained by the half-pixel motion estimation and a quarter-pixel motion vector obtained by the quarter-pixel motion estimation; and encode the current image block according to the half-pixel motion vector and the quarter-pixel motion vector.
[0098] This application example can be applied to the encoding of multiple videos. The reduction ratio of the number of sub-pixel motion estimation times and the ΔBD-rate are shown in Table 1.
[0099]
[0100] Table 1
[0101] Compared with the high-precision motion estimation process in traditional encoding technology, which is performed unconditionally, the adaptive precision motion estimation solution provided in this application example adopts motion estimation searches of different precisions when the current image block meets different conditions during motion estimation, thereby reducing the expected number of overall high-precision motion compensation searches, thereby reducing the overall complexity of motion estimation, and is more conducive to reflecting the affine characteristics of motion in the video.
[0102] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0103] Based on the same inventive concept, the embodiment of the present application also provides a motion estimation device in video coding for implementing the motion estimation method in video coding involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations of the one or more embodiments of the motion estimation device in video coding provided below can refer to the limitations of the motion estimation method in video coding above, and will not be repeated here.
[0104] In one embodiment, Figure 4 As shown, a motion estimation device in video coding is provided, comprising:
[0105] An integer pixel motion estimation module 401 is used to perform integer pixel motion estimation on a current image block in a video to obtain an integer pixel motion vector and a target integer pixel motion compensation position corresponding to the integer pixel motion vector;
[0106] An information determination module 402, configured to determine a coding cost of the current image block at the target integer pixel motion compensation position and a quantization parameter of the current image block;
[0107] A threshold determination module 403 is used to obtain a motion vector length threshold of the current image block according to the coding cost and the quantization parameter; the coding cost is positively correlated with the motion vector length threshold, and the quantization parameter is negatively correlated with the motion vector length threshold;
[0108] The pixel-by-pixel motion estimation module 404 is used to perform pixel-by-pixel motion estimation on the current image block to obtain a pixel-by-pixel motion vector if the length of the integer pixel motion vector is greater than or equal to the motion vector length threshold, so as to encode the current image block.
[0109] In one embodiment, the threshold determination module 403 is further configured to:
[0110] A first result is obtained by taking a first constant as an exponent and the coding cost as a base; a second result is obtained by taking a second constant as an exponent and the quantization parameter as a base; and the first result is divided by the second result to obtain a motion vector length threshold of the current image block.
[0111] In one embodiment, the threshold determination module 403 is further configured to:
[0112] The first result is divided by the second result to obtain a ratio; and a product result of a third constant and the ratio is obtained to obtain a motion vector length threshold of the current image block.
[0113] In one embodiment, the threshold determination module 403 is further configured to:
[0114] A product result of a third constant and the ratio and a coding speed control parameter are obtained; and a motion vector length threshold of the current image block is obtained according to the product of the product result and the coding speed control parameter.
[0115] In one embodiment, the sub-pixel motion estimation module 404 is further configured to:
[0116] If the length of the integer-pixel motion vector is greater than or equal to the motion vector length threshold, the accuracy and the number of precisions required for the sub-pixel motion estimation method are determined according to the degree to which the length of the integer-pixel motion vector exceeds the motion vector length threshold, so as to determine a target sub-pixel motion estimation method among sub-pixel motion estimation methods with different precisions; the smaller the degree of excess, the lower the accuracy required for the sub-pixel motion estimation method and the smaller the number of precisions; and sub-pixel motion estimation is performed on the current image block according to the target sub-pixel motion estimation method.
[0117] In one embodiment, the sub-pixel motion estimation module 404 is further configured to:
[0118] Obtain twice the value of the motion vector length threshold; if the length of the integer-pixel motion vector is greater than or equal to the motion vector length threshold, and the length of the integer-pixel motion vector is less than the twice value, then use the half-pixel motion estimation method as the target sub-pixel motion estimation method; if the length of the integer-pixel motion vector is greater than or equal to the twice value, then use the half-pixel motion estimation method and the quarter-pixel motion estimation method as the target sub-pixel motion estimation method.
[0119] Each module in the motion estimation device in the above video coding can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0120] In an exemplary embodiment, a computer device is provided, the internal structure of which can be shown as follows: Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data involved in the above method. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a motion estimation method in video coding is implemented.
[0121] Those skilled in the art will understand that Figure 5The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0122] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above-mentioned various method embodiments when executing the computer program.
[0123] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0124] In one embodiment, a computer program product is provided, on which a computer program is stored, and the computer program is used by a processor to execute the steps in the above-mentioned various method embodiments.
[0125] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0126] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0127] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0128] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A motion estimation method in video coding, characterized in that: The method comprises: Performing integer pixel motion estimation on a current image block in the video to obtain an integer pixel motion vector and a target integer pixel motion compensation position corresponding to the integer pixel motion vector; Determine a coding cost of the current image block at the target integer-pixel motion compensation position and a quantization parameter of the current image block; According to the coding cost and the quantization parameter, a motion vector length threshold of the current image block is obtained; the coding cost is positively correlated with the motion vector length threshold, and the quantization parameter is negatively correlated with the motion vector length threshold; If the length of the integer pixel motion vector is greater than or equal to the motion vector length threshold, sub-pixel motion estimation is performed on the current image block to obtain a sub-pixel motion vector to perform encoding processing on the current image block.
2. The method according to claim 1, characterized in that Obtaining a motion vector length threshold of the current image block according to the encoding cost and the quantization parameter, including: Taking the first constant as an exponent and the encoding cost as a base, a first result is obtained; Using the second constant as an exponent and the quantization parameter as a base, a second result is obtained; The first result is divided by the second result to obtain a motion vector length threshold of the current image block.
3. The method according to claim 2, characterized in that Dividing the first result by the second result to obtain a motion vector length threshold of the current image block includes: Dividing the first result by the second result to obtain a ratio; A product result of a third constant and the ratio is obtained to obtain a motion vector length threshold of the current image block.
4. The method according to claim 3, characterized in that Obtaining a product result of a third constant and the ratio to obtain a motion vector length threshold of the current image block includes: Obtaining a product result of a third constant and the ratio and an encoding speed control parameter; The motion vector length threshold of the current image block is obtained according to the product of the multiplication result and the encoding speed control parameter.
5. The method according to any one of claims 1 to 4, characterized in that: If the length of the integer pixel motion vector is greater than or equal to the motion vector length threshold, performing pixel-by-pixel motion estimation on the current image block, including: If the length of the integer-pixel motion vector is greater than or equal to the motion vector length threshold, then according to the degree of excess of the length of the integer-pixel motion vector relative to the motion vector length threshold, the precision and the number of precisions required for the sub-pixel motion estimation method are determined, so as to determine a target sub-pixel motion estimation method among sub-pixel motion estimation methods with different precisions; the smaller the excess, the lower the precision required for the sub-pixel motion estimation method and the smaller the number of precisions; According to the target sub-pixel motion estimation method, sub-pixel motion estimation is performed on the current image block.
6. The method according to claim 5, characterized in that Determining the required precision and precision quantity of the sub-pixel motion estimation method according to the degree to which the length of the integer pixel motion vector exceeds the motion vector length threshold, so as to determine a target sub-pixel motion estimation method among sub-pixel motion estimation methods with different precisions, including: Obtaining twice the value of the motion vector length threshold; If the length of the integer pixel motion vector is greater than or equal to the motion vector length threshold, and the length of the integer pixel motion vector is less than twice the value, then the half-pixel motion estimation method is used as the target sub-pixel motion estimation method; If the length of the integer pixel motion vector is greater than or equal to the twice value, the half-pixel motion estimation method and the quarter-pixel motion estimation method are used as the target sub-pixel motion estimation method.
7. A motion estimation device in video coding, characterized in that: The device comprises: An integer pixel motion estimation module is used to perform integer pixel motion estimation on a current image block in a video to obtain an integer pixel motion vector and a target integer pixel motion compensation position corresponding to the integer pixel motion vector; An information determination module, used to determine the encoding cost of the current image block at the target integer pixel motion compensation position and the quantization parameter of the current image block; A threshold determination module, configured to obtain a motion vector length threshold of the current image block according to the coding cost and the quantization parameter; the coding cost is positively correlated with the motion vector length threshold, and the quantization parameter is negatively correlated with the motion vector length threshold; The pixel-by-pixel motion estimation module is used to perform pixel-by-pixel motion estimation on the current image block to obtain the pixel-by-pixel motion vector if the length of the integer pixel motion vector is greater than or equal to the motion vector length threshold, so as to encode the current image block.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.