Method, apparatus and device for motion vector determination in video coding, and storage medium
Patent Information
- Application Number
- CN202211222054.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-08
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2042-10-08
AI Technical Summary
[0004]本申请实施例提供了一种视频编码中的运动矢量确定方法、装置、设备及存储介质,解决了相关技术中,在视频编码过程中,确定最佳运动矢量时,存在运算资源浪费的问题,本方案在运动矢量的确定过程中,充分考虑了编码块之间的空间相关性和时序相关性,减少了运动矢量确定过程中计算量的同时,提高了编码效率以及视频编码速度
[0021]本申请实施例中,在视频编码过程中,在确定当前编码块的运动矢量时,基于当前编码块的空域相邻块和时域相邻块构建运动矢量候选列表,在运动矢量候选列表中确定编码代价最小的运动矢量为起始运动矢量,并记录该起始运动矢量的编码代价,根据当前编码块的相邻块的编码预测模式,确定编码代价阈值,在编码代价小于编码代价阈值的情况下,将起始运动矢量确定为当前编码块的运动矢量。本方案中,使用当前编码块的空域相邻块和时域相邻块构建运动矢量候选列表,根据当前编码块的相邻块的编码预测模式来确定编码代价阈值,充分考虑了编码块之间的空间相关性和时序相关性,针对编码代价小于编码代价阈值的情况下,直接将确定出的起始运动矢量作为当前编码块的运动矢量,跳过后续进一步的在起始运动矢量周围搜索确认当前编码块的运动矢量的步骤,减少了计算量同时提高了编码效率以及视频编码速度。
Smart Images

Figure CN115914646B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video processing technology, and in particular to a method, apparatus, device, and storage medium for determining motion vectors in video encoding. Background Technology
[0002] In video encoding, to improve encoding efficiency, video encoders typically pre-encode video frames before starting formal encoding. This pre-encodes the frames to determine the frame type and collect encoding information, such as the intra-frame coding cost of the current downsampled frame, the optimal intra-frame prediction mode, and the inter-frame coding cost of the current downsampled frame. This encoding information allows for faster decision-making during formal encoding, improving decision-making efficiency.
[0003] In video precoding, multiple consecutive frames are typically buffered to form a raw image queue. This queue is then used to dynamically determine frame type by traversing different frame types and reference frame combinations, calculating the coding cost of each combination. Typically, video precoding downsamples the raw image and divides it into multiple non-overlapping coding units of the same size for prediction mode search and decision-making, including intra-frame prediction and inter-frame prediction. Intra-frame prediction primarily selects the prediction mode with the lowest coding cost for each coding unit, while inter-frame prediction uses a motion estimation algorithm to select the motion vector with the lowest coding cost from the reference image for each coding unit. Finding the best-matching block for the current block using the motion estimation algorithm in the reference image is a relatively time-consuming process in the coding framework. A common approach is to determine the initial motion vector based on the motion vector information of adjacent blocks in the spatial and temporal domains of the current block, and then further search the vicinity of the initial motion vector to determine the best-matching block and its corresponding motion vector. However, this method of determining the motion vector corresponding to the best-matching block indiscriminately searches the vicinity of the initial motion vector, resulting in poor flexibility and wasted computational resources. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for determining motion vectors in video coding. It solves the problem of wasted computing resources when determining the optimal motion vector during video coding in related technologies. This solution fully considers the spatial and temporal correlations between coding blocks during the motion vector determination process, reducing the amount of computation in the motion vector determination process while improving coding efficiency and video coding speed.
[0005] In a first aspect, embodiments of this application provide a method for determining motion vectors in video coding, the method comprising:
[0006] Construct a candidate list of motion vectors based on the spatial and temporal neighboring blocks of the current coding block;
[0007] The motion vector with the lowest encoding cost is selected as the starting motion vector from the candidate motion vector list, and the encoding cost of the starting motion vector is recorded.
[0008] The coding cost threshold is determined based on the coding prediction patterns of the adjacent blocks of the current coding block;
[0009] If the encoding cost is less than the encoding cost threshold, the starting motion vector is determined as the motion vector of the current encoding block.
[0010] Secondly, embodiments of this application also provide a motion vector determination device in video encoding, comprising:
[0011] The candidate list generation module is configured to construct a motion vector candidate list based on the spatial and temporal neighboring blocks of the current coding block;
[0012] The list processing module is configured to determine the motion vector with the lowest encoding cost as the starting motion vector from the motion vector candidate list, and record the encoding cost of the starting motion vector.
[0013] The threshold determination module is configured to determine the coding cost threshold based on the coding prediction modes of the adjacent blocks of the current coding block;
[0014] The vector determination module is configured to determine the starting motion vector as the motion vector of the current coding block when the coding cost is less than the coding cost threshold.
[0015] Thirdly, embodiments of this application also provide a motion vector determination device in video coding, the device comprising:
[0016] One or more processors;
[0017] Storage device for storing one or more programs.
[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the motion vector determination method in video encoding as described in the embodiments of this application.
[0019] Fourthly, embodiments of this application also provide a non-volatile storage medium for storing computer-executable instructions, which, when executed by a computer processor, are used to perform the motion vector determination method in video encoding described in embodiments of this application.
[0020] Fifthly, embodiments of this application also provide a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor of the device reads from the computer-readable storage medium and executes the computer program, causing the device to perform the motion vector determination method in video encoding described in embodiments of this application.
[0021] In this embodiment, during video encoding, when determining the motion vector of the current coding block, a motion vector candidate list is constructed based on the spatial and temporal neighboring blocks of the current coding block. The motion vector with the lowest encoding cost is selected as the starting motion vector from this candidate list, and its encoding cost is recorded. An encoding cost threshold is determined based on the encoding prediction modes of the neighboring blocks of the current coding block. If the encoding cost is less than the threshold, the starting motion vector is determined as the motion vector of the current coding block. This scheme uses the spatial and temporal neighboring blocks of the current coding block to construct the motion vector candidate list and determines the encoding cost threshold based on the encoding prediction modes of the neighboring blocks. This fully considers the spatial and temporal correlations between coding blocks. When the encoding cost is less than the threshold, the determined starting motion vector is directly used as the motion vector of the current coding block, skipping the subsequent step of searching around the starting motion vector to confirm the motion vector of the current coding block. This reduces computational load while improving encoding efficiency and video encoding speed. Attached Figure Description
[0022] Figure 1 A flowchart illustrating a method for determining motion vectors in video coding, provided in an embodiment of this application;
[0023] Figure 2 A schematic diagram illustrating the determination of spatially adjacent blocks of the current coded block, provided as an embodiment of this application;
[0024] Figure 3 A flowchart illustrating a motion vector determination method including encoding cost threshold determination, provided in an embodiment of this application;
[0025] Figure 4 A flowchart illustrating another motion vector determination method including encoding cost threshold determination provided in this application embodiment;
[0026] Figure 5 A structural block diagram of a motion vector determination device in video coding provided in this application embodiment;
[0027] Figure 6 This is a schematic diagram of a motion vector determination device in video encoding, provided as an embodiment of this application. Detailed Implementation
[0028] The embodiments of this application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the embodiments of this application and are not intended to limit the scope of the embodiments. Furthermore, it should be noted that, for ease of description, only the parts relevant to the embodiments of this application are shown in the accompanying drawings, not the entire structure.
[0029] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0030] The motion vector determination method for video encoding provided in this application embodiment can be applied to video encoding scenarios. During video encoding, to improve the compression ratio and achieve video compression using the fewest possible bits, it is necessary to determine suitable motion vectors for each encoding block. This allows for minimum-cost video encoding of the current encoding block based on the reference block associated with the motion vector. This motion vector determination method can be applied to any scenario requiring video encoding. For example, in the live streaming industry, the video stream captured by the broadcaster needs to be encoded before transmission; similarly, video encoding is required when recording video.
[0031] Figure 1 A flowchart of a motion vector determination method in video coding provided in this application embodiment specifically includes the following steps:
[0032] Step S101: Construct a motion vector candidate list based on the spatial and temporal neighboring blocks of the current coding block.
[0033] In one embodiment, when determining the motion vector of the current coding block during video encoding, a motion vector candidate list is first established. The motion vector candidate list is constructed using the motion vector information of the spatial and temporal neighboring blocks of the current coding block.
[0034] In the video encoding process, the original image is downsampled, and then the downsampled image is divided into multiple non-overlapping coding units of the same size for prediction mode search and decision-making. For each coding unit, when performing prediction mode search and decision-making, the coding unit is defined as the current coding block.
[0035] In one embodiment, the process of constructing a motion vector candidate list based on the spatial and temporal neighboring blocks of the current coding block can be as follows: obtaining the motion vector information of neighboring coding blocks in a preset direction of the current coding block, and adding the motion vector information of coding blocks at the same position in the reference image of the current coding block to the created motion vector candidate list. Optionally, the preset direction can be a pre-defined direction in which the current block selects spatial neighboring blocks when constructing the corresponding motion vector candidate list. Different video coding standards can use different preset directions for determination. For example, ... Figure 2 As shown, Figure 2 This application provides a schematic diagram of determining the spatial adjacent blocks of the current coding block, wherein the preset direction can be the right coding block, the bottom coding block, the lower left coding block, and the lower right coding block of the current coding block, i.e., for... Figure 2 As shown, taking code block 0 as an example, code blocks 1, 2, 3, and 4 are identified as spatially adjacent blocks of the current code block. When constructing a motion vector candidate list based on the motion vector information of the spatially adjacent blocks, the aforementioned preset direction and the number of spatially adjacent blocks of the current code block can be preset. For temporally adjacent blocks of the current code block, the motion vector information of code blocks at the same position in the reference image of the current code block is added to the created motion vector candidate list. It should be noted that the motion vector information of code blocks at the same position in the reference image of the current code block, as well as code blocks adjacent to the same position, can also be added to the created motion vector candidate list; the specific number of selected code blocks is adjustable. This motion vector information records the positional relationship between the spatially adjacent blocks and the temporally adjacent blocks corresponding to the current code block.
[0036] Step S102: Determine the motion vector with the minimum encoding cost from the motion vector candidate list as the starting motion vector, and record the encoding cost of the starting motion vector.
[0037] In one embodiment, after constructing the motion vector candidate list, the motion vector with the lowest encoding cost is determined as the starting motion vector from the motion vector candidate list, and the encoding cost of the starting motion vector is recorded accordingly.
[0038] Optionally, the specific calculation process may be as follows: traverse the candidate motion vectors in the candidate motion vector list, calculate the encoding cost of the matching block and the current encoding block corresponding to each candidate motion vector, and select the candidate motion vector with the smallest encoding cost as the starting motion vector from the calculated encoding costs.
[0039] For example, using candidate motion vectors (MV) x ,MV yTaking a sample image as an example, determine the matching block of the current coding block in the reference image, calculate the SAD (Sum of Absolute Difference) cost between the current coding block src and the matching block ref, and select the motion vector with the smallest SAD cost as the starting motion vector. Each candidate motion vector (MV...) x ,MV y The formula for calculating SAD corresponding to this is as follows:
[0040]
[0041] Where M and N represent the width and height of the coded block, respectively. It should be noted that the above example uses SAD cost as the coding cost for calculation, but other coding cost calculation methods can also be used, which are not limited here.
[0042] Step S103: Determine the coding cost threshold based on the coding prediction modes of the adjacent blocks of the current coding block.
[0043] In one embodiment, determining the motion vector of the current coding block includes a process of determining a coding cost threshold. Optionally, the coding cost threshold is determined based on the coding prediction patterns of neighboring blocks of the current coding block, with different coding cost thresholds corresponding to different neighboring block coding prediction patterns. This approach takes into account the strong spatial and temporal correlations between coding blocks, and therefore uses the prediction patterns of neighboring blocks to design different coding cost thresholds.
[0044] Optionally, the adjacent block can be one or more coding blocks in a preset direction of the current coding block, and the specific selection method of the adjacent block can be preset. In one embodiment, when selecting the corresponding coding cost threshold based on the coding prediction modes of multiple adjacent blocks, if the coding prediction modes of the multiple adjacent blocks of the current coding block are different, the coding prediction mode with the most codes can be used as a reference, and its corresponding coding cost threshold can be used.
[0045] Step S104: If the encoding cost is less than the encoding cost threshold, the starting motion vector is determined as the motion vector of the current encoding block.
[0046] In one embodiment, after determining the starting motion vector of the current coding block based on the motion vector candidate list and determining the coding cost threshold based on the coding prediction modes of the adjacent blocks of the current coding block, the coding cost corresponding to the starting motion vector is compared with the coding cost threshold to determine whether to skip further motion vector searches. Specifically, if the coding cost is less than the coding cost threshold, the starting motion vector is determined as the motion vector of the current coding block, meaning no further searches are performed. This approach is based on the consideration that in video precoding, when the coding cost of the starting motion vector is sufficiently small (i.e., less than the coding cost threshold set in this scheme), the probability that the starting motion vector is the optimal motion vector is very high. Further searching near the starting motion vector is very inefficient and would waste a significant amount of computational resources.
[0047] In one embodiment, if the encoding cost is not less than the encoding cost threshold, then the motion vector with the minimum encoding cost is searched around the starting motion vector to ensure that the motion vector with the minimum encoding cost can be determined, thereby ensuring the compression rate of the video encoding.
[0048] As described above, during video coding, when determining the motion vector of the current coding block, a candidate list of motion vectors is constructed based on the spatial and temporal neighboring blocks of the current coding block. The motion vector with the lowest coding cost is selected from this candidate list as the starting motion vector, and its coding cost is recorded. A coding cost threshold is determined based on the coding prediction modes of the neighboring blocks of the current coding block. If the coding cost is less than the threshold, the starting motion vector is determined as the motion vector of the current coding block. This scheme uses the spatial and temporal neighboring blocks of the current coding block to construct the candidate motion vector list and determines the coding cost threshold based on the coding prediction modes of the neighboring blocks. This fully considers the spatial and temporal correlations between coding blocks. When the coding cost is less than the threshold, the determined starting motion vector is directly used as the motion vector of the current coding block, skipping the subsequent step of searching around the starting motion vector to confirm the motion vector of the current coding block. This reduces computational load while improving coding efficiency and video coding speed.
[0049] Figure 3 A flowchart of a motion vector determination method including encoding cost threshold determination provided in an embodiment of this application is shown below. Figure 3 Specifically, it includes:
[0050] Step S201: Construct a motion vector candidate list based on the spatial and temporal neighboring blocks of the current coding block.
[0051] Step S202: Determine the motion vector with the lowest encoding cost from the motion vector candidate list as the starting motion vector, and record the encoding cost of the starting motion vector.
[0052] Step S203: When the coding prediction mode of the adjacent blocks of the current coding block is merge prediction mode, the coding cost threshold is determined as a first cost threshold; when the coding prediction mode of the adjacent blocks of the current coding block is intra-frame prediction mode, the coding cost threshold is determined as a second cost threshold.
[0053] In one embodiment, corresponding coding cost thresholds are pre-set for different coding prediction modes. Optionally, taking the coding prediction modes including merge prediction mode and intra-frame prediction mode as an example, their corresponding coding cost thresholds can be set as a first cost threshold and a second cost threshold, respectively. The first cost threshold and the second cost threshold are different, and their specific values can be set empirically. For example, the first cost threshold and the second cost threshold can be selected for multiple test videos with different resolutions and different scenes to determine the first cost threshold and the second cost threshold with the minimum computational cost and optimal efficiency. Optionally, the specific values of the first cost threshold and the second cost threshold are different under different video coding mode frameworks. An exemplary value range can be between 256 and 1024.
[0054] Step S204: If the encoding cost is less than the encoding cost threshold, the starting motion vector is determined as the motion vector of the current encoding block.
[0055] In one embodiment, during the comparison of coding cost and coding cost threshold, after obtaining the corresponding coding cost threshold for comparison based on the aforementioned determined coding prediction mode, if the coding prediction mode of the adjacent blocks of the current coding block is merge prediction mode, the coding cost is compared with the first cost threshold; if the coding prediction mode of the adjacent blocks of the current coding block is intra-frame prediction mode, the coding cost is compared with the second cost threshold. Specifically, taking the first case as an example, if the coding cost is less than the first cost threshold, the starting motion vector is determined as the motion vector of the current coding block; taking the second case as an example, if the coding cost is less than the second cost threshold, the starting motion vector is determined as the motion vector of the current coding block.
[0056] It should be noted that the above are only two exemplary coding prediction modes and the determination of the corresponding coding cost thresholds. Other coding prediction modes may also have corresponding coding cost thresholds set, which are not limited here.
[0057] As can be seen from the above, the coding prediction mode of the adjacent blocks of the current coding block is used as the basis for determining the coding cost threshold. Different coding prediction modes are set with different coding cost thresholds, so that the results of subsequent coding cost comparisons are more accurate and reliable, and conform to the actual video coding situation.
[0058] Figure 4 A flowchart of another motion vector determination method including encoding cost threshold determination provided in the embodiments of this application is shown below. Figure 4 As shown, it specifically includes:
[0059] Step S301: Construct a motion vector candidate list based on the spatial and temporal neighboring blocks of the current coding block.
[0060] Step S302: Determine the motion vector with the minimum encoding cost from the motion vector candidate list as the starting motion vector, and record the encoding cost of the starting motion vector.
[0061] Step S303: Determine whether the coding prediction mode of the adjacent blocks of the current coding block is merge prediction mode or intra-frame prediction mode. If so, proceed to step S304; otherwise, proceed to step S307.
[0062] Step S304: When the coding prediction mode of the adjacent blocks of the current coding block is merge prediction mode, the coding cost threshold is determined as a first cost threshold; when the coding prediction mode of the adjacent blocks of the current coding block is intra-frame prediction mode, the coding cost threshold is determined as a second cost threshold.
[0063] Step S305: When the encoding prediction mode of the adjacent blocks of the current encoding block is the merge prediction mode, if the encoding cost is less than the first cost threshold, the starting motion vector is determined as the motion vector of the current encoding block.
[0064] Step S306: When the coding prediction mode of the adjacent blocks of the current coding block is the intra-frame prediction mode, if the coding cost is less than the second cost threshold, the starting motion vector is determined as the motion vector of the current coding block.
[0065] Step S307: Determine the encoding cost threshold as the initial cost threshold. If the encoding cost is less than the initial cost threshold, determine the starting motion vector as the motion vector of the current encoding block.
[0066] In one embodiment, if the coding prediction mode for the adjacent blocks of the current coding block is not either merge prediction mode or intra-frame prediction mode, a set initial cost threshold is used as the coding cost threshold for coding cost comparison. This initial cost threshold is less than the aforementioned first cost threshold and second cost threshold. For example, the initial cost threshold can be set to 64, the first cost threshold to 200, and the second cost threshold to 300.
[0067] It should be noted that the specific order of the steps in the above process of setting the coding cost threshold is not limited. It can be set as the initial cost threshold first, and then the coding prediction mode of the adjacent blocks of the current coding block is determined. If it is the merge prediction mode, the coding cost threshold is set as the first cost threshold. If it is the intra-frame prediction mode, the coding cost threshold is set as the second cost threshold. Otherwise, the initial cost threshold is used for subsequent coding cost comparison.
[0068] As can be seen from the above, in video coding, multiple different coding cost thresholds are used for comparison in the process of determining motion vectors, rather than a fixed threshold. This allows for a better combination of the temporal and spatial correlation of coding blocks, ensuring the efficiency and accuracy of motion vector determination.
[0069] Figure 5 This is a structural block diagram of a motion vector determination device in video coding provided in an embodiment of this application. The device is used to execute the motion vector determination method in video coding provided in the above embodiment, and has corresponding functional modules and beneficial effects for executing the method. Figure 5 As shown, the device specifically includes: a candidate list generation module 101, a list processing module 102, a threshold determination module 103, and a vector determination module 104, wherein,
[0070] The candidate list generation module 101 is configured to construct a motion vector candidate list based on the spatial and temporal adjacent blocks of the current coding block;
[0071] The list processing module 102 is configured to determine the motion vector with the lowest encoding cost as the starting motion vector from the motion vector candidate list, and record the encoding cost of the starting motion vector;
[0072] The threshold determination module 103 is configured to determine the coding cost threshold based on the coding prediction mode of the adjacent blocks of the current coding block;
[0073] The vector determination module 104 is configured to determine the starting motion vector as the motion vector of the current coding block when the coding cost is less than the coding cost threshold.
[0074] As described above, during video coding, when determining the motion vector of the current coding block, a candidate list of motion vectors is constructed based on the spatial and temporal neighboring blocks of the current coding block. The motion vector with the lowest coding cost is selected from this candidate list as the starting motion vector, and its coding cost is recorded. A coding cost threshold is determined based on the coding prediction modes of the neighboring blocks of the current coding block. If the coding cost is less than the threshold, the starting motion vector is determined as the motion vector of the current coding block. This scheme uses the spatial and temporal neighboring blocks of the current coding block to construct the candidate motion vector list and determines the coding cost threshold based on the coding prediction modes of the neighboring blocks. This fully considers the spatial and temporal correlations between coding blocks. When the coding cost is less than the threshold, the determined starting motion vector is directly used as the motion vector of the current coding block, skipping the subsequent step of searching around the starting motion vector to confirm the motion vector of the current coding block. This reduces computational load while improving coding efficiency and video coding speed.
[0075] In one possible embodiment, the candidate list generation module 101 is configured as follows:
[0076] Obtain the motion vector information of adjacent coding blocks in the preset direction of the current coding block, and add the motion vector information of coding blocks at the same position in the reference image of the current coding block to the created motion vector candidate list.
[0077] In one possible embodiment, the list processing module 102 is configured as follows:
[0078] Traverse the candidate motion vectors in the candidate motion vector list and calculate the encoding cost between the matching block and the current encoding block corresponding to each candidate motion vector;
[0079] The candidate motion vector with the lowest calculated encoding cost is selected as the starting motion vector.
[0080] In one possible embodiment, the threshold determination module 103 is configured as follows:
[0081] When the coding prediction mode of the adjacent blocks of the current coding block is merge prediction mode, the coding cost threshold is determined as a first cost threshold. When the coding prediction mode of the adjacent blocks of the current coding block is intra-frame prediction mode, the coding cost threshold is determined as a second cost threshold. The first cost threshold and the second cost threshold are different in size.
[0082] In one possible embodiment, the threshold determination module 103 is configured as follows:
[0083] When the coding prediction mode of the adjacent blocks of the current coding block is the merge prediction mode, and the coding cost is less than the first cost threshold, the starting motion vector is determined as the motion vector of the current coding block; or,
[0084] When the coding prediction mode of the adjacent blocks of the current coding block is the intra-frame prediction mode, and the coding cost is less than the second cost threshold, the starting motion vector is determined as the motion vector of the current coding block.
[0085] In one possible embodiment, the threshold determination module 103 is configured as follows:
[0086] If the coding prediction mode of the adjacent blocks of the current coding block is not the merge prediction mode or the intra-frame prediction mode, the coding cost threshold is determined as the initial cost threshold, which is less than the first cost threshold and the second cost threshold.
[0087] In one possible embodiment, the vector determination module 104 is configured as follows:
[0088] When the coding prediction mode of the adjacent blocks of the current coding block is not merge prediction mode or intra-frame prediction mode, and the coding cost is less than the initial cost threshold, the starting motion vector is determined as the motion vector of the current coding block.
[0089] In one possible embodiment, the vector determination module 104 is further configured to:
[0090] If the encoding cost is not less than the encoding cost threshold, search for the motion vector with the minimum encoding cost around the starting motion vector.
[0091] Figure 6 This application provides a schematic diagram of the structure of a motion vector determination device in video coding, as shown in the embodiments of this application. Figure 6 As shown, the device includes a processor 201, a memory 202, an input device 203, and an output device 204; the number of processors 201 in the device can be one or more. Figure 6 Taking a processor 201 as an example; the processor 201, memory 202, input device 203, and output device 204 in the device can be connected via a bus or other means. Figure 6Taking a bus connection as an example, memory 202, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the motion vector determination method in video encoding in this embodiment. Processor 201 executes various functional applications and data processing of the device by running the software programs, instructions, and modules stored in memory 302, thereby implementing the aforementioned motion vector determination method in video encoding. Input device 203 can be used to receive input digital or character information and generate key signal inputs related to user settings and function control of the device. Output device 204 may include display devices such as a display screen.
[0092] This application also provides a non-volatile storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform a motion vector determination method in video coding as described in the above embodiments, wherein the method includes:
[0093] Construct a candidate list of motion vectors based on the spatial and temporal neighboring blocks of the current coding block;
[0094] The motion vector with the lowest encoding cost is selected as the starting motion vector from the candidate motion vector list, and the encoding cost of the starting motion vector is recorded.
[0095] The coding cost threshold is determined based on the coding prediction patterns of the adjacent blocks of the current coding block;
[0096] If the encoding cost is less than the encoding cost threshold, the starting motion vector is determined as the motion vector of the current encoding block.
[0097] It is worth noting that in the embodiments of the motion vector determination device in the above video encoding, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this application.
[0098] In some possible implementations, various aspects of the methods provided in this application can also be implemented as a program product comprising program code that, when run on a computer device, causes the computer device to perform the steps of the methods according to the various exemplary embodiments of this application described above. For example, the computer device can perform a motion vector determination method in video coding as described in the embodiments of this application. The program product can be implemented using any combination of one or more readable media.
Claims
1. A method for determining motion vectors in video coding, characterized in that, include: Construct a candidate list of motion vectors based on the spatial and temporal neighboring blocks of the current coding block; The motion vector with the lowest encoding cost is selected as the starting motion vector from the candidate motion vector list, and the encoding cost of the starting motion vector is recorded. The coding cost threshold is determined based on the coding prediction patterns of the adjacent blocks of the current coding block; If the encoding cost is less than the encoding cost threshold, the starting motion vector is determined as the motion vector of the current encoding block, and the subsequent step of searching around the starting motion vector to confirm the motion vector of the current encoding block is skipped.
2. The method for determining motion vectors in video coding according to claim 1, characterized in that, The process of constructing a motion vector candidate list based on the spatial and temporal neighboring blocks of the current coding block includes: Obtain the motion vector information of adjacent coding blocks in the preset direction of the current coding block, and add the motion vector information of coding blocks at the same position in the reference image of the current coding block to the created motion vector candidate list.
3. The method for determining motion vectors in video coding according to claim 1, characterized in that, The step of determining the motion vector with the minimum encoding cost as the starting motion vector from the candidate motion vector list includes: Traverse the candidate motion vectors in the candidate motion vector list and calculate the encoding cost between the matching block and the current encoding block corresponding to each candidate motion vector; The candidate motion vector with the lowest calculated encoding cost is selected as the starting motion vector.
4. The method for determining motion vectors in video coding according to any one of claims 1-3, characterized in that, Determining the coding cost threshold based on the coding prediction patterns of adjacent blocks of the current coding block includes: When the coding prediction mode of the adjacent blocks of the current coding block is merge prediction mode, the coding cost threshold is determined as a first cost threshold. When the coding prediction mode of the adjacent blocks of the current coding block is intra-frame prediction mode, the coding cost threshold is determined as a second cost threshold. The first cost threshold and the second cost threshold are different in size.
5. The method for determining motion vectors in video coding according to claim 4, characterized in that, The step of determining the starting motion vector as the motion vector of the current coding block when the coding cost is less than the coding cost threshold includes: When the coding prediction mode of the adjacent blocks of the current coding block is the merge prediction mode, and the coding cost is less than the first cost threshold, the starting motion vector is determined as the motion vector of the current coding block; or, When the coding prediction mode of the adjacent blocks of the current coding block is the intra-frame prediction mode, and the coding cost is less than the second cost threshold, the starting motion vector is determined as the motion vector of the current coding block.
6. The motion vector determination method in video coding according to claim 4, characterized in that, Determining the coding cost threshold based on the coding prediction patterns of adjacent blocks of the current coding block includes: If the coding prediction mode of the adjacent blocks of the current coding block is not the merge prediction mode or the intra-frame prediction mode, the coding cost threshold is determined as the initial cost threshold, which is less than the first cost threshold and the second cost threshold.
7. The method for determining motion vectors in video coding according to claim 6, characterized in that, The step of determining the starting motion vector as the motion vector of the current coding block when the coding cost is less than the coding cost threshold includes: When the coding prediction mode of the adjacent blocks of the current coding block is not merge prediction mode or intra-frame prediction mode, and the coding cost is less than the initial cost threshold, the starting motion vector is determined as the motion vector of the current coding block.
8. The method for determining motion vectors in video coding according to any one of claims 1-3, characterized in that, The motion vector determination method further includes: If the encoding cost is not less than the encoding cost threshold, search for the motion vector with the minimum encoding cost around the starting motion vector.
9. A motion vector determination device for video encoding, characterized in that, include: The candidate list generation module is configured to construct a motion vector candidate list based on the spatial and temporal neighboring blocks of the current coding block; The list processing module is configured to determine the motion vector with the lowest encoding cost as the starting motion vector from the motion vector candidate list, and record the encoding cost of the starting motion vector. The threshold determination module is configured to determine the coding cost threshold based on the coding prediction modes of the adjacent blocks of the current coding block; The vector determination module is configured to determine the starting motion vector as the motion vector of the current coding block when the coding cost is less than the coding cost threshold, and skip the subsequent step of searching around the starting motion vector to confirm the motion vector of the current coding block.
10. A motion vector determination device for video coding, the device comprising: One or more processors; A storage device for storing one or more programs, which, when executed by one or more processors, cause the one or more processors to implement the motion vector determination method in video coding as described in any one of claims 1-8.
11. A non-volatile storage medium storing computer-executable instructions, which, when executed by a computer processor, are used to perform the motion vector determination method in video coding as described in any one of claims 1-8.
12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the motion vector determination method in video encoding as described in any one of claims 1-8.
