WO2015021753A1 - 一种数据压缩的方法、计算机***和装置 - Google Patents
一种数据压缩的方法、计算机***和装置 Download PDFInfo
- Publication number
- WO2015021753A1 WO2015021753A1 PCT/CN2014/070865 CN2014070865W WO2015021753A1 WO 2015021753 A1 WO2015021753 A1 WO 2015021753A1 CN 2014070865 W CN2014070865 W CN 2014070865W WO 2015021753 A1 WO2015021753 A1 WO 2015021753A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- compressed
- data
- compression
- picture
- storage module
- Prior art date
Links
- 238000013144 data compression Methods 0.000 title claims abstract description 196
- 238000000034 method Methods 0.000 title claims abstract description 51
- 238000007906 compression Methods 0.000 claims abstract description 205
- 230000006835 compression Effects 0.000 claims abstract description 205
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 63
- 238000013500 data storage Methods 0.000 claims description 141
- 230000001133 acceleration Effects 0.000 claims description 75
- 230000004044 response Effects 0.000 claims description 58
- 125000004122 cyclic group Chemical group 0.000 claims description 8
- 239000003086 colorant Substances 0.000 description 8
- 238000010586 diagram Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 238000004590 computer program Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/90—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
Definitions
- Embodiments of the present invention relate to computer technology, and in particular, to a data compression method, computer system, and apparatus.
- Data compression can reduce the size of the original data, facilitate network transmission, and reduce the occupation of storage space. It is widely used in many fields.
- the data is compressed by first receiving the data to be compressed of the application module through the compression interface, and then compressing the data to be compressed by using a compression algorithm, and then returning the compressed data to the application through the compression interface after the compression is completed. Module.
- the prior art is to directly compress the data generated by the application module.
- the application module generates a large amount of data that needs to be compressed.
- VDI virtual desktop infrastructure
- multiple virtual machines generate data compression requirements at the same time, which causes the server to have a large amount of data to be compressed.
- the system CPU utilization is very high, which is generated in the system.
- the bottleneck of data compression leads to inefficient data processing and large system resource consumption.
- Embodiments of the present invention provide a data compression method, computer system, and apparatus to improve data compression efficiency.
- the embodiment of the present invention provides a data compression method, where the method includes: receiving a data compression request, where the data compression request indicates that the picture data to be compressed is compressed;
- Determining the feature identifier of the picture data to be compressed wherein the feature identifier is used to represent the picture data to be compressed, and the picture data with the same feature identifier has the same compressed data; according to the picture data to be compressed Feature identifier, acquiring compressed data corresponding to the feature identifier saved by the compressed data storage module; Returning a data compression response, the data compression response carrying compressed data corresponding to the feature identifier acquired from the compressed data storage module.
- the determining the feature identifier of the to-be-compressed picture data includes: calculating a feature identifier of the picture data to be compressed, where the feature identifier includes cyclic redundancy Code or Hamming code.
- the method further includes: determining whether the picture data to be compressed meets a condition of compression acceleration, and if the condition of the compression acceleration is met, performing the And the step of acquiring, by the feature identifier of the image data to be compressed, the compressed data corresponding to the feature identifier saved by the compressed data storage module.
- the determining whether the picture data to be compressed meets the conditions of the compression acceleration includes:
- the method further includes: establishing the compressed data storage module, where the compressed data storage module is configured to save a compressed data set of picture data, the compressed data set storing compressed data of different picture data by using the feature identifier as an index.
- the method further includes: determining whether the compressed data storage module saves the compressed data corresponding to the feature identifier, and if yes, performing the according to the compressed
- the feature identifier of the picture data is obtained by the step of acquiring the compressed data corresponding to the feature identifier saved by the compressed data storage module.
- the embodiment of the present invention provides an apparatus for data compression, where the apparatus includes: a receiving unit, configured to receive a data compression request, where the data compression request indicates compression of the picture data to be compressed;
- a determining unit configured to determine a feature identifier of the picture data to be compressed, where the feature identifier is used to represent the picture data to be compressed, and the picture data with the same feature identifier has the same compressed data;
- an acquiring unit configured to obtain, according to the feature identifier of the picture data to be compressed determined by the determining unit, compressed data corresponding to the feature identifier saved by the compressed data storage module;
- a response unit configured to return a data compression response, where the data compression response carries compressed data corresponding to the feature identifier acquired from the compressed data storage module.
- the determining unit is specifically configured to: calculate a feature identifier of the picture data to be compressed, where the feature identifier includes a cyclic redundancy code or a Hamming code.
- the apparatus further includes: a classification unit, configured to determine whether the picture data to be compressed meets a condition of compression acceleration; determining, in the classification unit, the to-be-determined When the compressed image data meets the condition of the compression acceleration, the acquiring unit is configured to acquire, according to the feature identifier of the image data to be compressed, the compressed data corresponding to the feature identifier saved by the compressed data storage module. .
- the classification unit is specifically configured to:
- the compressed data storage module is disposed inside or outside the data compression device, and is configured to save compressed data of the picture data.
- the set, the compressed data set uses the feature identifier as an index to store compressed data of different picture data.
- the determining unit is further configured to: determine whether the compressed data storage module saves the compressed data corresponding to the feature identifier;
- the acquiring unit is specifically configured to: when the determining unit determines that the compressed data storage module saves the compressed data corresponding to the feature identifier, acquire the compressed data according to the feature identifier of the image data to be compressed.
- the feature saved by the pipe module identifies the corresponding compressed data.
- the embodiment of the present invention provides a data compression system, where the system includes: a data compression device, configured to receive a data compression request, where the data compression request indicates compression of the picture data to be compressed, and determines the to-be-determined a feature identifier of the compressed picture data, where the feature identifier is used to represent the picture data to be compressed, and the picture data with the same feature identifier has the same compressed data, and is obtained according to the feature identifier of the picture data to be compressed.
- a data compression device configured to receive a data compression request, where the data compression request indicates compression of the picture data to be compressed, and determines the to-be-determined a feature identifier of the compressed picture data, where the feature identifier is used to represent the picture data to be compressed, and the picture data with the same feature identifier has the same compressed data, and is obtained according to the feature identifier of the picture data to be compressed.
- the feature identifier of the picture data to be compressed is determined, and according to the feature identifier of the picture data to be compressed, the compressed data storage module is saved.
- the feature identifiers the compressed data, and the image data to be compressed is obtained by compressing the image data to be compressed without calling a compression algorithm.
- the data is reduced, thereby avoiding the repeated compression of the data, improving the data compression efficiency, and effectively saving system resources.
- Compressed data of picture data Compressed data of picture data Compressed data of picture data Compressed data of picture data.
- FIG. 1 is a flowchart of a method according to an embodiment of the present invention
- FIG. 3 is a flow chart of still another method according to an embodiment of the present invention.
- FIG. 4 is a composition diagram of a data compression apparatus according to an embodiment of the present invention
- FIG. 5 is a composition diagram of another data compression apparatus according to an embodiment of the present invention
- FIG. 6 is a schematic diagram of a data compression apparatus according to an embodiment of the present invention.
- a composition diagram of a data compression apparatus
- FIG. 7 is a composition diagram of a data compression system according to an embodiment of the present invention
- FIG. 8 is a composition diagram of a computer according to an embodiment of the present invention.
- the embodiment of the invention provides a data compression method, a computer system and a device.
- directly acquiring the saved compressed data can avoid repeated compression work, improve data processing efficiency, and reduce processor resource consumption.
- the flow of the data compression method provided by the embodiment of the present invention includes:
- the data compression module obtains the data compression triggered by the application module from the operating system.
- the data compression module receives the data compression request, and acquires the image data to be compressed according to the data compression request.
- the picture data to be compressed may be one frame of picture data or multiple frames of picture data.
- the determining, by the data compression module, the feature identifier of the image data to be compressed from the application module or the operating system, or the data compression module obtains the The feature identifier of the compressed picture data is described.
- the feature identifier of the picture data to be compressed may include a feature identifier of each frame of picture data included in the picture data to be compressed, and the feature identifier of each frame of picture data may be used to represent the each frame.
- Picture data, picture data with the same feature identification has the same compressed data.
- the feature identifier of each frame of picture data may be an image feature code of the frame data of each frame.
- the compressed data storage module is configured to save a compressed data set, that is, to save different compressed data obtained by compressing each picture data by using a compression algorithm, and simultaneously store the corresponding relationship between each compressed data and its corresponding feature identifier.
- the image data with the same feature identifier has the same compressed data, so the compressed data saved by the compressed data storage module can be obtained according to the feature identifier of the image data to be compressed, and the acquired compressed data is used as the to-be-compressed data. Compressed data of compressed picture data.
- the method may specifically include:
- 201 Establish a compressed data storage module, where the compressed data storage module is configured to save a compressed data set of the picture data.
- the method further includes establishing a compressed data storage module, the compressed data storage module is configured to save a compressed data set of the image data, and the compressed data set is characterized by the feature of the image data.
- the compressed data of the different picture data is saved as an index, so the data compression module may obtain the compressed data corresponding to the saved feature identifier of the picture data from the compressed data storage module according to the feature identifier of the picture data,
- the compressed data storage module may be disposed inside or outside the data compression device.
- step 201 is an optional step.
- the existing storage module may be used to save the compressed data set. It is not necessary to perform this step to establish a compressed data storage module.
- the application module When the user accesses the application module, the user needs to compress the image data, and the application module triggers the operating system to perform processing, and the operating system instructs the data compression module to compress the image data to be compressed, and the data compression module receives the data compression module.
- the image data to be compressed carried in the data compression request may be directly obtained, or the related module may be queried according to the indication in the data compression request to obtain the image data to be compressed.
- the picture data to be compressed is one frame of picture data, determining a feature identifier of the one frame of picture data, if the picture data to be compressed is multi-frame picture data, determining The feature identifier of each frame of picture data.
- the determining, by the data compression module, the feature identifier of the image data to be compressed, or the data compression module determines that the to-be-compressed is determined by the data compression module.
- the feature identifier of the picture data, the feature identifier may be an image feature code, and the specific expression may be a character sequence or a digital sequence, for example, may be a Cyclic Redundancy Code (CRC), a Hamming code, but is not limited thereto. .
- CRC Cyclic Redundancy Code
- the data compression module calculates the feature identifier of the image data to be compressed, and the image data to be compressed is calculated by using different algorithms.
- the image data may be regarded as a binary number, and the calculation of the CRC32 may be referred to.
- the method obtains a feature identifier of the picture data, where the CRC may further include a CRC8, a CRC12, a CRC16, a CRC32, a CRC32c, and the like.
- step 205 is performed, otherwise step 206 is performed.
- the compressed data storage module is configured to save the compressed data set, that is, to save different compressed data obtained by compressing each picture data by using a compression algorithm, and simultaneously save each compressed data and its corresponding feature identifier.
- the data compression module may determine, according to the feature identifier of the picture data to be compressed, whether the compressed data storage module stores the compressed data corresponding to the feature identifier, that is, whether the file to be compressed is saved. The compressed data of the picture data.
- step 208 Acquire compressed data corresponding to the feature identifier saved by the compressed data storage module, and then perform step 208.
- the image data with the same feature identifier has the same compressed data, and the compressed data corresponding to the feature identifier saved by the compressed data storage module can be obtained according to the feature identifier of the image data to be compressed, and the acquired data is obtained.
- the compressed data is used as compressed data of the picture data to be compressed.
- step 206 compressing the image data to be compressed by using a compression algorithm to obtain a corresponding pressure Reduce the data, and then go to step 207.
- the data compression module compresses the image data to be compressed by using a compression algorithm to obtain compressed data of the image data to be compressed. Then, step 207 is performed.
- the compression algorithm may be a lossy compression algorithm or a lossless compression algorithm, which is not limited herein.
- the compressed data obtained by the compression is saved in the compressed data storage module.
- the compressed data obtained by the compression is saved in the compressed data storage module, so that when the system needs to compress the image data to be compressed next time, the system can directly obtain the compressed data storage module without repeating Compression.
- the compressed data obtained by the compression may be associated with the feature identifier of the image data to be compressed, and then saved, so that the compressed data can be queried by the feature identifier; preferably, the execution is performed.
- the following steps may be further performed:
- step 207 ′ determining whether the picture data to be compressed satisfies the condition of compression acceleration, and if the condition of the compression acceleration is met, performing step 207, otherwise performing step 208.
- the data compression module may further determine whether the picture data to be compressed satisfies a condition of compression acceleration, and if the condition of the compression acceleration is met, the step may be performed. 207. If the condition of the compression acceleration is not met, step 208 may be performed.
- step 207 Determining a size of a system resource that is compressed by the image data, and comparing the system resource consumed by the compressed image data with a preset first threshold. If the first threshold is exceeded, the image data is compressed. If the image data with a large resource is consumed, step 207 may be performed. The compressed data of the image data to be compressed is saved in the compressed data storage module. If the first threshold is not exceeded, the image data belongs to the image data with less compressed consumption resources, and may not be saved. Compress the compressed data of the compressed image data, and directly execute the steps
- the first threshold is an empirical value
- the size, length, or bit depth of the data may be determining whether the size, length, or depth or depth of the picture data to be compressed is If the second threshold is exceeded, it may be determined whether the size, length, and depth of the picture data to be compressed exceed the second threshold or whether two of the parameter values exceed the second threshold, and if so, Determining that the picture data to be compressed satisfies the condition of the compression acceleration, and the picture data to be compressed belongs to the picture data with a large compression consumption resource, wherein the attribute value of the picture data to be compressed may be from the application module.
- the second threshold is an empirical value
- the second threshold may be a value, or may be a plurality
- Determining whether the complexity of the picture data to be compressed exceeds a third threshold If yes, determining that the picture data to be compressed satisfies a condition of compression acceleration, specifically, determining the complexity of the picture data to be compressed. Whether the number of colors of the pixels of the picture data to be compressed exceeds the third threshold, and if yes, determining that the picture data to be compressed satisfies the condition of compression acceleration, the to-be-compressed.
- the picture data belongs to the picture data with higher complexity, and compressing the picture data will consume a larger system resource, and the number of colors of the pixels of the picture to be compressed may be obtained from the application module, or may be the data compression.
- the module obtains by using the image data to be compressed by an algorithm, and the third threshold belongs to an empirical value.
- the data compression module returns a data compression response to the application module, such that the application
- the client corresponding to the sequence module can obtain the compressed data of the picture data to be compressed, and can perform picture display according to the compressed data.
- the data compression module carries the acquired compressed data corresponding to the feature identifier in data compression.
- the data compression module carries the compressed data compressed by the compression algorithm in the data compression response.
- the data compression module may first determine whether the compressed data storage module stores the compressed data of the image data to be compressed, and if so, from the The compressed data storage module obtains the compressed data of the image data to be compressed, avoids repeated compression work, and effectively saves system resources. If not, the compression algorithm is used to obtain compressed data of the image data to be compressed. And compressing the compressed data of the picture data in the compressed data storage module to improve and update the compressed data storage module, so that when the compressed data of the picture data is needed next time, the compression is not repeated. The picture data.
- the picture data to be compressed satisfies the condition of the compression acceleration, and if the condition of the compression acceleration is met, the picture data belongs to the picture data with a large compression consumption resource, and the picture is The compressed data of the data is saved, so that when the compressed data of the picture data is needed next time, the compressed picture data is not required to be consumed by a large system resource. If the condition of the compression acceleration is not satisfied, the picture data is not a compressed resource.
- the compression data can be directly used to obtain the compressed data of the picture data, which not only utilizes the system resources reasonably, but also saves the storage space of the system. According to
- the method may specifically include:
- the method further includes establishing the compressed data a storage module, the compressed data storage module is configured to store a compressed data set of the picture data, and the compressed data set uses the feature identifier of the picture data as an index to store compressed data of different picture data, so the data compression module may The compressed data corresponding to the feature identifier of the saved image data is obtained from the compressed data storage module according to the feature identifier of the image data, and the compressed data storage module may be disposed inside or outside the data compression device.
- the application module When the user accesses the application module, the user needs to compress the image data, and the application module triggers the operating system to perform processing, and the operating system instructs the data compression module to compress the image data to be compressed, and the data compression module receives the data compression module.
- the image data to be compressed carried in the data compression request may be directly obtained, or the related module may be queried according to the indication in the data compression request to obtain the image data to be compressed.
- step 303 Determine whether the picture data to be compressed satisfies the condition of compression acceleration. If the condition of the compression acceleration is met, go to step 304, otherwise go to step 309.
- the data compression module may further determine whether the picture data to be compressed satisfies the condition of compression acceleration, and if the condition of the compression acceleration is met, it indicates that the picture data belongs to picture data with large compression cost resources, and the system
- the compressed data of the picture data may have been saved, and the process of acquiring the compressed data of the picture data may be directly performed in steps 304 to 306, that is, when compression is required, the system directly acquires the pre-stored picture to be compressed.
- the compressed data of the data thereby effectively saving system resources and improving the efficiency of data compression.
- the determining whether the picture data to be compressed satisfies the condition of compression acceleration may be specifically implemented as follows:
- Whether the size, the length or the width, or the bit depth exceeds the second threshold may further be determining whether the size, the length and the width, and the bit depth of the picture data to be compressed exceed the second threshold or whether two of the parameter values exceed The second threshold, if yes, determining that the picture data to be compressed meets the condition of the compression acceleration, the picture data to be compressed belongs to the picture data with a large compression consumption resource, wherein the attribute of the picture data to be compressed
- the value may be obtained from the application module, the second threshold is an empirical value, and the second threshold may be a value or a set of multiple values; or
- Determining whether the complexity of the picture data to be compressed exceeds a third threshold If yes, determining that the picture data to be compressed satisfies a condition of compression acceleration, specifically, determining the complexity of the picture data to be compressed. Whether the number of colors of the pixels of the picture data to be compressed exceeds the third threshold, and if yes, determining that the picture data to be compressed satisfies the condition of compression acceleration, the to-be-compressed.
- the picture data belongs to the picture data with higher complexity, and compressing the picture data will consume a larger system resource, and the number of colors of the pixels of the picture to be compressed may be obtained from the application module, or may be the data compression.
- the module obtains by using the image data to be compressed by an algorithm, and the third threshold belongs to an empirical value. .
- the data compression module determines the feature identifier of the image data to be compressed, and the determining the feature identifier of the image data to be compressed may be performed after step 302, and may also be performed before step 302.
- the embodiments of the present invention are not limited herein.
- the determining the feature identifier of the image data to be compressed may be: acquiring the feature identifier of the image data to be compressed from the application module, or obtaining, by the data compression module, the image data to be compressed.
- the feature identifier may be an image feature code, and the specific expression may be a character sequence or a digital sequence, for example, may be a cyclic redundancy code (Cyclic) Redundancy Code, CRC), Hamming code, but not limited to this
- the data compression module calculates the feature identifier of the image data to be compressed, and may calculate the image data to be compressed by using different algorithms, for example,
- the picture data is regarded as a binary number, and the feature identifier of the picture data is determined according to the calculation manner of the CRC32, wherein the CRC may further include CRC8, CRC12, CRC16, CRC32, CRC32c, and the like.
- the picture data to be compressed is one frame of picture data, determining a feature identifier of the one frame of picture data, and if the picture data to be compressed is multi-frame picture data, determining each picture of the frame The feature identifier of the data.
- step 305 Determine whether the compressed data storage module saves the compressed data corresponding to the feature identifier. If it is determined that the compressed data storage module saves the compressed data corresponding to the feature identifier, go to step 306, otherwise go to step 307. .
- the compressed data storage module is configured to save the compressed data set, that is, to save different compressed data obtained by compressing each picture data by using a compression algorithm, and simultaneously save each compressed data and its corresponding feature identifier.
- the data compression module may determine, according to the feature identifier of the picture data to be compressed, whether the compressed data storage module stores the compressed data corresponding to the feature identifier, that is, whether the file to be compressed is saved.
- the compressed data of the picture data Compressed data of image data
- the data compression module determines that the compressed data corresponding to the feature identifier is saved, the compressed data corresponding to the saved feature identifier is obtained from the compressed data storage module, and the image data with the same feature identifier has the same compressed data. Therefore, the acquired compressed data can be used as the compressed data of the picture data to be compressed, thereby avoiding repeated compression work.
- step 307 Compress the image data to be compressed by using a compression algorithm to obtain corresponding compressed data, and then perform step 308.
- the data compression module compresses the image data to be compressed by using a compression algorithm to obtain compressed data of the image data to be compressed, and then performs step 308.
- the compression algorithm may be a lossy compression algorithm or a lossless compression algorithm, which is not limited herein.
- step 308 Save the compressed compressed data in the compressed data storage module, and then perform step 310.
- the compressed data obtained by the compression is saved in the compressed data storage module, so that when the system needs to compress the image data to be compressed next time, the system can directly obtain the compressed data storage module without repeating Compression.
- the compressed compressed data may be associated with the feature identifier of the image data to be compressed, and then saved, so that the compressed data can be queried by the feature identifier;
- step 309 Compress the image data to be compressed by using a compression algorithm to obtain corresponding compressed data, and then perform step 310.
- step 310 If it is determined that the picture data to be compressed does not satisfy the condition of the compression acceleration, it indicates that the picture data to be compressed belongs to the picture data with less compression cost resources, and the data compression module directly acquires the picture data to be compressed by using a compression algorithm. The data is compressed, and after this step is completed, step 310 is performed.
- the data compression module returns a data compression response to the application module, so that the client corresponding to the application module can obtain the compressed data of the picture data to be compressed, and can perform picture display according to the compressed data.
- the data compression module determines whether the compressed data storage module saves the compressed data of the picture data to be compressed, and if so, from the compression Obtaining the saved image data to be compressed in the data storage module Compressing data, avoiding repeated compression work, and effectively saving system resources. If not saved, the compressed data is used to obtain compressed data of the image data to be compressed, and the compressed data of the image data is stored in the compressed data storage module. The saving is performed to improve and update the compressed data storage module, so that when the compressed data of the image data is needed next time, the image data is not repeatedly compressed.
- the data compression module after receiving the data compression request, the data compression module further includes determining whether the picture data to be compressed satisfies a condition of compression acceleration, and if the condition of compression acceleration is met, The process of acquiring the compressed data of the image data to be compressed is accelerated, that is, when the compressed data corresponding to the feature identifier of the image data to be compressed is saved, the saved data is directly obtained from the compressed data storage module.
- the compressed data corresponding to the feature identifier avoids the compression of the image data with large compression resources, so that the process of acquiring the compressed data of the image data is accelerated, further saving system resources and improving data compression efficiency.
- the method of the embodiment of the present invention can be applied to a VDI scenario.
- the virtual machine corresponding to different clients can save the compressed data of different picture data in the same compressed data storage module, and the compressed data storage module can be set in the virtual On the machine or the PC, if the first picture data needs to be compressed by the plurality of clients, or the first client needs to compress the first picture data multiple times, the first data can be directly obtained from the compressed data storage module.
- the compressed data of the picture data avoids the repeated compression work.
- the compressed data of the picture data to be compressed may be saved in the compressed data storage module of the virtual machine where the local application is located, so that the local application needs
- the image data to be compressed is repeatedly compressed, it is directly obtained from the compressed data storage module of the virtual machine, which avoids repeated compression of the data, improves the efficiency of data compression, and obtains the image data to be compressed locally.
- the real-time and rapid communication is guaranteed.
- the data compression device provided in the embodiment of the present invention is applied to a computer system. As shown in FIG. 4, the device 400 includes:
- the receiving unit 401 is configured to receive a data compression request, where the data compression request indicates that the picture data to be compressed is compressed;
- the determining unit 402 is configured to determine a feature identifier of the picture data to be compressed, where the feature identifier is used to represent the picture data to be compressed, and the picture data with the same feature identifier has the same compressed data.
- the obtaining unit 403 is configured to obtain compressed data corresponding to the feature identifier saved by the compressed data storage module according to the feature identifier of the image data to be compressed.
- the response unit 404 is configured to return a data compression response, where the data compression response carries the acquired compressed data corresponding to the feature identifier.
- the image data to be compressed may be acquired according to the data compression request, and the image data to be compressed may be one frame of image data or multiple frames of image data, and the determining unit 402 determines characteristics of the image data to be compressed.
- the identifier may be a feature identifier of the image data to be compressed obtained from the application module or the operating system, or may be obtained by the determining unit 402 to obtain the feature identifier of the image data to be compressed.
- the compressed data storage module is configured to save a compressed data set, that is, to save different compressed data obtained by compressing each picture data by using a compression algorithm, and simultaneously save each compressed data and corresponding features thereof.
- the determining unit 402 determines the feature identifier of the picture data to be compressed after the receiving unit 401 receives the data compression request, and the acquiring unit 403 is configured according to the feature of the picture data to be compressed. Identifying, by the compressed data storage module, the compressed data corresponding to the saved feature identifier, the response unit 404 returning a data compression response carrying the acquired compressed data corresponding to the feature identifier, and avoiding data Repeated compression work improves data compression efficiency and saves system resources.
- the data compression apparatus 500 may include: a receiving unit 501, a determining unit 502, an obtaining unit 503, a response unit 504, a compressed data storage module 505, and a The second compression unit 506, wherein, in another embodiment, the compressed data storage module 505 can also be disposed outside the data compression device 500.
- the compressed data storage module 505 is configured to store a compressed data set of the picture data, and the compressed data set 505 stores the pressure of different picture data by using the feature identifier of the picture data as an index.
- the data compression device 500 is configured to obtain the compressed data corresponding to the saved feature identifier of the image data from the compressed data storage module 505 according to the feature identifier of the image data.
- the user generates a requirement for compressing the image data when accessing the application module
- the application module triggers an operating system to perform processing
- the operating system instructs the data compression device to compress the image data to be compressed
- the receiving unit 501 is configured to receive a data compression request, and obtain image data to be compressed according to the data compression request, where the receiving unit 501 may directly obtain the image data to be compressed carried in the data compression request, or may
- the querying related module in the data compression request acquires the picture data to be compressed, wherein the data compression request indicates that the picture data to be compressed is compressed.
- the determining unit 502 is configured to determine a feature identifier of the picture data to be compressed, and determine, by using the feature identifier, whether the compressed data storage module 505 is saved.
- the feature identifier corresponds to the compressed data, where the feature identifier is used to represent the image data to be compressed, and the image data with the same feature identifier has the same compressed data.
- the determining unit 502 may The application module obtains the feature identifier of the image data to be compressed, and the determining unit 502 may obtain the feature identifier of the image data to be compressed, where the feature identifier may be an image feature code, and the specific expression form. It may be a character sequence or a digital sequence, and may be, for example, a Cyclic Redundancy Code (CRC), a Hamming code, but is not limited thereto.
- CRC Cyclic Redundancy Code
- the obtaining unit 503 is configured to acquire the compressed data storage module 505 according to the feature identifier when the determining unit 502 determines that the compressed data storage module 505 stores the compressed data corresponding to the feature identifier.
- the compressed data corresponding to the feature identifiers may be the compressed data corresponding to the feature identifiers, and the compressed data corresponding to the acquired feature identifiers may be used as the compressed data of the image data to be compressed.
- the response unit 504 is configured to return a data compression response that carries the compressed data corresponding to the feature identifier acquired by the acquiring unit 503.
- the second compression unit 506 is configured to compress the image data to be compressed by using a compression algorithm when the determining unit 502 determines that the compressed data storage module 505 does not save the compressed data corresponding to the feature code.
- the compression data of the picture data to be compressed is obtained, where the compression algorithm may be a lossy compression algorithm or a lossless compression algorithm, which is not limited herein.
- the compressed data storage module 505 is further configured to save the compressed data compressed by the second compression unit 506 by using a compression algorithm, so that the next time the system needs to compress the image data to be compressed, the compressed data may be directly Obtaining in the storage module 505, the repeated compression is not required.
- the compressed compressed data may be associated with the feature identifier of the image data to be compressed, and then saved, so that the feature identifier is saved. The compressed data can be queried.
- the device may further include:
- the categorizing unit 507 is configured to determine whether the picture data to be compressed satisfies the condition of the compression acceleration; the compressed data storage module 505 is specifically configured to trigger the determination of the acknowledgment when the picture data to be compressed satisfies the condition of the compression acceleration The unit 502 determines, according to the feature identifier, whether the compressed data storage module 505 stores the compressed data corresponding to the feature identifier, or saves the compressed data that is compressed by the second compression unit 506 by using a compression algorithm;
- the determining whether the picture data to be compressed meets the condition of the compression acceleration includes:
- Determining a size of a system resource that is compressed by the image data and comparing the system resource consumed by the compressed image data with a preset first threshold. If the first threshold is exceeded, the image data is compressed.
- the compressed data of the image data to be compressed may be saved in the compressed data storage module. If the first threshold is not exceeded, the image data belongs to the compressed consumption resource.
- Small picture data can not be saved
- the compressed data of the picture data to be compressed wherein the first threshold is an empirical value; or determining whether the attribute value of the picture data to be compressed exceeds a second threshold, and if yes, determining the picture to be compressed
- the data satisfies the condition of the compression acceleration, and the attribute value includes any one of the following factors or any combination thereof: the size, the length and the width, or the bit depth of the picture data.
- the determining whether the attribute value of the picture data to be compressed is The determining whether the size, the length, the width, and the bit depth of the picture data to be compressed exceeds the second threshold may be determined whether the size, the length, the width, and the bit depth of the picture data to be compressed are If the second threshold or the two of the parameter values exceeds the second threshold, if yes, it is determined that the picture data to be compressed satisfies the condition of compression acceleration, and the picture data to be compressed belongs to a compressed consumption resource.
- Image data, wherein the attribute value of the picture data to be compressed may be obtained from the application module, the second threshold Belonging to experience, the second threshold value may be a numerical value, it may be a set of multiple values thereof; or
- Determining whether the complexity of the picture data to be compressed exceeds a third threshold If yes, determining that the picture data to be compressed satisfies a condition of compression acceleration, specifically, determining the complexity of the picture data to be compressed. Whether the number of colors of the pixels of the picture data to be compressed exceeds the third threshold, and if yes, determining that the picture data to be compressed satisfies the condition of compression acceleration, the to-be-compressed.
- the picture data belongs to the picture data with higher complexity, and compressing the picture data will consume a larger system resource, and the number of colors of the pixels of the picture to be compressed may be obtained from the application module, or may be the data compression.
- the module obtains by using the image data to be compressed by an algorithm, and the third threshold belongs to an empirical value.
- the determining unit 502 determines whether the compressed data storage module 505 stores the compressed data of the picture data to be compressed, if it is saved.
- the response unit 504 obtains the saved compressed data of the image data to be compressed from the compressed data storage module 505, avoids repeated compression work, and effectively saves system resources. If not, the The second compression unit 506 acquires the compressed data of the picture data to be compressed by using a compression algorithm, and the compressed data storage module 505 The compressed data compressed by the second compression unit 506 is saved to improve and update the compressed data storage module 505, so that the compressed data of the picture data is not required to be compressed again.
- the classification unit 507 may further determine whether the picture data to be compressed satisfies the condition of the compression acceleration, and if the condition of the compression acceleration is met, the picture data belongs to Compressing the picture data with a large resource consumption, the compressed data storage module 505 saves the compressed data compressed by the second compression unit 506, so that when the compressed data of the picture data is needed next time, the compressed data is not consumed.
- the system resource is used to repeat the compressed image data. If the compression acceleration condition is not met, it indicates that the image data does not belong to the image data with large compression consumption resources.
- the compression algorithm may directly acquire the image data.
- the compressed data of the picture data not only makes reasonable use of system resources, but also saves the storage space of the system.
- the data compression apparatus 600 may include: a receiving unit 601, a determining unit 602, an obtaining unit 603, a response unit 604, a compressed data storage module 605, and a The second compression unit 606, the classification unit 607, and the first compression unit 608, wherein the compressed data storage module 605 can also be disposed outside the data compression device 600.
- the compressed data storage module 605 is configured to save a compressed data set of the picture data, where the compressed data set uses the feature identifier of the picture data as an index to store compressed data of different picture data, so that the data compression apparatus 600 can be based on the picture.
- the feature identifier of the data is obtained, and the compressed data corresponding to the feature identifier of the saved image data is obtained from the compressed data storage module 605.
- the receiving unit 601 is configured to receive a data compression request, and obtain image data to be compressed according to the data compression request. Preferably, the receiving unit 601 may directly acquire image data to be compressed carried in the data compression request.
- the image data to be compressed is obtained by querying the relevant module according to the indication in the data compression request, where the data compression request indicates that the image data to be compressed is compressed.
- the classifying unit 607 is configured to be used after the receiving unit 601 receives the data compression request. Determining whether the picture data to be compressed satisfies a condition of compression acceleration;
- the classifying unit 607 may determine a size of a system resource consumed by compressing the picture data, and compare the system resource consumed by the compressed picture data with a preset first threshold, and if yes, determine Determining whether the compressed picture data satisfies the condition of the compression acceleration; or determining whether the attribute value of the picture data to be compressed exceeds a second threshold, and if yes, determining that the picture data to be compressed satisfies a condition of compression acceleration,
- the attribute value includes any one of the following factors or any combination thereof: the size, the length and the width of the picture data, or the bit depth.
- determining whether the attribute value of the picture data to be compressed exceeds a second threshold may be determining the Whether the size, the length and the width, or the bit depth of the picture data to be compressed exceeds the second threshold, or may determine whether the size, the length and the width, and the bit depth of the picture data to be compressed exceed the second threshold or two of Whether the parameter value exceeds the second threshold, and if so, determining that the picture data to be compressed satisfies compression acceleration
- the image data to be compressed belongs to the image data with a large compression consumption resource, wherein the attribute value of the image data to be compressed may be acquired from the application module, and the second threshold belongs to an empirical value.
- the second threshold may be a value or a set of multiple values; or
- Determining whether the complexity of the picture data to be compressed exceeds a third threshold If yes, determining that the picture data to be compressed satisfies a condition of compression acceleration, specifically, determining the complexity of the picture data to be compressed. Whether the number of colors of the pixels of the picture data to be compressed exceeds the third threshold, and if yes, determining that the picture data to be compressed satisfies the condition of compression acceleration, the to-be-compressed.
- the picture data belongs to the picture data with higher complexity, and compressing the picture data will consume a larger system resource, and the number of colors of the pixels of the picture to be compressed may be obtained from the application module, or may be the data compression.
- the module obtains by using the image data to be compressed by an algorithm, and the third threshold belongs to an empirical value.
- the determining unit 602 is configured to determine a feature identifier of the picture data to be compressed, and determine the feature identifier according to the feature identifier, when the classification unit 607 determines that the picture data to be compressed satisfies a condition of compression acceleration.
- the compressed data storage module 605 stores the feature identifier corresponding to The compressed data, wherein the feature identifier is used to represent the image data to be compressed, and the image data having the same feature identifier has the same compressed data
- the determining unit 602 determines that the feature identifier of the image data to be compressed is also
- the determining unit 602 may obtain the feature identifier of the picture data to be compressed from the application module.
- the determining unit 602 may further obtain a feature identifier of the image data to be compressed, where the feature identifier may be an image feature code, and the specific expression may be a character sequence or a digital sequence.
- the obtaining unit 603 is configured to acquire, according to the feature identifier, the saved data stored in the compressed data storage module 605, when the determining unit determines that the compressed data storage module saves the compressed data corresponding to the feature identifier.
- the feature identifiers correspond to the compressed data. Since the image data with the same feature identifier has the same compressed data, the acquired compressed data corresponding to the feature identifier may be used as the compressed data of the image data to be compressed.
- the response unit 604 is configured to return a data compression response carrying the compressed data corresponding to the feature identifier acquired from the acquiring unit 603.
- the second compression unit 606 is configured to compress the image data to be compressed by using a compression algorithm when the determining unit 602 determines that the compressed data storage module 605 does not save the compressed data corresponding to the feature code.
- the compression data of the picture data to be compressed is obtained, where the compression algorithm may be a lossy compression algorithm or a lossless compression algorithm, which is not limited herein.
- the compressed data storage module 605 is further configured to save the compressed data that is compressed by the second compression unit 606 by using a compression algorithm, so that the next time the system needs to compress the image data to be compressed, the compressed data may be directly Obtaining in the storage module 605, the repeated compression is not required.
- the compressed compressed data may be associated with the feature identifier of the image data to be compressed, and then saved, so that the feature identifier is saved. The compressed data can be queried.
- the response unit 604 is further configured to return to carry the second compression unit 606 to adopt a compression algorithm.
- the data compression response of the compressed data obtained by compression.
- the compression data of the compressed picture data wherein the compression algorithm may be a lossy compression algorithm or a lossless compression algorithm, which is not limited herein.
- the response unit 604 is further configured to return a data compression response that carries the compressed data compressed by the first compression unit 608 by using a compression algorithm.
- the determining unit 602 determines whether the compressed data storage module 605 stores the compressed data of the picture data to be compressed, if the saved data is saved.
- the response unit 604 obtains the saved compressed data of the image data to be compressed from the compressed data storage module 605, avoiding repeated compression work, and effectively saving system resources. If not, the first
- the second compression unit 606 acquires the compressed data of the picture data to be compressed by using a compression algorithm, and the compressed data storage module 605 saves the compressed data compressed by the second compression unit 606 to improve and update the The data storage module 605 is compressed so that when the compressed data of the picture data is needed next time, the picture data is not repeatedly compressed.
- the classification unit 607 is further configured to determine whether the picture data to be compressed satisfies the condition of compression acceleration, if the compression acceleration is satisfied.
- the data compression device 600 accelerates the process of acquiring the compressed data of the picture data to be compressed, that is, when the determining unit 602 determines the compressed data corresponding to the feature identifier of the picture data to be compressed.
- the obtaining unit 603 directly obtains the compressed data corresponding to the saved feature identifier from the compressed data storage module 605, thereby avoiding compression of the image data with large compression cost resources, and compressing the image data.
- the data acquisition process is accelerated, further saving system resources and improving data compression efficiency.
- Figure 7 is a data compression system 700 according to an embodiment of the present invention.
- the system may include:
- the data compression device 701 is configured to receive a data compression request, where the data compression request is used to compress the picture data to be compressed, and determine a feature identifier of the picture data to be compressed, where the feature identifier is used to represent the to-be-represented
- the compressed picture data the same picture data of the feature identifier has the same compressed data, and the compressed data corresponding to the feature identifier saved by the compressed data storage module is obtained according to the feature identifier of the picture data to be compressed, and the data is returned.
- a compressed response the data compression response carrying the compressed data corresponding to the feature identifier acquired from the compressed data storage module 702;
- the compressed data storage module 702 is configured to save a compressed data set of the picture data, and the compressed data set uses the feature identifier as an index to store compressed data of different picture data.
- FIG. 8 is a schematic structural diagram of a computer according to an embodiment of the present invention.
- the computer 800 of an embodiment of the present invention may include:
- the processor 801, the memory 802, and the communication interface 805 are connected by the system bus 804 and communicate with each other.
- Processor 801 may be a single core or multi-core central processing unit, or a particular integrated circuit, or one or more integrated circuits configured to implement embodiments of the present invention.
- the memory 802 can be a high speed RAM memory or a non-volatile memory, such as at least one disk memory.
- Memory 802 is used by computer to execute instructions 803. Specifically, the program code may be included in the computer execution instruction 703.
- the processor 801 runs the computer execution instruction 803, and can perform the following method flow:
- the method flow specifically includes: 101: Receive a data compression request, where the data compression request indicates compression of the picture data to be compressed.
- 102 Determine a feature identifier of the picture data to be compressed, where the feature identifier is used to represent the picture data to be compressed, and the picture data with the same feature identifier has the same compressed data.
- 103 Acquire, according to the feature identifier of the picture data to be compressed, the compressed data corresponding to the feature identifier saved by the compressed data storage module.
- the method flow may further include: 201: Establishing a compressed data storage module, where the compressed data storage module is configured to save a compressed data set of the picture data.
- step 205 is performed, otherwise step 206 is performed.
- step 208 Acquire compressed data corresponding to the feature identifier saved by the compressed data storage module, and then perform step 208.
- step 206 Compress the image data to be compressed by using a compression algorithm to obtain corresponding compressed data, and then perform step 207.
- the compressed data obtained by the compression is saved in the compressed data storage module.
- the following steps may be further performed:
- step 207 ′ determining whether the picture data to be compressed satisfies the condition of compression acceleration, and if the condition of the compression acceleration is met, performing step 207, otherwise performing step 208.
- the method process may specifically include: 301: Establish a compressed data storage module, where the compressed data storage module is configured to save a compressed data set of the picture data.
- step 303 Determine whether the picture data to be compressed satisfies the condition of compression acceleration. If the condition of the compression acceleration is met, go to step 304, otherwise go to step 309.
- step 305 Determine whether the compressed data storage module saves the compressed data corresponding to the feature identifier. If it is determined that the compressed data storage module saves the compressed data corresponding to the feature identifier, go to step 306, otherwise go to step 307. .
- step 307 Compress the image data to be compressed by using a compression algorithm to obtain corresponding compressed data, and then perform step 308.
- step 308 Save the compressed compressed data in the compressed data storage module, and then perform step 310.
- step 309 Compress the image data to be compressed by using a compression algorithm to obtain corresponding compressed data, and then perform step 310.
- aspects of the present invention, or possible implementations of various aspects may be embodied as a system, method, or computer program product.
- aspects of the invention, or possible implementations of various aspects may be in the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, etc.), or a combination of software and hardware aspects, They are collectively referred to herein as "circuits,""modules," or “systems.”
- aspects of the invention, Or a possible implementation of various aspects may take the form of a computer program product, which is a computer readable program code stored in a computer readable medium.
- the computer readable medium can be a computer readable signal medium or a computer readable storage medium.
- the computer readable storage medium includes, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing, such as random access memory (RAM), read only memory (ROM), Erase programmable read-only memory (EPROM or flash memory), optical fiber, portable read-only memory (CD-ROM).
- the processor in the computer reads the computer readable program code stored in the computer readable medium, such that the processor can perform the functional actions specified in each step or combination of steps in the flowchart; A device that functions as specified in each block, or combination of blocks.
- the computer readable program code can execute entirely on the user's computer, partly on the user's computer, as a separate software package, partly on the user's computer and partly on the remote computer, or entirely on the remote computer or server.
- the functions noted in the various steps of the flowchart, or in the blocks in the block diagrams may not occur in the order noted.
- two steps, or two blocks, shown in succession may in fact be executed substantially simultaneously, or the blocks may sometimes be executed in the reverse order.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
本发明实施例涉及一种数据压缩的方法、计算机***和装置,接收数据压缩请求,确定所述待压缩的图片数据的特征标识,根据所述特征标识获取保存的所述特征标识对应的压缩数据,使得不需要采用压缩算法即可获得所述待压缩的图片数据的压缩数据,从而避免了重复压缩的工作,提高了数据压缩效率并节约了***资源。
Description
一种数据压缩的方法、 计算机***和装置 技术领域
本发明实施例涉及计算机技术, 特别是一种数据压缩的方法、 计算机系 统和装置。
背景技术
数据压缩可以降低原始数据的大小, 便于网络传输, 并减少对存储空间 的占用, 广泛应用于众多领域。 现有技术中对数据进行压缩是先通过压缩接 口接收应用程序模块的待压缩数据信息, 然后通过压缩算法实现对待压缩数 据的压缩, 压缩完成后再通过压缩接口将压缩后的数据返回给应用程序模 块。
现有技术是对应用程序模块产生的数据进行直接压缩。 然而, 在有些应 用场景下, 应用程序模块会产生大量需要进行压缩的数据。 例如, 在虚拟桌 面基础架构 (Virtual Desktop Infrastructure, VDI )场景下, 多个虚拟机同时 产生数据压缩需求, 导致服务器有大量数据需要压缩, 此时*** CPU的利用 率非常高, 在***中产生了数据压缩的瓶颈, 导致数据处理效率不高, 同时 ***资源消耗也较大。
发明内容
本发明实施例提出了一种数据压缩的方法、 计算机***和装置, 以提高 数据压缩效率。
第一方面, 本发明实施例提出了一种数据压缩的方法, 所述方法包括: 接收数据压缩请求, 所述数据压缩请求指示对待压缩的图片数据进行压 缩;
确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用于代表 所述待压缩的图片数据, 特征标识相同的图片数据具有相同的压缩数据; 根据所述待压缩的图片数据的特征标识,获取压缩数据存管模块保存的 所述特征标识对应的压缩数据;
返回数据压缩响应, 所述数据压缩响应携带从所述压缩数据存管模块获 取的所述特征标识对应的压缩数据。
结合第一方面, 在第一种可能的实现方式中, 所述确定所述待压缩的图 片数据的特征标识包括: 计算所述待压缩的图片数据的特征标识, 所述特征 标识包括循环冗余码或者海明码。
结合第一方面, 在第二种可能的实现方式中, 所述方法还包括: 确定所 述待压缩的图片数据是否满足压缩加速的条件,如果满足所述压缩加速的条 件, 则执行所述根据所述待压缩的图片数据的特征标识, 获取压缩数据存管 模块保存的所述特征标识对应的压缩数据的步骤。
结合第一方面的第二种可能的实现方式, 在第三种可能的实现方式中, 所述确定所述待压缩的图片数据是否满足压缩加速的条件, 包括:
确定对所述待压缩的图片数据进行压缩所耗费的资源是否超过第一阈 值, 如果是, 确定所述待压缩的图片数据满足压缩加速的条件; 或者, 确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意 之一或其任意组合: 图片数据的大小、 长宽或位深; 或者,
确定所述待压缩的图片数据的复杂度是否超过第三阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件。
结合第一方面的任一种可能的实现方式, 在第四种可能的实现方式中, 所述方法还包括: 建立所述压缩数据存管模块, 其中, 所述压缩数据存管模 块用于保存图片数据的压缩数据集合, 所述压缩数据集合通过所述特征标识 作为索引来保存不同图片数据的压缩数据。
结合第一方面的第四种可能的实现方式, 在第五种可能的实现方式中, 所述根据所述待压缩的图片数据的特征标识,获取压缩数据存管模块保存的 所述特征标识对应的压缩数据之前, 还包括: 确定所述压缩数据存管模块是 否保存所述特征标识对应的压缩数据, 如果是, 则执行所述根据所述待压缩
的图片数据的特征标识, 获取压缩数据存管模块保存的所述特征标识对应的 压缩数据的步骤。
第二方面, 本发明实施例提出了一种数据压缩的装置, 所述装置包括: 接收单元, 用于接收数据压缩请求, 所述数据压缩请求指示对待压缩的 图片数据进行压缩;
确定单元, 用于确定所述待压缩的图片数据的特征标识, 其中, 所述特 征标识用于代表所述待压缩的图片数据,特征标识相同的图片数据具有相同 的压缩数据;
获取单元, 用于根据所述确定单元确定的所述待压缩的图片数据的特征 标识, 获取压缩数据存管模块保存的所述特征标识对应的压缩数据;
响应单元, 用于返回数据压缩响应, 所述数据压缩响应携带从所述压缩 数据存管模块获取的所述特征标识对应的压缩数据。
结合第二方面, 在第一种可能的实现方式中, 所述确定单元具体用于: 计算所述待压缩的图片数据的特征标识, 所述特征标识包括循环冗余码或者 海明码。
结合第二方面, 在第二种可能的实现方式中, 所述装置还包括: 分类单元, 用于确定所述待压缩的图片数据是否满足压缩加速的条件; 在所述分类单元确定所述待压缩的图片数据满足所述压缩加速的条件时, 所 述获取单元具体用于根据所述待压缩的图片数据的特征标识, 获取所述压缩 数据存管模块保存的所述特征标识对应的压缩数据。
结合第二方面的第二种可能的实现方式, 在第三种可能的实现方式中, 所述分类单元具体用于:
确定对所述待压缩的图片数据进行压缩所耗费的资源是否超过第一阈 值, 如果是, 确定所述待压缩的图片数据满足压缩加速的条件; 或者, 确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意
之一或其任意组合: 图片数据的大小、 长宽或位深; 或者,
确定所述待压缩的图片数据的复杂度是否超过第三阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件。
结合第二方面的任一种可能的实现方式, 在第四种可能的实现方式中, 所述压缩数据存管模块设置于所述数据压缩的装置内部或者外部, 用于保存 图片数据的压缩数据集合, 所述压缩数据集合通过所述特征标识作为索引来 保存不同图片数据的压缩数据。
结合第二方面的第四种可能的实现方式, 在第五种可能的实现方式中, 所述确定单元还用于: 确定所述压缩数据存管模块是否保存所述特征标识对 应的压缩数据; 所述获取单元具体用于在所述确定单元确定所述压缩数据存 管模块保存有所述特征标识对应的压缩数据时,根据所述待压缩的图片数据 的特征标识, 获取所述压缩数据存管模块保存的所述特征标识对应的压缩数 据。
第三方面, 本发明实施例提出了一种数据压缩***, 所述***包括: 数 据压缩装置, 用于接收数据压缩请求, 所述数据压缩请求指示对待压缩的图 片数据进行压缩, 确定所述待压缩的图片数据的特征标识, 其中, 所述特征 标识用于代表所述待压缩的图片数据,特征标识相同的图片数据具有相同的 压缩数据, 根据所述待压缩的图片数据的特征标识, 获取压缩数据存管模块 保存的所述特征标识对应的压缩数据, 返回数据压缩响应, 所述数据压缩响 应携带从所述压缩数据存管模块获取的所述特征标识对应的压缩数据; 所述 压缩数据存管模块, 用于保存图片数据的压缩数据集合, 所述压缩数据集合 通过所述特征标识作为索引来保存不同图片数据的压缩数据。
在本发明实施例中, 由于能够在接收到数据压缩请求之后, 确定所述待 压缩的图片数据的特征标识, 并根据所述待压缩的图片数据的特征标识, 获 取压缩数据存管模块保存的所述特征标识对应的压缩数据, 无需调用压缩算 法对所述待压缩的图片数据进行压缩, 就可获得所述待压缩的图片数据的压
缩数据, 从而避免了数据的重复压缩工作, 提高了数据压缩效率, 有效节约 了***资源。 图片数据的压缩数据图片数据的压缩数据图片数据的压缩数 据。 附图说明
为了更清楚地说明本发明实施例的技术方案, 下面将对现有技术或实施 例中所需要使用的附图作筒单地介绍, 显而易见地, 下面描述中的附图仅仅 是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳 动的前提下, 还可以根据这些附图获得其他的附图。
图 1是根据本发明实施例提供的一种方法流程图;
图 2是根据本发明实施例提供的又一种方法流程图;
图 3是根据本发明实施例提供的又一种方法流程图;
图 4是根据本发明实施例提供的一种数据压缩装置的组成图; 图 5是根据本发明实施例提供的又一种数据压缩装置的组成图; 图 6是根据本发明实施例提供的又一种数据压缩装置的组成图; 图 7是根据本发明实施例提供的一种数据压缩***的组成图; 图 8是根据本发明实施例提供的一种计算机的组成图。
具体实施方式
本发明实施例提出了一种数据压缩的方法、 计算机***和装置, 当有数 据需要压缩时, 直接获取保存的压缩数据, 可以避免重复压缩工作, 提高数 据处理效率并降低处理器的资源消耗。
下面对数据压缩方法的实施例进行介绍, 如图 1所示, 为本发明实施例 提供的数据压缩方法的流程, 包括:
101 : 接收数据压缩请求, 所述数据压缩请求指示对待压缩的图片数据 进行压缩。
例如, 数据压缩模块从操作***获取应用程序模块触发的数据压缩请
求; 或者, 数据压缩模块接收到数据压缩请求, 根据所述数据压缩请求获取 所述待压缩的图片数据。
优选地, 所述待压缩的图片数据可以为一帧图片数据或者多帧图片数 据。
102: 确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用 于代表所述待压缩的图片数据,特征标识相同的图片数据具有相同的压缩数 据。
所述确定所述待压缩的图片数据的特征标识, 可以是数据压缩模块从所 述应用程序模块或者操作***获取所述待压缩的图片数据的特征标识,也可 以是数据压缩模块通过计算获取所述待压缩的图片数据的特征标识。
优选地, 所述待压缩的图片数据的特征标识可以包括所述待压缩的图片 数据所包含的每帧图片数据的特征标识, 所述每帧图片数据的特征标识可以 用于代表所述每帧图片数据, 特征标识相同的图片数据具有相同的压缩数 据。 例如, 所述每帧图片数据的特征标识可以为所述每帧图片数据的图像特 征码。
103: 根据所述待压缩的图片数据的特征标识, 获取压缩数据存管模块 保存的所述特征标识对应的压缩数据。
具体地, 所述压缩数据存管模块用于保存压缩数据集合, 即用于保存采 用压缩算法对各图片数据进行压缩得到的不同压缩数据, 并同时保存各压缩 数据与其对应的特征标识的对应关系。 由于特征标识相同的图片数据具有相 同的压缩数据, 因此可以根据所述待压缩的图片数据的特征标识获取所述压 缩数据存管模块保存的压缩数据, 并将所获取的压缩数据作为所述待压缩的 图片数据的压缩数据。
104: 返回数据压缩响应, 所述数据压缩响应携带所获取的所述特征标 识对应的压缩数据。
在本发明实施例中, 在接收到数据压缩请求之后, 确定所述待压缩的图
片数据的特征标识, 根据所述待压缩的图片数据的特征标识, 获取所述压缩 数据存管模块保存的所述特征标识对应的压缩数据, 并将所获取的压缩数据 携带在数据压缩响应中返回, 避免了进行重复的压缩工作, 提高了数据压缩 效率, 有效节约了***资源。
在本发明的又一实施例中, 如图 2所示, 该方法可以具体包括:
201 : 建立压缩数据存管模块, 所述压缩数据存管模块用于保存图片数 据的压缩数据集合。
在数据压缩模块接收数据压缩请求之前,所述方法还包括建立压缩数据 存管模块, 所述压缩数据存管模块用于保存图片数据的压缩数据集合, 所述 压缩数据集合通过图片数据的特征标识作为索引来保存不同图片数据的压 缩数据, 因此所述数据压缩模块可以根据图片数据的特征标识, 从所述压缩 数据存管模块中获取保存的该图片数据的特征标识对应的压缩数据, 所述压 缩数据存管模块可以设置于所述数据压缩装置内部或外部。
上述步骤 201为可选步骤, 在其他的实施例中, 可以选用现有的存储模 块来保存压缩数据集合, 并非需要执行本步骤来建立压缩数据存管模块。
202: 接收数据压缩请求, 根据所述数据压缩请求获取待压缩的图片数 据。
用户在访问应用程序模块时产生了压缩图片数据的需求, 所述应用程序 模块触发操作***进行处理,操作***指示数据压缩模块对所述待压缩的图 片数据进行压缩, 所述数据压缩模块接收到数据压缩请求后, 可以直接获取 所述数据压缩请求中携带的待压缩的图片数据,也可以根据所述数据压缩请 求中的指示查询相关模块, 获取所述待压缩的图片数据。
203: 确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用 于代表图片数据, 特征标识相同的图片数据具有相同的压缩数据。
优选地, 如果所述待压缩的图片数据为一帧图片数据, 则确定所述一帧 图片数据的特征标识, 如果所述待压缩的图片数据为多帧图片数据, 则确定
所述每帧图片数据的特征标识。
所述确定所述待压缩的图片数据的特征标识, 可以是数据压缩模块从所 述应用程序模块获取所述待压缩的图片数据的特征标识,也可以是数据压缩 模块通过计算确定所述待压缩的图片数据的特征标识, 所述特征标识可以是 图像特征码, 具体表现形式可以是字符序列或数字序列, 例如可以是循环冗 余码(Cyclic Redundancy Code, CRC ), 海明码, 但不仅限于此。
所述数据压缩模块计算所述待压缩的图片数据的特征标识可以是采用 不同的算法对所述待压缩的图片数据进行计算得到, 例如可以将所述图片数 据视为二进制数, 参照 CRC32的计算方式获取所述图片数据的特征标识, 其中, 所述 CRC还可以包括 CRC8、 CRC12、 CRC16、 CRC32、 CRC32c等。
204: 确定所述压缩数据存管模块是否保存有所述特征标识对应的压缩 数据, 如果确定所述压缩数据存管模块保存有所述特征标识对应的压缩数 据, 执行步骤 205, 否则执行步骤 206。
具体地, 由于所述压缩数据存管模块用于保存压缩数据集合, 即可以用 于保存采用压缩算法对各图片数据进行压缩得到的不同压缩数据, 并同时保 存各压缩数据与其对应的特征标识的对应关系, 因此所述数据压缩模块可以 根据所述待压缩的图片数据的特征标识,确定所述压缩数据存管模块是否保 存有所述特征标识对应的压缩数据, 即是否保存有所述待压缩的图片数据的 压缩数据。
205: 获取所述压缩数据存管模块保存的所述特征标识对应的压缩数据, 然后执行步骤 208。
由于特征标识相同的图片数据具有相同的压缩数据, 因此可以根据所述 待压缩的图片数据的特征标识,获取所述压缩数据存管模块保存的所述特征 标识对应的压缩数据, 并将所获取的压缩数据作为所述待压缩的图片数据的 压缩数据。
206: 采用压缩算法对所述待压缩的图片数据进行压缩, 得到对应的压
缩数据, 然后执行步骤 207。
如果确定所述压缩数据存管模块没有保存所述特征标识对应的压缩数 据, 所述数据压缩模块采用压缩算法对所述待压缩的图片数据进行压缩, 得 到所述待压缩的图片数据的压缩数据, 然后执行步骤 207。
其中, 所述压缩算法可以是有损压缩算法, 还可以是无损压缩算法, 本 发明实施例在此不作限定。
207: 将所述经过压缩得到的压缩数据在所述压缩数据存管模块中进行 保存。
将所述压缩得到的压缩数据保存在所述压缩数据存管模块中,使得*** 下次需要压缩所述待压缩的图片数据时, 可以直接从所述压缩数据存管模块 中获取, 无需进行重复的压缩。
具体地, 可以将所述经过压缩得到的压缩数据与所述待压缩的图片数据 的特征标识进行关联后再进行保存,使得通过所述特征标识能够查询到所述 压缩数据; 优选地, 在执行所述步骤 207的保存动作之前, 还可以进一步执 行如下步骤:
207' : 确定所述待压缩的图片数据是否满足压缩加速的条件, 如果满 足所述压缩加速的条件, 执行步骤 207, 否则执行步骤 208。
具体地, 数据压缩模块在使用压缩算法压缩所述待压缩的图片数据之 后, 可以进一步确定所述待压缩的图片数据是否满足压缩加速的条件, 如果 满足所述压缩加速的条件, 则可以执行步骤 207, 如果不满足所述压缩加速 的条件, 则可以执行步骤 208。
确定所述待压缩的图片数据是否满足压缩加速的条件,具体可以采用如 下方式:
确定压缩该图片数据所消耗的***资源的大小, 并将所述压缩该图片数 据所消耗的***资源与预设的第一阈值进行比较, 如果超过所述第一阈值, 说明该图片数据属于压缩消耗资源较大的图片数据, 则可以执行步骤 207,
即将所述待压缩的图片数据的压缩数据在所述压缩数据存管模块中进行保 存, 如果没有超过所述第一阈值, 说明该图片数据属于压缩消耗资源较小的 图片数据, 可以不保存所述待压缩的图片数据的压缩数据, 直接执行步骤
207, 其中所述第一阈值属于经验值; 或者,
确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意 之一或其任意组合: 图片数据的大小、 长宽或位深, 具体地, 所述确定所述 待压缩的图片数据的属性值是否超过第二阈值可以是确定所述待压缩的图 片数据的大小或长宽或位深是否超过所述第二阈值,还可以是确定所述待压 缩的图片数据的大小、长宽和位深是否超过所述第二阈值或者其中两个参数 值是否超过所述第二阈值, 如果是, 确定所述待压缩的图片数据满足压缩加 速的条件,所述待压缩的图片数据属于压缩消耗资源较大的图片数据,其中, 所述待压缩的图片数据的属性值可以从所述应用程序模块获取, 所述第二阈 值属于经验值, 所述第二阈值可以是一个数值, 也可以是多个数值组成的集 合; 或者,
确定所述待压缩的图片数据的复杂度是否超过第三阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 具体地, 所述确定所述待压缩 的图片数据的复杂度是否超过第三阈值可以是确定所述待压缩的图片数据 的像素的颜色数量是否超过所述第三阈值, 如果是, 确定所述待压缩的图片 数据满足压缩加速的条件, 所述待压缩的图片数据属于复杂度较高的图片数 据, 压缩该图片数据将消耗较大的***资源, 所述待压缩的图片的像素的颜 色数量可以从所述应用程序模块获取,也可以是所述数据压缩模块利用所述 待压缩的图片数据通过算法获得, 所述第三阈值属于经验值。
208: 返回数据压缩响应, 所述数据压缩响应携带所述待压缩的图片数 据的压缩数据。
数据压缩模块返回数据压缩响应给所述应用程序模块,使得所述应用程
序模块对应的客户端可以获取所述待压缩的图片数据的压缩数据, 并可以根 据所述压缩数据进行图片显示。
具体地, 当确定所述压缩数据存管模块保存有所述待压缩的图片数据的 特征标识对应的压缩数据时, 所述数据压缩模块将获取的所述特征标识对应 的压缩数据携带在数据压缩响应中返回, 当确定所述压缩数据存管模块没有 保存所述待压缩的图片数据的特征标识对应的压缩数据时, 所述数据压缩模 块将采用压缩算法压缩得到的压缩数据携带在数据压缩响应中返回。
在本发明实施例中, 在数据压缩模块接收到数据压缩请求之后, 可以先 确定所述压缩数据存管模块是否保存有所述待压缩的图片数据的压缩数据, 如果保存有, 则从所述压缩数据存管模块中获取保存的所述待压缩的图片数 据的压缩数据, 避免重复的压缩工作, 有效节约***资源, 如果没有保存, 则用压缩算法获取所述待压缩的图片数据的压缩数据, 并将该图片数据的压 缩数据在所述压缩数据存管模块中进行保存, 用以完善和更新所述压缩数据 存管模块, 使得下次需要该图片数据的压缩数据时, 不再重复压缩该图片数 据。
优选地, 在数据压缩完成后, 可以进一步确定所述待压缩的图片数据是 否满足压缩加速的条件, 如果满足压缩加速的条件, 说明该图片数据属于压 缩消耗资源较大的图片数据, 将该图片数据的压缩数据进行保存, 使得下次 需要该图片数据的压缩数据时, 不用消耗较大的***资源去重复该压缩图片 数据, 如果不满足压缩加速的条件, 说明该图片数据不属于压缩消耗资源较 大的图片数据, 可以采用压缩算法直接获取该图片数据的压缩数据, 既合理 利用了***资源, 又节约了***的存储空间。 据
在本发明的又一实施例中, 如图 3所示, 该方法可以具体包括:
301 : 建立压缩数据存管模块, 所述压缩数据存管模块用于保存图片数 据的压缩数据集合。
在数据压缩模块接收数据压缩请求之前,所述方法还包括建立压缩数据
存管模块, 所述压缩数据存管模块用于保存图片数据的压缩数据集合, 所述 压缩数据集合通过图片数据的特征标识作为索引来保存不同图片数据的压 缩数据, 因此所述数据压缩模块可以根据图片数据的特征标识, 从所述压缩 数据存管模块中获取保存的该图片数据的特征标识对应的压缩数据, 所述压 缩数据存管模块可以设置于所述数据压缩装置内部或外部。
302: 接收数据压缩请求, 根据所述数据压缩请求获取待压缩的图片数 据。
用户在访问应用程序模块时产生了压缩图片数据的需求, 所述应用程序 模块触发操作***进行处理,操作***指示数据压缩模块对所述待压缩的图 片数据进行压缩, 所述数据压缩模块接收到数据压缩请求后, 可以直接获取 所述数据压缩请求中携带的待压缩的图片数据,也可以根据所述数据压缩请 求中的指示查询相关模块, 获取所述待压缩的图片数据。
303: 确定所述待压缩的图片数据是否满足压缩加速的条件, 如果满足 压缩加速的条件, 执行步骤 304, 否则执行步骤 309。
数据压缩模块接收所述数据压缩请求之后, 可以进一步确定所述待压缩 的图片数据是否满足压缩加速的条件, 如果满足压缩加速的条件, 表示该图 片数据属于压缩耗费资源较大的图片数据, ***可能已经保存了该图片数据 的压缩数据,可以直接执行步骤 304至 306对该图片数据的压缩数据的获取 过程进行加速, 即在需要压缩的时候, ***直接获取预先保存的所述待压缩 的图片数据的压缩数据, 从而有效节约***资源, 提高数据压缩的效率。
所述确定所述待压缩的图片数据是否满足压缩加速的条件, 具体可以采 用如下方式:
确定对所述待压缩的图片数据进行压缩所耗费的资源是否超过第一阈 值, 如果是, 确定所述待压缩的图片数据满足压缩加速的条件; 或者, 确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意
之一或其任意组合: 图片数据的大小、 长宽或位深, 具体地, 所述确定所述 待压缩的图片数据的属性值是否超过第二阈值可以是确定所述待压缩的图 片数据的大小或长宽或位深是否超过所述第二阈值,还可以是确定所述待压 缩的图片数据的大小、长宽和位深是否超过所述第二阈值或者其中两个参数 值是否超过所述第二阈值, 如果是, 确定所述待压缩的图片数据满足压缩加 速的条件,所述待压缩的图片数据属于压缩消耗资源较大的图片数据,其中, 所述待压缩的图片数据的属性值可以从所述应用程序模块获取, 所述第二阈 值属于经验值, 所述第二阈值可以是一个数值, 也可以是多个数值组成的集 合; 或者,
确定所述待压缩的图片数据的复杂度是否超过第三阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 具体地, 所述确定所述待压缩 的图片数据的复杂度是否超过第三阈值可以是确定所述待压缩的图片数据 的像素的颜色数量是否超过所述第三阈值, 如果是, 确定所述待压缩的图片 数据满足压缩加速的条件, 所述待压缩的图片数据属于复杂度较高的图片数 据, 压缩该图片数据将消耗较大的***资源, 所述待压缩的图片的像素的颜 色数量可以从所述应用程序模块获取,也可以是所述数据压缩模块利用所述 待压缩的图片数据通过算法获得, 所述第三阈值属于经验值。。
304: 确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用 于代表图片数据, 特征标识相同的图片数据具有相同的压缩数据。
数据压缩模块在接收到数据压缩请求之后,确定所述待压缩的图片数据 的特征标识, 所述确定所述待压缩的图片数据的特征标识可以在步骤 302之 后执行, 还可以在步骤 302之前执行, 本发明实施例在此不作限定。
所述确定所述待压缩的图片数据的特征标识, 可以是从所述应用程序模 块获取所述待压缩的图片数据的特征标识,也可以是数据压缩模块通过计算 获取所述待压缩的图片数据的特征标识, 所述特征标识可以是图像特征码, 具体表现形式可以是字符序列或数字序列, 例如可以是循环冗余码 ( Cyclic
Redundancy Code, CRC ), 海明码, 但不仅限于此, 所述数据压缩模块计算 所述待压缩的图片数据的特征标识可以是采用不同的算法对所述待压缩的 图片数据进行计算得到, 例如可以将所述图片数据视为二进制数, 参照 CRC32的计算方式确定所述图片数据的特征标识, 其中, 所述 CRC还可以 包括 CRC8、 CRC12、 CRC16、 CRC32、 CRC32c等。
优选地, 如果所述待压缩的图片数据为一帧图片数据, 则确定所述一帧 图片数据的特征标识, 如果所述待压缩的图片数据为多帧图片数据, 则确定 所述每帧图片数据的特征标识。
305: 确定所述压缩数据存管模块是否保存有所述特征标识对应的压缩 数据, 如果确定所述压缩数据存管模块保存有所述特征标识对应的压缩数 据, 执行步骤 306, 否则执行步骤 307。
具体地, 由于所述压缩数据存管模块用于保存压缩数据集合, 即可以用 于保存采用压缩算法对各图片数据进行压缩得到的不同压缩数据, 并同时保 存各压缩数据与其对应的特征标识的对应关系, 因此所述数据压缩模块可以 根据所述待压缩的图片数据的特征标识,确定所述压缩数据存管模块是否保 存有所述特征标识对应的压缩数据, 即是否保存有所述待压缩的图片数据的 压缩数据。 图片数据的压缩数据
306: 获取从所述压缩数据存管模块中保存的所述特征标识对应的压缩 数据, 然后执行步骤 309。
数据压缩模块如果确定保存有所述特征标识对应的压缩数据, 则从所述 压缩数据存管模块中获取保存的所述特征标识对应的压缩数据, 由于特征标 识相同的图片数据具有相同的压缩数据, 因此可以将所获取的压缩数据作为 所述待压缩的图片数据的压缩数据, 避免了重复的压缩工作。
307: 采用压缩算法对所述待压缩的图片数据进行压缩, 得到对应的压 缩数据, 然后执行步骤 308。
如果确定所述压缩数据存管模块没有保存所述特征标识对应的压缩数
据, 则数据压缩模块采用压缩算法对所述待压缩的图片数据进行压缩, 得到 所述待压缩的图片数据的压缩数据, 然后执行步骤 308。
其中, 所述压缩算法可以是有损压缩算法, 还可以是无损压缩算法, 本 发明实施例在此不作限定。
308: 将所述经过压缩得到的压缩数据在所述压缩数据存管模块中进行 保存, 然后执行步骤 310。
将所述压缩得到的压缩数据保存在所述压缩数据存管模块中,使得*** 下次需要压缩所述待压缩的图片数据时, 可以直接从所述压缩数据存管模块 中获取, 无需进行重复的压缩。
具体地, 可以将所述经过压缩得到的压缩数据与所述待压缩的图片数据 的特征标识进行关联后再进行保存,使得通过所述特征标识能够查询到所述 压缩数据;
309: 采用压缩算法对所述待压缩的图片数据进行压缩, 得到对应的压 缩数据, 然后执行步骤 310。
如果确定所述待压缩的图片数据不满足压缩加速的条件,表明所述待压 缩的图片数据属于压缩耗费资源较小的图片数据,数据压缩模块通过压缩算 法直接获取所述待压缩的图片数据的压缩数据, 并在该步骤完成后执行步骤 310。
310: 返回数据压缩响应, 所述数据压缩响应携带所述待压缩的图片数 据的压缩数据。
数据压缩模块返回数据压缩响应给所述应用程序模块,使得所述应用程 序模块对应的客户端可以获取所述待压缩的图片数据的压缩数据, 并可以根 据所述压缩数据进行图片显示。
在本发明实施例中, 所述数据压缩模块接收到数据压缩请求之后, 确定 所述压缩数据存管模块是否保存有所述待压缩的图片数据的压缩数据,如果 保存有, 则从所述压缩数据存管模块中获取保存的所述待压缩的图片数据的
压缩数据, 避免重复的压缩工作, 有效节约***资源, 如果没有保存, 则用 压缩算法获取所述待压缩的图片数据的压缩数据, 并将该图片数据的压缩数 据在所述压缩数据存管模块中进行保存, 用以完善和更新所述压缩数据存管 模块, 使得下次需要该图片数据的压缩数据时, 不再重复压缩该图片数据。
进一步, 在本发明实施例中, 所述数据压缩模块在接收到数据压缩请求 之后, 还包括确定所述待压缩的图片数据是否满足压缩加速的条件, 如果满 足压缩加速的条件, 则对所述待压缩的图片数据的压缩数据的获取过程进行 加速, 即当确定保存有所述待压缩的图片数据的特征标识对应的压缩数据 时, 直接从所述压缩数据存管模块中获取保存的所述特征标识对应的压缩数 据, 避免了对压缩耗费资源较大的图片数据的压缩工作, 使得该图片数据的 压缩数据的获取过程得以被加速, 更进一步的节约了***资源, 提高了数据 压缩效率。本发明实施例的方法可以应用于 VDI场景下,不同客户端对应的 虚拟机可以将不同图片数据的压缩数据保存于同一个压缩数据存管模块中, 所述压缩数据存管模块可以设置在虚拟机或 PC机上, 使得如果多个客户端 需要压缩该第一图片数据时或者第一客户端需要多次压缩该第一图片数据 时, 可以直接从所述压缩数据存管模块中获取该第一图片数据的压缩数据, 避免了重复的压缩工作, 此外, 还可以将待压缩的图片数据的压缩数据保存 于本地应用程序所在的虚拟机的压缩数据存管模块中,使得所述本地应用程 序需要重复压缩所述待压缩的图片数据时, 直接从所述虚拟机的压缩数据存 管模块中获取, 避免了数据的重复压缩工作, 提高了数据压缩的效率, 而且 从本地获取待压缩的图片数据保障了通信的实时性和快速性。
本发明装置实施例
本发明实施例提供的数据压缩装置,应用于计算机***中,如图 4所示, 所述装置 400包括:
接收单元 401 , 用于接收数据压缩请求, 所述数据压缩请求指示对待压 缩的图片数据进行压缩;
确定单元 402, 用于确定所述待压缩的图片数据的特征标识, 其中, 所 述特征标识用于代表所述待压缩的图片数据,特征标识相同的图片数据具有 相同的压缩数据。
获取单元 403 , 用于根据所述待压缩的图片数据的特征标识, 获取压缩 数据存管模块保存的所述特征标识对应的压缩数据。
响应单元 404, 用于返回数据压缩响应, 所述数据压缩响应携带所获取 的所述特征标识对应的压缩数据。
其中, 所述待压缩的图片数据可以根据所述数据压缩请求获取, 所述待 压缩的图片数据可以为一帧图片数据或者多帧图片数据, 所述确定单元 402 确定待压缩的图片数据的特征标识可以是从所述应用程序模块或者操作系 统获取所述待压缩的图片数据的特征标识,也可以是所述确定单元 402通过 计算获取所述待压缩的图片数据的特征标识。
在本发明实施例中, 所述压缩数据存管模块用于保存压缩数据集合, 即 用于保存采用压缩算法对各图片数据进行压缩得到的不同压缩数据, 并同时 保存各压缩数据与其对应的特征标识的对应关系, 所述确定单元 402在所述 接收单元 401接收到数据压缩请求之后,确定所述待压缩的图片数据的特征 标识, 所述获取单元 403根据所述待压缩的图片数据的特征标识, 从所述压 缩数据存管模块中获取保存的所述特征标识对应的压缩数据, 所述响应单元 404返回携带所获取的所述特征标识对应的压缩数据的数据压缩响应, 避免 了数据的重复压缩工作, 提高了数据压缩效率, 有效节约了***资源。
在本发明的又一装置实施例中, 如图 5所示, 所述数据压缩装置 500可 包括: 接收单元 501、 确定单元 502、 获取单元 503、 响应单元 504、 压缩数 据存管模块 505和第二压缩单元 506, 其中, 在另一个实施例中, 所述压缩 数据存管模块 505还可以设置于所述数据压缩装置 500的外部。
所述压缩数据存管模块 505用于保存图片数据的压缩数据集合,所述压 缩数据集合 505通过图片数据的特征标识作为索引来保存不同图片数据的压
缩数据, 使得所述数据压缩装置 500可以根据图片数据的特征标识, 从所述 压缩数据存管模块 505 中获取保存的该图片数据的特征标识对应的压缩数 据。
具体地, 用户在访问应用程序模块时产生了压缩图片数据的需求, 所述 应用程序模块触发操作***进行处理,操作***指示所述数据压缩装置对所 述待压缩的图片数据进行压缩, 所述接收单元 501用于接收数据压缩请求, 并根据所述数据压缩请求获取待压缩的图片数据, 其中, 接收单元 501可以 直接获取所述数据压缩请求中携带的待压缩的图片数据,也可以根据所述数 据压缩请求中的指示查询相关模块, 获取所述待压缩的图片数据, 其中, 所 述数据压缩请求指示对待压缩的图片数据进行压缩。
所述确定单元 502在所述接收单元 501接收数据压缩请求之后, 用于确 定所述待压缩的图片数据的特征标识, 并利用所述特征标识, 确定所述压缩 数据存管模块 505是否保存有所述特征标识对应的压缩数据, 其中, 所述特 征标识用于代表所述待压缩的图片数据,特征标识相同的图片数据具有相同 的压缩数据, 具体地, 所述确定单元 502可以从所述应用程序模块获取所述 待压缩的图片数据的特征标识,还可以是所述确定单元 502通过计算获取所 述待压缩的图片数据的特征标识, 所述特征标识可以是图像特征码, 具体表 现形式可以是字符序列或数字序列, 例如可以是循环冗余码 ( Cyclic Redundancy Code, CRC ) , 海明码, 但不仅限于此。
所述获取单元 503 ,在所述确定单元 502确定所述压缩数据存管模块 505 保存有所述特征标识对应的压缩数据时, 用于根据所述特征标识, 获取所述 压缩数据存管模块 505保存的所述特征标识对应的压缩数据, 由于特征标识 相同的图片数据具有相同的压缩数据, 因此可以将所获取的所述特征标识对 应的压缩数据作为所述待压缩的图片数据的压缩数据。
所述响应单元 504用于返回携带从所述获取单元 503获取的所述特征标 识对应的压缩数据的数据压缩响应。
所述第二压缩单元 506, 在所述确定单元 502确定所述压缩数据存管模 块 505没有保存所述特征代码对应的压缩数据时, 用于采用压缩算法对所述 待压缩的图片数据进行压缩,得到所述待压缩的图片数据的压缩数据,其中, 所述压缩算法可以是有损压缩算法, 还可以是无损压缩算法, 本发明实施例 在此不作限定。
所述压缩数据存管模块 505还用于保存所述第二压缩单元 506采用压缩 算法压缩得到的压缩数据, 使得***下次需要压缩所述待压缩的图片数据 时, 可以直接从所述压缩数据存管模块 505中获取, 无需进行重复的压缩, 具体地,可以将所述经过压缩得到的压缩数据与所述待压缩的图片数据的特 征标识进行关联后再进行保存,使得通过所述特征标识能够查询到所述压缩 数据。
所述响应单元 504还用于返回携带所述第二压缩单元 506采用压缩算法 压缩得到的压缩数据的数据压缩响应。
优选地, 所述装置还可以进一步包括:
分类单元 507, 用于确定所述待压缩的图片数据是否满足压缩加速的条 件; 所述压缩数据存管模块 505在所述待压缩的图片数据满足压缩加速的条 件时, 具体用于触发所属确定单元 502根据所述特征标识, 确定所述压缩数 据存管模块 505是否保存有所述特征标识对应的压缩数据,或者保存所述第 二压缩单元 506采用压缩算法压缩得到的压缩数据;
其中, 在另一优选实施例中, 所述确定所述待压缩的图片数据是否满足 压缩加速的条件, 具体包括:
确定压缩该图片数据所消耗的***资源的大小,并将所述压缩该图片数 据所消耗的***资源与预设的第一阈值进行比较, 如果超过所述第一阈值, 说明该图片数据属于压缩消耗资源较大的图片数据, 可以将所述待压缩的图 片数据的压缩数据在所述压缩数据存管模块中进行保存,如果没有超过所述 第一阈值, 说明该图片数据属于压缩消耗资源较小的图片数据, 可以不保存
所述待压缩的图片数据的压缩数据, 其中所述第一阈值属于经验值; 或者, 确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意 之一或其任意组合: 图片数据的大小、 长宽或位深, 具体地, 所述确定所述 待压缩的图片数据的属性值是否超过第二阈值可以是确定所述待压缩的图 片数据的大小或长宽或位深是否超过所述第二阈值,还可以是确定所述待压 缩的图片数据的大小、长宽和位深是否超过所述第二阈值或者其中两个参数 值是否超过所述第二阈值, 如果是, 确定所述待压缩的图片数据满足压缩加 速的条件,所述待压缩的图片数据属于压缩消耗资源较大的图片数据,其中, 所述待压缩的图片数据的属性值可以从所述应用程序模块获取, 所述第二阈 值属于经验值, 所述第二阈值可以是一个数值, 也可以是多个数值组成的集 合; 或者,
确定所述待压缩的图片数据的复杂度是否超过第三阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 具体地, 所述确定所述待压缩 的图片数据的复杂度是否超过第三阈值可以是确定所述待压缩的图片数据 的像素的颜色数量是否超过所述第三阈值, 如果是, 确定所述待压缩的图片 数据满足压缩加速的条件, 所述待压缩的图片数据属于复杂度较高的图片数 据, 压缩该图片数据将消耗较大的***资源, 所述待压缩的图片的像素的颜 色数量可以从所述应用程序模块获取,也可以是所述数据压缩模块利用所述 待压缩的图片数据通过算法获得, 所述第三阈值属于经验值。
在本发明实施例中, 所述确定单元 502在所述接收单元 501接收到数据 压缩请求之后,确定所述压缩数据存管模块 505是否保存有所述待压缩的图 片数据的压缩数据, 如果保存有, 则所述响应单元 504从所述压缩数据存管 模块 505中获取保存的所述待压缩的图片数据的压缩数据,避免重复的压缩 工作, 有效节约***资源, 如果没有保存, 则所述第二压缩单元 506采用压 缩算法获取所述待压缩的图片数据的压缩数据, 所述压缩数据存管模块 505
将所述第二压缩单元 506压缩得到的压缩数据进行保存, 用以完善和更新所 述压缩数据存管模块 505 , 使得下次需要该图片数据的压缩数据时, 不再重 复压缩该图片数据。
优选地, 在所述第二压缩单元 506完成数据压缩后, 所述分类单元 507 可以进一步确定所述待压缩的图片数据是否满足压缩加速的条件,如果满足 压缩加速的条件, 说明该图片数据属于压缩消耗资源较大的图片数据, 所述 压缩数据存管模块 505将所述第二压缩单元 506压缩得到的压缩数据进行保 存, 使得下次需要该图片数据的压缩数据时, 不用消耗较大的***资源去重 复该压缩图片数据, 如果不满足压缩加速的条件, 说明该图片数据不属于压 缩消耗资源较大的图片数据, 下次需要该图片数据的压缩数据时, 可以采用 压缩算法直接获取该图片数据的压缩数据, 既合理利用了***资源, 又节约 了***的存储空间。
在本发明的又一装置实施例中, 如图 6所示, 所述数据压缩装置 600可 包括: 接收单元 601、 确定单元 602、 获取单元 603、 响应单元 604、 压缩数 据存管模块 605、 第二压缩单元 606、 分类单元 607和第一压缩单元 608, 其 中,所述压缩数据存管模块 605还可以设置于所述数据压缩装置 600的外部。
所述压缩数据存管模块 605用于保存图片数据的压缩数据集合, 所述压 缩数据集合通过图片数据的特征标识作为索引来保存不同图片数据的压缩 数据, 使得所述数据压缩装置 600可以根据图片数据的特征标识, 从所述压 缩数据存管模块 605中获取保存的该图片数据的特征标识对应的压缩数据。
所述接收单元 601用于接收数据压缩请求, 并根据所述数据压缩请求获 取待压缩的图片数据; 优选地, 所述接收单元 601可以直接获取所述数据压 缩请求中携带的待压缩的图片数据,也可以根据所述数据压缩请求中的指示 查询相关模块, 获取所述待压缩的图片数据, 其中, 所述数据压缩请求指示 对待压缩的图片数据进行压缩。
所述分类单元 607, 在所述接收单元 601接收数据压缩请求之后, 用于
确定所述待压缩的图片数据是否满足压缩加速的条件;
优选地, 所述分类单元 607可以确定压缩该图片数据所消耗的***资源 的大小, 并将所述压缩该图片数据所消耗的***资源与预设的第一阈值进行 比较, 如果是, 确定所述待压缩的图片数据满足压缩加速的条件; 或者, 确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意 之一或其任意组合: 图片数据的大小、 长宽或位深, 具体地, 所述确定所述 待压缩的图片数据的属性值是否超过第二阈值可以是确定所述待压缩的图 片数据的大小或长宽或位深是否超过所述第二阈值,还可以是确定所述待压 缩的图片数据的大小、长宽和位深是否超过所述第二阈值或者其中两个参数 值是否超过所述第二阈值, 如果是, 确定所述待压缩的图片数据满足压缩加 速的条件,所述待压缩的图片数据属于压缩消耗资源较大的图片数据,其中, 所述待压缩的图片数据的属性值可以从所述应用程序模块获取, 所述第二阈 值属于经验值, 所述第二阈值可以是一个数值, 也可以是多个数值组成的集 合; 或者,
确定所述待压缩的图片数据的复杂度是否超过第三阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 具体地, 所述确定所述待压缩 的图片数据的复杂度是否超过第三阈值可以是确定所述待压缩的图片数据 的像素的颜色数量是否超过所述第三阈值, 如果是, 确定所述待压缩的图片 数据满足压缩加速的条件, 所述待压缩的图片数据属于复杂度较高的图片数 据, 压缩该图片数据将消耗较大的***资源, 所述待压缩的图片的像素的颜 色数量可以从所述应用程序模块获取,也可以是所述数据压缩模块利用所述 待压缩的图片数据通过算法获得, 所述第三阈值属于经验值。
所述确定单元 602在所述分类单元 607确定所述待压缩的图片数据满足 压缩加速的条件时, 用于确定所述待压缩的图片数据的特征标识, 并根据所 述特征标识,确定所述压缩数据存管模块 605是否保存有所述特征标识对应
的压缩数据, 其中, 所述特征标识用于代表所述待压缩的图片数据, 特征标 识相同的图片数据具有相同的压缩数据, 所述确定单元 602确定所述待压缩 的图片数据的特征标识也可以是在所述分类单元 607确定所述待压缩的图片 数据满足压缩加速的条件之前, 具体地, 所述确定单元 602可以从所述应用 程序模块获取所述待压缩的图片数据的特征标识, 还可以是所述确定单元 602通过计算获取所述待压缩的图片数据的特征标识, 所述特征标识可以是 图像特征码, 具体表现形式可以是字符序列或数字序列。
所述获取单元 603 , 在所述确定单元确定所述压缩数据存管模块保存有 所述特征标识对应的压缩数据时, 用于根据所述特征标识, 获取所述压缩数 据存管模块 605保存的所述特征标识对应的压缩数据, 由于特征标识相同的 图片数据具有相同的压缩数据, 因此可以将所获取的所述特征标识对应的压 缩数据作为所述待压缩的图片数据的压缩数据。
所述响应单元 604用于返回携带从所述获取单元 603获取的所述特征标 识对应的压缩数据的数据压缩响应。
所述第二压缩单元 606, 在所述确定单元 602确定所述压缩数据存管模 块 605没有保存所述特征代码对应的压缩数据时, 用于采用压缩算法对所述 待压缩的图片数据进行压缩,得到所述待压缩的图片数据的压缩数据,其中, 所述压缩算法可以是有损压缩算法, 还可以是无损压缩算法, 本发明实施例 在此不作限定。
所述压缩数据存管模块 605还用于保存所述第二压缩单元 606采用压缩 算法压缩得到的压缩数据, 使得***下次需要压缩所述待压缩的图片数据 时, 可以直接从所述压缩数据存管模块 605中获取, 无需进行重复的压缩, 具体地,可以将所述经过压缩得到的压缩数据与所述待压缩的图片数据的特 征标识进行关联后再进行保存,使得通过所述特征标识能够查询到所述压缩 数据。
所述响应单元 604还用于返回携带所述第二压缩单元 606采用压缩算法
压缩得到的压缩数据的数据压缩响应。
所述第一压缩单元 608, 在所述分类单元 607确定所述待压缩的图片数 据不满足压缩加速的条件时, 用于采用压缩算法对所述待压缩的图片数据进 行压缩, 得到所述待压缩的图片数据的压缩数据, 其中, 所述压缩算法可以 是有损压缩算法, 还可以是无损压缩算法, 本发明实施例在此不作限定。
所述响应单元 604还用于返回携带所述第一压缩单元 608采用压缩算法 压缩得到的压缩数据的数据压缩响应。
在本发明实施例中, 所述确定单元 602在所述接收单元接收到数据压缩 请求之后,确定所述压缩数据存管模块 605是否保存有所述待压缩的图片数 据的压缩数据, 如果保存有, 则所述响应单元 604从所述压缩数据存管模块 605中获取保存的所述待压缩的图片数据的压缩数据,避免重复的压缩工作, 有效节约***资源, 如果没有保存, 则所述第二压缩单元 606采用压缩算法 获取所述待压缩的图片数据的压缩数据, 所述压缩数据存管模块 605将所述 第二压缩单元 606压缩得到的压缩数据进行保存, 用以完善和更新所述压缩 数据存管模块 605 , 使得下次需要该图片数据的压缩数据时, 不再重复压缩 该图片数据。
进一步, 在本发明实施例中, 所述分类单元 607在所述接收单元 601接 收到数据压缩请求之后, 用于进一步确定所述待压缩的图片数据是否满足压 缩加速的条件, 如果满足压缩加速的条件, 所述数据压缩装置 600对所述待 压缩的图片数据的压缩数据的获取过程进行加速, 即在所述确定单元 602确 定保存有所述待压缩的图片数据的特征标识对应的压缩数据时, 所述获取单 元 603直接从所述压缩数据存管模块 605中获取保存的所述特征标识对应的 压缩数据, 避免了对压缩耗费资源较大的图片数据的压缩工作, 使得该图片 数据的压缩数据的获取过程得以被加速, 更进一步的节约了***资源, 提高 了数据压缩效率。
如图 7为本发明实施例提供的数据压缩*** 700, 所述***可包括:
数据压缩装置 701 , 用于接收数据压缩请求, 所述数据压缩请求指示对 待压缩的图片数据进行压缩,确定所述待压缩的图片数据的特征标识,其中, 所述特征标识用于代表所述待压缩的图片数据,特征标识相同的图片数据具 有相同的压缩数据, 根据所述待压缩的图片数据的特征标识, 获取所述压缩 数据存管模块保存的所述特征标识对应的压缩数据, 返回数据压缩响应, 所 述数据压缩响应携带从所述压缩数据存管模块 702获取的所述特征标识对应 的压缩数据;
所述压缩数据存管模块 702, 用于保存图片数据的压缩数据集合, 所述 压缩数据集合通过所述特征标识作为索引来保存不同图片数据的压缩数据。
如图 8 , 为本发明实施例提供的计算机的结构组成示意图。 本发明实施 例的计算机 800可包括:
处理器 801、 存储器 802、 ***总线 804和通信接口 805。 处理器 801、 存储器 802和通信接口 805之间通过***总线 804连接并完成相互间的通信。
处理器 801可能为单核或多核中央处理单元, 或者为特定集成电路, 或 者为被配置成实施本发明实施例的一个或多个集成电路。
存储器 802 可以为高速 RAM 存储器, 也可以为非易失性存储器 ( non-vo la t i l e memory ), 例如至少一个磁盘存储器。
存储器 802用于计算机执行指令 803。 具体的, 计算机执行指令 703中 可以包括程序代码。
当计算机运行时, 处理器 801运行计算机执行指令 803 , 可以执行如下 方法流程:
所述方法流程具体包括: 101 : 接收数据压缩请求, 所述数据压缩请求 指示对待压缩的图片数据进行压缩。
102: 确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用 于代表所述待压缩的图片数据,特征标识相同的图片数据具有相同的压缩数 据。
103: 根据所述待压缩的图片数据的特征标识, 获取压缩数据存管模块 保存的所述特征标识对应的压缩数据。
104: 返回数据压缩响应, 所述数据压缩响应携带所获取的所述特征标 识对应的压缩数据。
所述方法流程具体还可以包括: 201 : 建立压缩数据存管模块, 所述压 缩数据存管模块用于保存图片数据的压缩数据集合。
202: 接收数据压缩请求, 根据所述数据压缩请求获取待压缩的图片数 据。
203: 确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用 于代表图片数据, 特征标识相同的图片数据具有相同的压缩数据。
204: 确定所述压缩数据存管模块是否保存有所述特征标识对应的压缩 数据, 如果确定所述压缩数据存管模块保存有所述特征标识对应的压缩数 据, 执行步骤 205 , 否则执行步骤 206。
205: 获取所述压缩数据存管模块保存的所述特征标识对应的压缩数据, 然后执行步骤 208。
206: 采用压缩算法对所述待压缩的图片数据进行压缩, 得到对应的压 缩数据, 然后执行步骤 207。
207: 将所述经过压缩得到的压缩数据在所述压缩数据存管模块中进行 保存。
优选地, 在执行所述步骤 207的保存动作之前, 还可以进一步执行如下 步骤:
207' : 确定所述待压缩的图片数据是否满足压缩加速的条件, 如果满 足所述压缩加速的条件, 执行步骤 207, 否则执行步骤 208。
208: 返回数据压缩响应, 所述数据压缩响应携带所述待压缩的图片数 据的压缩数据。
所述方法流程具体还可以包括:
301 : 建立压缩数据存管模块, 所述压缩数据存管模块用于保存图片数 据的压缩数据集合。
302: 接收数据压缩请求, 根据所述数据压缩请求获取待压缩的图片数 据。
303: 确定所述待压缩的图片数据是否满足压缩加速的条件, 如果满足 压缩加速的条件, 执行步骤 304, 否则执行步骤 309。
304: 确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用 于代表图片数据, 特征标识相同的图片数据具有相同的压缩数据。
305: 确定所述压缩数据存管模块是否保存有所述特征标识对应的压缩 数据, 如果确定所述压缩数据存管模块保存有所述特征标识对应的压缩数 据, 执行步骤 306, 否则执行步骤 307。
306: 获取从所述压缩数据存管模块中保存的所述特征标识对应的压缩 数据, 然后执行步骤 309。
307: 采用压缩算法对所述待压缩的图片数据进行压缩, 得到对应的压 缩数据, 然后执行步骤 308。
308: 将所述经过压缩得到的压缩数据在所述压缩数据存管模块中进行 保存, 然后执行步骤 310。
309: 采用压缩算法对所述待压缩的图片数据进行压缩, 得到对应的压 缩数据, 然后执行步骤 310。
310: 返回数据压缩响应, 所述数据压缩响应携带所述待压缩的图片数 据的压缩数据。
本领域普通技术人员将会理解, 本发明的各个方面、 或各个方面的可能 实现方式可以被具体实施为***、 方法或者计算机程序产品。 因此, 本发明 的各方面、 或各个方面的可能实现方式可以采用完全硬件实施例、 完全软件 实施例 (包括固件、驻留软件等等), 或者组合软件和硬件方面的实施例的形 式, 在这里都统称为"电路"、 "模块 "或者 "***"。 此外, 本发明的各方面、
或各个方面的可能实现方式可以采用计算机程序产品的形式,计算机程序产 品是指存储在计算机可读介质中的计算机可读程序代码。
计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。 计算机可读存储介质包含但不限于电子、 磁性、 光学、 电磁、 红外或半导体 ***、 设备或者装置, 或者前述的任意适当组合, 如随机存取存储器 (RAM), 只读存储器 (ROM)、 可擦除可编程只读存储器 (EPROM 或者快闪 存储器)、 光纤、 便携式只读存储器 (CD-ROM)。
计算机中的处理器读取存储在计算机可读介质中的计算机可读程序代 码, 使得处理器能够执行在流程图中每个步骤、 或各步骤的组合中规定的功 能动作;生成实施在框图的每一块、或各块的组合中规定的功能动作的装置。
计算机可读程序代码可以完全在用户的计算机上执行、部分在用户的计 算机上执行、 作为单独的软件包、 部分在用户的计算机上并且部分在远程计 算机上, 或者完全在远程计算机或者服务器上执行。 也应该注意, 在某些替 代实施方案中, 在流程图中各步骤、 或框图中各块所注明的功能可能不按图 中注明的顺序发生。 例如, 依赖于所涉及的功能, 接连示出的两个步骤、 或 两个块实际上可能被大致同时执行, 或者这些块有时候可能被以相反顺序执 行。
本领域普通技术人员可以意识到, 结合本文中所公开的实施例描述的各 示例的单元及算法步骤, 能够以电子硬件、 或者计算机软件和电子硬件的结 合来实现。 这些功能究竟以硬件还是软件方式来执行, 取决于技术方案的特 定应用和设计约束条件。 专业技术人员可以对每个特定的应用来使用不同方 法来实现所描述的功能, 但是这种实现不应认为超出本发明的范围。
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不局限 于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可轻易 想到变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本发明的保护 范围应所述以权利要求的保护范围为准。
Claims
1、 一种数据压缩的方法, 其特征在于, 包括:
接收数据压缩请求, 所述数据压缩请求指示对待压缩的图片数据进行压 缩;
确定所述待压缩的图片数据的特征标识, 其中, 所述特征标识用于代表 所述待压缩的图片数据, 特征标识相同的图片数据具有相同的压缩数据; 根据所述待压缩的图片数据的特征标识,获取压缩数据存管模块保存的 所述特征标识对应的压缩数据;
返回数据压缩响应, 所述数据压缩响应携带从所述压缩数据存管模块获 取的所述特征标识对应的压缩数据。
2、 根据权利要求 1所述的方法, 其特征在于, 所述确定所述待压缩的 图片数据的特征标识包括:
计算所述待压缩的图片数据的特征标识,所述特征标识包括循环冗余码 或者海明码。
3、 根据权利要求 2所述的方法, 其特征在于, 所述计算所述待压缩的 图片数据的特征标识包括:
提取所述待压缩的图片数据的每帧图片数据;
计算所述每帧图片数据的特征标识。
4、 根据权利要求 1所述的方法, 其特征在于, 所述方法还包括: 确定所述待压缩的图片数据是否满足压缩加速的条件,如果满足所述压 缩加速的条件, 则执行所述根据所述待压缩的图片数据的特征标识, 获取压 缩数据存管模块保存的所述特征标识对应的压缩数据的步骤。
5、 根据权利要求 4所述的方法, 其特征在于, 所述确定所述待压缩的 图片数据是否满足压缩加速的条件, 包括:
确定对所述待压缩的图片数据进行压缩所耗费的资源是否超过第一阈 值, 如果是, 确定所述待压缩的图片数据满足压缩加速的条件; 或者,
确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意 之一或其任意组合: 图片数据的大小、 长宽或位深; 或者,
确定所述待压缩的图片数据的复杂度是否超过第三阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件。
6、 根据权利要求 4所述的方法, 其特征在于, 如果所述待压缩的图片 数据不满足压缩加速的条件, 所述方法还包括:
对所述待压缩的图片数据采用压缩算法进行压缩;
返回数据压缩响应, 所述数据压缩响应携带所述采用压缩算法压缩得到 的压缩数据。
7、 根据权利要求 1-5任意一项所述的方法, 其特征在于, 还包括: 建立所述压缩数据存管模块, 其中, 所述压缩数据存管模块用于保存图 片数据的压缩数据集合, 所述压缩数据集合通过所述特征标识作为索引来保 存不同图片数据的压缩数据。
8、 根据权利要求 7所述的方法, 其特征在于, 所述根据所述待压缩的 图片数据的特征标识, 获取压缩数据存管模块保存的所述特征标识对应的压 缩数据之前, 还包括:
确定所述压缩数据存管模块是否保存所述特征标识对应的压缩数据,如 果是, 则执行所述根据所述待压缩的图片数据的特征标识, 获取压缩数据存 管模块保存的所述特征标识对应的压缩数据的步骤。
9、 根据权利要求 8所述的方法, 其特征在于, 如果确定所述压缩数据 存管模块未保存所述特征标识对应的压缩数据, 所述方法还包括:
对所述待压缩的图片数据采用压缩算法进行压缩;
返回数据压缩响应, 所述数据压缩响应携带所述采用压缩算法压缩得到 的压缩数据。
10、 根据权利要求 9所述的方法, 其特征在于, 所述方法还包括:
将所述采用压缩算法压缩得到的压缩数据和所述待压缩的图片数据的 特征标识保存到所述压缩数据存管模块。
11、 一种数据压缩的装置, 其特征在于, 包括:
接收单元, 用于接收数据压缩请求, 所述数据压缩请求指示对待压缩的 图片数据进行压缩;
确定单元, 用于确定所述待压缩的图片数据的特征标识, 其中, 所述特 征标识用于代表所述待压缩的图片数据,特征标识相同的图片数据具有相同 的压缩数据;
获取单元, 用于根据所述确定单元确定的所述待压缩的图片数据的特征 标识, 获取压缩数据存管模块保存的所述特征标识对应的压缩数据;
响应单元, 用于返回数据压缩响应, 所述数据压缩响应携带从所述压缩 数据存管模块获取的所述特征标识对应的压缩数据。
12、 根据权利要求 11所述的装置, 其特征在于, 所述确定单元具体用 于:
计算所述待压缩的图片数据的特征标识,所述特征标识包括循环冗余码 或者海明码。
13、 根据权利要求 12所述的装置, 其特征在于, 所述确定单元具体用 于:
提取所述待压缩的图片数据的每帧图片数据;
计算所述每帧图片数据的特征标识。
14、 根据权利要求 11所述的装置, 其特征在于, 所述装置还包括: 分类单元, 用于确定所述待压缩的图片数据是否满足压缩加速的条件; 在所述分类单元确定所述待压缩的图片数据满足所述压缩加速的条件 时, 所述获取单元具体用于根据所述待压缩的图片数据的特征标识, 获取所 述压缩数据存管模块保存的所述特征标识对应的压缩数据。
15、 根据权利要求 14所述的装置, 其特征在于, 所述分类单元具体用
于:
确定对所述待压缩的图片数据进行压缩所耗费的资源是否超过第一阈 值, 如果是, 确定所述待压缩的图片数据满足压缩加速的条件; 或者,
确定所述待压缩的图片数据的属性值是否超过第二阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件, 所述属性值包括以下因素任意 之一或其任意组合: 图片数据的大小、 长宽或位深; 或者,
确定所述待压缩的图片数据的复杂度是否超过第三阈值, 如果是, 确定 所述待压缩的图片数据满足压缩加速的条件。
16、 根据权利要求 14所述的装置, 其特征在于, 所述装置还包括: 第一压缩单元,在所述分类单元确定所述待压缩的图片数据不满足压缩 加速的条件时, 用于对所述待压缩的图片数据采用压缩算法进行压缩;
所述响应单元还用于返回携带所述第一压缩单元采用压缩算法压缩得 到的压缩数据的数据压缩响应。
17、 根据权利要求 11-16任意一项所述的装置, 其特征在于, 所述压缩 数据存管模块设置于所述数据压缩的装置内部或者外部, 用于保存图片数据 的压缩数据集合, 所述压缩数据集合通过所述特征标识作为索引来保存不同 图片数据的压缩数据。
18、 根据权利要求 17所述的装置, 其特征在于, 所述确定单元还用于: 确定所述压缩数据存管模块是否保存所述特征标识对应的压缩数据; 存有所述特征标识对应的压缩数据时,根据所述待压缩的图片数据的特征标 识, 获取所述压缩数据存管模块保存的所述特征标识对应的压缩数据。
19、 根据权利要求 18所述的装置, 其特征在于, 所述装置还包括: 第二压缩单元, 用于在所述确定单元确定所述压缩数据存管模块未保存 所述特征标识对应的压缩数据时,对所述待压缩的图片数据采用压缩算法进 行压缩;
所述响应单元还用于返回携带所述第二压缩单元采用压缩算法压缩得 到的压缩数据的数据压缩响应。
20、 根据权利要求 19所述的装置, 其特征在于, 所述第二压缩单元还 用于:
将所述采用压缩算法压缩得到的压缩数据和所述待压缩的图片数据的 特征标识保存到所述压缩数据存管模块。
21、 一种数据压缩***, 其特征在于, 包括:
数据压缩装置, 用于接收数据压缩请求, 所述数据压缩请求指示对待压 缩的图片数据进行压缩, 确定所述待压缩的图片数据的特征标识, 其中, 所 述特征标识用于代表所述待压缩的图片数据,特征标识相同的图片数据具有 相同的压缩数据, 根据所述待压缩的图片数据的特征标识, 获取压缩数据存 管模块保存的所述特征标识对应的压缩数据, 返回数据压缩响应, 所述数据 压缩响应携带从所述压缩数据存管模块获取的所述特征标识对应的压缩数 据;
所述压缩数据存管模块, 用于保存图片数据的压缩数据集合, 所述压缩 数据集合通过所述特征标识作为索引来保存不同图片数据的压缩数据。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310356700.XA CN104376584B (zh) | 2013-08-15 | 2013-08-15 | 一种数据压缩的方法、计算机***和装置 |
CN201310356700.X | 2013-08-15 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2015021753A1 true WO2015021753A1 (zh) | 2015-02-19 |
Family
ID=52467988
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2014/070865 WO2015021753A1 (zh) | 2013-08-15 | 2014-01-20 | 一种数据压缩的方法、计算机***和装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN104376584B (zh) |
WO (1) | WO2015021753A1 (zh) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106157337B (zh) * | 2015-04-09 | 2020-10-13 | 腾讯科技(深圳)有限公司 | 图片分析方法及分析*** |
CN106383670B (zh) * | 2016-09-21 | 2020-02-14 | 华为技术有限公司 | 一种数据处理方法及存储设备 |
CN109716660B (zh) * | 2017-01-24 | 2021-08-13 | 华为技术有限公司 | 数据压缩装置和方法 |
CN108933945B (zh) * | 2018-08-17 | 2020-06-19 | 腾讯科技(深圳)有限公司 | 一种gif图片的压缩方法、装置及存储介质 |
CN112084155B (zh) * | 2020-09-09 | 2024-03-22 | 深圳市欢太科技有限公司 | 图片处理方法、装置、设备、终端及可读存储介质 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102143183A (zh) * | 2011-03-24 | 2011-08-03 | 镇江星浪科技产品有限公司 | 一种文档版本化的方法 |
CN103136243A (zh) * | 2011-11-29 | 2013-06-05 | 中国电信股份有限公司 | 基于云存储的文件***去重方法及装置 |
CN103227818A (zh) * | 2013-03-27 | 2013-07-31 | 福建伊时代信息科技股份有限公司 | 终端、服务器、文件传输方法、文件存储管理***和方法 |
CN103237040A (zh) * | 2012-03-19 | 2013-08-07 | 天津书生投资有限公司 | 一种存储方法、服务器和客户端 |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110188763A1 (en) * | 2010-01-29 | 2011-08-04 | Nenad Rijavec | Image Header Compression Mechanism |
CN102982046B (zh) * | 2011-09-07 | 2017-09-26 | ***通信集团公司 | 一种网页数据压缩存储方法和*** |
-
2013
- 2013-08-15 CN CN201310356700.XA patent/CN104376584B/zh active Active
-
2014
- 2014-01-20 WO PCT/CN2014/070865 patent/WO2015021753A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102143183A (zh) * | 2011-03-24 | 2011-08-03 | 镇江星浪科技产品有限公司 | 一种文档版本化的方法 |
CN103136243A (zh) * | 2011-11-29 | 2013-06-05 | 中国电信股份有限公司 | 基于云存储的文件***去重方法及装置 |
CN103237040A (zh) * | 2012-03-19 | 2013-08-07 | 天津书生投资有限公司 | 一种存储方法、服务器和客户端 |
CN103227818A (zh) * | 2013-03-27 | 2013-07-31 | 福建伊时代信息科技股份有限公司 | 终端、服务器、文件传输方法、文件存储管理***和方法 |
Also Published As
Publication number | Publication date |
---|---|
CN104376584A (zh) | 2015-02-25 |
CN104376584B (zh) | 2018-02-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6316974B2 (ja) | フラッシュメモリ圧縮 | |
CN109918205B (zh) | 一种边缘设备调度方法、***、装置及计算机存储介质 | |
WO2017028697A1 (zh) | 计算机集群的扩容和缩容方法及设备 | |
WO2015021753A1 (zh) | 一种数据压缩的方法、计算机***和装置 | |
WO2022110444A1 (zh) | 云原生资源动态预测方法、装置、计算机设备及存储介质 | |
WO2018223786A1 (zh) | 云桌面***、及其图像序列压缩编码方法和介质 | |
WO2019109518A1 (zh) | 一种数据列表的上传方法及其终端 | |
US8438275B1 (en) | Formatting data for efficient communication over a network | |
CN104899204B (zh) | 数据存储方法及装置 | |
CN107146623B (zh) | 基于人工智能的语音识别方法、装置和*** | |
CN111813573B (zh) | 管理平台与机器人软件的通信方法及其相关设备 | |
CN104965676B (zh) | 一种随机存取存储器的访问方法、装置及控制芯片 | |
CN106685429B (zh) | 整数压缩方法及装置 | |
CN115567589B (zh) | Json数据的压缩传输方法、装置、设备及存储介质 | |
WO2015013981A1 (zh) | 一种图像显示方法和装置 | |
WO2023169274A1 (zh) | 数据处理方法、装置、存储介质以及处理器 | |
CN113238912A (zh) | 一种网络安全日志数据的聚合处理方法 | |
CN109788251B (zh) | 视频处理方法、装置及存储介质 | |
US11755540B2 (en) | Chunking method and apparatus | |
WO2014075564A1 (zh) | 图片压缩方法及装置 | |
WO2015090044A1 (zh) | 一种数据扫描的方法及装置 | |
CN113395523A (zh) | 基于并行线程的图像解码方法、装置、设备及存储介质 | |
CN110879749A (zh) | 一种实时转码任务的调度方法及调度装置 | |
CN111966647A (zh) | 一种小文件的云存储方法、装置、服务器及存储介质 | |
CN112084210A (zh) | 数据处理方法、装置、电子设备及存储介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 14836109 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 14836109 Country of ref document: EP Kind code of ref document: A1 |