A method and device for determining motion vector
By segmenting and motion vector prediction and matching the image of cloud desktop, the problem of coding block motion vector determination in cloud desktop scenarios is solved, which reduces network bandwidth consumption and improves the efficiency of cloud desktop operations.
Patent Information
- Application Number
- CN202111414541.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-25
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-11-25
AI Technical Summary
In cloud desktop scenarios, the existing video encoding algorithm motion estimation algorithm is not applicable, and it is difficult to accurately determine the motion vector of the encoding block, resulting in excessive network bandwidth consumption, especially when the user drags a window or icon.
By segmenting the current frame image into encoding blocks, using nearby encoded encoded blocks to predict the motion vector, and confirm within the error allowable range. Otherwise, find the pixel point on the diagonal line that matches the reference frame image, and determine Its motion vector.
It realizes the accurate determination of the motion vector of the encoded block in the cloud desktop scenario, reduces network bandwidth consumption, and saves bandwidth resources when users drag cloud desktop icons and windows.
Smart Images

Figure CN114222125B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a method and device for determining a motion vector. Background Art
[0002] In the current era of cloud computing, the application scenarios of virtual desktop infrastructure (VDI) are becoming increasingly widespread. VDI mainly relies on virtual machines divided by the hypervisor on the physical server. VDI users can access the virtual machines on the remote physical server through the cloud desktop client. The interaction between the cloud desktop client and the virtual machine is realized through the cloud desktop transmission protocol, which consumes network bandwidth. During the use of VDI users, many drawing instructions will be generated. If they are not compressed, a large amount of network bandwidth will be consumed. Among them, the operation that consumes network bandwidth is the user's dragging operation of the window or icon. During the dragging process, the content does not actually change. Therefore, it is necessary to find a method to find the motion vector during the dragging process to reduce the consumption of network bandwidth.
[0003] In current engineering applications, motion estimation is usually performed using motion estimation algorithms in video encoding algorithms. The main application scenario of motion estimation algorithms is video compression, which is only applicable when it is difficult for the previous and next frames of a video to have exactly the same picture content. However, in the usage scenario of a cloud desktop, there is a large amount of identical content between the previous and next frames. Therefore, the above motion estimation algorithm is not applicable to the cloud desktop scenario.
[0004] Therefore, how to accurately determine the motion vector of the coding block in the cloud desktop scenario is one of the technical issues worth considering. Summary of the invention
[0005] In view of this, the present application provides a motion vector determination method and device for accurately determining the motion vector of a coding block in a cloud desktop scenario.
[0006] Specifically, the present application is implemented through the following technical solutions:
[0007] According to a first aspect of the present application, a method for determining a motion vector is provided, comprising:
[0008] Segment the current frame image to obtain at least one coding block;
[0009] For each coding block, the motion vector of the coding block is predicted using the motion vector of the coded blocks near the coding block;
[0010] Determining whether the predicted motion vector is within an allowable error range according to the coding block and the reference coding block;
[0011] If the error is within the allowable range, the motion vector is determined to be the motion vector of the coding block;
[0012] If the error is not within the allowable range, the target pixel point on the diagonal line of the coding block is determined;
[0013] Finding a reference pixel point on the reference frame image that matches the target pixel point;
[0014] Determine a motion vector of the target pixel point according to the target pixel point and the reference pixel point;
[0015] When the motion vector of the target pixel is within an allowable error range, the motion vector of the target pixel is confirmed as the motion vector of the coding block.
[0016] According to a second aspect of the present application, a motion vector determination device is provided, comprising:
[0017] A segmentation module, used for segmenting the current frame image to obtain at least one coding block;
[0018] A prediction module, configured to predict, for each coding block, a motion vector of the coding block using motion vectors of coding blocks that have been coded near the coding block;
[0019] A judgment module, used for determining whether the predicted motion vector is within an allowable error range according to the coding block and the reference coding block;
[0020] A first determination module, configured to determine that the motion vector is the motion vector of the coding block when the determination result of the determination module is within an allowable error range;
[0021] A second determination module, configured to determine a target pixel point on a diagonal line of the coding block when the determination result of the determination module is that the target pixel point is not within the allowable error range;
[0022] A search module, used to search for a reference pixel point on a reference frame image that matches the target pixel point;
[0023] A third determining module, used to determine a motion vector of the target pixel point according to the target pixel point and the reference pixel point;
[0024] The fourth determination module is used to confirm the motion vector of the target pixel point as the motion vector of the coding block when the motion vector of the target pixel point is within an allowable error range.
[0025] According to the third aspect of the present application, an electronic device is provided, including a processor and a machine-readable storage medium, the machine-readable storage medium storing a computer program that can be executed by the processor, and the processor is prompted by the computer program to execute the method provided in the first aspect of the embodiment of the present application.
[0026] According to the fourth aspect of the present application, a machine-readable storage medium is provided, which stores a computer program. When called and executed by a processor, the computer program prompts the processor to execute the method provided in the first aspect of the embodiment of the present application.
[0027] Beneficial effects of the embodiments of the present application:
[0028] For each coding block obtained by segmenting the current frame image, the motion vector of the coding block is first predicted using the motion vector of the coded coding block near the coding block, and then it is determined whether the predicted motion vector is within the allowable error range based on the coding block and the reference coding block. When it is within the allowable error range, it is confirmed that the coding block is relatively close to the reference coding block, so that the predicted motion vector can be determined as the motion vector of the coding block. When it is not within the allowable error range, the pixel points on the diagonal of the coding block are used to find matching reference pixel points in the reference frame, and then the motion vector is determined based on the pixel points and the reference pixel points. When the determined motion vector is within the allowable error range, the determined motion vector is used as the motion vector of the coding block, thereby achieving the purpose of accurately determining the motion vector, providing a basis for users to save bandwidth resources when dragging cloud desktop icons and windows. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a flowchart of a method for determining a motion vector provided in an embodiment of the present application;
[0030] Figure 2 is a schematic diagram of a target pixel point on a diagonal line of a coding block provided in an embodiment of the present application;
[0031] Figure 3 A schematic diagram of the structure of a motion vector determination device provided in an embodiment of the present application;
[0032] Figure 4 It is a hardware structure diagram of an electronic device for implementing a motion vector determination method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] Here, exemplary embodiments will be described in detail, and examples thereof are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application.
[0034] The terms used in this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more corresponding listed items.
[0035] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0036] The motion vector determination method provided in the present application is described in detail below.
[0037] See also Figure 1 , Figure 1 This is a flow chart of a motion vector determination method provided by the present application, which is applied to an electronic device supporting VDI. The method may include the following steps:
[0038] S101: Segment a current frame image to obtain at least one coding block.
[0039] Specifically, a segmentation length P_L may be set, and then the current frame image cur_frame may be segmented according to the segmentation length, thereby obtaining at least one coding block.
[0040] It should be noted that the value of the above segmentation length can be arbitrarily configured according to actual conditions and can be determined based on actual conditions.
[0041] It should be noted that the above-mentioned current frame image can be, but is not limited to, an image collected on a cloud desktop, etc.
[0042] S102 . For each coding block, predict the motion vector of the coding block by using the motion vectors of the coded coding blocks near the coding block.
[0043] In this step, when determining the motion vector of the coding block in the current frame image, it is generally determined in order, first determining the coding blocks in the first row one by one, and then performing the motion vector confirmation step on the coding blocks in the second row. On this basis, the coded blocks that have been encoded near the coding block can be understood as the coding block on the upper left, the coding block above, and the coding block on the left of the coding block, etc. Of course, the coded blocks that have been encoded near the coding block mentioned above can also include the coding block on the upper right, etc., which can be determined according to actual conditions.
[0044] On this basis, the motion vector of the coding block (which can also be understood as the current coding block) can be predicted based on the motion vector of the encoded coding block. It should be noted that when the user drags the icon on the cloud desktop, the movement trajectory of the coding block on the current frame image generated during the movement is the same, that is, the user's dragging trajectory. Therefore, after predicting the motion vector of the encoded coding block near the coding block, the motion vector of the coding block can be predicted based on the dragging trajectory. In general, the motion vector of the encoded coding block near the coding block should be consistent with the motion vector of the coding block in theory. Based on this principle, the motion vector of the coding block can be predicted.
[0045] It should be noted that, when there are multiple encoded coding blocks used to predict the motion vector of the coding block, multiple motion vectors can be predicted.
[0046] S103, determining whether the predicted motion vector is within the allowable error range according to the coding block and the reference coding block; if it is within the allowable error range, executing step S104; if it is not within the allowable error range, executing step S105.
[0047] In this step, after the motion vector is predicted, an error judgment can be performed based on the coding block and the corresponding reference coding block. It should be noted that when multiple motion vectors are predicted, multiple reference coding blocks are corresponding, and then the coding block and the corresponding reference coding block are used to confirm whether the corresponding motion vector is within the allowable error range.
[0048] Optionally, step S103 may be performed according to the following process: using the predicted motion vector to shift the target coding block corresponding to the coding block in the reference frame image to obtain a reference coding block; determining the error between the coding block and the reference coding block; judging whether the error is less than a set error threshold; when the error is less than the set error threshold, determining that the predicted motion vector is within the allowable error range; and when the error is not less than the set error threshold, determining that the predicted motion vector is not within the allowable error range.
[0049] Specifically, the coding block in the current frame image corresponds to the coding block in the reference frame image one-to-one, therefore, a target coding block with the same position can be confirmed in the reference frame image according to the position of the coding block in the current frame image, and then the target coding block is shifted using the predicted motion vector, so that the reference coding block can be obtained, and then the coding block and the reference coding block are XORed, and the number of values 1 in the XOR result is counted, and the ratio between the number of values 1 and the total number of values in the XOR result is determined as the error between the coding block and the reference coding block; the larger the above ratio, that is, the more values 1, indicates that the coding block has more pixels that are different from the reference coding block, indicating that the error is larger; conversely, the smaller the ratio, that is, the fewer values 1, indicates that the coding block has more pixels that are the same as the reference coding block, indicating that the error is smaller. Based on this, when it is confirmed that the above error is less than the set error threshold, it means that the reference coding block predicted based on the motion vector is relatively consistent with the coding block, which further indicates that the motion vector is within the allowable error range; otherwise, it is confirmed that the motion vector is not within the allowable error range.
[0050] It should be noted that the error tolerance range and the error threshold setting involved in this embodiment are configurable, and the error tolerance range is set based on the error threshold setting, which depends on the actual situation.
[0051] S104: Determine that the motion vector is the motion vector of the coding block.
[0052] In this step, when the error between the current coding block and the reference coding block determined based on the predicted motion vector is determined to be less than the set error threshold, the motion vector can be determined as the motion vector of the current coding block. This achieves the purpose of accurately determining the motion vector of the coding block, laying the foundation for reducing network bandwidth consumption when the user drags the icon later.
[0053] It should be noted that when multiple motion vectors are determined based on step S102, three motion vectors can be obtained by using the running vectors of the upper left coding block, the upper coding block and the left coding block of the current coding block to respectively predict the motion vector of the current coding block. Then, step S103 is performed using these three motion vectors respectively, so that three errors can be obtained, and the motion vector with an error less than the set error threshold is selected, and the corresponding motion vector is determined as the motion vector of the coding block. When multiple errors among the three errors are less than the set error threshold, the motion vector corresponding to the smallest error can be selected and determined as the motion vector of the current coding block.
[0054] It should be noted that the value of the above-mentioned error threshold TH_D can be changed and can be specifically configured according to actual conditions.
[0055] S105: Determine a target pixel point on the diagonal line of the coding block.
[0056] In this step, when it is determined that the predicted motion vector is not within the allowable error range, in order to more accurately determine the motion vector of the coding block, this step proposes to determine the target pixel point on the diagonal line of the coding block.
[0057] It should be noted that the target pixel point can be any one or more pixel points on the diagonal line of the coding block. Figure 2 shown.
[0058] S106: Searching for a reference pixel point on the reference frame image that matches the target pixel point.
[0059] In this step, step S106 can be performed according to the following process: determine the index value of the target pixel point; search the linked list corresponding to the above index value in the hash linked list corresponding to the reference frame image, and search the reference pixel point whose hash value is the same as the hash value of the target pixel point in the linked list.
[0060] Specifically, in this embodiment, a hash linked list is generally generated for each frame image, and the hash linked list records the correspondence between index values, hash values and pixel points. Based on this, after selecting a target pixel point from the diagonal line, the index value of the target pixel point can be determined, and then the reference frame image is queried based on the index value whether the index value exists. If it exists, it means that the same index value as the index value of the target pixel point exists in the hash linked list corresponding to the reference frame image, and then the reference pixel point with the same hash value as the hash value of the target pixel point is searched in the linked list corresponding to the found index value.
[0061] Optionally, before searching the linked list for a reference pixel having the same hash value as the target pixel, the method further includes: determining a linked list length of the found linked list;
[0062] On this basis, the above-mentioned search for reference pixels whose hash values are the same as the hash values of the target pixel points in the linked list can be implemented according to the following process: when the length of the linked list is less than the set length threshold, the reference pixel points with the same hash value as the target pixel points in the linked list corresponding to the index value are searched; when the length of the linked list is not less than the set length threshold, the reference pixel points with the same hash value as the target pixel points are searched on the reference frame image.
[0063] Specifically, when generating a hash table, the length of the linked list corresponding to each index value varies. Therefore, there may be a situation where the length of the linked list corresponding to a certain index value is relatively long. In this case, it is necessary to traverse the linked list one by one to find the reference pixel points in the linked list, which may consume more time. In view of this, the present embodiment proposes to determine the length of the linked list corresponding to the index value found; when the length of the linked list is less than the set length threshold, it indicates that it will not take too long to find the reference pixel points in the linked list, and then directly find the reference pixel points in the linked list corresponding to the index value in the hash linked list; and when the length of the linked list is not less than the set length threshold, it indicates that the linked list is relatively long. In order to avoid the situation where it may take a long time to find the reference pixel points in the linked list, the present embodiment proposes to directly find the reference pixel points whose hash value is the same as the hash value of the target pixel points on the reference frame image. In this way, the reference pixel points of the target pixel points can be found quickly and accurately.
[0064] It should be noted that the above-mentioned set length threshold can be configured according to actual conditions, and this embodiment does not limit the value of the set length threshold.
[0065] Furthermore, in order to reduce the time for querying reference pixel points, in this embodiment, when searching for the linked list with the same index value in the hash linked list corresponding to the reference frame image, it can be implemented according to the following process: determine the search range according to the pixel points at both ends of the diagonal of the coding block; search for the linked list with the same index value in the hash linked list corresponding to the reference frame image according to the search range.
[0066] Specifically, after determining the index value of the target pixel, a search range will be set. The length of the search range is S_L. Taking the coordinates of the two end points on the diagonal line as (x0, y0) and (x1, y1) as an example, the search range is set to <(x0-S_L, y0-S_L), (x1+S_L, y1-S_L)>. Among them, there is a length difference between x1 and x0 and between y1 and y0. This length can be the segmentation length P_L, or other values, depending on the actual situation. On this basis, based on the set search range, the linked list with the same index value is searched in the hash table corresponding to the reference frame image.
[0067] On this basis, the set length threshold corresponding to the above-mentioned linked list length can be, but is not limited to, (P_L+2*S_L)*(P_L+2*S_L), etc., and can be specifically configured according to actual conditions. In addition, the value of the above-mentioned range length S_L can be configured according to actual conditions, and this embodiment does not limit this, and aims to quickly and accurately find the reference pixel point.
[0068] Accordingly, when the length of the linked list found when searching based on the search range is greater than the above-set length threshold, when searching in the reference frame image, the reference pixel whose hash value is the same as the hash value of the target pixel is also searched in the reference frame image based on the search range. Thus, by setting the search range, the speed of searching for reference pixels can be accelerated, so that the motion vector can be found more quickly.
[0069] Optionally, based on any of the above embodiments, the hash value of the target pixel can be determined according to the following process: determine a pixel set corresponding to the target pixel, the pixel set including the target pixel, pixels within a set length of the target pixel in the horizontal direction, and pixels within a set length of the target pixel in the vertical direction; determine the grayscale value of each pixel in the above pixel set, and form a grayscale set with the grayscale values of each pixel in the above pixel set; calculate the hash value of the target pixel based on the grayscale values in the above grayscale set.
[0070] Specifically, the coordinates of the target pixel can be<x,y> , select the pixel points of the target pixel in the horizontal and vertical directions with a specified length L, and then form a pixel set, recorded as set[xL,y>,<x-L-1,y> ,…<x,y> ,<x,y-1> ,…<x,y-L> ]; then calculate the gray value of each pixel in the pixel set and generate a gray set, recorded as: grey_set[xL,y>,<x-L-1,y> ,…<x,y> ,<x,y-1> ,…<x,y-L> ]. On this basis, a base b can be set, and then the hash value of the target pixel can be calculated according to the following formula:
[0071] For(i=0;i<2L;i++)
[0072] H_P(x,y)=grey_set[i]+H_P(x,y)*b
[0073] In the above formula, H_P(x,y) is the hash value of the target pixel, and grey_set[i] is the i-th grayscale value. Thus, the above calculation process can determine the hash value of the target pixel.
[0074] It should be noted that the calculation process of the hash value of each pixel can refer to the calculation process of the hash value of the target pixel mentioned above, and will not be described in detail here.
[0075] It should be noted that the above-mentioned specified length L may be the same as or different from the above-mentioned segmentation length P_L, and may be determined specifically according to actual conditions.
[0076] Optionally, in this embodiment, the index value of the target pixel is obtained by performing a modulo operation on a set value according to the hash value of the target pixel.
[0077] Specifically, after the hash value of the target pixel is confirmed, the index value Index of the target pixel can be calculated according to the following formula: Index = H_P (x, y) % M, wherein the above M is a configurable value, which can be determined according to actual conditions.
[0078] It should be noted that the calculation method of the index value of each pixel in the current frame image can refer to the calculation method of the target pixel, and will not be described in detail here.
[0079] In addition, in practical applications, the hash value and index value of each pixel of the current frame image can be determined, and then the relevant data of the pixel can be inserted into the linked list corresponding to the index value in the hash linked list HASH_LIST corresponding to the current frame image based on the index value of the pixel, and the linked list length of each linked list corresponding to the index value in the hash linked list is updated in real time and recorded in the hash linked list. On this basis, after the index value of the target pixel is determined, the linked list length of the linked list corresponding to the index value of the target pixel can be queried by checking the hash linked list.
[0080] S107: Determine a motion vector of the target pixel according to the target pixel and the reference pixel.
[0081] In this step, after the reference pixel point is determined, a motion vector between two pixels can be determined according to the coordinates of the target pixel point and the coordinates of the reference pixel point.
[0082] It should be noted that, when there are multiple target pixels, a corresponding number of reference pixels can be determined based on step S106, and further a corresponding number of motion vectors can be determined.
[0083] S108: When the motion vector of the target pixel is within an allowable error range, confirm the motion vector of the target pixel as the motion vector of the coding block.
[0084] In this step, after determining the motion vector of the target pixel point, the error between the target pixel point and the reference pixel point can be determined. When the error is within the allowable error range, it indicates that the coordinate values of the target pixel point and the reference pixel point are very close, and the motion vector can be determined as the motion vector of the coding block.
[0085] It should be noted that the error tolerance range in step S108 may be the same as or different from the error tolerance range in step S103 , and may be specifically configured according to actual conditions.
[0086] Optionally, when the number of target pixel points is multiple, step S108 can be performed according to the following method: the motion vectors determined based on the multiple target pixel points are selected to screen out the motion vector with the smallest error; if the error corresponding to the motion vector with the smallest error is less than a set threshold, the smallest motion vector is determined as the motion vector of the coding block.
[0087] Specifically, when multiple target pixels are selected from the diagonal line of the current coding block, a corresponding number of motion vectors will be determined; it should be noted that when determining the motion vector, there will generally be a situation where different target pixels determine the same motion vector; for example, when there are three target pixels with the same running vector, it means that the motion vector is hit three times, so the number of hits of each motion vector can be sorted, and then the first N motion vectors are screened out, and then the errors of the N motion vectors are calculated respectively to determine the motion vector with the smallest error. When the smallest error is less than the set threshold, the smallest error is determined as the motion vector of the coding block. In this way, the motion vector of the coding block can be accurately determined.
[0088] In addition, when the minimum error is not less than the set threshold, the motion vector corresponding to the minimum error will not be determined as the motion vector of the coding block, and the motion vector of the coding block will be marked as <0,0>, indicating that the motion vector of the coding block is not found.
[0089] In addition, after the motion vector is determined for the coding block, the other coding blocks of the current frame image can be traversed, and then the motion vector can be determined according to Figure 1 The process determines the motion vectors for other coding blocks.
[0090] It should be noted that the reference frame image in any embodiment of the present application can be understood as the previous frame image pre_frame of the current frame image.
[0091] By implementing the motion vector determination method provided by the present application, for each coding block obtained by segmenting the current frame image, the motion vector of the coding block is first predicted using the motion vector of the coding block that has been encoded near the coding block, and then it is determined whether the predicted motion vector is within the allowable error range based on the coding block and the reference coding block. When it is within the allowable error range, it is confirmed that the coding block is relatively close to the reference coding block, so that the predicted motion vector can be determined as the motion vector of the coding block. When it is not within the allowable error range, the pixel points on the diagonal of the coding block are used to search for matching reference pixel points in the reference frame, and then the motion vector is determined based on the pixel points and the reference pixel points. When the determined motion vector is within the allowable error range, the determined motion vector is used as the motion vector of the coding block, thereby achieving the purpose of accurately determining the motion vector, and providing a basis for users to save bandwidth resources when dragging cloud desktop icons and windows.
[0092] Based on the same inventive concept, the present application also provides a motion vector determination device corresponding to the above motion vector determination method. The implementation of the motion vector determination device can refer to the above description of the motion vector determination method, which will not be discussed here one by one.
[0093] See also Figure 3 , Figure 3 An exemplary embodiment of the present application provides a motion vector determination device, comprising:
[0094] The segmentation module 301 is used to segment the current frame image to obtain at least one coding block;
[0095] A prediction module 302 is used to predict the motion vector of each coding block by using the motion vectors of the coded blocks near the coding block.
[0096] A determination module 303 is used to determine whether the predicted motion vector is within an allowable error range according to the coding block and the reference coding block;
[0097] A first determination module 304 is configured to determine that the motion vector is the motion vector of the coding block when the determination result of the determination module 303 is within an allowable error range;
[0098] A second determination module 305 is configured to determine a target pixel point on a diagonal line of the coding block when the determination result of the determination module 303 is that the target pixel point is not within the allowable error range;
[0099] A search module 306 is used to search for a reference pixel point on the reference frame image that matches the target pixel point;
[0100] A third determining module 307, configured to determine a motion vector of the target pixel point according to the target pixel point and the reference pixel point;
[0101] The fourth determining module 308 is configured to confirm the motion vector of the target pixel as the motion vector of the coding block when the motion vector of the target pixel is within an allowable error range.
[0102] Optionally, the above-mentioned search module 306 is specifically used to determine the index value of the target pixel point; search for a linked list corresponding to the index value in the hash linked list corresponding to the reference frame image, and search for a reference pixel point whose hash value is the same as the hash value of the target pixel point in the linked list.
[0103] Optionally, the search module 306 is specifically used to:
[0104] After searching the linked list corresponding to the index value in the hash linked list corresponding to the reference frame image, determining the linked list length of the found linked list;
[0105] When the length of the linked list is less than a set length threshold, searching for a reference pixel point in the linked list corresponding to the index value that has the same hash value as the target pixel point;
[0106] When the length of the linked list is not less than the set length threshold, a reference pixel point having a hash value identical to the hash value of the target pixel point is searched on the reference frame image.
[0107] Optionally, the search module 306 is specifically configured to determine a search range according to pixel points at both ends of a diagonal line of the coding block; and search for a linked list having the same index value in a hash linked list corresponding to the reference frame image according to the search range.
[0108] Optionally, the fourth determination module 308 is specifically used to select the motion vectors determined based on the multiple target pixel points respectively when the number of the target pixel points is multiple, so as to screen out the motion vector with the smallest error; if the error corresponding to the motion vector with the smallest error is less than a set threshold, then the smallest motion vector is determined as the motion vector of the coding block.
[0109] Optionally, based on any of the foregoing embodiments, the vector determination device provided in this embodiment further includes:
[0110] A hash value determination module (not shown in the figure) is used to determine the hash value of the target pixel point according to the following method: determine the pixel set corresponding to the target pixel point, the pixel set including the target pixel point, the pixel points within a set length of the target pixel point in the horizontal direction, and the pixel points within a set length of the target pixel point in the vertical direction; determine the grayscale value of each pixel point in the pixel set, and form a grayscale set with the grayscale values of each pixel point in the pixel set; calculate the hash value of the target pixel point according to the grayscale values in the grayscale set.
[0111] Optionally, based on the above embodiment, the index value of the target pixel point in this embodiment is obtained by performing a modulo operation on a set value according to the hash value of the target pixel point.
[0112] Optionally, based on any of the above embodiments, the above judgment module 303 is specifically used to use the predicted motion vector to shift the target coding block corresponding to the coding block in the reference frame image to obtain a reference coding block; determine the error between the coding block and the reference coding block; determine whether the error is less than a set error threshold; when it is less than the set error threshold, determine that the predicted motion vector is within the allowable error range; when it is not less than the set error threshold, determine that the predicted motion vector is not within the allowable error range.
[0113] By providing a motion vector determination device provided by any embodiment of the present application, for each coding block obtained by segmenting the current frame image, the motion vector of the coding block is first predicted by using the motion vector of the coded coding block near the coding block, and then it is determined whether the predicted motion vector is within the allowable error range based on the coding block and the reference coding block. When it is within the allowable error range, it is confirmed that the coding block is relatively close to the reference coding block, so that the predicted motion vector can be determined as the motion vector of the coding block. When it is not within the allowable error range, the pixel points on the diagonal of the coding block are used to search for matching reference pixel points in the reference frame, and then the motion vector is determined based on the pixel points and the reference pixel points. When the determined motion vector is within the allowable error range, the determined motion vector is used as the motion vector of the coding block, thereby achieving the purpose of accurately determining the motion vector, and providing a basis for users to save bandwidth resources when dragging cloud desktop icons and windows.
[0114] Based on the same inventive concept, an embodiment of the present application provides an electronic device, which may be a device supporting the VDI protocol. Figure 4As shown, the electronic device includes a processor 401 and a machine-readable storage medium 402, the machine-readable storage medium 402 stores a computer program that can be executed by the processor 401, and the processor 401 is prompted by the computer program to execute the motion vector determination method provided by any embodiment of the present application. In addition, the electronic device also includes a communication interface 403 and a communication bus 404, wherein the processor 401, the communication interface 403, and the machine-readable storage medium 402 communicate with each other through the communication bus 404.
[0115] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0116] The communication interface is used for communication between the above electronic device and other devices.
[0117] The memory may include a random access memory (RAM), a DDR SRAM (Double Data Rate Synchronous Dynamic Random Access Memory), or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0118] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0119] In addition, an embodiment of the present application provides a machine-readable storage medium, which stores a computer program. When called and executed by a processor, the computer program prompts the processor to execute the motion vector determination method provided by the embodiment of the present application.
[0120] As for the electronic device and machine-readable storage medium embodiments, since the method contents involved are basically similar to the aforementioned method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0121] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0122] The implementation process of the functions and effects of each unit / module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.
[0123] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are merely schematic, wherein the units / modules described as separate components may or may not be physically separated, and the components displayed as units / modules may or may not be physical units / modules, that is, they may be located in one place, or they may be distributed on multiple network units / modules. Some or all of the units / modules may be selected according to actual needs to achieve the purpose of the present application. A person of ordinary skill in the art can understand and implement it without creative work.
[0124] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for determining a motion vector, characterized in that: include: Segment the current frame image to obtain at least one coding block; For each coding block, the motion vector of the coding block is predicted using the motion vector of the coded blocks near the coding block; Determining whether the predicted motion vector is within an allowable error range according to the coding block and the reference coding block; If the error is within the allowable range, the motion vector is determined to be the motion vector of the coding block; If the error is not within the allowable range, the target pixel point on the diagonal line of the coding block is determined; Finding a reference pixel point on the reference frame image that matches the target pixel point; Determine a motion vector of the target pixel point according to the coordinates of the target pixel point and the coordinates of the reference pixel point; When the motion vector of the target pixel is within an allowable error range, the motion vector of the target pixel is confirmed as the motion vector of the coding block.
2. The method according to claim 1, characterized in that Finding a reference pixel point on a reference frame that matches the pixel point includes: Determine the index value of the target pixel; A linked list corresponding to the index value is searched in the hash linked list corresponding to the reference frame image, and a reference pixel point having the same hash value as the hash value of the target pixel point is searched in the linked list.
3. The method according to claim 2, characterized in that Before searching the linked list for a reference pixel point whose hash value is the same as the hash value of the target pixel point, the method further includes: Determine the length of the linked list found; Searching for a reference pixel point having a hash value identical to the hash value of the target pixel point in the linked list includes: When the length of the linked list is less than a set length threshold, searching for a reference pixel point in the linked list corresponding to the index value that has the same hash value as the target pixel point; When the length of the linked list is not less than the set length threshold, a reference pixel point having a hash value identical to the hash value of the target pixel point is searched on the reference frame image.
4. The method according to claim 3, characterized in that Searching for a linked list with the same index value in a hash linked list corresponding to the reference frame image includes: Determine the search range according to the pixel points at both ends of the diagonal line of the coding block; According to the search range, a linked list with the same index value is searched in the hash linked list corresponding to the reference frame image.
5. The method according to claim 1, characterized in that When the number of the target pixel points is multiple, when the motion vector of the target pixel point is within the allowable error range, the motion vector of the target pixel point is confirmed as the motion vector of the coding block, including Selecting motion vectors respectively determined based on a plurality of target pixels to select a motion vector with the smallest error; If the error corresponding to the motion vector with the smallest error is smaller than a set threshold, the smallest motion vector is determined as the motion vector of the coding block.
6. The method according to any one of claims 2 to 5, characterized in that: Determine the hash value of the target pixel point according to the following method: Determine a pixel set corresponding to the target pixel point, the pixel set including the target pixel point, pixels within a set length of the target pixel point in the horizontal direction, and pixels within a set length of the target pixel point in the vertical direction; Determine the grayscale value of each pixel in the pixel set, and form a grayscale set with the grayscale values of each pixel in the pixel set; Calculate the hash value of the target pixel according to the grayscale value in the grayscale set.
7. The method according to claim 6, characterized in that The index value of the target pixel is obtained by calculating the modulus of a set value based on the hash value of the target pixel.
8. The method according to claim 1, characterized in that Determining whether the predicted motion vector is within an allowable error range according to the coding block and the reference coding block includes: Using the predicted motion vector, a target coding block corresponding to the coding block in the reference frame image is shifted to obtain a reference coding block; determining an error between the coded block and a reference coded block; Determine whether the error is less than a set error threshold; When the error is less than the set error threshold, the predicted motion vector is determined to be within the error allowable range; When it is not less than the set error threshold, it is determined that the predicted motion vector is not within the allowable error range.
9. A motion vector determination device, characterized in that: include: A segmentation module, used for segmenting the current frame image to obtain at least one coding block; A prediction module, configured to predict, for each coding block, a motion vector of the coding block using motion vectors of coding blocks that have been coded near the coding block; A judgment module, used for determining whether the predicted motion vector is within an allowable error range according to the coding block and the reference coding block; A first determination module, configured to determine that the motion vector is the motion vector of the coding block when the determination result of the determination module is within an allowable error range; A second determination module, configured to determine a target pixel point on a diagonal line of the coding block when the determination result of the determination module is that the target pixel point is not within the allowable error range; A search module, used to search for a reference pixel point on a reference frame image that matches the target pixel point; A third determination module, used to determine the motion vector of the target pixel point according to the coordinates of the target pixel point and the coordinates of the reference pixel point; The fourth determination module is used to confirm the motion vector of the target pixel point as the motion vector of the coding block when the motion vector of the target pixel point is within an allowable error range.
10. An electronic device, characterized in that: The method comprises a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores a computer program executable by the processor, and the processor is prompted by the computer program to execute the method according to any one of claims 1 to 8.
11. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores a computer program, and when called and executed by a processor, the computer program prompts the processor to execute the method according to any one of claims 1 to 8.
