Concurrent implementation method for motion vector search

By using parallel processing for motion vector search, the speed bottleneck caused by serial search in H264 video compression is solved, achieving faster video compression speed and less image quality loss, making it suitable for real-time video compression scenarios.

CN121486587AActive Publication Date: 2026-02-06PENG TI STORAGE TECH (NANJING) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202610022007.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-08
Publication Date
2026-02-06
Estimated Expiration
2046-01-08

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 cannot meet the requirements of real-time compression. Concurrent search can easily lead to image quality distortion.

Method used

If the current macroblock is not a P_SKIP macroblock, then 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 the four computing channels.

Benefits of technology

With a slight increase in bitrate, it significantly improves compression speed, is suitable for real-time video compression, has minimal image quality loss, and is even faster after MEA hardware optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121486587A_ABST
    Figure CN121486587A_ABST
Patent Text Reader

Abstract

The invention discloses a concurrent implementation method of motion vector search, which relates to the technical field of H264 video compression implementation, and comprises the following steps of: judging whether a current macro block meets a condition of becoming a PSKIP macro block according to PSKIP macro block type information of a block adjacent to the current macro block, if the current macro block is judged to be in a PSKIP macro block type, ending search, and otherwise, entering the next step; under the assumption that the partitioning mode is a P16 * 16 partitioning mode, taking a pskipmv variable value obtained by predicting an adjacent block of the current macro block as a prediction vector value of the current macro block, and calculating and judging whether the type of the current macro block is a PSKIP macro block type or not; and when the judgment result does not meet the condition of the PSKIP macro block, carrying out parallel search processing, and carrying out concurrent motion vector search in different blocking modes. Under the condition that a small number of code rates are increased, the compression speed is greatly increased, and the method is more suitable for the use scene of real-time video compression.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of H264 video compression implementation, and particularly to a concurrent implementation method of motion vector search. BACKGROUND

[0002] In H264 compression technology, if inter-frame compression mode is used for a data frame, the best motion vector value of the macroblock to be compressed in the frame is found by searching and comparing the pixel values in the reference frame, so that the overall encoding efficiency of the current frame is optimal. As a classic implementation of H264 compression technology, the x264 scheme searches the best motion vector in the reference frame by gradually trying P_SKIP, P16x16, P16x8, P8x16 and P8x8 (the above are standard macroblock types defined in H264 specification) block modes, and then comparing them with a certain threshold value to obtain the minimum value, until the most suitable macroblock type and block mode is found. This method requires successive comparison, i.e. the comparison threshold value of the next block mode needs to be obtained from the calculation result of the previous block mode, which is not the optimal method for real-time compression environment requiring speed. However, if concurrent search is simply used, it is easy to cause too much distortion. In the present innovative scheme, an optimized process is designed, and on the basis of appropriately modifying the original search model, a new search method of concurrently searching P16x16, P16x8, P8x16 and P8x8 in MEA is realized by sacrificing a small amount of video quality or compression efficiency, so that the video is compressed faster.

[0003] In the previous H264 motion vector search model, if the vector size of a macroblock is to be calculated, the macroblock needs to be divided into P16x16, P16x8, P8x16 and P8x8 four block modes, and the block with the smallest pixel difference value in the reference frame is found. Specifically, after the SAD (Sum of Absolute Difference) and SATD (Sum of Absolute Transformed Difference) are calculated by P16x16 block mode, the value is used to compare the same SAD / SATD value obtained by P16x8 block mode search, and the minimum value is obtained. Then, the minimum value is compared with the SAD / SATD obtained by P8x16 block search, and the minimum value is obtained. Finally, the minimum value is compared with the search result of P8x8, and the block mode with the minimum SATD value is taken as the best block mode, 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 in series, i.e. the search of the next block can only be performed after the current block search is completed. SUMMARY

[0004] In view of the problems existing in the prior art of concurrent implementation of motion vector search, the present application is proposed. On the basis of combining the principle of traditional search, the subtle difference that each search needs to be compared with the P_SKIP macroblock is ignored, and it is directly judged whether the P_SKIP macroblock type is, if not, the SAD / SATD values of the four modes of P16x16, P16x8, P8x16 and P8x8 are calculated by hardware concurrency, and the minimum value is directly outputted after the best block mode and the corresponding motion vector are obtained, so that the compression speed is greatly improved. Therefore, the problem to be solved by the present application is how to provide a concurrent implementation method of motion vector search.

[0005] To solve the above technical problems, the present application provides the following technical solutions. In the first aspect, the present application provides a concurrent implementation method of motion vector search, which comprises: judging whether the current macroblock satisfies the condition of becoming a P_SKIP macroblock according to the P_SKIP macroblock type information of the adjacent block of the current macroblock, if the current macroblock is determined to be a P_SKIP macroblock type and the search is ended, otherwise, the next step is entered. In the case of assuming that the block mode is a P16x16 block mode, the pskip_mv variable value obtained by predicting the adjacent block of the current macroblock is used as the prediction vector value of the current macroblock, and the rd_cost_mb function is used to calculate and judge whether the current macroblock type is a P_SKIP macroblock type. When the judgment result does not satisfy the condition of the P_SKIP macroblock, the hardware MEA module is started to perform parallel search processing, and the concurrent motion vector search under different block modes is performed.

[0006] As a preferred scheme of the concurrent implementation method of motion vector search, the judgment of whether the current macroblock satisfies the condition of becoming a P_SKIP macroblock comprises: When the P_SKIP macroblock type exists in the adjacent left block, the upper block, the upper left block or the upper 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, it is determined that the current macroblock is a P_SKIP macroblock type and the search is ended, otherwise, the next step is entered.

[0007] As a preferred scheme of the concurrent implementation method of motion vector search, the judgment of whether the macroblock is a P_SKIP macroblock comprises: The rd_cost_mb function is used to perform discrete cosine transform and quantization operation on the luminance component and the chrominance component of the current macroblock, when the obtained luminance CBP and chrominance CBP component values are both zero, it is determined that the current macroblock is a P_SKIP macroblock type and the current search process is ended.

[0008] 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. 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.

[0009] 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.

[0010] 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: 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.

[0011] 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.

[0012] 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.

[0013] 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

[0014] 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.

[0015] Figure 1 This is a flowchart of a concurrent implementation method for motion vector search. Detailed Implementation

[0016] 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.

[0017] 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.

[0018] 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.

[0019] Reference Figure 1 This is the first embodiment of the present invention, which provides a concurrent implementation method for motion vector search, including: 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.

[0020] 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.

[0021] 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.

[0022] 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.

[0023] 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.

[0024] 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. 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.

[0025] 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.

[0026] 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.

[0027] 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.

[0028] 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.

[0029] 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. 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 concurrent motion vector search under different block methods.

2. The concurrent implementation method for motion vector search as described in claim 1, characterized in that: 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.

3. The concurrent implementation method for motion vector search as described in claim 1, characterized in that: 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 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.

4. The concurrent implementation method for motion vector search as described in claim 1, characterized in that: 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.

5. The concurrent implementation method for motion vector search as described in claim 4, characterized in that: The hardware MEA module employs a hexagonal search algorithm to simultaneously calculate the motion vector values ​​and the sum of the absolute differences after transformation for each block in four parallel computing channels.

6. The concurrent implementation method for motion vector search as described in claim 4, characterized in that: 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.

7. 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 any one of claims 1 to 6.

8. 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 any one of claims 1 to 6.

Citation Information

Patent Citations

  • Interframe predictive coding mode quick selecting method

    CN101022555A

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

    CN104038764A

  • Method, device, equipment and medium for determining skip type macroblock

    CN109089116A

  • Video coding method and device, parallel computing unit and electronic equipment

    CN115834893A

  • Adaptive partition subset selection module and method for use therewith

    US20100246681A1