Image compression method and device, electronic equipment and storage medium

By vector calculation of the current frame and historical frame of the video data, the motion vector is determined and compressed, the problem of low compression efficiency of video data when the image does not change in the prior art is solved, and efficient video data compression is achieved.

CN119211578APending Publication Date: 2024-12-27SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411037483.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

In the prior art, if the image does not change or changes slightly for a continuous period of time, the direct overall compression efficiency is low and there is a problem of ineffective compression.

Method used

By vector calculation of the current frame data and historical frame data of the video data, the data motion vector is determined, and compressed according to the motion vector, only the current frame data is compressed, and the compression efficiency is improved.

Benefits of technology

It effectively improves the compression efficiency of video data, avoids ineffective compression, and ensures efficient data transmission in micro-small images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119211578A_ABST
    Figure CN119211578A_ABST
Patent Text Reader

Abstract

The invention provides an image compression method and apparatus, an electronic device and a storage medium. The method comprises the steps of obtaining current frame data and historical frame data of video data; wherein the historical frame data is the previous frame data of the current frame data in the video data; determining a frame difference result according to the current frame data and the historical frame data; when it is determined that the frame difference result is smaller than or equal to the preset threshold value, vector calculation is conducted on the current frame data and the historical frame data with the image block as the unit, and a data motion vector is determined; wherein the preset threshold value is a preset threshold value used for judging a frame difference result; and performing compression according to the data motion vector, and determining an image compression result. According to the technical scheme, the data motion vector is determined by performing vector calculation on the current frame data and the historical frame data in the video data, so that compression is performed according to the data motion vector, the image compression result is determined, only the current frame data in the video data is compressed at the moment, the compression efficiency is improved, and the compression is effective.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an image compression method, device, electronic equipment and storage medium. Background Art

[0002] With the advent of the information age and big data, the challenges faced by data transmission have become increasingly prominent as the amount of data continues to increase. Among them, image data, especially video data, has a significantly higher "data density" than other data types, which makes the contradiction between cost and efficiency in all aspects of its transmission particularly prominent.

[0003] At present, in the prior art, for processing video data, a direct compression method is usually used to compress the video data, and the compressed video data is transmitted. When it is determined that the video data will not change for a continuous period of time, the direct overall compression will lead to low compression efficiency or even invalid compression. Summary of the invention

[0004] The present invention provides an image compression method, device, electronic device and storage medium, which are used to solve the problem in the prior art that when video data is independently compressed, when the image of the video data does not change or changes very little over a continuous period of time, direct overall compression will result in low compression efficiency or even invalid compression. The present invention realizes that by performing vector calculation on current frame data and historical frame data in the video data, a data motion vector is determined, and compression is performed according to the data motion vector to determine the image compression result. At this time, only the current frame data in the video data is compressed, thereby improving the compression efficiency and making the compression effective.

[0005] The present invention provides an image compression method, comprising the following steps.

[0006] The current frame data and the historical frame data of the video data are obtained; wherein the historical frame data is the frame data before the current frame data in the video data.

[0007] The frame difference result is determined based on the current frame data and the historical frame data.

[0008] When it is determined that the frame difference result is less than or equal to a preset threshold, vector calculation is performed on the current frame data and the historical frame data in units of image blocks to determine the data motion vector; wherein the preset threshold is a pre-set threshold for judging the frame difference result.

[0009] Compression is performed based on the data motion vector to determine the image compression result.

[0010] According to an image compression method provided by the present invention, when it is determined that the frame difference result is less than or equal to a preset threshold, vector calculation is performed on the current frame data and the historical frame data in units of image blocks to determine the data motion vector, including: when it is determined that the frame difference result is less than or equal to the preset threshold, the count number is increased by 1, and it is determined whether the current frame data is the last pixel of the current frame; when it is determined that the current frame data is the last pixel of the current frame, it is determined whether the count number is greater than or equal to the preset number; when it is determined that the count number is greater than or equal to the preset number, vector calculation is performed on the current frame data and the historical frame data in units of image blocks to determine the data motion vector.

[0011] According to an image compression method provided by the present invention, vector calculation is performed on current frame data and historical frame data in units of image blocks to determine data motion vectors, including: performing block processing on current frame data to determine current frame image block data; and performing vector calculation on current frame image block data and historical frame data in units of image blocks to determine data motion vectors.

[0012] According to an image compression method provided by the present invention, vector calculation is performed in units of image blocks according to current frame image block data and historical frame data to determine a data motion vector, including: searching in units of image blocks according to current frame image block data and historical frame data to determine a search starting point; searching the current frame image block data according to the search starting point and an asymmetric cross search algorithm to determine a transition starting point; determining a rectangular point according to the transition starting point; wherein the rectangular point is a point within a preset range of the transition starting point, and the preset range is a pre-set range for determining the rectangular point; and performing vector calculation according to the rectangular point and a search matching criterion to determine the data motion vector.

[0013] According to an image compression method provided by the present invention, the method further includes: when it is determined that the frame difference result is greater than a preset threshold, the count quantity remains unchanged, and the step of determining whether the current frame data is the last pixel of the current frame is continued.

[0014] An image compression method provided according to the present invention further includes: when it is determined that the counted number is less than a preset number, directly compressing the current frame data to determine the image compression result.

[0015] An image compression method provided according to the present invention further includes: when it is determined that the current frame data is not the last pixel of the current frame, continuing to determine whether the frame difference result is less than or equal to a preset threshold.

[0016] The present invention also provides an image compression device, comprising the following modules.

[0017] The data acquisition module is used to acquire the current frame data and historical frame data of the video data; wherein the historical frame data is the frame data before the current frame data in the video data.

[0018] The frame difference result determination module is used to determine the frame difference result according to the current frame data and the historical frame data.

[0019] The vector determination module is used to perform vector calculation on the current frame data and the historical frame data in units of image blocks to determine the data motion vector when it is determined that the frame difference result is less than or equal to a preset threshold; wherein the preset threshold is a pre-set threshold for judging the frame difference result.

[0020] The compression result determination module is used to perform compression according to the data motion vector and determine the image compression result.

[0021] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-mentioned image compression methods when executing the program.

[0022] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, any of the above-mentioned image compression methods is implemented.

[0023] The present invention also provides a computer program product, comprising a computer program, and when the computer program is executed by a processor, any of the above-mentioned image compression methods is implemented.

[0024] The present invention provides an image compression method, device, electronic device and storage medium, which obtains the current frame data and historical frame data of video data; wherein the historical frame data is the previous frame data of the current frame data in the video data; determines the frame difference result according to the current frame data and the historical frame data; when it is determined that the frame difference result is less than or equal to the preset threshold, the current frame data and the historical frame data are vector-calculated in units of image blocks to determine the data motion vector; wherein the preset threshold is a preset threshold for judging the frame difference result; and the image compression result is determined according to the data motion vector. The technical scheme of the present invention is used to solve the defect that when the video data is independently compressed in the prior art, when the image of the video data does not change or changes very little for a continuous period of time, the direct overall compression will have low compression efficiency or even invalid compression, and realizes that the data motion vector is determined by performing vector calculation on the current frame data and the historical frame data in the video data, so as to perform compression according to the data motion vector and determine the image compression result, at this time, only the current frame data in the video data is compressed, the compression efficiency is improved, and the compression is effective. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0026] Figure 1 This is one of the flow charts of the image compression method provided by the present invention.

[0027] Figure 2 It is a structural schematic diagram of the functional modules of the image compression device provided by the present invention.

[0028] Figure 3 It is a structural schematic diagram of the decision module of the image compression device provided by the present invention.

[0029] Figure 4 This is the second flow chart of the image compression method provided by the present invention.

[0030] Figure 5 It is a structural schematic diagram of the inter-frame processing module of the image compression device provided by the present invention.

[0031] Figure 6 It is a schematic diagram of image segmentation provided by the present invention.

[0032] Figure 7 It is a structural schematic diagram of the image compression device provided by the present invention.

[0033] Figure 8 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0034] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0035] Combine the following Figure 1-Figure 2 The image compression method provided by the present invention is described. The image compression method provided by the present invention can be applicable to the image compression situation of the baseboard management controller. The execution subject of the method can be an electronic device or a configuration device of the control interface set in the electronic device. The configuration device of the control interface can be implemented by software, hardware or a combination of both. Figure 1 It is one of the flowcharts of the image compression method provided by the present invention, such as Figure 1 As shown, the method includes the following steps.

[0036] Step 101: Obtain current frame data and historical frame data of video data.

[0037] In this step, the historical frame data is the frame data before the current frame data in the video data; the current frame data is the frame data corresponding to the current moment of the video data.

[0038] In a specific embodiment, the electronic device of the present invention may be, for example, an image compression device. Figure 2 is a schematic diagram of the structure of the functional modules of the image compression device provided by the present invention, such as Figure 2 As shown, the interior of the image compression device includes a controller, a video graphics array (VGA) interface and an external controller. The controller has a data storage function; the VGA interface is a special interface that uses the VGA standard to output data and is used to obtain the video data of the host, so that the image compression device can obtain the current frame data and historical frame data of the video data through the VGA interface; the external controller is used to alleviate the storage pressure of the controller.

[0039] Specifically, the image acquisition device obtains the current frame data and the historical frame data corresponding to the video data of the host through the VGA interface.

[0040] Step 102: Determine a frame difference result according to the current frame data and the historical frame data.

[0041] In this step, the frame difference result refers to the result of frame difference processing between the current frame data and the historical frame data.

[0042] In a specific embodiment, Figure 2 As shown, the image compression device also includes a judgment module, an inter-frame processing module and an image compression module. The judgment module is used to read the current frame data and the historical frame data from the controller of the image compression device through the bus protocol (Advanced eXtensible Interface, AXI), and perform frame difference processing on the current frame data and the historical frame data to determine the frame difference result. And based on the frame difference result, it is determined whether inter-frame processing is required through the inter-frame processing module. The inter-frame processing module performs inter-frame processing after receiving the current frame data and the previous frame data from the judgment module, and the image compression module is used to compress the received data.

[0043] Specifically, after the current frame data and the historical frame data are acquired, the pixel values ​​of the current frame data and the historical frame data are subjected to frame difference processing in units of pixels of the current frame data and the historical frame data, thereby determining the frame difference result of the current frame data and the historical frame data. When it is determined that the frame difference result is less than or equal to a preset threshold, the current frame data and the historical frame data are sent to the inter-frame processing result, and step 103-step 104 are continued to be executed, first sending the current frame data and the historical frame data to the inter-frame processing result for processing to determine the data motion vector, and then sending the data motion vector to the image compression module for compression, and finally determining the image compression result. When it is determined that the frame difference result is greater than the preset threshold, the current frame data is sent to the image compression module for direct compression. The preset threshold is a pre-set threshold for judging the frame difference result, which is not limited in this embodiment.

[0044] In a specific embodiment, Figure 3 is a schematic diagram of the structure of the decision module of the image compression device provided by the present invention, such as Figure 3 As shown, the judgment module includes a frame difference processing module, a random access memory (RAM) and a selection module. The frame difference processing module is used to receive the current frame data of the video data obtained from the host and the historical frame data of the video obtained from the RAM, and then perform frame difference processing on the current frame data and the historical frame data, determine the frame difference result, and send the frame difference result to the selection module. The selection module judges the frame difference result. When it is determined that the frame difference result is less than or equal to the preset threshold, the current frame data and the historical frame data are sent to the inter-frame processing result for processing to determine the data motion vector, and then the data motion vector is sent to the image compression module for compression, and finally the image compression result is determined; when it is determined that the frame difference result is greater than the preset threshold, the current frame data is sent to the image compression module for direct compression. The preset threshold is a preset threshold for judging the frame difference result, which is not limited in this embodiment.

[0045] Step 103: When it is determined that the frame difference result is less than or equal to a preset threshold, vector calculation is performed on the current frame data and the historical frame data in units of image blocks to determine a data motion vector.

[0046] In this step, the data motion vector is a motion vector determined by performing vector calculation on the current frame data and the historical frame data in units of image blocks.

[0047] Specifically, when it is determined that the frame difference result is less than or equal to a preset threshold, vector calculation is performed on the current frame data and the historical frame data in units of image blocks to determine a data motion vector.

[0048] Step 104: perform compression according to the data motion vector to determine the image compression result.

[0049] In this step, the image compression result is the result of compressing the acquired video data.

[0050] Specifically, after the data motion vector is determined, compression is performed according to the data motion vector to determine an image compression result.

[0051] The present invention provides an image compression method, which obtains the current frame data and the historical frame data of the video data; wherein the historical frame data is the previous frame data of the current frame data in the video data; determines the frame difference result according to the current frame data and the historical frame data; when it is determined that the frame difference result is less than or equal to the preset threshold, the current frame data and the historical frame data are vector-calculated in units of image blocks to determine the data motion vector; wherein the preset threshold is a threshold value preset for judging the frame difference result; and the image compression result is determined according to the data motion vector. Based on the above embodiments, the technical scheme of the present invention is used to solve the defect that when the video data is independently compressed in the prior art, when the image of the video data does not change or changes very little for a continuous period of time, the direct overall compression will have low compression efficiency or even invalid compression, and realizes that the data motion vector is determined by performing vector calculation on the current frame data and the historical frame data in the video data, so as to perform compression according to the data motion vector and determine the image compression result, at this time, only the current frame data in the video data is compressed, the compression efficiency is improved, and the compression is effective.

[0052] Figure 4 This is the second flow chart of the image compression method provided by the present invention. The image compression method provided by the present invention can be applied to the image compression of the baseboard management controller. The execution subject of this method can be an electronic device or a configuration device of the control interface set in the electronic device. The configuration device of the control interface can be implemented by software, hardware or a combination of the two. Figure 4 As shown, when it is determined that the frame difference result is less than or equal to a preset threshold, vector calculation is performed on the current frame data and the historical frame data in units of image blocks to determine the data motion vector for optimization. The method includes the following steps.

[0053] Step 401: Acquire current frame data and historical frame data of video data.

[0054] In this step, the historical frame data is the frame data before the current frame data in the video data; Specifically, the image acquisition device obtains the current frame data and the historical frame data corresponding to the video data of the host through the VGA interface.

[0055] Step 402: Determine a frame difference result according to the current frame data and the historical frame data.

[0056] Specifically, after the current frame data and the historical frame data are acquired, frame difference processing is performed on the pixel values ​​of the current frame data and the historical frame data in units of pixels, thereby determining the frame difference result of the current frame data and the historical frame data.

[0057] Step 403: Determine whether the frame difference result is less than or equal to a preset threshold.

[0058] In this step, the preset threshold is a preset threshold for determining the frame difference result, which is not limited in this embodiment.

[0059] Specifically, determine whether the frame difference result is less than or equal to a preset threshold. When it is determined that the frame difference result is less than or equal to the preset threshold, continue to execute step S404; when it is determined that the frame difference result is greater than the preset threshold, continue to execute step S405.

[0060] Step 404: Add 1 to the count.

[0061] In this step, the count quantity is used to count the number of times the frame difference result is less than or equal to a preset threshold.

[0062] Specifically, when it is determined that the frame difference result is less than or equal to the preset threshold, the count number is increased by 1, and step 406 is further executed.

[0063] Step 405: The counted quantity remains unchanged.

[0064] Specifically, when it is determined that the frame difference result is greater than the preset threshold, the counted number remains unchanged, and step 406 is continued.

[0065] Step 406: Determine whether the current frame data is the last pixel of the current frame.

[0066] In this step, the last pixel is the end pixel of the current frame.

[0067] Specifically, when it is determined that the frame difference result is less than or equal to the preset threshold, the count number is increased by 1, and it is determined whether the current frame data is the last pixel of the current frame; when it is determined that the current frame data is not the last pixel of the current frame, continue to return to execute step 403, and determine that the frame difference result is less than or equal to the preset threshold; when it is determined that the current frame data is the last pixel of the current frame, continue to execute step 407.

[0068] Exemplarily, it is determined that the current frame includes A1, B1 and C1 pixels, and the A1, B1 and C1 pixels are in chronological order. At this time, if it is determined that the current frame data is the C1 pixel in the current frame, then the current frame data is determined to be the last pixel of the current frame, and step 407 is continued to be executed; if it is determined that the current frame data is the B1 pixel in the current frame, then it is determined that the current frame data is not the last pixel of the current frame, and step 403 is returned to execute to determine that the frame difference result is less than or equal to the preset threshold.

[0069] Step 407: Determine whether the counted number is greater than or equal to a preset number.

[0070] In this step, the preset number is a preset counting number, for example, it may be 3 times, 5 times, etc., which is not limited in this embodiment.

[0071] Specifically, when it is determined that the current frame data is the last pixel of the current frame, determine whether the count number is greater than or equal to the preset number; when it is determined that the count number is less than the preset number, continue to execute step 408; when it is determined that the count number is greater than or equal to the preset number, continue to execute step 409.

[0072] Step 408: directly compress the current frame data to determine the image compression result.

[0073] Specifically, when it is determined that the counted number is less than a preset number, the current frame data is directly compressed to determine an image compression result.

[0074] Step 409: perform vector calculation on the current frame data and the historical frame data in units of image blocks to determine the data motion vector.

[0075] Specifically, when it is determined that the counted number is greater than or equal to the preset number, the current frame data and the historical frame data are all input into the inter-frame processing module. Figure 5 is a schematic diagram of the structure of the inter-frame processing module of the image compression device provided by the present invention, such as Figure 5 As shown, the inter-frame processing module includes a blocking module, a motion vector calculation module and a motion vector prediction module. The blocking module obtains current frame data, and the motion vector module obtains historical frame data. Then the blocking module performs block processing on the current frame data, and sends the current frame data after block processing to the motion vector calculation module, so that the motion vector calculation module processes the current frame data and historical frame data after block processing, and performs vector prediction through the motion vector prediction module to determine the data motion vector.

[0076] In a specific implementation, vector calculation is performed on the current frame data and the historical frame data in units of image blocks, and the specific implementation steps for determining the data motion vector include: performing block processing on the current frame data to determine the current frame image block data; performing vector calculation on the current frame image block data and the historical frame data in units of image blocks to determine the data motion vector.

[0077] In this step, the current frame data is divided into blocks to determine the current frame image block data. The data block size of the current frame image block data may be, for example, 4×4, 8×8 or 16×16, etc., which is not limited in this embodiment.

[0078] Specifically, the data block size is determined, and the current frame data is divided into blocks according to the determined data block size to determine the current frame image block data, and the determined current frame image block data is data of a plurality of data block sizes. Then, according to the current frame image block data and the historical frame data, the image block is used as a unit, and the vector calculation is performed by adopting an asymmetric cross-type multi-level hexagonal grid motion search algorithm to finally determine the data motion vector.

[0079] In a specific embodiment, vector calculation is performed in units of image blocks based on the current frame image block data and the historical frame data, and specific implementation steps for determining the data motion vector include: searching in units of image blocks based on the current frame image block data and the historical frame data to determine the search starting point; searching the current frame image block data based on the search starting point and an asymmetric cross search algorithm to determine the transition starting point; determining a rectangular point based on the transition starting point; wherein the rectangular point is a point within a preset range of the transition starting point, and the preset range is a pre-set range for determining the rectangular point; and performing vector calculation based on the rectangular point and the search matching criteria to determine the data motion vector.

[0080] In this step, the position of the transition starting point is the position of the image block with the smallest mean square error with the current frame image block data searched in the historical frame data; the rectangular point is determined according to the transition starting point; wherein the rectangular point is a point within a preset range of the transition starting point, and the preset range is a pre-set range for determining the rectangular point.

[0081] Specifically, the search is performed in units of image blocks according to the current frame image block data and the historical frame data, and the search starting point is determined. Then, the asymmetric cross-type multi-level hexagonal grid motion search algorithm is used to search the current frame image block data to determine the transition starting point. The transition starting point can then be accurately used as the starting point for the next step, and then a rectangular point is determined within a preset range according to the transition starting point, and a search is performed through a small rectangle full search, and a non-uniform multi-hexagonal grid search is performed. Based on the consideration of large-scale video object motion, multiple hexagons of different sizes are used for search on the basis of the previous search, and finally the data motion vector is determined. The data motion vector is the vector of the point that is the optimal point at both the small hexagon and the small area cross center point.

[0082] In a specific implementation, the search criteria followed in the entire motion search process is the minimum mean square error criterion or the minimum absolute error mean criterion, etc. This embodiment does not limit this, and the minimum mean square error criterion or the minimum absolute error mean criterion is used to reduce the amount of calculation.

[0083] Exemplarily, when the minimum mean absolute error criterion is used to search and determine the data motion vector, the search area of ​​the historical frame data is first set, and then the displacement of the current frame image block data and the historical frame data is further found in the search area. If the historical frame data matching the current frame image block data can be found, the displacement is the required motion vector, and the motion vector is transmitted to the motion vector prediction module. The motion vector prediction module receives the motion vector of each image block. Considering that the encoding of the motion vector of each sub-block image block requires a considerable number of bits, especially when a small sub-block size (such as 4×4) is used, in order to reduce the number of transmission bits, the strong correlation between the motion vectors of adjacent sub-blocks can be used, and the data motion vector can be predicted by the motion vectors of adjacent encoded segments.

[0084] For example, Figure 6 It is a schematic diagram of image segmentation provided by the present invention, such as Figure 6 As shown, E is the current image block corresponding to the image block data of the current frame, A, B, and C are the three corresponding blocks to the left, top, and top right of E, respectively, and the motion vector prediction value is the median of the motion vectors of the image blocks A, B, and C. The predicted data motion vector is obtained.

[0085] The advantage of this setting is that it increases inter-frame processing, effectively improves compression efficiency, and reduces network bandwidth pressure.

[0086] Step 410: perform compression according to the data motion vector and determine the image compression result.

[0087] Specifically, after the data motion vector is determined, compression is performed according to the data motion vector to determine an image compression result.

[0088] The present invention provides an image compression method, which obtains current frame data and historical frame data of video data; determines a frame difference result according to the current frame data and the historical frame data; determines whether the frame difference result is less than or equal to a preset threshold; when it is determined that the frame difference result is less than or equal to the preset threshold, the count number is increased by 1, and a step of determining whether the current frame data is the last pixel of the current frame is further performed; when it is determined that the frame difference result is greater than the preset threshold, the count number remains unchanged, and the step of determining whether the current frame data is the last pixel of the current frame is continued to be performed; when it is determined that the current frame data is the last pixel of the current frame, it is determined whether the count number is greater than or equal to the preset number; when it is determined that the count number is less than the preset number, the current frame data is directly compressed to determine the image compression result; when it is determined that the count number is greater than or equal to the preset number, the current frame data and the historical frame data are all input into an inter-frame processing module, vector calculation is performed on the current frame data and the historical frame data in units of image blocks, and a data motion vector is determined; compression is performed according to the data motion vector to determine the image compression result. On the basis of the above-mentioned embodiments, the technical solution of the present invention is used to solve the problem in the prior art that when video data is independently compressed, when the image of the video data does not change or changes very little over a continuous period of time, direct overall compression will result in low compression efficiency or even invalid compression. By judging the frame difference result, it is determined that vector calculation needs to be performed on the current frame data and historical frame data in the video data to determine the data motion vector, and then compression is performed according to the data motion vector to determine the image compression result. At this time, only the current frame data in the video data is compressed, thereby improving the compression efficiency and making the compression effective.

[0089] The image compression device provided by the present invention is described below. The image compression device described below and the image compression method described above can be referred to each other.

[0090] Figure 7 is a schematic diagram of the structure of the image compression device provided by the present invention, referring to Figure 7 As shown, the image compression device 700 includes: a data acquisition module 701, a frame difference result determination module 702, a vector determination module 703 and a compression result determination module 704.

[0091] The data acquisition module 701 is used to acquire the current frame data and the historical frame data of the video data; wherein the historical frame data is the frame data before the current frame data in the video data.

[0092] The frame difference result determination module 702 is used to determine the frame difference result according to the current frame data and the historical frame data.

[0093] The vector determination module 703 is used to perform vector calculation on the current frame data and the historical frame data in units of image blocks to determine the data motion vector when it is determined that the frame difference result is less than or equal to a preset threshold; wherein the preset threshold is a pre-set threshold for judging the frame difference result.

[0094] The compression result determination module 704 is used to perform compression according to the data motion vector and determine the image compression result.

[0095] In an exemplary embodiment, the vector determination module 703 is specifically used to: when it is determined that the frame difference result is less than or equal to a preset threshold, add 1 to the count number and determine whether the current frame data is the last pixel of the current frame; when it is determined that the current frame data is the last pixel of the current frame, determine whether the count number is greater than or equal to the preset number; when it is determined that the count number is greater than or equal to the preset number, perform vector calculation on the current frame data and the historical frame data in units of image blocks to determine the data motion vector.

[0096] In an exemplary embodiment, the vector determination module 703 performs vector calculation on the current frame data and the historical frame data in units of image blocks to determine the data motion vector, and is specifically used to: perform block processing on the current frame data to determine the current frame image block data; perform vector calculation on the current frame image block data and the historical frame data in units of image blocks to determine the data motion vector.

[0097] In an exemplary embodiment, the vector determination module 703 performs vector calculations in units of image blocks based on the current frame image block data and the historical frame data to determine the data motion vector, and is specifically used to: perform a search in units of image blocks based on the current frame image block data and the historical frame data to determine the search starting point; perform a search on the current frame image block data based on the search starting point and an asymmetric cross search algorithm to determine the transition starting point; determine a rectangular point based on the transition starting point; wherein the rectangular point is a point within a preset range of the transition starting point, and the preset range is a pre-set range for determining the rectangular point; perform a vector calculation based on the rectangular point and the search matching criteria to determine the data motion vector.

[0098] In an exemplary embodiment, the device further includes: a counting module. The counting module is used to: when it is determined that the frame difference result is greater than a preset threshold, keep the counted number unchanged, and continue to perform the step of determining whether the current frame data is the last pixel of the current frame.

[0099] In an exemplary embodiment, the device further includes: a direct compression module. The direct compression module is used to: when it is determined that the counted number is less than a preset number, directly compress the current frame data to determine an image compression result.

[0100] In an exemplary embodiment, the device further includes: a loop determination module. The loop determination module is used to: when it is determined that the current frame data is not the last pixel of the current frame, continue to determine whether the frame difference result is less than or equal to a preset threshold.

[0101] The device of this embodiment can be used to execute the method of any embodiment in the image compression method side embodiment. Its specific implementation process and technical effects are similar to those in the image compression method side embodiment. For details, please refer to the detailed introduction in the image compression method side embodiment, which will not be repeated here.

[0102] Figure 8 is a schematic diagram of the structure of the electronic device provided by the present invention, such as Figure 8 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820 and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the image compression method, which includes: obtaining the current frame data and the historical frame data of the video data; wherein the historical frame data is the previous frame data of the current frame data in the video data; determining the frame difference result according to the current frame data and the historical frame data; when it is determined that the frame difference result is less than or equal to the preset threshold, performing vector calculation on the current frame data and the historical frame data in units of image blocks to determine the data motion vector; wherein the preset threshold is a preset threshold for judging the frame difference result; performing compression according to the data motion vector to determine the image compression result.

[0103] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0104] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the image compression method provided by the above methods, which includes: obtaining current frame data and historical frame data of video data; wherein the historical frame data is the previous frame data of the current frame data in the video data; determining a frame difference result based on the current frame data and the historical frame data; when it is determined that the frame difference result is less than or equal to a preset threshold, performing vector calculation on the current frame data and the historical frame data in units of image blocks to determine a data motion vector; wherein the preset threshold is a pre-set threshold for judging the frame difference result; compressing according to the data motion vector to determine the image compression result.

[0105] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the image compression method provided by the above-mentioned methods, the method comprising: obtaining current frame data and historical frame data of video data; wherein the historical frame data is the previous frame data of the current frame data in the video data; determining a frame difference result based on the current frame data and the historical frame data; when it is determined that the frame difference result is less than or equal to a preset threshold, performing vector calculation on the current frame data and the historical frame data in units of image blocks to determine a data motion vector; wherein the preset threshold is a pre-set threshold for judging the frame difference result; and compressing according to the data motion vector to determine the image compression result.

[0106] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0107] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0108] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An image compression method, characterized in that: include: Acquire current frame data and historical frame data of video data; wherein the historical frame data is the frame data before the current frame data in the video data; Determine a frame difference result according to the current frame data and the historical frame data; When it is determined that the frame difference result is less than or equal to a preset threshold, vector calculation is performed on the current frame data and the historical frame data in units of image blocks to determine a data motion vector; wherein the preset threshold is a preset threshold for determining the frame difference result; Compression is performed according to the data motion vector to determine an image compression result.

2. The image compression method according to claim 1, characterized in that: When it is determined that the frame difference result is less than or equal to a preset threshold, performing vector calculation on the current frame data and the historical frame data in units of image blocks to determine a data motion vector includes: When it is determined that the frame difference result is less than or equal to the preset threshold, the count number is increased by 1, and it is determined whether the current frame data is the last pixel in the current frame; When it is determined that the current frame data is the last pixel of the current frame, determining whether the counted number is greater than or equal to a preset number; When it is determined that the counted number is greater than or equal to the preset number, vector calculation is performed on the current frame data and the historical frame data in units of image blocks to determine a data motion vector.

3. The image compression method according to claim 2, characterized in that: The performing vector calculation on the current frame data and the historical frame data in units of image blocks to determine the data motion vector includes: Performing block processing on the current frame data to determine the current frame image block data; The data motion vector is determined by performing vector calculation in units of image blocks according to the current frame image block data and the historical frame data.

4. The image compression method according to claim 3, characterized in that: The step of performing vector calculation in units of image blocks according to the current frame image block data and the historical frame data to determine the data motion vector comprises: Searching in units of image blocks according to the current frame image block data and the historical frame data, and determining a search starting point; Search the image block data of the current frame according to the search starting point and an asymmetric cross search algorithm to determine a transition starting point; Determine a rectangular point according to the transition start point; wherein the rectangular point is a point within a preset range of the transition start point, and the preset range is a pre-set range for determining the rectangular point; Vector calculation is performed according to the rectangular points and the search matching criterion to determine the data motion vector.

5. The image compression method according to claim 2, characterized in that: Also includes: When it is determined that the frame difference result is greater than the preset threshold, the count quantity remains unchanged, and the step of determining whether the current frame data is the last pixel of the current frame is continued.

6. The image compression method according to claim 2, characterized in that: Also includes: When it is determined that the counted number is less than the preset number, the current frame data is directly compressed to determine the image compression result.

7. The image compression method according to claim 2, characterized in that: Also includes: When it is determined that the current frame data is not the last pixel of the current frame, it is further determined whether the frame difference result is less than or equal to a preset threshold.

8. An image compression device, characterized in that: include: A data acquisition module, used to acquire current frame data and historical frame data of video data; wherein the historical frame data is the previous frame data of the current frame data in the video data; A frame difference result determination module, used to determine a frame difference result according to the current frame data and the historical frame data; A vector determination module, configured to perform vector calculation on the current frame data and the historical frame data in units of image blocks to determine a data motion vector when it is determined that the frame difference result is less than or equal to a preset threshold; wherein the preset threshold is a preset threshold for determining the frame difference result; The compression result determination module is used to perform compression according to the data motion vector and determine the image compression result.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the image compression method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the image compression method according to any one of claims 1 to 7 is implemented.