An Inter-Frame Prediction Motion Search Decision Method, System and Device
By setting a terminator in the AVS3 encoder, the problem of long encoding time is solved and encoding efficiency is improved by determining whether to skip the search based on the search precision and bit ratio.
Patent Information
- Application Number
- CN202411364760.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-09-27
AI Technical Summary
The existing AVS3 encoder suffers from long encoding time and low efficiency during motion search because the optimal motion vectors are similar under different search accuracies.
By setting a terminator based on search precision, search method, and search step size during the motion search process, the ratio of the number of encoded bits of the optimal motion vector to the rate-distortion optimization value at a certain search precision is determined, and it is decided whether to skip integer pixel searches at other search precisions, thereby reducing the number of RDOs.
It effectively reduces the encoding time in the motion search phase and improves encoding efficiency.
Smart Images

Figure CN119383357B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image and video data compression processing, and in particular to a method, system and apparatus for inter-frame predictive motion search decision. Background Technology
[0002] Motion search and motion estimation are key components of video compression technology, primarily used in inter-frame prediction of video sequences. Their purpose is to reduce redundant information between frames, thereby compressing the video data volume. Motion search refers to finding the best-matching block during inter-frame prediction and calculating the motion vector pointing from the current block to the best-matching block. This process is typically performed in the encoder to find a reference frame block that is closest to the current frame to be encoded. In this way, the difference between the current frame and the reference frame (called the residual) can be effectively represented, rather than directly encoding the entire frame, thus significantly reducing the amount of encoded data.
[0003] Taking the AVS3 encoder as an example, the motion search process includes: Block segmentation: Dividing the current frame into smaller coding units (e.g., 16x16 pixels). Determining the search strategy: Selecting an appropriate motion search algorithm (e.g., full search, diamond search, hexagonal search, grid search, etc.) based on the characteristics of the coding units (e.g., CU size, temporal reference level of the CU). Determining the search precision: Deciding the precision to be used in the motion search process. Generally, it starts with the highest precision and tries all precisions one by one. If the rate-distortion optimization value corresponding to the optimal motion vector in the search result at a certain precision meets the preset threshold condition, it is prematurely terminated, and lower precisions are no longer tried. Motion Search: Based on the search strategy and search precision, a series of motion vectors are obtained. The positions of candidate blocks are determined using these motion vectors. The difference between the current block and candidate blocks (e.g., SAD - Sum of Absolute Differences, SSD - Sum of Squared Differences) is calculated as the distortion corresponding to that motion vector. Simultaneously, the number of bits required to encode the motion vector is calculated. Based on the distortion, the number of bits, and Lagrange multipliers, the optimal rate-distortion value corresponding to that motion vector is calculated. Best Match Selection: Among the optimal rate-distortion values corresponding to the series of motion vectors, the motion vector corresponding to the smallest optimal rate-distortion value is selected as the optimal motion vector obtained from the motion search.
[0004] In the process of motion search, the existing AVS3 encoder sometimes finds that the process of finding the optimal motion vector is extremely similar when multiple rounds of search are performed using different search accuracies, resulting in long encoding time and low efficiency. Summary of the Invention
[0005] The present invention aims to solve the problem of long encoding time in existing encoders when performing motion search.
[0006] This invention proposes an inter-frame predictive motion search decision method, system, and apparatus.
[0007] An inter-frame prediction motion search decision method includes:
[0008] Step 1: Obtain the encoder's search precision, search method, and search step size during the motion search process. Set the corresponding terminator in the encoding unit according to the search method and search step size. When using the first search precision in each encoding unit, set all terminators to A.
[0009] Step 2: The encoder performs an integer-pixel search using the first search precision to obtain the optimal motion vector corresponding to the first search precision, the rate-distortion optimization value corresponding to the optimal motion vector, and the product of the number of bits used to encode the optimal motion vector and the Lagrange multiplier. The above three data are saved. The ratio of the calculated product to the obtained rate-distortion optimization value is calculated. If the ratio meets the preset requirements, the terminator corresponding to the search method and search step size of the first integer-pixel search is set to B.
[0010] Step 3: Perform an integer-pixel search according to the next search precision. First, determine the search method and search step size. If the search method and search step size have been used in the previous search process, and the corresponding early termination flag is B, then do not perform an integer-pixel search under this search precision. Use the saved optimal motion vector as the optimal motion vector for this integer-pixel search, and use the saved rate-distortion optimization value as the rate-distortion optimization value for this integer-pixel search. Use this optimal motion vector as the search starting point to perform a search with a lower step size. Otherwise, obtain the optimal motion vector corresponding to this search precision, the rate-distortion optimization value corresponding to the optimal motion vector, and the product of the number of bits used to encode the optimal motion vector and the Lagrange multiplier. Save the above three data. If the ratio of the obtained product to the obtained rate-distortion optimization value meets the preset requirements, set the termination flag corresponding to the search method and search step size for the integer-pixel search under this search precision to B.
[0011] Step 4: Repeat step 3 until all search precisions have completed the integer pixel search.
[0012] Preferably, in step 2, the rate-distortion optimization value is obtained by summing the product of the number of bits consumed by the encoded motion vector and the Lagrange multiplier with the distortion value of the current coding unit.
[0013] Preferably, the distortion value of the current coding unit includes SAD, STAD, MSE, SSE, SATD, or any combination of the above values.
[0014] Preferably, in step 1, the search step size includes 1, 2, and 4.
[0015] Preferably, in step 1, the search methods for integer pixel search include full search, hexagonal search, diamond search, and grid search.
[0016] Preferably, in step 1, the search precision includes 1 / 4 pixel precision, 1 / 2 pixel precision, 1 pixel precision, 2 pixel precision and 4 pixel precision, and each precision is searched for in whole pixels in order from high precision to low precision.
[0017] An inter-frame predictive motion search decision system is provided for implementing the aforementioned inter-frame predictive motion search decision method. The system includes: a statistics module for acquiring all possible search accuracies, search methods for all integer-pixel searches, and search step sizes during the motion search process; a decision module for calculating the product of the number of bits used in the optimal motion vector and the Lagrange multiplier; and a matching module for determining the final search result.
[0018] An inter-frame predictive motion search decision apparatus includes a storage device and a processing device. The storage device stores a program for implementing the inter-frame predictive motion search decision method, and the processing device includes the encoder.
[0019] Compared with the prior art, the present invention has the following advantages and effects:
[0020] This invention determines whether to skip the integer-pixel search process at other search accuracies by judging the proportion of the number of bits used in the encoded motion vector obtained by integer-pixel search at a certain search accuracy to the total rate-distortion optimization value. This reduces the number of RDOs in the motion search stage and saves encoding time. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0024] like Figure 1 As shown, an inter-frame prediction motion search decision method includes:
[0025] Step 1: Obtain the encoder's search precision, search method, and search step size during the motion search process. Set the corresponding terminator in the encoding unit according to the search method and search step size. When using the first search precision in each encoding unit, set all terminators to A.
[0026] Step 2: The encoder performs an integer-pixel search using the first search precision to obtain the optimal motion vector corresponding to the first search precision, the rate-distortion optimization value corresponding to the optimal motion vector, and the product of the number of bits used to encode the optimal motion vector and the Lagrange multiplier. The above three data are saved. The ratio of the calculated product to the obtained rate-distortion optimization value is calculated. If the ratio meets the preset requirements, the terminator corresponding to the search method and search step size of the first integer-pixel search is set to B.
[0027] Step 3: Perform an integer-pixel search according to the next search precision. First, determine the search method and search step size. If the search method and search step size have been used in the previous search process, and the corresponding early termination flag is B, then do not perform an integer-pixel search under this search precision. Use the saved optimal motion vector as the optimal motion vector for this integer-pixel search, and use the saved rate-distortion optimization value as the rate-distortion optimization value for this integer-pixel search. Use this optimal motion vector as the search starting point to perform a search with a lower step size. Otherwise, obtain the optimal motion vector corresponding to this search precision, the rate-distortion optimization value corresponding to the optimal motion vector, and the product of the number of bits used to encode the optimal motion vector and the Lagrange multiplier. Save the above three data. If the ratio of the obtained product to the obtained rate-distortion optimization value meets the preset requirements, set the termination flag corresponding to the search method and search step size for the integer-pixel search under this search precision to B.
[0028] Step 4: Repeat step 3 until all search precisions have completed the integer pixel search.
[0029] In one specific implementation, in step 1, the search precision includes at least one or more of the following: 1 / 4 pixel precision, 1 / 2 pixel precision, 1 pixel precision, 2 pixel precision, and 4 pixel precision. The integer pixel search methods include at least one or more of the following: full search, hexagonal search, diamond search, and grid search. The search step size includes at least one or more of the following: 1, 2, and 4. A search step size of 1 represents changing the motion vector with 1 pixel as the smallest unit during an integer pixel search; a search step size of 2 represents changing the motion vector with 2 pixels as the smallest unit during an integer pixel search; similarly, a search step size of n represents changing the motion vector with n pixels as the smallest unit during an integer pixel search.
[0030] In one specific implementation, in step 1, the appropriate motion search method and search accuracy range are selected based on conditions such as block size and the temporal reference level of the coding unit. Full search yields the most points and provides the best results, but it is also the most time-consuming. Diamond search is simpler than full search, and hexagonal search is simpler than diamond search. Therefore, to save encoding time, the encoder generally uses diamond search or hexagonal search if a frame is not referenced by other images (i.e., when the temporal reference level is relatively high), and full search if the image is referenced by many other images (i.e., when the temporal reference level is relatively low). If the current block size is large, full search will also be time-consuming, so simpler diamond search or hexagonal search should be used for larger blocks. For example, by setting some thresholds, full search is used when the temporal reference level L < threshold C and the block size is also smaller than another threshold; otherwise, diamond search is used. Diamond search is used when C < temporal reference level L < threshold D, and hexagonal search is used when the temporal reference level L > D.
[0031] In one specific implementation, A is 0 and B is 1. The rate-distortion optimization value is calculated as follows: RD_Cost = Bit_cnt * λ + Dist, where RD_Cost is the rate-distortion optimization value, Bit_cnt is the number of bits used to encode the motion vector, λ is the Lagrange multiplier, which is determined by the qp of the macroblock in which the current coding unit is located, and Dist is the distortion value between the previous coding unit and the prediction unit.
[0032] In one specific implementation, in step 1, the encoder sequentially attempts three search accuracies during motion search: 1 / 4 pixel accuracy, 1 / 2 pixel accuracy, and 1 pixel accuracy. When attempting each pixel accuracy, a full search with a step size of 1 is performed first to obtain the optimal integer pixel motion vector. Furthermore, when each CU attempts the first search accuracy, all early termination flags are set to 0. In step 2, the encoder first attempts the 1 / 4 pixel accuracy. The current encoding unit obtains the optimal integer pixel motion vector and its corresponding rate-distortion optimization value through a full search with a step size of 1. The product of the number of bits used to encode this motion vector and the Lagrange multiplier is calculated. In step 3, with a preset threshold of 10%, the product obtained in step 2 is calculated to account for 5% of the rate-distortion optimization value obtained in step 2. If this proportion is less than the preset threshold, the early termination flag corresponding to the full search with a step size of 1 is set to 1, and the optimal integer pixel motion vector and its rate-distortion optimization value are saved. Step 4: When attempting 1 / 2 pixel precision, a full search with a step size of 1 is also required. First, determine whether the early termination flag corresponding to the full search with a step size of 1 is 1. In this example, it is 1, so skip the full search with a step size of 1. Use the previously saved optimal integer pixel motion vector as the optimal motion vector obtained in this integer pixel search, and use the previously saved rate-distortion optimization value as the optimal rate-distortion optimization value obtained in this integer pixel search. Then, use the optimal integer pixel motion vector as the search starting point to perform a sub-pixel search.
[0033] In one specific implementation, in step 1, the encoder sequentially attempts three search accuracies during motion search: 1 / 4 pixel accuracy, 1 / 2 pixel accuracy, and 1 pixel accuracy. When attempting each pixel accuracy, a full search with a step size of 1 is performed first to obtain the optimal integer pixel motion vector. When each CU attempts the first search accuracy, all identifiers are set to 0. In step 2, the encoder first attempts the 1 / 4 pixel accuracy. The current encoding unit obtains the optimal integer pixel motion vector and the corresponding rate-distortion optimization value through a full search with a step size of 1. The product of the number of bits used to encode this motion vector and the Lagrange multiplier is calculated. In step 3, a preset threshold of 5% is set. If the product obtained in step 2 accounts for 10% of the rate-distortion optimization value obtained in step 2, and this proportion is greater than the preset threshold, then the early termination identifier corresponding to the full search with a step size of 1 is not set to 1. Step 4: When attempting a 1 / 2 pixel precision, a full search with a step size of 1 is also required. First, determine whether the early termination flag corresponding to the full search with a step size of 1 is 1. In this example, it is not 1. Therefore, the current coding unit does not skip the full search with a step size of 1, performs the search, and obtains the optimal integer pixel motion vector. When attempting a search precision of 1, the full search with a step size of 1 is also not skipped.
[0034] In one specific implementation, in step 1, the encoder sequentially attempts three search accuracies during motion search: 1-pixel accuracy, 2-pixel accuracy, and 4-pixel accuracy. Before attempting each pixel accuracy, a diamond search with a step size of 4 is performed to obtain a locally optimal motion vector. When each CU attempts the first search accuracy, all identifiers are set to 0. In step 2, the encoder first attempts 1-pixel accuracy. The current encoding unit obtains a locally optimal motion vector and its corresponding rate-distortion optimization value through a diamond search with a step size of 4. The product of the number of bits used to encode this motion vector and the Lagrange multiplier is calculated. In step 3, with a preset threshold of 10%, the product obtained in step 2 is calculated to account for 5% of the rate-distortion optimization value obtained in step 2. If this proportion is less than the preset threshold, the early termination identifier corresponding to the diamond search with a step size of 4 is set to 1, and the locally optimal motion vector and its rate-distortion optimization value are saved. Step 4: When attempting 2-pixel precision, a diamond search with a step size of 4 is also required. First, determine if the early termination flag corresponding to the diamond search with a step size of 4 is 1. In this example, it is 1, so skip the diamond search with a step size of 4. Use the previously saved local optimal motion vector as the local optimal motion vector obtained by the diamond search with a step size of 4. Use the previously saved rate-distortion optimization value as the optimal rate-distortion optimization value obtained by the search. Then, use this optimal motion vector as the starting point for a search with a lower step size.
[0035] In one specific implementation, in step 1, the encoder sequentially attempts three search accuracies during motion search: 1-pixel accuracy, 2-pixel accuracy, and 4-pixel accuracy. Before attempting each pixel accuracy, a diamond search with a step size of 4 is performed to obtain a locally optimal motion vector. All identifiers are set to 0 when each CU attempts the first search accuracy. In step 2, the encoder first attempts 1-pixel accuracy. The current encoding unit obtains a locally optimal motion vector and its corresponding rate-distortion optimization value through a diamond search with a step size of 4. The product of the number of bits used to encode this motion vector and the Lagrange multiplier is calculated. In step 3, a preset threshold of 5% is set. If the product obtained in step 2 accounts for 10% of the rate-distortion optimization value obtained in step 2, and this proportion exceeds the preset threshold, the early termination identifier corresponding to the full search with a step size of 4 is not set to 1. Step 4: When attempting a 2-pixel precision, a diamond search with a step size of 4 is also required. First, determine whether the early termination flag corresponding to the full search with a step size of 4 is 1. In this example, it is not 1, so the diamond search with a step size of 4 is not skipped. The search is performed to obtain the local optimal motion vector. In subsequent attempts to search with a precision of 1, the diamond search with a step size of 4 is not skipped either.
[0036] An inter-frame predictive motion search decision system is provided for implementing the aforementioned inter-frame predictive motion search decision method. The system includes: a statistics module for acquiring all possible search accuracies, search methods for all integer-pixel searches, and search step sizes during the motion search process; a decision module for calculating the product of the number of bits used in the optimal motion vector and the Lagrange multiplier; and a matching module for determining the final search result.
[0037] An inter-frame predictive motion search decision apparatus includes a storage device and a processing device. The storage device stores a program for implementing the inter-frame predictive motion search decision method, and the processing device includes the encoder.
[0038] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for inter-frame prediction motion search decision, characterized in that, include: Step 1: Obtain the encoder's search precision, search method, and search step size during the motion search process. For the search method and search step size of the integer pixel search, set the corresponding early termination flag. When using the first search precision in each encoding unit, set all early termination flags to A. Step 2: The encoder performs an integer pixel search according to the search precision to obtain the value of the optimal motion vector corresponding to the search precision, the rate-distortion optimization value corresponding to the optimal motion vector, and the product of the number of bits used to encode the optimal motion vector and the Lagrange multiplier. Step 3: Calculate the ratio of the product obtained in Step 2 to the rate-distortion optimization value obtained in Step 2. If the ratio meets the preset requirements, set the early termination flag corresponding to the search method and search step size of this integer pixel search to B. Step 4: When performing integer-pixel searches according to subsequent search precision, first determine the search method and search step size for the integer-pixel search. If it has already been used in the previous search process and the corresponding early termination flag is B, then the integer-pixel search at this search precision is not performed. The value of the optimal motion vector that meets the preset requirements in Step 3 is taken as the final search result of the integer-pixel search, and the rate-distortion optimization value corresponding to the optimal motion vector is taken as the optimal rate-distortion optimization value obtained by the integer-pixel search. Otherwise, continue the integer-pixel search at this search precision and execute the operations in Steps 2 and 3, and then execute the integer-pixel search at the subsequent search precision according to the operations in Step 4.
2. The inter-frame prediction motion search decision method according to claim 1, characterized in that, In step 2, the rate-distortion optimization value is obtained by summing the product of the number of bits consumed by the encoded motion vector and the Lagrange multiplier with the distortion value of the current coding unit.
3. The inter-frame prediction motion search decision method according to claim 2, characterized in that, The distortion value of the current coding unit includes SAD, STAD, MSE, SSE, SATD, or any combination of the above values.
4. The inter-frame prediction motion search decision method according to claim 1, characterized in that, In step 1, the search step size includes 1, 2, and 4.
5. The inter-frame prediction motion search decision method according to claim 1, characterized in that, In step 1, the search methods for integer pixel search include full search, hexagonal search, diamond search, and grid search.
6. The inter-frame prediction motion search decision method according to claim 1, characterized in that, In step 1, the search precision includes 1 / 4 pixel precision, 1 / 2 pixel precision, 1 pixel precision, 2 pixel precision and 4 pixel precision. The integer pixel search of each precision is performed in order from high precision to low precision.
7. An inter-frame prediction motion search decision system, used to implement the inter-frame prediction motion search decision method according to any one of claims 1-6, characterized in that, include: The statistics module is used to obtain the search accuracy, integer pixel search method and search step size during the motion search process; the decision module is used to calculate the product of the number of bits used by the optimal motion vector and the Lagrange multiplier; the matching module is used to determine the final search result.
8. An inter-frame prediction motion search decision device, characterized in that, It includes a storage device and a processing device, wherein the storage device is used to store a program for implementing the inter-frame prediction motion search decision method according to any one of claims 1-6, and the processing device includes the encoder according to any one of claims 1-6.
Citation Information
Patent Citations
Intraframe video encoding optimization method based on video texture information
CN104796694A
VVC interframe coding unit prediction mode early decision and block division early termination method
CN110087087A