Disclosure of Invention
The embodiment of the disclosure provides a video data processing method and device, which can solve the problems of resource waste and low data processing efficiency caused by the fact that motion vectors need to be calculated in video compression. The technical scheme is as follows:
according to a first aspect of embodiments of the present disclosure, there is provided a video data processing method, including:
acquiring target image data and corresponding target mouse data, wherein the mouse data comprises: the state data of the mouse comprises mouse wheel information and mouse button information;
generating comparison data according to the target mouse data and the preset mouse data, wherein the comparison data comprises coordinate difference data between the target mouse and the preset mouse;
and generating a target motion vector according to the target mouse data and the comparison data.
In one embodiment, the method comprises, before acquiring the target image data and the current mouse position data:
acquiring previous frame image data corresponding to the target image data and corresponding mouse data in the previous frame image data;
and when the previous frame of image data is inconsistent with the target image data, determining that the previous frame of image data is preset image data and the mouse data is preset mouse data.
In one embodiment, in the method, the coordinate difference data between the target mouse and the preset mouse includes:
and when the coordinate difference data is not zero, generating a target motion vector according to the target mouse data and the comparison data.
In one embodiment, the method for generating the target motion vector according to the target mouse data and the comparison data comprises the following steps:
if the state data in the target mouse data indicate a dragging state, acquiring coordinate data of the target mouse, wherein the coordinate data comprises x-axis coordinate data and y-axis coordinate data;
from the coordinate data, (x, y) coordinate point data, (0, y) coordinate point data, and (x, 0) coordinate point data are acquired, and a target motion vector is generated.
In one embodiment, the method for generating the target motion vector according to the target mouse data and the comparison data comprises the following steps:
if the state data in the target mouse data indicate a non-dragging state and the state data in the target mouse data indicate an up-down rolling state, acquiring coordinate data of the target mouse, wherein the coordinate data comprise an x-axis coordinate data value x and a y-axis coordinate data value y;
and when the target image data is inconsistent with the preset image data, acquiring (y, 0) coordinate point data according to the coordinate data and generating a target motion vector.
In one embodiment, after generating the target motion vector according to the target mouse data and the comparison data, the method further includes:
acquiring at least one target macro block image data and corresponding target position data in the target image data;
acquiring preset macro block image data of a corresponding position in preset image data according to the target position data;
and storing the target motion vector if the target macro block image data is consistent with the preset macro block image data after the target motion vector is moved.
According to the data processing method provided by the embodiment of the disclosure, target image data and corresponding target mouse data are obtained; generating comparison data according to the target mouse data and preset mouse data; and finally, generating a target motion vector according to the target mouse data and the comparison data. According to the method and the device, the motion vector between the two frames of image data is calculated by acquiring the mouse data in the current image data, so that a large amount of calculation loss of calculating the motion vector block by block in the video compression process is avoided, and the calculation efficiency is improved.
According to a second aspect of the embodiments of the present disclosure, there is provided a video data processing apparatus comprising: the device comprises an acquisition module, a first generation module and a second generation module;
the acquisition module is respectively connected with the first generation module and the second generation module;
the acquisition module is used for acquiring target image data and corresponding target mouse data, and the mouse data comprises: the state data of the mouse comprises mouse wheel information and mouse button information;
the first generation module is used for generating comparison data according to the target mouse data and the preset mouse data, wherein the comparison data comprises coordinate difference data between the target mouse and the preset mouse;
and the second generation module is used for generating a target motion vector according to the target mouse data and the comparison data.
In one embodiment, the obtaining module of the apparatus further comprises: a first acquisition unit and a first determination unit,
the first acquisition unit is used for acquiring the previous frame of image data corresponding to the target image data and the corresponding mouse data in the previous frame of image data;
and the first determining unit is used for determining the previous frame of image data as the preset image data and the mouse data as the preset mouse data when the previous frame of image data is inconsistent with the target image data.
In one embodiment, the second generating module of the apparatus further comprises: a first acquisition unit and a first generation unit;
the first obtaining unit is used for obtaining coordinate data of the target mouse when the state data in the target mouse data indicate a dragging state, wherein the coordinate data comprise an x-axis coordinate data value x and a y-axis coordinate data value y;
a first generation unit configured to acquire (x, y) coordinate point data, (0, y) coordinate point data, and (x, 0) coordinate point data from the coordinate data, and generate a target motion vector.
In one embodiment, the second generating module of the apparatus further comprises: a second acquisition unit and a second generation unit;
the second acquisition unit is used for acquiring coordinate data of the target mouse when the state data in the target mouse data indicate a non-dragging state and the state data in the target mouse data indicate an up-down rolling state, wherein the coordinate data comprise an x-axis coordinate data value x and a y-axis coordinate data value y;
and a second generation unit configured to acquire (y, 0) coordinate point data according to the coordinate data and generate a target motion vector when the target image data is inconsistent with the preset image data.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Example one
An embodiment of the present disclosure provides a data processing method, as shown in fig. 1, the video data processing method includes the following steps:
101. and acquiring target image data and corresponding target mouse data.
The mouse data includes: state data of the mouse and position data of the mouse; the state data of the mouse comprises mouse wheel information and mouse button information.
Before acquiring target image data and current mouse position data, the method comprises the following steps:
acquiring previous frame image data corresponding to the target image data and corresponding mouse data in the previous frame image data;
and when the previous frame of image data is inconsistent with the target image data, determining that the previous frame of image data is preset image data and the mouse data is preset mouse data.
And when the previous frame of image data is consistent with the target image data, determining that the previous frame of image data is not preset image data, and ending the video data processing process.
In an alternative embodiment, when the preset image data and the target image data are not consistent, the method includes:
acquiring at least one target macro block image data in the target image data and corresponding position information;
acquiring macro block image data of a corresponding position in the previous frame of image data according to the position information;
and when the target macro block image data is consistent with the macro block image data at the corresponding position in the previous frame of image data, confirming that the target image data is consistent with the previous frame of image data.
102. And generating comparison data according to the target mouse data and the preset mouse data.
Comparing data, including coordinate difference data between the target mouse and a preset mouse; the mouse position information indicating device is used for indicating whether the position information of the target mouse is consistent with that of the preset mouse, namely whether the two mice are overlapped.
In an optional embodiment, the coordinate difference data between the target mouse and the preset mouse includes:
and when the coordinate difference data is not zero, generating a target motion vector according to the target mouse data and the comparison data.
And when the coordinate difference data is not zero, generating a target motion vector according to the target mouse data and the comparison data, wherein the coordinate difference data is used for indicating whether the target mouse coordinate is not changed compared with the preset mouse coordinate, namely whether the target mouse coordinate is overlapped with the preset mouse coordinate.
When the calculation result is not zero, according to the state data in the target mouse data including the state of the mouse wheel, if the state of the mouse wheel is not changed, the motion vector is calculated by using a motion search algorithm.
103. Generating a target motion vector based on the target mouse data and the comparison data
In an alternative embodiment, generating the target motion vector based on the target mouse data and the comparison data comprises:
if the state data in the target mouse data indicate a dragging state, acquiring coordinate data of the target mouse, wherein the coordinate data comprise an x-axis coordinate data value x and a y-axis coordinate data value y; the dragging state comprises a state that the target mouse is pressed and moved;
from the coordinate data, (x, y) coordinate point data, (0, y) coordinate point data, and (x, 0) coordinate point data are acquired, and a target motion vector is generated. For example, if the coordinate data of the target mouse is (4,5), that is, the x-axis coordinate data value is 4 and the y-axis coordinate data value is 5, the (x, y) -coordinate point data is (4,5), (0, y) -coordinate point data is (0,5), and the (x, 0) -coordinate point data is (0, 4), and the target motion vector is generated.
In an alternative embodiment, generating the target motion vector based on the target mouse data and the comparison data comprises:
if the state data in the target mouse data indicate a non-dragging state and the state data in the target mouse data indicate an up-down rolling state, acquiring coordinate data of the target mouse, wherein the coordinate data comprise an x-axis coordinate data value x and a y-axis coordinate data value y;
and when the target image data is inconsistent with the preset image data, acquiring (y, 0) coordinate point data according to the coordinate data of the target mouse, and generating a target motion vector. When the state in the target mouse data is up-and-down rolling, the corresponding target image data is correspondingly changed in the up-and-down direction, and the target motion vector at this time only needs to acquire the y-axis coordinate data value y in the coordinate data of the target mouse.
In a specific embodiment, when the target image data is inconsistent with the preset image data, acquiring an application type of a window to which the target image data belongs, and generating a motion vector (0, y) according to the application type and the target mouse data, that is, acquiring a target motion vector according to y ═ epsilon · S, in the above formula: epsilon represents a preset parameter, the preset parameter value is determined according to the window application type of the target image data, and multiple experience parameters of the same application type can be provided, such as a word application type and a PDF application type; and S represents the value which is returned by triggering the mouse wheel event in the method and represents the moving direction and the size of the mouse wheel. The method determines a target motion vector according to the key state of the target mouse and the offset of a roller in the vertical direction of the target mouse.
In an alternative embodiment, generating the target motion vector based on the target mouse data and the comparison data comprises:
if the state data indicate that the state data are in a non-dragging state and indicate that the mouse wheel is not clicked again or other keys are not clicked after clicking, coordinate data of the target mouse are obtained, wherein the coordinate data comprise an x-axis coordinate data value x and a y-axis coordinate data value y;
and when the target image data is inconsistent with the preset image data, acquiring (y, 0) coordinate point data according to the coordinate data of the target mouse, and generating a target motion vector.
In an alternative embodiment, after generating the target motion vector according to the target mouse data and the comparison data, the method further includes:
acquiring at least one target macro block image data and corresponding target position data in the target image data;
acquiring target position data and acquiring preset macro block image data of a corresponding position in preset image data;
and storing the target motion vector if the target macro block image data is consistent with the preset macro block image data after the target motion vector is moved.
In an alternative embodiment, after the target motion vector is generated, all macro blocks in the target image data change area are enumerated, and the macro blocks in the target image data, that is, the macro blocks at corresponding positions in the preset image data are compared with the macro blocks after the target macro blocks are translated by using the motion vector. If the two data are the same, the target macro block can be obtained from the preset image data through the motion vector, so that the calculation amount of obtaining the motion vector can be reduced, and the data processing efficiency is improved.
In an optional embodiment, after the target motion vector is stored, target position data and a target motion vector corresponding to the target image data are acquired to generate target data. The target data is used for indicating that when the previous frame of image data and the current frame of image data are compressed and processed by the video data, the previous frame of image data can be translated according to the target data to obtain the current image data; the method comprises the steps of determining preset macro block image data of a previous frame of image data corresponding to a target position through position data in target data, and determining a motion vector of the preset macro block image data needing translation through a target motion vector in the target data to obtain current image data.
According to the data processing method provided by the embodiment of the disclosure, target image data and corresponding target mouse data are obtained; generating comparison data according to the target mouse data and preset mouse data; and finally, generating a target motion vector according to the target mouse data and the comparison data. According to the method and the device, the motion vector between the two frames of image data is calculated by acquiring the mouse data in the current image data, so that a large amount of calculation loss of calculating the motion vector block by block in the video compression process is avoided, and the data processing efficiency is improved.
Example two
Based on the video data processing method described in the embodiment corresponding to fig. 1, the following is an embodiment of the apparatus of the present disclosure, which can be used to execute an embodiment of the method of the present disclosure.
The embodiment of the present disclosure provides a video data processing apparatus, as shown in fig. 2, the video data processing apparatus 20 includes: an acquisition module 201, a first generation module 202 and a second generation module 203;
the acquisition module 201 is connected with the first generation module 202 and the second generation module 203 respectively, and the first generation module 202 is connected with the second generation module 203;
an obtaining module 201, configured to obtain target image data and corresponding target mouse data, where the mouse data includes: mouse state data and mouse position data, and mouse state data including mouse wheel information and mouse button information.
As shown in fig. 3, in an alternative embodiment, the obtaining module 201 further includes: a first acquiring unit 2011 and a first determining unit 2012,
a first obtaining unit 2011, configured to obtain previous frame image data corresponding to the target image data and corresponding mouse data in the previous frame image data;
the first determining unit 2012 is configured to determine that the image data of the previous frame is the preset image data and the mouse data is the preset mouse data when the image data of the previous frame is inconsistent with the target image data.
The first generating module 202 is configured to generate comparison data according to the target mouse data and the preset mouse data, where the comparison data includes coordinate difference data between the target mouse and the preset mouse.
And the second generating module 203 is configured to generate a target motion vector according to the target mouse data and the comparison data.
As shown in fig. 4, in an alternative embodiment, the second generating module 203 further includes: a first acquisition unit 2031 and a first generation unit 2032;
a first obtaining unit 2031, configured to obtain coordinate data of the target mouse when the state data indicates a dragging state, where the coordinate data includes an x-axis coordinate data value x and a y-axis coordinate data value y;
a first generating unit 2032 for acquiring (x, y) coordinate point data, (0, y) coordinate point data, and (x, 0) coordinate point data from the coordinate data of the target mouse, and generating a target motion vector.
As shown in fig. 5, in an alternative embodiment, the second generating module 203 further includes: a second acquiring unit 2033 and a second generating unit 2034;
a second obtaining unit 2033, configured to obtain coordinate data of the target mouse when the state data indicates a non-dragging state and the state data indicates a vertical scrolling state, where the coordinate data includes an x-axis coordinate data value x and a y-axis coordinate data value y;
a second generating unit 2034 for, when the target image data does not coincide with the preset image data, acquiring (y, 0) coordinate point data according to the coordinate data of the target mouse, and generating a target motion vector.
The video data processing device provided by the embodiment of the disclosure acquires target image data and corresponding target mouse data; generating comparison data according to the target mouse data and preset mouse data; and finally, generating a target motion vector according to the target mouse data and the comparison data. According to the method and the device, the motion vector between the two frames of image data is calculated by acquiring the mouse data in the current image data, so that a large amount of calculation loss of calculating the motion vector block by block in the video compression process is avoided, and the data processing efficiency is improved. .
Based on the video data processing method described in the embodiment corresponding to fig. 1, an embodiment of the present disclosure further provides a computer-readable storage medium, for example, the non-transitory computer-readable storage medium may be a Read Only Memory (ROM), a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like. The storage medium stores computer instructions for executing the video data processing method described in the embodiment corresponding to fig. 1, which is not described herein again.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.