A concurrent implementation method for motion vector search

By parallel processing of P_SKIP macroblock judgment and concurrent search of the hardware MEA module, the problem of insufficient motion vector search speed in H264 video compression is solved, achieving faster video compression speed and less image quality loss.

CN121486587BActive Publication Date: 2026-04-03PENG TI STORAGE TECH (NANJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-08
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In existing H.264 video compression technology, the motion vector search uses a serial method, which results in insufficient compression speed and makes it difficult to meet the requirements of real-time video compression. Concurrent search is prone to image quality distortion.

Method used

By determining whether the current macroblock is of type P_SKIP, if not, concurrent motion vector searches of P16×16, P16×8, P8×16 and P8×8 are performed in parallel in the hardware MEA module. The hexagonal search algorithm is used to simultaneously calculate the motion vector and the absolute difference after transformation in four computing channels.

Benefits of technology

With a slight increase in bitrate, compression speed is significantly improved, making it suitable for real-time video compression. The reduction in image quality is less than the reduction in SSIM value, and the speed is even faster after MEA hardware optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121486587B_ABST
    Figure CN121486587B_ABST
Patent Text Reader

Abstract

This invention discloses a concurrent implementation method for motion vector search, relating to the field of H.264 video compression technology. The method includes determining whether the current macroblock meets the conditions for becoming a P_SKIP macroblock based on the P_SKIP macroblock type information of its neighboring blocks. If the current macroblock is determined to be of type P_SKIP, the search ends; otherwise, it proceeds to the next step. Assuming a P16×16 block partitioning method, the pskip_mv variable value predicted from the neighboring blocks is used as the predicted vector value of the current macroblock. The method then calculates and determines whether the current macroblock type is of type P_SKIP. When the determination result does not meet the conditions for a P_SKIP macroblock, parallel search processing is performed, conducting concurrent motion vector searches under different partitioning methods. This invention achieves a significant improvement in compression speed with a slight increase in bitrate, making it more suitable for real-time video compression applications.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of H.264 video compression technology, and in particular to a concurrent implementation method for motion vector search. Background Technology

[0002] In H.264 compression, if inter-frame compression is used for a data frame, the optimal motion vector value for the macroblock to be compressed within that frame needs to be found by searching and comparing pixel values ​​in its reference frame to optimize the overall coding efficiency of the current frame. The ×264 scheme, a classic implementation of H.264 compression, searches for the optimal motion vector in the reference frame by progressively trying different block types such as P_SKIP, P16×16, P16×8, P8×16, and P8×8 (these are standard macroblock types defined in the H.264 specification). Each vector is compared to a predetermined threshold, and the minimum value is taken until the most suitable macroblock type and block type are found. This method requires successive comparisons; the threshold for the next block type comparison needs to be derived from the previous calculation. This is not optimal for real-time compression environments requiring high speed. However, simply using concurrent search can easily lead to excessive distortion. In this innovative solution, we adopted an optimized process design. By appropriately modifying the original search model and sacrificing a small amount of video quality or compression efficiency, we achieved a new search method in MEA that performs concurrent P16×16, P16×8, P8×16 and P8×8 searches, thereby compressing videos faster.

[0003] Based on previous H.264 motion vector search models, to calculate the vector size of a macroblock, it is necessary to divide the macroblock into four types: P16×16, P16×8, P8×16, and P8×8, and find the block with the smallest pixel difference from the current macroblock in the reference frame. Specifically, after calculating SAD (Sum of Absolute Difference) and SATD (Sum of Absolute Transformed Difference) using the P16×16 block method, this value is compared with the same SAD / SATD value obtained in the next P16×8 block method search. The minimum value is then taken and compared with the SAD / SATD obtained in the subsequent P8×16 block method search to obtain the minimum value again. Finally, it is compared with the search results of P8×8, and the block method with the smallest SATD value is taken as the best block, and the corresponding motion vector value is taken as the optimal motion vector value. As can be seen, this search method can only be performed sequentially, meaning that the search for the next block can only begin after the current block search calculation is completed. Summary of the Invention

[0004] In view of the problems existing in the concurrent implementation method of motion vector search, this invention is proposed. Based on the traditional search principle, it ignores the subtle differences in comparing with P_SKIP macroblocks in each search, directly determining whether it is a P_SKIP macroblock type. If not, it performs SAD / SATD values ​​concurrently in hardware for four modes: P16×16, P16×8, P8×16, and P8×8, and directly outputs the optimal block partitioning method and its corresponding motion vector after taking the minimum value, significantly improving compression speed. Therefore, the problem this invention aims to solve is how to provide a concurrent implementation method for motion vector search.

[0005] To solve the above-mentioned technical problems, the present invention provides the following technical solution:

[0006] In a first aspect, the present invention provides a concurrent implementation method for motion vector search, which includes: determining whether the current macroblock meets the conditions for becoming a P_SKIP macroblock based on the P_SKIP macroblock type information of the adjacent blocks of the current macroblock; if the current macroblock is determined to be of type P_SKIP macroblock and the search ends, otherwise proceed to the next step;

[0007] Assuming the block partitioning method is P16×16, the pskip_mv variable value obtained from the prediction of the adjacent blocks of the current macroblock is used as the prediction vector value of the current macroblock. The rd_cost_mb function is used to calculate and determine whether the current macroblock type is P_SKIP macroblock type.

[0008] When the judgment result does not meet the conditions of the P_SKIP macroblock, the hardware MEA module is started to perform parallel search processing and concurrent motion vector search under different block methods.

[0009] As a preferred embodiment of the concurrent implementation method for motion vector search described in this invention, the step of determining whether the current macroblock meets the conditions for becoming a P_SKIP macroblock includes:

[0010] When a P_SKIP macroblock type exists in an adjacent left block, top block, top-left block, or top-right block, the x264_macroblock_probe_skip function is used to detect whether the current macroblock belongs to the P_SKIP macroblock type. If the function returns true, the current macroblock is determined to be of the P_SKIP macroblock type and the search ends; otherwise, proceed to the next step.

[0011] As a preferred embodiment of the concurrent implementation method for motion vector search described in this invention, the step of determining whether a macroblock is a P_SKIP macroblock includes:

[0012] The rd_cost_mb function is used to perform discrete cosine transform and quantization operations on the luminance and chrominance components of the current macroblock, respectively. When the resulting luminance CBP and chrominance CBP component values ​​are both zero, the current macroblock is determined to be of type P_SKIP and the current search process ends.

[0013] As a preferred embodiment of the concurrent implementation method of motion vector search described in this invention, the hardware MEA module is used to determine the pixel position corresponding to the pskip_mv motion vector in the same reference frame, which serves as the common search starting point for the four block-based methods, and performs synchronous search calculations for multiple block types.

[0014] Before startup, the cached pskip_mv variable value is simultaneously used as the initial motion vector input to the hardware MEA module for four block types: P8×8, P16×16, P16×8, and P8×16.

[0015] As a preferred embodiment of the concurrent implementation method for motion vector search described in this invention, the hardware MEA module adopts a hexagonal search algorithm to simultaneously calculate the motion vectors and the sum of absolute differences after transformation in each block in four parallel computing channels.

[0016] As a preferred embodiment of the concurrent implementation method for motion vector search described in this invention, the step of performing synchronous search calculations of multi-block type includes:

[0017] After completing the parallel search of four block partitioning methods (P8×8, P16×16, P16×8, and P8×16), the hardware MEA module compares the minimum absolute difference after transformation for each block type, selects the block type with the smallest difference as the best macroblock partitioning mode, and outputs the corresponding motion vector value as the best motion vector.

[0018] In a second aspect, the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement a concurrent implementation method for motion vector search.

[0019] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements the steps of a concurrent implementation method for motion vector search.

[0020] The beneficial effects of this invention are as follows: In the process of implementing the motion search function as hardware acceleration, this invention optimizes the sequential comparison of ME search into a parallel comparison technique, thereby achieving a significant improvement in compression speed with a small increase in bit rate. This makes it more suitable for real-time video compression scenarios. Compared with the improved image quality generated on a computer, the compression speed on the computer is faster even with a small reduction in SSIM value, and the speed will be even faster with MEA hardware optimization. Attached Figure Description

[0021] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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 a concurrent implementation method for motion vector search. Detailed Implementation

[0023] To make the above-mentioned objects, features, and advantages of the present invention more readily understood, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.

[0024] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0025] Secondly, the term "an embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places throughout this specification does not necessarily refer to the same embodiment, nor is it a single embodiment or an embodiment selectively excluded from other embodiments.

[0026] Reference Figure 1 This is the first embodiment of the present invention, which provides a concurrent implementation method for motion vector search, including:

[0027] In the traditional H.264 motion vector search model, to calculate the vector size of a macroblock, the macroblock needs to be divided into three blocks: P16x16, P16x8, and P8x16. The block with the smallest pixel difference from the current macroblock in the reference frame is then searched. Specifically, after calculating SAD and SATD using the P16x16 block method, this value is compared with the same SAD / SATD value obtained in the next P16x8 block search. The minimum value is then compared again with the SAD / SATD obtained in the subsequent P8x16 block search to find the minimum value. Finally, the block with the smallest SATD value is taken as the optimal block, and the corresponding motion vector value is taken as the optimal motion vector value. It can be seen that this search method can only be performed serially; that is, the search for the next block can only begin after the current block search calculation is completed. This method, based on its search principle, ignores the subtle differences in comparing with P_SKIP in each search. It directly first determines if the block is of type P_SKIP. If not, it uses hardware concurrency to calculate the SAD / SATD values ​​for P16x16, P16x8, and P8x16, taking the minimum value and directly outputting the optimal block partitioning method and its corresponding mv value. This significantly improves compression speed. The improved implementation process is as follows: Figure 1 As shown.

[0028] Step 1: Directly refer to the P_SKIP macroblock type of adjacent blocks to determine whether the current macroblock meets the P_SKIP macroblock type. The judgment rule is: if the P_SKIP macroblock type has appeared in the left block, upper block, upper left block, or upper right block adjacent to the current macroblock, then first use the x264_macroblock_probe_skip function to detect whether the current macroblock is also a P_SKIP macroblock. If the function returns true, then the current macroblock is considered to be a P_SKIP macroblock, and the search can be ended early.

[0029] Step 2: Probe again. When the pskip_mv predicted from neighboring blocks in a P16×16 block format is marked as the motion vector value and used as the prediction vector value of the current macroblock, the rd_cost_mb function is used to determine whether the current macroblock is a P_SKIP macroblock. The specific rule is: the current macroblock is quantized with a predetermined qp value, and the luminance component and chrominance component of the current macroblock are subjected to discrete cosine transform and quantization operations respectively. If the luminance CBP (CodedBlockPattern) and chrominance CBP component values ​​obtained from the block are both 0, then the current macroblock is determined to be of the P_SKIP macroblock type, and the search can be terminated early.

[0030] The `rd_cost_mb` function is used to determine macroblock parameters. Specifically, it uses the given QP (Quantization Parameter) value of the input macroblock to perform a Discrete Cosine Transform (DCT) and quantization calculation on the difference between the current macroblock and its prediction block. Based on this result, it further calculates the coding length and returns the sum of the SSD and the coding bit length as the function execution result. If the intermediate calculation result generated by this function, i.e., the luminance CBP and chrominance CBP component values ​​of the current macroblock, are both zero, the current macroblock is determined to be of type P_SKIP, and the current search process ends.

[0031] Step 3: Otherwise, the hardware MEA module is started to perform parallel search. During the search, the cached pskip_mv is used as the initial motion vector for four block types: P8×8, P16×16, P16×8, and P8×16. This initial motion vector is input into the designed hardware MEA module. The pixel position of the pskip_mv motion vector is found in the same reference frame and used as the common search starting point for the four block types: P8×8, P16×16, P16×8, and P8×16. Using the hexagonal search algorithm, the motion vector and the sum of the absolute differences after transformation are calculated simultaneously on four computing channels. Since these four searches already have all the search elements, they can be performed simultaneously in the MEA hardware module. After finding the motion vector and the sum of the absolute differences after transformation for each block, the parallel search process for each block ends.

[0032] The hexagonal search algorithm typically employs a staged search strategy to improve efficiency. **Initial Search Phase:** Centered on the search starting point, a hexagonal template is used to calculate the matching error (e.g., sum of absolute pixel differences, SAD) of the center point and its six surrounding points. If the minimum matching error is located at the center point, a refinement search is initiated; otherwise, the hexagonal search is repeated around this minimum error point until a local optimum is reached. **Refinement Search Phase:** Centered on the local optimum, a denser template (e.g., a small rhombus or small square template) is used to further refine the matching accuracy, ultimately determining the optimal matching point.

[0033] Step 4: After the parallel search is completed, the hardware MEA module automatically compares the optimal transformed absolute difference (SAD) and SATD values ​​calculated for each of the four block partitioning methods: P16×16, P16×8, P8×16, and P8×8. For a macroblock unit with a length and width of 16×16 pixels, the sum of the SAD values ​​of the upper and lower blocks of P16×8 (each block is 16 pixels long and 8 pixels wide) is compared with the sum of the SAD values ​​of the left and right blocks of P8×16 (each block is 8 pixels long and 16 pixels wide), and then compared with the sum of the SAD values ​​of the four blocks of P8×8 (each block is 8 pixels long and 8 pixels wide). If the total SAD value of a certain block type is the smallest, then that block will be taken as the optimal macroblock type obtained by concurrent search, and the corresponding motion vector value will be taken as the optimal motion vector value.

[0034] This embodiment also provides a computer device applicable to a concurrent implementation method for motion vector search, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement all or part of the steps of the method described in the above embodiments of the present invention.

[0035] This embodiment also provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, it performs the method in any optional implementation of the above embodiments. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0036] The storage medium proposed in this embodiment and the data storage method proposed in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.

[0037] In summary, this invention, in implementing the motion search function with hardware acceleration, optimizes the sequential comparison of ME search into a parallel comparison technique. This achieves a significant improvement in compression speed with a small increase in bitrate, making it more suitable for real-time video compression scenarios. For the improved image quality comparison generated on the computer, the compression speed is faster even with a small reduction in SSIM value, and the speed will be even faster with MEA hardware optimization.

[0038] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A concurrent implementation method for motion vector search, characterized in that: include: Based on the P_SKIP macroblock type information of the adjacent blocks of the current macroblock, determine whether the current macroblock meets the conditions to become a P_SKIP macroblock. If the current macroblock is determined to be of type P_SKIP macroblock, end the search; otherwise, proceed to the next step. The conditions for determining whether the current macroblock meets the criteria to become a P_SKIP macroblock include: When a P_SKIP macroblock type exists in an adjacent left block, top block, top-left block, or top-right block, the x264_macroblock_probe_skip function is used to detect whether the current macroblock belongs to the P_SKIP macroblock type. If the function returns true, the current macroblock is determined to be of the P_SKIP macroblock type and the search ends; otherwise, proceed to the next step. The determination of whether a macroblock is a P_SKIP macroblock includes: The rd_cost_mb function is used to perform discrete cosine transform and quantization operations on the luminance and chrominance components of the current macroblock, respectively. When the luminance CBP and chrominance CBP component values ​​are both zero, the current macroblock is determined to be of type P_SKIP and the current search process ends. Assuming the block partitioning method is P16×16, the pskip_mv variable value obtained from the prediction of the adjacent blocks of the current macroblock is used as the prediction vector value of the current macroblock. The rd_cost_mb function is used to calculate and determine whether the current macroblock type is P_SKIP macroblock type. When the judgment result does not meet the conditions of the P_SKIP macroblock, the hardware MEA module is started to perform parallel search processing and perform concurrent motion vector search under different block methods; The hardware MEA module is used to determine the pixel position corresponding to the pskip_mv motion vector in the same reference frame, which serves as the common search starting point for the four block partitioning methods, and performs synchronous search calculations for multiple block partitioning types. Before startup, the cached pskip_mv variable value is simultaneously used as the initial motion vector input to the hardware MEA module for four block types: P8×8, P16×16, P16×8, and P8×16. The hardware MEA module uses a hexagonal search algorithm to simultaneously calculate the motion vector values ​​and the sum of the transformed absolute differences for each block in four parallel computing channels. The synchronous search calculation for multi-block type includes: After completing the parallel search of four block partitioning methods (P8×8, P16×16, P16×8, and P8×16), the hardware MEA module compares the sum of the minimum absolute differences after transformation for each block type, selects the block type with the smallest sum of absolute differences as the best macroblock partitioning mode, and outputs the corresponding motion vector value as the best motion vector.

2. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the concurrent implementation method for motion vector search as described in claim 1.

3. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the concurrent implementation method for motion vector search as described in claim 1.

Citation Information

Patent Citations

  • Interframe predictive coding mode quick selecting method

    CN101022555A

  • H.264-to-H.265 video transcoding method and transcoder

    CN104038764A